From 23916689cea6a4831eccd5dcd74f78726b8af97c Mon Sep 17 00:00:00 2001 From: Carlo Sala Date: Mon, 16 Sep 2024 16:20:44 +0200 Subject: [PATCH] fix(getting-started): merge websockets and add sdk compat --- docs/pages/getting-started.mdx | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/docs/pages/getting-started.mdx b/docs/pages/getting-started.mdx index 48b78750..762dc7d1 100644 --- a/docs/pages/getting-started.mdx +++ b/docs/pages/getting-started.mdx @@ -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', }}> ```ts @@ -107,28 +106,21 @@ Now you can create a PolkadotClient with a provider of your choice and start int ``` - + ```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] - ``` - - - - ```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]