mirror of
https://github.com/status-im/status-mobile.git
synced 2025-01-28 01:16:50 +00:00
basic controller added
This commit is contained in:
parent
7e5df7689b
commit
7812b393ce
@ -0,0 +1,64 @@
|
|||||||
|
(ns status-im.contexts.wallet.send.input-amount.controller
|
||||||
|
(:require
|
||||||
|
[utils.re-frame :as rf]))
|
||||||
|
|
||||||
|
(rf/reg-sub
|
||||||
|
:layers/ui
|
||||||
|
:<- [:layers]
|
||||||
|
:-> :ui)
|
||||||
|
|
||||||
|
(rf/reg-sub
|
||||||
|
:ui/send
|
||||||
|
:<- [:layers/ui]
|
||||||
|
:-> :send)
|
||||||
|
|
||||||
|
(rf/reg-sub
|
||||||
|
:ui/send-input-amount-screen
|
||||||
|
:<- [:ui/send]
|
||||||
|
:-> :input-amount-screen)
|
||||||
|
|
||||||
|
(rf/reg-sub
|
||||||
|
:controller/send-input-amount-screen
|
||||||
|
:<- [:ui/send-input-amount-screen]
|
||||||
|
:-> :controller)
|
||||||
|
|
||||||
|
(rf/reg-sub
|
||||||
|
:screen-data/send-input-amount-screen
|
||||||
|
:<- [:controller/send-input-amount-screen]
|
||||||
|
(fn [controller]
|
||||||
|
{:crypto-currency? (:crypto-currency? controller)}))
|
||||||
|
|
||||||
|
(rf/reg-event-fx
|
||||||
|
:send-input-amount-screen/swap-between-fiat-and-crypto
|
||||||
|
(fn [{:keys [db]}]
|
||||||
|
{:db (update-in db [:layers :ui :send :input-amount-screen :controller :crypto-currency?] not)}))
|
||||||
|
|
||||||
|
(comment
|
||||||
|
(rf/dispatch [:send-input-amount-screen/swap-between-fiat-and-crypto])
|
||||||
|
(rf/sub [:screen-data/send-input-amount-screen])
|
||||||
|
(rf/sub [:controller/send-input-amount-screen])
|
||||||
|
)
|
||||||
|
|
||||||
|
#_(rf/reg-sub
|
||||||
|
:wallet/wallet-send-enough-assets?
|
||||||
|
:<- [:wallet/wallet-send]
|
||||||
|
:-> :enough-assets?)
|
||||||
|
|
||||||
|
#_(rf/reg-sub
|
||||||
|
:wallet/wallet-send-token
|
||||||
|
:<- [:wallet/wallet-send]
|
||||||
|
:<- [:wallet/network-details]
|
||||||
|
:<- [:wallet/wallet-send-disabled-from-chain-ids]
|
||||||
|
(fn [[wallet-send networks disabled-from-chain-ids]]
|
||||||
|
(let [token (:token wallet-send)
|
||||||
|
disabled-from-chain-ids? (set disabled-from-chain-ids)
|
||||||
|
enabled-from-chain-ids (->> networks
|
||||||
|
(map :chain-id)
|
||||||
|
(remove disabled-from-chain-ids?)
|
||||||
|
set)]
|
||||||
|
(some-> token
|
||||||
|
(assoc :networks (network-utils/network-list token networks)
|
||||||
|
:available-balance (utils/calculate-total-token-balance token)
|
||||||
|
:total-balance (utils/calculate-total-token-balance
|
||||||
|
token
|
||||||
|
enabled-from-chain-ids))))))
|
@ -0,0 +1 @@
|
|||||||
|
(ns status-im.contexts.wallet.send.input-amount.logic)
|
@ -11,6 +11,7 @@
|
|||||||
[status-im.contexts.wallet.common.account-switcher.view :as account-switcher]
|
[status-im.contexts.wallet.common.account-switcher.view :as account-switcher]
|
||||||
[status-im.contexts.wallet.common.asset-list.view :as asset-list]
|
[status-im.contexts.wallet.common.asset-list.view :as asset-list]
|
||||||
[status-im.contexts.wallet.common.utils :as utils]
|
[status-im.contexts.wallet.common.utils :as utils]
|
||||||
|
[status-im.contexts.wallet.send.input-amount.controller :as c]
|
||||||
[status-im.contexts.wallet.send.input-amount.style :as style]
|
[status-im.contexts.wallet.send.input-amount.style :as style]
|
||||||
[status-im.contexts.wallet.send.routes.view :as routes]
|
[status-im.contexts.wallet.send.routes.view :as routes]
|
||||||
[status-im.contexts.wallet.sheets.buy-token.view :as buy-token]
|
[status-im.contexts.wallet.sheets.buy-token.view :as buy-token]
|
||||||
@ -23,6 +24,81 @@
|
|||||||
[utils.number :as number]
|
[utils.number :as number]
|
||||||
[utils.re-frame :as rf]))
|
[utils.re-frame :as rf]))
|
||||||
|
|
||||||
|
#_{:navigation-system [view-id
|
||||||
|
active-screen?]
|
||||||
|
|
||||||
|
:current-screen-ui-and-state [bottom
|
||||||
|
handle-on-confirm
|
||||||
|
on-navigate-back
|
||||||
|
[crypto-currency? set-crypto-currency]
|
||||||
|
[input-state set-input-state]
|
||||||
|
send-from-locked-amounts
|
||||||
|
clear-input!
|
||||||
|
on-confirm
|
||||||
|
input-value
|
||||||
|
valid-input?
|
||||||
|
confirm-disabled?
|
||||||
|
swap-between-fiat-and-crypto
|
||||||
|
show-select-asset-sheet
|
||||||
|
input-error
|
||||||
|
limit-exceeded?
|
||||||
|
show-no-routes?]
|
||||||
|
|
||||||
|
:currency-and-tokens [usd-conversion-rate
|
||||||
|
conversion-rate
|
||||||
|
token-decimals
|
||||||
|
{token-symbol :symbol
|
||||||
|
token-networks :networks
|
||||||
|
:as
|
||||||
|
token}
|
||||||
|
currency-symbol
|
||||||
|
crypto-decimals
|
||||||
|
amount-in-crypto
|
||||||
|
fee-formatted]
|
||||||
|
|
||||||
|
:user-profie [{fiat-currency :currency}
|
||||||
|
currency]
|
||||||
|
|
||||||
|
:accounts [token-balance
|
||||||
|
{:keys [total-balance]
|
||||||
|
:as token-by-symbol}
|
||||||
|
max-limit
|
||||||
|
current-address]
|
||||||
|
|
||||||
|
:backend-data [loading-routes?
|
||||||
|
route
|
||||||
|
first-route
|
||||||
|
routes
|
||||||
|
suggested-routes
|
||||||
|
no-routes-found?
|
||||||
|
request-fetch-routes
|
||||||
|
sender-network-values
|
||||||
|
receiver-network-values
|
||||||
|
total-amount-receiver
|
||||||
|
native-currency-symbol
|
||||||
|
tx-type
|
||||||
|
token-not-supported-in-receiver-networks?
|
||||||
|
receiver-networks
|
||||||
|
receiver-preferred-networks
|
||||||
|
receiver-preferred-networks-set
|
||||||
|
sending-to-unpreferred-networks?
|
||||||
|
should-try-again?
|
||||||
|
owned-eth-token
|
||||||
|
not-enough-asset?]
|
||||||
|
}
|
||||||
|
|
||||||
|
#_[ui
|
||||||
|
business-logic
|
||||||
|
|
||||||
|
status-go-backend
|
||||||
|
]
|
||||||
|
|
||||||
|
#_[]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(defn- estimated-fees
|
(defn- estimated-fees
|
||||||
[{:keys [loading-routes? fees amount]}]
|
[{:keys [loading-routes? fees amount]}]
|
||||||
[rn/view {:style style/estimated-fees-container}
|
[rn/view {:style style/estimated-fees-container}
|
||||||
@ -121,7 +197,7 @@
|
|||||||
[quo/alert-banner
|
[quo/alert-banner
|
||||||
{:action? true
|
{:action? true
|
||||||
:text (i18n/label :t/not-enough-assets-to-pay-gas-fees)
|
:text (i18n/label :t/not-enough-assets-to-pay-gas-fees)
|
||||||
:button-text (i18n/label :t/add-eth)
|
:button-text (i18n/label :t/buy-eth)
|
||||||
:on-button-press #(rf/dispatch [:show-bottom-sheet
|
:on-button-press #(rf/dispatch [:show-bottom-sheet
|
||||||
{:content buy-token/view}])}])
|
{:content buy-token/view}])}])
|
||||||
|
|
||||||
@ -140,26 +216,6 @@
|
|||||||
|
|
||||||
:else (rf/dispatch [:wallet/stop-and-clean-suggested-routes])))
|
:else (rf/dispatch [:wallet/stop-and-clean-suggested-routes])))
|
||||||
|
|
||||||
(defn- get-fee-formatted
|
|
||||||
[route]
|
|
||||||
(when-let [native-currency-symbol (-> route first :from :native-currency-symbol)]
|
|
||||||
(rf/sub [:wallet/wallet-send-fee-fiat-formatted native-currency-symbol])))
|
|
||||||
|
|
||||||
(defn- insufficient-asset-amount?
|
|
||||||
[{:keys [token-symbol owned-eth-token input-state no-routes-found? limit-exceeded?
|
|
||||||
sender-network-values enough-assets?]}]
|
|
||||||
(let [eth-selected? (= token-symbol (string/upper-case constants/mainnet-short-name))
|
|
||||||
zero-owned-eth? (money/equal-to (:total-balance owned-eth-token) 0)
|
|
||||||
input-at-max-owned-amount? (money/equal-to
|
|
||||||
(controlled-input/value-bn input-state)
|
|
||||||
(controlled-input/upper-limit-bn input-state))
|
|
||||||
exceeded-input? (if eth-selected?
|
|
||||||
input-at-max-owned-amount?
|
|
||||||
zero-owned-eth?)]
|
|
||||||
(and (or no-routes-found? limit-exceeded?)
|
|
||||||
(seq sender-network-values)
|
|
||||||
(or exceeded-input? (not enough-assets?)))))
|
|
||||||
|
|
||||||
(defn view
|
(defn view
|
||||||
;; crypto-decimals, limit-crypto and initial-crypto-currency? args are needed
|
;; crypto-decimals, limit-crypto and initial-crypto-currency? args are needed
|
||||||
;; for component tests only
|
;; for component tests only
|
||||||
@ -174,129 +230,148 @@
|
|||||||
enabled-from-chain-ids :enabled-from-chain-ids
|
enabled-from-chain-ids :enabled-from-chain-ids
|
||||||
from-enabled-networks :from-enabled-networks
|
from-enabled-networks :from-enabled-networks
|
||||||
:or {initial-crypto-currency? true}}]
|
:or {initial-crypto-currency? true}}]
|
||||||
(let [view-id (rf/sub [:view-id])
|
(let [{:keys [crypto-currency?] :as state} (rf/sub [:screen-data/send-input-amount-screen])
|
||||||
active-screen? (= view-id current-screen-id)
|
view-id (rf/sub [:view-id])
|
||||||
bottom (safe-area/get-bottom)
|
active-screen? (= view-id current-screen-id)
|
||||||
[crypto-currency?
|
bottom (safe-area/get-bottom)
|
||||||
set-crypto-currency] (rn/use-state initial-crypto-currency?)
|
on-navigate-back on-navigate-back
|
||||||
handle-on-confirm (fn [amount]
|
handle-on-confirm (fn [amount]
|
||||||
(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}]))
|
||||||
{fiat-currency :currency} (rf/sub [:profile/profile])
|
{fiat-currency :currency} (rf/sub [:profile/profile])
|
||||||
{token-symbol :symbol
|
{token-symbol :symbol
|
||||||
token-networks :networks
|
token-networks :networks
|
||||||
:as token} (rf/sub [:wallet/wallet-send-token])
|
:as
|
||||||
send-from-locked-amounts (rf/sub [:wallet/wallet-send-from-locked-amounts])
|
token} (rf/sub [:wallet/wallet-send-token])
|
||||||
|
send-from-locked-amounts (rf/sub [:wallet/wallet-send-from-locked-amounts])
|
||||||
{:keys [total-balance]
|
{:keys [total-balance]
|
||||||
:as token-by-symbol} (rf/sub [:wallet/token-by-symbol
|
:as token-by-symbol} (rf/sub [:wallet/token-by-symbol
|
||||||
(str token-symbol)
|
(str token-symbol)
|
||||||
enabled-from-chain-ids])
|
enabled-from-chain-ids])
|
||||||
token-balance (or default-limit-crypto total-balance)
|
token-balance (or default-limit-crypto total-balance)
|
||||||
usd-conversion-rate (utils/token-usd-price token)
|
usd-conversion-rate (utils/token-usd-price token)
|
||||||
currency (rf/sub [:profile/currency])
|
currency (rf/sub [:profile/currency])
|
||||||
conversion-rate (-> token
|
conversion-rate (-> token
|
||||||
:market-values-per-currency
|
:market-values-per-currency
|
||||||
currency
|
currency
|
||||||
:price)
|
:price)
|
||||||
token-decimals (-> token
|
token-decimals (-> token
|
||||||
utils/token-usd-price
|
utils/token-usd-price
|
||||||
utils/one-cent-value
|
utils/one-cent-value
|
||||||
utils/calc-max-crypto-decimals)
|
utils/calc-max-crypto-decimals)
|
||||||
[input-state set-input-state] (rn/use-state controlled-input/init-state)
|
[input-state set-input-state] (rn/use-state controlled-input/init-state)
|
||||||
clear-input! #(set-input-state controlled-input/delete-all)
|
clear-input! #(set-input-state controlled-input/delete-all)
|
||||||
currency-symbol (rf/sub [:profile/currency-symbol])
|
currency-symbol (rf/sub [:profile/currency-symbol])
|
||||||
loading-routes? (rf/sub [:wallet/wallet-send-loading-suggested-routes?])
|
loading-routes? (rf/sub
|
||||||
route (rf/sub [:wallet/wallet-send-route])
|
[:wallet/wallet-send-loading-suggested-routes?])
|
||||||
on-confirm (or default-on-confirm handle-on-confirm)
|
route (rf/sub [:wallet/wallet-send-route])
|
||||||
crypto-decimals (or token-decimals default-crypto-decimals)
|
on-confirm (or default-on-confirm handle-on-confirm)
|
||||||
max-limit (if crypto-currency?
|
crypto-decimals (or token-decimals default-crypto-decimals)
|
||||||
(utils/cut-crypto-decimals-to-fit-usd-cents
|
max-limit (if crypto-currency?
|
||||||
token-balance
|
(utils/cut-crypto-decimals-to-fit-usd-cents
|
||||||
usd-conversion-rate)
|
token-balance
|
||||||
(utils/cut-fiat-balance-to-two-decimals
|
usd-conversion-rate)
|
||||||
(money/crypto->fiat token-balance conversion-rate)))
|
(-> (money/crypto->fiat
|
||||||
input-value (controlled-input/input-value input-state)
|
token-balance
|
||||||
valid-input? (not (or (controlled-input/empty-value? input-state)
|
conversion-rate)
|
||||||
(controlled-input/input-error input-state)))
|
utils/cut-fiat-balance-to-two-decimals))
|
||||||
amount-in-crypto (if crypto-currency?
|
input-value (controlled-input/input-value input-state)
|
||||||
input-value
|
valid-input? (not (or (controlled-input/empty-value? input-state)
|
||||||
(number/remove-trailing-zeroes
|
(controlled-input/input-error input-state)))
|
||||||
(.toFixed (/ input-value conversion-rate)
|
confirm-disabled? (or (nil? route)
|
||||||
crypto-decimals)))
|
(empty? route)
|
||||||
total-amount-receiver (rf/sub [:wallet/total-amount true])
|
(not valid-input?))
|
||||||
amount-text (str (number/remove-trailing-zeroes
|
amount-in-crypto (if crypto-currency?
|
||||||
(.toFixed total-amount-receiver
|
input-value
|
||||||
(min token-decimals 6)))
|
(number/remove-trailing-zeroes
|
||||||
" "
|
(.toFixed (/ input-value conversion-rate)
|
||||||
token-symbol)
|
crypto-decimals)))
|
||||||
show-select-asset-sheet #(rf/dispatch
|
total-amount-receiver (rf/sub [:wallet/total-amount true])
|
||||||
[:show-bottom-sheet
|
amount-text (str (number/remove-trailing-zeroes
|
||||||
{:content (fn []
|
(.toFixed total-amount-receiver
|
||||||
[select-asset-bottom-sheet
|
(min token-decimals 6)))
|
||||||
clear-input!])}])
|
" "
|
||||||
sender-network-values (rf/sub [:wallet/wallet-send-sender-network-values])
|
token-symbol)
|
||||||
receiver-network-values (rf/sub [:wallet/wallet-send-receiver-network-values])
|
first-route (first route)
|
||||||
tx-type (rf/sub [:wallet/wallet-send-tx-type])
|
native-currency-symbol (when-not confirm-disabled?
|
||||||
unsupported-token-in-receiver? (and (not= tx-type :tx/bridge)
|
(get-in first-route
|
||||||
(->> receiver-network-values
|
[:from :native-currency-symbol]))
|
||||||
(remove #(= (:type %) :add))
|
fee-formatted (when native-currency-symbol
|
||||||
(every? #(= (:type %) :not-available))))
|
(rf/sub [:wallet/wallet-send-fee-fiat-formatted
|
||||||
suggested-routes (rf/sub [:wallet/wallet-send-suggested-routes])
|
native-currency-symbol]))
|
||||||
routes (when suggested-routes
|
show-select-asset-sheet #(rf/dispatch
|
||||||
(or (:best suggested-routes) []))
|
[:show-bottom-sheet
|
||||||
no-routes-found? (and
|
{:content (fn []
|
||||||
(every-network-value-is-zero? sender-network-values)
|
[select-asset-bottom-sheet
|
||||||
(some? routes)
|
clear-input!])}])
|
||||||
(not loading-routes?)
|
sender-network-values (rf/sub
|
||||||
(not unsupported-token-in-receiver?))
|
[:wallet/wallet-send-sender-network-values])
|
||||||
receiver-networks (rf/sub [:wallet/wallet-send-receiver-networks])
|
receiver-network-values (rf/sub
|
||||||
receiver-preferred-networks (rf/sub [:wallet/wallet-send-receiver-preferred-networks])
|
[:wallet/wallet-send-receiver-network-values])
|
||||||
receiver-preferred-network? (set receiver-preferred-networks)
|
tx-type (rf/sub [:wallet/wallet-send-tx-type])
|
||||||
sending-to-unpreferred-networks? (some (comp not receiver-preferred-network?)
|
token-not-supported-in-receiver-networks? (and (not= tx-type :tx/bridge)
|
||||||
receiver-networks)
|
(->> receiver-network-values
|
||||||
input-error (controlled-input/input-error input-state)
|
(remove #(= (:type %) :add))
|
||||||
limit-exceeded? (controlled-input/upper-limit-exceeded? input-state)
|
(every? #(= (:type %) :not-available))))
|
||||||
current-address (rf/sub [:wallet/current-viewing-account-address])
|
suggested-routes (rf/sub [:wallet/wallet-send-suggested-routes])
|
||||||
current-color (rf/sub [:wallet/current-viewing-account-color])
|
routes (when suggested-routes
|
||||||
enough-assets? (rf/sub [:wallet/wallet-send-enough-assets?])
|
(or (:best suggested-routes) []))
|
||||||
owned-eth-token (rf/sub [:wallet/token-by-symbol
|
no-routes-found? (and
|
||||||
(string/upper-case constants/mainnet-short-name)
|
(every-network-value-is-zero?
|
||||||
enabled-from-chain-ids])
|
sender-network-values)
|
||||||
not-enough-asset? (insufficient-asset-amount?
|
(not (nil? routes))
|
||||||
{:enough-assets? enough-assets?
|
(not loading-routes?)
|
||||||
:token-symbol token-symbol
|
(not token-not-supported-in-receiver-networks?))
|
||||||
:owned-eth-token owned-eth-token
|
receiver-networks (rf/sub [:wallet/wallet-send-receiver-networks])
|
||||||
:input-state input-state
|
receiver-preferred-networks (rf/sub
|
||||||
:no-routes-found? no-routes-found?
|
[:wallet/wallet-send-receiver-preferred-networks])
|
||||||
:limit-exceeded? limit-exceeded?
|
receiver-preferred-networks-set (set receiver-preferred-networks)
|
||||||
:sender-network-values sender-network-values})
|
sending-to-unpreferred-networks? (not (every? (fn [receiver-selected-network]
|
||||||
should-try-again? (and (not limit-exceeded?)
|
(contains?
|
||||||
no-routes-found?
|
receiver-preferred-networks-set
|
||||||
(not not-enough-asset?))
|
receiver-selected-network))
|
||||||
show-no-routes? (and (or no-routes-found? limit-exceeded?)
|
receiver-networks))
|
||||||
(not-empty sender-network-values)
|
input-error (controlled-input/input-error input-state)
|
||||||
(not not-enough-asset?))
|
limit-exceeded? (controlled-input/upper-limit-exceeded? input-state)
|
||||||
confirm-disabled? (or (nil? route)
|
should-try-again? (and (not limit-exceeded?) no-routes-found?)
|
||||||
(empty? route)
|
current-address (rf/sub [:wallet/current-viewing-account-address])
|
||||||
(not valid-input?))
|
owned-eth-token (rf/sub [:wallet/token-by-symbol
|
||||||
fee-formatted (when (or (not confirm-disabled?) not-enough-asset?)
|
(string/upper-case
|
||||||
(get-fee-formatted route))
|
constants/mainnet-short-name)
|
||||||
request-fetch-routes (fn [bounce-duration-ms]
|
enabled-from-chain-ids])
|
||||||
(fetch-routes
|
not-enough-asset? (and
|
||||||
{:amount amount-in-crypto
|
(or no-routes-found? limit-exceeded?)
|
||||||
:valid-input? valid-input?
|
(not-empty sender-network-values)
|
||||||
:bounce-duration-ms bounce-duration-ms
|
(if (= token-symbol
|
||||||
:token token
|
(string/upper-case
|
||||||
:reset-amounts-to-zero? (and limit-exceeded?
|
constants/mainnet-short-name))
|
||||||
(some? routes))}))
|
(money/equal-to
|
||||||
swap-between-fiat-and-crypto (fn []
|
(controlled-input/value-bn input-state)
|
||||||
(if crypto-currency?
|
(controlled-input/upper-limit-bn input-state))
|
||||||
(set-input-state
|
(money/equal-to (:total-balance
|
||||||
#(controlled-input/->fiat % conversion-rate))
|
owned-eth-token)
|
||||||
(set-input-state
|
0)))
|
||||||
#(controlled-input/->crypto % conversion-rate)))
|
show-no-routes? (and
|
||||||
(set-crypto-currency (not crypto-currency?)))]
|
(or no-routes-found? limit-exceeded?)
|
||||||
|
(not-empty sender-network-values)
|
||||||
|
(not not-enough-asset?))
|
||||||
|
request-fetch-routes (fn [bounce-duration-ms]
|
||||||
|
(fetch-routes
|
||||||
|
{:amount amount-in-crypto
|
||||||
|
:valid-input? valid-input?
|
||||||
|
:bounce-duration-ms bounce-duration-ms
|
||||||
|
:token token
|
||||||
|
:reset-amounts-to-zero? (and limit-exceeded?
|
||||||
|
(some? routes))}))
|
||||||
|
swap-between-fiat-and-crypto (fn []
|
||||||
|
(if crypto-currency?
|
||||||
|
(set-input-state
|
||||||
|
#(controlled-input/->fiat % conversion-rate))
|
||||||
|
(set-input-state
|
||||||
|
#(controlled-input/->crypto % conversion-rate)))
|
||||||
|
(rf/dispatch
|
||||||
|
[:send-input-amount-screen/swap-between-fiat-and-crypto]))]
|
||||||
(rn/use-effect
|
(rn/use-effect
|
||||||
(fn []
|
(fn []
|
||||||
(when active-screen?
|
(when active-screen?
|
||||||
@ -371,44 +446,38 @@
|
|||||||
{:token token-by-symbol
|
{:token token-by-symbol
|
||||||
:send-amount-in-crypto amount-in-crypto
|
:send-amount-in-crypto amount-in-crypto
|
||||||
:valid-input? valid-input?
|
:valid-input? valid-input?
|
||||||
:token-not-supported-in-receiver-networks? unsupported-token-in-receiver?
|
:token-not-supported-in-receiver-networks? token-not-supported-in-receiver-networks?
|
||||||
:current-screen-id current-screen-id
|
:current-screen-id current-screen-id
|
||||||
:request-fetch-routes request-fetch-routes}]
|
:request-fetch-routes request-fetch-routes}]
|
||||||
(when (and (not loading-routes?)
|
(when (and (not loading-routes?)
|
||||||
sender-network-values
|
sender-network-values
|
||||||
unsupported-token-in-receiver?)
|
token-not-supported-in-receiver-networks?)
|
||||||
[token-not-available token-symbol receiver-networks token-networks])
|
[token-not-available token-symbol receiver-networks token-networks])
|
||||||
(when not-enough-asset?
|
(when (and (not no-routes-found?) (or loading-routes? route))
|
||||||
[not-enough-asset])
|
|
||||||
(when (or (and (not no-routes-found?) (or loading-routes? route))
|
|
||||||
not-enough-asset?)
|
|
||||||
[estimated-fees
|
[estimated-fees
|
||||||
{:loading-routes? loading-routes?
|
{:loading-routes? loading-routes?
|
||||||
:fees fee-formatted
|
:fees fee-formatted
|
||||||
:amount amount-text}])
|
:amount amount-text}])
|
||||||
(when show-no-routes?
|
(cond
|
||||||
[no-routes-found])
|
show-no-routes? [no-routes-found]
|
||||||
|
not-enough-asset? [not-enough-asset])
|
||||||
[quo/bottom-actions
|
[quo/bottom-actions
|
||||||
{:actions :one-action
|
{:actions :one-action
|
||||||
:button-one-label (if should-try-again?
|
:button-one-label (if should-try-again?
|
||||||
(i18n/label :t/try-again)
|
(i18n/label :t/try-again)
|
||||||
button-one-label)
|
button-one-label)
|
||||||
:button-one-props (merge (when-not should-try-again?
|
:button-one-props (merge (when-not should-try-again? button-one-props)
|
||||||
button-one-props)
|
{:disabled? (or loading-routes?
|
||||||
{:disabled? (or not-enough-asset?
|
(and (not should-try-again?) confirm-disabled?))
|
||||||
loading-routes?
|
:on-press (cond
|
||||||
(and (not should-try-again?)
|
should-try-again?
|
||||||
confirm-disabled?))
|
#(rf/dispatch [:wallet/start-get-suggested-routes
|
||||||
:on-press (cond
|
{:amount amount-in-crypto
|
||||||
should-try-again?
|
:updated-token token-by-symbol}])
|
||||||
#(rf/dispatch [:wallet/start-get-suggested-routes
|
sending-to-unpreferred-networks?
|
||||||
{:amount amount-in-crypto
|
#(show-unpreferred-networks-alert on-confirm)
|
||||||
:updated-token token-by-symbol}])
|
:else
|
||||||
sending-to-unpreferred-networks?
|
#(on-confirm amount-in-crypto))}
|
||||||
#(show-unpreferred-networks-alert on-confirm)
|
|
||||||
:else
|
|
||||||
#(on-confirm amount-in-crypto))
|
|
||||||
:customization-color current-color}
|
|
||||||
(when should-try-again?
|
(when should-try-again?
|
||||||
{:type :grey}))}]
|
{:type :grey}))}]
|
||||||
[quo/numbered-keyboard
|
[quo/numbered-keyboard
|
||||||
|
@ -43,4 +43,9 @@
|
|||||||
:stickers/packs-pending #{}
|
:stickers/packs-pending #{}
|
||||||
:settings/change-password {}
|
:settings/change-password {}
|
||||||
:keycard {}
|
:keycard {}
|
||||||
:theme :light})
|
:theme :light
|
||||||
|
:layers {:ui
|
||||||
|
{:send
|
||||||
|
{:input-amount-screen
|
||||||
|
{:controller
|
||||||
|
{:crypto-currency? true}}}}}})
|
||||||
|
@ -196,3 +196,5 @@
|
|||||||
|
|
||||||
;;keycard
|
;;keycard
|
||||||
(reg-root-key-sub :keycard :keycard)
|
(reg-root-key-sub :keycard :keycard)
|
||||||
|
|
||||||
|
(reg-root-key-sub :layers :layers)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user