Skip to content

Commit

Permalink
import screen doesn't show account balance in USD shows $0 (#1634)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Sinclair <[email protected]>
  • Loading branch information
derHowie and DanielSinclair authored Aug 2, 2024
1 parent 6c07087 commit 2166514
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/entries/popup/hooks/useWalletsSummary.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
import { useMemo } from 'react';
import { Address } from 'viem';

import {
AVAX_AVALANCHE_ADDRESS,
BNB_MAINNET_ADDRESS,
ETH_ADDRESS,
MATIC_MAINNET_ADDRESS,
SupportedCurrencyKey,
} from '~/core/references';
import { SupportedCurrencyKey } from '~/core/references';
import {
AddySummary,
useAddysSummary,
} from '~/core/resources/addys/addysSummary';
import { useCurrentCurrencyStore } from '~/core/state';
import { ParsedAsset } from '~/core/types/assets';
import { ChainId } from '~/core/types/chains';
import {
add,
convertAmountAndPriceToNativeDisplay,
Expand Down Expand Up @@ -61,7 +56,7 @@ const parseAddressSummary = ({
}).amount;
const ethCurrencyBalance = convertAmountAndPriceToNativeDisplay(
ethBalance || 0,
nativeAssets?.[`${ETH_ADDRESS}_1`]?.price?.value || 0,
nativeAssets?.[ChainId.mainnet]?.price?.value || 0,
currentCurrency,
).amount;

Expand All @@ -70,7 +65,7 @@ const parseAddressSummary = ({
}).amount;
const bnbCurrencyBalance = convertAmountAndPriceToNativeDisplay(
bnbBalance || 0,
nativeAssets?.[`${BNB_MAINNET_ADDRESS}_1`]?.price?.value || 0,
nativeAssets?.[ChainId.bsc]?.price?.value || 0,
currentCurrency,
).amount;

Expand All @@ -82,7 +77,7 @@ const parseAddressSummary = ({
).amount;
const maticCurrencyBalance = convertAmountAndPriceToNativeDisplay(
maticBalance || 0,
nativeAssets?.[`${MATIC_MAINNET_ADDRESS}_1`]?.price?.value || 0,
nativeAssets?.[ChainId.polygon]?.price?.value || 0,
currentCurrency,
).amount;

Expand All @@ -91,7 +86,7 @@ const parseAddressSummary = ({
}).amount;
const avaxCurrencyBalance = convertAmountAndPriceToNativeDisplay(
avaxBalance || 0,
nativeAssets?.[`${AVAX_AVALANCHE_ADDRESS}_1`]?.price?.value || 0,
nativeAssets?.[ChainId.avalanche]?.price?.value || 0,
currentCurrency,
).amount;

Expand Down

0 comments on commit 2166514

Please sign in to comment.