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:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user