Skip to main content

core

Export all packages grouped by name spaces

Index

References

Web3Context

Re-exports Web3Context

Web3EthPluginBase

Web3PluginBase

Re-exports Web3PluginBase

Web3PromiEvent

Re-exports Web3PromiEvent

inputAddressFormatter

inputBlockNumberFormatter

inputCallFormatter

inputDefaultBlockNumberFormatter

inputLogFormatter

inputPostFormatter

inputSignFormatter

inputStorageKeysFormatter

inputTopicFormatter

inputTransactionFormatter

outputBigIntegerFormatter

outputBlockFormatter

outputLogFormatter

outputPostFormatter

outputProofFormatter

outputSyncingFormatter

outputTransactionFormatter

outputTransactionReceiptFormatter

txInputOptionsFormatter

Namespaces

formatters

formatters:

inputAddressFormatter

  • inputAddressFormatter(address: string): string
  • @deprecated

    Use format function from web3-utils package instead


    Parameters

    • address: string

    Returns string

inputBlockNumberFormatter

  • inputBlockNumberFormatter(blockNumber: undefined | Numbers): undefined | string
  • @deprecated

    Use format function from web3-utils package instead Returns the given block number as hex string or the predefined block number 'latest', 'pending', 'earliest', 'genesis'


    Parameters

    Returns undefined | string

inputCallFormatter

  • @deprecated

    Use format function from web3-utils package instead Formats the input of a transaction and converts all values to HEX


    Parameters

    Returns Mutable<TransactionOutput>

inputDefaultBlockNumberFormatter

  • inputDefaultBlockNumberFormatter(blockNumber: undefined | Numbers, defaultBlock: Numbers): undefined | string
  • @deprecated

    Use format function from web3-utils package instead Returns the given block number as hex string or does return the defaultBlock property of the current module


    Parameters

    Returns undefined | string

inputLogFormatter

  • @deprecated

    Use format function from web3-utils package instead


    Parameters

    Returns Filter

inputPostFormatter

  • @deprecated

    Use format function from web3-utils package instead Formats the input of a whisper post and converts all values to HEX


    Parameters

    Returns PostInput

inputSignFormatter

  • inputSignFormatter(data: string): string
  • @deprecated

    Use format function from web3-utils package instead Hex encodes the data passed to eth_sign and personal_sign


    Parameters

    • data: string

    Returns string

inputStorageKeysFormatter

  • inputStorageKeysFormatter(keys: string[]): string[]
  • @deprecated

    Use format function from web3-utils package instead Will format the given storage key array values to hex strings.


    Parameters

    • keys: string[]

    Returns string[]

inputTopicFormatter

  • inputTopicFormatter(topic: string): null | string
  • @deprecated

    Use format function from web3-utils package instead


    Parameters

    • topic: string

    Returns null | string

inputTransactionFormatter

  • @deprecated

    Use format function from web3-utils package instead Formats the input of a transaction and converts all values to HEX


    Parameters

    Returns Mutable<TransactionOutput>

outputBigIntegerFormatter

  • outputBigIntegerFormatter(number: Numbers): number | bigint
  • @deprecated

    Use format function from web3-utils package instead Should the format output to a big number


    Parameters

    Returns number | bigint

outputBlockFormatter

  • @deprecated

    Use format function from web3-utils package instead Formats the output of a block to its proper values

    @function

    outputBlockFormatter


    Parameters

    Returns BlockOutput

outputLogFormatter

  • @deprecated

    Use format function from web3-utils package instead Formats the output of a log

    @function

    outputLogFormatter


    Parameters

    Returns LogsOutput

outputPostFormatter

  • @deprecated

    Use format function from web3-utils package instead Formats the output of a received post message

    @function

    outputPostFormatter


    Parameters

    Returns PostOutput

outputProofFormatter

  • @deprecated

    Use format function from web3-utils package instead Will format the given proof response from the node.


    Parameters

    Returns Proof

outputSyncingFormatter

  • @deprecated

    Use format function from web3-utils package instead


    Parameters

    Returns SyncOutput

outputTransactionFormatter

  • @deprecated

    Use format function from web3-utils package instead Formats the output of a transaction to its proper values

    @function

    outputTransactionFormatter


    Parameters

    Returns TransactionOutput

