remove event duplication

Signed-off-by: yenda <eric@status.im>
This commit is contained in:
Andrey Shovkoplyas 2020-02-03 09:28:49 +01:00 committed by yenda
parent c1245d7b1d
commit 6e9292c1e1
No known key found for this signature in database
GPG Key ID: 0095623C0069DCE6
1 changed files with 11 additions and 32 deletions

View File

@ -505,29 +505,6 @@
[to-norm amount-hex])})})))))
(fx/defn sign-transaction-button-clicked
{:events [:wallet.ui/sign-transaction-button-clicked]}
[{:keys [db] :as cofx} {:keys [to amount from token gas gasPrice]}]
(let [{:keys [symbol address]} token
amount-hex (str "0x" (abi-spec/number-to-hex amount))
to-norm (ethereum/normalized-hex (if (string? to) to (:address to)))
from-address (:address from)]
(fx/merge cofx
{:db (dissoc db :wallet/prepare-transaction)}
(fn [cofx]
(signing/sign cofx {:tx-obj (if (= symbol :ETH)
{:to to-norm
:from from-address
:value amount-hex}
{:to (ethereum/normalized-hex address)
:from from-address
:data (abi-spec/encode
"transfer(address,uint256)"
[to-norm amount-hex])
;;Note: data from qr (eip681)
:gas gas
:gasPrice gasPrice})})))))
(fx/defn sign-transaction-button-clicked-from-command
{:events [:wallet.ui/sign-transaction-button-clicked]}
[{:keys [db] :as cofx} {:keys [to amount from token gas gasPrice]}]
(let [{:keys [symbol address]} token
@ -537,12 +514,14 @@
(fx/merge cofx
{:db (dissoc db :wallet/prepare-transaction)}
(signing/sign
{:tx-obj (merge {:from from-address}
{:tx-obj (merge {:from from-address
;;gas and gasPrice from qr (eip681)
:gas gas
:gasPrice gasPrice}
(if (= symbol :ETH)
{:to to-norm
:value amount-hex}
{:to (ethereum/normalized-hex address)
:from from-address
:data (abi-spec/encode
"transfer(address,uint256)"
[to-norm amount-hex])}))}))))