getBalanceAt getStorageAt, fixed get balance api call

This commit is contained in:
obscuren 2014-04-30 14:54:59 +02:00
parent 183dbcc6a0
commit c5481b7654
3 changed files with 9 additions and 5 deletions

View File

@ -29,7 +29,7 @@ window.eth = {
postData({call: "create", args: [sec, value, gas, gasPrice, init, body]}, cb); postData({call: "create", args: [sec, value, gas, gasPrice, init, body]}, cb);
}, },
getStorage: function(address, storageAddress, cb) { getStorageAt: function(address, storageAddress, cb) {
postData({call: "getStorage", args: [address, storageAddress]}, cb); postData({call: "getStorage", args: [address, storageAddress]}, cb);
}, },
@ -37,7 +37,7 @@ window.eth = {
postData({call: "getKey"}, cb); postData({call: "getKey"}, cb);
}, },
getBalance: function(address, cb) { getBalanceAt: function(address, cb) {
postData({call: "getBalance", args: [address]}, cb); postData({call: "getBalance", args: [address]}, cb);
}, },

View File

@ -76,7 +76,7 @@ ApplicationWindow {
case "getBalance": case "getBalance":
require(1); require(1);
postData(data._seed, eth.getStateObject(data.args[0]).Value()); postData(data._seed, eth.getStateObject(data.args[0]).value());
break break
case "getKey": case "getKey":

View File

@ -23,15 +23,19 @@ function tests() {
function init() { function init() {
eth.getKey(function(key) { eth.getKey(function(key) {
eth.getStorage(jefcoinAddr, key, function(storage) { eth.getStorageAt(jefcoinAddr, key, function(storage) {
document.querySelector("#currentAmount").innerHTML = "Amount: " + storage; document.querySelector("#currentAmount").innerHTML = "Amount: " + storage;
}); });
eth.watch(jefcoinAddr, function(stateObject) { eth.watch(jefcoinAddr, function(stateObject) {
eth.getStorage(jefcoinAddr, key, function(storage) { eth.getStorageAt(jefcoinAddr, key, function(storage) {
document.querySelector("#currentAmount").innerHTML = "Amount: " + storage; document.querySelector("#currentAmount").innerHTML = "Amount: " + storage;
}); });
}); });
eth.getBalanceAt(key, function(balance) {
debug("balance", balance);
})
}); });
} }