providers
Index
Namespaces
Enumerations
Classes
Interfaces
Type Aliases
Variables
Functions
Namespaces
http
HttpProvider
default
HttpProviderOptions
providerOptions
ws
WebSocketProvider
default
Enumerations
Eip6963EventName
eip6963announceProvider
eip6963requestProvider
Classes
abstractEip1193Provider
Type parameters
- API: Web3APISpec = EthExecutionAPI
constructor
Type parameters
- API: unknown = EthExecutionAPI
Returns Eip1193Provider<API>
[symbol]
Returns boolean
asEIP1193Provider
Modify the return type of the request method to be fully compatible with EIP-1193
[deprecated] In the future major releases (>= v5) all providers are supposed to be fully compatible with EIP-1193. So this method will not be needed and would not be available in the future.
Returns Eip1193Compatible<API>
A new instance of the provider with the request method fully compatible with EIP-1193
abstractconnect
Returns void
abstractdisconnect
Parameters
optionalcode: number
optionaldata: string
Returns void
abstractgetStatus
Returns Web3ProviderStatus
abstracton
Parameters
type: disconnect
listener: Web3Eip1193ProviderEventCallback<ProviderRpcError>
Returns void
abstractonce
Parameters
type: disconnect
listener: Web3Eip1193ProviderEventCallback<ProviderRpcError>
Returns void
optionalabstractremoveAllListeners
Parameters
type: string
Returns void
abstractremoveListener
Parameters
type: disconnect
listener: Web3Eip1193ProviderEventCallback<ProviderRpcError>
Returns void
abstractrequest
Type parameters
- Method: string
- ResultType = unknown
Parameters
args: Web3APIPayload<API, Method>
Returns Promise<JsonRpcResponseWithResult<ResultType>>
abstractreset
Returns void
send
Type parameters
- ResultType = JsonRpcResult
- P = unknown
Parameters
payload: JsonRpcPayload<P>
Request Payload
callback: (err: null | Error, response?: JsonRpcResponse<ResultType, JsonRpcResult>) => void
Callback
Returns void
sendAsync
Type parameters
- R = JsonRpcResult
- P = unknown
Parameters
payload: JsonRpcPayload<P>
Request Payload
Returns Promise<JsonRpcResponse<R, JsonRpcResult>>
abstractsupportsSubscriptions
Returns boolean
staticisWeb3Provider
Parameters
provider: unknown
Returns boolean
abstractSocketProvider
This is an abstract class, which extends Web3BaseProvider class. This class is used to implement a provider that adheres to the EIP-1193 standard for Ethereum providers.
Type parameters
- MessageEvent
- CloseEvent
- ErrorEvent
- API: Web3APISpec = EthExecutionAPI
constructor
This is an abstract class for implementing a socket provider (e.g. WebSocket, IPC). It extends the EIP-1193 provider EIP1193Provider.
Type parameters
- MessageEvent
- CloseEvent
- ErrorEvent
- API: unknown = EthExecutionAPI
Parameters
socketPath: string
The path to the socket (e.g. /ipc/path or ws://localhost:8546)
optionalsocketOptions: unknown
The options for the socket connection. Its type is supposed to be specified in the inherited classes.
optionalreconnectOptions: Partial<ReconnectOptions>
The options for the socket reconnection ReconnectOptions
Returns SocketProvider<MessageEvent, CloseEvent, ErrorEvent, API>
SocketConnection
Returns unknown
[symbol]
Returns boolean
asEIP1193Provider
Modify the return type of the request method to be fully compatible with EIP-1193
[deprecated] In the future major releases (>= v5) all providers are supposed to be fully compatible with EIP-1193. So this method will not be needed and would not be available in the future.
Returns Eip1193Compatible<API>
A new instance of the provider with the request method fully compatible with EIP-1193
clearQueues
Parameters
optionalevent: ConnectionEvent
Returns void
connect
Try to establish a connection to the socket
Returns void
disconnect
Disconnects the socket
Parameters
optionalcode: number
The code to be sent to the server
optionaldata: string
The data to be sent to the server
Returns void
getPendingRequestQueueSize
Returns number
the pendingRequestQueue size
getSentRequestsQueueSize
Returns number
the sendPendingRequests size
abstractgetStatus
Returns Web3ProviderStatus
on
Registers a listener for the specified event type.
Parameters
type: disconnect
The event type to listen for
listener: Web3Eip1193ProviderEventCallback<ProviderRpcError>
The callback to be invoked when the event is emitted
Returns void
once
Registers a listener for the specified event type that will be invoked at most once.
Parameters
type: disconnect
The event type to listen for
listener: Web3Eip1193ProviderEventCallback<ProviderRpcError>
The callback to be invoked when the event is emitted
Returns void
removeAllListeners
Removes all listeners for the specified event type.
Parameters
type: string
The event type to remove the listeners for
Returns void
removeListener
Removes a listener for the specified event type.
Parameters
type: disconnect
The event type to remove the listener for
listener: Web3Eip1193ProviderEventCallback<ProviderRpcError>
The callback to be executed
Returns void
request
Creates a request object to be sent to the server
Type parameters
- Method: string
- ResultType = Web3APIReturnType<API, Method>
Parameters
request: Web3APIPayload<API, Method>
Returns Promise<JsonRpcResponseWithResult<ResultType>>
reset
Resets the socket, removing all listeners and pending requests
Returns void
safeDisconnect
Safely disconnects the socket, async and waits for request size to be 0 before disconnecting
Parameters
optionalcode: number
The code to be sent to the server
optionaldata: string
The data to be sent to the server
optionalforceDisconnect: boolean
If true, will clear queue after 5 attempts of waiting for both pending and sent queue to be 0
optionalms: number
Determines the ms of setInterval
Returns Promise<void>
send
Type parameters
- ResultType = JsonRpcResult
- P = unknown
Parameters
payload: JsonRpcPayload<P>
Request Payload
callback: (err: null | Error, response?: JsonRpcResponse<ResultType, JsonRpcResult>) => void
Callback
Returns void
sendAsync
Type parameters
- R = JsonRpcResult
- P = unknown
Parameters
payload: JsonRpcPayload<P>
Request Payload
Returns Promise<JsonRpcResponse<R, JsonRpcResult>>
supportsSubscriptions
Returns boolean
true
if the socket supports subscriptions
staticisWeb3Provider
Parameters
provider: unknown
Returns boolean
Interfaces
EIP6963AnnounceProviderEvent
Type parameters
- API = Web3APISpec
detail
type
EIP6963ProviderDetail
Type parameters
- API = Web3APISpec
info
provider
EIP6963ProviderInfo
icon
name
rdns
uuid
EIP6963ProvidersMapUpdateEvent
detail
type
EIP6963RequestProviderEvent
type
Type Aliases
EIP6963ProviderResponse
Variables
consteip6963ProvidersMap
constweb3ProvidersMapUpdated
Functions
onNewProviderDiscovered
Parameters
callback: (providerEvent: EIP6963ProvidersMapUpdateEvent) => void
Returns void
requestEIP6963Providers
Returns Promise<EIP6963ProviderResponse>
This is an abstract class, which extends Web3BaseProvider class. This class is used to implement a provider that adheres to the EIP-1193 standard for Ethereum providers.