From e841860fdf1cf5612b6871395d67d0a8b532a71b Mon Sep 17 00:00:00 2001 From: Danh Date: Fri, 21 Jul 2023 11:49:48 +0700 Subject: [PATCH] fix number rate order --- src/components/swapv2/LimitOrder/helpers.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/swapv2/LimitOrder/helpers.ts b/src/components/swapv2/LimitOrder/helpers.ts index e783095ece..7bbefc2d0d 100644 --- a/src/components/swapv2/LimitOrder/helpers.ts +++ b/src/components/swapv2/LimitOrder/helpers.ts @@ -116,7 +116,8 @@ export const formatRateLimitOrder = (order: LimitOrder, invert: boolean) => { } catch (error) { console.log(error) } - return formatNumberWithPrecisionRange(parseFloat(rateValue.toFixed(16)), 0, 8) + const float = parseFloat(rateValue.toFixed(16)) + return formatNumberWithPrecisionRange(float, 0, float < 1e-8 ? 16 : 8) } export const calcPercentFilledOrder = (value: string, total: string, decimals: number) => {