aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-08-15 07:08:23 +0800
committerobscuren <geffobscura@gmail.com>2014-08-15 07:08:23 +0800
commitace551030fbe9288d0d8660f9431867a42e98c88 (patch)
tree9fd27fe0b1c15e823960f55e70672bda1da84f5b
parentc7ee9844bd6f8ed2bb466f8adf21f437ecc83564 (diff)
downloaddexon-ace551030fbe9288d0d8660f9431867a42e98c88.tar
dexon-ace551030fbe9288d0d8660f9431867a42e98c88.tar.gz
dexon-ace551030fbe9288d0d8660f9431867a42e98c88.tar.bz2
dexon-ace551030fbe9288d0d8660f9431867a42e98c88.tar.lz
dexon-ace551030fbe9288d0d8660f9431867a42e98c88.tar.xz
dexon-ace551030fbe9288d0d8660f9431867a42e98c88.tar.zst
dexon-ace551030fbe9288d0d8660f9431867a42e98c88.zip
Convert to hex
-rw-r--r--ethpub/types.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/ethpub/types.go b/ethpub/types.go
index faf75bbe1..159f7d9a7 100644
--- a/ethpub/types.go
+++ b/ethpub/types.go
@@ -221,15 +221,16 @@ func (self *PStateObject) EachStorage(cb ethtrie.EachCallback) {
}
type KeyVal struct {
- Key string
- Value string
+ Key string `json:"key"`
+ Value string `json:"value"`
}
func (c *PStateObject) StateKeyVal(asJson bool) interface{} {
var values []KeyVal
if c.object != nil {
c.object.EachStorage(func(name string, value *ethutil.Value) {
- values = append(values, KeyVal{name, ethutil.Bytes2Hex(value.Bytes())})
+ value.Decode()
+ values = append(values, KeyVal{ethutil.Bytes2Hex([]byte(name)), ethutil.Bytes2Hex(value.Bytes())})
})
}
@@ -238,7 +239,7 @@ func (c *PStateObject) StateKeyVal(asJson bool) interface{} {
if err != nil {
return nil
}
- fmt.Println(string(valuesJson))
+
return string(valuesJson)
}