new switch

This commit is contained in:
obscuren 2015-01-09 13:26:49 +01:00
parent 18d8bf4b9c
commit bfa12d75f8

View File

@ -174,51 +174,51 @@ Rectangle {
try { try {
switch(data.call) { switch(data.call) {
case "compile": case "eth_compile":
postData(data._id, eth.compile(data.args[0])) postData(data._id, eth.compile(data.args[0]))
break break
case "coinbase": case "eth_coinbase":
postData(data._id, eth.coinBase()) postData(data._id, eth.coinBase())
case "account": case "eth_account":
postData(data._id, eth.key().address); postData(data._id, eth.key().address);
case "isListening": case "eth_istening":
postData(data._id, eth.isListening()) postData(data._id, eth.isListening())
break break
case "isMining": case "eth_mining":
postData(data._id, eth.isMining()) postData(data._id, eth.isMining())
break break
case "peerCount": case "eth_peerCount":
postData(data._id, eth.peerCount()) postData(data._id, eth.peerCount())
break break
case "countAt": case "eth_countAt":
require(1) require(1)
postData(data._id, eth.txCountAt(data.args[0])) postData(data._id, eth.txCountAt(data.args[0]))
break break
case "codeAt": case "eth_codeAt":
require(1) require(1)
var code = eth.codeAt(data.args[0]) var code = eth.codeAt(data.args[0])
postData(data._id, code); postData(data._id, code);
break break
case "blockByNumber": case "eth_blockByNumber":
require(1) require(1)
var block = eth.blockByNumber(data.args[0]) var block = eth.blockByNumber(data.args[0])
postData(data._id, block) postData(data._id, block)
break break
case "blockByHash": case "eth_blockByHash":
require(1) require(1)
var block = eth.blockByHash(data.args[0]) var block = eth.blockByHash(data.args[0])
postData(data._id, block) postData(data._id, block)
@ -229,8 +229,8 @@ Rectangle {
postData(data._id, block.transactions[data.args[1]]) postData(data._id, block.transactions[data.args[1]])
break break
case "transactionByHash": case "eth_transactionByHash":
case "transactionByNumber": case "eth_transactionByNumber":
require(2) require(2)
var block; var block;
@ -244,8 +244,8 @@ Rectangle {
postData(data._id, tx) postData(data._id, tx)
break break
case "uncleByHash": case "eth_uncleByHash":
case "uncleByNumber": case "eth_uncleByNumber":
require(2) require(2)
var block; var block;
@ -268,7 +268,7 @@ Rectangle {
break break
case "stateAt": case "eth_stateAt":
require(2); require(2);
var storage = eth.storageAt(data.args[0], data.args[1]); var storage = eth.storageAt(data.args[0], data.args[1]);
@ -276,55 +276,41 @@ Rectangle {
break break
case "call": case "eth_call":
require(1); require(1);
var ret = eth.call(data.args) var ret = eth.call(data.args)
postData(data._id, ret) postData(data._id, ret)
break break
case "balanceAt": case "eth_balanceAt":
require(1); require(1);
postData(data._id, eth.balanceAt(data.args[0])); postData(data._id, eth.balanceAt(data.args[0]));
break break
case "watch": case "eth_watch":
require(2) require(2)
eth.watch(data.args[0], data.args[1]) eth.watch(data.args[0], data.args[1])
case "disconnect": case "eth_disconnect":
require(1) require(1)
postData(data._id, null) postData(data._id, null)
break; break;
case "messages": case "eth_newFilterString":
require(1);
var messages = JSON.parse(eth.getMessages(data.args[0]))
postData(data._id, messages)
break
case "mutan":
require(1)
var code = eth.compileMutan(data.args[0])
postData(data._id, "0x"+code)
break;
case "newFilterString":
require(1) require(1)
var id = eth.newFilterString(data.args[0]) var id = eth.newFilterString(data.args[0])
postData(data._id, id); postData(data._id, id);
break; break;
case "newFilter": case "eth_newFilter":
require(1) require(1)
var id = eth.newFilter(data.args[0]) var id = eth.newFilter(data.args[0])
postData(data._id, id); postData(data._id, id);
break; break;
case "getMessages": case "eth_messages":
require(1); require(1);
var messages = eth.messages(data.args[0]); var messages = eth.messages(data.args[0]);
@ -333,26 +319,26 @@ Rectangle {
break; break;
case "deleteFilter": case "eth_deleteFilter":
require(1); require(1);
eth.uninstallFilter(data.args[0]) eth.uninstallFilter(data.args[0])
break; break;
case "shhNewFilter": case "shh_newFilter":
require(1); require(1);
var id = shh.watch(data.args[0], window); var id = shh.watch(data.args[0], window);
postData(data._id, id); postData(data._id, id);
break; break;
case "newIdentity": case "shh_newIdentity":
var id = shh.newIdentity() var id = shh.newIdentity()
console.log("newIdentity", id) console.log("newIdentity", id)
postData(data._id, id) postData(data._id, id)
break break
case "post": case "shh_post":
require(1); require(1);
var params = data.args[0]; var params = data.args[0];