SafeTxGas calculation: Add check for openethereum/parity revert messages (#788)
* add check for openethereum/parity revert messages * fix isEstimationSuccessful check * fix estimation check if revert msg is from openethereum
This commit is contained in:
parent
f4cca4c416
commit
76c673ac4d
|
@ -118,8 +118,15 @@ export const estimateSafeTxGas = async (
|
||||||
gasLimit: txGasEstimation + dataGasEstimation + additionalGas,
|
gasLimit: txGasEstimation + dataGasEstimation + additionalGas,
|
||||||
},
|
},
|
||||||
(error, res) => {
|
(error, res) => {
|
||||||
|
// res.data check is for OpenEthereum/Parity revert messages format
|
||||||
|
const isOpenEthereumRevertMsg = res && typeof res.data === 'string'
|
||||||
|
|
||||||
|
const isEstimationSuccessful =
|
||||||
|
!error &&
|
||||||
|
((typeof res === 'string' && res !== '0x') || (isOpenEthereumRevertMsg && res.data.slice(9) !== '0x'))
|
||||||
|
|
||||||
resolve({
|
resolve({
|
||||||
success: error || res === '0x' ? false : true,
|
success: isEstimationSuccessful,
|
||||||
estimation: txGasEstimation + additionalGas,
|
estimation: txGasEstimation + additionalGas,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue