Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
ercoin-browser-wallet
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ercoin
ercoin-browser-wallet
Commits
2e49a44a
Verified
Commit
2e49a44a
authored
Sep 26, 2018
by
Krzysztof Jurewicz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add vote transaction
parent
6f2fe011
Pipeline
#31246667
passed with stages
in 4 minutes and 50 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
12 deletions
+53
-12
core.cljs
src/ercoin_wallet/core.cljs
+42
-12
tx.cljs
src/ercoin_wallet/tx.cljs
+11
-0
No files found.
src/ercoin_wallet/core.cljs
View file @
2e49a44a
...
...
@@ -182,18 +182,20 @@
{
:on-click
#
(
reset!
account-atom
account
)}
(
::a/label
account
)]))]])
(
defn
amount-field
[
amount-atom
]
(
let
[{
:keys
[
:resolution
:symbol
]}
(
units/get-unit
@
unit
)]
[
:p
[
:label
"Amount"
]
[
:input
{
:type
:number
:value
(
unit-encode
@
amount-atom
)
:min
0
:step
(
if
(
=
0
resolution
)
1
(
apply
str
(
concat
"0."
(
repeat
(
-
resolution
1
)
0
)
"1"
)))
:on-change
#
(
reset!
amount-atom
(
->
%
.-target
.-value
(
unit-decode
)))}]
" "
symbol
]))
(
defn
amount-field
([
amount-atom
]
(
amount-field
amount-atom
"Amount"
))
([
amount-atom
label
]
(
let
[{
:keys
[
:resolution
:symbol
]}
(
units/get-unit
@
unit
)]
[
:p
[
:label
label
]
[
:input
{
:type
:number
:value
(
unit-encode
@
amount-atom
)
:min
0
:step
(
if
(
=
0
resolution
)
1
(
apply
str
(
concat
"0."
(
repeat
(
-
resolution
1
)
0
)
"1"
)))
:on-change
#
(
reset!
amount-atom
(
->
%
.-target
.-value
(
unit-decode
)))}]
" "
symbol
])))
(
defn
auto-valid-since
[
valid-since-atom
]
(
go
...
...
@@ -294,6 +296,33 @@
:value
"Generate"
}]]
[
generated-tx
tx
]])))
(
defn
vote-tx-form
[]
(
let
[
validator
(
r/atom
nil
)
valid-since
(
r/atom
nil
)
per-tx
(
r/atom
nil
)
per-256b
(
r/atom
nil
)
per-account-day
(
r/atom
nil
)
protocol
(
r/atom
1
)
tx
(
r/atom
nil
)]
(
fn
[]
[
:div
[
account-select
"Validator"
validator
]
[
amount-field
per-tx
"Fee per tx"
]
[
amount-field
per-256b
"Fee per 256 bytes"
]
[
amount-field
per-account-day
"Fee per account/day"
]
[
:p
[
:label
"Protocol"
]
[
:input
{
:type
:number
:value
@
protocol
:readonly
true
}]]
[
valid-since-input
valid-since
]
[
:p
[
:input
{
:type
:button
:on-click
#
(
reset!
tx
(
tx/vote-tx
@
valid-since
@
validator
@
per-tx
@
per-256b
@
per-account-day
@
protocol
))
:value
"Generate"
}]]
[
generated-tx
tx
]
])))
(
defn
genesis-tx-form
[]
(
let
[
from
(
r/atom
nil
)
locked
(
r/atom
false
)
...
...
@@ -334,6 +363,7 @@
types
(
array-map
:transfer
transfer-tx-form
:account
account-tx-form
:lock
lock-tx-form
:vote
vote-tx-form
:genesis
genesis-tx-form
)]
(
fn
[]
[
:div
...
...
src/ercoin_wallet/tx.cljs
View file @
2e49a44a
...
...
@@ -43,6 +43,17 @@
(
::a/address
validator
))]
(
sign
to-sign
account
)))
(
defn
vote-tx
[
valid-since
validator
per-tx
per-256b
per-account-day
protocol
]
(
->
(
concat
[
3
]
(
uint/uint->vec
valid-since
4
)
(
::a/address
validator
)
(
uint/uint->vec
per-tx
8
)
(
uint/uint->vec
per-256b
8
)
(
uint/uint->vec
per-account-day
8
)
[
protocol
])
(
sign
validator
)))
(
defn
genesis-tx
[
from
locked-until
validator
]
(
let
[
locked-until-vec
(
drop-while
#
(
=
0
%
)
(
uint/uint->vec
(
or
locked-until
0
)
3
))
to-sign
(
concat
...
...
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