outputTransactionReceiptFormatter

  • @deprecated

    Use format function from web3-utils package instead Formats the output of a transaction receipt to its proper values


    Parameters

    Returns ReceiptOutput

txInputOptionsFormatter

Enumerations

Web3ConfigEvent

Web3ConfigEvent:

CONFIG_CHANGE

CONFIG_CHANGE: CONFIG_CHANGE

Web3RequestManagerEvent

Web3RequestManagerEvent:

BEFORE_PROVIDER_CHANGE

BEFORE_PROVIDER_CHANGE: BEFORE_PROVIDER_CHANGE

PROVIDER_CHANGED

PROVIDER_CHANGED: PROVIDER_CHANGED

Classes

Web3BatchRequest

Web3BatchRequest:

constructor

requests

add

execute

  • Parameters

    • optionaloptions: { timeout?: number }
      • optionaltimeout: number

    Returns Promise<JsonRpcBatchResponse<unknown, unknown>>

abstractWeb3Config

Web3Config:

constructor

config

blockHeaderTimeout

  • get blockHeaderTimeout(): number
  • set blockHeaderTimeout(val: number): 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 is 10 seconds.


    Returns number

  • Will set the blockHeaderTimeout


    Parameters

    • val: number

    Returns void

contractDataInputFill

  • get contractDataInputFill(): input | data | both
  • set contractDataInputFill(val: input | data | both): void
  • The contractDataInputFill options property will allow you to set the hash of the method signature and encoded parameters to the property either data, input or both within your contract. This will affect the contracts send, call and estimateGas methods Default is data.


    Returns input | data | both

  • Will set the contractDataInputFill


    Parameters

    • val: input | data | both

    Returns void

customTransactionSchema

defaultAccount

  • get defaultAccount(): undefined | string
  • set defaultAccount(val: undefined | string): void
  • This default address is used as the default from property, if no from 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

defaultBlock

  • 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

    Returns void

defaultChain

  • get defaultChain(): string
  • set defaultChain(val: string): void
  • Returns string

  • Parameters

    • val: string

    Returns void

defaultCommon

  • get defaultCommon(): undefined | Common
  • set defaultCommon(val: undefined | Common): void
  • Will get the default common property The default common property does contain the following Common object:

    • customChain - Object: The custom chain properties
      • name - string: (optional) The name of the chain
      • networkId - number: Network ID of the custom chain
      • chainId - number: Chain ID of the custom chain
    • baseChain - string: (optional) mainnet, goerli, kovan, rinkeby, or ropsten
    • hardfork - string: (optional) chainstart, homestead, dao, tangerineWhistle, spuriousDragon, byzantium, constantinople, petersburg, istanbul, berlin, or london Default is undefined.

    Returns undefined | Common

  • Will set the default common property


    Parameters

    Returns void

defaultHardfork

  • get defaultHardfork(): string
  • set defaultHardfork(val: string): void
  • 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

defaultMaxPriorityFeePerGas

  • get defaultMaxPriorityFeePerGas(): Numbers
  • set defaultMaxPriorityFeePerGas(val: Numbers): void
  • Returns Numbers

  • Parameters

    Returns void

defaultNetworkId

  • get defaultNetworkId(): undefined | Numbers
  • set defaultNetworkId(val: undefined | Numbers): void
  • Returns undefined | Numbers

  • Parameters

    Returns void

defaultReturnFormat

  • Returns DataFormat

  • Parameters

    Returns void

defaultTransactionType

  • get defaultTransactionType(): Numbers
  • set defaultTransactionType(val: Numbers): void
  • Returns Numbers

  • Parameters

    Returns void

enableExperimentalFeatures

  • get enableExperimentalFeatures(): { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }
  • set enableExperimentalFeatures(val: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }): void
  • 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

handleRevert

  • get handleRevert(): boolean
  • set handleRevert(val: boolean): void
  • 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 moment handleRevert is only supported for sendTransaction and not for sendSignedTransaction


    Returns boolean

  • Will set the handleRevert


    Parameters

    • val: boolean

    Returns void

