From 745c29c20ec62a92e5ae5436eb80c62a385ed6e6 Mon Sep 17 00:00:00 2001 From: chris Date: Fri, 20 Dec 2024 11:36:23 +1000 Subject: [PATCH] fix: Fix layerzero number format issue --- packages/canonical-bridge-widget/src/core/utils/number.ts | 3 ++- .../aggregator/adapters/layerZero/hooks/useGetLayerZeroFees.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/canonical-bridge-widget/src/core/utils/number.ts b/packages/canonical-bridge-widget/src/core/utils/number.ts index e0f11317..33fdec41 100644 --- a/packages/canonical-bridge-widget/src/core/utils/number.ts +++ b/packages/canonical-bridge-widget/src/core/utils/number.ts @@ -1,7 +1,8 @@ -export const formatNumber = (value: number, decimals = 18) => { +export const formatNumber = (value: number, decimals = 18, useGrouping = true) => { const num = removeAfterDecimals(value, decimals); return num.toLocaleString('fullwide', { maximumFractionDigits: decimals, + useGrouping, }); }; diff --git a/packages/canonical-bridge-widget/src/modules/aggregator/adapters/layerZero/hooks/useGetLayerZeroFees.ts b/packages/canonical-bridge-widget/src/modules/aggregator/adapters/layerZero/hooks/useGetLayerZeroFees.ts index d23de756..b7b4e63b 100644 --- a/packages/canonical-bridge-widget/src/modules/aggregator/adapters/layerZero/hooks/useGetLayerZeroFees.ts +++ b/packages/canonical-bridge-widget/src/modules/aggregator/adapters/layerZero/hooks/useGetLayerZeroFees.ts @@ -69,7 +69,7 @@ export const useGetLayerZeroFees = () => { ]; const nativeFee = fees[0]; const minAmount = parseUnits( - String(formatNumber(Number(sendValue), 8)), + String(formatNumber(Number(sendValue), 8, false)), selectedToken?.layerZero?.raw?.decimals ?? (18 as number), ); const cakeArgs = {