disable selected network on select network to receive on bridge flow, and other minor fixes
This commit is contained in:
parent
bc75a5a2bb
commit
286743816c
|
@ -14,13 +14,16 @@
|
|||
|
||||
(defn- bridge-token-component
|
||||
[]
|
||||
(fn [{:keys [chain-id network-name]} {:keys [supported-networks] :as token}]
|
||||
(fn [{:keys [chain-id network-name]} {:keys [supported-networks] :as token} selected-network]
|
||||
(let [network (rf/sub [:wallet/network-details-by-chain-id chain-id])
|
||||
currency (rf/sub [:profile/currency])
|
||||
currency-symbol (rf/sub [:profile/currency-symbol])
|
||||
prices-per-token (rf/sub [:wallet/prices-per-token])
|
||||
{selected-network-chain-id :chain-id} selected-network
|
||||
balance (utils/calculate-total-token-balance token [chain-id])
|
||||
crypto-value (utils/get-standard-crypto-format token balance prices-per-token)
|
||||
crypto-value (utils/get-standard-crypto-format token
|
||||
balance
|
||||
prices-per-token)
|
||||
fiat-value (utils/calculate-token-fiat-value
|
||||
{:currency currency
|
||||
:balance balance
|
||||
|
@ -28,14 +31,17 @@
|
|||
:prices-per-token prices-per-token})
|
||||
fiat-formatted (utils/fiat-formatted-for-ui currency-symbol
|
||||
fiat-value)
|
||||
token-available-on-network? (network-utils/token-available-on-network? supported-networks
|
||||
token-available-on-network? (network-utils/token-available-on-network?
|
||||
supported-networks
|
||||
chain-id)]
|
||||
[quo/network-list
|
||||
{:label (name network-name)
|
||||
:network-image (quo.resources/get-network (:network-name network))
|
||||
:token-value (str crypto-value " " (:symbol token))
|
||||
:fiat-value fiat-formatted
|
||||
:state (if token-available-on-network? :default :disabled)
|
||||
:state (if (and token-available-on-network? (not= chain-id selected-network-chain-id))
|
||||
:default
|
||||
:disabled)
|
||||
:on-press #(rf/dispatch [:wallet/select-bridge-network
|
||||
{:network-chain-id chain-id
|
||||
:stack-id :screen/wallet.bridge-to}])}])))
|
||||
|
@ -45,6 +51,7 @@
|
|||
(let [network-details (rf/sub [:wallet/network-details])
|
||||
account (rf/sub [:wallet/current-viewing-account])
|
||||
token (rf/sub [:wallet/wallet-send-token])
|
||||
selected-network (rf/sub [:wallet/send-network])
|
||||
token-symbol (:symbol token)
|
||||
tokens (:tokens account)
|
||||
mainnet (first network-details)
|
||||
|
@ -60,17 +67,17 @@
|
|||
|
||||
[rn/view
|
||||
[account-switcher/view
|
||||
{:on-press #(rf/dispatch [:dismiss-modal])
|
||||
{:on-press #(rf/dispatch [:navigate-back])
|
||||
:icon-name :i/arrow-left
|
||||
:accessibility-label :top-bar
|
||||
:switcher-type :select-account}]
|
||||
[quo/page-top {:title bridge-to-title}]
|
||||
[rn/view style/content-container
|
||||
[bridge-token-component (assoc mainnet :network-name :t/mainnet) account-token]]
|
||||
[bridge-token-component (assoc mainnet :network-name :t/mainnet) account-token selected-network]]
|
||||
|
||||
[quo/divider-label (i18n/label :t/layer-2)]
|
||||
[rn/flat-list
|
||||
{:data layer-2-networks
|
||||
:render-fn (fn [network]
|
||||
[bridge-token-component network account-token])
|
||||
[bridge-token-component network account-token selected-network])
|
||||
:content-container-style style/content-container}]]))
|
||||
|
|
|
@ -348,6 +348,8 @@
|
|||
(let [{:keys [wallet]} db
|
||||
missing-recipient? (-> db :wallet :ui :send :to-address nil?)
|
||||
to-address (-> db :wallet :current-viewing-account-address)
|
||||
view-id (:view-id db)
|
||||
root-screen? (or (= view-id :wallet-stack) (nil? view-id))
|
||||
multi-account-balance? (-> (utils/get-accounts-with-token-balance (:accounts wallet)
|
||||
token)
|
||||
(count)
|
||||
|
@ -358,7 +360,7 @@
|
|||
token-symbol (assoc-in [:wallet :ui :send :token-symbol] token-symbol)
|
||||
network (assoc-in [:wallet :ui :send :network] network)
|
||||
missing-recipient? (assoc-in [:wallet :ui :send :to-address] to-address))
|
||||
:fx (if multi-account-balance?
|
||||
:fx (if (and multi-account-balance? root-screen?)
|
||||
[[:dispatch [:open-modal :screen/wallet.select-from]]]
|
||||
(if (some? network)
|
||||
[[:dispatch
|
||||
|
@ -376,7 +378,7 @@
|
|||
:on-select-network (fn [network]
|
||||
(rf/dispatch [:hide-bottom-sheet])
|
||||
(rf/dispatch
|
||||
[:wallet/select-from-account
|
||||
[:wallet/bridge-select-token
|
||||
(assoc params :network network)]))}])}]]]))})))
|
||||
|
||||
(rf/reg-event-fx :wallet/start-bridge
|
||||
|
|
|
@ -701,7 +701,6 @@
|
|||
flow-id (if bridge-tx?
|
||||
:wallet-bridge-flow
|
||||
:wallet-send-flow)]
|
||||
(println address "43423432423")
|
||||
{:db (cond-> db
|
||||
network (assoc-in [:wallet :ui :send :network] network)
|
||||
token-symbol (assoc-in [:wallet :ui :send :token] token)
|
||||
|
@ -718,7 +717,6 @@
|
|||
[:dispatch
|
||||
[:show-bottom-sheet
|
||||
{:content (fn []
|
||||
(println (or token-symbol (:symbol token)) token "fdsfdsfsdfsd")
|
||||
[network-selection/view
|
||||
{:token-symbol (or token-symbol (:symbol token))
|
||||
:source :send
|
||||
|
|
Loading…
Reference in New Issue