ignoreGasPricing

  • get ignoreGasPricing(): boolean
  • set ignoreGasPricing(val: boolean): void
  • 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

maxListenersWarningThreshold

  • get maxListenersWarningThreshold(): number
  • set maxListenersWarningThreshold(val: number): void
  • Returns number

  • Parameters

    • val: number

    Returns void

transactionBlockTimeout

  • get transactionBlockTimeout(): number
  • set transactionBlockTimeout(val: number): void
  • 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 is 50.


    Returns number

  • Will set the transactionBlockTimeout.


    Parameters

    • val: number

    Returns void

transactionBuilder

  • Returns undefined | TransactionBuilder<unknown>

  • Parameters

    Returns void

transactionConfirmationBlocks

  • get transactionConfirmationBlocks(): number
  • set transactionConfirmationBlocks(val: number): void
  • 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

transactionConfirmationPollingInterval

  • get transactionConfirmationPollingInterval(): undefined | number
  • set transactionConfirmationPollingInterval(val: undefined | number): void
  • Returns undefined | number

  • Parameters

    • val: undefined | number

    Returns void

transactionPollingInterval

  • get transactionPollingInterval(): number
  • set transactionPollingInterval(val: number): void
  • 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

transactionPollingTimeout

  • get transactionPollingTimeout(): number
  • set transactionPollingTimeout(val: number): void
  • 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

transactionReceiptPollingInterval

  • get transactionReceiptPollingInterval(): undefined | number
  • set transactionReceiptPollingInterval(val: undefined | number): void
  • 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 is undefined


    Returns undefined | number

  • Will set the transactionReceiptPollingInterval


    Parameters

    • val: undefined | number

    Returns void

transactionSendTimeout

  • get transactionSendTimeout(): number
  • set transactionSendTimeout(val: number): void
  • 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

transactionTypeParser

  • Returns undefined | TransactionTypeParser

  • Parameters

    Returns void

emit

  • emit<K>(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]): void
  • 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

eventNames

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

getMaxListeners

  • getMaxListeners(): number
  • Returns number

listenerCount

  • listenerCount<K>(eventName: K): number
  • Type parameters

    • K: CONFIG_CHANGE

    Parameters

    • eventName: K

    Returns number

listeners

  • listeners<K>(eventName: K): (...args: any[]) => void[]
  • Type parameters

    • K: CONFIG_CHANGE

    Parameters

    • eventName: K

    Returns (...args: any[]) => void[]

off

  • off<K>(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]>): void
  • 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

on

  • on<K>(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]>): void
  • 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

once

  • once<K>(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]>): void
  • 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

removeAllListeners

  • Returns EventEmitter

setConfig

setMaxListenerWarningThreshold

  • setMaxListenerWarningThreshold(maxListenersWarningThreshold: number): void
  • Parameters

    • maxListenersWarningThreshold: number

    Returns void

Web3EventEmitter

Web3EventEmitter<T>:

Type parameters

constructor

emit

  • emit<K>(eventName: K, params: T[K]): void
  • Type parameters

    • K: string

    Parameters

    • eventName: K
    • params: T[K]

    Returns void

eventNames

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

getMaxListeners

  • getMaxListeners(): number
  • Returns number

listenerCount

  • listenerCount<K>(eventName: K): number
  • Type parameters

    • K: string

    Parameters

    • eventName: K

    Returns number

listeners

  • listeners<K>(eventName: K): (...args: any[]) => void[]
  • Type parameters

    • K: string

    Parameters

    • eventName: K

    Returns (...args: any[]) => void[]

off

  • Type parameters

    • K: string

    Parameters

    Returns void

on

  • Type parameters

    • K: string

    Parameters

    Returns void

once

  • Type parameters

    • K: string

    Parameters

    Returns void

removeAllListeners

setMaxListenerWarningThreshold

  • setMaxListenerWarningThreshold(maxListenersWarningThreshold: number): void
  • Parameters

    • maxListenersWarningThreshold: number

    Returns void

Web3RequestManager

Web3RequestManager<API>:

Type parameters

constructor

optionalmiddleware

middleware?: RequestManagerMiddleware<API>

provider

  • Will return the current provider.


    Returns undefined | SupportedProviders<API>

    Returns the current provider

