diff --git a/src/components/table/balancesTable/parseData/parseBalanceInfo.tsx b/src/components/table/balancesTable/parseData/parseBalanceInfo.tsx index d32b885..3094d42 100644 --- a/src/components/table/balancesTable/parseData/parseBalanceInfo.tsx +++ b/src/components/table/balancesTable/parseData/parseBalanceInfo.tsx @@ -36,7 +36,7 @@ import { TFunction } from 'i18next' import { Button, Tooltip } from 'antd' import { FiSend } from 'react-icons/fi' import { LinksButton } from '../../links/Links' -import { PnlInDollars, PriceChangedOn } from '../utils' +import { PnlInDollars, PriceChangedOn, allowedTokensByNetwork } from '../utils' import { InfoCircleOutlined } from '@ant-design/icons' const getAccountData = (info: AccountInfoByChain, t: TFunction) => { @@ -85,7 +85,12 @@ const parseBalancesEntities = ( const balanceInfoBySymbol: Record = {} + const allowedTokens = allowedTokensByNetwork[network] + Object.entries(balanceInfo || {}).forEach(([ symbol, info ]) => { + if ((allowedTokens && !allowedTokens.includes(symbol)) || !symbol) + return + const { decimal } = getDecimalsAndSymbol(chainInfo, symbol) if (!decimal) return diff --git a/src/rtk/features/prices/pricesHooks.ts b/src/rtk/features/prices/pricesHooks.ts index a3f775e..44fb5de 100644 --- a/src/rtk/features/prices/pricesHooks.ts +++ b/src/rtk/features/prices/pricesHooks.ts @@ -1,6 +1,7 @@ import { useAppSelector } from '../../app/store' import { PricesEntity, selectPrices } from './pricesSlice' import { MultiChainInfo } from '../multiChainInfo/types' +import { isEmptyObj } from '@subsocial/utils' export const overriddenChainNames: Record = { bifrostKusama: 'bifrost-native-coin', @@ -19,15 +20,17 @@ export const overriddenChainNames: Record = { continuum: 'mnet-continuum', } -export const statemineAssets = [ 'rmrk' ] -const additionalTokens = [ 'zenlink-network-token', 'weth', 'wrapped-bitcoin' ] +export const statemineAssets = ['rmrk'] +const additionalTokens = ['zenlink-network-token', 'weth', 'wrapped-bitcoin'] export const getChainsNamesForCoinGecko = (chainsInfo: MultiChainInfo) => { - const chainInfoKeys = chainsInfo ? Object.keys(chainsInfo) : [] + let keys: string[] = [] - chainInfoKeys.push(...statemineAssets, ...additionalTokens) + if (chainsInfo && !isEmptyObj(chainsInfo)) { + keys = [...Object.keys(chainsInfo), ...statemineAssets, ...additionalTokens] + } - return chainInfoKeys + return keys .map((network) => overriddenChainNames[network] || network) .join(',') }