Skip to main content
Module

x/smoldot2/instance/raw-instance.d.ts>PlatformBindings

Alternative client for Substrate-based chains.
Go to Latest
interface PlatformBindings
import { type PlatformBindings } from "https://deno.land/x/smoldot2@light-js-deno-v1.0.1/instance/raw-instance.d.ts";

Contains functions that the client will use when it needs to leverage the platform.

Properties

trustedBase64DecodeAndZlibInflate: (input: string) => Promise<Uint8Array>

Base64-decode the given buffer then decompress its content using the inflate algorithm with zlib header.

The input is considered trusted. In other words, the implementation doesn't have to resist malicious input.

This function is asynchronous because implementations might use the compression streams Web API, which for whatever reason is asynchronous.

performanceNow: () => number

Returns the number of milliseconds since an arbitrary epoch.

getRandomValues: (buffer: Uint8Array) => void

Fills the given buffer with randomly-generated bytes.

registerShouldPeriodicallyYield: (callback: (newValue: boolean) => void) => [boolean, () => void]

The "should periodically yield" setting indicates whether the execution should periodically yield back control by using setTimeout(..., 0).

On platforms such as browsers where setTimeout(..., 0) takes way more than 0 milliseconds, this setting should be set to false.

This function registers a callback that is called when the setting should be updated with a new value. It returns the initial value of the setting and a function used to unregister the callback.

Methods

connect(config: ConnectionConfig): Connection

Tries to open a new connection using the given configuration.