providers

staticproviders

emit

eventNames

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

getMaxListeners

  • getMaxListeners(): number
  • Returns number

listenerCount

  • listenerCount<K>(eventName: K): number

listeners

  • listeners<K>(eventName: K): (...args: any[]) => void[]
  • Type parameters

    Parameters

    • eventName: K

    Returns (...args: any[]) => void[]

off

on

once

removeAllListeners

  • Returns EventEmitter

send

  • send<Method, ResponseType>(request: Web3APIRequest<API, Method>): Promise<ResponseType>
  • Will execute a request


    Type parameters

    Parameters

    Returns Promise<ResponseType>

    The response of the request ResponseType. If there is error in the response, will throw an error

sendBatch

setMaxListenerWarningThreshold

  • setMaxListenerWarningThreshold(maxListenersWarningThreshold: number): void
  • Parameters

    • maxListenersWarningThreshold: number

    Returns void

setMiddleware

setProvider

  • Use to set provider. Provider can be a provider instance or a string.


    Parameters

    Returns boolean

abstractWeb3Subscription

Web3Subscription<EventMap, ArgsType, API, CombinedEventMap>:

Type parameters

constructor

readonlyargs

args: ArgsType

id

  • get id(): undefined | string
  • Returns undefined | string

lastBlock

_processSubscriptionError

  • _processSubscriptionError(error: Error): void
  • Parameters

    • error: Error

    Returns void

_processSubscriptionResult

  • _processSubscriptionResult(data: unknown): void
  • Parameters

    • data: unknown

    Returns void

emit

  • emit<K>(eventName: K, params: CombinedEventMap[K]): void
  • Type parameters

    • K: string

    Parameters

    • eventName: K
    • params: CombinedEventMap[K]

    Returns void

eventNames

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

getMaxListeners

  • getMaxListeners(): number
  • Returns number

listenerCount

  • listenerCount<K>(eventName: K): number
  • Type parameters

    • K: string

    Parameters

    • eventName: K

    Returns number

listeners

  • listeners<K>(eventName: K): (...args: any[]) => void[]
  • Type parameters

    • K: string

    Parameters

    • eventName: K

    Returns (...args: any[]) => void[]

off

  • Type parameters

    • K: string

    Parameters

    Returns void

on

  • Type parameters

    • K: string

    Parameters

    Returns void

once

  • Type parameters

    • K: string

    Parameters

    Returns void

processSubscriptionData

removeAllListeners

  • Returns EventEmitter

resubscribe

  • resubscribe(): Promise<void>
  • Returns Promise<void>

sendSubscriptionRequest

  • sendSubscriptionRequest(): Promise<string>
  • Returns Promise<string>

sendUnsubscribeRequest

  • sendUnsubscribeRequest(): Promise<void>
  • Returns Promise<void>

setMaxListenerWarningThreshold

  • setMaxListenerWarningThreshold(maxListenersWarningThreshold: number): void
  • Parameters

    • maxListenersWarningThreshold: number

    Returns void

subscribe

  • subscribe(): Promise<string>
  • Returns Promise<string>

unsubscribe

  • unsubscribe(): Promise<void>
  • Returns Promise<void>

Web3SubscriptionManager

Web3SubscriptionManager<API, RegisteredSubs>:

Type parameters

constructor

  • @example
    const requestManager = new Web3RequestManager("ws://localhost:8545");
    const subscriptionManager = new Web3SubscriptionManager(requestManager, {});

    Type parameters

    • API: unknown = unknown
    • RegisteredSubs: {} = {}

    Parameters

    Returns Web3SubscriptionManager<API, RegisteredSubs>

readonlyregisteredSubscriptions

registeredSubscriptions: RegisteredSubs

readonlyrequestManager

requestManager: Web3RequestManager<API>

subscriptions

  • get subscriptions(): Map<string, InstanceType<RegisteredSubs[keyof RegisteredSubs]>>
  • Will returns all subscriptions.


    Returns Map<string, InstanceType<RegisteredSubs[keyof RegisteredSubs]>>

