JSON RPC Provider Implementation

JSONRpcProviderConfig Interface

The JSONRpcProviderConfig interface defines the complete set of options accepted by the JSONRpcProvider constructor. Only url and network are required; all other fields are optional and fall back to default values when omitted.

typescript
JSONRpcProviderConfig Interface Definition
export interface JSONRpcProviderConfig {
    readonly url: string;
    readonly network: Network;
    readonly timeout?: number;
    readonly fetcherConfigurations?: Agent.Options;
    readonly useThreadedParsing?: boolean;
    readonly useThreadedHttp?: boolean;
}

Reference

url
network
timeout
fetcherConfigurations
useThreadedParsing
useThreadedHttp

JSONRpcProvider Class

The JSONRpcProvider class extends AbstractRpcProvider to provide HTTP-based JSON-RPC communication with OP_NET nodes.

typescript
JSONRpcProvider Class Definition - Simplified
export class JSONRpcProvider extends AbstractRpcProvider {
    public readonly url: string;

    constructor(config: JSONRpcProviderConfig);

    public async close(): Promise<void>;
    public async _send(payload: JsonRpcPayload | JsonRpcPayload[]): Promise<JsonRpcCallResult>;
}

Reference

constructor
url
close
_send