@paraspell/sdk 12.10.0-rc.2 → 13.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 +58 -29
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -201,9 +201,9 @@ const builder = Builder(/*client | builder_config |ws_url | [ws_url, ws_url,..]
201
201
  .sender(address | PAPI_SIGNER /*Only in PAPI SDK*/ | {address, PJS_SIGNER} /*Only in PJS SDK*/) // - OPTIONAL but strongly recommended as it is automatically ignored when not needed - Used when origin is AssetHub/Hydration with feeAsset or when sending to AssetHub to prevent asset traps by auto-swapping to DOT to have DOT ED.
202
202
  .swap({
203
203
  currencyTo: {id: currencyID, amount: amount /*Use "ALL" to transfer everything*/} | {symbol: currencySymbol, amount: amount /*Use "ALL" to transfer everything*/} | {symbol: Native('currencySymbol'), amount: amount /*Use "ALL" to transfer everything*/} | {symbol: Foreign('currencySymbol'), amount: amount /*Use "ALL" to transfer everything*/} | {symbol: ForeignAbstract('currencySymbol'), amount: amount /*Use "ALL" to transfer everything*/} | {location: AssetLocationString, amount: amount /*Use "ALL" to transfer everything*/ | AssetLocationJson, amount: amount /*Use "ALL" to transfer everything*/} | {location: Override('Custom Location'), amount: amount /*Use "ALL" to transfer everything*/}
204
- // exchange: ['AssetHubPolkadotDex'], - Optional parameter - 'HydrationDex' | 'AcalaDex' | 'AssetHubPolkadotDex' | ...
204
+ // exchange: ['AssetHubPolkadot'], - Optional parameter - 'Hydration' | 'Acala' | 'AssetHubPolkadot' | ...
205
205
  // slippage: 1, - Optional - 1 by default
206
- // evmsender: '0x000', - Optional parameter when origin CHAIN is EVM based (Required with evmSigner)
206
+ // evmSenderAddress: '0x000', - Optional parameter when origin CHAIN is EVM based (Required with evmSigner)
207
207
  // evmSigner: Signer, - Optional parameter when origin CHAIN is EVM based (Required with evmInjectorAddress)
208
208
  // onStatusChange: (event) => void - Optional parameter for callback events when sender address is supplied as signer
209
209
  })
