Skip to content

Commit ec6ca17

Browse files
committed
Fix substrate-connect documentation
1 parent 47477eb commit ec6ca17

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

content/md/en/docs/learn/light-clients-in-substrate-connect.md

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,30 @@ To add `substrate-connect` to your application:
9393
npm i @polkadot/api
9494
```
9595

96+
1. Finally install `@substrate/connect` package by running the appropriate command for the package manager you use.
97+
98+
For example, if you use `yarn`, run the following command:
99+
100+
```bash
101+
yarn add @substrate/connect
102+
```
103+
104+
If you use `npm` as your package manager, run the following command:
105+
106+
```bash
107+
npm i @substrate/connect
108+
```
109+
96110
### Use the RPC provider to connect to a well-known network
97111

98112
The following example illustrates how you can use the `rpc-provider` to connect to a well-known network such as Polkadot, Kusama, Westend, or Rococo.
99113

100114
```js
101115
import { ScProvider, WellKnownChain } from "@polkadot/rpc-provider/substrate-connect";
116+
import * as Sc from "@substrate/connect";
102117
import { ApiPromise } from "@polkadot/api";
103118
// Create the provider for a known chain
104-
const provider = new ScProvider(WellKnownChain.westend2);
119+
const provider = new ScProvider(Sc, WellKnownChain.westend2);
105120
// Stablish the connection (and catch possible errors)
106121
await provider.connect();
107122
// Create the PolkadotJS api instance
@@ -118,11 +133,12 @@ The following example illustrates how you can use the `rpc-provider` to connect
118133

119134
```js
120135
import { ScProvider } from "@polkadot/rpc-provider/substrate-connect";
136+
import * as Sc from "@substrate/connect";
121137
import { ApiPromise } from "@polkadot/api";
122138
import jsonCustomSpec from "./jsonCustomSpec.json";
123139
// Create the provider for the custom chain
124140
const customSpec = JSON.stringify(jsonCustomSpec);
125-
const provider = new ScProvider(customSpec);
141+
const provider = new ScProvider(Sc, customSpec);
126142
// Stablish the connection (and catch possible errors)
127143
await provider.connect();
128144
// Create the PolkadotJS api instance
@@ -139,15 +155,16 @@ The following example illustrates how you can use the `rpc-provider` to connect
139155

140156
```js
141157
import { ScProvider, WellKnownChain } from "@polkadot/rpc-provider/substrate-connect";
158+
import * as Sc from "@substrate/connect";
142159
import { ApiPromise } from "@polkadot/api";
143160
import jsonParachainSpec from "./jsonParachainSpec.json";
144161
// Create the provider for the relay chain
145-
const relayProvider = new ScProvider(WellKnownChain.westend2);
162+
const relayProvider = new ScProvider(Sc, WellKnownChain.westend2);
146163
// Create the provider for the parachain. Notice that
147164
// we must pass the provider of the relay chain as the
148165
// second argument
149166
const parachainSpec = JSON.stringify(jsonParachainSpec);
150-
const provider = new ScProvider(parachainSpec, relayProvider);
167+
const provider = new ScProvider(Sc, parachainSpec, relayProvider);
151168
// Stablish the connection (and catch possible errors)
152169
await provider.connect();
153170
// Create the PolkadotJS api instance
@@ -234,9 +251,9 @@ You can download the Chrome and Firefox extensions from [Substrate Connect](http
234251
It's meant to be quick and easy to use but less secure than other solutions.
235252
[Github](https://github.com/paritytech/substrate-connect/tree/main/projects/burnr)
236253

237-
- [Multi-demo](https://paritytech.github.io/substrate-connect/demo/)
254+
- [Multi-chain demo](https://paritytech.github.io/substrate-connect/demo/)
238255

239-
Simple demo that covers multichain and parachain examples.
256+
A simple demo that covers multichain and parachain examples.
240257
[Github](https://github.com/paritytech/substrate-connect/tree/main/projects/demo)
241258

242259
## Brave browser WebSocket issue

0 commit comments

Comments
 (0)