Got rid of warnings and updated storage getters

This commit is contained in:
obscuren 2014-08-15 01:07:40 +02:00
parent aadc5be3ff
commit c362172567
7 changed files with 24 additions and 20 deletions

View File

@ -1,6 +1,8 @@
// Main Ethereum library // Main Ethereum library
window.eth = { window.eth = {
prototype: Object(), prototype: Object(),
_callbacks: {},
_onCallbacks: {},
mutan: function(code) { mutan: function(code) {
}, },
@ -103,8 +105,8 @@ window.eth = {
postData({call: "getStorage", args: [address, storageAddress]}, cb); postData({call: "getStorage", args: [address, storageAddress]}, cb);
}, },
getStateKeyVals: function(address, cb){ getEachStorageAt: function(address, cb){
postData({call: "getStateKeyVals", args: [address]}, cb); postData({call: "getEachStorage", args: [address]}, cb);
}, },
getKey: function(cb) { getKey: function(cb) {
@ -221,17 +223,15 @@ window.eth = {
}, },
} }
window.eth._callbacks = {}
window.eth._onCallbacks = {}
var Filter = function(options) { var Filter = function(options) {
this.options = options; this.options = options;
}; };
Filter.prototype.changed = function(callback) { Filter.prototype.changed = function(callback) {
// Register the watched:<number>. Qml will call the appropriate event if anything
// interesting happens in the land of Go.
eth.on("watched:"+this.number, callback) eth.on("watched:"+this.number, callback)
} }
Filter.prototype.getMessages = function(cb) { Filter.prototype.getMessages = function(cb) {
return eth.getMessages(this.options, cb) return eth.getMessages(this.options, cb)
} }

View File

@ -22,6 +22,9 @@ function test() {
console.log("getMessages", messages) console.log("getMessages", messages)
}); });
eth.getEachStorageAt("9ef0f0d81e040012600b0c1abdef7c48f720f88a", function(a, b) {
console.log(a,b)
})
} }
</script> </script>

View File

@ -193,7 +193,7 @@ ApplicationWindow {
break break
case "getStateKeyVals": case "getEachStorage":
require(1); require(1);
var stateObject = eth.getStateObject(data.args[0]).stateKeyVal(true) var stateObject = eth.getStateObject(data.args[0]).stateKeyVal(true)
postData(data._seed,stateObject) postData(data._seed,stateObject)

View File

@ -44,7 +44,7 @@ type ExtApplication struct {
func NewExtApplication(container AppContainer, lib *UiLib) *ExtApplication { func NewExtApplication(container AppContainer, lib *UiLib) *ExtApplication {
app := &ExtApplication{ app := &ExtApplication{
ethpub.NewPEthereum(lib.eth), ethpub.New(lib.eth),
lib.eth, lib.eth,
make(chan ethreact.Event, 100), make(chan ethreact.Event, 100),
make(chan ethreact.Event, 100), make(chan ethreact.Event, 100),

View File

@ -57,7 +57,7 @@ func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIden
panic(err) 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} return &Gui{eth: ethereum, txDb: db, pub: pub, logLevel: ethlog.LogLevel(logLevel), Session: session, open: false, clientIdentity: clientIdentity, config: config}
} }

View File

@ -50,7 +50,7 @@ func NewJSRE(ethereum *eth.Ethereum) *JSRE {
re := &JSRE{ re := &JSRE{
ethereum, ethereum,
otto.New(), otto.New(),
ethpub.NewPEthereum(ethereum), ethpub.New(ethereum),
make(chan ethreact.Event, 10), make(chan ethreact.Event, 10),
make(chan ethreact.Event, 10), make(chan ethreact.Event, 10),
make(chan bool), make(chan bool),

View File

@ -1,8 +1,17 @@
package utils package utils
import ( import (
"bitbucket.org/kardianos/osext"
"fmt" "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"
"github.com/ethereum/eth-go/ethcrypto" "github.com/ethereum/eth-go/ethcrypto"
"github.com/ethereum/eth-go/ethdb" "github.com/ethereum/eth-go/ethdb"
@ -12,14 +21,6 @@ import (
"github.com/ethereum/eth-go/ethrpc" "github.com/ethereum/eth-go/ethrpc"
"github.com/ethereum/eth-go/ethutil" "github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethwire" "github.com/ethereum/eth-go/ethwire"
"io"
"log"
"os"
"os/signal"
"path"
"path/filepath"
"runtime"
"time"
) )
var logger = ethlog.NewLogger("CLI") 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) { func StartRpc(ethereum *eth.Ethereum, RpcPort int) {
var err error var err error
ethereum.RpcServer, err = ethrpc.NewJsonRpcServer(ethpub.NewPEthereum(ethereum), RpcPort) ethereum.RpcServer, err = ethrpc.NewJsonRpcServer(ethpub.New(ethereum), RpcPort)
if err != nil { if err != nil {
logger.Errorf("Could not start RPC interface (port %v): %v", RpcPort, err) logger.Errorf("Could not start RPC interface (port %v): %v", RpcPort, err)
} else { } else {