@paraspell/sdk 8.16.0 → 9.0.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.
Files changed (2) hide show
  1. package/README.md +74 -75
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -185,6 +185,37 @@ await builder.disconnect()
185
185
  */
186
186
  ```
187
187
 
188
+ ##### Local transfers
189
+ ```ts
190
+ const builder = Builder(/*node api/ws_url_string/ws_url_array - optional*/)
191
+ .from(NODE)
192
+ .to(NODE) //Has to be same as origin (from)
193
+ .currency({id: currencyID, amount: amount} | {symbol: currencySymbol, amount: amount} | {symbol: Native('currencySymbol'), amount: amount} | {symbol: Foreign('currencySymbol'), amount: amount} | {symbol: ForeignAbstract('currencySymbol'), amount: amount} | {multilocation: AssetMultilocationString, amount: amount | AssetMultilocationJson, amount: amount} | {multilocation: Override('Custom Multilocation'), amount: amount} | {multiasset: {currencySelection, isFeeAsset?: true /* for example symbol: symbol or id: id, or multilocation: multilocation*/, amount: amount}})
194
+ .address(address)
195
+
196
+ const tx = await builder.build()
197
+
198
+ //Make sure to disconnect API after it is no longer used (eg. after transaction)
199
+ await builder.disconnect()
200
+
201
+ /*
202
+ EXAMPLE:
203
+ const builder = Builder()
204
+ .from('Hydration')
205
+ .to('Hydration')
206
+ .currency({
207
+ symbol: 'DOT',
208
+ amount: '1000000000'
209
+ })
210
+ .address(address)
211
+
212
+ const tx = await builder.build()
213
+
214
+ //Disconnect API after TX
215
+ await builder.disconnect()
216
+ */
217
+ ```
218
+
188
219
  ##### Batch calls
189
220
  You can batch XCM calls and execute multiple XCM calls within one call. All three scenarios (Para->Para, Para->Relay, Relay->Para) can be used and combined.
190
221
  ```js
