示例#1
0
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
}
示例#2
0
func getBalance(address string) string {
	pp(web3.Call("eth_getBalance", "[\""+address+"\"]").Get("result"))
	res := web3.Call("eth_getBalance", "[\""+address+"\"]").Get("result").MustString()
	return res
}
示例#3
0
func accounts() []interface{} {
	res := web3.Call("eth_accounts").Get("result").MustArray()
	return res
}
示例#4
0
func coinbase() string {
	res := web3.Call("eth_coinbase").Get("result").MustString()
	return res
}
示例#5
0
func compile(contract string) *simplejson.Json {
	//  TODO: compile with solc
	res := web3.Call("eth_compileSolidity", `["`+contract+`"]`).Get("result")
	return res
}