addSubscription

  • addSubscription(sub: InstanceType<RegisteredSubs[keyof RegisteredSubs]>): Promise<string>
  • Adds an instance of Web3Subscription and subscribes to it


    Parameters

    • sub: InstanceType<RegisteredSubs[keyof RegisteredSubs]>

    Returns Promise<string>

clear

  • clear(): void
  • Clears all subscriptions


    Returns void

removeSubscription

  • removeSubscription(sub: InstanceType<RegisteredSubs[keyof RegisteredSubs]>): Promise<string>
  • Will clear a subscription


    Parameters

    • sub: InstanceType<RegisteredSubs[keyof RegisteredSubs]>

    Returns Promise<string>

subscribe

  • subscribe<T>(name: T, args?: ConstructorParameters<RegisteredSubs[T]>[0], returnFormat?: DataFormat): Promise<InstanceType<RegisteredSubs[T]>>
  • Will create a new subscription


    Type parameters

    • T: string | number | symbol

    Parameters

    • name: T

      The subscription you want to subscribe to

    • optionalargs: ConstructorParameters<RegisteredSubs[T]>[0]

      Optional additional parameters, depending on the subscription type

    • optionalreturnFormat: DataFormat

    Returns Promise<InstanceType<RegisteredSubs[T]>>

    The subscription object

supportsSubscriptions

  • supportsSubscriptions(): boolean
  • Check whether the current provider supports subscriptions.


    Returns boolean

    true or false depending on if the current provider supports subscriptions

unsubscribe

  • unsubscribe(condition?: ShouldUnsubscribeCondition): Promise<string[]>
  • Will unsubscribe all subscriptions that fulfill the condition


    Parameters

    • optionalcondition: ShouldUnsubscribeCondition

      A function that access and id and a subscription and return true or false

    Returns Promise<string[]>

    An array of all the un-subscribed subscriptions

Interfaces

ExtensionObject

ExtensionObject:

methods

methods: Method[]

optionalproperty

property?: string

Method

Method:

call

call: string

name

name: string

RequestManagerMiddleware

RequestManagerMiddleware<API>:

Type parameters

  • API

processRequest

  • Type parameters

    • ParamType = unknown[]

    Parameters

    Returns Promise<JsonRpcPayload<ParamType>>

processResponse

Web3ConfigOptions

Web3ConfigOptions:

blockHeaderTimeout

blockHeaderTimeout: number

contractDataInputFill

contractDataInputFill: input | data | both

optionalcustomTransactionSchema

customTransactionSchema?: CustomTransactionSchema

optionaldefaultAccount

defaultAccount?: string

defaultBlock

defaultBlock: BlockNumberOrTag

defaultChain

defaultChain: string

optionaldefaultCommon

defaultCommon?: Common

defaultHardfork

defaultHardfork: string

defaultMaxPriorityFeePerGas

defaultMaxPriorityFeePerGas: Numbers

optionaldefaultNetworkId

defaultNetworkId?: Numbers

defaultReturnFormat

defaultReturnFormat: DataFormat

defaultTransactionType

defaultTransactionType: Numbers

enableExperimentalFeatures

enableExperimentalFeatures: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }

Type declaration

  • useRpcCallSpecification: boolean
  • useSubscriptionWhenCheckingBlockTimeout: boolean

handleRevert

handleRevert: boolean

ignoreGasPricing

ignoreGasPricing: boolean

maxListenersWarningThreshold

maxListenersWarningThreshold: number

transactionBlockTimeout

transactionBlockTimeout: number

optionaltransactionBuilder

transactionBuilder?: TransactionBuilder<unknown>

transactionConfirmationBlocks

transactionConfirmationBlocks: number

optionaltransactionConfirmationPollingInterval

transactionConfirmationPollingInterval?: number

transactionPollingInterval

transactionPollingInterval: number

transactionPollingTimeout

transactionPollingTimeout: number

optionaltransactionReceiptPollingInterval

transactionReceiptPollingInterval?: number

transactionSendTimeout

transactionSendTimeout: number

optionaltransactionTypeParser

transactionTypeParser?: TransactionTypeParser

Web3Emitter

Web3Emitter<T>:

Type parameters

emit

  • emit<K>(eventName: K, params: T[K]): void
  • Type parameters

    • K: string

    Parameters

    • eventName: K
    • params: T[K]

    Returns void

