Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/components/Send/Send.js
Show First 20 Lines • Show All 347 Lines • ▼ Show 20 Lines | const SendBCH = ({ filledAddress, callbackTxId }) => { | ||||
const onMax = async () => { | const onMax = async () => { | ||||
// Clear amt error | // Clear amt error | ||||
setSendBchAmountError(false); | setSendBchAmountError(false); | ||||
// Set currency to BCH | // Set currency to BCH | ||||
setSelectedCurrency(currency.ticker); | setSelectedCurrency(currency.ticker); | ||||
try { | try { | ||||
const txFeeSats = calcFee(BCH, slpBalancesAndUtxos.nonSlpUtxos); | const txFeeSats = calcFee(BCH, slpBalancesAndUtxos.nonSlpUtxos); | ||||
const txFeeBch = txFeeSats / 1e8; | const txFeeBch = txFeeSats / 10 ** currency.cashDecimals; | ||||
let value = | let value = | ||||
balances.totalBalance - txFeeBch >= 0 | balances.totalBalance - txFeeBch >= 0 | ||||
? (balances.totalBalance - txFeeBch).toFixed(8) | ? (balances.totalBalance - txFeeBch).toFixed( | ||||
currency.cashDecimals, | |||||
) | |||||
: 0; | : 0; | ||||
setFormData({ | setFormData({ | ||||
...formData, | ...formData, | ||||
value, | value, | ||||
}); | }); | ||||
} catch (err) { | } catch (err) { | ||||
console.log(`Error in onMax:`); | console.log(`Error in onMax:`); | ||||
▲ Show 20 Lines • Show All 162 Lines • Show Last 20 Lines |