Skip to content

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

NameDescription
RpcTransport.fromHttpCreates a HTTP JSON-RPC Transport from a URL.

Errors

NameDescription
RpcTransport.HttpErrorThrown when a HTTP request fails.
RpcTransport.MalformedResponseErrorThrown when a HTTP response is malformed.

Types

NameDescription
RpcTransport.HttpHTTP-based RPC Transport.
RpcTransport.HttpOptions
RpcTransport.RequestFn
RpcTransport.RpcTransportRoot type for an RPC Transport.