aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ethereal/assets/ext/ethereum.js17
-rw-r--r--ethereal/assets/qml/webapp.qml24
-rw-r--r--ethereum/ethereum.go47
3 files changed, 66 insertions, 22 deletions
diff --git a/ethereal/assets/ext/ethereum.js b/ethereal/assets/ext/ethereum.js
index f565e58bd..d4eaf97fd 100644
--- a/ethereal/assets/ext/ethereum.js
+++ b/ethereal/assets/ext/ethereum.js
@@ -36,6 +36,21 @@ window.eth = {
postData({call: "getKey"}, cb);
},
+ getTxCountAt: function(address, cb) {
+ postData({call: "getTxCountAt", args: [address]}, cb);
+ },
+ getIsMining: function(cb){
+ postData({call: "getIsMining"}, cb)
+ },
+ getIsListening: function(cb){
+ postData({call: "getIsListening"}, cb)
+ },
+ getCoinBase: function(cb){
+ postData({call: "getCoinBase"}, cb);
+ },
+ getPeerCount: function(cb){
+ postData({call: "getPeerCount"}, cb);
+ },
getBalanceAt: function(address, cb) {
postData({call: "getBalance", args: [address]}, cb);
},
@@ -115,6 +130,8 @@ window.eth = {
}
}
},
+
+
}
window.eth._callbacks = {}
window.eth._onCallbacks = {}
diff --git a/ethereal/assets/qml/webapp.qml b/ethereal/assets/qml/webapp.qml
index 14f3bd6d0..86eb7fe2f 100644
--- a/ethereal/assets/qml/webapp.qml
+++ b/ethereal/assets/qml/webapp.qml
@@ -47,13 +47,37 @@ ApplicationWindow {
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("b9b56cf6f907fbee21db0cd7cbc0e6fea2fe29503a3943e275c5e467d649cb06")
postData(data._seed, block)
+
break
case "getBlockByHash":
var block = eth.getBlock("b9b56cf6f907fbee21db0cd7cbc0e6fea2fe29503a3943e275c5e467d649cb06")
postData(data._seed, block)
+
break
case "transact":
require(5)
diff --git a/ethereum/ethereum.go b/ethereum/ethereum.go
index 5b578deba..8b22533d9 100644
--- a/ethereum/ethereum.go
+++ b/ethereum/ethereum.go
@@ -122,28 +122,8 @@ func main() {
// Set the max peers
ethereum.MaxPeers = MaxPeer
- if StartConsole {
- err := os.Mkdir(ethutil.Config.ExecPath, os.ModePerm)
- // Error is OK if the error is ErrExist
- if err != nil && !os.IsExist(err) {
- log.Panic("Unable to create EXECPATH:", err)
- }
-
- console := NewConsole(ethereum)
- go console.Start()
- }
- if StartRpc {
- ethereum.RpcServer, err = ethrpc.NewJsonRpcServer(ethpub.NewPEthereum(ethereum), RpcPort)
- if err != nil {
- logger.Infoln("Could not start RPC interface:", err)
- } else {
- go ethereum.RpcServer.Start()
- }
- }
-
- RegisterInterrupts(ethereum)
-
- ethereum.Start(UseSeed)
+ // Set Mining status
+ ethereum.Mining = StartMining
if StartMining {
logger.Infoln("Miner started")
@@ -168,6 +148,29 @@ func main() {
}
+ if StartConsole {
+ err := os.Mkdir(ethutil.Config.ExecPath, os.ModePerm)
+ // Error is OK if the error is ErrExist
+ if err != nil && !os.IsExist(err) {
+ log.Panic("Unable to create EXECPATH:", err)
+ }
+
+ console := NewConsole(ethereum)
+ go console.Start()
+ }
+ if StartRpc {
+ ethereum.RpcServer, err = ethrpc.NewJsonRpcServer(ethpub.NewPEthereum(ethereum), RpcPort)
+ if err != nil {
+ logger.Infoln("Could not start RPC interface:", err)
+ } else {
+ go ethereum.RpcServer.Start()
+ }
+ }
+
+ RegisterInterrupts(ethereum)
+
+ ethereum.Start(UseSeed)
+
// Wait for shutdown
ethereum.WaitForShutdown()
}