fix: stop bridge routes on amount confirm

This commit is contained in:
Cristian Lungu 2024-09-20 16:40:34 +03:00
parent 7b0476e28c
commit 6e75bfa291
No known key found for this signature in database
GPG Key ID: 00D675EDE1B264D9
3 changed files with 7 additions and 7 deletions

View File

@ -19,6 +19,7 @@
[:wallet/bridge-from-chain-ids]) [:wallet/bridge-from-chain-ids])
:from-enabled-networks (rf/sub [:wallet/bridge-from-networks]) :from-enabled-networks (rf/sub [:wallet/bridge-from-networks])
:on-confirm (fn [amount] :on-confirm (fn [amount]
(rf/dispatch [:wallet/stop-get-suggested-routes])
(rf/dispatch [:wallet/set-token-amount-to-bridge (rf/dispatch [:wallet/set-token-amount-to-bridge
{:amount amount {:amount amount
:stack-id :screen/wallet.bridge-input-amount}])) :stack-id :screen/wallet.bridge-input-amount}]))

View File

@ -138,7 +138,7 @@
(defn view (defn view
;; crypto-decimals, limit-crypto and initial-crypto-currency? args are needed ;; crypto-decimals, limit-crypto and initial-crypto-currency? args are needed
;; for component tests only ;; for component tests only
[{default-on-confirm :on-confirm [{on-confirm :on-confirm
default-limit-crypto :limit-crypto default-limit-crypto :limit-crypto
default-crypto-decimals :crypto-decimals default-crypto-decimals :crypto-decimals
on-navigate-back :on-navigate-back on-navigate-back :on-navigate-back
@ -155,11 +155,6 @@
on-navigate-back on-navigate-back on-navigate-back on-navigate-back
[just-toggled-mode? set-just-toggled-mode?] (rn/use-state false) [just-toggled-mode? set-just-toggled-mode?] (rn/use-state false)
handle-on-confirm (fn [amount]
(rf/dispatch [:wallet/stop-get-suggested-routes])
(rf/dispatch [:wallet/set-token-amount-to-send
{:amount amount
:stack-id current-screen-id}]))
{fiat-currency :currency} (rf/sub [:profile/profile]) {fiat-currency :currency} (rf/sub [:profile/profile])
{token-symbol :symbol {token-symbol :symbol
token-networks :networks token-networks :networks
@ -190,7 +185,6 @@
loading-routes? (rf/sub loading-routes? (rf/sub
[:wallet/wallet-send-loading-suggested-routes?]) [:wallet/wallet-send-loading-suggested-routes?])
route (rf/sub [:wallet/wallet-send-route]) route (rf/sub [:wallet/wallet-send-route])
on-confirm (or default-on-confirm handle-on-confirm)
crypto-decimals (or token-decimals default-crypto-decimals) crypto-decimals (or token-decimals default-crypto-decimals)
input-value (controlled-input/input-value input-state) input-value (controlled-input/input-value input-state)
valid-input? (not (or (controlled-input/empty-value? input-state) valid-input? (not (or (controlled-input/empty-value? input-state)

View File

@ -14,6 +14,11 @@
:button-one-label (i18n/label :t/review-send) :button-one-label (i18n/label :t/review-send)
:enabled-from-chain-ids (rf/sub :enabled-from-chain-ids (rf/sub
[:wallet/wallet-send-enabled-from-chain-ids]) [:wallet/wallet-send-enabled-from-chain-ids])
:on-confirm (fn [amount]
(rf/dispatch [:wallet/stop-get-suggested-routes])
(rf/dispatch [:wallet/set-token-amount-to-send
{:amount amount
:stack-id :screen/wallet.send-input-amount}]))
:from-enabled-networks (rf/sub [:wallet/wallet-send-enabled-networks]) :from-enabled-networks (rf/sub [:wallet/wallet-send-enabled-networks])
:on-navigate-back (fn [] :on-navigate-back (fn []
(rf/dispatch [:wallet/clean-disabled-from-networks]) (rf/dispatch [:wallet/clean-disabled-from-networks])