DedotClient

New promised-based API Client for Polkadot & Substrate based on JSON-RPC V2

Unstable, use with caution.

Type Parameters

Hierarchy

Constructors

Properties

_chainHead?: ChainHead
_chainSpec?: ChainSpec
_genesisHash?: `0x${string}`
_localCache?: IStorage
_metadata?: Metadata
_options: ApiOptions
_registry?: PortableRegistry
_runtimeUpgrading?: Deferred<void>
_runtimeVersion?: SubstrateRuntimeVersion
_txBroadcaster?: TxBroadcaster
rpcVersion: RpcVersion

Accessors

  • get rpc(): ChainApi[RpcVersion]["rpc"]
  • Returns ChainApi[RpcVersion]["rpc"]

    Entry-point for executing JSON-RPCs to blockchain node.

    const client = new JsonRpcClient('wss://rpc.polkadot.io');
    await client.connect();

    // Subscribe to new heads
    client.rpc.chain_subscribeNewHeads((header) => {
    console.log(header);
    });

    // Execute arbitrary rpc method: `module_rpc_name`
    const result = await client.rpc.module_rpc_name();

Methods

  • Returns void

  • Parameters

    Returns boolean

  • Parameters

    • event: ApiEvent
    • Optionalhandler: HandlerFn

    Returns this

  • Parameters

    Returns Unsub

  • Parameters

    Returns Unsub

  • Parameters

    • runtimeVersion: {
          apis: (readonly [`0x${string}`, number])[];
          authoringVersion: number;
          implName: string;
          implVersion: number;
          specName: string;
          specVersion: number;
          stateVersion: number;
          transactionVersion: number;
      }
      • apis: (readonly [`0x${string}`, number])[]
      • authoringVersion: number
      • implName: string
      • implVersion: number
      • specName: string
      • specVersion: number
      • stateVersion: number
      • transactionVersion: number

    Returns SubstrateRuntimeVersion