diff --git a/src/hooks/useGetSourceParsedTokenAccounts.ts b/src/hooks/useGetSourceParsedTokenAccounts.ts index 6f5f25159..f635dff3d 100644 --- a/src/hooks/useGetSourceParsedTokenAccounts.ts +++ b/src/hooks/useGetSourceParsedTokenAccounts.ts @@ -640,18 +640,16 @@ const createNFTParsedTokenAccountFromCovalent = ( covalent: CovalentData, nft_data: CovalentNFTData ): NFTParsedTokenAccount => { + const amount = nft_data.token_balance + ? formatUnits(nft_data.token_balance, covalent.contract_decimals) + : "0"; return { publicKey: walletAddress, mintKey: covalent.contract_address, - amount: nft_data.token_balance, + amount: nft_data.token_balance ? nft_data.token_balance : "", decimals: covalent.contract_decimals, - uiAmount: Number( - formatUnits(nft_data.token_balance, covalent.contract_decimals) - ), - uiAmountString: formatUnits( - nft_data.token_balance, - covalent.contract_decimals - ), + uiAmount: Number(amount), + uiAmountString: amount, symbol: covalent.contract_ticker_symbol, name: covalent.contract_name, logo: covalent.logo_url, @@ -689,7 +687,7 @@ export type CovalentNFTExternalData = { export type CovalentNFTData = { token_id: string; - token_balance: string; + token_balance: string | null; external_data: CovalentNFTExternalData; token_url: string; };