fix no routes found state

Signed-off-by: Brian Sztamfater <brian@status.im>
This commit is contained in:
Brian Sztamfater 2024-11-21 14:33:45 -03:00
parent ac0f8e4e70
commit 3226095ba9
No known key found for this signature in database
GPG Key ID: 59EB921E0706B48F
2 changed files with 13 additions and 19 deletions

View File

@ -152,23 +152,16 @@
(rf/reg-event-fx (rf/reg-event-fx
:wallet/select-send-address :wallet/select-send-address
(fn [{:keys [db]} [{:keys [address recipient stack-id start-flow?]}]] (fn [{:keys [db]} [{:keys [address recipient stack-id start-flow?]}]]
(let [[prefix to-address] (utils/split-prefix-and-address address) (let [[to-address] (utils/split-prefix-and-address address)
testnet-enabled? (get-in db [:profile/profile :test-networks-enabled?]) collectible-tx? (send-utils/tx-type-collectible?
receiver-networks (network-utils/resolve-receiver-networks (-> db :wallet :ui :send :tx-type))
{:prefix prefix collectible (when collectible-tx?
:testnet-enabled? testnet-enabled?}) (-> db :wallet :ui :send :collectible))
collectible-tx? (send-utils/tx-type-collectible? one-collectible? (when collectible-tx?
(-> db :wallet :ui :send :tx-type)) (= (collectible.utils/collectible-balance collectible) 1))]
collectible (when collectible-tx?
(-> db :wallet :ui :send :collectible))
one-collectible? (when collectible-tx?
(= (collectible.utils/collectible-balance collectible) 1))]
{:db (-> db {:db (-> db
(assoc-in [:wallet :ui :send :recipient] (or recipient address)) (assoc-in [:wallet :ui :send :recipient] (or recipient address))
(assoc-in [:wallet :ui :send :to-address] to-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))
:fx [(when (and collectible-tx? one-collectible?) :fx [(when (and collectible-tx? one-collectible?)
[:dispatch [:wallet/start-get-suggested-routes {:amount 1}]]) [:dispatch [:wallet/start-get-suggested-routes {:amount 1}]])
[:dispatch [:dispatch

View File

@ -145,10 +145,11 @@
input-value input-value
(rf/sub [:wallet/send-amount-fixed (rf/sub [:wallet/send-amount-fixed
(/ input-value conversion-rate)])) (/ input-value conversion-rate)]))
routes (when suggested-routes routes-request-uuid (when suggested-routes
(or (:best suggested-routes) [])) (:uuid suggested-routes))
no-routes-found? (and no-routes-found? (and
(some? routes) routes-request-uuid
(empty? route)
(not loading-routes?)) (not loading-routes?))
input-error (controlled-input/input-error input-state) input-error (controlled-input/input-error input-state)
limit-exceeded? (controlled-input/upper-limit-exceeded? input-state) limit-exceeded? (controlled-input/upper-limit-exceeded? input-state)
@ -186,7 +187,7 @@
:bounce-duration-ms bounce-duration-ms :bounce-duration-ms bounce-duration-ms
:token token :token token
:reset-amounts-to-zero? (and limit-exceeded? :reset-amounts-to-zero? (and limit-exceeded?
(some? routes))})) (some? route))}))
swap-between-fiat-and-crypto (fn [] swap-between-fiat-and-crypto (fn []
(if crypto-currency? (if crypto-currency?
(set-input-state (set-input-state