RpcTransport.fromHttp
Creates a HTTP JSON-RPC Transport from a URL.
Imports
Named
import { RpcTransport } from 'ox'Examples
import { RpcTransport } from 'ox'
const transport = RpcTransport.fromHttp('https://1.rpc.thirdweb.com')
const blockNumber = await transport.request({ method: 'eth_blockNumber' })
'0x1a2b3c'Definition
function fromHttp<raw, schema>(
url: string,
options?: fromHttp.Options<raw, schema>,
): Http<raw, schema>Source: src/core/RpcTransport.ts
Parameters
url
- Type:
string
URL to perform the JSON-RPC requests to.
options
- Type:
fromHttp.Options<raw, schema> - Optional
Transport options.
options.fetchFn
- Type:
{ (input: RequestInfo | URL, init?: RequestInit): Promise; } - Optional
Function to use to make the request.
options.fetchOptions
- Type:
Omit) - Optional
Request configuration to pass to fetch.
options.timeout
- Type:
number - Optional
Timeout for the request in milliseconds.
Return Type
HTTP JSON-RPC Transport.
Http<raw, schema>

