Merge pull request #2751 from MetaMask/i#2720

transactions:gas-utils - handle new type of estimateGas error
feature/default_network_editable
Thomas Huang 7 years ago committed by GitHub
commit 84dece92a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      app/scripts/lib/tx-gas-utils.js

@ -22,7 +22,11 @@ module.exports = class txProvideUtil {
try {
estimatedGasHex = await this.estimateTxGas(txMeta, block.gasLimit)
} catch (err) {
if (err.message.includes('Transaction execution error.')) {
const simulationFailed = (
err.message.includes('Transaction execution error.') ||
err.message.includes('gas required exceeds allowance or always failing transaction')
)
if ( simulationFailed ) {
txMeta.simulationFails = true
return txMeta
}

Loading…
Cancel
Save