fix(wallet): adjust max amount to not include network being bridged to (#20604)
This commit is contained in:
parent
cef1308b3a
commit
3ab345563c
|
@ -12,13 +12,16 @@
|
||||||
(hot-reload/use-safe-unmount #(rf/dispatch [:wallet/clean-routes-calculation]))
|
(hot-reload/use-safe-unmount #(rf/dispatch [:wallet/clean-routes-calculation]))
|
||||||
[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
|
||||||
:button-one-label (i18n/label :t/review-bridge)
|
:button-one-label (i18n/label :t/review-bridge)
|
||||||
:button-one-props {:icon-left :i/bridge}
|
:button-one-props {:icon-left :i/bridge}
|
||||||
:on-confirm (fn [amount]
|
:enabled-from-chain-ids (rf/sub
|
||||||
(rf/dispatch [:wallet/set-token-amount-to-bridge
|
[:wallet/bridge-from-chain-ids])
|
||||||
{:amount amount
|
:from-enabled-networks (rf/sub [:wallet/bridge-from-networks])
|
||||||
:stack-id :screen/wallet.bridge-input-amount}]))
|
:on-confirm (fn [amount]
|
||||||
:on-navigate-back (fn []
|
(rf/dispatch [:wallet/set-token-amount-to-bridge
|
||||||
(rf/dispatch [:wallet/clean-disabled-from-networks])
|
{:amount amount
|
||||||
(rf/dispatch [:wallet/clean-send-amount]))}]])
|
:stack-id :screen/wallet.bridge-input-amount}]))
|
||||||
|
:on-navigate-back (fn []
|
||||||
|
(rf/dispatch [:wallet/clean-disabled-from-networks])
|
||||||
|
(rf/dispatch [:wallet/clean-send-amount]))}]])
|
||||||
|
|
|
@ -146,6 +146,8 @@
|
||||||
button-one-props :button-one-props
|
button-one-props :button-one-props
|
||||||
current-screen-id :current-screen-id
|
current-screen-id :current-screen-id
|
||||||
initial-crypto-currency? :initial-crypto-currency?
|
initial-crypto-currency? :initial-crypto-currency?
|
||||||
|
enabled-from-chain-ids :enabled-from-chain-ids
|
||||||
|
from-enabled-networks :from-enabled-networks
|
||||||
:or {initial-crypto-currency? true}}]
|
:or {initial-crypto-currency? true}}]
|
||||||
(let [_ (rn/dismiss-keyboard!)
|
(let [_ (rn/dismiss-keyboard!)
|
||||||
bottom (safe-area/get-bottom)
|
bottom (safe-area/get-bottom)
|
||||||
|
@ -164,9 +166,6 @@
|
||||||
token-decimals :decimals
|
token-decimals :decimals
|
||||||
:as
|
:as
|
||||||
token} (rf/sub [:wallet/wallet-send-token])
|
token} (rf/sub [:wallet/wallet-send-token])
|
||||||
send-enabled-networks (rf/sub [:wallet/wallet-send-enabled-networks])
|
|
||||||
enabled-from-chain-ids (rf/sub
|
|
||||||
[:wallet/wallet-send-enabled-from-chain-ids])
|
|
||||||
send-from-locked-amounts (rf/sub [:wallet/wallet-send-from-locked-amounts])
|
send-from-locked-amounts (rf/sub [:wallet/wallet-send-from-locked-amounts])
|
||||||
{token-balance :total-balance
|
{token-balance :total-balance
|
||||||
available-balance :available-balance
|
available-balance :available-balance
|
||||||
|
@ -355,7 +354,7 @@
|
||||||
:currency-symbol currency-symbol
|
:currency-symbol currency-symbol
|
||||||
:crypto-decimals (min token-decimals 6)
|
:crypto-decimals (min token-decimals 6)
|
||||||
:error? (controlled-input/input-error input-state)
|
:error? (controlled-input/input-error input-state)
|
||||||
:networks (seq send-enabled-networks)
|
:networks (seq from-enabled-networks)
|
||||||
:title (i18n/label
|
:title (i18n/label
|
||||||
:t/send-limit
|
:t/send-limit
|
||||||
{:limit (if crypto-currency?
|
{:limit (if crypto-currency?
|
||||||
|
@ -429,3 +428,4 @@
|
||||||
(set-just-toggled-mode? false)
|
(set-just-toggled-mode? false)
|
||||||
(set-input-state controlled-input/delete-all)
|
(set-input-state controlled-input/delete-all)
|
||||||
(rf/dispatch [:wallet/clean-suggested-routes]))}]]))
|
(rf/dispatch [:wallet/clean-suggested-routes]))}]]))
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,12 @@
|
||||||
(defn view
|
(defn view
|
||||||
[]
|
[]
|
||||||
[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)
|
||||||
:on-navigate-back (fn []
|
:enabled-from-chain-ids (rf/sub
|
||||||
(rf/dispatch [:wallet/clean-disabled-from-networks])
|
[:wallet/wallet-send-enabled-from-chain-ids])
|
||||||
(rf/dispatch [:wallet/clean-from-locked-amounts])
|
:from-enabled-networks (rf/sub [:wallet/wallet-send-enabled-networks])
|
||||||
(rf/dispatch [:wallet/clean-send-amount]))}])
|
:on-navigate-back (fn []
|
||||||
|
(rf/dispatch [:wallet/clean-disabled-from-networks])
|
||||||
|
(rf/dispatch [:wallet/clean-from-locked-amounts])
|
||||||
|
(rf/dispatch [:wallet/clean-send-amount]))}])
|
||||||
|
|
|
@ -61,3 +61,22 @@
|
||||||
:wallet/send-token-not-supported-in-receiver-networks?
|
:wallet/send-token-not-supported-in-receiver-networks?
|
||||||
:<- [:wallet/wallet-send]
|
:<- [:wallet/wallet-send]
|
||||||
:-> :token-not-supported-in-receiver-networks?)
|
:-> :token-not-supported-in-receiver-networks?)
|
||||||
|
|
||||||
|
(rf/reg-sub
|
||||||
|
:wallet/bridge-from-networks
|
||||||
|
:<- [:wallet/wallet-send]
|
||||||
|
:<- [:wallet/network-details]
|
||||||
|
(fn [[{:keys [bridge-to-chain-id]} networks]]
|
||||||
|
(set (filter (fn [network]
|
||||||
|
(not= (:chain-id network) bridge-to-chain-id))
|
||||||
|
networks))))
|
||||||
|
|
||||||
|
(rf/reg-sub
|
||||||
|
:wallet/bridge-from-chain-ids
|
||||||
|
:<- [:wallet/wallet-send]
|
||||||
|
:<- [:wallet/networks-by-mode]
|
||||||
|
(fn [[{:keys [bridge-to-chain-id]} networks]]
|
||||||
|
(keep (fn [network]
|
||||||
|
(when (not= (:chain-id network) bridge-to-chain-id)
|
||||||
|
(:chain-id network)))
|
||||||
|
networks)))
|
||||||
|
|
Loading…
Reference in New Issue