abstractWeb3Config
Hierarchy
- Web3EventEmitter<{ CONFIG_CHANGE: ConfigEvent<Web3ConfigOptions> }>
- Web3Config
Implements
Index
Constructors
Properties
Accessors
- blockHeaderTimeout
- contractDataInputFill
- customTransactionSchema
- defaultAccount
- defaultBlock
- defaultChain
- defaultCommon
- defaultHardfork
- defaultMaxPriorityFeePerGas
- defaultNetworkId
- defaultReturnFormat
- defaultTransactionType
- enableExperimentalFeatures
- handleRevert
- ignoreGasPricing
- maxListenersWarningThreshold
- transactionBlockTimeout
- transactionBuilder
- transactionConfirmationBlocks
- transactionConfirmationPollingInterval
- transactionPollingInterval
- transactionPollingTimeout
- transactionReceiptPollingInterval
- transactionSendTimeout
- transactionTypeParser
Methods
Constructors
publicconstructor
Parameters
optionaloptions: Partial<Web3ConfigOptions>
Returns Web3Config
Properties
publicconfig
Accessors
publicblockHeaderTimeout
Returns number
Will set the blockHeaderTimeout
Parameters
val: number
Returns void
publiccontractDataInputFill
The
contractDataInputFill
options property will allow you to set the hash of the method signature and encoded parameters to the property eitherdata
,input
or both within your contract. This will affect the contracts send, call and estimateGas methods Default isdata
.Returns input | data | both
Will set the contractDataInputFill
Parameters
val: input | data | both
Returns void
publiccustomTransactionSchema
Returns undefined | CustomTransactionSchema
Parameters
schema: undefined | CustomTransactionSchema
Returns void
publicdefaultAccount
This default address is used as the default
from
property, if nofrom
property is specified in for the following methods:- web3.eth.sendTransaction()
- web3.eth.call()
- myContract.methods.myMethod().call()
- myContract.methods.myMethod().send()
Returns undefined | string
Will set the default account.
Parameters
val: undefined | string
Returns void
publicdefaultBlock
The default block is used for certain methods. You can override it by passing in the defaultBlock as last parameter. The default value is
"latest"
.- web3.eth.getBalance()
- web3.eth.getCode()
- web3.eth.getTransactionCount()
- web3.eth.getStorageAt()
- web3.eth.call()
- myContract.methods.myMethod().call()
Returns BlockNumberOrTag
Will set the default block.
- A block number
"earliest"
- String: The genesis block"latest"
- String: The latest block (current head of the blockchain)"pending"
- String: The currently mined block (including pending transactions)"finalized"
- String: (For POS networks) The finalized block is one which has been accepted as canonical by greater than 2/3 of validators"safe"
- String: (For POS networks) The safe head block is one which under normal network conditions, is expected to be included in the canonical chain. Under normal network conditions the safe head and the actual tip of the chain will be equivalent (with safe head trailing only by a few seconds). Safe heads will be less likely to be reorged than the proof of work network's latest blocks.
Parameters
val: BlockNumberOrTag
Returns void
publicdefaultChain
Returns string
Parameters
val: string
Returns void
publicdefaultCommon
Will get the default common property The default common property does contain the following Common object:
customChain
-Object
: The custom chain propertiesname
-string
: (optional) The name of the chainnetworkId
-number
: Network ID of the custom chainchainId
-number
: Chain ID of the custom chain
baseChain
-string
: (optional) mainnet, goerli, kovan, rinkeby, or ropstenhardfork
-string
: (optional) chainstart, homestead, dao, tangerineWhistle, spuriousDragon, byzantium, constantinople, petersburg, istanbul, berlin, or london Default isundefined
.
Returns undefined | Common
Will set the default common property
Parameters
val: undefined | Common
Returns void
publicdefaultHardfork
Will return the default hardfork. Default is
london
The default hardfork property can be one of the following:chainstart
homestead
dao
tangerineWhistle
spuriousDragon
byzantium
constantinople
petersburg
istanbul
berlin
london
- 'arrowGlacier',
- 'tangerineWhistle',
- 'muirGlacier'
Returns string
Will set the default hardfork.
Parameters
val: string
Returns void
publicdefaultMaxPriorityFeePerGas
publicdefaultNetworkId
publicdefaultReturnFormat
Returns DataFormat
Parameters
val: DataFormat
Returns void
publicdefaultTransactionType
publicenableExperimentalFeatures
The enableExperimentalFeatures is used to enable trying new experimental features that are still not fully implemented or not fully tested or still have some related issues. Default is
false
for every feature.Returns { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }
useRpcCallSpecification: boolean
useSubscriptionWhenCheckingBlockTimeout: boolean
Will set the enableExperimentalFeatures
Parameters
val: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }
useRpcCallSpecification: boolean
useSubscriptionWhenCheckingBlockTimeout: boolean
Returns void
publichandleRevert
The
handleRevert
options property returns the revert reason string if enabled for the following methods:- web3.eth.sendTransaction()
- web3.eth.call()
- myContract.methods.myMethod().call()
- myContract.methods.myMethod().send()
Default is
false
.
Note
: At the momenthandleRevert
is only supported forsendTransaction
and not forsendSignedTransaction
Returns boolean
Will set the handleRevert
Parameters
val: boolean
Returns void
publicignoreGasPricing
Will get the ignoreGasPricing property. When true, the gasPrice, maxPriorityFeePerGas, and maxFeePerGas will not be autofilled in the transaction object. Useful when you want wallets to handle gas pricing.
Returns boolean
Parameters
val: boolean
Returns void
publicmaxListenersWarningThreshold
Returns number
Parameters
val: number
Returns void
publictransactionBlockTimeout
The
transactionBlockTimeout
is used over socket-based connections. This option defines the amount of new blocks it should wait until the first confirmation happens, otherwise the PromiEvent rejects with a timeout error. Default is50
.Returns number
Will set the transactionBlockTimeout.
Parameters
val: number
Returns void
publictransactionBuilder
Returns undefined | TransactionBuilder<unknown>
Parameters
val: undefined | TransactionBuilder<unknown>
Returns void
publictransactionConfirmationBlocks
This defines the number of blocks it requires until a transaction is considered confirmed. Default is
24
.Returns number
Will set the transactionConfirmationBlocks.
Parameters
val: number
Returns void
publictransactionConfirmationPollingInterval
Returns undefined | number
Parameters
val: undefined | number
Returns void
publictransactionPollingInterval
Used over HTTP connections. This option defines the number of seconds between Web3 calls for a receipt which confirms that a transaction was mined by the network. Default is
1000
ms.Returns number
Will set the transactionPollingInterval.
Parameters
val: number
Returns void
publictransactionPollingTimeout
Used over HTTP connections. This option defines the number of seconds Web3 will wait for a receipt which confirms that a transaction was mined by the network. Note: If this method times out, the transaction may still be pending. Default is
750
seconds (12.5 minutes).Returns number
Will set the transactionPollingTimeout.
Parameters
val: number
Returns void
publictransactionReceiptPollingInterval
The
transactionPollingInterval
is used over HTTP connections. This option defines the number of seconds between Web3 calls for a receipt which confirms that a transaction was mined by the network. Default isundefined
Returns undefined | number
Will set the transactionReceiptPollingInterval
Parameters
val: undefined | number
Returns void
publictransactionSendTimeout
The time used to wait for Ethereum Node to return the sent transaction result. Note: If the RPC call stuck at the Node and therefor timed-out, the transaction may still be pending or even mined by the Network. We recommend checking the pending transactions in such a case. Default is
750
seconds (12.5 minutes).Returns number
Will set the transactionSendTimeout.
Parameters
val: number
Returns void
publictransactionTypeParser
Returns undefined | TransactionTypeParser
Parameters
val: undefined | TransactionTypeParser
Returns void
Methods
publicemit
Type parameters
- K: CONFIG_CHANGE
Parameters
eventName: K
params: { CONFIG_CHANGE: { name: handleRevert; newValue: boolean; oldValue: boolean } | { name: defaultAccount; newValue: undefined | string; oldValue: undefined | string } | { name: defaultBlock; newValue: BlockNumberOrTag; oldValue: BlockNumberOrTag } | { name: transactionSendTimeout; newValue: number; oldValue: number } | { name: transactionBlockTimeout; newValue: number; oldValue: number } | { name: transactionConfirmationBlocks; newValue: number; oldValue: number } | { name: transactionPollingInterval; newValue: number; oldValue: number } | { name: transactionPollingTimeout; newValue: number; oldValue: number } | { name: transactionReceiptPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: transactionConfirmationPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: blockHeaderTimeout; newValue: number; oldValue: number } | { name: maxListenersWarningThreshold; newValue: number; oldValue: number } | { name: contractDataInputFill; newValue: input | data | both; oldValue: input | data | both } | { name: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { name: ignoreGasPricing; newValue: boolean; oldValue: boolean } | { name: defaultCommon; newValue: undefined | Common; oldValue: undefined | Common } | { name: defaultTransactionType; newValue: Numbers; oldValue: Numbers } | { name: defaultMaxPriorityFeePerGas; newValue: Numbers; oldValue: Numbers } | { name: enableExperimentalFeatures; newValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }; oldValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean } } | { name: transactionBuilder; newValue: undefined | TransactionBuilder<unknown>; oldValue: undefined | TransactionBuilder<unknown> } | { name: transactionTypeParser; newValue: undefined | TransactionTypeParser; oldValue: undefined | TransactionTypeParser } | { name: customTransactionSchema; newValue: undefined | CustomTransactionSchema; oldValue: undefined | CustomTransactionSchema } | { name: defaultReturnFormat; newValue: DataFormat; oldValue: DataFormat } }[K]
Returns void
publiceventNames
Returns (string | symbol)[]
publicgetMaxListeners
Returns number
publiclistenerCount
Type parameters
- K: CONFIG_CHANGE
Parameters
eventName: K
Returns number
publiclisteners
Type parameters
- K: CONFIG_CHANGE
Parameters
eventName: K
Returns (...args: any[]) => void[]
publicoff
Type parameters
- K: CONFIG_CHANGE
Parameters
eventName: K
fn: Web3EventCallback<{ CONFIG_CHANGE: { name: handleRevert; newValue: boolean; oldValue: boolean } | { name: defaultAccount; newValue: undefined | string; oldValue: undefined | string } | { name: defaultBlock; newValue: BlockNumberOrTag; oldValue: BlockNumberOrTag } | { name: transactionSendTimeout; newValue: number; oldValue: number } | { name: transactionBlockTimeout; newValue: number; oldValue: number } | { name: transactionConfirmationBlocks; newValue: number; oldValue: number } | { name: transactionPollingInterval; newValue: number; oldValue: number } | { name: transactionPollingTimeout; newValue: number; oldValue: number } | { name: transactionReceiptPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: transactionConfirmationPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: blockHeaderTimeout; newValue: number; oldValue: number } | { name: maxListenersWarningThreshold; newValue: number; oldValue: number } | { name: contractDataInputFill; newValue: input | data | both; oldValue: input | data | both } | { name: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { name: ignoreGasPricing; newValue: boolean; oldValue: boolean } | { name: defaultCommon; newValue: undefined | Common; oldValue: undefined | Common } | { name: defaultTransactionType; newValue: Numbers; oldValue: Numbers } | { name: defaultMaxPriorityFeePerGas; newValue: Numbers; oldValue: Numbers } | { name: enableExperimentalFeatures; newValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }; oldValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean } } | { name: transactionBuilder; newValue: undefined | TransactionBuilder<unknown>; oldValue: undefined | TransactionBuilder<unknown> } | { name: transactionTypeParser; newValue: undefined | TransactionTypeParser; oldValue: undefined | TransactionTypeParser } | { name: customTransactionSchema; newValue: undefined | CustomTransactionSchema; oldValue: undefined | CustomTransactionSchema } | { name: defaultReturnFormat; newValue: DataFormat; oldValue: DataFormat } }[K]>
Returns void
publicon
Type parameters
- K: CONFIG_CHANGE
Parameters
eventName: K
fn: Web3EventCallback<{ CONFIG_CHANGE: { name: handleRevert; newValue: boolean; oldValue: boolean } | { name: defaultAccount; newValue: undefined | string; oldValue: undefined | string } | { name: defaultBlock; newValue: BlockNumberOrTag; oldValue: BlockNumberOrTag } | { name: transactionSendTimeout; newValue: number; oldValue: number } | { name: transactionBlockTimeout; newValue: number; oldValue: number } | { name: transactionConfirmationBlocks; newValue: number; oldValue: number } | { name: transactionPollingInterval; newValue: number; oldValue: number } | { name: transactionPollingTimeout; newValue: number; oldValue: number } | { name: transactionReceiptPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: transactionConfirmationPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: blockHeaderTimeout; newValue: number; oldValue: number } | { name: maxListenersWarningThreshold; newValue: number; oldValue: number } | { name: contractDataInputFill; newValue: input | data | both; oldValue: input | data | both } | { name: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { name: ignoreGasPricing; newValue: boolean; oldValue: boolean } | { name: defaultCommon; newValue: undefined | Common; oldValue: undefined | Common } | { name: defaultTransactionType; newValue: Numbers; oldValue: Numbers } | { name: defaultMaxPriorityFeePerGas; newValue: Numbers; oldValue: Numbers } | { name: enableExperimentalFeatures; newValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }; oldValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean } } | { name: transactionBuilder; newValue: undefined | TransactionBuilder<unknown>; oldValue: undefined | TransactionBuilder<unknown> } | { name: transactionTypeParser; newValue: undefined | TransactionTypeParser; oldValue: undefined | TransactionTypeParser } | { name: customTransactionSchema; newValue: undefined | CustomTransactionSchema; oldValue: undefined | CustomTransactionSchema } | { name: defaultReturnFormat; newValue: DataFormat; oldValue: DataFormat } }[K]>
Returns void
publiconce
Type parameters
- K: CONFIG_CHANGE
Parameters
eventName: K
fn: Web3EventCallback<{ CONFIG_CHANGE: { name: handleRevert; newValue: boolean; oldValue: boolean } | { name: defaultAccount; newValue: undefined | string; oldValue: undefined | string } | { name: defaultBlock; newValue: BlockNumberOrTag; oldValue: BlockNumberOrTag } | { name: transactionSendTimeout; newValue: number; oldValue: number } | { name: transactionBlockTimeout; newValue: number; oldValue: number } | { name: transactionConfirmationBlocks; newValue: number; oldValue: number } | { name: transactionPollingInterval; newValue: number; oldValue: number } | { name: transactionPollingTimeout; newValue: number; oldValue: number } | { name: transactionReceiptPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: transactionConfirmationPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: blockHeaderTimeout; newValue: number; oldValue: number } | { name: maxListenersWarningThreshold; newValue: number; oldValue: number } | { name: contractDataInputFill; newValue: input | data | both; oldValue: input | data | both } | { name: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { name: ignoreGasPricing; newValue: boolean; oldValue: boolean } | { name: defaultCommon; newValue: undefined | Common; oldValue: undefined | Common } | { name: defaultTransactionType; newValue: Numbers; oldValue: Numbers } | { name: defaultMaxPriorityFeePerGas; newValue: Numbers; oldValue: Numbers } | { name: enableExperimentalFeatures; newValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }; oldValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean } } | { name: transactionBuilder; newValue: undefined | TransactionBuilder<unknown>; oldValue: undefined | TransactionBuilder<unknown> } | { name: transactionTypeParser; newValue: undefined | TransactionTypeParser; oldValue: undefined | TransactionTypeParser } | { name: customTransactionSchema; newValue: undefined | CustomTransactionSchema; oldValue: undefined | CustomTransactionSchema } | { name: defaultReturnFormat; newValue: DataFormat; oldValue: DataFormat } }[K]>
Returns void
publicremoveAllListeners
Returns EventEmitter
publicsetConfig
Parameters
options: Partial<Web3ConfigOptions>
Returns void
publicsetMaxListenerWarningThreshold
Parameters
maxListenersWarningThreshold: number
Returns void
The blockHeaderTimeout is used over socket-based connections. This option defines the amount seconds it should wait for
'newBlockHeaders'
event before falling back to polling to fetch transaction receipt. Default is10
seconds.