Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
dba1ba38
Commit
dba1ba38
authored
Feb 25, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Currency to string
parent
6451a718
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
gui.go
ui/gui.go
+7
-7
wallet.qml
wallet.qml
+3
-0
No files found.
ui/gui.go
View file @
dba1ba38
...
...
@@ -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
)
))
}
}
}
...
...
wallet.qml
View file @
dba1ba38
...
...
@@ -215,6 +215,7 @@ ApplicationWindow {
text
:
"Connect"
}
Button
{
id
:
importAppButton
anchors.left
:
connectButton
.
right
anchors.leftMargin
:
5
onClicked
:
openAppDialog
.
open
()
...
...
@@ -222,6 +223,8 @@ ApplicationWindow {
}
Label
{
anchors.left
:
importAppButton
.
right
anchors.leftMargin
:
5
id
:
walletValueLabel
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment