mirror of
https://github.com/status-im/status-react.git
synced 2025-02-22 15:48:50 +00:00
fix: network-values amount should be fixed
This commit is contained in:
parent
90166ad45a
commit
6acda08ebb
@ -1,6 +1,8 @@
|
|||||||
(ns status-im.subs.wallet.networks
|
(ns status-im.subs.wallet.networks
|
||||||
(:require [re-frame.core :as re-frame]
|
(:require [re-frame.core :as re-frame]
|
||||||
[status-im.contexts.wallet.common.utils.networks :as network-utils]))
|
[status-im.contexts.wallet.common.utils.networks :as network-utils]
|
||||||
|
[utils.money :as money]
|
||||||
|
[utils.number :as number]))
|
||||||
|
|
||||||
(def max-network-prefixes 2)
|
(def max-network-prefixes 2)
|
||||||
|
|
||||||
@ -61,15 +63,18 @@
|
|||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet/network-values
|
:wallet/network-values
|
||||||
:<- [:wallet/wallet-send]
|
:<- [:wallet/wallet-send]
|
||||||
(fn [{:keys [from-values-by-chain to-values-by-chain token-display-name] :as send-data} [_ to-values?]]
|
:<- [:wallet/send-display-token-decimals]
|
||||||
|
(fn [[{:keys [from-values-by-chain to-values-by-chain token-display-name] :as send-data} token-decimals]
|
||||||
|
[_ to-values?]]
|
||||||
(let [network-values (if to-values? to-values-by-chain from-values-by-chain)
|
(let [network-values (if to-values? to-values-by-chain from-values-by-chain)
|
||||||
token-symbol (or token-display-name
|
token-symbol (or token-display-name
|
||||||
(-> send-data :token :symbol))]
|
(-> send-data :token :symbol))]
|
||||||
(reduce-kv
|
(reduce-kv
|
||||||
(fn [acc chain-id amount]
|
(fn [acc chain-id amount]
|
||||||
(let [network-name (network-utils/id->network chain-id)]
|
(let [network-name (network-utils/id->network chain-id)
|
||||||
|
amount-fixed (number/to-fixed (money/->bignumber amount) token-decimals)]
|
||||||
(assoc acc
|
(assoc acc
|
||||||
(if (= network-name :mainnet) :ethereum network-name)
|
(if (= network-name :mainnet) :ethereum network-name)
|
||||||
{:amount amount :token-symbol token-symbol})))
|
{:amount amount-fixed :token-symbol token-symbol})))
|
||||||
{}
|
{}
|
||||||
network-values))))
|
network-values))))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user