@@ -93,15 +93,30 @@ To add `substrate-connect` to your application:
93
93
npm i @polkadot/api
94
94
```
95
95
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
+
96
110
### Use the RPC provider to connect to a well-known network
97
111
98
112
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.
99
113
100
114
``` js
101
115
import { ScProvider , WellKnownChain } from " @polkadot/rpc-provider/substrate-connect" ;
116
+ import * as Sc from " @substrate/connect" ;
102
117
import { ApiPromise } from " @polkadot/api" ;
103
118
// Create the provider for a known chain
104
- const provider = new ScProvider (WellKnownChain .westend2 );
119
+ const provider = new ScProvider (Sc, WellKnownChain .westend2 );
105
120
// Stablish the connection (and catch possible errors)
106
121
await provider .connect ();
107
122
// Create the PolkadotJS api instance
@@ -118,11 +133,12 @@ The following example illustrates how you can use the `rpc-provider` to connect
118
133
119
134
``` js
120
135
import { ScProvider } from " @polkadot/rpc-provider/substrate-connect" ;
136
+ import * as Sc from " @substrate/connect" ;
121
137
import { ApiPromise } from " @polkadot/api" ;
122
138
import jsonCustomSpec from " ./jsonCustomSpec.json" ;
123
139
// Create the provider for the custom chain
124
140
const customSpec = JSON .stringify (jsonCustomSpec);
125
- const provider = new ScProvider (customSpec);
141
+ const provider = new ScProvider (Sc, customSpec);
126
142
// Stablish the connection (and catch possible errors)
127
143
await provider .connect ();
128
144
// Create the PolkadotJS api instance
@@ -139,15 +155,16 @@ The following example illustrates how you can use the `rpc-provider` to connect
139
155
140
156
``` js
141
157
import { ScProvider , WellKnownChain } from " @polkadot/rpc-provider/substrate-connect" ;
158
+ import * as Sc from " @substrate/connect" ;
142
159
import { ApiPromise } from " @polkadot/api" ;
143
160
import jsonParachainSpec from " ./jsonParachainSpec.json" ;
144
161
// Create the provider for the relay chain
145
- const relayProvider = new ScProvider (WellKnownChain .westend2 );
162
+ const relayProvider = new ScProvider (Sc, WellKnownChain .westend2 );
146
163
// Create the provider for the parachain. Notice that
147
164
// we must pass the provider of the relay chain as the
148
165
// second argument
149
166
const parachainSpec = JSON .stringify (jsonParachainSpec);
150
- const provider = new ScProvider (parachainSpec, relayProvider);
167
+ const provider = new ScProvider (Sc, parachainSpec, relayProvider);
151
168
// Stablish the connection (and catch possible errors)
152
169
await provider .connect ();
153
170
// Create the PolkadotJS api instance
@@ -234,9 +251,9 @@ You can download the Chrome and Firefox extensions from [Substrate Connect](http
234
251
It's meant to be quick and easy to use but less secure than other solutions.
235
252
[ Github] ( https://github.com/paritytech/substrate-connect/tree/main/projects/burnr )
236
253
237
- - [ Multi-demo] ( https://paritytech.github.io/substrate-connect/demo/ )
254
+ - [ Multi-chain demo] ( https://paritytech.github.io/substrate-connect/demo/ )
238
255
239
- Simple demo that covers multichain and parachain examples.
256
+ A simple demo that covers multichain and parachain examples.
240
257
[ Github] ( https://github.com/paritytech/substrate-connect/tree/main/projects/demo )
241
258
242
259
## Brave browser WebSocket issue
0 commit comments