diff --git a/src/components/token/utils.ts b/src/components/token/utils.ts index 3b0bc26ae..23f89e44e 100644 --- a/src/components/token/utils.ts +++ b/src/components/token/utils.ts @@ -1,6 +1,6 @@ import { ChainID } from 'lib/eoaWallet' -import { TokenSymbol, getTokenByChainId } from 'screens/home/TokenImage' +import { TokenSymbol, getTokenSymbolByChainId } from 'screens/home/TokenImage' import { TokenOrBitcoinNetwork } from 'shared/types' /** @@ -14,17 +14,17 @@ export const sortBalancesBySymbol = ( balances: Array, chainId: ChainID, ): Array => { - const rif = getTokenByChainId(TokenSymbol.RIF, chainId) - const usdrif = getTokenByChainId(TokenSymbol.USDRIF, chainId) - const rbtc = getTokenByChainId(TokenSymbol.RBTC, chainId) - const btc = getTokenByChainId(TokenSymbol.BTC, chainId) - const rdoc = getTokenByChainId(TokenSymbol.RDOC, chainId) + const rif = getTokenSymbolByChainId(TokenSymbol.RIF, chainId) + const usdrif = getTokenSymbolByChainId(TokenSymbol.USDRIF, chainId) + const rbtc = getTokenSymbolByChainId(TokenSymbol.RBTC, chainId) + const btc = getTokenSymbolByChainId(TokenSymbol.BTC, chainId) + const rdoc = getTokenSymbolByChainId(TokenSymbol.RDOC, chainId) const defaultOrder = [rif, usdrif, rbtc, btc, rdoc] return balances.sort((a, b) => { - const symbolA = getTokenByChainId(a.symbol, chainId) - const symbolB = getTokenByChainId(b.symbol, chainId) + const symbolA = getTokenSymbolByChainId(a.symbol, chainId) + const symbolB = getTokenSymbolByChainId(b.symbol, chainId) const indexA = defaultOrder.indexOf(symbolA) const indexB = defaultOrder.indexOf(symbolB) diff --git a/src/screens/home/PortfolioComponent.tsx b/src/screens/home/PortfolioComponent.tsx index 8ca40ec86..d5a50d9e9 100644 --- a/src/screens/home/PortfolioComponent.tsx +++ b/src/screens/home/PortfolioComponent.tsx @@ -3,15 +3,11 @@ import { useTranslation } from 'react-i18next' import { ScrollView, StyleProp, View, ViewStyle } from 'react-native' import { PortfolioCard } from 'components/Porfolio/PortfolioCard' -import { - sortBalancesBySymbol, - sortTokensBySymbol, -} from 'components/token/utils' +import { sortBalancesBySymbol } from 'components/token/utils' import { getTokenColor } from 'screens/home/tokenColor' import { sharedColors } from 'shared/constants' import { TokenOrBitcoinNetwork } from 'shared/types' -import { useAppSelector } from 'src/redux/storeUtils' -import { selectChainId } from 'src/redux/slices/settingsSlice' +import { getCurrentChainId } from 'storage/ChainStorage' interface Props { setSelectedAddress: (token: string | undefined) => void @@ -29,7 +25,7 @@ export const PortfolioComponent = ({ showTotalCard = true, style, }: Props) => { - const chainId = useAppSelector(selectChainId) + const chainId = getCurrentChainId() const { t } = useTranslation() const [isTotalCardSelected, setIsTotalCardSelected] = useState( showTotalCard && !selectedAddress, diff --git a/src/screens/home/TokenImage.tsx b/src/screens/home/TokenImage.tsx index a97c61b2f..5e5b3a3b3 100644 --- a/src/screens/home/TokenImage.tsx +++ b/src/screens/home/TokenImage.tsx @@ -280,7 +280,7 @@ export const getIconSource = ( } } -export const getTokenByChainId = ( +export const getTokenSymbolByChainId = ( symbol: string | TokenSymbol, chainId: ChainID, ) => {