core
Index
References
- Web3Context
- Web3EthPluginBase
- Web3PluginBase
- Web3PromiEvent
- inputAddressFormatter
- inputBlockNumberFormatter
- inputCallFormatter
- inputDefaultBlockNumberFormatter
- inputLogFormatter
- inputPostFormatter
- inputSignFormatter
- inputStorageKeysFormatter
- inputTopicFormatter
- inputTransactionFormatter
- outputBigIntegerFormatter
- outputBlockFormatter
- outputLogFormatter
- outputPostFormatter
- outputProofFormatter
- outputSyncingFormatter
- outputTransactionFormatter
- outputTransactionReceiptFormatter
- txInputOptionsFormatter
Namespaces
Enumerations
Classes
Interfaces
Type Aliases
Variables
Functions
References
Web3Context
Web3EthPluginBase
Web3PluginBase
Web3PromiEvent
inputAddressFormatter
inputBlockNumberFormatter
inputCallFormatter
inputDefaultBlockNumberFormatter
inputLogFormatter
inputPostFormatter
inputSignFormatter
inputStorageKeysFormatter
inputTopicFormatter
inputTransactionFormatter
outputBigIntegerFormatter
outputBlockFormatter
outputLogFormatter
outputPostFormatter
outputProofFormatter
outputSyncingFormatter
outputTransactionFormatter
outputTransactionReceiptFormatter
txInputOptionsFormatter
Namespaces
formatters
inputAddressFormatter
Parameters
address: string
Returns string
inputBlockNumberFormatter
Parameters
blockNumber: undefined | Numbers
Returns undefined | string
inputCallFormatter
Parameters
options: TransactionInput
optionaldefaultAccount: string
Returns Mutable<TransactionOutput>
inputDefaultBlockNumberFormatter
inputLogFormatter
inputPostFormatter
Parameters
post: PostOutput
Returns PostInput
inputSignFormatter
Parameters
data: string
Returns string
inputStorageKeysFormatter
Parameters
keys: string[]
Returns string[]
inputTopicFormatter
Parameters
topic: string
Returns null | string
inputTransactionFormatter
Parameters
options: TransactionInput
optionaldefaultAccount: string
Returns Mutable<TransactionOutput>
outputBigIntegerFormatter
Parameters
number: Numbers
Returns number | bigint
outputBlockFormatter
Parameters
block: BlockInput
Returns BlockOutput
outputLogFormatter
Parameters
log: Partial<LogsInput>
Returns LogsOutput
outputPostFormatter
Parameters
post: PostInput
Returns PostOutput
outputProofFormatter
outputSyncingFormatter
Parameters
result: SyncInput
Returns SyncOutput
outputTransactionFormatter
Parameters
tx: TransactionInput
Returns TransactionOutput
outputTransactionReceiptFormatter
Parameters
receipt: ReceiptInput
Returns ReceiptOutput
txInputOptionsFormatter
Parameters
options: TransactionInput
Returns Mutable<TransactionOutput>
Enumerations
Web3ConfigEvent
CONFIG_CHANGE
Web3RequestManagerEvent
BEFORE_PROVIDER_CHANGE
PROVIDER_CHANGED
Classes
Web3BatchRequest
constructor
Parameters
requestManager: Web3RequestManager<EthExecutionAPI>
Returns Web3BatchRequest
requests
Returns JsonRpcRequest<unknown[]>[]
add
Type parameters
- ResponseType = unknown
Parameters
request: JsonRpcOptionalRequest<unknown>
Returns Web3DeferredPromise<ResponseType>
execute
Parameters
optionaloptions: { timeout?: number }
optionaltimeout: number
Returns Promise<JsonRpcBatchResponse<unknown, unknown>>
abstractWeb3Config
constructor
Parameters
optionaloptions: Partial<Web3ConfigOptions>
Returns Web3Config
config
blockHeaderTimeout
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.Returns number
Will set the blockHeaderTimeout
Parameters
val: number
Returns void
contractDataInputFill
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
customTransactionSchema
Returns undefined | CustomTransactionSchema
Parameters
schema: undefined | CustomTransactionSchema
Returns void
defaultAccount
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
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
val: BlockNumberOrTag
Returns void
defaultChain
Returns string
Parameters
val: string
Returns void
defaultCommon
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
defaultHardfork
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
defaultNetworkId
defaultReturnFormat
Returns DataFormat
Parameters
val: DataFormat
Returns void
defaultTransactionType
enableExperimentalFeatures
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
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
ignoreGasPricing
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
Returns number
Parameters
val: number
Returns void
transactionBlockTimeout
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
transactionBuilder
Returns undefined | TransactionBuilder<unknown>
Parameters
val: undefined | TransactionBuilder<unknown>
Returns void
transactionConfirmationBlocks
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
Returns undefined | number
Parameters
val: undefined | number
Returns void
transactionPollingInterval
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
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
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
transactionSendTimeout
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
val: undefined | TransactionTypeParser
Returns void
emit
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
Returns (string | symbol)[]
getMaxListeners
Returns number
listenerCount
Type parameters
- K: CONFIG_CHANGE
Parameters
eventName: K
Returns number
listeners
Type parameters
- K: CONFIG_CHANGE
Parameters
eventName: K
Returns (...args: any[]) => void[]
off
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
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
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
Parameters
options: Partial<Web3ConfigOptions>
Returns void
setMaxListenerWarningThreshold
Parameters
maxListenersWarningThreshold: number
Returns void
Web3EventEmitter
Type parameters
- T: Web3EventMap
constructor
Type parameters
- T: Web3EventMap
Returns Web3EventEmitter<T>
emit
Type parameters
- K: string
Parameters
eventName: K
params: T[K]
Returns void
eventNames
Returns (string | symbol)[]
getMaxListeners
Returns number
listenerCount
Type parameters
- K: string
Parameters
eventName: K
Returns number
listeners
Type parameters
- K: string
Parameters
eventName: K
Returns (...args: any[]) => void[]
off
Type parameters
- K: string
Parameters
eventName: K
fn: Web3EventCallback<T[K]>
Returns void
on
Type parameters
- K: string
Parameters
eventName: K
fn: Web3EventCallback<T[K]>
Returns void
once
Type parameters
- K: string
Parameters
eventName: K
fn: Web3EventCallback<T[K]>
Returns void
removeAllListeners
Returns EventEmitter
setMaxListenerWarningThreshold
Parameters
maxListenersWarningThreshold: number
Returns void
Web3RequestManager
Type parameters
- API: Web3APISpec = EthExecutionAPI
constructor
Type parameters
- API: unknown = EthExecutionAPI
Parameters
optionalprovider: string | SupportedProviders<API>
optionaluseRpcCallSpecification: boolean
optionalrequestManagerMiddleware: RequestManagerMiddleware<API>
Returns Web3RequestManager<API>
optionalmiddleware
provider
Will return the current provider.
Returns undefined | SupportedProviders<API>
Returns the current provider
providers
Will return all available providers
Returns { HttpProvider: Web3BaseProviderConstructor; WebsocketProvider: Web3BaseProviderConstructor }
HttpProvider: Web3BaseProviderConstructor
WebsocketProvider: Web3BaseProviderConstructor
staticproviders
Will return all available providers
Returns { HttpProvider: Web3BaseProviderConstructor; WebsocketProvider: Web3BaseProviderConstructor }
HttpProvider: Web3BaseProviderConstructor
WebsocketProvider: Web3BaseProviderConstructor
emit
Type parameters
- K: Web3EventKey<{ BEFORE_PROVIDER_CHANGE: undefined | SupportedProviders<API>; PROVIDER_CHANGED: undefined | SupportedProviders<API> }>
Parameters
eventName: K
params: { BEFORE_PROVIDER_CHANGE: undefined | SupportedProviders<API>; PROVIDER_CHANGED: undefined | SupportedProviders<API> }[K]
Returns void
eventNames
Returns (string | symbol)[]
getMaxListeners
Returns number
listenerCount
Type parameters
- K: Web3EventKey<{ BEFORE_PROVIDER_CHANGE: undefined | SupportedProviders<API>; PROVIDER_CHANGED: undefined | SupportedProviders<API> }>
Parameters
eventName: K
Returns number
listeners
Type parameters
- K: Web3EventKey<{ BEFORE_PROVIDER_CHANGE: undefined | SupportedProviders<API>; PROVIDER_CHANGED: undefined | SupportedProviders<API> }>
Parameters
eventName: K
Returns (...args: any[]) => void[]
off
Type parameters
- K: Web3EventKey<{ BEFORE_PROVIDER_CHANGE: undefined | SupportedProviders<API>; PROVIDER_CHANGED: undefined | SupportedProviders<API> }>
Parameters
eventName: K
fn: Web3EventCallback<{ BEFORE_PROVIDER_CHANGE: undefined | SupportedProviders<API>; PROVIDER_CHANGED: undefined | SupportedProviders<API> }[K]>
Returns void
on
Type parameters
- K: Web3EventKey<{ BEFORE_PROVIDER_CHANGE: undefined | SupportedProviders<API>; PROVIDER_CHANGED: undefined | SupportedProviders<API> }>
Parameters
eventName: K
fn: Web3EventCallback<{ BEFORE_PROVIDER_CHANGE: undefined | SupportedProviders<API>; PROVIDER_CHANGED: undefined | SupportedProviders<API> }[K]>
Returns void
once
Type parameters
- K: Web3EventKey<{ BEFORE_PROVIDER_CHANGE: undefined | SupportedProviders<API>; PROVIDER_CHANGED: undefined | SupportedProviders<API> }>
Parameters
eventName: K
fn: Web3EventCallback<{ BEFORE_PROVIDER_CHANGE: undefined | SupportedProviders<API>; PROVIDER_CHANGED: undefined | SupportedProviders<API> }[K]>
Returns void
removeAllListeners
Returns EventEmitter
send
Will execute a request
Type parameters
- Method: string
- ResponseType = Web3APIReturnType<API, Method>
Parameters
request: Web3APIRequest<API, Method>
Web3APIRequest The request to send
Returns Promise<ResponseType>
The response of the request ResponseType. If there is error in the response, will throw an error
sendBatch
Same as send, but, will execute a batch of requests
Parameters
request: JsonRpcBatchRequest
JsonRpcBatchRequest The batch request to send
Returns Promise<JsonRpcBatchResponse<unknown, JsonRpcResult>>
setMaxListenerWarningThreshold
Parameters
maxListenersWarningThreshold: number
Returns void
setMiddleware
Parameters
requestManagerMiddleware: RequestManagerMiddleware<API>
Returns void
setProvider
Use to set provider. Provider can be a provider instance or a string.
Parameters
optionalprovider: string | SupportedProviders<API>
The provider to set
Returns boolean
abstractWeb3Subscription
Type parameters
- EventMap: Web3EventMap
- ArgsType = any
- API: Web3APISpec = EthExecutionAPI
- CombinedEventMap: CommonSubscriptionEvents = EventMap & CommonSubscriptionEvents
constructor
Type parameters
- EventMap: Web3EventMap
- ArgsType = any
- API: unknown = EthExecutionAPI
- CombinedEventMap: CommonSubscriptionEvents = EventMap & CommonSubscriptionEvents
Parameters
args: ArgsType
options: { returnFormat?: DataFormat; subscriptionManager: Web3SubscriptionManager<unknown, {}> }
optionalreturnFormat: DataFormat
subscriptionManager: Web3SubscriptionManager<unknown, {}>
Returns Web3Subscription<EventMap, ArgsType, API, CombinedEventMap>
readonlyargs
id
Returns undefined | string
lastBlock
Returns undefined | BlockOutput
_processSubscriptionError
Parameters
error: Error
Returns void
_processSubscriptionResult
Parameters
data: unknown
Returns void
emit
Type parameters
- K: string
Parameters
eventName: K
params: CombinedEventMap[K]
Returns void
eventNames
Returns (string | symbol)[]
getMaxListeners
Returns number
listenerCount
Type parameters
- K: string
Parameters
eventName: K
Returns number
listeners
Type parameters
- K: string
Parameters
eventName: K
Returns (...args: any[]) => void[]
off
Type parameters
- K: string
Parameters
eventName: K
fn: Web3EventCallback<CombinedEventMap[K]>
Returns void
on
Type parameters
- K: string
Parameters
eventName: K
fn: Web3EventCallback<CombinedEventMap[K]>
Returns void
once
Type parameters
- K: string
Parameters
eventName: K
fn: Web3EventCallback<CombinedEventMap[K]>
Returns void
processSubscriptionData
Parameters
Returns void
removeAllListeners
Returns EventEmitter
resubscribe
Returns Promise<void>
sendSubscriptionRequest
Returns Promise<string>
sendUnsubscribeRequest
Returns Promise<void>
setMaxListenerWarningThreshold
Parameters
maxListenersWarningThreshold: number
Returns void
subscribe
Returns Promise<string>
unsubscribe
Returns Promise<void>
Web3SubscriptionManager
Type parameters
- API: Web3APISpec = Web3APISpec
- RegisteredSubs: {} = {}
constructor
Type parameters
- API: unknown = unknown
- RegisteredSubs: {} = {}
Parameters
requestManager: Web3RequestManager<API>
registeredSubscriptions: RegisteredSubs
Returns Web3SubscriptionManager<API, RegisteredSubs>
readonlyregisteredSubscriptions
readonlyrequestManager
subscriptions
Will returns all subscriptions.
Returns Map<string, InstanceType<RegisteredSubs[keyof RegisteredSubs]>>
addSubscription
Adds an instance of Web3Subscription and subscribes to it
Parameters
sub: InstanceType<RegisteredSubs[keyof RegisteredSubs]>
A Web3Subscription object
Returns Promise<string>
clear
Clears all subscriptions
Returns void
removeSubscription
Will clear a subscription
Parameters
sub: InstanceType<RegisteredSubs[keyof RegisteredSubs]>
Returns Promise<string>
subscribe
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
Check whether the current provider supports subscriptions.
Returns boolean
true
orfalse
depending on if the current provider supports subscriptions
unsubscribe
Will unsubscribe all subscriptions that fulfill the condition
Parameters
optionalcondition: ShouldUnsubscribeCondition
A function that access and
id
and asubscription
and returntrue
orfalse
Returns Promise<string[]>
An array of all the un-subscribed subscriptions
Interfaces
ExtensionObject
methods
optionalproperty
Method
call
name
RequestManagerMiddleware
Type parameters
- API
processRequest
Type parameters
- ParamType = unknown[]
Parameters
request: JsonRpcPayload<ParamType>
optionaloptions: {}
Returns Promise<JsonRpcPayload<ParamType>>
processResponse
Type parameters
- AnotherMethod: string
- ResponseType = Web3APIReturnType<API, AnotherMethod>
Parameters
response: JsonRpcResponse<ResponseType, JsonRpcResult>
optionaloptions: {}
Returns Promise<JsonRpcResponse<ResponseType, JsonRpcResult>>
Web3ConfigOptions
blockHeaderTimeout
contractDataInputFill
optionalcustomTransactionSchema
optionaldefaultAccount
defaultBlock
defaultChain
optionaldefaultCommon
defaultHardfork
defaultMaxPriorityFeePerGas
optionaldefaultNetworkId
defaultReturnFormat
defaultTransactionType
enableExperimentalFeatures
Type declaration
useRpcCallSpecification: boolean
useSubscriptionWhenCheckingBlockTimeout: boolean
handleRevert
ignoreGasPricing
maxListenersWarningThreshold
transactionBlockTimeout
optionaltransactionBuilder
transactionConfirmationBlocks
optionaltransactionConfirmationPollingInterval
transactionPollingInterval
transactionPollingTimeout
optionaltransactionReceiptPollingInterval
transactionSendTimeout
optionaltransactionTypeParser
Web3Emitter
Type parameters
- T: Web3EventMap
emit
Type parameters
- K: string
Parameters
eventName: K
params: T[K]
Returns void
off
Type parameters
- K: string
Parameters
eventName: K
fn: Web3EventCallback<T[K]>
Returns void
on
Type parameters
- K: string
Parameters
eventName: K
fn: Web3EventCallback<T[K]>
Returns void
once
Type parameters
- K: string
Parameters
eventName: K
fn: Web3EventCallback<T[K]>
Returns void
Type Aliases
CustomTransactionSchema
Type declaration
properties: Record<string, Schema>
type: string
PromiseExecutor
Type parameters
- T
Type declaration
Parameters
resolve: (data: T) => void
reject: (reason: unknown) => void
Returns void
TransactionBuilder
Type parameters
- API: Web3APISpec = unknown
Type declaration
Type parameters
- ReturnType = Transaction
Parameters
options: { fillGasPrice?: boolean; privateKey?: HexString | Uint8Array; transaction: Transaction; web3Context: Web3Context<API> }
optionalfillGasPrice: boolean
optionalprivateKey: HexString | Uint8Array
transaction: Transaction
web3Context: Web3Context<API>
Returns Promise<ReturnType>
TransactionTypeParser
Type declaration
Parameters
transaction: Transaction
Returns HexString | undefined
Web3ContextConstructor
Type parameters
- T: Web3Context
- T2: unknown[]
Type declaration
Parameters
rest...args: [extras: T2, context: Web3ContextObject]
Returns T
Web3ContextFactory
Type parameters
- T: Web3Context
- T2: unknown[]
Web3ContextInitOptions
Type parameters
- API: Web3APISpec = unknown
- RegisteredSubs: {} = any
Type declaration
optionalaccountProvider?: Web3AccountProvider<Web3BaseWalletAccount>
optionalconfig?: Partial<Web3ConfigOptions>
optionalprovider?: SupportedProviders<API> | string
optionalregisteredSubscriptions?: RegisteredSubs
optionalrequestManager?: Web3RequestManager<API>
optionalrequestManagerMiddleware?: RequestManagerMiddleware<API>
optionalsubscriptionManager?: Web3SubscriptionManager<API, RegisteredSubs>
optionalwallet?: Web3BaseWallet<Web3BaseWalletAccount>
Web3ContextObject
Type parameters
- API: Web3APISpec = unknown
- RegisteredSubs: {} = any
Type declaration
optionalaccountProvider?: Web3AccountProvider<Web3BaseWalletAccount>
config: Web3ConfigOptions
optionalprovider?: SupportedProviders<API> | string
providers: typeof Web3RequestManager.providers
optionalregisteredSubscriptions?: RegisteredSubs
requestManager: Web3RequestManager<API>
optionalsubscriptionManager?: Web3SubscriptionManager<API, RegisteredSubs>
optionalwallet?: Web3BaseWallet<Web3BaseWalletAccount>
Web3EventCallback
Type parameters
- T
Type declaration
Parameters
params: T
Returns void | Promise<void>
Web3EventKey
Type parameters
- T: Web3EventMap
Web3EventMap
Web3SubscriptionConstructor
Type parameters
- API: Web3APISpec
- SubscriptionType: Web3Subscription<any, any, API> = Web3Subscription<any, any, API>
Variables
constDEFAULT_BATCH_REQUEST_TIMEOUT
Functions
isEIP1193Provider
Type parameters
- API: unknown
Parameters
provider: SupportedProviders<API>
Returns provider is EIP1193Provider<API>
isLegacyRequestProvider
Type parameters
- API: unknown
Parameters
provider: SupportedProviders<API>
Returns provider is LegacyRequestProvider
isLegacySendAsyncProvider
Type parameters
- API: unknown
Parameters
provider: SupportedProviders<API>
Returns provider is LegacySendAsyncProvider
isLegacySendProvider
Type parameters
- API: unknown
Parameters
provider: SupportedProviders<API>
Returns provider is LegacySendProvider
isMetaMaskProvider
Type parameters
- API: unknown
Parameters
provider: SupportedProviders<API>
Returns provider is MetaMaskProvider<API>
isSupportSubscriptions
Type parameters
- API: unknown
Parameters
provider: SupportedProviders<API>
Returns boolean
isSupportedProvider
Type parameters
- API: unknown
Parameters
provider: SupportedProviders<API>
Returns provider is SupportedProviders<API>
isWeb3Provider
Type parameters
- API: unknown
Parameters
provider: SupportedProviders<API>
Returns provider is Web3BaseProvider<API>
Export all packages grouped by name spaces