fix: rename argument for fee discount calculation
This commit is contained in:
parent
32f79bc450
commit
8c948d08c7
1 changed files with 5 additions and 5 deletions
|
|
@ -57,25 +57,25 @@ function estimateFee () {
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
}
|
}
|
||||||
|
|
||||||
function calculateFeeDiscount (feeDiscount) {
|
function calculateFeeDiscount (feeMultiplier) {
|
||||||
// 0 makes bitcoind do automatic fee selection
|
// 0 makes bitcoind do automatic fee selection
|
||||||
const AUTOMATIC_FEE = 0
|
const AUTOMATIC_FEE = 0
|
||||||
if (!feeDiscount) return AUTOMATIC_FEE
|
if (!feeMultiplier) return AUTOMATIC_FEE
|
||||||
return estimateFee()
|
return estimateFee()
|
||||||
.then(estimatedFee => {
|
.then(estimatedFee => {
|
||||||
if (!estimatedFee) return AUTOMATIC_FEE
|
if (!estimatedFee) return AUTOMATIC_FEE
|
||||||
const newFee = estimatedFee.times(feeDiscount)
|
const newFee = estimatedFee.times(feeMultiplier)
|
||||||
if (newFee.lt(0.00001) || newFee.gt(0.1)) return AUTOMATIC_FEE
|
if (newFee.lt(0.00001) || newFee.gt(0.1)) return AUTOMATIC_FEE
|
||||||
return newFee
|
return newFee
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendCoins (account, tx, settings, operatorId, feeDiscount) {
|
function sendCoins (account, tx, settings, operatorId, feeMultiplier) {
|
||||||
const { toAddress, cryptoAtoms, cryptoCode } = tx
|
const { toAddress, cryptoAtoms, cryptoCode } = tx
|
||||||
const coins = cryptoAtoms.shiftedBy(-unitScale).toFixed(8)
|
const coins = cryptoAtoms.shiftedBy(-unitScale).toFixed(8)
|
||||||
|
|
||||||
return checkCryptoCode(cryptoCode)
|
return checkCryptoCode(cryptoCode)
|
||||||
.then(() => calculateFeeDiscount(feeDiscount))
|
.then(() => calculateFeeDiscount(feeMultiplier))
|
||||||
.then(newFee => fetch('settxfee', [newFee]))
|
.then(newFee => fetch('settxfee', [newFee]))
|
||||||
.then(() => fetch('sendtoaddress', [toAddress, coins]))
|
.then(() => fetch('sendtoaddress', [toAddress, coins]))
|
||||||
.then((txId) => fetch('gettransaction', [txId]))
|
.then((txId) => fetch('gettransaction', [txId]))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue