From 53cf550249b61b158b11ac1239180c9773ee87ec Mon Sep 17 00:00:00 2001 From: Apisit Toompakdee Date: Tue, 20 Feb 2018 14:05:25 +0900 Subject: [PATCH] nep9 without attr for gomobile --- dep.sh | 1 + neoutils/utils.go | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 dep.sh diff --git a/dep.sh b/dep.sh new file mode 100644 index 0000000..04caed3 --- /dev/null +++ b/dep.sh @@ -0,0 +1 @@ +go get github.com/o3labs/nep9-go \ No newline at end of file diff --git a/neoutils/utils.go b/neoutils/utils.go index 80b494b..6debb08 100644 --- a/neoutils/utils.go +++ b/neoutils/utils.go @@ -80,6 +80,20 @@ func ConvertByteArrayToBigInt(hexString string) *big.Int { return v } -func ParseNEP9URI(uri string) (*nep9.NEP9, error) { - return nep9.ParseNEP9URI(uri) +type SimplifiedNEP9 struct { + To string `json:"to"` + AssetID string `json:"assetID"` + Amount float64 `json:"amount"` +} + +func ParseNEP9URI(uri string) (*SimplifiedNEP9, error) { + parsed, err := nep9.ParseNEP9URI(uri) + if err != nil { + return nil, err + } + return &SimplifiedNEP9{ + To: parsed.To, + AssetID: parsed.AssetID, + Amount: parsed.Amount, + }, nil }