func call(data string, to string) interface{} { callArgs := `[{ "to": "` + to + `", "data": "` + data + `" }]` // fmt.Println(callArgs) res := web3.Call("eth_call", callArgs) errStr := res.Get("error").MustString() if errStr != "" { fmt.Println("Error: " + errStr) pp(res) } resp := res.Get("result").MustString() return resp }
func getBalance(address string) string { pp(web3.Call("eth_getBalance", "[\""+address+"\"]").Get("result")) res := web3.Call("eth_getBalance", "[\""+address+"\"]").Get("result").MustString() return res }
func accounts() []interface{} { res := web3.Call("eth_accounts").Get("result").MustArray() return res }
func coinbase() string { res := web3.Call("eth_coinbase").Get("result").MustString() return res }
func compile(contract string) *simplejson.Json { // TODO: compile with solc res := web3.Call("eth_compileSolidity", `["`+contract+`"]`).Get("result") return res }