feat: stop-get-suggested-routes on amount confirm

This commit is contained in:
Cristian Lungu 2024-09-20 13:32:03 +03:00
parent 1ee16da0c7
commit 7b0476e28c
No known key found for this signature in database
GPG Key ID: 00D675EDE1B264D9
4 changed files with 16 additions and 8 deletions

View File

@ -9,7 +9,7 @@
(defn view (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} [rn/view {:style style/bridge-send-wrapper}
[input-amount/view [input-amount/view
{:current-screen-id :screen/wallet.bridge-input-amount {:current-screen-id :screen/wallet.bridge-input-amount

View File

@ -489,13 +489,18 @@
(rf/reg-event-fx :wallet/stop-get-suggested-routes (rf/reg-event-fx :wallet/stop-get-suggested-routes
(fn [] (fn []
{:fx [[:dispatch [:wallet/clean-routes-calculation]]] {:fx [[:json-rpc/call
:json-rpc/call [{:method "wallet_stopSuggestedRoutesAsyncCalculation" [{:method "wallet_stopSuggestedRoutesAsyncCalculation"
:params [] :params []
:on-error (fn [error] :on-error (fn [error]
(log/error "failed to stop suggested routes calculation" (log/error "failed to stop suggested routes calculation"
{:event :wallet/stop-get-suggested-routes {:event :wallet/stop-get-suggested-routes
:error error}))}]})) :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? (defn- bridge-amount-greater-than-bonder-fees?
[{{token-decimals :decimals} :from-token [{{token-decimals :decimals} :from-token

View File

@ -156,6 +156,7 @@
[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] handle-on-confirm (fn [amount]
(rf/dispatch [:wallet/stop-get-suggested-routes])
(rf/dispatch [:wallet/set-token-amount-to-send (rf/dispatch [:wallet/set-token-amount-to-send
{:amount amount {:amount amount
:stack-id current-screen-id}])) :stack-id current-screen-id}]))

View File

@ -2,11 +2,13 @@
(:require (:require
[quo.theme] [quo.theme]
[status-im.contexts.wallet.send.input-amount.view :as input-amount] [status-im.contexts.wallet.send.input-amount.view :as input-amount]
[status-im.setup.hot-reload :as hot-reload]
[utils.i18n :as i18n] [utils.i18n :as i18n]
[utils.re-frame :as rf])) [utils.re-frame :as rf]))
(defn view (defn view
[] []
(hot-reload/use-safe-unmount #(rf/dispatch [:wallet/suggested-routes-cleanup]))
[input-amount/view [input-amount/view
{:current-screen-id :screen/wallet.send-input-amount {:current-screen-id :screen/wallet.send-input-amount
:button-one-label (i18n/label :t/review-send) :button-one-label (i18n/label :t/review-send)