mirror of
https://github.com/status-im/open-bounty.git
synced 2025-01-12 10:34:30 +00:00
handlers to store and remove a set of currently confirming payouts
fix remove confirming-payout dispatch and call it from confirm payout callback make sure confirming flag is set on db via handler clean up logic for confirm button assoc confirming? flag in local storage, update :payout-confirm-failed to actually produce an effect update handler to reg-event-fx
This commit is contained in:
parent
08faa879df
commit
b9c948b778
@ -425,6 +425,14 @@
|
||||
(defn strip-0x [x]
|
||||
(str/replace x #"^0x" ""))
|
||||
|
||||
(reg-event-fx
|
||||
:set-confirming-payout
|
||||
[interceptors (inject-cofx :store)]
|
||||
(fn [{:keys [db store]} [_ issue-id]]
|
||||
{:db (assoc-in db [:owner-bounties issue-id :confirming?] true)
|
||||
:store (assoc-in store [:owner-bounties issue-id :confirming?] true)}))
|
||||
|
||||
|
||||
(defn set-pending-revocation [location issue-id confirming-account]
|
||||
(assoc-in location [::db/pending-revocations issue-id]
|
||||
{:confirming-account confirming-account}))
|
||||
@ -503,9 +511,9 @@
|
||||
:data data}]
|
||||
(println "data:" data)
|
||||
(try
|
||||
(dispatch [:set-confirming-payout issue-id])
|
||||
(web3-eth/send-transaction! w3 payload
|
||||
(send-transaction-callback issue-id pending-revocations))
|
||||
{:db (assoc-in db [:owner-bounties issue-id :confirming?] true)}
|
||||
(catch js/Error e
|
||||
{:db (assoc-in db [:owner-bounties issue-id :confirm-failed?] true)
|
||||
:dispatch-n [[:payout-confirm-failed issue-id e]
|
||||
@ -515,20 +523,23 @@
|
||||
|
||||
(reg-event-fx
|
||||
:payout-confirmed
|
||||
interceptors
|
||||
[interceptors [(inject-cofx :store)]]
|
||||
(fn [{:keys [db]} [_ issue-id]]
|
||||
{:dispatch [:load-owner-bounties]
|
||||
:db (-> db
|
||||
(dissoc-in [:owner-bounties issue-id :confirming?])
|
||||
(assoc-in [:owner-bounties issue-id :confirmed?] true))}))
|
||||
(assoc-in [:owner-bounties issue-id :confirmed?] true))
|
||||
:store (dissoc-in store [:owner-bounties issue-id :confirming?])}))
|
||||
|
||||
(reg-event-db
|
||||
(reg-event-fx
|
||||
:payout-confirm-failed
|
||||
(fn [db [_ issue-id e]]
|
||||
[(inject-cofx :store)]
|
||||
(fn [{:keys [db store]} [_ issue-id e]]
|
||||
(println "payout-confirm-failed" issue-id e)
|
||||
(-> db
|
||||
{:db (-> db
|
||||
(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))
|
||||
:store (dissoc-in store [:owner-bounties issue-id :confirming?])}))
|
||||
|
||||
|
||||
(reg-event-fx
|
||||
|
@ -53,20 +53,17 @@
|
||||
|
||||
(defn confirm-button [bounty claim]
|
||||
(let [paid? (bnt/paid? claim)
|
||||
merged? (bnt/merged? claim)]
|
||||
(when (and merged? (not paid?))
|
||||
merged? (bnt/merged? claim)
|
||||
confirming? (bnt/confirming? bounty)
|
||||
bot-unmined? (bnt/bot-confirm-unmined? bounty)]
|
||||
(when (and merged?
|
||||
(:payout_address bounty)
|
||||
(not paid?)
|
||||
(not confirming?)
|
||||
(not bot-unmined?))
|
||||
[primary-button-button
|
||||
(merge {:on-click #(rf/dispatch [:confirm-payout claim])}
|
||||
(if (and merged? (not paid?) (:payout_address bounty))
|
||||
{}
|
||||
{:disabled true})
|
||||
(when (and (or (bnt/confirming? bounty)
|
||||
(bnt/bot-confirm-unmined? bounty))
|
||||
merged?)
|
||||
{:class "busy loading" :disabled true}))
|
||||
(if paid?
|
||||
"Signed off"
|
||||
"Confirm Payment")])))
|
||||
{:on-click #(rf/dispatch [:confirm-payout claim])}
|
||||
"Confirm Payment"])))
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user