package util import ( "strconv" "strings" ) type JsonRpcResponseGetter struct { m map[string]interface{} } func NewJsonRpcResponseGetter(result interface{}) JsonRpcResponseGetter { return JsonRpcResponseGetter{m: result.(map[string]interface{})} } func (this JsonRpcResponseGetter) GetString(key string) string { return this.m[key].(string) } func (this JsonRpcResponseGetter) GetUint64(key string) uint64 { str := this.m[key].(string) if strings.HasPrefix(str, "0x") { str = str[2:] } ret, err := strconv.ParseUint(str, 16, 64) if err != nil { panic(err) } return ret }