@ -2,7 +2,7 @@
import { EventManager } from '../eventManager'
import type { Transaction as InternalTransaction } from './txRunner'
import Web3 from 'web3'
import { toBigInt , toHex } from 'web3-utils'
import { toBigInt , toHex } from 'web3-utils'
export class TxRunnerWeb3 {
event
@ -65,9 +65,9 @@ export class TxRunnerWeb3 {
promptCb (
async ( value ) = > {
try {
const res = await ( this . getWeb3 ( ) as any ) . eth . personal . sendTransaction ( { . . . tx , value } , { checkRevertBeforeSending : false , ignoreGasPricing : true } )
const res = await ( this . getWeb3 ( ) as any ) . eth . personal . sendTransaction ( { . . . tx , value } , { checkRevertBeforeSending : false , ignoreGasPricing : true } )
cb ( null , res . transactionHash )
} catch ( e ) {
} catch ( e ) {
console . log ( ` Send transaction failed: ${ e . message } . if you use an injected provider, please check it is properly unlocked. ` )
// in case the receipt is available, we consider that only the execution failed but the transaction went through.
// So we don't consider this to be an error.
@ -81,9 +81,9 @@ export class TxRunnerWeb3 {
)
} else {
try {
const res = await this . getWeb3 ( ) . eth . sendTransaction ( tx , null , { checkRevertBeforeSending : false , ignoreGasPricing : true } )
const res = await this . getWeb3 ( ) . eth . sendTransaction ( tx , null , { checkRevertBeforeSending : false , ignoreGasPricing : true } )
cb ( null , res . transactionHash )
} catch ( e ) {
} catch ( e ) {
console . log ( ` Send transaction failed: ${ e . message } . if you use an injected provider, please check it is properly unlocked. ` )
// in case the receipt is available, we consider that only the execution failed but the transaction went through.
// So we don't consider this to be an error.
@ -121,7 +121,7 @@ export class TxRunnerWeb3 {
console . log ( errNetWork )
return
}
const txCopy = { . . . tx , type : undefined , maxFeePerGas : undefined , gasPrice : undefined }
const txCopy = { . . . tx , type : undefined , maxFeePerGas : undefined , gasPrice : undefined }
if ( network && network . lastBlock ) {
if ( network . lastBlock . baseFeePerGas ) {
// the sending stack (web3.js / metamask need to have the type defined)
@ -138,17 +138,17 @@ export class TxRunnerWeb3 {
gasEstimationForceSend ( null , ( ) = > {
/ *
* gasLimit is a value that can be set in the UI to hardcap value that can be put in a tx .
* e . g if the gasestimate
* e . g if the gasestimate
* /
if ( gasLimit !== '0x0' && gasEstimation > gasLimit ) {
return callback ( ` estimated gas for this transaction ( ${ gasEstimation } ) is higher than gasLimit set in the configuration ( ${ gasLimit } ). Please raise the gas limit. ` )
}
}
if ( gasLimit === '0x0' ) {
tx [ 'gas' ] = gasEstimation
} else {
tx [ 'gas' ] = gasLimit
}
}
if ( this . _api . config . getUnpersistedProperty ( 'doNotShowTransactionConfirmationAgain' ) ) {
return this . _executeTx ( tx , network , null , this . _api , promptCb , callback )