From 164bb267f1673686bfaa5e94fad1e736a0938d4c Mon Sep 17 00:00:00 2001 From: adonis Date: Tue, 1 Sep 2026 15:45:13 +0330 Subject: [PATCH] fix(trade): show three gram decimals when converting from rial Keep the rial-locked order amount unchanged; only the gram input display is capped. Co-authored-by: Cursor --- src/utils/serviceFee.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils/serviceFee.ts b/src/utils/serviceFee.ts index 421e21b..48f7c07 100644 --- a/src/utils/serviceFee.ts +++ b/src/utils/serviceFee.ts @@ -25,6 +25,9 @@ export const TRADE_GRAM_STORAGE_DECIMALS = 10 /** حداکثر اعشار نمایش به کاربر در اپ */ export const TRADE_GRAM_DISPLAY_DECIMALS = 8 +/** اعشار فیلد گرم وقتی از ریال تبدیل می‌شود (فقط نمایش همان فیلد) */ +export const TRADE_GRAM_INPUT_DECIMALS = 3 + /** زیر این مقدار (گرم)، معادل گرم در فیلد ورودی نشان داده نمی‌شود */ export const TRADE_GRAM_MIN_DISPLAY_GRAMS = 0.0001 @@ -59,7 +62,7 @@ export function formatTradeGramInputValue(grams?: number | null): string | undef const value = Number(grams ?? 0) if (!Number.isFinite(value) || value <= 0) return undefined if (value < TRADE_GRAM_MIN_DISPLAY_GRAMS) return undefined - return formatTradeGramFixedText(value) + return value.toFixed(TRADE_GRAM_INPUT_DECIMALS) } function feeRate() {