Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/smoldot2/internals/local-instance.d.ts>Instance

Lightweight client for Substrate-based chains, such as Polkadot and Kusama.
Go to Latest
interface Instance
import { type Instance } from "https://deno.land/x/smoldot2@light-js-deno-v2.0.4/internals/local-instance.d.ts";

Properties

request: (request: string, chainId: number) => number
peekJsonRpcResponse: (chainId: number) => string | null
addChain: (
chainSpec: string,
databaseContent: string,
potentialRelayChains: number[],
disableJsonRpc: boolean,
jsonRpcMaxPendingRequests: number,
jsonRpcMaxSubscriptions: number,
) => void
removeChain: (chainId: number) => void
shutdownExecutor: () => void

Notifies the background executor that it should stop. Once it has effectively stopped, a executor-shutdown event will be generated. Note that the instance can technically still be used, and all the functions still work, but in practice nothing is being run in the background and as such it won't do much. Existing connections are not closed. It is the responsibility of the API user to close all connections.

connectionOpened: (connectionId: number, info: { type: "single-stream"; handshake: "multistream-select-noise-yamux"; initialWritableBytes: number; } | { type: "multi-stream"; handshake: "webrtc"; localTlsCertificateSha256: Uint8Array; remoteTlsCertificateSha256: Uint8Array; }) => void
connectionReset: (connectionId: number, message: string) => void
streamWritableBytes: (
connectionId: number,
numExtra: number,
streamId?: number,
) => void
streamMessage: (
connectionId: number,
message: Uint8Array,
streamId?: number,
) => void
streamOpened: (
connectionId: number,
streamId: number,
direction: "inbound" | "outbound",
initialWritableBytes: number,
) => void
streamReset: (connectionId: number, streamId: number) => void