Optional
network: NetworkishOptional
_options: BrowserProviderOptionsGets the [[Network]] this provider has committed to. On each call, the network is detected, and if it has changed, the call will reject.
Returns true only if the [[_start]] has been called.
Returns this
, to allow an AbstractProvider to implement
the [[ContractRunner]] interface.
Returns all the registered plug-ins.
Prevent any CCIP-read operation, regardless of whether requested
in a [[call]] using enableCcipRead
.
If this provider has been destroyed using the [[destroy]] method.
Once destroyed, all resources are reclaimed, internal event loops and timers are cleaned up and no further requests may be sent to the provider.
Whether the provider is currently paused.
A paused provider will not emit any events, and generally should not make any requests to the network, but that is up to sub-classes to manage.
Setting paused = true
is identical to calling .pause(false)
,
which will buffer any events that occur while paused until the
provider is unpaused.
Requests the %%method%% with %%params%% via the JSON-RPC protocol over the underlying channel. This can be used to call methods on the backend that do not have a high-level API within the Provider API.
This method queues requests according to the batch constraints in the options, assigns the request a unique ID.
Do NOT override this method in sub-classes; instead override [[_send]] or force the options values in the call to the constructor to modify this method's behavior.
Returns an ethers-style Error for the given JSON-RPC error %%payload%%, coalescing the various strings and error shapes that different nodes return, coercing them into a machine-readable standardized error.
Resolves to the [[Signer]] account for %%address%% managed by the client.
If the %%address%% is a number, it is used as an index in the the accounts from [[listAccounts]].
This can only be used on clients which manage accounts (such as Geth with imported account or MetaMask).
Throws if the account doesn't exist.
Optional
address: string | numberProvides the opportunity for a sub-class to wrap a transaction receipt before returning it, to add additional properties or an alternate sub-class of [[TransactionReceipt]].
Provides the opportunity for a sub-class to wrap a transaction response before returning it, to add additional properties or an alternate sub-class of [[TransactionResponse]].
Returns or resolves to a filter for %%filter%%, resolving any ENS names or [[Addressable]] object and returning if already a valid filter.
Returns or resolves to a transaction for %%request%%, resolving any ENS names or [[Addressable]] and returning if already a valid transaction.
Get the account balance (in wei) of %%address%%. If %%blockTag%% is specified and the node supports archive access for that %%blockTag%%, the balance is as of that [[BlockTag]].
Optional
blockTag: BlockTagGet the number of transactions ever sent for %%address%%, which
is used as the nonce
when sending a transaction. If
%%blockTag%% is specified and the node supports archive access
for that %%blockTag%%, the transaction count is as of that
[[BlockTag]].
Optional
blockTag: BlockTagBroadcasts the %%signedTx%% to the network, adding it to the memory pool of any node for which the transaction meets the rebroadcast requirements.
Resolves to the block for %%blockHashOrBlockTag%%.
If %%prefetchTxs%%, and the backend supports including transactions with block requests, all transactions will be included and the [[Block]] object will not need to make remote calls for getting transactions.
Optional
prefetchTxs: booleanResolves to the transaction for %%hash%%.
If the transaction is unknown or on pruning nodes which
discard old transactions this resolves to null
.
Resolves to the transaction receipt for %%hash%%, if mined.
If the transaction has not been mined, is unknown or on
pruning nodes which discard old transactions this resolves to
null
.
Resolves to the ENS name associated for the %%address%% or
null
if the //primary name// is not configured.
Users must perform additional steps to configure a //primary name//, which is not currently common.
Create a timer that will execute %%func%% after at least %%timeout%% (in ms). If %%timeout%% is unspecified, then %%func%% will execute in the next event loop.
Pausing the provider will pause any associated timers.
Optional
timeout: numberIf a [[Subscriber]] fails and needs to replace itself, this method may be used.
For example, this is used for providers when using the
eth_getFilterChanges
method, which can return null if state
filters are not supported by the backend, allowing the Subscriber
to swap in a [[PollingEventSubscriber]].
Registers a %%listener%% that is called whenever the %%event%% occurs until unregistered.
Registers a %%listener%% that is called the next time %%event%% occurs.
Unregister the %%listener%% for %%event%%. If %%listener%% is unspecified, all listeners are unregistered.
Optional
listener: ListenerUnregister all listeners for %%event%%.
Optional
event: ProviderEventAlias for [[on]].
Alias for [[off]].
The polling interval (default: 4000 ms)