Fix issues with :confirm-payout re-frame handler
This commit is contained in:
parent
9885014235
commit
5ab68f3b18
|
@ -344,6 +344,7 @@
|
||||||
(defn send-transaction-callback
|
(defn send-transaction-callback
|
||||||
[issue-id]
|
[issue-id]
|
||||||
(fn [error payout-hash]
|
(fn [error payout-hash]
|
||||||
|
(println "send-transaction-callback" error payout-hash)
|
||||||
(when error
|
(when error
|
||||||
(dispatch [:set-flash-message
|
(dispatch [:set-flash-message
|
||||||
:error
|
:error
|
||||||
|
@ -354,7 +355,7 @@
|
||||||
|
|
||||||
(defn sig->method-id [w3 sig]
|
(defn sig->method-id [w3 sig]
|
||||||
(println "sig->method-id" w3 sig)
|
(println "sig->method-id" w3 sig)
|
||||||
(let [sha3 (fn [x] (web3/sha3 w3 x))]
|
(let [sha3 (fn [x] (web3/sha3 x w3))]
|
||||||
(apply str (take 10 (sha3 sig)))))
|
(apply str (take 10 (sha3 sig)))))
|
||||||
|
|
||||||
(defn strip-0x [x]
|
(defn strip-0x [x]
|
||||||
|
@ -374,18 +375,18 @@
|
||||||
confirm-id)
|
confirm-id)
|
||||||
payload {:from owner-address
|
payload {:from owner-address
|
||||||
:to contract-address
|
:to contract-address
|
||||||
:gas 200000
|
:gas 180000
|
||||||
:gas-price 8000000000
|
:gas-price 20000000000
|
||||||
:value 0
|
:value 0
|
||||||
:data data}]
|
:data data}]
|
||||||
(println "data:" data)
|
(println "data:" data)
|
||||||
(try
|
(try
|
||||||
(web3-eth/send-transaction! w3 payload
|
(web3-eth/send-transaction! w3 payload
|
||||||
(send-transaction-callback issue-id))
|
(send-transaction-callback issue-id))
|
||||||
{:db (assoc-in db [:owner-bounties issue-id :confirming?] true)}
|
{:db (assoc-in db [:owner-bounties issue-id :confirming?] true)}
|
||||||
(catch js/Error e
|
(catch js/Error e
|
||||||
{:db (assoc-in db [:owner-bounties issue-id :confirm-failed?] true)
|
{:db (assoc-in db [:owner-bounties issue-id :confirm-failed?] true)
|
||||||
:dispatch-n [[:payout-confirm-failed issue-id]
|
:dispatch-n [[:payout-confirm-failed issue-id e]
|
||||||
[:set-flash-message
|
[:set-flash-message
|
||||||
:error
|
:error
|
||||||
(str "Failed to send transaction" e)]]})))))
|
(str "Failed to send transaction" e)]]})))))
|
||||||
|
@ -400,8 +401,8 @@
|
||||||
|
|
||||||
(reg-event-db
|
(reg-event-db
|
||||||
:payout-confirm-failed
|
:payout-confirm-failed
|
||||||
(fn [db [_ issue-id]]
|
(fn [db [_ issue-id e]]
|
||||||
(println "payout-confirm-failed" issue-id)
|
(println "payout-confirm-failed" issue-id e)
|
||||||
(-> db
|
(-> db
|
||||||
(dissoc-in [:owner-bounties issue-id :confirming?])
|
(dissoc-in [:owner-bounties issue-id :confirming?])
|
||||||
(assoc-in [:owner-bounties issue-id :confirm-failed?] true))))
|
(assoc-in [:owner-bounties issue-id :confirm-failed?] true))))
|
||||||
|
|
Loading…
Reference in New Issue