@@ -210,6 +241,21 @@ const tx = await builder.buildBatch({
210
241
  await builder.disconnect()
211
242
  ```
212
243
 
244
+ ##### Asset claim:
245
+ ```ts
246
+ //Claim XCM trapped assets from the selected chain
247
+ const builder = Builder(/*node api/ws_url_string/ws_url_array - optional*/)
248
+ .claimFrom(NODE)
249
+ .fungible(MultilocationArray (Only one multilocation allowed) [{Multilocation}])
250
+ .account(address | Multilocation object)
251
+ /*.xcmVersion(Version.V3) Optional parameter, by default V3. XCM Version ENUM if a different XCM version is needed (Supported V2 & V3). Requires importing Version enum.*/
252
+
253
+ const tx = await builder.build()
254
+
255
+ //Make sure to disconnect API after it is no longer used (eg. after transaction)
256
+ await builder.disconnect()
257
+ ```
258
+
213
259
  ### Dry run your XCM Calls:
214
260
  ```ts
215
261
  //Builder pattern
@@ -264,51 +310,43 @@ const fee = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
264
310
  .getXcmFeeEstimate()
265
311
  ```
266
312
 
267
-
268
- ### Asset claim:
313
+ ### XCM Transfer info
269
314
  ```ts
270
- //Claim XCM trapped assets from the selected chain
271
- const builder = Builder(/*node api/ws_url_string/ws_url_array - optional*/)
272
- .claimFrom(NODE)
273
- .fungible(MultilocationArray (Only one multilocation allowed) [{Multilocation}])
274
- .account(address | Multilocation object)
275
- /*.xcmVersion(Version.V3) Optional parameter, by default V3. XCM Version ENUM if a different XCM version is needed (Supported V2 & V3). Requires importing Version enum.*/
315
+ import { getAssetBalance, getTransferInfo, getOriginFeeDetails, getTransferableAmount, getParaEthTransferFees, verifyEdOnDestination } from "@paraspell/sdk";
276
316
 
277
- const tx = await builder.build()
317
+ //Get fee information regarding XCM call
318
+ await getOriginFeeDetails({from, to, currency /*- {id: currencyID} | {symbol: currencySymbol} | {symbol: Native('currencySymbol')} | {symbol: Foreign('currencySymbol')} | {symbol: ForeignAbstract('currencySymbol')} | {multilocation: AssetMultilocationString | AssetMultilocationJson}*/, amount, originAddress, destinationAddress, ahAddress /* optional parameter when destination is Ethereum and origin is Parachain other than AssetHub*/, api /* api/ws_url_string optional */, feeMargin /* 10% by default */})
278
319
 
279
- //Make sure to disconnect API after it is no longer used (eg. after transaction)
280
- await builder.disconnect()
281
- ```
320
+ //Retrieves the asset balance for a given account on a specified node. (You do not need to specify if it is native or foreign).
321
+ await getAssetBalance({address, node, currency /*- {id: currencyID} | {symbol: currencySymbol} | {symbol: Native('currencySymbol')} | {symbol: Foreign('currencySymbol')} | {symbol: ForeignAbstract('currencySymbol')} | {multilocation: AssetMultilocationString | AssetMultilocationJson}*/, api /* api/ws_url_string optional */});
282
322
 
283
- ### Local transfers
284
- ```ts
285
- const builder = Builder(/*node api/ws_url_string/ws_url_array - optional*/)
286
- .from(NODE)
287
- .to(NODE) //Has to be same as origin (from)
288
- .currency({id: currencyID, amount: amount} | {symbol: currencySymbol, amount: amount} | {symbol: Native('currencySymbol'), amount: amount} | {symbol: Foreign('currencySymbol'), amount: amount} | {symbol: ForeignAbstract('currencySymbol'), amount: amount} | {multilocation: AssetMultilocationString, amount: amount | AssetMultilocationJson, amount: amount} | {multilocation: Override('Custom Multilocation'), amount: amount} | {multiasset: {currencySelection, isFeeAsset?: true /* for example symbol: symbol or id: id, or multilocation: multilocation*/, amount: amount}})
289
- .address(address)
323
+ //Combines the getMaxNative and getMaxForeign transferable amount functions into one, so you don't have to specify whether you want a native or foreign asset.
324
+ await getTransferableAmount({address, node, currency /*- {id: currencyID} | {symbol: currencySymbol} | {symbol: Native('currencySymbol')} | {symbol: Foreign('currencySymbol')} | {symbol: ForeignAbstract('currencySymbol')} | {multilocation: AssetMultilocationString | AssetMultilocationJson}*/});
290
325
 
291
- const tx = await builder.build()
326
+ //Get all the information about XCM transfer
327
+ await getTransferInfo({from, to, address, destinationAddress, currency /*- {id: currencyID} | {symbol: currencySymbol} | {symbol: Native('currencySymbol')} | {symbol: Foreign('currencySymbol')} | {symbol: ForeignAbstract('currencySymbol')} | {multilocation: AssetMultilocationString | AssetMultilocationJson}*/, amount, api /* api/ws_url_string optional */})
292
328
 
293
- //Make sure to disconnect API after it is no longer used (eg. after transaction)
294
- await builder.disconnect()
329
+ //Get bridge and execution fee for transfer from Parachain to Ethereum. Returns as an object of 2 values - [bridgeFee, executionFee]
330
+ await getParaEthTransferFees(/*api - optional (Can also be WS port string or array o WS ports. Must be AssetHubPolkadot WS!)*/)
295
331
 
296
- /*
297
- EXAMPLE:
298
- const builder = Builder()
299
- .from('Hydration')
300
- .to('Hydration')
301
- .currency({
302
- symbol: 'DOT',
303
- amount: '1000000000'
304
- })
305
- .address(address)
332
+ //Verify whether XCM message you wish to send will reach above existential deposit on destination chain.
333
+ await verifyEdOnDestination(node, currency: {symbol: || id: || multilocation: .. ,amount: 100000n}, address)
334
+ ```
306
335
 
307
- const tx = await builder.build()
336
+ ### Existential deposit queries
337
+ ```ts
338
+ import { getExistentialDeposit } from "@paraspell/sdk";
308
339
 
309
- //Disconnect API after TX
310
- await builder.disconnect()
311
- */
340
+ //Currency is an optional parameter. If you wish to query native asset, currency parameter is not necessary.
341
+ //Currency can be either {symbol: assetSymbol}, {id: assetId}, {multilocation: assetMultilocation}.
342
+ const ed = getExistentialDeposit(node, currency?)
343
+ ```
344
+
345
+ ### Convert SS58 address
346
+ ```ts
347
+ import { convertSs58 } from "@paraspell/sdk";
348
+
349
+ let result = convertSs58(address, node) // returns converted address in string
312
350
  ```
313
351
 
314
352
  ### Asset queries:
@@ -373,45 +411,6 @@ getPalletIndex(node: TNode)
373
411
  console.log(SUPPORTED_PALLETS)
374
412
  ```
375
413
 
376
- ### Existential deposit queries
377
- ```ts
378
- import { getExistentialDeposit } from "@paraspell/sdk";
379
-
380
- //Currency is an optional parameter. If you wish to query native asset, currency parameter is not necessary.
381
- //Currency can be either {symbol: assetSymbol}, {id: assetId}, {multilocation: assetMultilocation}.
382
- const ed = getExistentialDeposit(node, currency?)
383
- ```
384
-
385
- ### Convert SS58 address
386
- ```ts
387
- import { convertSs58 } from "@paraspell/sdk";
388
-
389
- let result = convertSs58(address, node) // returns converted address in string
390
- ```
391
-
392
- ### XCM Transfer info
393
- ```ts
394
- import { getAssetBalance, getTransferInfo, getOriginFeeDetails, getTransferableAmount, getParaEthTransferFees, verifyEdOnDestination } from "@paraspell/sdk";
395
-
396
- //Get fee information regarding XCM call
397
- await getOriginFeeDetails({from, to, currency /*- {id: currencyID} | {symbol: currencySymbol} | {symbol: Native('currencySymbol')} | {symbol: Foreign('currencySymbol')} | {symbol: ForeignAbstract('currencySymbol')} | {multilocation: AssetMultilocationString | AssetMultilocationJson}*/, amount, originAddress, destinationAddress, ahAddress /* optional parameter when destination is Ethereum and origin is Parachain other than AssetHub*/, api /* api/ws_url_string optional */, feeMargin /* 10% by default */})
398
-
399
- //Retrieves the asset balance for a given account on a specified node. (You do not need to specify if it is native or foreign).
400
- await getAssetBalance({address, node, currency /*- {id: currencyID} | {symbol: currencySymbol} | {symbol: Native('currencySymbol')} | {symbol: Foreign('currencySymbol')} | {symbol: ForeignAbstract('currencySymbol')} | {multilocation: AssetMultilocationString | AssetMultilocationJson}*/, api /* api/ws_url_string optional */});
401
-
402
- //Combines the getMaxNative and getMaxForeign transferable amount functions into one, so you don't have to specify whether you want a native or foreign asset.
403
- await getTransferableAmount({address, node, currency /*- {id: currencyID} | {symbol: currencySymbol} | {symbol: Native('currencySymbol')} | {symbol: Foreign('currencySymbol')} | {symbol: ForeignAbstract('currencySymbol')} | {multilocation: AssetMultilocationString | AssetMultilocationJson}*/});
404
-
405
- //Get all the information about XCM transfer
406
- await getTransferInfo({from, to, address, destinationAddress, currency /*- {id: currencyID} | {symbol: currencySymbol} | {symbol: Native('currencySymbol')} | {symbol: Foreign('currencySymbol')} | {symbol: ForeignAbstract('currencySymbol')} | {multilocation: AssetMultilocationString | AssetMultilocationJson}*/, amount, api /* api/ws_url_string optional */})
407
-
408
- //Get bridge and execution fee for transfer from Parachain to Ethereum. Returns as an object of 2 values - [bridgeFee, executionFee]
409
- await getParaEthTransferFees(/*api - optional (Can also be WS port string or array o WS ports. Must be AssetHubPolkadot WS!)*/)
410
-
411
- //Verify whether XCM message you wish to send will reach above existential deposit on destination chain.
412
- await verifyEdOnDestination(node, currency: {symbol: || id: || multilocation: .. ,amount: 100000n}, address)
413
- ```
414
-
415
414
  ## 💻 Tests
416
415
  - Run compilation using `pnpm compile`
417
416
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk",
3
- "version": "8.16.0",
3
+ "version": "9.0.0",
4
4
  "description": "SDK for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,7 +27,7 @@
27
27
  "ethers": "^6.13.7",
28
28
  "quick-lru": "^7.0.1",
29
29
  "viem": "^2.28.1",
30
- "@paraspell/sdk-core": "8.16.0"
30
+ "@paraspell/sdk-core": "9.0.0"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "polkadot-api": ">= 1.10.2 < 2"