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 <cursoragent@cursor.com>
This commit is contained in:
2026-09-01 15:45:13 +03:30
co-authored by Cursor
parent 8929501be5
commit 164bb267f1
+4 -1
View File
@@ -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() {