aboutsummaryrefslogtreecommitdiffstats
path: root/xeth
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
parent6488a392a347d0d47212fdc78386e3e0e5841d7d (diff)
downloadgo-tangerine-0031f388ac1f6f4a23c5c75e5eeb4a007f0b2f31.tar
go-tangerine-0031f388ac1f6f4a23c5c75e5eeb4a007f0b2f31.tar.gz
go-tangerine-0031f388ac1f6f4a23c5c75e5eeb4a007f0b2f31.tar.bz2
go-tangerine-0031f388ac1f6f4a23c5c75e5eeb4a007f0b2f31.tar.lz
go-tangerine-0031f388ac1f6f4a23c5c75e5eeb4a007f0b2f31.tar.xz
go-tangerine-0031f388ac1f6f4a23c5c75e5eeb4a007f0b2f31.tar.zst
go-tangerine-0031f388ac1f6f4a23c5c75e5eeb4a007f0b2f31.zip
More dapp samples
* Info DApp, coin DApp * Additional rpc methods
Diffstat (limited to 'xeth')
-rw-r--r--xeth/types.go19
-rw-r--r--xeth/world.go2
2 files changed, 16 insertions, 5 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"`
diff --git a/xeth/world.go b/xeth/world.go
index cdceec50d..9cbdd9461 100644
--- a/xeth/world.go
+++ b/xeth/world.go
@@ -11,7 +11,7 @@ func NewState(xeth *XEth) *State {
}
func (self *State) State() *state.StateDB {
- return self.xeth.chainManager.State()
+ return self.xeth.chainManager.TransState()
}
func (self *State) Get(addr string) *Object {