off

  • Type parameters

    • K: string

    Parameters

    Returns void

on

  • Type parameters

    • K: string

    Parameters

    Returns void

once

  • Type parameters

    • K: string

    Parameters

    Returns void

Type Aliases

CustomTransactionSchema

CustomTransactionSchema: { properties: Record<string, Schema>; type: string }

Type declaration

  • properties: Record<string, Schema>
  • type: string

PromiseExecutor

PromiseExecutor<T>: (resolve: (data: T) => void, reject: (reason: unknown) => void) => void

Type parameters

  • T

Type declaration

    • (resolve: (data: T) => void, reject: (reason: unknown) => void): void
    • Parameters

      • resolve: (data: T) => void
        • reject: (reason: unknown) => void

          Returns void

      TransactionBuilder

      TransactionBuilder<API>: <ReturnType>(options: { fillGasPrice?: boolean; privateKey?: HexString | Uint8Array; transaction: Transaction; web3Context: Web3Context<API> }) => Promise<ReturnType>

      Type parameters

      Type declaration

      TransactionTypeParser

      TransactionTypeParser: (transaction: Transaction) => HexString | undefined

      Type declaration

      Web3ContextConstructor

      Web3ContextConstructor<T, T2>: new (...args: [extras: T2, context: Web3ContextObject]) => T

      Type parameters

      Type declaration

      Web3ContextFactory

      Web3ContextFactory<T, T2>: Web3ContextConstructor<T, T2> & { fromContextObject: any }

      Type parameters

      Web3ContextInitOptions

      Web3ContextInitOptions<API, RegisteredSubs>: { accountProvider?: Web3AccountProvider<Web3BaseWalletAccount>; config?: Partial<Web3ConfigOptions>; provider?: SupportedProviders<API> | string; registeredSubscriptions?: RegisteredSubs; requestManager?: Web3RequestManager<API>; requestManagerMiddleware?: RequestManagerMiddleware<API>; subscriptionManager?: Web3SubscriptionManager<API, RegisteredSubs>; wallet?: Web3BaseWallet<Web3BaseWalletAccount> }

      Type parameters

      Type declaration

      Web3ContextObject

      Web3ContextObject<API, RegisteredSubs>: { accountProvider?: Web3AccountProvider<Web3BaseWalletAccount>; config: Web3ConfigOptions; provider?: SupportedProviders<API> | string; providers: typeof Web3RequestManager.providers; registeredSubscriptions?: RegisteredSubs; requestManager: Web3RequestManager<API>; subscriptionManager?: Web3SubscriptionManager<API, RegisteredSubs>; wallet?: Web3BaseWallet<Web3BaseWalletAccount> }

      Type parameters

      Type declaration

      Web3EventCallback

      Web3EventCallback<T>: (params: T) => void | Promise<void>

      Type parameters

      • T

      Type declaration

        • (params: T): void | Promise<void>
        • Parameters

          • params: T

          Returns void | Promise<void>

      Web3EventKey

      Web3EventKey<T>: string & keyof T

      Type parameters

      Web3EventMap

      Web3EventMap: Record<string, unknown>

      Web3SubscriptionConstructor

      Web3SubscriptionConstructor<API, SubscriptionType>: new (args: any, options: { returnFormat?: DataFormat; subscriptionManager: Web3SubscriptionManager<API> } | { requestManager: Web3RequestManager<API>; returnFormat?: DataFormat }) => SubscriptionType | new (args: any, options: { returnFormat?: DataFormat; subscriptionManager: Web3SubscriptionManager<API> }) => SubscriptionType | new (args: any, options: { requestManager: Web3RequestManager<API>; returnFormat?: DataFormat }) => SubscriptionType

      Type parameters

      Variables

      constDEFAULT_BATCH_REQUEST_TIMEOUT

      DEFAULT_BATCH_REQUEST_TIMEOUT: 1000 = 1000

      Functions

      isEIP1193Provider

      isLegacyRequestProvider

      isLegacySendAsyncProvider

      isLegacySendProvider

      isMetaMaskProvider

      isSupportSubscriptions

      isSupportedProvider

      isWeb3Provider