diff --git a/neoutils/ont_test.go b/neoutils/ont_test.go index 1320acb..5a82068 100644 --- a/neoutils/ont_test.go +++ b/neoutils/ont_test.go @@ -1,10 +1,10 @@ package neoutils_test import ( + "encoding/json" "log" "math" "testing" - "encoding/json" "github.com/o3labs/neo-utils/neoutils" ) @@ -14,7 +14,7 @@ type parameterJSONArrayForm struct { } type parameterJSONForm struct { - T string `json:"type"` + T string `json:"type"` V interface{} `json:"value"` } @@ -66,26 +66,26 @@ func TestBuildOntologyInvocation(t *testing.T) { return } - account, _ := neoutils.GenerateFromWIF(wif) - address := account.Address + account, _ := neoutils.GenerateFromWIF(wif) + address := account.Address addr := parameterJSONForm{T: "Address", V: address} - val := parameterJSONForm{T: "String", V: "Hi there"} + val := parameterJSONForm{T: "String", V: "Hi there"} - jsondat := ¶meterJSONArrayForm{A: []parameterJSONForm{addr, val}} - argData, _ := json.Marshal(jsondat) + jsondat := ¶meterJSONArrayForm{A: []parameterJSONForm{addr, val}} + argData, _ := json.Marshal(jsondat) argString := string(argData) - gasPrice := int(500) - gasLimit := int(20000) + gasPrice := int(500) + gasLimit := int(20000) - txData, err := neoutils.BuildOntologyInvocationTransaction("c168e0fb1a2bddcd385ad013c2c98358eca5d4dc", "put", argString, gasPrice, gasLimit, wif) - if err != nil { - log.Printf("Error creating invocation transaction: %s", err) - t.Fail() - } else { - log.Printf("Raw transaction: %s", txData) - } + txData, err := neoutils.BuildOntologyInvocationTransaction("c168e0fb1a2bddcd385ad013c2c98358eca5d4dc", "put", argString, gasPrice, gasLimit, wif) + if err != nil { + log.Printf("Error creating invocation transaction: %s", err) + t.Fail() + } else { + log.Printf("Raw transaction: %s", txData) + } } func TestOntologyInvoke(t *testing.T) { @@ -95,26 +95,26 @@ func TestOntologyInvoke(t *testing.T) { return } - account, _ := neoutils.GenerateFromWIF(wif) - address := account.Address + account, _ := neoutils.GenerateFromWIF(wif) + address := account.Address addr := parameterJSONForm{T: "Address", V: address} - val := parameterJSONForm{T: "String", V: "Hi there"} + val := parameterJSONForm{T: "String", V: "Hi there"} - jsondat := ¶meterJSONArrayForm{A: []parameterJSONForm{addr, val}} - argData, _ := json.Marshal(jsondat) + jsondat := ¶meterJSONArrayForm{A: []parameterJSONForm{addr, val}} + argData, _ := json.Marshal(jsondat) argString := string(argData) - gasPrice := int(500) - gasLimit := int(20000) + gasPrice := int(500) + gasLimit := int(20000) endpoint := "http://polaris2.ont.io:20336" - txid, err := neoutils.OntologyInvoke(endpoint, "c168e0fb1a2bddcd385ad013c2c98358eca5d4dc", "put", argString, gasPrice, gasLimit, wif) - if err != nil { - log.Printf("Error creating invocation transaction: %s", err) - t.Fail() - } else { + txid, err := neoutils.OntologyInvoke(endpoint, "c168e0fb1a2bddcd385ad013c2c98358eca5d4dc", "put", argString, gasPrice, gasLimit, wif) + if err != nil { + log.Printf("Error creating invocation transaction: %s", err) + t.Fail() + } else { log.Printf("tx id = %s", txid) - } + } }