paritytech / substrate-connect

Run Wasm Light Clients of any Substrate based chain directly in your browser.
https://paritytech.github.io/substrate-connect/
GNU General Public License v3.0
233 stars 80 forks source link

Document Polkadot JS API support with latest `@substrate/connect` version #2386

Open rossbulat opened 1 month ago

rossbulat commented 1 month ago

Is your feature request related to a problem? Please describe.

Using Polkadot JS API is no longer documented in the NPM docs or readme of the @substrate/connect package. This is throwing devs off & consuming time to find fixes. Substate.io is also hosting stale documentation with incorrect examples.

Describe the solution you'd like

Request 1: Add an example to @substrate/connect on connecting to a well known chain.

import { ScProvider } from '@polkadot/rpc-provider/substrate-connect';
import * as Sc from '@substrate/connect';

const provider = new ScProvider(Sc, Sc.WellKnownChain.polkadot);
await provider.connect();

Request 2: Add an addChain example for ScProvider - how do we connect to a system or parachain - just instantiate more ScProviders?

Request 3: Update https://docs.substrate.io/learn/light-clients-in-substrate-connect/ to the latest API - the imports and code examples are currently inconsistent with the latest versions of @substrate/connect and @polkadot/rpc-provider. This doc was last updated in October 2023 - needs to be updated.

Describe alternatives you've considered

Outdated docs and lack of examples.

Additional context

No response

ryanleecode commented 1 month ago

Makes sense. Will get this done

ryanleecode commented 1 month ago

request 1 & 2 are merged.