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