[#21557] fix: add format address util and rename screen
This commit is contained in:
parent
ed34d30017
commit
e093d42c94
|
@ -7,6 +7,7 @@
|
|||
[utils.number]))
|
||||
|
||||
(def ^:private last-comma-followed-by-text-to-end-regex #",\s(?=[^,]+$)")
|
||||
(def ^:private max-network-prefixes 2)
|
||||
|
||||
(def id->network
|
||||
{constants/ethereum-mainnet-chain-id constants/mainnet-network-name
|
||||
|
@ -185,3 +186,11 @@
|
|||
:related-chain-id related-chain-id
|
||||
:layer layer)))
|
||||
(sort-by (juxt :layer :short-name))))
|
||||
|
||||
(defn format-address
|
||||
[address network-preferences]
|
||||
(let [short-names (map network->short-name network-preferences)
|
||||
prefix (when (<= (count short-names) max-network-prefixes)
|
||||
(short-names->network-preference-prefix short-names))
|
||||
transformed-address (str prefix address)]
|
||||
transformed-address))
|
||||
|
|
|
@ -537,7 +537,7 @@
|
|||
(fn [{:keys [db]} [account]]
|
||||
(let [asset-to-pay (get-in db [:wallet :ui :swap :asset-to-pay])
|
||||
asset-to-receive (get-in db [:wallet :ui :swap :asset-to-receive])]
|
||||
{:fx [[:dispatch [:navigate-back]]
|
||||
{:fx [[:dispatch [:dismiss-modal :screen/wallet.swap-select-account]]
|
||||
[:dispatch
|
||||
[:wallet.swap/start
|
||||
{:asset-to-pay asset-to-pay
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
[utils.money :as money]
|
||||
[utils.number :as number]))
|
||||
|
||||
(def max-network-prefixes 2)
|
||||
|
||||
(re-frame/reg-sub
|
||||
:wallet/networks
|
||||
:<- [:wallet]
|
||||
|
@ -53,12 +51,7 @@
|
|||
(re-frame/reg-sub
|
||||
:wallet/account-address
|
||||
(fn [_ [_ address network-preferences]]
|
||||
(let [short-names (map network-utils/network->short-name network-preferences)
|
||||
prefix (when (<= (count short-names) max-network-prefixes)
|
||||
(network-utils/short-names->network-preference-prefix
|
||||
short-names))
|
||||
transformed-address (str prefix address)]
|
||||
transformed-address)))
|
||||
(network-utils/format-address address network-preferences)))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:wallet/network-values
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
[re-frame.core :as rf]
|
||||
[status-im.constants :as constants]
|
||||
[status-im.contexts.wallet.common.utils :as utils]
|
||||
[status-im.contexts.wallet.common.utils.networks :as network-utils]
|
||||
[status-im.contexts.wallet.send.utils :as send-utils]
|
||||
[utils.money :as money]
|
||||
[utils.number :as number]))
|
||||
|
@ -326,8 +327,8 @@
|
|||
(let [tokens (:tokens account)
|
||||
filtered-tokens (filter #(= (:symbol %) token-symbol) tokens)
|
||||
asset-pay-balance (utils/calculate-total-token-balance filtered-tokens)
|
||||
formatted-address @(rf/subscribe [:wallet/account-address (:address account)
|
||||
(:network-preferences-names account)])]
|
||||
formatted-address (network-utils/format-address (:address account)
|
||||
(:network-preferences-names account))]
|
||||
(assoc account
|
||||
:formatted-address formatted-address
|
||||
:asset-pay-balance (utils/sanitized-token-amount-to-display
|
||||
|
|
Loading…
Reference in New Issue