Skip to content

Commit e4c404c

Browse files
authored
chore: decimal has a max value of 19, so should be a number (#79)
1 parent 726ad53 commit e4c404c

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/features/assets/components/asset-details.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ export function AssetDetails({ asset }: Props) {
7373
: undefined,
7474
{
7575
dt: assetTotalSupplyLabel,
76-
dd: `${new Decimal(asset.total.toString()).div(new Decimal(10).pow(asset.decimals.toString()))} ${asset.unitName ?? ''}`,
76+
dd: `${new Decimal(asset.total.toString()).div(new Decimal(10).pow(asset.decimals))} ${asset.unitName ?? ''}`,
7777
},
7878
{
7979
dt: assetDecimalsLabel,
80-
dd: asset.decimals.toString(),
80+
dd: asset.decimals,
8181
},
8282
{
8383
dt: assetDefaultFrozenLabel,

src/features/assets/mappers/asset-summary.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const asAssetSummary = (assetResult: AssetResult): AssetSummary => {
55
return {
66
id: assetResult.index,
77
name: assetResult.params.name,
8-
decimals: assetResult.params.decimals,
8+
decimals: Number(assetResult.params.decimals),
99
unitName: assetResult.params['unit-name'],
1010
clawback: assetResult.params.clawback,
1111
}

src/features/assets/models/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export type AssetSummary = {
22
id: number
33
name?: string
4-
decimals: number | bigint
4+
decimals: number
55
unitName?: string
66
clawback?: string
77
}

src/features/common/components/display-asset-amount.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type Props = {
1515
const Amount = ({ asset, amount, isFrozen }: { asset: AssetSummary; amount: number | bigint; isFrozen?: boolean }) => {
1616
// asset decimals value must be from 0 to 19 so it is safe to use .toString() here
1717
// the amount is uint64, should be safe to be .toString()
18-
const amountToDisplay = new Decimal(amount.toString()).div(new Decimal(10).pow(asset.decimals.toString())).toString()
18+
const amountToDisplay = new Decimal(amount.toString()).div(new Decimal(10).pow(asset.decimals)).toString()
1919

2020
return (
2121
<>

0 commit comments

Comments
 (0)