Compare commits

...
4 changed files with 22 additions and 14 deletions
@@ -9,7 +9,7 @@
(defn view
[]
(hot-reload/use-safe-unmount #(rf/dispatch [:wallet/stop-get-suggested-routes]))
(hot-reload/use-safe-unmount #(rf/dispatch [:wallet/suggested-routes-cleanup]))
[rn/view {:style style/bridge-send-wrapper}
[input-amount/view
{:current-screen-id :screen/wallet.bridge-input-amount
@@ -19,6 +19,7 @@
[:wallet/bridge-from-chain-ids])
:from-enabled-networks (rf/sub [:wallet/bridge-from-networks])
:on-confirm (fn [amount]
(rf/dispatch [:wallet/stop-get-suggested-routes])
(rf/dispatch [:wallet/set-token-amount-to-bridge
{:amount amount
:stack-id :screen/wallet.bridge-input-amount}]))
+12 -7
View File
@@ -489,13 +489,18 @@
(rf/reg-event-fx :wallet/stop-get-suggested-routes
(fn []
{:fx [[:dispatch [:wallet/clean-routes-calculation]]]
:json-rpc/call [{:method "wallet_stopSuggestedRoutesAsyncCalculation"
:params []
:on-error (fn [error]
(log/error "failed to stop suggested routes calculation"
{:event :wallet/stop-get-suggested-routes
:error error}))}]}))
{:fx [[:json-rpc/call
[{:method "wallet_stopSuggestedRoutesAsyncCalculation"
:params []
:on-error (fn [error]
(log/error "failed to stop suggested routes calculation"
{:event :wallet/stop-get-suggested-routes
:error error}))}]]]}))
(rf/reg-event-fx :wallet/suggested-routes-cleanup
(fn []
{:fx [[:dispatch [:wallet/clean-routes-calculation]]
[:dispatch [:wallet/stop-get-suggested-routes]]]}))
(defn- bridge-amount-greater-than-bonder-fees?
[{{token-decimals :decimals} :from-token
@@ -138,7 +138,7 @@
(defn view
;; crypto-decimals, limit-crypto and initial-crypto-currency? args are needed
;; for component tests only
[{default-on-confirm :on-confirm
[{on-confirm :on-confirm
default-limit-crypto :limit-crypto
default-crypto-decimals :crypto-decimals
on-navigate-back :on-navigate-back
@@ -155,10 +155,6 @@
on-navigate-back on-navigate-back
[just-toggled-mode? set-just-toggled-mode?] (rn/use-state false)
handle-on-confirm (fn [amount]
(rf/dispatch [:wallet/set-token-amount-to-send
{:amount amount
:stack-id current-screen-id}]))
{fiat-currency :currency} (rf/sub [:profile/profile])
{token-symbol :symbol
token-networks :networks
@@ -186,7 +182,6 @@
loading-routes? (rf/sub
[:wallet/wallet-send-loading-suggested-routes?])
route (rf/sub [:wallet/wallet-send-route])
on-confirm (or default-on-confirm handle-on-confirm)
crypto-decimals (or token-decimals default-crypto-decimals)
max-limit (if crypto-currency?
(utils/cut-crypto-decimals-to-fit-usd-cents
@@ -2,16 +2,23 @@
(:require
[quo.theme]
[status-im.contexts.wallet.send.input-amount.view :as input-amount]
[status-im.setup.hot-reload :as hot-reload]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn view
[]
(hot-reload/use-safe-unmount #(rf/dispatch [:wallet/suggested-routes-cleanup]))
[input-amount/view
{:current-screen-id :screen/wallet.send-input-amount
:button-one-label (i18n/label :t/review-send)
:enabled-from-chain-ids (rf/sub
[: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])
:on-navigate-back (fn []
(rf/dispatch [:wallet/clean-disabled-from-networks])