@paraspell/sdk 2.0.6 → 3.0.1

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 CHANGED
@@ -1,53 +1,26 @@
1
-
2
-
3
-
4
1
  # @paraspell/sdk
5
2
 
6
3
  ![Full name (3)](https://user-images.githubusercontent.com/55763425/197985791-fc7afa52-061d-413a-bbe9-bf1123f16a50.png)
7
4
 
8
-
9
-
10
-
11
-
12
5
  [![npm version][npm-version-src]][npm-version-href]
13
6
 
14
-
15
-
16
7
  [![npm downloads][npm-downloads-src]][npm-downloads-href]
17
8
 
18
-
19
-
20
9
  [![Known Vulnerabilities](https://snyk.io/test/github/paraspell/sdk/badge.svg)](https://snyk.io/test/github/paraspell/sdk)
21
10
 
22
-
23
-
24
- 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 🧙✨.
11
+ 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 a magician and try your paraSPELLS 🧙✨.
25
12
 
26
-
27
-
28
- ##### Currently supporting 44 Polkadot & Kusama nodes list [here](https://github.com/paraspell/sdk/blob/main/docs/supportedNodes.md).
29
-
30
-
13
+ ##### Currently supporting 48 Polkadot & Kusama nodes list [here](https://github.com/paraspell/sdk/blob/main/docs/supportedNodes.md).
31
14
 
32
15
  ### Check out our brand new Wiki documentation! [Wiki docs](https://paraspell.github.io/docs/)
33
16
 
34
-
35
-
36
17
  ## Usage
37
18
 
38
-
39
-
40
-
41
-
42
19
  **Install package:**
43
20
 
44
-
45
-
46
21
  #### Since version 1.0.0
47
22
 
48
- Our SDK introduced all Polkadot libraries as peer dependencies. Reason for this is, that most of the projects use these libraries in some way already and it fixes issues with unmet dependency warnings. Make sure your project have them. You can install them by following command:
49
-
50
-
23
+ Our SDK introduced all Polkadot libraries as peer dependencies. The reason for this is, that most of the projects use these libraries in some way already and it fixes issues with unmet dependency warnings. Make sure your project has them. You can install them by following the command:
51
24
 
52
25
  ##### Install DEPS via npm||yarn||pnpm
53
26
 
@@ -70,45 +43,36 @@ yarn install @paraspell/sdk
70
43
  //pnpm
71
44
  pnpm install @paraspell/sdk
72
45
  ```
73
- ##### Importing package to your project:
74
46
 
75
-
47
+ ##### Importing package to your project:
76
48
 
77
- If you wish to use XCM, HRMP, XYK Pallets only you can import Builder like this:
49
+ If you wish to use XCM, HRMP and XYK Pallets only you can import Builder like this:
78
50
 
79
51
  ```js
80
- import { Builder } from '@paraspell/sdk'
52
+ import { Builder } from '@paraspell/sdk'
81
53
  ```
82
54
 
83
-
84
-
85
55
  Old function like import (With assets):
86
56
 
87
57
  ```js
88
58
  // ESM
89
- import * as paraspell from '@paraspell/sdk'
59
+ import * as paraspell from '@paraspell/sdk'
90
60
 
91
61
  // CommonJS
92
- const paraspell = require('@paraspell/sdk')
62
+ const paraspell = require('@paraspell/sdk')
93
63
  ```
94
64
 
95
-
96
-
97
-
98
-
99
65
  ## Currently implemented pallets
100
66
 
101
67
  XCM pallet (Combined xTokens, polkadotXCM, ormlXTokens, XcmPallet & relayerXCM):
102
68
 
103
-
104
-
105
69
  Builder pattern XCM & HRMP construction
106
70
 
107
71
  ```ts
108
72
  //Transfer tokens from Parachain to Parachain
109
73
  Builder(api).from(NODE).to(NODE).currency(CurrencyString||CurrencyID).amount(amount).address(address).build()
110
74
 
111
- //Transfer tokens from Relay chain to Parachain
75
+ //Transfer tokens from the Relay chain to Parachain
112
76
  Builder(api).to(NODE).amount(amount).address(address).build()
113
77
 
114
78
  //Transfer tokens from Parachain to Relay chain
@@ -121,8 +85,6 @@ Builder(api).from(NODE).closeChannel().inbound(inbound).outbound(outbound).build
121
85
  Builder(api).from(NODE).to(NODE).openChannel().maxSize(maxSize).maxMessageSize(maxMsgSize).build()'
122
86
  ```
123
87
 
124
-
125
-
126
88
  Function pattern XCM & HRMP construction
127
89
 
128
90
  ```ts
@@ -144,30 +106,28 @@ paraspell.closeChannels.closeChannel(api: ApiPromise, origin: origin Parachain
144
106
  paraspell.openChannels.openChannel(api: ApiPromise, origin: origin Parachain ID, destination: destination Parachain ID, maxSize: number, maxMessageSize: number)
145
107
  ```
146
108
 
147
- Asset pallet contruction:
148
-
149
-
109
+ Asset pallet construction:
150
110
 
151
111
  ```ts
152
112
  //Returns assets object from assets.json for particular node including information about native and foreign assets
153
113
  paraspell.assets.getAssetsObject(node: TNode)
154
114
 
155
- //Returns foreign assetId for particular node and asset symbol
115
+ //Returns foreign assetId for a particular node and asset symbol
156
116
  paraspell.assets.getAssetId(node: TNode, symbol: string)
157
117
 
158
- //Returns symbol of the relay chain for particular node. Either "DOT" or "KSM"
118
+ //Returns the symbol of the relay chain for a particular node. Either "DOT" or "KSM"
159
119
  paraspell.assets.getRelayChainSymbol(node: TNode)
160
120
 
161
121
  //Returns string array of native assets symbols for particular node
162
122
  paraspell.assets.getNativeAssets(node: TNode)
163
123
 
164
- //Returns object array of foreign assets for particular node. Each object has symbol and assetId property
124
+ //Returns object array of foreign assets for a particular node. Each object has a symbol and assetId property
165
125
  paraspell.assets.getOtherAssets(node: TNode)
166
126
 
167
- //Returns string array of all assets symbols. (native and foreign assets are merged to a single array)
127
+ //Returns string array of all assets symbols. (native and foreign assets are merged into a single array)
168
128
  paraspell.assets.getAllAssetsSymbols(node: TNode)
169
129
 
170
- //Checks if node supports particular asset. (Both native and foreign assets are searched). Returns boolean
130
+ //Checks if a node supports a particular asset. (Both native and foreign assets are searched). Returns boolean
171
131
  paraspell.assets.hasSupportForAsset(node: TNode, symbol: string)
172
132
 
173
133
  //Get decimals for specific asset
@@ -183,30 +143,28 @@ paraspell.assets.getTNode(nodeID: number)
183
143
  paraspell.NODE_NAMES
184
144
  ```
185
145
 
186
- Basilisk XYK pallet contruction
187
-
188
-
146
+ Basilisk XYK pallet construction
189
147
 
190
- Builder patternn XYK construction
148
+ Builder pattern XYK construction
191
149
 
192
150
  ```ts
193
- //Add liquidity to specific pool
151
+ //Add liquidity to a specific pool
194
152
  Builder(api).addLiquidity().assetA(assetA).assetB(assetB).amountA(amountA).amountBMaxLimit(maxLimit).build()
195
153
 
196
- //Remove liquidity from specific pool
154
+ //Remove liquidity from a specific pool
197
155
  Builder(api).removeLiquidity().assetA(assetA).assetB(assetB).liquidityAmount(liquidity).build()
198
156
 
199
157
  //Create pool
200
158
  Builder(api).createPool().assetA(assetA).amountA(amountA).assetB(assetB).amountB(amountB).build()
201
159
 
202
- //Buy specific asset from pool
160
+ //Buy specific asset from the pool
203
161
  Builder(api).buy().assetOut(out).assetIn(in).amount(amount).maxLimit(maxLimit).discount(discount).build()
204
162
 
205
- //Sell specific asset from pool
163
+ //Sell specific asset from the pool
206
164
  Builder(api).sell().assetIn(in).assetOut(out).amount(amount).maxLimit(maxLimit).discount(discount).build()
207
165
  ```
208
166
 
209
- Function pattern XYK contruction
167
+ Function pattern XYK construction
210
168
 
211
169
  ```ts
212
170
  //Add liquidity to specific pool
@@ -233,7 +191,7 @@ import { getDefaultPallet, getSupportedPallets, SUPPORTED_PALLETS } from '@para
233
191
  //Returns default pallet for specific parachain node
234
192
  getDefaultPallet(node: TNode)
235
193
 
236
- //Returns an array of supported pallets for specific parachain node.
194
+ //Returns an array of supported pallets for a specific parachain node.
237
195
  getSupportedPallets(node: TNode)
238
196
 
239
197
  //Prints all pallets that are currently supported
@@ -242,7 +200,7 @@ console.log(SUPPORTED_PALLETS)
242
200
 
243
201
  ##### Example of usage can be found in the UI repository [here](https://github.com/paraspell/ui) or in the Astarot repository [here](https://github.com/paraspell/astarot)
244
202
 
245
- ##### List of currently compatible nodes can be found [here](https://github.com/paraspell/sdk/blob/beta-pre-release/docs/supportedNodes.md)
203
+ ##### A list of currently compatible nodes can be found [here](https://github.com/paraspell/sdk/blob/beta-pre-release/docs/supportedNodes.md)
246
204
 
247
205
  ## 💻 Development
248
206
 
@@ -262,7 +220,7 @@ console.log(SUPPORTED_PALLETS)
262
220
 
263
221
  - Run updatePallets script using `pnpm updatePallets`
264
222
 
265
- - Run coverage tests usign `pnpm test`
223
+ - Run coverage tests using `pnpm test`
266
224
 
267
225
  - Run all tests using `pnpm runAll`
268
226
 
@@ -276,61 +234,19 @@ console.log(SUPPORTED_PALLETS)
276
234
 
277
235
  [![logo-v1](https://user-images.githubusercontent.com/55763425/204865221-90d2b3cd-f2ac-48a2-a367-08722aa8e923.svg)](https://bsx.fi/)
278
236
 
279
-
280
-
281
-
282
237
  ## License
283
238
 
284
-
285
-
286
239
  Made with 💛 by [ParaSpell✨](https://github.com/paraspell)
287
240
 
288
-
289
-
290
-
291
-
292
241
  Published under [MIT License](https://github.com/paraspell/sdk/blob/main/LICENSE).
293
242
 
294
-
295
-
296
-
297
-
298
243
  <!-- Badges -->
299
244
 
300
-
301
-
302
245
  [npm-version-src]: https://img.shields.io/npm/v/@paraspell/sdk?style=flat-square
303
-
304
-
305
-
306
246
  [npm-version-href]: https://npmjs.com/package/@paraspell/sdk
307
-
308
-
309
-
310
-
311
-
312
247
  [npm-downloads-src]: https://img.shields.io/npm/dm/@paraspell/sdk?style=flat-square
313
-
314
-
315
-
316
248
  [npm-downloads-href]: https://npmjs.com/package/@paraspell/sdk
317
-
318
-
319
-
320
-
321
-
322
249
  [github-actions-src]: https://img.shields.io/github/workflow/status/unjs/@paraspell/sdk/ci/main?style=flat-square
323
-
324
-
325
-
326
250
  [github-actions-href]: https://github.com/unjs/@paraspell/sdk/actions?query=workflow%3Aci
327
-
328
-
329
-
330
-
331
-
332
251
  [codecov-src]: https://img.shields.io/codecov/c/gh/unjs/@paraspell/sdk/main?style=flat-square
333
-
334
-
335
-
336
252
  [codecov-href]: https://codecov.io/gh/unjs/@paraspell/sdk