diff --git a/explorer/src/components/account/TokenLargestAccountsCard.tsx b/explorer/src/components/account/TokenLargestAccountsCard.tsx index bfc12bcd07..3b32d7ffa9 100644 --- a/explorer/src/components/account/TokenLargestAccountsCard.tsx +++ b/explorer/src/components/account/TokenLargestAccountsCard.tsx @@ -22,7 +22,7 @@ export function TokenLargestAccountsCard({ pubkey }: { pubkey: PublicKey }) { }, [mintAddress]); // eslint-disable-line react-hooks/exhaustive-deps const supplyTotal = supply?.data?.uiAmount; - if (!supplyTotal || !largestAccounts) { + if (supplyTotal === undefined || !largestAccounts) { return null; } @@ -78,6 +78,10 @@ const renderAccountRow = ( index: number, supply: number ) => { + let percent = "-"; + if (supply > 0) { + percent = `${((100 * account.uiAmount) / supply).toFixed(3)}%`; + } return ( @@ -87,10 +91,7 @@ const renderAccountRow = (
{account.uiAmount} - {`${( - (100 * account.uiAmount) / - supply - ).toFixed(3)}%`} + {percent} ); }; diff --git a/explorer/src/pages/AccountDetailsPage.tsx b/explorer/src/pages/AccountDetailsPage.tsx index 5b05e8ae20..7a271a2f21 100644 --- a/explorer/src/pages/AccountDetailsPage.tsx +++ b/explorer/src/pages/AccountDetailsPage.tsx @@ -158,8 +158,8 @@ function MoreSection({
    - {tabs.map(({ title, path }) => ( -
  • + {tabs.map(({ title, slug, path }) => ( +