aboutsummaryrefslogtreecommitdiffstats
path: root/ethereal/assets/ext
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-08-10 21:57:42 +0800
committerobscuren <geffobscura@gmail.com>2014-08-10 21:57:42 +0800
commit51a2087081ec0c8a9d0d739c344929c8494e13b6 (patch)
tree25c81e5b0d75d54a904da33036cda29c36f1f8a8 /ethereal/assets/ext
parent4dc5855dfe08bd427e931d03f2c7ae9105688f67 (diff)
downloadgo-tangerine-51a2087081ec0c8a9d0d739c344929c8494e13b6.tar
go-tangerine-51a2087081ec0c8a9d0d739c344929c8494e13b6.tar.gz
go-tangerine-51a2087081ec0c8a9d0d739c344929c8494e13b6.tar.bz2
go-tangerine-51a2087081ec0c8a9d0d739c344929c8494e13b6.tar.lz
go-tangerine-51a2087081ec0c8a9d0d739c344929c8494e13b6.tar.xz
go-tangerine-51a2087081ec0c8a9d0d739c344929c8494e13b6.tar.zst
go-tangerine-51a2087081ec0c8a9d0d739c344929c8494e13b6.zip
Minor issues
Diffstat (limited to 'ethereal/assets/ext')
-rw-r--r--ethereal/assets/ext/home.html2
-rw-r--r--ethereal/assets/ext/messaging.js117
2 files changed, 118 insertions, 1 deletions
diff --git a/ethereal/assets/ext/home.html b/ethereal/assets/ext/home.html
index 54af76991..86a659d65 100644
--- a/ethereal/assets/ext/home.html
+++ b/ethereal/assets/ext/home.html
@@ -14,7 +14,7 @@ h1 {
</head>
<body>
-<h1>Ethereum</h1>
+<h1>... Ethereum ...</h1>
<!-- ĐΞV --!>
</body>
</html>
diff --git a/ethereal/assets/ext/messaging.js b/ethereal/assets/ext/messaging.js
new file mode 100644
index 000000000..e7bc63020
--- /dev/null
+++ b/ethereal/assets/ext/messaging.js
@@ -0,0 +1,117 @@
+function handleMessage(message) {
+ console.log("[onMessageReceived]: ", message.data)
+ // TODO move to messaging.js
+ var data = JSON.parse(message.data)
+
+ try {
+ switch(data.call) {
+ case "getCoinBase":
+ postData(data._seed, eth.getCoinBase())
+
+ break
+ case "getIsListening":
+ postData(data._seed, eth.getIsListening())
+
+ break
+ case "getIsMining":
+ postData(data._seed, eth.getIsMining())
+
+ break
+ case "getPeerCount":
+ postData(data._seed, eth.getPeerCount())
+
+ break
+
+ case "getTxCountAt":
+ require(1)
+ postData(data._seed, eth.getTxCountAt(data.args[0]))
+
+ break
+ case "getBlockByNumber":
+ var block = eth.getBlock(data.args[0])
+ postData(data._seed, block)
+
+ break
+ case "getBlockByHash":
+ var block = eth.getBlock(data.args[0])
+ postData(data._seed, block)
+
+ break
+ case "transact":
+ require(5)
+
+ var tx = eth.transact(data.args[0], data.args[1], data.args[2],data.args[3],data.args[4],data.args[5])
+ postData(data._seed, tx)
+
+ break
+ case "create":
+ postData(data._seed, null)
+
+ break
+ case "getStorage":
+ require(2);
+
+ var stateObject = eth.getStateObject(data.args[0])
+ var storage = stateObject.getStorage(data.args[1])
+ postData(data._seed, storage)
+
+ break
+ case "getStateKeyVals":
+ require(1);
+ var stateObject = eth.getStateObject(data.args[0]).stateKeyVal(true)
+ postData(data._seed,stateObject)
+
+ break
+ case "getTransactionsFor":
+ require(1);
+ var txs = eth.getTransactionsFor(data.args[0], true)
+ postData(data._seed, txs)
+
+ break
+ case "getBalance":
+ require(1);
+
+ postData(data._seed, eth.getStateObject(data.args[0]).value());
+
+ break
+ case "getKey":
+ var key = eth.getKey().privateKey;
+
+ postData(data._seed, key)
+ break
+ case "watch":
+ require(1)
+ eth.watch(data.args[0], data.args[1]);
+ break
+ case "disconnect":
+ require(1)
+ postData(data._seed, null)
+ break;
+ case "set":
+ console.log("'Set' has been depcrecated")
+ /*
+ for(var key in data.args) {
+ if(webview.hasOwnProperty(key)) {
+ window[key] = data.args[key];
+ }
+ }
+ */
+ break;
+ case "getSecretToAddress":
+ require(1)
+ postData(data._seed, eth.secretToAddress(data.args[0]))
+ break;
+ case "debug":
+ console.log(data.args[0]);
+ break;
+ }
+ } catch(e) {
+ console.log(data.call + ": " + e)
+
+ postData(data._seed, null);
+ }
+}
+
+function postData(seed, data) {
+ webview.experimental.postMessage(JSON.stringify({data: data, _seed: seed}))
+}