fix: update math for eth sends
This commit is contained in:
parent
a0b8b634fb
commit
2acd39fac2
1 changed files with 3 additions and 4 deletions
|
|
@ -161,7 +161,7 @@ function generateErc20Tx (_toAddress, wallet, amount, includesFee, cryptoCode) {
|
||||||
.then(([gas, txCount, baseFeePerGas]) => {
|
.then(([gas, txCount, baseFeePerGas]) => {
|
||||||
lastUsedNonces[fromAddress] = txCount
|
lastUsedNonces[fromAddress] = txCount
|
||||||
|
|
||||||
const maxPriorityFeePerGas = new BN(web3.utils.toWei('2.5', 'gwei')) // web3 default value
|
const maxPriorityFeePerGas = new BN(web3.utils.toWei('1.0', 'gwei')) // web3 default value
|
||||||
const maxFeePerGas = new BN(2).times(baseFeePerGas).plus(maxPriorityFeePerGas)
|
const maxFeePerGas = new BN(2).times(baseFeePerGas).plus(maxPriorityFeePerGas)
|
||||||
|
|
||||||
if (includesFee && (toSend.isNegative() || toSend.isZero())) {
|
if (includesFee && (toSend.isNegative() || toSend.isZero())) {
|
||||||
|
|
@ -219,9 +219,8 @@ function generateTx (_toAddress, wallet, amount, includesFee, cryptoCode, txId)
|
||||||
.then(([gas, gasPrice, txCount, baseFeePerGas]) => {
|
.then(([gas, gasPrice, txCount, baseFeePerGas]) => {
|
||||||
lastUsedNonces[fromAddress] = txCount
|
lastUsedNonces[fromAddress] = txCount
|
||||||
|
|
||||||
const maxPriorityFeePerGas = new BN(web3.utils.toWei('2.5', 'gwei')) // web3 default value
|
const maxPriorityFeePerGas = new BN(web3.utils.toWei('1.0', 'gwei')) // web3 default value
|
||||||
const neededPriority = new BN(web3.utils.toWei('2.0', 'gwei'))
|
const maxFeePerGas = baseFeePerGas.times(2).plus(maxPriorityFeePerGas)
|
||||||
const maxFeePerGas = baseFeePerGas.plus(neededPriority)
|
|
||||||
const newGasPrice = BN.minimum(maxFeePerGas, baseFeePerGas.plus(maxPriorityFeePerGas))
|
const newGasPrice = BN.minimum(maxFeePerGas, baseFeePerGas.plus(maxPriorityFeePerGas))
|
||||||
|
|
||||||
const toSend = includesFee
|
const toSend = includesFee
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue