From 3226095ba99ab2997d3d6a6383fc79a2c8c75d14 Mon Sep 17 00:00:00 2001 From: Brian Sztamfater Date: Thu, 21 Nov 2024 14:33:45 -0300 Subject: [PATCH] fix no routes found state Signed-off-by: Brian Sztamfater --- .../contexts/wallet/send/events.cljs | 23 +++++++------------ .../wallet/send/input_amount/view.cljs | 9 ++++---- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/status_im/contexts/wallet/send/events.cljs b/src/status_im/contexts/wallet/send/events.cljs index a3d9dc3534..df93083bc4 100644 --- a/src/status_im/contexts/wallet/send/events.cljs +++ b/src/status_im/contexts/wallet/send/events.cljs @@ -152,23 +152,16 @@ (rf/reg-event-fx :wallet/select-send-address (fn [{:keys [db]} [{:keys [address recipient stack-id start-flow?]}]] - (let [[prefix to-address] (utils/split-prefix-and-address address) - testnet-enabled? (get-in db [:profile/profile :test-networks-enabled?]) - receiver-networks (network-utils/resolve-receiver-networks - {:prefix prefix - :testnet-enabled? testnet-enabled?}) - collectible-tx? (send-utils/tx-type-collectible? - (-> db :wallet :ui :send :tx-type)) - collectible (when collectible-tx? - (-> db :wallet :ui :send :collectible)) - one-collectible? (when collectible-tx? - (= (collectible.utils/collectible-balance collectible) 1))] + (let [[to-address] (utils/split-prefix-and-address address) + collectible-tx? (send-utils/tx-type-collectible? + (-> db :wallet :ui :send :tx-type)) + collectible (when collectible-tx? + (-> db :wallet :ui :send :collectible)) + one-collectible? (when collectible-tx? + (= (collectible.utils/collectible-balance collectible) 1))] {:db (-> db (assoc-in [:wallet :ui :send :recipient] (or recipient address)) - (assoc-in [:wallet :ui :send :to-address] to-address) - (assoc-in [:wallet :ui :send :address-prefix] prefix) - (assoc-in [:wallet :ui :send :receiver-preferred-networks] receiver-networks) - (assoc-in [:wallet :ui :send :receiver-networks] receiver-networks)) + (assoc-in [:wallet :ui :send :to-address] to-address)) :fx [(when (and collectible-tx? one-collectible?) [:dispatch [:wallet/start-get-suggested-routes {:amount 1}]]) [:dispatch diff --git a/src/status_im/contexts/wallet/send/input_amount/view.cljs b/src/status_im/contexts/wallet/send/input_amount/view.cljs index 1225ff8781..38be7b50b8 100644 --- a/src/status_im/contexts/wallet/send/input_amount/view.cljs +++ b/src/status_im/contexts/wallet/send/input_amount/view.cljs @@ -145,10 +145,11 @@ input-value (rf/sub [:wallet/send-amount-fixed (/ input-value conversion-rate)])) - routes (when suggested-routes - (or (:best suggested-routes) [])) + routes-request-uuid (when suggested-routes + (:uuid suggested-routes)) no-routes-found? (and - (some? routes) + routes-request-uuid + (empty? route) (not loading-routes?)) input-error (controlled-input/input-error input-state) limit-exceeded? (controlled-input/upper-limit-exceeded? input-state) @@ -186,7 +187,7 @@ :bounce-duration-ms bounce-duration-ms :token token :reset-amounts-to-zero? (and limit-exceeded? - (some? routes))})) + (some? route))})) swap-between-fiat-and-crypto (fn [] (if crypto-currency? (set-input-state