Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/components/Send/Send.js
Show First 20 Lines • Show All 338 Lines • ▼ Show 20 Lines | const handleBchAmountChange = e => { | ||||
bchValue = (value / fiatPrice).toFixed(8); | bchValue = (value / fiatPrice).toFixed(8); | ||||
} | } | ||||
// Validate value for > 0 | // Validate value for > 0 | ||||
if (isNaN(bchValue)) { | if (isNaN(bchValue)) { | ||||
error = 'Amount must be a number'; | error = 'Amount must be a number'; | ||||
} else if (bchValue <= 0) { | } else if (bchValue <= 0) { | ||||
error = 'Amount must be greater than 0'; | error = 'Amount must be greater than 0'; | ||||
} else if (bchValue < 0.00001) { | } else if (bchValue < currency.dust) { | ||||
error = `Send amount must be at least 0.00001 ${currency.ticker}`; | error = `Send amount must be at least ${currency.dust} ${currency.ticker}`; | ||||
} else if (bchValue > balances.totalBalance) { | } else if (bchValue > balances.totalBalance) { | ||||
error = `Amount cannot exceed your ${currency.ticker} balance`; | error = `Amount cannot exceed your ${currency.ticker} balance`; | ||||
} else if (!isNaN(bchValue) && bchValue.toString().includes('.')) { | } else if (!isNaN(bchValue) && bchValue.toString().includes('.')) { | ||||
if (bchValue.toString().split('.')[1].length > 8) { | if (bchValue.toString().split('.')[1].length > 8) { | ||||
error = `${currency.ticker} transactions do not support more than 8 decimal places`; | error = `${currency.ticker} transactions do not support more than 8 decimal places`; | ||||
} | } | ||||
} | } | ||||
setSendBchAmountError(error); | setSendBchAmountError(error); | ||||
▲ Show 20 Lines • Show All 186 Lines • Show Last 20 Lines |