@@ -228,9 +228,9 @@ const result = await Builder(/*chain api/builder_config/ws_url_string/ws_url_arr
228
228
  /*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.
229
229
  .swap({
230
230
  currencyTo: CURRENCY_SPEC, //Reffer to currency spec options above
231
- // exchange: ['AssetHubPolkadotDex'], - Optional parameter - 'HydrationDex' | 'AcalaDex' | 'AssetHubPolkadotDex' | ...
231
+ // exchange: ['AssetHubPolkadot'], - Optional parameter - 'Hydration' | 'Acala' | 'AssetHubPolkadot' | ...
232
232
  // slippage: 1, - Optional - 1 by default
233
- // evmsender: '0x000', - Optional parameter when origin CHAIN is EVM based (Required with evmSigner)
233
+ // evmSenderAddress: '0x000', - Optional parameter when origin CHAIN is EVM based (Required with evmSigner)
234
234
  // evmSigner: Signer, - Optional parameter when origin CHAIN is EVM based (Required with evmInjectorAddress)
235
235
  // onStatusChange: (event) => void - Optional parameter for callback events when sender address is supplied as signer
236
236
  })*/
@@ -283,23 +283,6 @@ const tx = await builder.buildBatch({
283
283
  await builder.disconnect()
284
284
  ```
285
285
 
286
- #### Asset claim:
287
-
288
- ```ts
289
- //Claim XCM trapped assets from the selected chain
290
- const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
291
- .claimfrom(TSubstrateChain)
292
- .currency({id: currencyID, amount: amount /*Use "ALL" to transfer everything*/} | {symbol: currencySymbol, amount: amount /*Use "ALL" to transfer everything*/} | {symbol: Native('currencySymbol'), amount: amount /*Use "ALL" to transfer everything*/} | {symbol: Foreign('currencySymbol'), amount: amount /*Use "ALL" to transfer everything*/} | {symbol: ForeignAbstract('currencySymbol'), amount: amount /*Use "ALL" to transfer everything*/} | {location: AssetLocationString, amount: amount /*Use "ALL" to transfer everything*/ | AssetLocationJson, amount: amount /*Use "ALL" to transfer everything*/} | [{currencySelection /*for example symbol: symbol or id: id, or location: location*/, amount: amount /*Use "ALL" to transfer everything*/}, {currencySelection}, ..]
293
- )
294
- .recipient(address | Location object)
295
- /*.xcmVersion(Version.V3) Optional parameter, by default chain specific version. XCM Version ENUM if a different XCM version is needed (Supported V3 & V4 & V5). Requires importing Version enum.*/
296
-
297
- const tx = await builder.build()
298
-
299
- //Make sure to disconnect the API after it is no longer used (eg, after a transaction)
300
- await builder.disconnect()
301
- ```
302
-
303
286
  ### Localhost test setup
304
287
 
305
288
  ```ts
@@ -340,9 +323,9 @@ const fee = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array
340
323
  /*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.
341
324
  .swap({
342
325
  currencyTo: CURRENCY_SPEC, //Reffer to currency spec options above
343
- // exchange: ['AssetHubPolkadotDex'], - Optional parameter - 'HydrationDex' | 'AcalaDex' | 'AssetHubPolkadotDex' | ...
326
+ // exchange: ['AssetHubPolkadot'], - Optional parameter - 'Hydration' | 'Acala' | 'AssetHubPolkadot' | ...
344
327
  // slippage: 1, - Optional - 1 by default
345
- // evmsender: '0x000', - Optional parameter when origin CHAIN is EVM based (Required with evmSigner)
328
+ // evmSenderAddress: '0x000', - Optional parameter when origin CHAIN is EVM based (Required with evmSigner)
346
329
  // evmSigner: Signer, - Optional parameter when origin CHAIN is EVM based (Required with evmInjectorAddress)
347
330
  // onStatusChange: (event) => void - Optional parameter for callback events when sender address is supplied as signer
348
331
  })*/
@@ -385,9 +368,9 @@ const transferable = await Builder(/*chain api/builder_config/ws_url_string/ws_u
385
368
  /*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.
386
369
  .swap({
387
370
  currencyTo: CURRENCY_SPEC, //Reffer to currency spec options above
388
- // exchange: ['AssetHubPolkadotDex'], - Optional parameter - 'HydrationDex' | 'AcalaDex' | 'AssetHubPolkadotDex' | ...
371
+ // exchange: ['AssetHubPolkadot'], - Optional parameter - 'Hydration' | 'Acala' | 'AssetHubPolkadot' | ...
389
372
  // slippage: 1, - Optional - 1 by default
390
- // evmsender: '0x000', - Optional parameter when origin CHAIN is EVM based (Required with evmSigner)
373
+ // evmSenderAddress: '0x000', - Optional parameter when origin CHAIN is EVM based (Required with evmSigner)
391
374
  // evmSigner: Signer, - Optional parameter when origin CHAIN is EVM based (Required with evmInjectorAddress)
392
375
  // onStatusChange: (event) => void - Optional parameter for callback events when sender address is supplied as signer
393
376
  })*/
@@ -405,9 +388,9 @@ const transferable = await Builder(/*chain api/builder_config/ws_url_string/ws_u
405
388
  /*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.
406
389
  .swap({
407
390
  currencyTo: CURRENCY_SPEC, //Reffer to currency spec options above
408
- // exchange: ['AssetHubPolkadotDex'], - Optional parameter - 'HydrationDex' | 'AcalaDex' | 'AssetHubPolkadotDex' | ...
391
+ // exchange: ['AssetHubPolkadot'], - Optional parameter - 'Hydration' | 'Acala' | 'AssetHubPolkadot' | ...
409
392
  // slippage: 1, - Optional - 1 by default
410
- // evmsender: '0x000', - Optional parameter when origin CHAIN is EVM based (Required with evmSigner)
393
+ // evmSenderAddress: '0x000', - Optional parameter when origin CHAIN is EVM based (Required with evmSigner)
411
394
  // evmSigner: Signer, - Optional parameter when origin CHAIN is EVM based (Required with evmInjectorAddress)
412
395
  // onStatusChange: (event) => void - Optional parameter for callback events when sender address is supplied as signer
413
396
  })*/
@@ -451,9 +434,9 @@ const result = await Builder(/*chain api/builder_config/ws_url_string/ws_url_arr
451
434
  .sender(SENDER_ADDRESS)
452
435
  .swap({
453
436
  currencyTo: CURRENCY_SPEC,
454
- // exchange: ['AssetHubPolkadotDex'], - Optional parameter - 'HydrationDex' | 'AcalaDex' | 'AssetHubPolkadotDex' | ...
437
+ // exchange: ['AssetHubPolkadot'], - Optional parameter - 'Hydration' | 'Acala' | 'AssetHubPolkadot' | ...
455
438
  // slippage: 1, - Optional - 1 by default
456
- // evmsender: '0x000', - Optional parameter when origin CHAIN is EVM based (Required with evmSigner)
439
+ // evmSenderAddress: '0x000', - Optional parameter when origin CHAIN is EVM based (Required with evmSigner)
457
440
  // evmSigner: Signer, - Optional parameter when origin CHAIN is EVM based (Required with evmInjectorAddress)
458
441
  // onStatusChange: (event) => void - Optional parameter for callback events when sender address is supplied as signer
459
442
  })
@@ -566,6 +549,52 @@ getOtherAssetsPallets(chain: TChain)
566
549
  console.log(SUPPORTED_PALLETS)
567
550
  ```
568
551
 
552
+ ### Import chains as types
553
+ There are 6 options for types you can choose based on your prefference
554
+
555
+ ```ts
556
+ // Import all exchange chains (Swap)
557
+ import type { TExchangeChain } from "@paraspell/sdk"
558
+
559
+ // Import all Parachains
560
+ import type { TParachain } from "@paraspell/sdk"
561
+
562
+ // Import all Relay chains
563
+ import type { TRelaychain } from "@paraspell/sdk"
564
+
565
+ // Import all Substrate chains (Parachains + Relays)
566
+ import type { TSubstrateChain } from "@paraspell/sdk"
567
+
568
+ // Import chains outside Polkadot ecosystem (Ethereum)
569
+ import type { TExternalChain } from "@paraspell/sdk"
570
+
571
+ // Import all chains implemented in ParaSpell
572
+ import type { TChain } from "@paraspell/sdk"
573
+ ```
574
+
575
+ ### Import chains as constant
576
+ There are 6 options for constants you can choose based on your prefference
577
+
578
+ ```ts
579
+ // Print all exchange chains (Swap)
580
+ console.log(EXCHANGE_CHAINS)
581
+
582
+ // Print all Parachains
583
+ console.log(PARACHAINS)
584
+
585
+ // Print all Relay chains
586
+ console.log(RELAYCHAINS)
587
+
588
+ // Print all Substrate chains (Parachains + Relays)
589
+ console.log(SUBSTRATE_CHAINS)
590
+
591
+ // Print chains outside Polkadot ecosystem (Ethereum)
592
+ console.log(EXTERNAL_CHAINS)
593
+
594
+ // Print all chains implemented in ParaSpell
595
+ console.log(CHAINS)
596
+ ```
597
+
569
598
  ## 💻 Tests
570
599
  - Run compilation using `pnpm compile`
571
600
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk",
3
- "version": "12.10.0-rc.2",
3
+ "version": "13.0.0",
4
4
  "description": "SDK for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,8 +27,8 @@
27
27
  "@polkadot-api/legacy-provider": "^0.3.8",
28
28
  "@polkadot-labs/hdkd": "^0.0.27",
29
29
  "@polkadot-labs/hdkd-helpers": "^0.0.28",
30
- "viem": "2.47.1",
31
- "@paraspell/sdk-core": "12.10.0-rc.2"
30
+ "viem": "^2.47.6",
31
+ "@paraspell/sdk-core": "13.0.0"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "polkadot-api": ">= 1.23.3 < 2"