just send the tx if "VM"

pull/2244/head^2
yann300 3 years ago
parent 358c75955b
commit ced9077119
  1. 14
      libs/remix-lib/src/execution/txRunnerWeb3.ts

@ -101,16 +101,16 @@ export class TxRunnerWeb3 {
// // @todo(#378) this should be removed when https://github.com/WalletConnect/walletconnect-monorepo/issues/334 is fixed // // @todo(#378) this should be removed when https://github.com/WalletConnect/walletconnect-monorepo/issues/334 is fixed
callback(new Error('Gas estimation failed because of an unknown internal error. This may indicated that the transaction will fail.')) callback(new Error('Gas estimation failed because of an unknown internal error. This may indicated that the transaction will fail.'))
} }
this._api.detectNetwork((errNetWork, network) => {
if (errNetWork) {
console.log(errNetWork)
return
}
err = network.name === 'VM' ? null : err // just send the tx if "VM"
gasEstimationForceSend(err, () => { gasEstimationForceSend(err, () => {
// callback is called whenever no error // callback is called whenever no error
tx['gas'] = !gasEstimation ? gasLimit : gasEstimation tx['gas'] = !gasEstimation ? gasLimit : gasEstimation
this._api.detectNetwork((err, network) => {
if (err) {
console.log(err)
return
}
if (this._api.config.getUnpersistedProperty('doNotShowTransactionConfirmationAgain')) { if (this._api.config.getUnpersistedProperty('doNotShowTransactionConfirmationAgain')) {
return this._executeTx(tx, network, null, this._api, promptCb, callback) return this._executeTx(tx, network, null, this._api, promptCb, callback)
} }
@ -120,7 +120,6 @@ export class TxRunnerWeb3 {
}, (error) => { }, (error) => {
callback(error) callback(error)
}) })
})
}, () => { }, () => {
const blockGasLimit = this.currentblockGasLimit() const blockGasLimit = this.currentblockGasLimit()
// NOTE: estimateGas very likely will return a large limit if execution of the code failed // NOTE: estimateGas very likely will return a large limit if execution of the code failed
@ -138,6 +137,7 @@ export class TxRunnerWeb3 {
} }
}) })
}) })
})
} }
} }

Loading…
Cancel
Save