From 91824af46b59b7af84c7591236fe8b34b667ddb8 Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 5 May 2014 13:09:11 +0200 Subject: [PATCH] Changed getkey and secrettoaddress --- ethereal/assets/ethereum.js | 5 ++++- ethereal/assets/qml/webapp.qml | 15 +++++++-------- ethereal/assets/samplecoin/samplecoin.html | 16 +++++++++------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/ethereal/assets/ethereum.js b/ethereal/assets/ethereum.js index e83d252b2..8f1a60300 100644 --- a/ethereal/assets/ethereum.js +++ b/ethereal/assets/ethereum.js @@ -36,11 +36,14 @@ window.eth = { postData({call: "getKey"}, cb); }, - getBalanceAt: function(address, cb) { postData({call: "getBalance", args: [address]}, cb); }, + getSecretToAddress: function(sec, cb) { + postData({call: "getSecretToAddress", args: [sec]}, cb); + }, + watch: function(address, storageAddrOrCb, cb) { var ev; if(cb === undefined) { diff --git a/ethereal/assets/qml/webapp.qml b/ethereal/assets/qml/webapp.qml index 2267ab4bf..d02c9a82e 100644 --- a/ethereal/assets/qml/webapp.qml +++ b/ethereal/assets/qml/webapp.qml @@ -81,8 +81,9 @@ ApplicationWindow { break case "getKey": - var keys = eth.getKey() - postData(data._seed, keys) + var key = eth.getKey().privateKey; + + postData(data._seed, key) break case "watch": require(1) @@ -99,14 +100,13 @@ ApplicationWindow { } } break; + case "getSecretToAddress": + require(1) + postData(data._seed, eth.secretToAddress(data.args[0])) + break; case "debug": console.log(data.args[0]); break; - case "test": - console.log("in") - webview.experimental.evaluateJavaScript("hello()") - console.log("out") - break; } } catch(e) { console.log(data.call + ": " + e) @@ -134,7 +134,6 @@ ApplicationWindow { postEvent("object:"+stateObject.address(), stateObject) } function onStorageChangeCb(storageObject) { - console.log("storage object cb", storageObject) var ev = ["storage", storageObject.stateAddress, storageObject.address].join(":"); postEvent(ev, [storageObject.address, storageObject.value]) } diff --git a/ethereal/assets/samplecoin/samplecoin.html b/ethereal/assets/samplecoin/samplecoin.html index fb0c22c7f..c1ee941a2 100644 --- a/ethereal/assets/samplecoin/samplecoin.html +++ b/ethereal/assets/samplecoin/samplecoin.html @@ -26,15 +26,17 @@ function createTransaction() { function init() { eth.set({width: 500}); - eth.getKey(function(keyPair) { - mAddr = keyPair.privateKey; + eth.getKey(function(sec) { + eth.getSecretToAddress(sec, function(addr) { + mAddr = addr; - eth.getStorageAt(jefcoinAddr, keyPair.address, function(storage) { - document.querySelector("#current-amount").innerHTML = storage; - }); + eth.getStorageAt(jefcoinAddr, addr, function(storage) { + document.querySelector("#current-amount").innerHTML = storage; + }); - eth.watch(jefcoinAddr, keyPair.address, function(addr, value) { - document.querySelector("#current-amount").innerHTML = value + eth.watch(jefcoinAddr, addr, function(addr, value) { + document.querySelector("#current-amount").innerHTML = value + }); }); }); }