diff --git a/src/context/Dapp.context.tsx b/src/context/Dapp.context.tsx index 612dd28c..6098a8fa 100644 --- a/src/context/Dapp.context.tsx +++ b/src/context/Dapp.context.tsx @@ -38,7 +38,7 @@ export function DAppProvider({ }: PropsWithChildren) { return ( - + id !== 1337)} config={config}> {children} diff --git a/src/utils/formatter.service.ts b/src/utils/formatter.service.ts index e0c536b9..bce1a86c 100644 --- a/src/utils/formatter.service.ts +++ b/src/utils/formatter.service.ts @@ -13,7 +13,11 @@ export class FormatterService { } } - toNumber(value: bigint | string, decimals = 18): number { + public static toPrice(value: bigint | string, token: { price?: number | null; decimals: number }): number { + return FormatterService.toNumber(value, token.decimals) * (token.price ?? 0); + } + + public static toNumber(value: bigint | string, decimals = 18): number { const bi = BigInt(value); const fractionalPart = Number.parseFloat((bi % BigInt(10 ** decimals)).toString()) / 10 ** decimals;