Skip to main content
Module

x/smoldot2/client.d.ts>Client

Alternative client for Substrate-based chains.
Go to Latest
interface Client
import { type Client } from "https://deno.land/x/smoldot2@light-js-deno-v0.7.10/client.d.ts";

Client with zero or more active connections to blockchains.

Methods

addChain(options: AddChainOptions): Promise<Chain>

Connects to a chain.

Throws an exception if the chain specification isn't valid, or if the chain specification concerns a parachain but no corresponding relay chain can be found.

Smoldot will automatically de-duplicate chains if multiple identical chains are added, in order to save resources. In other words, it is not a problem to call addChain multiple times with the same chain specifications and obtain multiple Chain. When the same client is used for multiple different purposes, you are in fact strongly encouraged to trust smoldot and not attempt to de-duplicate chains yourself, as determining whether two chains are identical is complicated and might have security implications.

Smoldot tries to distribute CPU resources equally between all active Chain objects.

terminate(): Promise<void>

Terminates the client.

Afterwards, trying to use the client or any of its chains again will lead to an exception being thrown.