diff --git a/src/hooks/useTokenPriceIsMissing.ts b/src/hooks/useTokenPriceIsMissing.ts index e82962f5..c8ac6d5e 100644 --- a/src/hooks/useTokenPriceIsMissing.ts +++ b/src/hooks/useTokenPriceIsMissing.ts @@ -2,6 +2,7 @@ import { isBitcoinChainId } from '@src/background/services/network/utils/isBitco import { useAccountsContext } from '@src/contexts/AccountsProvider'; import { useBalancesContext } from '@src/contexts/BalancesProvider'; import { useNetworkContext } from '@src/contexts/NetworkProvider'; +import { useSettingsContext } from '@src/contexts/SettingsProvider'; import { useCallback, useMemo } from 'react'; type UseTokenPriceMissingProps = { @@ -16,6 +17,7 @@ export function useTokenPriceMissing(): UseTokenPriceMissingProps { accounts: { active: activeAccount }, } = useAccountsContext(); const { network: activeNetwork, favoriteNetworks } = useNetworkContext(); + const { getTokenVisibility } = useSettingsContext(); const networksMissingPrice: Record = useMemo(() => { if (isTokensCached) { @@ -52,10 +54,11 @@ export function useTokenPriceMissing(): UseTokenPriceMissingProps { if (!tokensForActiveAccount) { return; } - - const isMissingPrices = Object.values(tokensForActiveAccount).some( - (token) => token.priceInCurrency === undefined - ); + const isMissingPrices = Object.values(tokensForActiveAccount) + .filter(getTokenVisibility) // Discard hidden tokens + .some( + (token) => token.balance > 0n && token.priceInCurrency === undefined + ); networksIsMissingPrices[networkId] = isMissingPrices; }); @@ -66,6 +69,7 @@ export function useTokenPriceMissing(): UseTokenPriceMissingProps { activeAccount?.addressC, isTokensCached, balances.tokens, + getTokenVisibility, ]); const favoriteNetworksMissingPrice = useMemo(