add token-with-balances utils functions
Signed-off-by: Brian Sztamfater <brian@status.im>
This commit is contained in:
parent
3ff460fdc7
commit
80bab0f976
|
@ -546,14 +546,20 @@
|
||||||
(let [priority #(get constants/token-sort-priority (:symbol %) ##Inf)]
|
(let [priority #(get constants/token-sort-priority (:symbol %) ##Inf)]
|
||||||
(sort-by (juxt :symbol priority) tokens)))
|
(sort-by (juxt :symbol priority) tokens)))
|
||||||
|
|
||||||
(defn tokens-with-balance
|
(defn token-with-balance
|
||||||
[tokens networks chain-ids]
|
([token networks]
|
||||||
(map (fn [token]
|
(token-with-balance token networks nil))
|
||||||
|
([token networks chain-ids]
|
||||||
(assoc token
|
(assoc token
|
||||||
:networks (network-utils/network-list-with-positive-balance token networks)
|
:networks (network-utils/network-list-with-positive-balance token networks)
|
||||||
:supported-networks (network-utils/network-list token networks)
|
:supported-networks (network-utils/network-list token networks)
|
||||||
:available-balance (calculate-total-token-balance token)
|
:available-balance (calculate-total-token-balance token)
|
||||||
:total-balance (calculate-total-token-balance token chain-ids)))
|
:total-balance (calculate-total-token-balance token chain-ids))))
|
||||||
|
|
||||||
|
(defn tokens-with-balance
|
||||||
|
[tokens networks chain-ids]
|
||||||
|
(map (fn [token]
|
||||||
|
(token-with-balance token networks chain-ids))
|
||||||
tokens))
|
tokens))
|
||||||
|
|
||||||
(defn estimated-time-format
|
(defn estimated-time-format
|
||||||
|
|
|
@ -366,14 +366,7 @@
|
||||||
(let [token (utils/get-token-from-account db
|
(let [token (utils/get-token-from-account db
|
||||||
token-symbol
|
token-symbol
|
||||||
unique-owner)]
|
unique-owner)]
|
||||||
(assoc token
|
(utils/token-with-balance token network-details))
|
||||||
:networks (network-utils/network-list-with-positive-balance
|
|
||||||
token
|
|
||||||
network-details)
|
|
||||||
:supported-networks (network-utils/network-list
|
|
||||||
token
|
|
||||||
network-details)
|
|
||||||
:total-balance (utils/calculate-total-token-balance token)))
|
|
||||||
token)
|
token)
|
||||||
missing-recipient? (-> db :wallet :ui :send :to-address nil?)
|
missing-recipient? (-> db :wallet :ui :send :to-address nil?)
|
||||||
to-address (or unique-owner
|
to-address (or unique-owner
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
[status-im.contexts.wallet.collectible.utils :as collectible.utils]
|
[status-im.contexts.wallet.collectible.utils :as collectible.utils]
|
||||||
[status-im.contexts.wallet.common.utils :as utils]
|
[status-im.contexts.wallet.common.utils :as utils]
|
||||||
[status-im.contexts.wallet.common.utils.networks :as network-utils]
|
[status-im.contexts.wallet.common.utils.networks :as network-utils]
|
||||||
[status-im.contexts.wallet.common.wizard.utils :as wizard-utils]
|
|
||||||
[status-im.contexts.wallet.data-store :as data-store]
|
[status-im.contexts.wallet.data-store :as data-store]
|
||||||
[status-im.contexts.wallet.send.utils :as send-utils]
|
[status-im.contexts.wallet.send.utils :as send-utils]
|
||||||
[status-im.contexts.wallet.sheets.network-selection.view :as network-selection]
|
[status-im.contexts.wallet.sheets.network-selection.view :as network-selection]
|
||||||
|
@ -667,14 +666,7 @@
|
||||||
;; token or collectible to send, but we don't know from which
|
;; token or collectible to send, but we don't know from which
|
||||||
;; account, so we extract the token data from the picked account.
|
;; account, so we extract the token data from the picked account.
|
||||||
(let [token (utils/get-token-from-account db token-symbol address)]
|
(let [token (utils/get-token-from-account db token-symbol address)]
|
||||||
(assoc token
|
(utils/token-with-balance token network-details)))
|
||||||
:networks (network-utils/network-list-with-positive-balance
|
|
||||||
token
|
|
||||||
network-details)
|
|
||||||
:supported-networks (network-utils/network-list
|
|
||||||
token
|
|
||||||
network-details)
|
|
||||||
:total-balance (utils/calculate-total-token-balance token))))
|
|
||||||
bridge-tx? (= tx-type :tx/bridge)
|
bridge-tx? (= tx-type :tx/bridge)
|
||||||
flow-id (if bridge-tx?
|
flow-id (if bridge-tx?
|
||||||
:wallet-bridge-flow
|
:wallet-bridge-flow
|
||||||
|
|
Loading…
Reference in New Issue