forked from cerc-io/plugeth
Convert to hex
This commit is contained in:
parent
c7ee9844bd
commit
ace551030f
@ -221,15 +221,16 @@ func (self *PStateObject) EachStorage(cb ethtrie.EachCallback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type KeyVal struct {
|
type KeyVal struct {
|
||||||
Key string
|
Key string `json:"key"`
|
||||||
Value string
|
Value string `json:"value"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *PStateObject) StateKeyVal(asJson bool) interface{} {
|
func (c *PStateObject) StateKeyVal(asJson bool) interface{} {
|
||||||
var values []KeyVal
|
var values []KeyVal
|
||||||
if c.object != nil {
|
if c.object != nil {
|
||||||
c.object.EachStorage(func(name string, value *ethutil.Value) {
|
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 {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
fmt.Println(string(valuesJson))
|
|
||||||
return string(valuesJson)
|
return string(valuesJson)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user