diff --git a/explorer/src/components/Consensus/Account/AccountBalancePieChart.tsx b/explorer/src/components/Consensus/Account/AccountBalancePieChart.tsx index 87724ea1..7280c5f1 100644 --- a/explorer/src/components/Consensus/Account/AccountBalancePieChart.tsx +++ b/explorer/src/components/Consensus/Account/AccountBalancePieChart.tsx @@ -15,7 +15,7 @@ export const AccountBalancePieChart: FC = ({ account }) => { : 0 const transferable = account ? bigNumberToNumber(account.free) : 0 const staking = account ? bigNumberToNumber(account.reserved) : 0 - const other = otherNumber ? bigNumberToNumber(otherNumber.toString()) : 0 + const other = otherNumber ? bigNumberToNumber(otherNumber) : 0 const data = [ { diff --git a/explorer/src/utils/number.ts b/explorer/src/utils/number.ts index b9e23eb6..aa094aef 100644 --- a/explorer/src/utils/number.ts +++ b/explorer/src/utils/number.ts @@ -25,6 +25,7 @@ export const floatToStringWithDecimals = (value: number, decimals = 4): string = BigInt(value * 10 ** decimals).toString() export const bigNumberToNumber = (bigNumber: string | bigint | number, precision = 4): number => { + if (!bigNumber) return 0 if (typeof bigNumber !== 'string') bigNumber = bigNumber.toString() const number = formatUnits(bigNumber)