@@ -70,7 +70,16 @@ export default function InteractionClient() {
7070 const formatNumber = ( num : number , decimals : number = 4 ) : string => {
7171 if ( num === 0 ) return "0" ;
7272 if ( num < 0.0001 ) return num . toExponential ( 2 ) ;
73- return num . toFixed ( decimals ) ;
73+
74+ // Format with specified decimals
75+ const formatted = num . toFixed ( decimals ) ;
76+
77+ // Remove trailing zeros after decimal point
78+ if ( formatted . includes ( '.' ) ) {
79+ return formatted . replace ( / \. ? 0 + $ / , '' ) ;
80+ }
81+
82+ return formatted ;
7483 } ;
7584
7685 const [ isLoading , setIsLoading ] = useState ( true ) ;
@@ -539,11 +548,13 @@ export default function InteractionClient() {
539548 try {
540549 await fetchTokenDetailsFromBlockchain ( ) ;
541550 toast . success ( 'Token details synced successfully' ) ;
551+ // Force re-initialization to refresh all data
552+ await initializeTokenDetails ( ) ;
542553 } catch ( error ) {
543554 console . error ( 'Manual sync failed:' , error ) ;
544555 toast . error ( 'Failed to sync token details. Please try again.' ) ;
545556 }
546- } , [ tokenAddress , chainId , address , isOnline , fetchTokenDetailsFromBlockchain ] ) ;
557+ } , [ tokenAddress , chainId , address , isOnline , fetchTokenDetailsFromBlockchain , initializeTokenDetails ] ) ;
547558
548559 useEffect ( ( ) => {
549560 if ( isInitialized && tokenAddress && chainId && address ) {
@@ -1116,7 +1127,7 @@ export default function InteractionClient() {
11161127 < Coins className = "h-5 w-5 text-green-500 dark:text-[#FFD600]" />
11171128 < h3 className = "text-lg font-semibold text-blue-400 dark:text-yellow-200" > Max Supply</ h3 >
11181129 </ div >
1119- < p className = "text-lg font-bold text-blue-400 dark:text-yellow-200" > { tokenDetails . maxSupply } { tokenDetails . tokenSymbol } </ p >
1130+ < p className = "text-lg font-bold text-blue-400 dark:text-yellow-200" > { formatNumber ( tokenDetails . maxSupply ) } { tokenDetails . tokenSymbol } </ p >
11201131 </ div >
11211132 < Button
11221133 onClick = { openMaxSupplyModal }
@@ -1133,7 +1144,7 @@ export default function InteractionClient() {
11331144 < Target className = "h-5 w-5 text-blue-400 dark:text-[#FFD600]" />
11341145 < h3 className = "text-lg font-semibold text-blue-400 dark:text-yellow-200" > Threshold Supply</ h3 >
11351146 </ div >
1136- < p className = "text-lg font-bold text-blue-400 dark:text-yellow-200" > { tokenDetails . thresholdSupply } { tokenDetails . tokenSymbol } </ p >
1147+ < p className = "text-lg font-bold text-blue-400 dark:text-yellow-200" > { formatNumber ( tokenDetails . thresholdSupply ) } { tokenDetails . tokenSymbol } </ p >
11371148 </ div >
11381149 < Button
11391150 onClick = { openThresholdModal }
@@ -1150,7 +1161,7 @@ export default function InteractionClient() {
11501161 < ArrowUp className = "h-5 w-5 text-purple-500 dark:text-[#FFD600]" />
11511162 < h3 className = "text-lg font-semibold text-blue-400 dark:text-yellow-200" > Expansion Rate</ h3 >
11521163 </ div >
1153- < p className = "text-lg font-bold text-blue-400 dark:text-yellow-200" > { tokenDetails . maxExpansionRate } %</ p >
1164+ < p className = "text-lg font-bold text-blue-400 dark:text-yellow-200" > { formatNumber ( tokenDetails . maxExpansionRate ) } %</ p >
11541165 </ div >
11551166 < Button
11561167 onClick = { openExpansionRateModal }
@@ -1220,8 +1231,7 @@ export default function InteractionClient() {
12201231 < div className = "flex items-center justify-between mb-4" >
12211232 < div className = "space-y-1" >
12221233 < p className = "text-sm text-gray-600 dark:text-yellow-200" >
1223- Max Mintable Amount:
1224- < span
1234+ Max Mintable Amount: < span
12251235 className = "font-bold cursor-help"
12261236 title = { `${ tokenDetails . maxMintableAmount } ${ tokenDetails . tokenSymbol } ` }
12271237 >
@@ -1230,8 +1240,7 @@ export default function InteractionClient() {
12301240 </ p >
12311241 </ div >
12321242 < p className = "text-sm text-gray-600 dark:text-yellow-200" >
1233- Current Supply:
1234- < span
1243+ Current Supply: < span
12351244 className = "font-bold cursor-help"
12361245 title = { `${ tokenDetails . currentSupply } ${ tokenDetails . tokenSymbol } ` }
12371246 >
@@ -1266,8 +1275,7 @@ export default function InteractionClient() {
12661275 { mintAmount && ! isNaN ( Number ( mintAmount ) ) && Number ( mintAmount ) > 0 && (
12671276 < div className = "mt-2 p-2 rounded-lg bg-blue-50 dark:bg-yellow-400/10 border border-blue-200 dark:border-yellow-400/20" >
12681277 < p className = "text-xs text-blue-600 dark:text-yellow-200" >
1269- You will receive:
1270- < span
1278+ You will receive: < span
12711279 className = "font-bold cursor-help"
12721280 title = { `${ userAmountAfterFees || 0 } ${ tokenDetails . tokenSymbol } ` }
12731281 >
@@ -1280,8 +1288,7 @@ export default function InteractionClient() {
12801288 ) } { tokenDetails . tokenSymbol }
12811289 </ span >
12821290 < br />
1283- Clowder fee:
1284- < span
1291+ Clowder fee: < span
12851292 className = "font-bold cursor-help"
12861293 title = { `${ ! isNaN ( userAmountAfterFees ) && userAmountAfterFees !== null ? Number ( mintAmount ) - userAmountAfterFees : 0 } ${ tokenDetails . tokenSymbol } ` }
12871294 >
0 commit comments