aboutsummaryrefslogtreecommitdiffstats
path: root/ethereal/ui/ui_lib.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-04-26 07:47:04 +0800
committerobscuren <geffobscura@gmail.com>2014-04-26 07:47:04 +0800
commite16fd323e800297602a60b7a0e7b7897a55d2fa0 (patch)
tree1c27a3bc225af36d6b0b2117ba6b649cc3983110 /ethereal/ui/ui_lib.go
parentd0438ac10ab55cd12c1ab5ec3aaf0030185bf131 (diff)
downloaddexon-e16fd323e800297602a60b7a0e7b7897a55d2fa0.tar
dexon-e16fd323e800297602a60b7a0e7b7897a55d2fa0.tar.gz
dexon-e16fd323e800297602a60b7a0e7b7897a55d2fa0.tar.bz2
dexon-e16fd323e800297602a60b7a0e7b7897a55d2fa0.tar.lz
dexon-e16fd323e800297602a60b7a0e7b7897a55d2fa0.tar.xz
dexon-e16fd323e800297602a60b7a0e7b7897a55d2fa0.tar.zst
dexon-e16fd323e800297602a60b7a0e7b7897a55d2fa0.zip
Leverage the new watch & address:changed functionality
Diffstat (limited to 'ethereal/ui/ui_lib.go')
-rw-r--r--ethereal/ui/ui_lib.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/ethereal/ui/ui_lib.go b/ethereal/ui/ui_lib.go
index 08e2267a7..6217c0065 100644
--- a/ethereal/ui/ui_lib.go
+++ b/ethereal/ui/ui_lib.go
@@ -69,8 +69,10 @@ func (ui *UiLib) OpenHtml(path string) {
}
win.Set("url", path)
+ webView := win.ObjectByName("webView")
go func() {
blockChan := make(chan ethutil.React, 1)
+ addrChan := make(chan ethutil.React, 1)
quitChan := make(chan bool)
go func() {
@@ -82,8 +84,12 @@ func (ui *UiLib) OpenHtml(path string) {
break out
case block := <-blockChan:
if block, ok := block.Resource.(*ethchain.Block); ok {
- b := &Block{Number: int(block.BlockInfo().Number), Hash: ethutil.Hex(block.Hash())}
- win.ObjectByName("webView").Call("onNewBlockCb", b)
+ b := &QBlock{Number: int(block.BlockInfo().Number), Hash: ethutil.Hex(block.Hash())}
+ webView.Call("onNewBlockCb", b)
+ }
+ case stateObject := <-addrChan:
+ if stateObject, ok := stateObject.Resource.(*ethchain.StateObject); ok {
+ webView.Call("onObjectChangeCb", NewQStateObject(stateObject))
}
}
}
@@ -93,6 +99,7 @@ func (ui *UiLib) OpenHtml(path string) {
close(quitChan)
}()
ui.eth.Reactor().Subscribe("newBlock", blockChan)
+ ui.eth.Reactor().Subscribe("addressChanged", addrChan)
win.Show()
win.Wait()
@@ -169,7 +176,7 @@ func (ui *UiLib) DebugTx(recipient, valueStr, gasStr, gasPriceStr, data string)
callerClosure := ethchain.NewClosure(account, c, c.Script(), state, ethutil.Big(gasStr), ethutil.Big(gasPriceStr), ethutil.Big(valueStr))
block := ui.eth.BlockChain().CurrentBlock
- vm := ethchain.NewVm(state, ethchain.RuntimeVars{
+ vm := ethchain.NewVm(state, ui.eth.StateManager(), ethchain.RuntimeVars{
Origin: account.Address(),
BlockNumber: block.BlockInfo().Number,
PrevHash: block.PrevHash,