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 --- cmd/mist/ext_app.go | 4 ++-- cmd/mist/gui.go | 12 ++++++------ cmd/mist/html_container.go | 2 +- cmd/mist/qml_container.go | 2 +- cmd/mist/ui_lib.go | 12 ++++++------ cmd/utils/cmd.go | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) (limited to 'cmd') diff --git a/cmd/mist/ext_app.go b/cmd/mist/ext_app.go index 012c94923..bc856cd72 100644 --- a/cmd/mist/ext_app.go +++ b/cmd/mist/ext_app.go @@ -47,7 +47,7 @@ type AppContainer interface { } type ExtApplication struct { - *xeth.JSXEth + *xeth.XEth eth core.EthManager events event.Subscription @@ -61,7 +61,7 @@ type ExtApplication struct { func NewExtApplication(container AppContainer, lib *UiLib) *ExtApplication { return &ExtApplication{ - JSXEth: xeth.NewJSXEth(lib.eth), + XEth: xeth.New(lib.eth), eth: lib.eth, watcherQuitChan: make(chan bool), filters: make(map[string]*core.Filter), diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 6522c865d..e053c82c4 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -75,7 +75,7 @@ type Gui struct { logLevel logger.LogLevel open bool - xeth *xeth.JSXEth + xeth *xeth.XEth Session string clientIdentity *p2p.SimpleClientIdentity @@ -93,7 +93,7 @@ func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIden panic(err) } - xeth := xeth.NewJSXEth(ethereum) + xeth := xeth.New(ethereum) gui := &Gui{eth: ethereum, txDb: db, xeth: xeth, @@ -120,9 +120,9 @@ func (gui *Gui) Start(assetPath string) { // Register ethereum functions qml.RegisterTypes("Ethereum", 1, 0, []qml.TypeSpec{{ - Init: func(p *xeth.JSBlock, obj qml.Object) { p.Number = 0; p.Hash = "" }, + Init: func(p *xeth.Block, obj qml.Object) { p.Number = 0; p.Hash = "" }, }, { - Init: func(p *xeth.JSTransaction, obj qml.Object) { p.Value = ""; p.Hash = ""; p.Address = "" }, + Init: func(p *xeth.Transaction, obj qml.Object) { p.Value = ""; p.Hash = ""; p.Address = "" }, }, { Init: func(p *xeth.KeyVal, obj qml.Object) { p.Key = ""; p.Value = "" }, }}) @@ -276,7 +276,7 @@ func (gui *Gui) insertTransaction(window string, tx *types.Transaction) { } var ( - ptx = xeth.NewJSTx(tx) + ptx = xeth.NewTx(tx) send = ethutil.Bytes2Hex(tx.From()) rec = ethutil.Bytes2Hex(tx.To()) ) @@ -303,7 +303,7 @@ func (gui *Gui) readPreviousTransactions() { func (gui *Gui) processBlock(block *types.Block, initial bool) { name := ethutil.Bytes2Hex(block.Coinbase()) - b := xeth.NewJSBlock(block) + b := xeth.NewBlock(block) b.Name = name gui.getObjectByName("chainView").Call("addBlock", b, initial) diff --git a/cmd/mist/html_container.go b/cmd/mist/html_container.go index f2ba6fbe2..516dcb6b3 100644 --- a/cmd/mist/html_container.go +++ b/cmd/mist/html_container.go @@ -142,7 +142,7 @@ func (app *HtmlApplication) Window() *qml.Window { } func (app *HtmlApplication) NewBlock(block *types.Block) { - b := &xeth.JSBlock{Number: int(block.NumberU64()), Hash: ethutil.Bytes2Hex(block.Hash())} + b := &xeth.Block{Number: int(block.NumberU64()), Hash: ethutil.Bytes2Hex(block.Hash())} app.webView.Call("onNewBlockCb", b) } diff --git a/cmd/mist/qml_container.go b/cmd/mist/qml_container.go index 7f5d97bec..5fbe3c01e 100644 --- a/cmd/mist/qml_container.go +++ b/cmd/mist/qml_container.go @@ -70,7 +70,7 @@ func (app *QmlApplication) NewWatcher(quitChan chan bool) { // Events func (app *QmlApplication) NewBlock(block *types.Block) { - pblock := &xeth.JSBlock{Number: int(block.NumberU64()), Hash: ethutil.Bytes2Hex(block.Hash())} + pblock := &xeth.Block{Number: int(block.NumberU64()), Hash: ethutil.Bytes2Hex(block.Hash())} app.win.Call("onNewBlockCb", pblock) } diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index ca3884a82..0bffc4cd1 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -44,7 +44,7 @@ type memAddr struct { // UI Library that has some basic functionality exposed type UiLib struct { - *xeth.JSXEth + *xeth.XEth engine *qml.Engine eth *eth.Ethereum connected bool @@ -63,7 +63,7 @@ type UiLib struct { } func NewUiLib(engine *qml.Engine, eth *eth.Ethereum, assetPath string) *UiLib { - lib := &UiLib{JSXEth: xeth.NewJSXEth(eth), engine: engine, eth: eth, assetPath: assetPath, jsEngine: javascript.NewJSRE(eth), filterCallbacks: make(map[int][]int)} //, filters: make(map[int]*xeth.JSFilter)} + lib := &UiLib{XEth: xeth.New(eth), engine: engine, eth: eth, assetPath: assetPath, jsEngine: javascript.NewJSRE(eth), filterCallbacks: make(map[int][]int)} //, filters: make(map[int]*xeth.JSFilter)} lib.miner = miner.New(eth.KeyManager().Address(), eth) lib.filterManager = filter.NewFilterManager(eth.EventMux()) go lib.filterManager.Start() @@ -180,7 +180,7 @@ func (self *UiLib) StartDebugger() { func (self *UiLib) Transact(params map[string]interface{}) (string, error) { object := mapToTxParams(params) - return self.JSXEth.Transact( + return self.XEth.Transact( object["from"], object["to"], object["value"], @@ -202,7 +202,7 @@ func (self *UiLib) Compile(code string) (string, error) { func (self *UiLib) Call(params map[string]interface{}) (string, error) { object := mapToTxParams(params) - return self.JSXEth.Execute( + return self.XEth.Execute( object["to"], object["value"], object["gas"], @@ -261,7 +261,7 @@ func (self *UiLib) ToAscii(data string) string { func (self *UiLib) NewFilter(object map[string]interface{}, view *qml.Common) (id int) { filter := qt.NewFilterFromMap(object, self.eth) filter.MessageCallback = func(messages state.Messages) { - view.Call("messages", xeth.ToJSMessages(messages), id) + view.Call("messages", xeth.ToMessages(messages), id) } id = self.filterManager.InstallFilter(filter) return id @@ -279,7 +279,7 @@ func (self *UiLib) NewFilterString(typ string, view *qml.Common) (id int) { func (self *UiLib) Messages(id int) *ethutil.List { filter := self.filterManager.GetFilter(id) if filter != nil { - messages := xeth.ToJSMessages(filter.Find()) + messages := xeth.ToMessages(filter.Find()) return messages } diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go index 9cdd8b5d1..1d4655433 100644 --- a/cmd/utils/cmd.go +++ b/cmd/utils/cmd.go @@ -194,7 +194,7 @@ func KeyTasks(keyManager *crypto.KeyManager, KeyRing string, GenAddr bool, Secre func StartRpc(ethereum *eth.Ethereum, RpcPort int) { var err error - ethereum.RpcServer, err = rpchttp.NewRpcHttpServer(xeth.NewJSXEth(ethereum), RpcPort) + ethereum.RpcServer, err = rpchttp.NewRpcHttpServer(xeth.New(ethereum), RpcPort) if err != nil { clilogger.Errorf("Could not start RPC interface (port %v): %v", RpcPort, err) } else { -- cgit