diff --git a/docs/pages/getting-started.mdx b/docs/pages/getting-started.mdx index ddfabc7d..ecd454b6 100644 --- a/docs/pages/getting-started.mdx +++ b/docs/pages/getting-started.mdx @@ -26,10 +26,30 @@ It's a really good idea to add papi to the "postinstall" script in package.json Now you can create a PolkadotClient with a provider of your choice and start interacting with the API: + + ```ts + // [!include ~/snippets/gettingStarted.ts:import] + import { getSmProvider } from "polkadot-api/sm-provider"; + import { chainSpec } from "polkadot-api/chains/polkadot"; + import { startFromWorker } from "polkadot-api/smoldot/from-worker"; + import SmWorker from "polkadot-api/smoldot/worker?worker"; + + const smoldot = startFromWorker(new SmWorker()); + const chain = await smoldot.addChain({ chainSpec }); + + // Connect to the polkadot relay chain. + const client = createClient( + getSmProvider(chain) + ); + + // [!include ~/snippets/gettingStarted.ts:usage] + ``` + ```ts // [!include ~/snippets/gettingStarted.ts:import] diff --git a/docs/pages/index.mdx b/docs/pages/index.mdx index 67cbbd1e..90243ff4 100644 --- a/docs/pages/index.mdx +++ b/docs/pages/index.mdx @@ -33,16 +33,19 @@ import { KeyPoint } from '../components/KeyPoint'; -
+

Features

-
    -
  • Connect to the chain through a light client, a WebSocket connection, or an extension.
  • -
  • Perform storage queries or runtime calls.
  • -
  • Generate the types of a chain through its current metadata.
  • -
  • Compatibility checks.
  • -
  • Multiple connections to different chains.
  • -
  • Transaction API in read-only and read/write mode.
  • -
  • Promise-based or Observable-based API for your needs.
  • -
+ + - **Light client first**: built on top of the [new JSON-RPC spec](https://paritytech.github.io/json-rpc-interface-spec/) to fully leverage the potential of light-clients. + - Delightful **TypeScript support** with types and docs generated from on-chain metadata. + - First class support for **storage** reads, **constants**, **transactions**, **events** and **runtime calls**. + - Perform **multiple connections** to different chains simultaneously. + - Prepare for an upcoming **runtime updates** by generating multiple descriptors and performing **compatibility checks**. + - **Performant and lightweight**: ships with multiple subpaths, so dApps don't bundle unnecessary assets. + - Uses **native BigInt**, instead of large BigNumber libraries + - Leverages dynamic imports to favour **faster loading times**. + - **Promise-based and Observable-based APIs**: use the one that best suit your needs and/or coding style. + - Use **signers** from your browser extension, or from a private key. + - Easy integration with **PJS-based extensions**.
\ No newline at end of file