aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/mist/gui.go
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-01-29 02:01:15 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-01-29 02:01:15 +0800
commit21fd31dad8bc6e0291ca405314b516670333c707 (patch)
tree34aa6f6d0e1f5c7316f0220f6e0569f916307fa3 /cmd/mist/gui.go
parenta88f609b8ab1e20eb2564d47605985d6b8f593e8 (diff)
parent872b2497114209119becf2e8a4d4a5818e2084ee (diff)
downloadgo-tangerine-21fd31dad8bc6e0291ca405314b516670333c707.tar
go-tangerine-21fd31dad8bc6e0291ca405314b516670333c707.tar.gz
go-tangerine-21fd31dad8bc6e0291ca405314b516670333c707.tar.bz2
go-tangerine-21fd31dad8bc6e0291ca405314b516670333c707.tar.lz
go-tangerine-21fd31dad8bc6e0291ca405314b516670333c707.tar.xz
go-tangerine-21fd31dad8bc6e0291ca405314b516670333c707.tar.zst
go-tangerine-21fd31dad8bc6e0291ca405314b516670333c707.zip
Merge branch 'jsonrpc' of github.com:ethereum/go-ethereum into jsonrpc
Diffstat (limited to 'cmd/mist/gui.go')
-rw-r--r--cmd/mist/gui.go102
1 files changed, 42 insertions, 60 deletions
diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go
index fd2ad5a11..e053c82c4 100644
--- a/cmd/mist/gui.go
+++ b/cmd/mist/gui.go
@@ -32,7 +32,6 @@ import (
"path"
"runtime"
"strconv"
- "strings"
"time"
"github.com/ethereum/go-ethereum/core"
@@ -76,7 +75,7 @@ type Gui struct {
logLevel logger.LogLevel
open bool
- xeth *xeth.JSXEth
+ xeth *xeth.XEth
Session string
clientIdentity *p2p.SimpleClientIdentity
@@ -94,7 +93,7 @@ func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIden
panic(err)
}
- xeth := xeth.NewJSXEth(ethereum)
+ xeth := xeth.New(ethereum)
gui := &Gui{eth: ethereum,
txDb: db,
xeth: xeth,
@@ -121,9 +120,9 @@ func (gui *Gui) Start(assetPath string) {
// Register ethereum functions
qml.RegisterTypes("Ethereum", 1, 0, []qml.TypeSpec{{
- Init: func(p *xeth.JSBlock, obj qml.Object) { p.Number = 0; p.Hash = "" },
+ Init: func(p *xeth.Block, obj qml.Object) { p.Number = 0; p.Hash = "" },
}, {
- Init: func(p *xeth.JSTransaction, obj qml.Object) { p.Value = ""; p.Hash = ""; p.Address = "" },
+ Init: func(p *xeth.Transaction, obj qml.Object) { p.Value = ""; p.Hash = ""; p.Address = "" },
}, {
Init: func(p *xeth.KeyVal, obj qml.Object) { p.Key = ""; p.Value = "" },
}})
@@ -229,41 +228,44 @@ func (gui *Gui) setInitialChain(ancientBlocks bool) {
}
func (gui *Gui) loadAddressBook() {
- view := gui.getObjectByName("infoView")
- nameReg := gui.xeth.World().Config().Get("NameReg")
- if nameReg != nil {
- it := nameReg.Trie().Iterator()
- for it.Next() {
- if it.Key[0] != 0 {
- view.Call("addAddress", struct{ Name, Address string }{string(it.Key), ethutil.Bytes2Hex(it.Value)})
- }
+ /*
+ view := gui.getObjectByName("infoView")
+ nameReg := gui.xeth.World().Config().Get("NameReg")
+ if nameReg != nil {
+ it := nameReg.Trie().Iterator()
+ for it.Next() {
+ if it.Key[0] != 0 {
+ view.Call("addAddress", struct{ Name, Address string }{string(it.Key), ethutil.Bytes2Hex(it.Value)})
+ }
+ }
}
- }
+ */
}
func (self *Gui) loadMergedMiningOptions() {
- view := self.getObjectByName("mergedMiningModel")
-
- mergeMining := self.xeth.World().Config().Get("MergeMining")
- if mergeMining != nil {
- i := 0
- it := mergeMining.Trie().Iterator()
- for it.Next() {
- view.Call("addMergedMiningOption", struct {
- Checked bool
- Name, Address string
- Id, ItemId int
- }{false, string(it.Key), ethutil.Bytes2Hex(it.Value), 0, i})
-
- i++
+ /*
+ view := self.getObjectByName("mergedMiningModel")
+
+ mergeMining := self.xeth.World().Config().Get("MergeMining")
+ if mergeMining != nil {
+ i := 0
+ it := mergeMining.Trie().Iterator()
+ for it.Next() {
+ view.Call("addMergedMiningOption", struct {
+ Checked bool
+ Name, Address string
+ Id, ItemId int
+ }{false, string(it.Key), ethutil.Bytes2Hex(it.Value), 0, i})
+
+ i++
+ }
}
- }
+ */
}
func (gui *Gui) insertTransaction(window string, tx *types.Transaction) {
- nameReg := gui.xeth.World().Config().Get("NameReg")
addr := gui.address()
var inout string
@@ -274,32 +276,12 @@ func (gui *Gui) insertTransaction(window string, tx *types.Transaction) {
}
var (
- ptx = xeth.NewJSTx(tx)
- send = nameReg.Storage(tx.From())
- rec = nameReg.Storage(tx.To())
- s, r string
+ ptx = xeth.NewTx(tx)
+ send = ethutil.Bytes2Hex(tx.From())
+ rec = ethutil.Bytes2Hex(tx.To())
)
-
- if core.MessageCreatesContract(tx) {
- rec = nameReg.Storage(core.AddressFromMessage(tx))
- }
-
- if send.Len() != 0 {
- s = strings.Trim(send.Str(), "\x00")
- } else {
- s = ethutil.Bytes2Hex(tx.From())
- }
- if rec.Len() != 0 {
- r = strings.Trim(rec.Str(), "\x00")
- } else {
- if core.MessageCreatesContract(tx) {
- r = ethutil.Bytes2Hex(core.AddressFromMessage(tx))
- } else {
- r = ethutil.Bytes2Hex(tx.To())
- }
- }
- ptx.Sender = s
- ptx.Address = r
+ ptx.Sender = send
+ ptx.Address = rec
if window == "post" {
//gui.getObjectByName("transactionView").Call("addTx", ptx, inout)
@@ -320,8 +302,8 @@ func (gui *Gui) readPreviousTransactions() {
}
func (gui *Gui) processBlock(block *types.Block, initial bool) {
- name := strings.Trim(gui.xeth.World().Config().Get("NameReg").Storage(block.Coinbase()).Str(), "\x00")
- b := xeth.NewJSBlock(block)
+ name := ethutil.Bytes2Hex(block.Coinbase())
+ b := xeth.NewBlock(block)
b.Name = name
gui.getObjectByName("chainView").Call("addBlock", b, initial)
@@ -531,9 +513,9 @@ NumGC: %d
func (gui *Gui) setPeerInfo() {
gui.win.Root().Call("setPeers", fmt.Sprintf("%d / %d", gui.eth.PeerCount(), gui.eth.MaxPeers))
gui.win.Root().Call("resetPeers")
- for _, peer := range gui.xeth.Peers() {
- gui.win.Root().Call("addPeer", peer)
- }
+ //for _, peer := range gui.xeth.Peers() {
+ //gui.win.Root().Call("addPeer", peer)
+ //}
}
func (gui *Gui) privateKey() string {