File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
packages/nextjs/components/address-vision Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -12,15 +12,16 @@ export const TokensTable = ({ tokens }: { tokens: Token[] }) => {
1212 const divisor = BigInt ( Math . pow ( 10 , decimals ) ) ;
1313 const integerPart = balanceBigInt / divisor ;
1414 const fractionalPart = balanceBigInt % divisor ;
15- const formattedFractionalPart = fractionalPart . toString ( ) . padStart ( decimals , "0" ) . slice ( 0 , 2 ) ;
15+ const decimalDigits = integerPart === 0n ? 6 : integerPart < 10n ? 4 : 2 ;
16+ const formattedFractionalPart = fractionalPart . toString ( ) . padStart ( decimals , "0" ) . slice ( 0 , decimalDigits ) ;
1617
1718 const integerPartStr = integerPart . toString ( ) ;
1819
1920 if ( integerPartStr . length > 10 ) {
2021 return `${ integerPartStr . slice ( 0 , 10 ) } ...` ;
21- } else {
22- return `${ integerPartStr } .${ formattedFractionalPart } ` ;
2322 }
23+ const formatted = `${ integerPartStr } .${ formattedFractionalPart } ` ;
24+ return formatted === "0.000000" ? "0" : formatted ;
2425 } ;
2526
2627 if ( tokens . length === 0 ) {
You can’t perform that action at this time.
0 commit comments