extract exchange amount validation

This commit is contained in:
2026-09-06 18:14:31 +03:00
parent 55efb8675c
commit a76a35c14d
4 changed files with 29 additions and 2 deletions
+9
View File
@@ -0,0 +1,9 @@
const MAX_EXCHANGE_AMOUNT = 1e12;
export function validateExchangeAmount(value) {
if (value === null || value === undefined || (typeof value === 'string' && !value.trim())) return false;
const amount = Number(value);
return Number.isFinite(amount) && amount >= 0 && amount <= MAX_EXCHANGE_AMOUNT;
}
export { MAX_EXCHANGE_AMOUNT };