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)]
|
||||
(sort-by (juxt :symbol priority) tokens)))
|
||||
|
||||
(defn token-with-balance
|
||||
([token networks]
|
||||
(token-with-balance token networks nil))
|
||||
([token networks chain-ids]
|
||||
(assoc token
|
||||
:networks (network-utils/network-list-with-positive-balance token networks)
|
||||
:supported-networks (network-utils/network-list token networks)
|
||||
:available-balance (calculate-total-token-balance token)
|
||||
:total-balance (calculate-total-token-balance token chain-ids))))
|
||||
|
||||
(defn tokens-with-balance
|
||||
[tokens networks chain-ids]
|
||||
(map (fn [token]
|
||||
(assoc token
|
||||
:networks (network-utils/network-list-with-positive-balance token networks)
|
||||
:supported-networks (network-utils/network-list token networks)
|
||||
:available-balance (calculate-total-token-balance token)
|
||||
:total-balance (calculate-total-token-balance token chain-ids)))
|
||||
(token-with-balance token networks chain-ids))
|
||||
tokens))
|
||||
|
||||
(defn estimated-time-format
|
||||
|
|
|
@ -366,14 +366,7 @@
|
|||
(let [token (utils/get-token-from-account db
|
||||
token-symbol
|
||||
unique-owner)]
|
||||
(assoc token
|
||||
: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)))
|
||||
(utils/token-with-balance token network-details))
|
||||
token)
|
||||
missing-recipient? (-> db :wallet :ui :send :to-address nil?)
|
||||
to-address (or unique-owner
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
[status-im.contexts.wallet.collectible.utils :as collectible.utils]
|
||||
[status-im.contexts.wallet.common.utils :as 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.send.utils :as send-utils]
|
||||
[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
|
||||
;; account, so we extract the token data from the picked account.
|
||||
(let [token (utils/get-token-from-account db token-symbol address)]
|
||||
(assoc token
|
||||
: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))))
|
||||
(utils/token-with-balance token network-details)))
|
||||
bridge-tx? (= tx-type :tx/bridge)
|
||||
flow-id (if bridge-tx?
|
||||
:wallet-bridge-flow
|
||||
|
|
Loading…
Reference in New Issue