RpcTransport
Utility functions for working with JSON-RPC Transports.
Examples
HTTP Instantiation
import { RpcTransport } from 'ox'
const transport = RpcTransport.fromHttp('https://1.rpc.thirdweb.com')
const blockNumber = await transport.request({ method: 'eth_blockNumber' })
'0x1a2b3c'
Functions
Name | Description |
---|---|
RpcTransport.fromHttp | Creates a HTTP JSON-RPC Transport from a URL. |
Errors
Name | Description |
---|---|
RpcTransport.HttpError | Thrown when a HTTP request fails. |
RpcTransport.MalformedResponseError | Thrown when a HTTP response is malformed. |
Types
Name | Description |
---|---|
RpcTransport.Http | HTTP-based RPC Transport. |
RpcTransport.HttpOptions | |
RpcTransport.RequestFn | |
RpcTransport.RpcTransport | Root type for an RPC Transport. |