@@ -17,43 +17,145 @@ Rectangle {
17
17
18
18
function onReady () {
19
19
menuItem .secondary = eth .numberToHuman (eth .balanceAt (eth .key ().address ))
20
+ }
20
21
22
+ ListModel {
23
+ id: denomModel
24
+ ListElement { text: " Wei" ; zeros: " " }
25
+ ListElement { text: " Ada" ; zeros: " 000" }
26
+ ListElement { text: " Babbage" ; zeros: " 000000" }
27
+ ListElement { text: " Shannon" ; zeros: " 000000000" }
28
+ ListElement { text: " Szabo" ; zeros: " 000000000000" }
29
+ ListElement { text: " Finney" ; zeros: " 000000000000000" }
30
+ ListElement { text: " Ether" ; zeros: " 000000000000000000" }
31
+ ListElement { text: " Einstein" ;zeros: " 000000000000000000000" }
32
+ ListElement { text: " Douglas" ; zeros: " 000000000000000000000000000000000000000000" }
21
33
}
22
34
23
35
ColumnLayout {
24
36
spacing: 10
25
37
y: 40
26
- anchors {
27
- left: parent .left
28
- right: parent .right
29
- }
38
+ anchors .fill : parent
30
39
31
40
Text {
41
+ id: balance
32
42
text: " <b>Balance</b>: " + eth .numberToHuman (eth .balanceAt (eth .key ().address ))
33
43
font .pixelSize : 24
34
44
anchors {
35
45
horizontalCenter: parent .horizontalCenter
46
+ top: parent .top
47
+ topMargin: 20
36
48
}
37
49
}
38
50
39
- TableView {
40
- id: txTableView
51
+ Rectangle {
52
+ id: newTxPane
53
+ color: " #ececec"
54
+ border .color : " #cccccc"
55
+ border .width : 1
41
56
anchors {
57
+ top: balance .bottom
58
+ topMargin: 10
42
59
left: parent .left
60
+ leftMargin: 5
43
61
right: parent .right
62
+ rightMargin: 5
63
+ }
64
+ height: 100
65
+
66
+ RowLayout {
67
+ id: amountFields
68
+ spacing: 10
69
+ anchors {
70
+ top: parent .top
71
+ topMargin: 20
72
+ left: parent .left
73
+ leftMargin: 20
74
+ }
75
+
76
+ Text {
77
+ text: " Ξ "
78
+ }
79
+
80
+ // There's something off with the row layout where textfields won't listen to the width setting
81
+ Rectangle {
82
+ width: 50
83
+ height: 20
84
+ TextField {
85
+ id: txValue
86
+ width: parent .width
87
+ placeholderText: " 0.00"
88
+ }
89
+ }
90
+
91
+ ComboBox {
92
+ id: valueDenom
93
+ currentIndex: 6
94
+ model: denomModel
95
+ }
96
+
44
97
}
45
- TableViewColumn{ role: " num" ; title: " #" ; width: 30 }
46
- TableViewColumn{ role: " from" ; title: " From" ; width: 280 }
47
- TableViewColumn{ role: " to" ; title: " To" ; width: 280 }
48
- TableViewColumn{ role: " value" ; title: " Amount" ; width: 100 }
49
-
50
- model: ListModel {
51
- id: txModel
52
- Component .onCompleted : {
53
- var messages = JSON .parse (eth .messages ({latest: - 1 , from: " e6716f9544a56c530d868e4bfbacb172315bdead" }))
54
- for (var i = 0 ; i < messages .length ; i++ ) {
55
- var message = messages[i];
56
- this .insert (0 , {num: i, from: message .from , to: message .to , value: eth .numberToHuman (message .value )})
98
+
99
+ RowLayout {
100
+ id: toFields
101
+ spacing: 10
102
+ anchors {
103
+ top: amountFields .bottom
104
+ topMargin: 5
105
+ left: parent .left
106
+ leftMargin: 20
107
+ }
108
+
109
+ Text {
110
+ text: " To"
111
+ }
112
+
113
+ Rectangle {
114
+ width: 200
115
+ height: 20
116
+ TextField {
117
+ id: txTo
118
+ width: parent .width
119
+ placeholderText: " Address or name"
120
+ }
121
+ }
122
+
123
+ Button {
124
+ text: " Send"
125
+ onClicked: {
126
+ var value = txValue .text + denomModel .get (valueDenom .currentIndex ).zeros ;
127
+ var gasPrice = " 10000000000000"
128
+ var res = eth .transact (eth .key ().privateKey , txTo .text , value, " 500" , gasPrice, " " )
129
+ console .log (res)
130
+ }
131
+ }
132
+ }
133
+ }
134
+
135
+ Rectangle {
136
+ anchors {
137
+ left: parent .left
138
+ right: parent .right
139
+ top: newTxPane .bottom
140
+ topMargin: 10
141
+ bottom: parent .bottom
142
+ }
143
+ TableView {
144
+ id: txTableView
145
+ anchors .fill : parent
146
+ TableViewColumn{ role: " num" ; title: " #" ; width: 30 }
147
+ TableViewColumn{ role: " from" ; title: " From" ; width: 280 }
148
+ TableViewColumn{ role: " to" ; title: " To" ; width: 280 }
149
+ TableViewColumn{ role: " value" ; title: " Amount" ; width: 100 }
150
+
151
+ model: ListModel {
152
+ id: txModel
153
+ Component .onCompleted : {
154
+ var messages = JSON .parse (eth .messages ({latest: - 1 , from: " e6716f9544a56c530d868e4bfbacb172315bdead" }))
155
+ for (var i = 0 ; i < messages .length ; i++ ) {
156
+ var message = messages[i];
157
+ this .insert (0 , {num: i, from: message .from , to: message .to , value: eth .numberToHuman (message .value )})
158
+ }
57
159
}
58
160
}
59
161
}
0 commit comments