diff --git a/packages/synapse-interface/components/Portfolio/components/GasTokenAsset.tsx b/packages/synapse-interface/components/Portfolio/components/GasTokenAsset.tsx index cae8ccb317..43c327f3fe 100644 --- a/packages/synapse-interface/components/Portfolio/components/GasTokenAsset.tsx +++ b/packages/synapse-interface/components/Portfolio/components/GasTokenAsset.tsx @@ -2,7 +2,8 @@ import React from 'react' import Image from 'next/image' import { Token } from '@/utils/types' import { getParsedBalance } from '@/utils/getParsedBalance' -import { HoverTooltip } from '../../HoverTooltip' +import { HoverTooltip } from '@/components/HoverTooltip' +import { formatAmount } from '@/utils/formatAmount' import GasIcon from '@/components/icons/GasIcon' export const GasTokenAsset = ({ @@ -13,8 +14,7 @@ export const GasTokenAsset = ({ balance: bigint }) => { const { icon, symbol, decimals } = token - const parsedBalance = getParsedBalance(balance, decimals as number, 3) - const parsedBalanceLong = getParsedBalance(balance, decimals as number, 8) + const parsedBalance = getParsedBalance(balance, decimals as number) return (
- {parsedBalanceLong} {symbol} + {parsedBalance} {symbol}
} >
- {parsedBalance} {symbol} + {formatAmount(parsedBalance)} {symbol}
{ const hasNoTokens: boolean = !portfolioTokens || (portfolioTokens && portfolioTokens.length === 0) @@ -18,6 +22,15 @@ export const PortfolioTokenVisualizer = ({ const hasOnlyOneToken: boolean = portfolioTokens && portfolioTokens.length === 1 + const firstTokenBalance = getParsedBalance( + portfolioTokens?.[0]?.balance, + portfolioTokens?.[0]?.token?.decimals[portfolioChainId] + ) + const secondTokenBalance = getParsedBalance( + portfolioTokens?.[1]?.balance, + portfolioTokens?.[1]?.token?.decimals[portfolioChainId] + ) + if (hasNoTokens) { return (
) } + return (
- {portfolioTokens[0]?.parsedBalance}{' '} + {formatAmount(firstTokenBalance)}{' '} {portfolioTokens[0]?.token.symbol}
} @@ -55,7 +69,7 @@ export const PortfolioTokenVisualizer = ({ {hasOnlyOneToken && (
- {portfolioTokens[0].parsedBalance} {portfolioTokens[0].token.symbol} + {formatAmount(firstTokenBalance)} {portfolioTokens[0].token.symbol}
)} @@ -64,7 +78,7 @@ export const PortfolioTokenVisualizer = ({ - {portfolioTokens[1]?.parsedBalance}{' '} + {formatAmount(secondTokenBalance)}{' '} {portfolioTokens[1]?.token.symbol}
} @@ -86,10 +100,13 @@ export const PortfolioTokenVisualizer = ({ (token: TokenAndBalance, key: number) => { if (key > 1) { const tokenSymbol = token.token.symbol - const balance = token.parsedBalance + const parsedBalance = getParsedBalance( + token.balance, + token.token.decimals[portfolioChainId] + ) return (
- {balance} {tokenSymbol} + {formatAmount(parsedBalance)} {tokenSymbol}
) } diff --git a/packages/synapse-interface/components/Portfolio/components/SingleNetworkPortfolio.tsx b/packages/synapse-interface/components/Portfolio/components/SingleNetworkPortfolio.tsx index 392edc169e..eba363e7d7 100644 --- a/packages/synapse-interface/components/Portfolio/components/SingleNetworkPortfolio.tsx +++ b/packages/synapse-interface/components/Portfolio/components/SingleNetworkPortfolio.tsx @@ -87,7 +87,10 @@ export const SingleNetworkPortfolio = ({ /> } collapsedProps={ - + } > {isUnsupportedChain && ( diff --git a/packages/synapse-interface/components/StateManagedBridge/AvailableBalance.tsx b/packages/synapse-interface/components/StateManagedBridge/AvailableBalance.tsx index da1ee49204..6b5faf50b3 100644 --- a/packages/synapse-interface/components/StateManagedBridge/AvailableBalance.tsx +++ b/packages/synapse-interface/components/StateManagedBridge/AvailableBalance.tsx @@ -1,5 +1,6 @@ import React from 'react' import { joinClassNames } from '@/utils/joinClassNames' +import { formatAmount } from '@/utils/formatAmount' export const AvailableBalance = ({ balance, @@ -35,7 +36,7 @@ export const AvailableBalance = ({ return ( ) }