Check that the estimation of the node is bigger than 0 before returning
This commit is contained in:
parent
2f6113d117
commit
c1b48f9508
|
@ -182,15 +182,17 @@ const calculateMinimumGasForTransaction = async (
|
||||||
const amountOfGasToTryTx = txGasEstimation + dataGasEstimation + additionalGas
|
const amountOfGasToTryTx = txGasEstimation + dataGasEstimation + additionalGas
|
||||||
console.info(`Estimating transaction creation with gas amount: ${amountOfGasToTryTx}`)
|
console.info(`Estimating transaction creation with gas amount: ${amountOfGasToTryTx}`)
|
||||||
try {
|
try {
|
||||||
await getGasEstimationTxResponse({
|
const estimation = await getGasEstimationTxResponse({
|
||||||
to: safeAddress,
|
to: safeAddress,
|
||||||
from: safeAddress,
|
from: safeAddress,
|
||||||
data: estimateData,
|
data: estimateData,
|
||||||
gasPrice: 0,
|
gasPrice: 0,
|
||||||
gas: amountOfGasToTryTx,
|
gas: amountOfGasToTryTx,
|
||||||
})
|
})
|
||||||
console.info(`Gas estimation successfully finished with gas amount: ${amountOfGasToTryTx}`)
|
if (estimation > 0) {
|
||||||
return amountOfGasToTryTx
|
console.info(`Gas estimation successfully finished with gas amount: ${amountOfGasToTryTx}`)
|
||||||
|
return amountOfGasToTryTx
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(`Error trying to estimate gas with amount: ${amountOfGasToTryTx}`)
|
console.log(`Error trying to estimate gas with amount: ${amountOfGasToTryTx}`)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue