interface JsonRpcProvider {
    status: ConnectionStatus;
    connect(): Promise<JsonRpcProvider>;
    disconnect(): Promise<void>;
    off(event: ProviderEvent, handler?: HandlerFn): this;
    on(event: ProviderEvent, handler: HandlerFn): Unsub;
    once(event: ProviderEvent, handler: HandlerFn): Unsub;
    send<T>(method: string, params: any[]): Promise<T>;
    subscribe<T>(input: JsonRpcSubscriptionInput, callback: JsonRpcSubscriptionCallback<T>): Promise<JsonRpcSubscription>;
}

Hierarchy (view full)

Properties

The current connection status

Methods

  • Disconnect from the provider

    Returns Promise<void>

  • Parameters

    Returns this

  • Parameters

    Returns Unsub

  • Parameters

    Returns Unsub

  • Send a JSON-RPC request, make sure to connect to the provider first before sending requests

    Type Parameters

    • T = any

    Parameters

    • method: string
    • params: any[]

    Returns Promise<T>