Skip to content

Commit

Permalink
fix(getting-started): merge websockets and add sdk compat
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosala committed Sep 16, 2024
1 parent 0680bda commit 2391668
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions docs/pages/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ Now you can create a PolkadotClient with a provider of your choice and start int
smw: 'Smoldot (WebWorker)',
smnw: 'Smoldot (NodeJS WebWorker)',
sm: 'Smoldot',
web: 'WebSocket',
node: 'NodeJS Socket',
ws: 'WebSocket',
}}>
<Tabs.Content value="smw">
```ts
Expand Down Expand Up @@ -107,28 +106,21 @@ Now you can create a PolkadotClient with a provider of your choice and start int
```

</Tabs.Content>
<Tabs.Content value="web">
<Tabs.Content value="ws">
```ts
// [!include ~/snippets/gettingStarted.ts:import]
// import from "polkadot-api/ws-provider/node"
// if you are running in a NodeJS environment
import { getWsProvider } from "polkadot-api/ws-provider/web";
import { withPolkadotSdkCompat } from "polkadot-api/polkadot-sdk-compat";
// Connect to the polkadot relay chain.
const client = createClient(
getWsProvider("wss://dot-rpc.stakeworld.io")
);
// [!include ~/snippets/gettingStarted.ts:usage]
```

</Tabs.Content>
<Tabs.Content value="node">
```ts
// [!include ~/snippets/gettingStarted.ts:import]
import { getWsProvider } from "polkadot-api/ws-provider/node";
// Connect to the polkadot relay chain.
const client = createClient(
getWsProvider("wss://dot-rpc.stakeworld.io")
// Polkadot-SDK Nodes have issues, we recommend adding this enhancer
// see Requirements page for more info
withPolkadotSdkCompat(
getWsProvider("wss://dot-rpc.stakeworld.io")
)
);
// [!include ~/snippets/gettingStarted.ts:usage]
Expand Down

0 comments on commit 2391668

Please sign in to comment.