getRpcClient
Returns an RPC request that can be used to make JSON-RPC requests.
import { createThirdwebClient } from "thirdweb";import { getRpcClient } from "thirdweb/rpc";import { ethereum } from "thirdweb/chains";const client = createThirdwebClient({ clientId: "..." });const rpcRequest = getRpcClient({ client, chain: ethereum });const blockNumber = await rpcRequest({ method: "eth_blockNumber",});
function getRpcClient( options: Readonly<{ chain: { readonly blockExplorers?: Array<{ apiUrl?: string; name: string; url: string; }>; readonly experimental?: { increaseZeroByteCount?: boolean }; readonly faucets?: Array<string>; readonly icon?: Icon; readonly id: number; readonly name?: string; readonly nativeCurrency?: { decimals?: number; name?: string; symbol?: string; }; readonly rpc: string; readonly testnet?: true; }; config?: { batchTimeoutMs?: number; maxBatchSize?: number; requestTimeoutMs?: number; }; }>,): EIP1193RequestFn<EIP1474Methods>;
The RPC options.
let options: Readonly<{ chain: { readonly blockExplorers?: Array<{ apiUrl?: string; name: string; url: string; }>; readonly experimental?: { increaseZeroByteCount?: boolean }; readonly faucets?: Array<string>; readonly icon?: Icon; readonly id: number; readonly name?: string; readonly nativeCurrency?: { decimals?: number; name?: string; symbol?: string; }; readonly rpc: string; readonly testnet?: true; }; config?: { batchTimeoutMs?: number; maxBatchSize?: number; requestTimeoutMs?: number; };}>;