From c362172567e7bd499ea0d0bcf84c54a9b7788614 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 15 Aug 2014 01:07:40 +0200 Subject: [PATCH] Got rid of warnings and updated storage getters --- ethereal/assets/ext/ethereum.js | 12 ++++++------ ethereal/assets/ext/test.html | 3 +++ ethereal/assets/qml/webapp.qml | 2 +- ethereal/ext_app.go | 2 +- ethereal/gui.go | 2 +- javascript/javascript_runtime.go | 2 +- utils/cmd.go | 21 +++++++++++---------- 7 files changed, 24 insertions(+), 20 deletions(-) diff --git a/ethereal/assets/ext/ethereum.js b/ethereal/assets/ext/ethereum.js index 5891fb9f9..03b25179b 100644 --- a/ethereal/assets/ext/ethereum.js +++ b/ethereal/assets/ext/ethereum.js @@ -1,6 +1,8 @@ // Main Ethereum library window.eth = { prototype: Object(), + _callbacks: {}, + _onCallbacks: {}, mutan: function(code) { }, @@ -103,8 +105,8 @@ window.eth = { postData({call: "getStorage", args: [address, storageAddress]}, cb); }, - getStateKeyVals: function(address, cb){ - postData({call: "getStateKeyVals", args: [address]}, cb); + getEachStorageAt: function(address, cb){ + postData({call: "getEachStorage", args: [address]}, cb); }, getKey: function(cb) { @@ -221,17 +223,15 @@ window.eth = { }, } -window.eth._callbacks = {} -window.eth._onCallbacks = {} var Filter = function(options) { this.options = options; }; - Filter.prototype.changed = function(callback) { + // Register the watched:. Qml will call the appropriate event if anything + // interesting happens in the land of Go. eth.on("watched:"+this.number, callback) } - Filter.prototype.getMessages = function(cb) { return eth.getMessages(this.options, cb) } diff --git a/ethereal/assets/ext/test.html b/ethereal/assets/ext/test.html index b605e8dbd..0d6b710fa 100644 --- a/ethereal/assets/ext/test.html +++ b/ethereal/assets/ext/test.html @@ -22,6 +22,9 @@ function test() { console.log("getMessages", messages) }); + eth.getEachStorageAt("9ef0f0d81e040012600b0c1abdef7c48f720f88a", function(a, b) { + console.log(a,b) + }) } diff --git a/ethereal/assets/qml/webapp.qml b/ethereal/assets/qml/webapp.qml index b0f50c8f9..5faf50e91 100644 --- a/ethereal/assets/qml/webapp.qml +++ b/ethereal/assets/qml/webapp.qml @@ -193,7 +193,7 @@ ApplicationWindow { break - case "getStateKeyVals": + case "getEachStorage": require(1); var stateObject = eth.getStateObject(data.args[0]).stateKeyVal(true) postData(data._seed,stateObject) diff --git a/ethereal/ext_app.go b/ethereal/ext_app.go index 627f9e9ca..37e9676ff 100644 --- a/ethereal/ext_app.go +++ b/ethereal/ext_app.go @@ -44,7 +44,7 @@ type ExtApplication struct { func NewExtApplication(container AppContainer, lib *UiLib) *ExtApplication { app := &ExtApplication{ - ethpub.NewPEthereum(lib.eth), + ethpub.New(lib.eth), lib.eth, make(chan ethreact.Event, 100), make(chan ethreact.Event, 100), diff --git a/ethereal/gui.go b/ethereal/gui.go index 276c1a348..c0584936d 100644 --- a/ethereal/gui.go +++ b/ethereal/gui.go @@ -57,7 +57,7 @@ func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIden panic(err) } - pub := ethpub.NewPEthereum(ethereum) + pub := ethpub.New(ethereum) return &Gui{eth: ethereum, txDb: db, pub: pub, logLevel: ethlog.LogLevel(logLevel), Session: session, open: false, clientIdentity: clientIdentity, config: config} } diff --git a/javascript/javascript_runtime.go b/javascript/javascript_runtime.go index 158fc93cf..d384c5048 100644 --- a/javascript/javascript_runtime.go +++ b/javascript/javascript_runtime.go @@ -50,7 +50,7 @@ func NewJSRE(ethereum *eth.Ethereum) *JSRE { re := &JSRE{ ethereum, otto.New(), - ethpub.NewPEthereum(ethereum), + ethpub.New(ethereum), make(chan ethreact.Event, 10), make(chan ethreact.Event, 10), make(chan bool), diff --git a/utils/cmd.go b/utils/cmd.go index 0eeb1049e..d34348ad8 100644 --- a/utils/cmd.go +++ b/utils/cmd.go @@ -1,8 +1,17 @@ package utils import ( - "bitbucket.org/kardianos/osext" "fmt" + "io" + "log" + "os" + "os/signal" + "path" + "path/filepath" + "runtime" + "time" + + "bitbucket.org/kardianos/osext" "github.com/ethereum/eth-go" "github.com/ethereum/eth-go/ethcrypto" "github.com/ethereum/eth-go/ethdb" @@ -12,14 +21,6 @@ import ( "github.com/ethereum/eth-go/ethrpc" "github.com/ethereum/eth-go/ethutil" "github.com/ethereum/eth-go/ethwire" - "io" - "log" - "os" - "os/signal" - "path" - "path/filepath" - "runtime" - "time" ) var logger = ethlog.NewLogger("CLI") @@ -227,7 +228,7 @@ func KeyTasks(keyManager *ethcrypto.KeyManager, KeyRing string, GenAddr bool, Se func StartRpc(ethereum *eth.Ethereum, RpcPort int) { var err error - ethereum.RpcServer, err = ethrpc.NewJsonRpcServer(ethpub.NewPEthereum(ethereum), RpcPort) + ethereum.RpcServer, err = ethrpc.NewJsonRpcServer(ethpub.New(ethereum), RpcPort) if err != nil { logger.Errorf("Could not start RPC interface (port %v): %v", RpcPort, err) } else {