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

Commit

Permalink
Formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Wyatt Mufson committed Jan 29, 2019
1 parent 1afcc06 commit cab3b8c
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions neoutils/ont_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package neoutils_test

import (
"encoding/json"
"log"
"math"
"testing"
"encoding/json"

"github.com/o3labs/neo-utils/neoutils"
)
Expand All @@ -14,7 +14,7 @@ type parameterJSONArrayForm struct {
}

type parameterJSONForm struct {
T string `json:"type"`
T string `json:"type"`
V interface{} `json:"value"`
}

Expand Down Expand Up @@ -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 := &parameterJSONArrayForm{A: []parameterJSONForm{addr, val}}
argData, _ := json.Marshal(jsondat)
jsondat := &parameterJSONArrayForm{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) {
Expand All @@ -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 := &parameterJSONArrayForm{A: []parameterJSONForm{addr, val}}
argData, _ := json.Marshal(jsondat)
jsondat := &parameterJSONArrayForm{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)
}
}
}

0 comments on commit cab3b8c

Please sign in to comment.