Skip to content

Commit 5fbc918

Browse files
committed
rename package to polkadot-api
1 parent bd19cef commit 5fbc918

8 files changed

+33
-72
lines changed

docs/pages/api/papee.mdx

-3
This file was deleted.

docs/pages/api/polkadot_api.mdx

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Polkadot-API
2+
3+
polkadot-api

docs/pages/codegen.mdx

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ It's recommended to add `papi` to the `postinstall` script in package.json to ha
4949
}
5050
```
5151

52-
The code is generated into a new `node_modules` package `@polkadot-api/descriptors`, but it's always re-exported from `papee/descriptors`.
52+
The code is generated into the `@polkadot-api/descriptors` node modules package
5353

5454
:::info
5555
Some package managers clean the `node_modules` folder after installing or removing dependencies. When that happens, run the codegen again.
@@ -75,7 +75,7 @@ In the event that there are two chains with the two well-known types that have t
7575

7676
## Usage
7777

78-
Import from `papee/descriptors` every chain and type that you need, then use it through `getTypedApi()`.
78+
Import from `@polkadot-api/descriptors` every chain and type that you need, then use it through `getTypedApi()`.
7979

8080
```ts
8181
import {
@@ -85,7 +85,7 @@ import {
8585
XcmVersionedXcm,
8686
XcmV2Instruction,
8787
XcmV2MultilocationJunctions,
88-
} from 'papee/descriptors';
88+
} from '@polkadot-api/descriptors';
8989

9090
// ...
9191

docs/pages/getting-started.mdx

+20-59
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,11 @@ import * as Tabs from '../components/Tabs';
22

33
# Getting Started
44

5-
Start by installing papee and a JSON RPC provider of your choice.
5+
Start by installing `polkadot-api` and `@polkadot-api/descriptors`
66

7-
<Tabs.Root options={{
8-
web: 'WebSocket',
9-
sc: '@substrate/connect',
10-
sm: 'Smoldot'
11-
}}>
12-
<Tabs.Content value="web">
13-
```sh
14-
npm i papee
15-
```
16-
</Tabs.Content>
17-
<Tabs.Content value="sc">
18-
```sh
19-
npm i papee @substrate/connect
20-
```
21-
</Tabs.Content>
22-
<Tabs.Content value="sm">
23-
```sh
24-
npm i papee smoldot @substrate/connect-known-chains
25-
```
26-
</Tabs.Content>
27-
</Tabs.Root>
28-
29-
:::warning
30-
`papee` is a tentative package name while it's in beta. The package name might change, but the API is expected to be fairly stable.
31-
:::
7+
```sh
8+
npm i polkadot-api @polkadot-api/descriptors
9+
```
3210

3311
Next, download the latest metadata from the chain you want to connect to and generate the types:
3412

@@ -45,69 +23,52 @@ npx papi
4523
It's a really good idea to add papi to the "postinstall" script in package.json to automate generating the types after installation.
4624
:::
4725

