Skip to content
This repository has been archived by the owner on Jan 25, 2021. It is now read-only.

Commit

Permalink
added parse nep9
Browse files Browse the repository at this point in the history
  • Loading branch information
apisit committed Feb 20, 2018
1 parent 9f363c7 commit 67a91b9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions neoutils/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import (

func TestFetchBlockCount(t *testing.T) {
url := "http://seed2.neo.org:10332/"
res := FetchSeedNode(url)
res := fetchSeedNode(url)
log.Printf("%v", res)
}

func TestFetchDownNodeBlockCount(t *testing.T) {
url := "http://seed1.cityofzion.io:8080"
res := FetchSeedNode(url)
res := fetchSeedNode(url)
log.Printf("%v", res)
}

Expand Down
1 change: 1 addition & 0 deletions neoutils/scriptbuilder.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package neoutils
5 changes: 5 additions & 0 deletions neoutils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"math/big"

nep9 "github.com/o3labs/NEP9-go"
"github.com/o3labs/neo-utils/neoutils/btckey"
)

Expand Down Expand Up @@ -78,3 +79,7 @@ func ConvertByteArrayToBigInt(hexString string) *big.Int {
v, _ := new(big.Int).SetString(reversedHex, 16)
return v
}

func ParseNEP9URI(uri string) (*nep9.NEP9, error) {
return nep9.ParseNEP9URI(uri)
}
11 changes: 11 additions & 0 deletions neoutils/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,14 @@ func TestConverting(t *testing.T) {

log.Printf("%v", value)
}

func TestParseNEP9(t *testing.T) {
uri := "neo:AeNkbJdiMx49kBStQdDih7BzfDwyTNVRfb?assetID=602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7&amount=0.11&description=for%20a%20coffee"
nep9, err := ParseNEP9URI(uri)
if err != nil {
log.Printf("%v", err)
t.Fail()
return
}
log.Printf("%+v", nep9)
}

0 comments on commit 67a91b9

Please sign in to comment.