From 6ce85e0b85afbd740e36d45fb5d558cb56b5bba1 Mon Sep 17 00:00:00 2001 From: JCNoguera Date: Thu, 11 Jan 2024 16:09:23 +0100 Subject: [PATCH] fix: quantity of native tokens in hex --- .../address/section/native-tokens/AssetsTable.tsx | 12 +++++++----- .../components/stardust/foundry/TokenInfoSection.tsx | 6 +++--- 2 files changed, 10 insertions(+), 8 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 96d0c0c34..28c5849f4 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 @@ -33,11 +33,13 @@ const AssetsTable: React.FC = ({ networkId, outputs, setTokenC output.type === OutputType.Foundry || output.type === OutputType.Nft) { for (const token of (output as CommonOutput).nativeTokens ?? []) { const existingToken = theTokens.find(t => t.id === token.id); - if (existingToken) { - existingToken.amount += token.amount; - } else { - theTokens.push({ id: token.id, amount: token.amount }); - } + // Convert to BigInt again in case the amount is hex + const amount = BigInt(token.amount); + if (existingToken) { + existingToken.amount += amount; + } else { + 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 537cd9293..1a26ef231 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 (