Lumina node wasm
A compatibility layer for the Lumina
node to
work within a browser environment and be operable with javascript.
Example
Starting lumina inside a dedicated worker
import from "lumina-node";
const node = await ;
const mainnetConfig = ;
await node.;
await node.;
await node.;
Manual setup
Note that spawnNode
implicitly calls wasm initialisation code. If you want to set things up manually, make sure to call the default export before using any of the wasm functionality.
import init from "lumina-node";
await ;
const config = ;
// client and worker accept any object with MessagePort like interface e.g. Worker
const channel = ;
const worker = ;
// note that this runs lumina in the current context (and doesn't create a new web-worker). Promise created with `.run()` never completes.
const worker_promise = worker.;
// client port can be used locally or transferred like any plain MessagePort
const client = await ;
await client.;
await client.;