From 5e3f847f31a4d0eb7eeb9addff52e9f22b8ef77e Mon Sep 17 00:00:00 2001 From: JCNoguera <88061365+VmMad@users.noreply.github.com> Date: Thu, 18 Jan 2024 18:37:16 +0100 Subject: [PATCH] fix: quantity of native tokens in hex (#960) --- .../stardust/address/section/native-tokens/AssetsTable.tsx | 6 ++++-- .../app/components/stardust/foundry/TokenInfoSection.tsx | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/client/src/app/components/stardust/address/section/native-tokens/AssetsTable.tsx b/client/src/app/components/stardust/address/section/native-tokens/AssetsTable.tsx index ad6f4b299..ebfe3abbc 100644 --- a/client/src/app/components/stardust/address/section/native-tokens/AssetsTable.tsx +++ b/client/src/app/components/stardust/address/section/native-tokens/AssetsTable.tsx @@ -35,10 +35,12 @@ const AssetsTable: React.FC = ({ networkId, outputs, setTokenC ) { for (const token of (output as CommonOutput).nativeTokens ?? []) { const existingToken = theTokens.find((t) => t.id === token.id); + // Convert to BigInt again in case the amount is hex + const amount = BigInt(token.amount); if (existingToken) { - existingToken.amount += token.amount; + existingToken.amount += amount; } else { - theTokens.push({ id: token.id, amount: token.amount }); + theTokens.push({ id: token.id, amount }); } } } diff --git a/client/src/app/components/stardust/foundry/TokenInfoSection.tsx b/client/src/app/components/stardust/foundry/TokenInfoSection.tsx index e0d189268..629f0974b 100644 --- a/client/src/app/components/stardust/foundry/TokenInfoSection.tsx +++ b/client/src/app/components/stardust/foundry/TokenInfoSection.tsx @@ -29,9 +29,9 @@ const TokenInfoSection: React.FC = ({ tokenId, tokenSchem const simpleTokenScheme = tokenScheme as SimpleTokenScheme; - const maximumSupply = formatNumberWithCommas(simpleTokenScheme.maximumSupply); - const mintedTokens = formatNumberWithCommas(simpleTokenScheme.mintedTokens); - const meltedTokens = formatNumberWithCommas(simpleTokenScheme.meltedTokens); + const maximumSupply = formatNumberWithCommas(BigInt(simpleTokenScheme.maximumSupply)); + const mintedTokens = formatNumberWithCommas(BigInt(simpleTokenScheme.mintedTokens)); + const meltedTokens = formatNumberWithCommas(BigInt(simpleTokenScheme.meltedTokens)); return (