dedot 0.0.1-next.f5bf4fc2.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +211 -64
- package/bin/dedot +3 -0
- package/chaintypes/index.d.ts +1 -0
- package/chaintypes/index.js +1 -0
- package/cjs/{extrinsic → chaintypes}/index.js +1 -2
- package/cjs/{extrinsic/extensions → codecs}/index.js +1 -3
- package/cjs/{executor → contracts}/index.js +1 -8
- package/cjs/index.js +16 -7
- package/cjs/runtime-specs/index.js +17 -0
- package/cjs/{client → shape}/index.js +1 -1
- package/cjs/types/index.js +17 -0
- package/cjs/types/json-rpc/index.js +17 -0
- package/cjs/utils/index.js +17 -0
- package/codecs/index.d.ts +1 -0
- package/codecs/index.js +1 -0
- package/contracts/index.d.ts +1 -0
- package/contracts/index.js +1 -0
- package/index.d.ts +3 -6
- package/index.js +3 -5
- package/package.json +77 -33
- package/runtime-specs/index.d.ts +1 -0
- package/runtime-specs/index.js +1 -0
- package/shape/index.d.ts +1 -0
- package/shape/index.js +1 -0
- package/types/index.d.ts +1 -0
- package/types/index.js +1 -0
- package/types/json-rpc/index.d.ts +1 -0
- package/types/json-rpc/index.js +1 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.js +1 -0
- package/cjs/client/Dedot.js +0 -436
- package/cjs/executor/ConstantExecutor.js +0 -22
- package/cjs/executor/ErrorExecutor.js +0 -47
- package/cjs/executor/EventExecutor.js +0 -53
- package/cjs/executor/Executor.js +0 -39
- package/cjs/executor/RpcExecutor.js +0 -110
- package/cjs/executor/RuntimeApiExecutor.js +0 -108
- package/cjs/executor/StorageQueryExecutor.js +0 -33
- package/cjs/executor/TxExecutor.js +0 -153
- package/cjs/extrinsic/SubmittableResult.js +0 -33
- package/cjs/extrinsic/extensions/ExtraSignedExtension.js +0 -88
- package/cjs/extrinsic/extensions/SignedExtension.js +0 -41
- package/cjs/extrinsic/extensions/known/ChargeAssetTxPayment.js +0 -44
- package/cjs/extrinsic/extensions/known/ChargeTransactionPayment.js +0 -16
- package/cjs/extrinsic/extensions/known/CheckGenesis.js +0 -19
- package/cjs/extrinsic/extensions/known/CheckMortality.js +0 -71
- package/cjs/extrinsic/extensions/known/CheckNonZeroSender.js +0 -10
- package/cjs/extrinsic/extensions/known/CheckNonce.js +0 -34
- package/cjs/extrinsic/extensions/known/CheckSpecVersion.js +0 -19
- package/cjs/extrinsic/extensions/known/CheckTxVersion.js +0 -19
- package/cjs/extrinsic/extensions/known/CheckWeight.js +0 -10
- package/cjs/extrinsic/extensions/known/PrevalidateAttests.js +0 -11
- package/cjs/extrinsic/extensions/known/index.js +0 -25
- package/cjs/packageInfo.js +0 -5
- package/cjs/proxychain.js +0 -20
- package/cjs/storage/QueryableStorage.js +0 -99
- package/cjs/types.js +0 -2
- package/client/Dedot.d.ts +0 -181
- package/client/Dedot.js +0 -432
- package/client/index.d.ts +0 -1
- package/client/index.js +0 -1
- package/executor/ConstantExecutor.d.ts +0 -11
- package/executor/ConstantExecutor.js +0 -18
- package/executor/ErrorExecutor.d.ts +0 -11
- package/executor/ErrorExecutor.js +0 -43
- package/executor/EventExecutor.d.ts +0 -11
- package/executor/EventExecutor.js +0 -49
- package/executor/Executor.d.ts +0 -150
- package/executor/Executor.js +0 -35
- package/executor/RpcExecutor.d.ts +0 -14
- package/executor/RpcExecutor.js +0 -106
- package/executor/RuntimeApiExecutor.d.ts +0 -12
- package/executor/RuntimeApiExecutor.js +0 -104
- package/executor/StorageQueryExecutor.d.ts +0 -10
- package/executor/StorageQueryExecutor.js +0 -29
- package/executor/TxExecutor.d.ts +0 -47
- package/executor/TxExecutor.js +0 -147
- package/executor/index.d.ts +0 -8
- package/executor/index.js +0 -8
- package/extrinsic/SubmittableResult.d.ts +0 -19
- package/extrinsic/SubmittableResult.js +0 -29
- package/extrinsic/extensions/ExtraSignedExtension.d.ts +0 -14
- package/extrinsic/extensions/ExtraSignedExtension.js +0 -61
- package/extrinsic/extensions/SignedExtension.d.ts +0 -40
- package/extrinsic/extensions/SignedExtension.js +0 -37
- package/extrinsic/extensions/index.d.ts +0 -3
- package/extrinsic/extensions/index.js +0 -3
- package/extrinsic/extensions/known/ChargeAssetTxPayment.d.ts +0 -14
- package/extrinsic/extensions/known/ChargeAssetTxPayment.js +0 -40
- package/extrinsic/extensions/known/ChargeTransactionPayment.d.ts +0 -6
- package/extrinsic/extensions/known/ChargeTransactionPayment.js +0 -12
- package/extrinsic/extensions/known/CheckGenesis.d.ts +0 -10
- package/extrinsic/extensions/known/CheckGenesis.js +0 -15
- package/extrinsic/extensions/known/CheckMortality.d.ts +0 -15
- package/extrinsic/extensions/known/CheckMortality.js +0 -67
- package/extrinsic/extensions/known/CheckNonZeroSender.d.ts +0 -6
- package/extrinsic/extensions/known/CheckNonZeroSender.js +0 -6
- package/extrinsic/extensions/known/CheckNonce.d.ts +0 -10
- package/extrinsic/extensions/known/CheckNonce.js +0 -30
- package/extrinsic/extensions/known/CheckSpecVersion.d.ts +0 -9
- package/extrinsic/extensions/known/CheckSpecVersion.js +0 -15
- package/extrinsic/extensions/known/CheckTxVersion.d.ts +0 -9
- package/extrinsic/extensions/known/CheckTxVersion.js +0 -15
- package/extrinsic/extensions/known/CheckWeight.d.ts +0 -6
- package/extrinsic/extensions/known/CheckWeight.js +0 -6
- package/extrinsic/extensions/known/PrevalidateAttests.d.ts +0 -7
- package/extrinsic/extensions/known/PrevalidateAttests.js +0 -7
- package/extrinsic/extensions/known/index.d.ts +0 -3
- package/extrinsic/extensions/known/index.js +0 -22
- package/extrinsic/index.d.ts +0 -2
- package/extrinsic/index.js +0 -2
- package/packageInfo.d.ts +0 -4
- package/packageInfo.js +0 -2
- package/proxychain.d.ts +0 -7
- package/proxychain.js +0 -16
- package/storage/QueryableStorage.d.ts +0 -16
- package/storage/QueryableStorage.js +0 -95
- package/types.d.ts +0 -54
- package/types.js +0 -1
package/README.md
CHANGED
|
@@ -5,44 +5,60 @@ A delightful JavaScript/TypeScript client for [Polkadot](https://polkadot.networ
|
|
|
5
5
|
<p align="left">
|
|
6
6
|
<img src="https://img.shields.io/github/license/dedotdev/dedot?style=flat-square"/>
|
|
7
7
|
<img src="https://img.shields.io/github/actions/workflow/status/dedotdev/dedot/run-tests.yml?label=unit%20tests&style=flat-square"/>
|
|
8
|
+
<img src="https://img.shields.io/github/actions/workflow/status/dedotdev/dedot/zombienet-tests.yml?label=e2e%20tests&style=flat-square"/>
|
|
8
9
|
<img src="https://img.shields.io/github/package-json/v/dedotdev/dedot?filename=packages%2Fapi%2Fpackage.json&style=flat-square"/>
|
|
9
10
|
</p>
|
|
10
11
|
|
|
11
12
|
_Note: The project is still in active development phase, the information on this page might be outdated. Feel free to raise an [issue](https://github.com/dedotdev/dedot/issues/new) if you run into any problems or want to share any ideas._
|
|
12
13
|
|
|
13
14
|
---
|
|
15
|
+
### Features
|
|
16
|
+
- ✅ Small bundle size, tree-shakable (no more bn.js or wasm-blob tight dependencies)
|
|
17
|
+
- ✅ Built-in metadata caching mechanism
|
|
18
|
+
- ✅ Types & APIs suggestions for each individual Substrate-based blockchain network ([@dedot/chaintypes](https://github.com/dedotdev/chaintypes))
|
|
19
|
+
- ✅ Familiar api style with `@polkadot/api`, easy & fast migration!
|
|
20
|
+
- ✅ Native TypeScript type system for scale-codec
|
|
21
|
+
- ✅ Compatible with `@polkadot/extension`-based wallets
|
|
22
|
+
- ✅ Support Metadata V14, V15 (latest)
|
|
23
|
+
- ✅ Build on top of both the [new](https://paritytech.github.io/json-rpc-interface-spec/introduction.html) & legacy (deprecated soon) JSON-RPC APIs
|
|
24
|
+
- ✅ Support light clients (e.g: [smoldot](https://www.npmjs.com/package/smoldot)) (_docs coming soon_)
|
|
25
|
+
- ✅ Typed Contract APIs (_docs coming soon_)
|
|
26
|
+
- ✅ Fully-typed low-level JSON-RPC client (_docs coming soon_)
|
|
27
|
+
- ⏳ [Compact Metadata](https://github.com/dedotdev/dedot/issues/45)
|
|
28
|
+
|
|
14
29
|
### Have a quick taste
|
|
15
30
|
|
|
16
31
|
Try `dedot` now on [CodeSandbox Playground](https://codesandbox.io/p/devbox/trydedot-th96cm?file=%2Fmain.ts%3A24%2C26) or follow the below steps to run it on your local environment.
|
|
17
32
|
- Install `dedot` package
|
|
18
33
|
```shell
|
|
19
34
|
# via yarn
|
|
20
|
-
yarn add dedot
|
|
35
|
+
yarn add dedot@latest
|
|
21
36
|
|
|
22
37
|
# via npm
|
|
23
|
-
npm i dedot
|
|
38
|
+
npm i dedot@latest
|
|
24
39
|
```
|
|
25
40
|
|
|
26
41
|
- Install `@dedot/chaintypes` package for chain types & APIs suggestion. Skip this step if you don't use TypeScript.
|
|
27
42
|
```shell
|
|
28
43
|
# via yarn
|
|
29
|
-
yarn add -D @dedot/chaintypes
|
|
44
|
+
yarn add -D @dedot/chaintypes@latest
|
|
30
45
|
|
|
31
46
|
# via npm
|
|
32
|
-
npm i -D @dedot/chaintypes
|
|
47
|
+
npm i -D @dedot/chaintypes@latest
|
|
33
48
|
```
|
|
34
49
|
|
|
35
50
|
- Initialize the API client and start interacting with Polkadot network
|
|
36
51
|
```typescript
|
|
37
52
|
// main.ts
|
|
38
|
-
import {
|
|
53
|
+
import { DedotClient, WsProvider } from 'dedot';
|
|
39
54
|
import type { PolkadotApi } from '@dedot/chaintypes';
|
|
40
55
|
|
|
41
56
|
const run = async () => {
|
|
42
|
-
const
|
|
57
|
+
const provider = new WsProvider('wss://rpc.polkadot.io');
|
|
58
|
+
const api = await DedotClient.new<PolkadotApi>(provider);
|
|
43
59
|
|
|
44
60
|
// Call rpc `state_getMetadata` to fetch raw scale-encoded metadata and decode it.
|
|
45
|
-
const metadata = await api.rpc.
|
|
61
|
+
const metadata = await api.rpc.state_getMetadata();
|
|
46
62
|
console.log('Metadata:', metadata);
|
|
47
63
|
|
|
48
64
|
// Query on-chain storage
|
|
@@ -73,10 +89,20 @@ run().catch(console.error);
|
|
|
73
89
|
|
|
74
90
|
```js
|
|
75
91
|
// main.js
|
|
76
|
-
const {
|
|
92
|
+
const { DedotClient, WsProvider } = require('dedot');
|
|
77
93
|
// ...
|
|
78
|
-
const
|
|
94
|
+
const provider = new WsProvider('wss://rpc.polkadot.io');
|
|
95
|
+
const api = await DedotClient.new(provider);
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
- If the JSON-RPC server doesn't support [new](https://paritytech.github.io/json-rpc-interface-spec/introduction.html) JSON-RPC APIs yet, you can connect using the `LegacyClient` which build on top of the legacy JSON-RPC APIs.
|
|
99
|
+
```typescript
|
|
100
|
+
import { LegacyClient, WsProvider } from 'dedot';
|
|
101
|
+
|
|
102
|
+
const provider = new WsProvider('wss://rpc.polkadot.io');
|
|
103
|
+
const api = await LegacyClient.new(provider);
|
|
79
104
|
```
|
|
105
|
+
|
|
80
106
|
### Table of contents
|
|
81
107
|
- [Status](#status)
|
|
82
108
|
- [Chain Types & APIs](#chain-types--apis)
|
|
@@ -87,90 +113,70 @@ const api = await Dedot.new('wss://rpc.polkadot.io');
|
|
|
87
113
|
- [Submit Transactions](#transaction-apis)
|
|
88
114
|
- [Events](#events)
|
|
89
115
|
- [Errors](#errors)
|
|
116
|
+
- [`@polkadot/api` -> `dedot`](#migration-from-polkadotapi-to-dedot)
|
|
90
117
|
- [Credit](#credit)
|
|
91
118
|
|
|
92
|
-
### Status
|
|
93
|
-
|
|
94
|
-
| Feature | Status |
|
|
95
|
-
|-------------------------------------------------------| ----------- |
|
|
96
|
-
| Execute RPC (`api.rpc`) | ✅ |
|
|
97
|
-
| Query On-chain Storage (`api.query`) | ✅ |
|
|
98
|
-
| Get runtime constants (`api.consts`) | ✅ |
|
|
99
|
-
| Runtime APIs (`api.call`) | ✅ |
|
|
100
|
-
| Transaction APIs (`api.tx`) | ✅ |
|
|
101
|
-
| Events (`api.events`) | ✅ |
|
|
102
|
-
| Errors (`api.errors`) | ✅ |
|
|
103
|
-
| Contract APIs | ⏳ |
|
|
104
|
-
| Metadata v14 | ✅ |
|
|
105
|
-
| Metadata v15 | ✅ |
|
|
106
|
-
| [RPC v2](https://github.com/dedotdev/dedot/issues/20) | ⏳ |
|
|
107
|
-
|
|
108
119
|
### Chain Types & APIs
|
|
109
120
|
|
|
110
121
|
Each Substrate-based blockchain has their own set of data types & APIs to interact with, so being aware of those types & APIs when working with a blockchain will greatly improve the overall development experience. `dedot` exposes TypeScript's types & APIs for each individual Substrate-based blockchain, we recommend using TypeScript for your project to have the best experience.
|
|
111
122
|
|
|
112
|
-
Types & APIs for each Substrate-based blockchains are defined in package [`@dedot/chaintypes`](https://github.com/dedotdev/
|
|
123
|
+
Types & APIs for each Substrate-based blockchains are defined in package [`@dedot/chaintypes`](https://github.com/dedotdev/chaintypes):
|
|
113
124
|
```shell
|
|
114
125
|
# via yarn
|
|
115
|
-
yarn add -D @dedot/chaintypes
|
|
126
|
+
yarn add -D @dedot/chaintypes@latest
|
|
116
127
|
|
|
117
128
|
# via npm
|
|
118
|
-
npm i -D @dedot/chaintypes
|
|
129
|
+
npm i -D @dedot/chaintypes@latest
|
|
119
130
|
```
|
|
120
131
|
|
|
121
|
-
Initialize a `
|
|
132
|
+
Initialize a `DedotClient` instance using the `ChainApi` interface for a target chain to enable types & APIs suggestion/autocompletion for that particular chain:
|
|
133
|
+
|
|
122
134
|
```typescript
|
|
123
|
-
import {
|
|
135
|
+
import { DedotClient, WsProvider } from 'dedot';
|
|
124
136
|
import type { PolkadotApi, KusamaApi, MoonbeamApi, AstarApi } from '@dedot/chaintypes';
|
|
125
137
|
|
|
126
138
|
// ...
|
|
127
139
|
|
|
128
|
-
const polkadotApi = await
|
|
140
|
+
const polkadotApi = await DedotClient.new<PolkadotApi>(new WsProvider('wss://rpc.polkadot.io'));
|
|
129
141
|
console.log(await polkadotApi.query.babe.authorities());
|
|
130
142
|
|
|
131
|
-
const kusamaApi = await
|
|
143
|
+
const kusamaApi = await DedotClient.new<KusamaApi>(new WsProvider('wss://kusama-rpc.polkadot.io'));
|
|
132
144
|
console.log(await kusamaApi.query.society.memberCount());
|
|
133
145
|
|
|
134
|
-
const moonbeamApi = await
|
|
146
|
+
const moonbeamApi = await DedotClient.new<MoonbeamApi>(new WsProvider('wss://wss.api.moonbeam.network'));
|
|
135
147
|
console.log(await moonbeamApi.query.ethereumChainId.chainId());
|
|
136
148
|
|
|
137
|
-
const astarApi = await
|
|
149
|
+
const astarApi = await DedotClient.new<AstarApi>(new WsProvider('wss://rpc.astar.network'));
|
|
138
150
|
console.log(await astarApi.query.dappsStaking.blockRewardAccumulator());
|
|
139
151
|
|
|
140
|
-
const genericApi = await
|
|
152
|
+
const genericApi = await DedotClient.new(new WsProvider('ws://localhost:9944'));
|
|
141
153
|
|
|
142
154
|
// ...
|
|
143
155
|
```
|
|
144
156
|
|
|
145
|
-
Supported `ChainApi` interfaces are defined [here](https://github.com/dedotdev/
|
|
157
|
+
Supported `ChainApi` interfaces are defined [here](https://github.com/dedotdev/chaintypes/blob/main/packages/chaintypes/src/index.ts), you can also generate the `ChainApi` interface for the chain you want to connect with using `dedot` cli.
|
|
146
158
|
|
|
147
159
|
```shell
|
|
148
|
-
# Install @dedot/cli via yarn
|
|
149
|
-
yarn add -D @dedot/cli
|
|
150
|
-
|
|
151
|
-
# Or via npm
|
|
152
|
-
npm i -D @dedot/cli
|
|
153
|
-
|
|
154
160
|
# Generate ChainApi interface for Polkadot network via rpc endpoint: wss://rpc.polkadot.io
|
|
155
161
|
npx dedot chaintypes -w wss://rpc.polkadot.io
|
|
156
162
|
```
|
|
157
163
|
|
|
158
164
|
### Execute RPC Methods
|
|
159
165
|
|
|
160
|
-
RPCs can be executed via `api.rpc` entry point. After creating a `Dedot` instance with a `ChainApi` interface of the network you want to interact with, all RPC methods of the network will be exposed in the autocompletion/suggestion with format: `api.rpc
|
|
166
|
+
RPCs can be executed via `api.rpc` entry point. After creating a `Dedot` instance with a `ChainApi` interface of the network you want to interact with, all RPC methods of the network will be exposed in the autocompletion/suggestion with format: `api.rpc.method_name(param1, param2, ...)`. E.g: you can find all supported RPC methods for Polkadot network [here](https://github.com/dedotdev/chaintypes/blob/main/packages/chaintypes/src/polkadot/json-rpc.d.ts), similarly for other networks as well.
|
|
161
167
|
|
|
162
168
|
Examples:
|
|
163
169
|
```typescript
|
|
164
170
|
// Call rpc: `state_getMetadata`
|
|
165
|
-
const metadata = await api.rpc.
|
|
171
|
+
const metadata = await api.rpc.state_getMetadata();
|
|
166
172
|
|
|
167
173
|
// Call an arbitrary rpc: `module_rpc_name` with arguments ['param1', 'param2']
|
|
168
|
-
const result = await api.rpc.
|
|
174
|
+
const result = await api.rpc.module_rpc_name('param1', 'param2');
|
|
169
175
|
```
|
|
170
176
|
|
|
171
177
|
### Query On-chain Storage
|
|
172
178
|
|
|
173
|
-
On-chain storage can be queried via `api.query` entry point. All the available storage entries for a chain are exposed in the `ChainApi` interface for that chain and can be executed with format: `api.query.<pallet>.<storgeEntry>`. E.g: You can find all the available storage queries of Polkadot network [here](https://github.com/dedotdev/
|
|
179
|
+
On-chain storage can be queried via `api.query` entry point. All the available storage entries for a chain are exposed in the `ChainApi` interface for that chain and can be executed with format: `api.query.<pallet>.<storgeEntry>`. E.g: You can find all the available storage queries of Polkadot network [here](https://github.com/dedotdev/chaintypes/blob/main/packages/chaintypes/src/polkadot/query.d.ts), similarly for other networks as well.
|
|
174
180
|
|
|
175
181
|
Examples:
|
|
176
182
|
```typescript
|
|
@@ -182,7 +188,7 @@ const events = await api.query.system.events();
|
|
|
182
188
|
```
|
|
183
189
|
### Constants
|
|
184
190
|
|
|
185
|
-
Runtime constants (parameter types) are defined in metadata, and can be inspected via `api.consts` entry point with format: `api.consts.<pallet>.<constantName>`. All available constants are also exposed in the `ChainApi` interface. E.g: Available constants for Polkadot network is defined [here](https://github.com/dedotdev/
|
|
191
|
+
Runtime constants (parameter types) are defined in metadata, and can be inspected via `api.consts` entry point with format: `api.consts.<pallet>.<constantName>`. All available constants are also exposed in the `ChainApi` interface. E.g: Available constants for Polkadot network is defined [here](https://github.com/dedotdev/chaintypes/blob/main/packages/chaintypes/src/polkadot/consts.d.ts), similarly for other networks.
|
|
186
192
|
|
|
187
193
|
Examples:
|
|
188
194
|
```typescript
|
|
@@ -195,7 +201,7 @@ const existentialDeposit = api.consts.balances.existentialDeposit;
|
|
|
195
201
|
|
|
196
202
|
### Runtime APIs
|
|
197
203
|
|
|
198
|
-
The latest stable Metadata V15 now includes all the runtime apis type information. So for chains that are supported Metadata V15, we can now execute all available runtime apis with syntax `api.call.<runtimeApi>.<methodName>`, those apis are exposed in `ChainApi` interface. E.g: Runtime Apis for Polkadot network is defined [here](https://github.com/dedotdev/
|
|
204
|
+
The latest stable Metadata V15 now includes all the runtime apis type information. So for chains that are supported Metadata V15, we can now execute all available runtime apis with syntax `api.call.<runtimeApi>.<methodName>`, those apis are exposed in `ChainApi` interface. E.g: Runtime Apis for Polkadot network is defined [here](https://github.com/dedotdev/chaintypes/blob/main/packages/chaintypes/src/polkadot/runtime.d.ts), similarly for other networks as well.
|
|
199
205
|
|
|
200
206
|
Examples:
|
|
201
207
|
```typescript
|
|
@@ -210,28 +216,28 @@ const queryInfo = await api.call.transactionPaymentApi.queryInfo(tx.toU8a(), tx.
|
|
|
210
216
|
const runtimeVersion = await api.call.core.version();
|
|
211
217
|
```
|
|
212
218
|
|
|
213
|
-
For chains that only support Metadata V14, we need to bring in the Runtime Api definitions when initializing the
|
|
219
|
+
For chains that only support Metadata V14, we need to bring in the Runtime Api definitions when initializing the DedotClient instance to encode & decode the calls. You can find all supported Runtime Api definitions in [`dedot/runtime-specs`](https://github.com/dedotdev/dedot/blob/fefe71cf4a04d1433841f5cfc8400a1e2a8db112/packages/runtime-specs/src/all.ts#L21-L39) package.
|
|
214
220
|
|
|
215
221
|
Examples:
|
|
216
222
|
```typescript
|
|
217
|
-
import { RuntimeApis } from '
|
|
218
|
-
const api = await
|
|
223
|
+
import { RuntimeApis } from 'dedot/runtime-specs';
|
|
224
|
+
const api = await DedotClient.new({ provider: new WsProvider('wss://rpc.mynetwork.com'), runtimeApis: RuntimeApis });
|
|
219
225
|
|
|
220
226
|
// Or bring in only the Runtime Api definition that you want to interact with
|
|
221
|
-
import { AccountNonceApi } from '
|
|
222
|
-
const api = await
|
|
227
|
+
import { AccountNonceApi } from 'dedot/runtime-specs';
|
|
228
|
+
const api = await DedotClient.new({ provider: new WsProvider('wss://rpc.mynetwork.com'), runtimeApis: { AccountNonceApi } });
|
|
223
229
|
|
|
224
230
|
// Get account nonce
|
|
225
231
|
const nonce = await api.call.accountNonceApi.accountNonce(<address>);
|
|
226
232
|
```
|
|
227
233
|
|
|
228
|
-
You absolutely can define your own Runtime Api definition if you don't find it in the [supported list](https://github.com/dedotdev/dedot/blob/
|
|
234
|
+
You absolutely can define your own Runtime Api definition if you don't find it in the [supported list](https://github.com/dedotdev/dedot/blob/fefe71cf4a04d1433841f5cfc8400a1e2a8db112/packages/runtime-specs/src/all.ts#L21-L39).
|
|
229
235
|
|
|
230
236
|
### Transaction APIs
|
|
231
237
|
|
|
232
238
|
Transaction apis are designed to be compatible with [`IKeyringPair`](https://github.com/polkadot-js/api/blob/3bdf49b0428a62f16b3222b9a31bfefa43c1ca55/packages/types/src/types/interfaces.ts#L15-L21) and [`Signer`](https://github.com/polkadot-js/api/blob/3bdf49b0428a62f16b3222b9a31bfefa43c1ca55/packages/types/src/types/extrinsic.ts#L135-L150) interfaces, so you can sign the transactions with accounts created by a [`Keyring`](https://github.com/polkadot-js/common/blob/22aab4a4e62944a2cf8c885f50be2c1b842813ec/packages/keyring/src/keyring.ts#L41-L40) or from any [Polkadot{.js}-based](https://github.com/polkadot-js/extension?tab=readme-ov-file#api-interface) wallet extensions.
|
|
233
239
|
|
|
234
|
-
All transaction apis are exposed in `ChainApi` interface and can be access with syntax: `api.tx.<pallet>.<transactionName>`. E.g: Available transaction apis for Polkadot network are defined [here](https://github.com/dedotdev/
|
|
240
|
+
All transaction apis are exposed in `ChainApi` interface and can be access with syntax: `api.tx.<pallet>.<transactionName>`. E.g: Available transaction apis for Polkadot network are defined [here](https://github.com/dedotdev/chaintypes/blob/main/packages/chaintypes/src/polkadot/tx.d.ts), similarly for other networks as well.
|
|
235
241
|
|
|
236
242
|
Example 1: Sign transaction with a Keying account
|
|
237
243
|
```typescript
|
|
@@ -245,8 +251,8 @@ const alice = keyring.addFromUri('//Alice');
|
|
|
245
251
|
const unsub = await api.tx.balances
|
|
246
252
|
.transferKeepAlive(<destAddress>, 2_000_000_000_000n)
|
|
247
253
|
.signAndSend(alice, async ({ status }) => {
|
|
248
|
-
console.log('Transaction status', status.
|
|
249
|
-
if (status.
|
|
254
|
+
console.log('Transaction status', status.type);
|
|
255
|
+
if (status.type === 'BestChainBlockIncluded') { // or status.type === 'Finalized'
|
|
250
256
|
console.log(`Transaction completed at block hash ${status.value}`);
|
|
251
257
|
await unsub();
|
|
252
258
|
}
|
|
@@ -262,8 +268,8 @@ const signer = injected.signer;
|
|
|
262
268
|
const unsub = await api.tx.balances
|
|
263
269
|
.transferKeepAlive(<destAddress>, 2_000_000_000_000n)
|
|
264
270
|
.signAndSend(account.address, { signer }, async ({ status }) => {
|
|
265
|
-
console.log('Transaction status', status.
|
|
266
|
-
if (status.
|
|
271
|
+
console.log('Transaction status', status.type);
|
|
272
|
+
if (status.type === 'BestChainBlockIncluded') { // or status.type === 'Finalized'
|
|
267
273
|
console.log(`Transaction completed at block hash ${status.value}`);
|
|
268
274
|
await unsub();
|
|
269
275
|
}
|
|
@@ -291,17 +297,78 @@ const remarkCall: PolkadotRuntimeRuntimeCallLike = {
|
|
|
291
297
|
|
|
292
298
|
const unsub = api.tx.utility.batch([transferTx.call, remarkCall])
|
|
293
299
|
.signAndSend(account.address, { signer }, async ({ status }) => {
|
|
294
|
-
console.log('Transaction status', status.
|
|
295
|
-
if (status.
|
|
300
|
+
console.log('Transaction status', status.type);
|
|
301
|
+
if (status.type === 'BestChainBlockIncluded') { // or status.type === 'Finalized'
|
|
296
302
|
console.log(`Transaction completed at block hash ${status.value}`);
|
|
297
303
|
await unsub();
|
|
298
304
|
}
|
|
299
305
|
});
|
|
300
306
|
```
|
|
301
307
|
|
|
308
|
+
<details>
|
|
309
|
+
<summary>Example 4: Teleport WND from Westend Asset Hub to Westend via XCM</summary>
|
|
310
|
+
|
|
311
|
+
```typescript
|
|
312
|
+
import { WestendAssetHubApi, XcmVersionedLocation, XcmVersionedAssets, XcmV3WeightLimit } from '@dedot/chaintypes/westendAssetHub';
|
|
313
|
+
import { AccountId32 } from 'dedot/codecs';
|
|
314
|
+
|
|
315
|
+
const TWO_TOKENS = 2_000_000_000_000n;
|
|
316
|
+
const destAddress = <bobAddress>;
|
|
317
|
+
|
|
318
|
+
const api = await DedotClient.new<WestendAssetHubApi>('...westend-assethub-rpc...');
|
|
319
|
+
|
|
320
|
+
const dest: XcmVersionedLocation = {
|
|
321
|
+
type: 'V3',
|
|
322
|
+
value: { parents: 1, interior: { type: 'Here' } },
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
const beneficiary: XcmVersionedLocation = {
|
|
326
|
+
type: 'V3',
|
|
327
|
+
value: {
|
|
328
|
+
parents: 0,
|
|
329
|
+
interior: {
|
|
330
|
+
type: 'X1',
|
|
331
|
+
value: {
|
|
332
|
+
type: 'AccountId32',
|
|
333
|
+
value: { id: new AccountId32(destAddress).raw },
|
|
334
|
+
},
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
const assets: XcmVersionedAssets = {
|
|
340
|
+
type: 'V3',
|
|
341
|
+
value: [
|
|
342
|
+
{
|
|
343
|
+
id: {
|
|
344
|
+
type: 'Concrete',
|
|
345
|
+
value: {
|
|
346
|
+
parents: 1,
|
|
347
|
+
interior: { type: 'Here' },
|
|
348
|
+
},
|
|
349
|
+
},
|
|
350
|
+
fun: {
|
|
351
|
+
type: 'Fungible',
|
|
352
|
+
value: TWO_TOKENS,
|
|
353
|
+
},
|
|
354
|
+
},
|
|
355
|
+
],
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
const weight: XcmV3WeightLimit = { type: 'Unlimited' };
|
|
359
|
+
|
|
360
|
+
api.tx.polkadotXcm
|
|
361
|
+
.limitedTeleportAssets(dest, beneficiary, assets, 0, weight)
|
|
362
|
+
.signAndSend(alice, { signer, tip: 1_000_000n }, (result) => {
|
|
363
|
+
console.dir(result, { depth: null });
|
|
364
|
+
});
|
|
365
|
+
```
|
|
366
|
+
</details>
|
|
367
|
+
|
|
368
|
+
|
|
302
369
|
### Events
|
|
303
370
|
|
|
304
|
-
Events for each pallet emit during runtime operations and are defined in the medata. Available events are also exposed in `ChainApi` interface so we can get information of an event through syntax `api.events.<pallet>.<eventName>`. E.g: Events for Polkadot network can be found [here](https://github.com/dedotdev/
|
|
371
|
+
Events for each pallet emit during runtime operations and are defined in the medata. Available events are also exposed in `ChainApi` interface so we can get information of an event through syntax `api.events.<pallet>.<eventName>`. E.g: Events for Polkadot network can be found [here](https://github.com/dedotdev/chaintypes/blob/main/packages/chaintypes/src/polkadot/events.d.ts), similarly for other network as well.
|
|
305
372
|
|
|
306
373
|
This `api.events` is helpful when we want quickly check if an event matches with an event that we're expecting in a list of events, the API also comes with type narrowing for the matched event, so event name & related data of the event are fully typed.
|
|
307
374
|
|
|
@@ -325,7 +392,7 @@ await api.query.system.events(async (eventRecords) => {
|
|
|
325
392
|
|
|
326
393
|
### Errors
|
|
327
394
|
|
|
328
|
-
Pallet errors are thrown out when things go wrong in the runtime, those are defined in the metadata. Available errors for each pallet are also exposed in `ChainApi` interface, so we can get information an error through this syntax: `api.errors.<pallet>.<errorName>`. E.g: Available errors for Polkadot network can be found [here](https://github.com/dedotdev/
|
|
395
|
+
Pallet errors are thrown out when things go wrong in the runtime, those are defined in the metadata. Available errors for each pallet are also exposed in `ChainApi` interface, so we can get information an error through this syntax: `api.errors.<pallet>.<errorName>`. E.g: Available errors for Polkadot network can be found [here](https://github.com/dedotdev/chaintypes/blob/main/packages/chaintypes/src/polkadot/errors.d.ts).
|
|
329
396
|
|
|
330
397
|
Similar to events API, this API is helpful when we want to check if an error maches with an error that we're expecting.
|
|
331
398
|
|
|
@@ -336,7 +403,7 @@ await api.query.system.events(async (eventRecords) => {
|
|
|
336
403
|
for (const tx of eventRecords) {
|
|
337
404
|
if (api.events.system.ExtrinsicFailed.is(tx.event)) {
|
|
338
405
|
const { dispatchError } = tx.event.palletEvent.data;
|
|
339
|
-
if (
|
|
406
|
+
if (api.errors.assets.AlreadyExists.is(dispatchError)) {
|
|
340
407
|
console.log('Assets.AlreadyExists error occurred!');
|
|
341
408
|
} else {
|
|
342
409
|
console.log('Other error occurred', dispatchError);
|
|
@@ -347,6 +414,86 @@ await api.query.system.events(async (eventRecords) => {
|
|
|
347
414
|
// ...
|
|
348
415
|
```
|
|
349
416
|
|
|
417
|
+
### Migration from `@polkadot/api` to `dedot`
|
|
418
|
+
`dedot` is inspired by `@polkadot/api`, so both are sharing some common patterns and api styling (eg: api syntax `api.<type>.<module>.<section>`). Although we have experimented some other different api stylings but to our findings and development experience, we find that the api style of `@polkadot/api` is very intuiative and easy to use. We decide the use a similar api styling with `@polkadot/api`, this also helps the migration from `@polkadot/api` to `dedot` easier & faster.
|
|
419
|
+
|
|
420
|
+
While the api style are similar, but there're also some differences you might need to be aware of when switching to use `dedot`.
|
|
421
|
+
|
|
422
|
+
**Initialize api client**
|
|
423
|
+
- `@polkadot/api`
|
|
424
|
+
```typescript
|
|
425
|
+
import { ApiPromise, WsProvider } from '@polkadot/api';
|
|
426
|
+
|
|
427
|
+
const api = await ApiPromise.create({ provider: new WsProvider('wss://rpc.polkadot.io') });
|
|
428
|
+
```
|
|
429
|
+
- `dedot`
|
|
430
|
+
|
|
431
|
+
```typescript
|
|
432
|
+
import { DedotClient, WsProvider } from 'dedot';
|
|
433
|
+
import type { PolkadotApi } from '@dedot/chaintypes';
|
|
434
|
+
|
|
435
|
+
const api = await DedotClient.new<PolkadotApi>(new WsProvider('wss://rpc.polkadot.io')); // or DedotClient.create(...) if you prefer
|
|
436
|
+
|
|
437
|
+
// OR
|
|
438
|
+
const api = await DedotClient.new<PolkadotApi>({ provider: new WsProvider('wss://rpc.polkadot.io') });
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
- Notes:
|
|
442
|
+
- `dedot` only supports provider can make subscription request (e.g: via Websocket).
|
|
443
|
+
- We recommend specifying the `ChainApi` interface (e.g: [`PolkadotApi`](https://github.com/dedotdev/chaintypes/blob/main/packages/chaintypes/src/polkadot/index.d.ts) in the example above) of the chain that you want to interact with. This enable apis & types suggestion/autocompletion for that particular chain (via IntelliSense). If you don't specify a `ChainApi` interface, the default [`SubstrateApi`](https://github.com/dedotdev/dedot/blob/a762faf8f6af40d3e4ef163bd538b270a5ca31e8/packages/chaintypes/src/substrate/index.d.ts) interface will be used.
|
|
444
|
+
- `WsProvider` from `dedot` and `@polkadot/api` are different, they cannot be used interchangeable.
|
|
445
|
+
|
|
446
|
+
**Type system**
|
|
447
|
+
|
|
448
|
+
Unlike `@polkadot/api` where data are wrapped inside a [codec types](https://polkadot.js.org/docs/api/start/types.basics), so we always need to unwrap the data before using it (e.g: via `.unwrap()`, `.toNumber()`, `.toString()`, `.toJSON()` ...). `dedot` leverages the native TypeScript type system to represent scale-codec types, so you can use the data directly without extra handling/unwrapping. The table below is a mapping between scale-codec types and TypeScript types that we're using for `dedot`:
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
| Scale Codec | TypeScript (`dedot`) |
|
|
452
|
+
|---------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|
|
|
453
|
+
| `u8`, `u16`, `u32`, `i8`, `i16`, `i32` | `number` |
|
|
454
|
+
| `u64`, `u128`, `u256`, `i64`, `i128`, `i256` | `bigint` (native [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt), not bn.js) |
|
|
455
|
+
| `bool` | `boolean` (true, false) |
|
|
456
|
+
| `Option<T>` | `T \| undefined` |
|
|
457
|
+
| `Result<Ok, Err>` | `{ isOk: true; isErr?: false; value: Ok } \| { isOk?: false; isErr: true; err: Err }` |
|
|
458
|
+
| `Vec<T>` | `Array<T>` |
|
|
459
|
+
| `str` | `string` |
|
|
460
|
+
| Tuple: `(A, B)`, `()` | `[A, B]`, `[]` |
|
|
461
|
+
| Struct: `struct { field_1: u8, field_2: str }` | `{ field_1: number, field_2: string}` |
|
|
462
|
+
| Enum: `enum { Variant1(u8), Variant2(bool), Variant3 }` | `{ type: 'Variant1', value: number } \| { type: 'Variant2', value: boolean } \| { type: 'Variant2' }` |
|
|
463
|
+
| FlatEnum: `enum { Variant1, Variant2 }` | `'Variant1' \| 'Variant2'` |
|
|
464
|
+
|
|
465
|
+
E.g 1:
|
|
466
|
+
```typescript
|
|
467
|
+
const runtimeVersion = api.consts.system.version;
|
|
468
|
+
|
|
469
|
+
// @polkadot/api
|
|
470
|
+
const specName: string = runtimeVersion.toJSON().specName; // OR runtimeVersion.specName.toString()
|
|
471
|
+
|
|
472
|
+
// dedot
|
|
473
|
+
const specName: string = runtimeVersion.specName;
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
E.g 2:
|
|
477
|
+
```typescript
|
|
478
|
+
const balance = await api.query.system.account(<address>);
|
|
479
|
+
|
|
480
|
+
// @polkadot/api
|
|
481
|
+
const freeBalance: bigint = balance.data.free.toBigInt();
|
|
482
|
+
|
|
483
|
+
// dedot
|
|
484
|
+
const freeBalance: bigint = balance.data.free;
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
E.g 3:
|
|
488
|
+
```typescript
|
|
489
|
+
// @polkadot/api
|
|
490
|
+
const proposalBondMaximum: bigint | undefined = api.consts.treasury.proposalBondMaximum.unwrapOr(undefined)?.toBigInt();
|
|
491
|
+
|
|
492
|
+
// dedot
|
|
493
|
+
const proposalBondMaximum: bigint | undefined = api.consts.treasury.proposalBondMaximum;
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
|
|
350
497
|
### Credit
|
|
351
498
|
|
|
352
499
|
`dedot` take a lot of inspirations from project [@polkadot/api](https://github.com/polkadot-js/api). A big thank to all the maintainers/contributors of this awesome library.
|
package/bin/dedot
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@dedot/api/chaintypes';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@dedot/api/chaintypes';
|
|
@@ -14,5 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("
|
|
18
|
-
__exportStar(require("./SubmittableResult"), exports);
|
|
17
|
+
__exportStar(require("@dedot/api/chaintypes"), exports);
|
|
@@ -14,6 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("
|
|
18
|
-
__exportStar(require("./known"), exports);
|
|
19
|
-
__exportStar(require("./ExtraSignedExtension"), exports);
|
|
17
|
+
__exportStar(require("@dedot/codecs"), exports);
|
|
@@ -14,11 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("
|
|
18
|
-
__exportStar(require("./RpcExecutor"), exports);
|
|
19
|
-
__exportStar(require("./ConstantExecutor"), exports);
|
|
20
|
-
__exportStar(require("./StorageQueryExecutor"), exports);
|
|
21
|
-
__exportStar(require("./ErrorExecutor"), exports);
|
|
22
|
-
__exportStar(require("./EventExecutor"), exports);
|
|
23
|
-
__exportStar(require("./RuntimeApiExecutor"), exports);
|
|
24
|
-
__exportStar(require("./TxExecutor"), exports);
|
|
17
|
+
__exportStar(require("@dedot/contracts"), exports);
|
package/cjs/index.js
CHANGED
|
@@ -10,14 +10,23 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
11
|
o[k2] = m[k];
|
|
12
12
|
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
13
25
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
26
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
27
|
};
|
|
16
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
__exportStar(require("
|
|
21
|
-
__exportStar(require("./extrinsic"), exports);
|
|
22
|
-
var rpc_provider_1 = require("@polkadot/rpc-provider");
|
|
23
|
-
Object.defineProperty(exports, "WsProvider", { enumerable: true, get: function () { return rpc_provider_1.WsProvider; } });
|
|
29
|
+
exports.$ = void 0;
|
|
30
|
+
exports.$ = __importStar(require("@dedot/shape"));
|
|
31
|
+
__exportStar(require("@dedot/api"), exports);
|
|
32
|
+
__exportStar(require("@dedot/providers"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("@dedot/runtime-specs"), exports);
|
|
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("
|
|
17
|
+
__exportStar(require("@dedot/shape"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("@dedot/types"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("@dedot/types/json-rpc"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("@dedot/utils"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@dedot/codecs';
|
package/codecs/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@dedot/codecs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@dedot/contracts';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@dedot/contracts';
|