Polkadot JS Provider for Smoldot Light Client
This is a prototype for using @polkadot/api
with the smoldot WASM light client either by
passing chainspecs or using the extension by predefined chains (e.g. westend, kusama).
Detector check existence of substrate extension. If it is installed and activated then
smoldot clients of extension will be used. If not, a new smoldot client will start and
sync with given chainspecs.
Usage
Provide a known Chain Name ('kusama', 'polkadot', 'westend'):
import { Detector } from '@substrate/connect';
const detect = new Detector('my cool unstoppable app');
const api = await detect.connect('westend');
or provide your custom substrate chain's name and chainspec:
import { Detector } from '@substrate/connect';
import mySubstrateChainSpec from './mySubstrateChainSpec.json';
const chainSpec = JSON.stringify(mySubstrateChainSpec);
const detect = new Detector('my cool unstoppable app');
const api = await detect.connect('mySubstrateChainName', chainSpec());
Scripts
yarn test
to run the unit testsyarn build
to build @substrate-connectyarn lint
to run linter for @substrate-connect