From 148de1c8757413f171dbf2fd3e8e5a5976eb7dc9 Mon Sep 17 00:00:00 2001 From: zelig Date: Sun, 14 Dec 2014 18:09:33 +0000 Subject: adapt xeth pkg to new backend. FIXME JSPeer peer info --- xeth/world.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'xeth/world.go') diff --git a/xeth/world.go b/xeth/world.go index 956ef1e15..008a08423 100644 --- a/xeth/world.go +++ b/xeth/world.go @@ -1,8 +1,7 @@ package xeth import ( - "container/list" - + "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/state" ) @@ -55,7 +54,7 @@ func (self *World) IsListening() bool { return self.pipe.obj.IsListening() } -func (self *World) Peers() *list.List { +func (self *World) Peers() []*p2p.Peer { return self.pipe.obj.Peers() } -- cgit v1.2.3 From fed3e6a808921fb8274b50043c5c39a24a1bbccf Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 7 Jan 2015 13:17:48 +0100 Subject: Refactored ethutil.Config.Db out --- xeth/world.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'xeth/world.go') diff --git a/xeth/world.go b/xeth/world.go index 008a08423..25c2f3eb8 100644 --- a/xeth/world.go +++ b/xeth/world.go @@ -36,7 +36,7 @@ func (self *World) SafeGet(addr []byte) *Object { func (self *World) safeGet(addr []byte) *state.StateObject { object := self.State().GetStateObject(addr) if object == nil { - object = state.NewStateObject(addr) + object = state.NewStateObject(addr, self.pipe.obj.Db()) } return object -- cgit v1.2.3 From 7f638f0b2d8d989be25e660178d79df3278e4c84 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 28 Jan 2015 18:14:28 +0100 Subject: moving to a better xeth --- xeth/world.go | 57 +++++++++++++-------------------------------------------- 1 file changed, 13 insertions(+), 44 deletions(-) (limited to 'xeth/world.go') diff --git a/xeth/world.go b/xeth/world.go index 25c2f3eb8..60d4bbb57 100644 --- a/xeth/world.go +++ b/xeth/world.go @@ -1,63 +1,32 @@ package xeth -import ( - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/state" -) - -type World struct { - pipe *XEth - cfg *Config -} - -func NewWorld(pipe *XEth) *World { - world := &World{pipe, nil} - world.cfg = &Config{pipe} +import "github.com/ethereum/go-ethereum/state" - return world +type State struct { + xeth *JSXEth } -func (self *XEth) World() *World { - return self.world +func NewState(xeth *JSXEth) *State { + return &State{xeth} } -func (self *World) State() *state.StateDB { - return self.pipe.chainManager.State() +func (self *State) State() *state.StateDB { + return self.xeth.chainManager.State() } -func (self *World) Get(addr []byte) *Object { - return &Object{self.State().GetStateObject(addr)} +func (self *State) Get(addr string) *Object { + return &Object{self.State().GetStateObject(fromHex(addr))} } -func (self *World) SafeGet(addr []byte) *Object { +func (self *State) SafeGet(addr string) *Object { return &Object{self.safeGet(addr)} } -func (self *World) safeGet(addr []byte) *state.StateObject { - object := self.State().GetStateObject(addr) +func (self *State) safeGet(addr string) *state.StateObject { + object := self.State().GetStateObject(fromHex(addr)) if object == nil { - object = state.NewStateObject(addr, self.pipe.obj.Db()) + object = state.NewStateObject(fromHex(addr), self.xeth.eth.Db()) } return object } - -func (self *World) Coinbase() *state.StateObject { - return nil -} - -func (self *World) IsMining() bool { - return self.pipe.obj.IsMining() -} - -func (self *World) IsListening() bool { - return self.pipe.obj.IsListening() -} - -func (self *World) Peers() []*p2p.Peer { - return self.pipe.obj.Peers() -} - -func (self *World) Config() *Config { - return self.cfg -} -- cgit v1.2.3 From 872b2497114209119becf2e8a4d4a5818e2084ee Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 28 Jan 2015 18:35:49 +0100 Subject: further cleaned up xeth interface --- xeth/world.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'xeth/world.go') diff --git a/xeth/world.go b/xeth/world.go index 60d4bbb57..cdceec50d 100644 --- a/xeth/world.go +++ b/xeth/world.go @@ -3,10 +3,10 @@ package xeth import "github.com/ethereum/go-ethereum/state" type State struct { - xeth *JSXEth + xeth *XEth } -func NewState(xeth *JSXEth) *State { +func NewState(xeth *XEth) *State { return &State{xeth} } -- cgit v1.2.3 From 0031f388ac1f6f4a23c5c75e5eeb4a007f0b2f31 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 29 Jan 2015 20:39:26 +0100 Subject: More dapp samples * Info DApp, coin DApp * Additional rpc methods --- xeth/world.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'xeth/world.go') 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 { -- cgit v1.2.3