[#21132] fix: add on-success callback
This commit is contained in:
parent
48f0af4d36
commit
bb0847f463
|
@ -2,7 +2,6 @@
|
|||
(:require [cljs-bean.core :as bean]
|
||||
[clojure.string :as string]
|
||||
[native-module.core :as native-module]
|
||||
[re-frame.core :as rf]
|
||||
[status-im.constants :as constants]
|
||||
[status-im.contexts.wallet.wallet-connect.utils.data-store :as
|
||||
data-store]
|
||||
|
@ -11,6 +10,7 @@
|
|||
[status-im.contexts.wallet.wallet-connect.utils.transactions :as transactions]
|
||||
[taoensso.timbre :as log]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]
|
||||
[utils.transforms :as transforms]))
|
||||
|
||||
(rf/reg-event-fx
|
||||
|
@ -37,7 +37,9 @@
|
|||
(assoc-in [:wallet-connect/current-request :response-sent?] false))
|
||||
:fx [(condp = method
|
||||
constants/wallet-connect-eth-send-transaction-method
|
||||
[:dispatch [:wallet-connect/process-eth-send-transaction]]
|
||||
[:dispatch
|
||||
[:wallet-connect/process-eth-send-transaction
|
||||
{:on-success (fn [] (rf/dispatch [:wallet-connect/show-request-modal]))}]]
|
||||
|
||||
constants/wallet-connect-eth-sign-method
|
||||
[:dispatch [:wallet-connect/process-eth-sign]]
|
||||
|
@ -82,7 +84,7 @@
|
|||
|
||||
(rf/reg-event-fx
|
||||
:wallet-connect/prepare-transaction-success
|
||||
(fn [{:keys [db]} [prepared-tx chain-id refetch?]]
|
||||
(fn [{:keys [db]} [prepared-tx chain-id]]
|
||||
(let [{:keys [tx-args]} prepared-tx
|
||||
tx (bean/->clj tx-args)
|
||||
address (-> tx :from string/lower-case)
|
||||
|
@ -94,12 +96,11 @@
|
|||
:raw-data prepared-tx
|
||||
:transaction tx
|
||||
:chain-id chain-id
|
||||
:display-data display-data)
|
||||
:fx [(when-not refetch? [:dispatch [:wallet-connect/show-request-modal]])]})))
|
||||
:display-data display-data)})))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet-connect/process-eth-send-transaction
|
||||
(fn [{:keys [db]} [refetch?]]
|
||||
(fn [{:keys [db]} [{:keys [on-success]}]]
|
||||
(let [event (data-store/get-db-current-request-event db)
|
||||
tx (-> event data-store/get-request-params first)
|
||||
chain-id (-> event
|
||||
|
@ -109,8 +110,10 @@
|
|||
{:fx [[:effects.wallet-connect/prepare-transaction
|
||||
{:tx tx
|
||||
:chain-id chain-id
|
||||
:on-success #(rf/dispatch [:wallet-connect/prepare-transaction-success % chain-id
|
||||
refetch?])
|
||||
:on-success (fn [data]
|
||||
(rf/dispatch [:wallet-connect/prepare-transaction-success data chain-id])
|
||||
(when on-success
|
||||
(rf/call-continuation on-success)))
|
||||
:on-error #(rf/dispatch [:wallet-connect/on-processing-error %])}]]}))))
|
||||
|
||||
(rf/reg-event-fx
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
(defn- refetch-transaction
|
||||
[]
|
||||
(rf/dispatch [:wallet-connect/process-eth-send-transaction true]))
|
||||
(rf/dispatch [:wallet-connect/process-eth-send-transaction]))
|
||||
|
||||
(def tabs-data
|
||||
[{:id :tab/data :label (i18n/label :t/data)}
|
||||
|
|
Loading…
Reference in New Issue