@paraspell/sdk 0.0.11 → 0.0.13
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 +114 -28
- package/dist/index.cjs +2818 -139
- package/dist/index.d.ts +53 -20
- package/dist/index.mjs +2818 -138
- package/package.json +12 -4
package/README.md
CHANGED
|
@@ -1,80 +1,166 @@
|
|
|
1
|
+
|
|
1
2
|
# @paraspell/sdk
|
|
2
3
|
|
|
4
|
+
|
|
5
|
+
|
|
3
6
|
[![npm version][npm-version-src]][npm-version-href]
|
|
7
|
+
|
|
4
8
|
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
5
|
-
[![Github Actions][github-actions-src]][github-actions-href]
|
|
6
|
-
[![Codecov][codecov-src]][codecov-href]
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
[](https://snyk.io/test/github/paraspell/sdk)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
SDK For XCM & XCMP handling made with ❤️ by ParaSpell✨. It is no longer necessary to construct calls manually. @paraspell/sdk handles this for you. Feel free to become magician and try your paraSPELLS 🧙✨.
|
|
14
|
+
|
|
15
|
+
##### Currently supporting 42 Polkadot & Kusama nodes list [here](https://github.com/paraspell/sdk/blob/beta-pre-release/docs/supportedNodes.md).
|
|
16
|
+
|
|
17
|
+
|
|
9
18
|
|
|
10
19
|
## Usage
|
|
11
20
|
|
|
21
|
+
|
|
22
|
+
|
|
12
23
|
Install package:
|
|
13
24
|
|
|
14
|
-
|
|
15
|
-
# npm
|
|
16
|
-
npm install @paraspell/sdk
|
|
25
|
+
|
|
17
26
|
|
|
18
|
-
|
|
27
|
+
##### Install via npm
|
|
28
|
+
```
|
|
29
|
+
npm install @paraspell/sdk
|
|
30
|
+
```
|
|
31
|
+
##### Install via yarn
|
|
32
|
+
```
|
|
19
33
|
yarn install @paraspell/sdk
|
|
20
|
-
|
|
21
|
-
|
|
34
|
+
```
|
|
35
|
+
##### Install via pnpm
|
|
36
|
+
```
|
|
22
37
|
pnpm install @paraspell/sdk
|
|
23
38
|
```
|
|
24
39
|
|
|
25
|
-
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
##### Importing package to your project:
|
|
26
43
|
|
|
44
|
+
|
|
27
45
|
```js
|
|
46
|
+
|
|
28
47
|
// ESM
|
|
29
|
-
import
|
|
48
|
+
import * as paraspell from '@paraspell/sdk'
|
|
30
49
|
|
|
31
50
|
// CommonJS
|
|
32
|
-
const
|
|
51
|
+
const paraspell = require('@paraspell/sdk')
|
|
52
|
+
|
|
33
53
|
```
|
|
34
54
|
|
|
55
|
+
|
|
56
|
+
|
|
35
57
|
## Currently implemented pallets
|
|
58
|
+
|
|
36
59
|
```ts
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
60
|
+
|
|
61
|
+
//XCM pallet (Combined xTokens, polkadotXCM, ormlXTokens, XcmPallet & relayerXCM):
|
|
62
|
+
|
|
63
|
+
//Transfer tokens from Parachain to Parachain
|
|
64
|
+
paraspell.xcmPallet.send(api: ApiPromise, origin: origin Parachain name string, currency: currency symbol string, currencyID: number (If applicable), amount: any, to: destination address string, destination: destination Parachain ID)
|
|
65
|
+
|
|
66
|
+
//Transfer tokens from Parachain to Relay chain
|
|
67
|
+
paraspell.xcmPallet.send(api: ApiPromise, origin: origin Parachain name string, currency: currency symbol string, currencyID: number (If applicable), amount: any, to: destination address string)
|
|
68
|
+
|
|
69
|
+
//Transfer tokens from Relay chain to Parachain
|
|
70
|
+
paraspell.xcmPallet.transferRelayToPara(api: ApiPromise, destination: destination Parachain ID, amount: any, to: destination address string)
|
|
71
|
+
|
|
72
|
+
//Transfer tokens from Relay chain to Parachain /w specific limit
|
|
73
|
+
paraspell.xcmPallet.limitedTransferRelayToPara(api,destParaID,amount,destinationAddress,yourWeight,true)
|
|
74
|
+
|
|
75
|
+
|
|
41
76
|
//hrmp pallet:
|
|
42
|
-
|
|
77
|
+
|
|
78
|
+
//Close HRMP channels
|
|
79
|
+
paraspell.closeChannels.closeChannel(api: ApiPromise, origin: origin Parachain ID, inbound: number, outbound: number)
|
|
80
|
+
|
|
81
|
+
|
|
43
82
|
//parasSudoWrapper pallet:
|
|
44
|
-
paraspell.openChannels.openChannel(api: ApiPromise, origin: origin Parachain ID, destination: destination Parachain ID, maxSize: number, maxMessageSize: number)
|
|
45
83
|
|
|
84
|
+
//Open HRMP channels
|
|
85
|
+
paraspell.openChannels.openChannel(api: ApiPromise, origin: origin Parachain ID, destination: destination Parachain ID, maxSize: number, maxMessageSize: number)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
//Asset pallet
|
|
89
|
+
|
|
90
|
+
//Returns assets object from assets.json for particular node including information about native and foreign assets
|
|
91
|
+
paraspell.getAssetsObject(node: TNode)
|
|
92
|
+
|
|
93
|
+
//Returns foreign assetId for particular node and asset symbol
|
|
94
|
+
paraspell.getAssetId(node: TNode, symbol: string)
|
|
95
|
+
|
|
96
|
+
//Returns symbol of the relay chain for particular node. Either "DOT" or "KSM"
|
|
97
|
+
paraspell.getRelayChainSymbol(node: TNode)
|
|
98
|
+
|
|
99
|
+
//Returns string array of native assets symbols for particular node
|
|
100
|
+
paraspell.getNativeAssets(node: TNode)
|
|
101
|
+
|
|
102
|
+
//Returns object array of foreign assets for particular node. Each object has symbol and assetId property
|
|
103
|
+
paraspell.getOtherAssets(node: TNode)
|
|
104
|
+
|
|
105
|
+
//Returns string array of all assets symbols. (native and foreign assets are merged to a single array)
|
|
106
|
+
paraspell.getAllAssetsSymbols(node: TNode)
|
|
107
|
+
|
|
108
|
+
//Checks if node supports particular asset. (Both native and foreign assets are searched). Returns boolean
|
|
109
|
+
paraspell.hasSupportForAsset(node: TNode, symbol: string)
|
|
46
110
|
```
|
|
47
|
-
|
|
111
|
+
|
|
112
|
+
##### Example of usage can be found in the UI repository [here](https://github.com/paraspell/ui)
|
|
113
|
+
##### List of currently compatible nodes can be found [here](https://github.com/paraspell/sdk/blob/beta-pre-release/docs/supportedNodes.md)
|
|
114
|
+
|
|
115
|
+
|
|
48
116
|
|
|
49
117
|
## 💻 Development
|
|
50
118
|
|
|
119
|
+
|
|
120
|
+
|
|
51
121
|
- Clone this repository
|
|
122
|
+
|
|
52
123
|
- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable` (use `npm i -g corepack` for Node.js < 16.10)
|
|
124
|
+
|
|
53
125
|
- Install dependencies using `pnpm install`
|
|
126
|
+
|
|
54
127
|
- Run interactive tests using `pnpm dev`
|
|
55
128
|
|
|
56
|
-
##
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
```
|
|
61
|
-
pnpm test
|
|
62
|
-
```
|
|
129
|
+
## Founded by
|
|
130
|
+
[](https://bsx.fi/)
|
|
131
|
+
|
|
132
|
+
|
|
63
133
|
|
|
64
134
|
## License
|
|
65
|
-
Made with 💛
|
|
66
135
|
|
|
67
|
-
|
|
136
|
+
Made with 💛 by [ParaSpell✨](https://github.com/paraspell)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
Published under [MIT License](https://github.com/paraspell/sdk/blob/main/LICENSE).
|
|
141
|
+
|
|
142
|
+
|
|
68
143
|
|
|
69
144
|
<!-- Badges -->
|
|
145
|
+
|
|
70
146
|
[npm-version-src]: https://img.shields.io/npm/v/@paraspell/sdk?style=flat-square
|
|
147
|
+
|
|
71
148
|
[npm-version-href]: https://npmjs.com/package/@paraspell/sdk
|
|
72
149
|
|
|
150
|
+
|
|
151
|
+
|
|
73
152
|
[npm-downloads-src]: https://img.shields.io/npm/dm/@paraspell/sdk?style=flat-square
|
|
153
|
+
|
|
74
154
|
[npm-downloads-href]: https://npmjs.com/package/@paraspell/sdk
|
|
75
155
|
|
|
156
|
+
|
|
157
|
+
|
|
76
158
|
[github-actions-src]: https://img.shields.io/github/workflow/status/unjs/@paraspell/sdk/ci/main?style=flat-square
|
|
159
|
+
|
|
77
160
|
[github-actions-href]: https://github.com/unjs/@paraspell/sdk/actions?query=workflow%3Aci
|
|
78
161
|
|
|
162
|
+
|
|
163
|
+
|
|
79
164
|
[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/@paraspell/sdk/main?style=flat-square
|
|
165
|
+
|
|
80
166
|
[codecov-href]: https://codecov.io/gh/unjs/@paraspell/sdk
|