Class JsonRpcGroup<Event>

Type Parameters

  • Event extends string = string

Hierarchy (view full)

Constructors

Properties

Accessors

Methods

Constructors

Properties

Accessors

  • get prefix(): string
  • The prefix of the group

    Returns string

Methods

  • Returns void

  • Parameters

    • event: Event
    • Rest...args: any[]

    Returns boolean

  • Parameters

    • event: Event
    • Optionalhandler: HandlerFn

    Returns this

  • Parameters

    • event: Event
    • handler: HandlerFn

    Returns Unsub

  • Parameters

    • event: Event
    • handler: HandlerFn

    Returns Unsub

  • Send a json-rpc request, note the method should not contain the prefix and version parts.

    Type Parameters

    • T = any

    Parameters

    • method: string
    • Rest...params: any[]

    Returns Promise<T>

    const client = await JsonRpcClient.new('wss://rpc.polkadot.io');
    const achieve = new JsonRpcGroup(client, { prefix: 'archive', supportedVersions: ['unstable'] });

    const finalizedHeight = await achieve.send<number>('finalizedHeight'); // sending archive_unstable_finalizedHeight
    console.log(finalizedHeight);
  • Check if the group is supported by the connected JSON-RPC server.

    Returns Promise<boolean>

  • Detect & return the version of the group. This will be used to construct the json-rpc method name.

    Returns Promise<JsonRpcGroupVersion>