aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/send_/send.utils.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/components/send_/send.utils.js')
-rw-r--r--ui/app/components/send_/send.utils.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/ui/app/components/send_/send.utils.js b/ui/app/components/send_/send.utils.js
index 750411908..9b8f1d118 100644
--- a/ui/app/components/send_/send.utils.js
+++ b/ui/app/components/send_/send.utils.js
@@ -193,14 +193,21 @@ async function estimateGas ({ selectedAddress, selectedToken, data, blockGasLimi
roundDown: '0',
toNumericBase: 'hex',
}))
-
// run tx
return new Promise((resolve, reject) => {
- estimateGasMethod(paramsForGasEstimate, (err, estimatedGas) => {
+ return estimateGasMethod(paramsForGasEstimate, (err, estimatedGas) => {
if (err) {
- reject(err)
+ const simulationFailed = (
+ err.message.includes('Transaction execution error.') ||
+ err.message.includes('gas required exceeds allowance or always failing transaction')
+ )
+ if (simulationFailed) {
+ return resolve(paramsForGasEstimate.gas)
+ } else {
+ return reject(err)
+ }
}
- resolve(estimatedGas.toString(16))
+ return resolve(estimatedGas.toString(16))
})
})
}