Fixs ETH display on balances list (#360)

This commit is contained in:
Agustin Pane 2019-12-17 05:08:53 -03:00 committed by Mikhail Mikheev
parent 4f64a2e4df
commit d028da662e
1 changed files with 5 additions and 1 deletions

View File

@ -21,13 +21,17 @@ export type BalanceRow = SortRow<BalanceData>
// eslint-disable-next-line max-len // eslint-disable-next-line max-len
const getTokenPriceInCurrency = (token: Token, currencySelected: AVAILABLE_CURRENCIES, currencyValues: List<BalanceCurrencyType>): string => { const getTokenPriceInCurrency = (token: Token, currencySelected: AVAILABLE_CURRENCIES, currencyValues: List<BalanceCurrencyType>): string => {
// eslint-disable-next-line no-restricted-syntax // eslint-disable-next-line no-restricted-syntax
for (const tokenPriceIterator of currencyValues) { for (const tokenPriceIterator of currencyValues) {
const { tokenAddress, balanceInSelectedCurrency, currencyName } = tokenPriceIterator const { tokenAddress, balanceInSelectedCurrency, currencyName } = tokenPriceIterator
if (token.address === tokenAddress && currencySelected === currencyName) { if (token.address === tokenAddress && currencySelected === currencyName) {
const balance = balanceInSelectedCurrency ? parseFloat(balanceInSelectedCurrency, 10).toFixed(2) : balanceInSelectedCurrency const balance = balanceInSelectedCurrency ? parseFloat(balanceInSelectedCurrency, 10).toFixed(2) : balanceInSelectedCurrency
return `${balance} ${currencySelected}` return `${balance} ${currencySelected}`
} }
// ETH token
if (token.address === '0x000' && !tokenAddress) {
const balance = balanceInSelectedCurrency ? parseFloat(balanceInSelectedCurrency, 10).toFixed(2) : balanceInSelectedCurrency
return `${balance} ${currencySelected}`
}
} }
return null return null
} }