48-
Now you can create a PolkadotClient with that provider and start interacting with the API:
49-
26+
Now you can create a PolkadotClient with a provider of your choice and start interacting with the API:
27+
5028
<Tabs.Root options={{
29+
sm: 'Smoldot',
5130
web: 'WebSocket',
5231
node: 'NodeJS Socket',
53-
sc: '@substrate/connect',
54-
sm: 'Smoldot'
5532
}}>
56-
<Tabs.Content value="web">
33+
<Tabs.Content value="sm">
5734
```ts
5835
// [!include ~/snippets/gettingStarted.ts:import]
59-
import { WebSocketProvider } from "papee/ws-provider-web";
60-
61-
// Connect to the polkadot relay chain.
62-
const client = createClient(
63-
WebSocketProvider("wss://dot-rpc.stakeworld.io")
64-
);
36+
import { getSmProvider } from "polkadot-api/sm-provider";
37+
import { chainSpec } from "polkadot-api/chains/polkadot";
38+
import { start } from "polkadot-api/smoldot";
6539

66-
// [!include ~/snippets/gettingStarted.ts:usage]
67-
```
68-
</Tabs.Content>
69-
<Tabs.Content value="node">
70-
```ts
71-
// [!include ~/snippets/gettingStarted.ts:import]
72-
import { WebSocketProvider } from "papee/ws-provider-node";
40+
const smoldot = start();
41+
const chain = await smoldot.addChain({ chainSpec });
7342

7443
// Connect to the polkadot relay chain.
7544
const client = createClient(
76-
WebSocketProvider("wss://dot-rpc.stakeworld.io")
45+
getSmProvider(chain)
7746
);
7847

7948
// [!include ~/snippets/gettingStarted.ts:usage]
8049
```
8150
</Tabs.Content>
82-
<Tabs.Content value="sc">
51+
<Tabs.Content value="web">
8352
```ts
8453
// [!include ~/snippets/gettingStarted.ts:import]
85-
import { getScProvider } from "papee/sc-provider";
86-
import { WellKnownChain, createScClient } from "@substrate/connect";
87-
88-
const scProvider = getScProvider(createScClient());
54+
import { WebSocketProvider } from "polkadot-api/ws-provider/web";
8955

9056
// Connect to the polkadot relay chain.
9157
const client = createClient(
92-
scProvider(WellKnownChain.polkadot).relayChain
58+
WebSocketProvider("wss://dot-rpc.stakeworld.io")
9359
);
9460

9561
// [!include ~/snippets/gettingStarted.ts:usage]
9662
```
9763
</Tabs.Content>
98-
<Tabs.Content value="sm">
64+
<Tabs.Content value="node">
9965
```ts
10066
// [!include ~/snippets/gettingStarted.ts:import]
101-
import { getSmProvider } from "papee/sm-provider";
102-
import { polkadot } from "@substrate/connect-known-chains";
103-
import { start } from "smoldot";
104-
105-
const smoldot = start();
106-
const chain = await smoldot.addChain({ chainSpec: polkadot });
67+
import { WebSocketProvider } from "polkadot-api/ws-provider/node";
10768

10869
// Connect to the polkadot relay chain.
10970
const client = createClient(
110-
getSmProvider(chain)
71+
WebSocketProvider("wss://dot-rpc.stakeworld.io")
11172
);
11273

11374
// [!include ~/snippets/gettingStarted.ts:usage]

docs/pages/index.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { KeyPoint } from '../components/KeyPoint';
1818
</HomePage.Buttons>
1919
</div>
2020

21-
<HomePage.InstallPackage name="papee" type="i" />
21+
<HomePage.InstallPackage name="polkadot-api" type="i" />
2222
</div>
2323

2424
<div className="flex gap-2 flex-col md:flex-row mt-8">

docs/pages/types.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ The enums that are not well-known types, they are anonymous. In that case, you w
5959

6060
This indicates that the parameter value is an enum, whose key will be either one of the keys of the object type (i.e. `transfer_allow_death`, `force_transfer`, ..., `force_set_balance`), and the type will be the value for that particular key.
6161

62-
For these cases, you should use the function `Enum(type, value)`, imported from `@polkadot-api/client`. This has full type inference support, and creates an Enum object that can be used as a parameter of a call:
62+
For these cases, you should use the function `Enum(type, value)`, imported from `polkadot-api`. This has full type inference support, and creates an Enum object that can be used as a parameter of a call:
6363

6464
```ts
6565
dotApi.apis.TransactionPaymentCallApi.query_call_info(

docs/snippets/gettingStarted.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// [!region import]
22
// `dot` is the name we gave to `npx papi add`
3-
import { dot } from "papee/descriptors";
4-
import { createClient } from "papee";
3+
import { dot } from "@polkadot-api/descriptors";
4+
import { createClient } from "polkadot-api";
55
// [!endregion import]
66

77
// [!region usage]

vocs.config.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ export default defineConfig({
3030
collapsed: true,
3131
items: [
3232
{
33-
text: "Papee",
34-
link: "/api/papee",
33+
text: "Polkadot-API",
34+
link: "/api/polkadot_api",
3535
},
3636
],
3737
},
@@ -41,7 +41,7 @@ export default defineConfig({
4141
items: [
4242
{
4343
text: "Example",
44-
link: "/api/example",
44+
link: "/examples/example",
4545
},
4646
],
4747
},

0 commit comments

Comments
 (0)