Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

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

Alternative client for Substrate-based chains.
Go to Latest
interface Instance
import { type Instance } from "https://deno.land/x/smoldot2@light-js-deno-v1.0.6/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,
) => void
removeChain: (chainId: number) => void
shutdownExecutor: () => void

Notifies the background executor that it should stop. Once it has effectively stopped, a shutdown-finished 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; writeClosable: boolean; } | { type: "multi-stream"; handshake: "webrtc"; localTlsCertificateMultihash: Uint8Array; remoteTlsCertificateMultihash: 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