aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-02-25 18:24:04 +0800
committerobscuren <geffobscura@gmail.com>2014-02-25 18:24:04 +0800
commitdba1ba38220c92f96aaeeb2d4cc99c1991220dc4 (patch)
treec2e4c20f5f5f7389745a42ac226311e5d1b6bdf2 /ui
parent6451a7187a5eeff6ac819ded11b6e7f0a5aa1b1b (diff)
downloadgo-tangerine-dba1ba38220c92f96aaeeb2d4cc99c1991220dc4.tar
go-tangerine-dba1ba38220c92f96aaeeb2d4cc99c1991220dc4.tar.gz
go-tangerine-dba1ba38220c92f96aaeeb2d4cc99c1991220dc4.tar.bz2
go-tangerine-dba1ba38220c92f96aaeeb2d4cc99c1991220dc4.tar.lz
go-tangerine-dba1ba38220c92f96aaeeb2d4cc99c1991220dc4.tar.xz
go-tangerine-dba1ba38220c92f96aaeeb2d4cc99c1991220dc4.tar.zst
go-tangerine-dba1ba38220c92f96aaeeb2d4cc99c1991220dc4.zip
Currency to string
Diffstat (limited to 'ui')
-rw-r--r--ui/gui.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/ui/gui.go b/ui/gui.go
index 72e5b976a..6e30b5891 100644
--- a/ui/gui.go
+++ b/ui/gui.go
@@ -26,7 +26,7 @@ func NewTxFromTransaction(tx *ethchain.Transaction) *Tx {
hash := hex.EncodeToString(tx.Hash())
sender := hex.EncodeToString(tx.Recipient)
- return &Tx{Hash: hash, Value: tx.Value.String(), Address: sender}
+ return &Tx{Hash: hash, Value: ethutil.CurrencyToString(tx.Value), Address: sender}
}
// Creates a new QML Block from a chain block
@@ -154,7 +154,7 @@ func (ui *Gui) update() {
ui.eth.TxPool.Subscribe(txChan)
account := ui.eth.BlockManager.GetAddrState(ui.addr).Account
- ui.win.Root().Call("setWalletValue", fmt.Sprintf("%v", account.Amount))
+ ui.win.Root().Call("setWalletValue", fmt.Sprintf("%v", ethutil.CurrencyToString(account.Amount)))
for {
select {
case txMsg := <-txChan:
@@ -162,22 +162,22 @@ func (ui *Gui) update() {
ui.txDb.Put(tx.Hash(), tx.RlpEncode())
ui.win.Root().Call("addTx", NewTxFromTransaction(tx))
- // Yeah, yeah, stupid code. Refactor next week
+ // TODO FOR THE LOVE OF EVERYTHING GOOD IN THIS WORLD REFACTOR ME
if txMsg.Type == ethchain.TxPre {
if bytes.Compare(tx.Sender(), ui.addr) == 0 {
- ui.win.Root().Call("setWalletValue", fmt.Sprintf("%v (- %v)", account.Amount, tx.Value))
+ ui.win.Root().Call("setWalletValue", fmt.Sprintf("%v (- %v)", ethutil.CurrencyToString(account.Amount), ethutil.CurrencyToString(tx.Value)))
ui.eth.BlockManager.GetAddrState(ui.addr).Nonce += 1
fmt.Println("Nonce", ui.eth.BlockManager.GetAddrState(ui.addr).Nonce)
} else if bytes.Compare(tx.Recipient, ui.addr) == 0 {
- ui.win.Root().Call("setWalletValue", fmt.Sprintf("%v (+ %v)", account.Amount, tx.Value))
+ ui.win.Root().Call("setWalletValue", fmt.Sprintf("%v (+ %v)", ethutil.CurrencyToString(account.Amount), ethutil.CurrencyToString(tx.Value)))
}
} else {
if bytes.Compare(tx.Sender(), ui.addr) == 0 {
amount := account.Amount.Sub(account.Amount, tx.Value)
- ui.win.Root().Call("setWalletValue", fmt.Sprintf("%v", amount))
+ ui.win.Root().Call("setWalletValue", fmt.Sprintf("%v", ethutil.CurrencyToString(amount)))
} else if bytes.Compare(tx.Recipient, ui.addr) == 0 {
amount := account.Amount.Sub(account.Amount, tx.Value)
- ui.win.Root().Call("setWalletValue", fmt.Sprintf("%v", amount))
+ ui.win.Root().Call("setWalletValue", fmt.Sprintf("%v", ethutil.CurrencyToString(amount)))
}
}
}