aboutsummaryrefslogtreecommitdiffstats
path: root/xeth/types.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-01-30 03:39:26 +0800
committerobscuren <geffobscura@gmail.com>2015-01-30 03:39:26 +0800
commit0031f388ac1f6f4a23c5c75e5eeb4a007f0b2f31 (patch)
tree05a525e94ee55bd9c4a84301989176d40d76cb61 /xeth/types.go
parent6488a392a347d0d47212fdc78386e3e0e5841d7d (diff)
downloaddexon-0031f388ac1f6f4a23c5c75e5eeb4a007f0b2f31.tar.gz
dexon-0031f388ac1f6f4a23c5c75e5eeb4a007f0b2f31.tar.zst
dexon-0031f388ac1f6f4a23c5c75e5eeb4a007f0b2f31.zip
More dapp samples
* Info DApp, coin DApp * Additional rpc methods
Diffstat (limited to 'xeth/types.go')
-rw-r--r--xeth/types.go19
1 files changed, 15 insertions, 4 deletions
diff --git a/xeth/types.go b/xeth/types.go
index 4d8543eb1..bee730ba1 100644
--- a/xeth/types.go
+++ b/xeth/types.go
@@ -35,20 +35,31 @@ func NewObject(state *state.StateObject) *Object {
func (self *Object) StorageString(str string) *ethutil.Value {
if ethutil.IsHex(str) {
- return self.Storage(ethutil.Hex2Bytes(str[2:]))
+ return self.storage(ethutil.Hex2Bytes(str[2:]))
} else {
- return self.Storage(ethutil.RightPadBytes([]byte(str), 32))
+ return self.storage(ethutil.RightPadBytes([]byte(str), 32))
}
}
func (self *Object) StorageValue(addr *ethutil.Value) *ethutil.Value {
- return self.Storage(addr.Bytes())
+ return self.storage(addr.Bytes())
}
-func (self *Object) Storage(addr []byte) *ethutil.Value {
+func (self *Object) storage(addr []byte) *ethutil.Value {
return self.StateObject.GetStorage(ethutil.BigD(addr))
}
+func (self *Object) Storage() (storage map[string]string) {
+ storage = make(map[string]string)
+
+ it := self.StateObject.Trie().Iterator()
+ for it.Next() {
+ storage[toHex(it.Key)] = toHex(it.Value)
+ }
+
+ return
+}
+
// Block interface exposed to QML
type Block struct {
//Transactions string `json:"transactions"`