|
|
@ -1,4 +1,4 @@ |
|
|
|
package ethui |
|
|
|
package main |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"bytes" |
|
|
|
"bytes" |
|
|
@ -40,8 +40,7 @@ type Gui struct { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Create GUI, but doesn't start it
|
|
|
|
// Create GUI, but doesn't start it
|
|
|
|
func New(ethereum *eth.Ethereum, session string, logLevel int) *Gui { |
|
|
|
func NewWindow(ethereum *eth.Ethereum, session string, logLevel int) *Gui { |
|
|
|
|
|
|
|
|
|
|
|
db, err := ethdb.NewLDBDatabase("tx_database") |
|
|
|
db, err := ethdb.NewLDBDatabase("tx_database") |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
panic(err) |
|
|
|
panic(err) |
|
|
@ -217,7 +216,9 @@ func (gui *Gui) loadAddressBook() { |
|
|
|
nameReg := ethpub.EthereumConfig(gui.eth.StateManager()).NameReg() |
|
|
|
nameReg := ethpub.EthereumConfig(gui.eth.StateManager()).NameReg() |
|
|
|
if nameReg != nil { |
|
|
|
if nameReg != nil { |
|
|
|
nameReg.State().EachStorage(func(name string, value *ethutil.Value) { |
|
|
|
nameReg.State().EachStorage(func(name string, value *ethutil.Value) { |
|
|
|
|
|
|
|
if name[0] != 0 { |
|
|
|
gui.win.Root().Call("addAddress", struct{ Name, Address string }{name, ethutil.Bytes2Hex(value.Bytes())}) |
|
|
|
gui.win.Root().Call("addAddress", struct{ Name, Address string }{name, ethutil.Bytes2Hex(value.Bytes())}) |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -273,7 +274,11 @@ func (gui *Gui) update() { |
|
|
|
reactor.Subscribe("newBlock", blockChan) |
|
|
|
reactor.Subscribe("newBlock", blockChan) |
|
|
|
reactor.Subscribe("newTx:pre", txChan) |
|
|
|
reactor.Subscribe("newTx:pre", txChan) |
|
|
|
reactor.Subscribe("newTx:post", txChan) |
|
|
|
reactor.Subscribe("newTx:post", txChan) |
|
|
|
//reactor.Subscribe("object:"+string(namereg), objectChan)
|
|
|
|
|
|
|
|
|
|
|
|
nameReg := ethpub.EthereumConfig(gui.eth.StateManager()).NameReg() |
|
|
|
|
|
|
|
if nameReg != nil { |
|
|
|
|
|
|
|
reactor.Subscribe("object:"+string(nameReg.Address()), objectChan) |
|
|
|
|
|
|
|
} |
|
|
|
reactor.Subscribe("peerList", peerChan) |
|
|
|
reactor.Subscribe("peerList", peerChan) |
|
|
|
|
|
|
|
|
|
|
|
ticker := time.NewTicker(5 * time.Second) |
|
|
|
ticker := time.NewTicker(5 * time.Second) |