@paraspell/sdk 13.0.0-rc.1 → 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.
package/README.md CHANGED
@@ -47,7 +47,7 @@ npm install | pnpm add | yarn add @paraspell/sdk
47
47
 
48
48
  ### Install Swap extension
49
49
 
50
- If you plan to [do Swap XCMs](https://paraspell.github.io/docs/sdk/xcmPallet.html#swap) you can install Swap package which allows you to do cross-chain swaps on popular Polkadot, Kusama, Paseo, Westend exchanges. Only available in PAPI version of SDK.
50
+ If you plan to [do Swap XCMs](https://paraspell.github.io/docs/sdk/xcmPallet.html#swap) you can install Swap package which allows you to do cross-chain swaps on popular Polkadot, Kusama, Paseo, Westend exchanges. Now available in all JS client versions of SDK.
51
51
 
52
52
  > [!IMPORTANT]
53
53
  > - ⚠️ **WebAssembly (Wasm) must be enabled in your project** because of the Hydration SDK (One of the exchanges implemented in XCM Router). Wasm can be enabled either through the web application configuration or through the appropriate plugin.
@@ -87,11 +87,14 @@ import * as paraspell from '@paraspell/sdk'
87
87
  ## Implementation
88
88
 
89
89
  > [!NOTE]
90
+ > - You can now pass signer directly into sender parameter
90
91
  > - The local transfers now have additional builder parameter called keepAlive
91
92
  > - Transact is here! Find out more: https://paraspell.github.io/docs/sdk/xcmPallet.html#transact
92
93
  >
93
94
  > **Latest news:**
94
- > - Swap is here! Find out more: https://paraspell.github.io/docs/sdk/getting-started.html#install-swap-extension
95
+ > - V12 > V13 Migration guide: https://paraspell.github.io/docs/migration/v12-to-v13.html
96
+ > - Swap package is now available on every XCM SDK version: https://paraspell.github.io/docs/sdk/getting-started.html#install-swap-extension
97
+ > - abstractDecimals is now turned on by default!
95
98
 
96
99
  ### Sending XCM
97
100
  For full documentation on XCM Transfers head over to [official documentation](https://paraspell.github.io/docs/sdk/xcmPallet.html).
@@ -103,15 +106,15 @@ const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array -
103
106
  .from(TSubstrateChain)
104
107
  .to(TChain /*,customParaId - optional*/ | Location object /*Only works for PolkadotXCM pallet*/)
105
108
  .currency({id: currencyID, amount: amount} | {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*/} | [{currencySelection /*for example symbol: symbol or id: id, or location: location*/, amount: amount /*Use "ALL" to transfer everything*/}, {currencySelection}, ..])
106
- .address(address | Location object /*If you are sending through xTokens, you need to pass the destination and address Location in one object (x2)*/)
107
- .senderAddress(address | PAPI_SIGNER) // - OPTIONAL but strongly recommended as it is automatically ignored when not needed - Used when origin is AssetHub with feeAsset or when sending to AssetHub to prevent asset traps by auto-swapping to DOT to have DOT ED.
109
+ .recipient(address | Location object /*If you are sending through xTokens, you need to pass the destination and address Location in one object (x2)*/)
110
+ .sender(address | PAPI_SIGNER) // - OPTIONAL but strongly recommended as it is automatically ignored when not needed - Used when origin is AssetHub with feeAsset or when sending to AssetHub to prevent asset traps by auto-swapping to DOT to have DOT ED.
108
111
  /*.ahAddress(ahAddress) - OPTIONAL - used when origin is EVM chain and XCM goes through AssetHub (Multihop transfer where we are unable to convert Key20 to ID32 address eg. origin: Moonbeam & destination: Ethereum (Multihop goes from Moonbeam > AssetHub > BridgeHub > Ethereum)
109
112
  .feeAsset({symbol: 'symbol'} || {id: 'id'} || {location: 'location'}) // Optional parameter used when multiasset is provided or when origin is AssetHub - so user can pay in fees different than DOT
110
113
  .xcmVersion(Version.V3/V4/V5) //Optional parameter for manual override of XCM Version used in call
111
114
  .customPallet('Pallet','pallet_function') //Optional parameter for manual override of XCM Pallet and function used in call (If they are named differently on some chain but syntax stays the same). Both pallet name and function required. Pallet name must be CamelCase, function name snake_case.*/
112
115
 
113
116
  const tx = await builder.build()
114
- // Or if you use signers in senderAddress:
117
+ // Or if you use signers in sender:
115
118
  // await builder.signAndSubmit() - Signs and submits the transaction; returns TX hash for tracking
116
119
 
117
120
  //Make sure to disconnect the API after it is no longer used (eg, after a transaction)
@@ -124,9 +127,9 @@ const builder = Builder()
124
127
  .to('Polkadot')
125
128
  .currency({
126
129
  symbol: 'DOT',
127
- amount: '1000000000'
130
+ amount: '1'
128
131
  })
129
- .address(address)
132
+ .recipient(address)
130
133
 
131
134
  const tx = await builder.build()
132
135
 
@@ -142,7 +145,7 @@ const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array -
142
145
  .from(TSubstrateChain)
143
146
  .to(TChain) //Has to be the same as the origin (from)
144
147
  .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*/} | {location: Override('Custom Location'), 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}, ..])
145
- .address(address)
148
+ .recipient(address)
146
149
  /* .keepAlive(bool) - Optional: Allows draining the account below the existential deposit. */
147
150
 
148
151
  const tx = await builder.build()
@@ -157,9 +160,9 @@ const builder = Builder()
157
160
  .to('Hydration')
158
161
  .currency({
159
162
  symbol: 'DOT',
160
- amount: '1000000000'
163
+ amount: '1'
161
164
  })
162
- .address(address)
165
+ .recipient(address)
163
166
 
164
167
  const tx = await builder.build()
165
168
 
@@ -175,12 +178,12 @@ const builder = Builder(/*client | builder_config | ws_url | [ws_url, ws_url,..]
175
178
  .from(TSubstrateChain) // 'AssetHubPolkadot' | 'Hydration' | 'Moonbeam' | 'Polkadot' | ... https://paraspell.github.io/docs/sdk/AssetPallet.html#import-chains-as-types
176
179
  .to(TChain) // Has to be same as origin (from)
177
180
  .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*/} | {location: Override('Custom Location'), amount: amount /*Use "ALL" to transfer everything*/})
178
- .senderAddress(senderAddress | PAPI SIGNER)
179
- .address(address)
181
+ .sender(sender | PAPI SIGNER)
182
+ .recipient(address)
180
183
  .transact(hex, /* originType, TWeight - Optional */)
181
184
 
182
185
  const tx = await builder.build()
183
- // Or if you use signers in senderAddress:
186
+ // Or if you use signers in sender:
184
187
  // await builder.signAndSubmit() - Signs and submits the transaction; returns TX hash for tracking
185
188
 
186
189
  //Disconnect API after TX
@@ -194,11 +197,11 @@ const builder = Builder(/*client | builder_config |ws_url | [ws_url, ws_url,..]
194
197
  .from(TSubstrateChain) // 'AssetHubPolkadot' | 'Hydration' | 'Moonbeam' | 'Polkadot' | ... https://paraspell.github.io/docs/sdk/AssetPallet.html#import-chains-as-types
195
198
  .to(TChain /*,customParaId - optional*/ | Location object /*Only works for PolkadotXCM pallet*/) //'AssetHubPolkadot' | 'Hydration' | 'Moonbeam' | 'Polkadot' | ... https://paraspell.github.io/docs/sdk/AssetPallet.html#import-chains-as-types
196
199
  .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*/} | {location: Override('Custom Location'), amount: amount /*Use "ALL" to transfer everything*/})
197
- .address(address | Location object /*If you are sending through xTokens, you need to pass the destination and address location in one object (x2)*/)
198
- .senderAddress(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.
200
+ .recipient(address | Location object /*If you are sending through xTokens, you need to pass the destination and address location in one object (x2)*/)
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.
199
202
  .swap({
200
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*/}
201
- // exchange: ['AssetHubPolkadotDex'], - Optional parameter - 'HydrationDex' | 'AcalaDex' | 'AssetHubPolkadotDex' | ...
204
+ // exchange: ['AssetHubPolkadot'], - Optional parameter - 'Hydration' | 'Acala' | 'AssetHubPolkadot' | ...
202
205
  // slippage: 1, - Optional - 1 by default
203
206
  // evmSenderAddress: '0x000', - Optional parameter when origin CHAIN is EVM based (Required with evmSigner)
204
207
  // evmSigner: Signer, - Optional parameter when origin CHAIN is EVM based (Required with evmInjectorAddress)
@@ -206,8 +209,9 @@ const builder = Builder(/*client | builder_config |ws_url | [ws_url, ws_url,..]
206
209
  })
207
210
 
208
211
  const tx = await builder.buildAll()
209
- // Or if you use signers in senderAddress:
210
- // await builder.signAndSubmit() - Signs and submits the transaction; returns TX hash for tracking
212
+ // Or if you use signers in sender:
213
+ // await builder.signAndSubmit() - Signs and submits the transaction (only working in 1click scenarios); returns TX hash for tracking
214
+ // await builder.signAndSubmitAll() - Signs and submits transactions (required in 2click scenarios); returns array of TX hashes for tracking
211
215
 
212
216
  // Make sure to disconnect API after it is no longer used (eg. after transaction)
213
217
  await builder.disconnect()
@@ -224,14 +228,14 @@ const result = await Builder(/*chain api/builder_config/ws_url_string/ws_url_arr
224
228
  /*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.
225
229
  .swap({
226
230
  currencyTo: CURRENCY_SPEC, //Reffer to currency spec options above
227
- // exchange: ['AssetHubPolkadotDex'], - Optional parameter - 'HydrationDex' | 'AcalaDex' | 'AssetHubPolkadotDex' | ...
231
+ // exchange: ['AssetHubPolkadot'], - Optional parameter - 'Hydration' | 'Acala' | 'AssetHubPolkadot' | ...
228
232
  // slippage: 1, - Optional - 1 by default
229
233
  // evmSenderAddress: '0x000', - Optional parameter when origin CHAIN is EVM based (Required with evmSigner)
230
234
  // evmSigner: Signer, - Optional parameter when origin CHAIN is EVM based (Required with evmInjectorAddress)
231
235
  // onStatusChange: (event) => void - Optional parameter for callback events when sender address is supplied as signer
232
236
  })*/
233
- .address(ADDRESS)
234
- .senderAddress(address | PAPI_SIGNER)
237
+ .recipient(ADDRESS)
238
+ .sender(address | PAPI_SIGNER)
235
239
  .dryRun()
236
240
 
237
241
  //Check Parachain for DryRun support - returns true/false
@@ -249,8 +253,8 @@ const result = await Builder(/*chain api/builder_config/ws_url_string/ws_url_arr
249
253
  .to(TChain)
250
254
  .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*/} | {location: Override('Custom Location'), amount: amount /*Use "ALL" to transfer everything*/} | {[{currencySelection, isFeeAsset?: true /* for example symbol: symbol or id: id, or Location: Location*/, amount: amount /*Use "ALL" to transfer everything*/}]})
251
255
  /*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in same fee asset as selected currency.*/
252
- .address(ADDRESS)
253
- .senderAddress(address | PAPI_SIGNER)
256
+ .recipient(ADDRESS)
257
+ .sender(address | PAPI_SIGNER)
254
258
  .dryRunPreview(/*{ mintFeeAssets: true } - false by default - Mints fee assets also, if user does not have enough to cover fees on origin.*/)
255
259
  ```
256
260
 
@@ -261,13 +265,13 @@ const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array -
261
265
  .from(TSubstrateChain) //Ensure, that origin chain is the same in all batched XCM Calls.
262
266
  .to(TChain2) //Any compatible Parachain
263
267
  .currency({currencySelection, amount}) //Currency to transfer - options as in scenarios above
264
- .address(address | Location object)
268
+ .recipient(address | Location object)
265
269
  .addToBatch()
266
270
 
267
271
  .from(TSubstrateChain) //Ensure, that origin chain is the same in all batched XCM Calls.
268
272
  .to(TChain3) //Any compatible Parachain
269
273
  .currency({currencySelection, amount}) //Currency to transfer - options as in scenarios above
270
- .address(address | Location object)
274
+ .recipient(address | Location object)
271
275
  .addToBatch()
272
276
 
273
277
  const tx = await builder.buildBatch({
@@ -279,23 +283,6 @@ const tx = await builder.buildBatch({
279
283
  await builder.disconnect()
280
284
  ```
281
285
 
282
- #### Asset claim:
283
-
284
- ```ts
285
- //Claim XCM trapped assets from the selected chain
286
- const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
287
- .claimfrom(TSubstrateChain)
288
- .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}, ..]
289
- )
290
- .address(address | Location object)
291
- /*.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.*/
292
-
293
- const tx = await builder.build()
294
-
295
- //Make sure to disconnect the API after it is no longer used (eg, after a transaction)
296
- await builder.disconnect()
297
- ```
298
-
299
286
  ### Localhost test setup
300
287
 
301
288
  ```ts
@@ -312,11 +299,11 @@ const builder = await Builder({
312
299
  .from(TSubstrateChain)
313
300
  .to(TChain)
314
301
  .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*/} | {location: Override('Custom Location'), amount: amount /*Use "ALL" to transfer everything*/} | [{currencySelection, isFeeAsset?: true /* for example symbol: symbol or id: id, or Location: Location*/, amount: amount /*Use "ALL" to transfer everything*/}])
315
- .address(address) //You can also use prederived accounts - //Alice, //Bob... //Alith, //Balthathar...
316
- .senderAddress(address | PAPI_SIGNER) //You can also use prederived accounts //Alice, //Bob... //Alith, //Balthathar...
302
+ .recipient(address) //You can also use prederived accounts - //Alice, //Bob... //Alith, //Balthathar...
303
+ .sender(address | PAPI_SIGNER) //You can also use prederived accounts //Alice, //Bob... //Alith, //Balthathar...
317
304
 
318
305
  const tx = await builder.build()
319
- //Or if you use prederived account as senderAddress:
306
+ //Or if you use prederived account as sender:
320
307
  //await builder.signAndSubmit()
321
308
 
322
309
  //Disconnect API after TX
@@ -336,14 +323,14 @@ const fee = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array
336
323
  /*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.
337
324
  .swap({
338
325
  currencyTo: CURRENCY_SPEC, //Reffer to currency spec options above
339
- // exchange: ['AssetHubPolkadotDex'], - Optional parameter - 'HydrationDex' | 'AcalaDex' | 'AssetHubPolkadotDex' | ...
326
+ // exchange: ['AssetHubPolkadot'], - Optional parameter - 'Hydration' | 'Acala' | 'AssetHubPolkadot' | ...
340
327
  // slippage: 1, - Optional - 1 by default
341
328
  // evmSenderAddress: '0x000', - Optional parameter when origin CHAIN is EVM based (Required with evmSigner)
342
329
  // evmSigner: Signer, - Optional parameter when origin CHAIN is EVM based (Required with evmInjectorAddress)
343
330
  // onStatusChange: (event) => void - Optional parameter for callback events when sender address is supplied as signer
344
331
  })*/
345
- .address(RECIPIENT_ADDRESS)
346
- .senderAddress(address | PAPI_SIGNER)
332
+ .recipient(RECIPIENT_ADDRESS)
333
+ .sender(address | PAPI_SIGNER)
347
334
  .getXcmFee(/*{disableFallback: true / false}*/) //Fallback is optional. When fallback is disabled, you only get notified of a DryRun error, but no Payment info query fallback is performed. Payment info is still performed if Origin or Destination chain do not support DryRun out of the box.
348
335
  ```
349
336
 
@@ -355,8 +342,8 @@ const fee = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array
355
342
  .to(TChain)
356
343
  .currency(CURRENCY_SPEC)
357
344
  /*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
358
- .address(RECIPIENT_ADDRESS)
359
- .senderAddress(address | PAPI_SIGNER)
345
+ .recipient(RECIPIENT_ADDRESS)
346
+ .sender(address | PAPI_SIGNER)
360
347
  .getOriginXcmFee(/*{disableFallback: true / false}*/) //Fallback is optional. When fallback is disabled, you only get notified of a DryRun error, but no Payment info query fallback is performed. Payment info is still performed if Origin do not support DryRun out of the box.
361
348
  ```
362
349
 
@@ -367,8 +354,8 @@ const info = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array
367
354
  .to(TChain)
368
355
  .currency(CURRENCY_SPEC)
369
356
  /*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
370
- .address(RECIPIENT_ADDRESS)
371
- .senderAddress(address | PAPI_SIGNER)
357
+ .recipient(RECIPIENT_ADDRESS)
358
+ .sender(address | PAPI_SIGNER)
372
359
  .getTransferInfo()
373
360
  ```
374
361
 
@@ -381,14 +368,14 @@ const transferable = await Builder(/*chain api/builder_config/ws_url_string/ws_u
381
368
  /*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.
382
369
  .swap({
383
370
  currencyTo: CURRENCY_SPEC, //Reffer to currency spec options above
384
- // exchange: ['AssetHubPolkadotDex'], - Optional parameter - 'HydrationDex' | 'AcalaDex' | 'AssetHubPolkadotDex' | ...
371
+ // exchange: ['AssetHubPolkadot'], - Optional parameter - 'Hydration' | 'Acala' | 'AssetHubPolkadot' | ...
385
372
  // slippage: 1, - Optional - 1 by default
386
373
  // evmSenderAddress: '0x000', - Optional parameter when origin CHAIN is EVM based (Required with evmSigner)
387
374
  // evmSigner: Signer, - Optional parameter when origin CHAIN is EVM based (Required with evmInjectorAddress)
388
375
  // onStatusChange: (event) => void - Optional parameter for callback events when sender address is supplied as signer
389
376
  })*/
390
- .address(RECIPIENT_ADDRESS)
391
- .senderAddress(address | PAPI_SIGNER)
377
+ .recipient(RECIPIENT_ADDRESS)
378
+ .sender(address | PAPI_SIGNER)
392
379
  .getTransferableAmount()
393
380
  ```
394
381
 
@@ -401,14 +388,14 @@ const transferable = await Builder(/*chain api/builder_config/ws_url_string/ws_u
401
388
  /*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.
402
389
  .swap({
403
390
  currencyTo: CURRENCY_SPEC, //Reffer to currency spec options above
404
- // exchange: ['AssetHubPolkadotDex'], - Optional parameter - 'HydrationDex' | 'AcalaDex' | 'AssetHubPolkadotDex' | ...
391
+ // exchange: ['AssetHubPolkadot'], - Optional parameter - 'Hydration' | 'Acala' | 'AssetHubPolkadot' | ...
405
392
  // slippage: 1, - Optional - 1 by default
406
393
  // evmSenderAddress: '0x000', - Optional parameter when origin CHAIN is EVM based (Required with evmSigner)
407
394
  // evmSigner: Signer, - Optional parameter when origin CHAIN is EVM based (Required with evmInjectorAddress)
408
395
  // onStatusChange: (event) => void - Optional parameter for callback events when sender address is supplied as signer
409
396
  })*/
410
- .address(RECIPIENT_ADDRESS)
411
- .senderAddress(address | PAPI_SIGNER)
397
+ .recipient(RECIPIENT_ADDRESS)
398
+ .sender(address | PAPI_SIGNER)
412
399
  .getMinTransferableAmount()
413
400
  ```
414
401
 
@@ -419,8 +406,8 @@ const receivable = await Builder(/*chain api/builder_config/ws_url_string/ws_url
419
406
  .to(TChain)
420
407
  .currency(CURRENCY_SPEC)
421
408
  /*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
422
- .address(RECIPIENT_ADDRESS)
423
- .senderAddress(address | PAPI_SIGNER)
409
+ .recipient(RECIPIENT_ADDRESS)
410
+ .sender(address | PAPI_SIGNER)
424
411
  .getReceivableAmount()
425
412
  ```
426
413
 
@@ -431,8 +418,8 @@ const ed = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array -
431
418
  .to(TChain)
432
419
  .currency(CURRENCY_SPEC)
433
420
  /*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
434
- .address(RECIPIENT_ADDRESS)
435
- .senderAddress(address | PAPI_SIGNER)
421
+ .recipient(RECIPIENT_ADDRESS)
422
+ .sender(address | PAPI_SIGNER)
436
423
  .verifyEdOnDestination()
437
424
  ```
438
425
 
@@ -443,11 +430,11 @@ const result = await Builder(/*chain api/builder_config/ws_url_string/ws_url_arr
443
430
  .from(TSubstrateChain) //'AssetHubPolkadot' | 'Hydration' | 'Moonbeam' | 'Polkadot' | ... https://paraspell.github.io/docs/sdk/AssetPallet.html#import-chains-as-types
444
431
  .to(TChain) //'AssetHubPolkadot' | 'Hydration' | 'Moonbeam' | 'Polkadot' | ... https://paraspell.github.io/docs/sdk/AssetPallet.html#import-chains-as-types
445
432
  .currency(CURRENCY_SPEC)
446
- .address(RECIPIENT_ADDRESS)
447
- .senderAddress(SENDER_ADDRESS)
433
+ .recipient(RECIPIENT_ADDRESS)
434
+ .sender(SENDER_ADDRESS)
448
435
  .swap({
449
436
  currencyTo: CURRENCY_SPEC,
450
- // exchange: ['AssetHubPolkadotDex'], - Optional parameter - 'HydrationDex' | 'AcalaDex' | 'AssetHubPolkadotDex' | ...
437
+ // exchange: ['AssetHubPolkadot'], - Optional parameter - 'Hydration' | 'Acala' | 'AssetHubPolkadot' | ...
451
438
  // slippage: 1, - Optional - 1 by default
452
439
  // evmSenderAddress: '0x000', - Optional parameter when origin CHAIN is EVM based (Required with evmSigner)
453
440
  // evmSigner: Signer, - Optional parameter when origin CHAIN is EVM based (Required with evmInjectorAddress)
@@ -487,11 +474,12 @@ import { convertSs58 } from "@paraspell/sdk";
487
474
  let result = convertSs58(ADDRESS, TChain) // returns converted address in string
488
475
  ```
489
476
 
490
- ### Asset queries
477
+ ### Asset queries:
478
+
491
479
  For full documentation with output examples of asset queries, head over to [official documentation](https://paraspell.github.io/docs/sdk/AssetPallet.html).
492
480
 
493
481
  ```ts
494
- import { getSupportedDestinations, getFeeAssets, getAssetsObject, getAssetId, getRelayChainSymbol, getNativeAssets, getNativeAssets, getOtherAssets, getAllAssetsSymbols, hasSupportForAsset, getAssetDecimals, getParaId, getTChain, getAssetLocation, CHAINS, findAssetInfo, findAssetInfoOrThrow } from '@paraspell/sdk'
482
+ import { getSupportedDestinations, getFeeAssets, getAssetsObject, getRelayChainSymbol, getNativeAssets, getNativeAssets, getOtherAssets, getAllAssetsSymbols, getParaId, getTChain, getAssetLocation, CHAINS, findAssetInfo, findAssetInfoOrThrow } from '@paraspell/sdk'
495
483
 
496
484
  //Get chains that support the specific asset related to origin
497
485
  getSupportedDestinations(TChain, CURRENCY)
@@ -514,9 +502,6 @@ getAssetLocation(TChain, { symbol: symbol } | { id: assetId })
514
502
  // Retrieve assets object from assets.json for a particular chain, including information about native and foreign assets
515
503
  getAssetsObject(TChain)
516
504
 
517
- // Retrieve foreign assetId for a particular chain and asset symbol
518
- getAssetId(TChain, ASSET_SYMBOL)
519
-
520
505
  // Retrieve the symbol of the relay chain for a particular chain. Either "DOT" or "KSM"
521
506
  getRelayChainSymbol(TChain)
522
507
 
@@ -529,12 +514,6 @@ getOtherAssets(TChain)
529
514
  // Retrieve string array of all asset symbols. (native and foreign assets are merged into a single array)
530
515
  getAllAssetsSymbols(TChain)
531
516
 
532
- // Check if a chain supports a particular asset. (Both native and foreign assets are searched). Returns boolean
533
- hasSupportForAsset(TChain, ASSET_SYMBOL)
534
-
535
- // Get decimals for specific asset
536
- getAssetDecimals(TChain, ASSET_SYMBOL)
537
-
538
517
  // Get specific chain id
539
518
  getParaId(TChain)
540
519
 
@@ -570,6 +549,52 @@ getOtherAssetsPallets(chain: TChain)
570
549
  console.log(SUPPORTED_PALLETS)
571
550
  ```
572
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
+
573
598
  ## 💻 Tests
574
599
  - Run compilation using `pnpm compile`
575
600
 
@@ -579,6 +604,8 @@ console.log(SUPPORTED_PALLETS)
579
604
 
580
605
  - Run end-to-end tests using `pnpm test:e2e`
581
606
 
607
+ - Run swap end-to-end tests using `pnpm test:e2e:swap`
608
+
582
609
  - Run full end-to-end tests using `pnpm test:e2e:chopsticks`
583
610
 
584
611
  - Run all core tests and checks using `pnpm runAll`
package/dist/index.d.ts CHANGED
@@ -1,12 +1,11 @@
1
1
  import * as _paraspell_sdk_core from '@paraspell/sdk-core';
2
- import { TApiOrUrl, TEvmChainFrom, TSwapEvent as TSwapEvent$1, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, TSubstrateChain, TEvmBuilderOptions, TChain, TCurrencyInputWithAmount, TBuilderOptions, GeneralBuilder as GeneralBuilder$1, TTransferBaseOptions, TGetXcmFeeBaseOptions, TCreateBaseSwapXcmOptions } from '@paraspell/sdk-core';
2
+ import { TEvmChainFrom, TSwapEvent as TSwapEvent$1, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, TSubstrateChain, TEvmBuilderOptions, TChain, TCurrencyInputWithAmount, TBuilderOptions, TApiOrUrl, GeneralBuilder as GeneralBuilder$1, TTransferBaseOptions, TGetXcmFeeBaseOptions, TCreateBaseSwapXcmOptions } from '@paraspell/sdk-core';
3
3
  export * from '@paraspell/sdk-core';
4
4
  import * as polkadot_api from 'polkadot-api';
5
5
  import { PolkadotClient, UnsafeTransaction, PolkadotSigner } from 'polkadot-api';
6
6
  import { WalletClient } from 'viem';
7
7
 
8
8
  type TPapiApi = PolkadotClient;
9
- type TPapiApiOrUrl = TApiOrUrl<PolkadotClient>;
10
9
  type TPapiSigner = PolkadotSigner;
11
10
  type TPapiTransaction = UnsafeTransaction<any, string, string, any>;
12
11
  type TEvmChainFromPapi = Extract<TEvmChainFrom, 'Moonbeam' | 'Moonriver' | 'Darwinia'>;
@@ -20,7 +19,7 @@ type TSwapEvent = TSwapEvent$1<TPapiApi, TPapiTransaction>;
20
19
  declare const getBalance: (options: _paraspell_sdk_core.TGetBalanceCommonOptions & {
21
20
  currency?: _paraspell_sdk_core.TCurrencyCore;
22
21
  } & {
23
- api?: TPapiApiOrUrl;
22
+ api?: _paraspell_sdk_core.TApiOrUrl<TPapiApi>;
24
23
  }) => Promise<bigint>;
25
24
 
26
25
  declare const assets_Foreign: typeof Foreign;
@@ -138,31 +137,31 @@ declare class EvmBuilderCore<TApi, TRes, TSigner, T extends Partial<TEvmBuilderO
138
137
  * @param api - The API instance to use for building transactions. If not provided, a new instance will be created.
139
138
  * @returns A new Builder instance.
140
139
  */
141
- declare const Builder: (api?: TBuilderOptions<TPapiApiOrUrl>) => GeneralBuilder$1<PolkadotClient, TPapiTransaction, PolkadotSigner, object>;
140
+ declare const Builder: (api?: TBuilderOptions<TApiOrUrl<TPapiApi>>) => GeneralBuilder$1<PolkadotClient, TPapiTransaction, PolkadotSigner, object>;
142
141
  type GeneralBuilder<T extends Partial<TTransferBaseOptions<TPapiApi, TPapiTransaction, TPapiSigner>> = object> = GeneralBuilder$1<PolkadotClient, TPapiTransaction, PolkadotSigner, T>;
143
- declare const EvmBuilder: (api?: TBuilderOptions<TPapiApiOrUrl>) => EvmBuilderCore<unknown, unknown, unknown, {
144
- api: _paraspell_sdk_core.IPolkadotApi<PolkadotClient, TPapiTransaction, PolkadotSigner>;
142
+ declare const EvmBuilder: (api?: TBuilderOptions<TApiOrUrl<TPapiApi>>) => EvmBuilderCore<unknown, unknown, unknown, {
143
+ api: _paraspell_sdk_core.PolkadotApi<PolkadotClient, TPapiTransaction, PolkadotSigner>;
145
144
  }>;
146
145
 
147
146
  declare const dryRun: (options: _paraspell_sdk_core.TDryRunBaseOptions<TPapiTransaction> & {
148
- api?: TPapiApiOrUrl;
147
+ api?: TApiOrUrl<TPapiApi>;
149
148
  }) => Promise<_paraspell_sdk_core.TDryRunResult>;
150
149
  declare const dryRunOrigin: (options: _paraspell_sdk_core.TDryRunCallBaseOptions<TPapiTransaction> & {
151
- api?: TPapiApiOrUrl;
150
+ api?: TApiOrUrl<TPapiApi>;
152
151
  }) => Promise<_paraspell_sdk_core.TDryRunChainResult>;
153
- declare const getParaEthTransferFees: (ahApi?: TPapiApiOrUrl) => Promise<[bigint, bigint]>;
152
+ declare const getParaEthTransferFees: (ahApi?: TApiOrUrl<TPapiApi>) => Promise<[bigint, bigint]>;
154
153
  /**
155
154
  * Gets the Ethereum bridge status.
156
155
  */
157
- declare const getBridgeStatus: (ahApi?: TPapiApiOrUrl) => Promise<_paraspell_sdk_core.TBridgeStatus>;
156
+ declare const getBridgeStatus: (ahApi?: TApiOrUrl<TPapiApi>) => Promise<_paraspell_sdk_core.TBridgeStatus>;
158
157
  declare const getOriginXcmFee: (options: _paraspell_sdk_core.TGetOriginXcmFeeBaseOptions<TPapiTransaction> & {
159
- api?: TPapiApiOrUrl;
158
+ api?: TApiOrUrl<TPapiApi>;
160
159
  }) => Promise<_paraspell_sdk_core.TXcmFeeDetail & {
161
160
  forwardedXcms?: unknown;
162
161
  destParaId?: number;
163
162
  }>;
164
- declare const getXcmFee: <TDisableFallback extends boolean>(options: TGetXcmFeeBaseOptions<TPapiTransaction, TDisableFallback>, builderOptions?: TBuilderOptions<TPapiApiOrUrl>) => Promise<_paraspell_sdk_core.TGetXcmFeeResult<TDisableFallback>>;
165
- declare const handleSwapExecuteTransfer: (options: TCreateBaseSwapXcmOptions, builderOptions?: TBuilderOptions<TPapiApiOrUrl>) => Promise<TPapiTransaction>;
163
+ declare const getXcmFee: <TDisableFallback extends boolean>(options: TGetXcmFeeBaseOptions<TPapiTransaction, TDisableFallback>, builderOptions?: TBuilderOptions<TApiOrUrl<TPapiApi>>) => Promise<_paraspell_sdk_core.TGetXcmFeeResult<TDisableFallback>>;
164
+ declare const handleSwapExecuteTransfer: (options: TCreateBaseSwapXcmOptions, builderOptions?: TBuilderOptions<TApiOrUrl<TPapiApi>>) => Promise<TPapiTransaction>;
166
165
 
167
166
  declare const transfer_dryRun: typeof dryRun;
168
167
  declare const transfer_dryRunOrigin: typeof dryRunOrigin;
@@ -183,10 +182,10 @@ declare namespace transfer {
183
182
  };
184
183
  }
185
184
 
186
- declare const createChainClient: (chain: TSubstrateChain, api?: TBuilderOptions<TPapiApiOrUrl>) => Promise<polkadot_api.PolkadotClient>;
185
+ declare const createChainClient: (chain: TSubstrateChain, api?: TBuilderOptions<TApiOrUrl<TPapiApi>>) => Promise<polkadot_api.PolkadotClient>;
187
186
 
188
187
  declare const checkAndConvertToNumberOrBigInt: (input: string) => number | bigint;
189
188
  declare const transform: (obj: any) => any;
190
189
 
191
190
  export { Builder, EvmBuilder, assets, checkAndConvertToNumberOrBigInt, convertSs58, createChainClient, dryRun, dryRunOrigin, getBalance, getBridgeStatus, getOriginXcmFee, getParaEthTransferFees, getXcmFee, handleSwapExecuteTransfer, transform, transfer as xcmPallet };
192
- export type { GeneralBuilder, TEvmChainFromPapi, TPapiApi, TPapiApiOrUrl, TPapiSigner, TPapiTransaction, TSwapEvent };
191
+ export type { GeneralBuilder, TEvmChainFromPapi, TPapiApi, TPapiSigner, TPapiTransaction, TSwapEvent };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { getNativeAssetSymbol, getOtherAssets, isSenderSigner, getEvmPrivateKeyHex, NumberFormatError, createClientCache, MAX_CLIENTS, EXTENSION_MS, createClientPoolHelpers, InvalidAddressError, BatchMode, isConfig, findNativeAssetInfoOrThrow, getChainProviders, DEFAULT_TTL_MS, resolveChainApi, isExternalChain, Parents, findAssetInfoOrThrow, hasXcmPaymentApiSupport, replaceBigInt, getAssetsObject, RuntimeApiUnavailableError, wrapTxBypass, localizeLocation, isAssetXcEqual, addXcmVersionHeader, RELAY_LOCATION, getRelayChainOf, isRelayChain, padValueBy, isAssetEqual, SubmitTransactionError, createChainClient as createChainClient$1, getBalance as getBalance$1, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, convertSs58 as convertSs58$1, transferMoonbeamEvm, validateAddress, transferMoonbeamToEth, Builder as Builder$1, handleSwapExecuteTransfer as handleSwapExecuteTransfer$1, getBridgeStatus as getBridgeStatus$1, getParaEthTransferFees as getParaEthTransferFees$1, getXcmFee as getXcmFee$1, dryRun as dryRun$1, dryRunOrigin as dryRunOrigin$1, getOriginXcmFee as getOriginXcmFee$1 } from '@paraspell/sdk-core';
1
+ import { getNativeAssetSymbol, getOtherAssets, isSenderSigner, getEvmPrivateKeyHex, NumberFormatError, createClientCache, MAX_CLIENTS, EXTENSION_MS, createClientPoolHelpers, InvalidAddressError, BatchMode, isConfig, findNativeAssetInfoOrThrow, getChainProviders, PolkadotApi, resolveChainApi, DEFAULT_TTL_MS, isExternalChain, Parents, findAssetInfoOrThrow, hasXcmPaymentApiSupport, replaceBigInt, getAssetsObject, RuntimeApiUnavailableError, wrapTxBypass, localizeLocation, isAssetXcEqual, addXcmVersionHeader, RELAY_LOCATION, getRelayChainOf, isRelayChain, padValueBy, isAssetEqual, SubmitTransactionError, createChainClient as createChainClient$1, getBalance as getBalance$1, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, convertSs58 as convertSs58$1, transferMoonbeamEvm, validateAddress, transferMoonbeamToEth, Builder as Builder$1, handleSwapExecuteTransfer as handleSwapExecuteTransfer$1, getBridgeStatus as getBridgeStatus$1, getParaEthTransferFees as getParaEthTransferFees$1, getXcmFee as getXcmFee$1, dryRun as dryRun$1, dryRunOrigin as dryRunOrigin$1, getOriginXcmFee as getOriginXcmFee$1 } from '@paraspell/sdk-core';
2
2
  export * from '@paraspell/sdk-core';
3
3
  import { secp256k1 } from '@noble/curves/secp256k1.js';
4
4
  import { keccak_256 } from '@noble/hashes/sha3.js';
@@ -21,6 +21,10 @@ function _arrayLikeToArray(r, a) {
21
21
  function _arrayWithoutHoles(r) {
22
22
  if (Array.isArray(r)) return _arrayLikeToArray(r);
23
23
  }
24
+ function _assertThisInitialized(e) {
25
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
26
+ return e;
27
+ }
24
28
  function asyncGeneratorStep(n, t, e, r, o, a, c) {
25
29
  try {
26
30
  var i = n[a](c),
@@ -46,6 +50,9 @@ function _asyncToGenerator(n) {
46
50
  });
47
51
  };
48
52
  }
53
+ function _callSuper(t, o, e) {
54
+ return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
55
+ }
49
56
  function _classCallCheck(a, n) {
50
57
  if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
51
58
  }
@@ -116,6 +123,31 @@ function _defineProperty(e, r, t) {
116
123
  writable: true
117
124
  }) : e[r] = t, e;
118
125
  }
126
+ function _getPrototypeOf(t) {
127
+ return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
128
+ return t.__proto__ || Object.getPrototypeOf(t);
129
+ }, _getPrototypeOf(t);
130
+ }
131
+ function _inherits(t, e) {
132
+ if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
133
+ t.prototype = Object.create(e && e.prototype, {
134
+ constructor: {
135
+ value: t,
136
+ writable: true,
137
+ configurable: true
138
+ }
139
+ }), Object.defineProperty(t, "prototype", {
140
+ writable: false
141
+ }), e && _setPrototypeOf(t, e);
142
+ }
143
+ function _isNativeReflectConstruct() {
144
+ try {
145
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
146
+ } catch (t) {}
147
+ return (_isNativeReflectConstruct = function () {
148
+ return !!t;
149
+ })();
150
+ }
119
151
  function _iterableToArray(r) {
120
152
  if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
121
153
  }
@@ -143,6 +175,11 @@ function _objectSpread2(e) {
143
175
  }
144
176
  return e;
145
177
  }
178
+ function _possibleConstructorReturn(t, e) {
179
+ if (e && ("object" == typeof e || "function" == typeof e)) return e;
180
+ if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
181
+ return _assertThisInitialized(t);
182
+ }
146
183
  function _regenerator() {
147
184
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
148
185
  var e,
@@ -251,6 +288,11 @@ function _regeneratorDefine(e, r, n, t) {
251
288
  }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
252
289
  }, _regeneratorDefine(e, r, n, t);
253
290
  }
291
+ function _setPrototypeOf(t, e) {
292
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
293
+ return t.__proto__ = e, t;
294
+ }, _setPrototypeOf(t, e);
295
+ }
254
296
  function _toConsumableArray(r) {
255
297
  return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
256
298
  }
@@ -690,41 +732,27 @@ var extractDryRunXcmFailureReason = function extractDryRunXcmFailureReason(resul
690
732
  }
691
733
  return JSON.stringify((_ref5 = (_result$value2 = result === null || result === void 0 ? void 0 : result.value) !== null && _result$value2 !== void 0 ? _result$value2 : result) !== null && _ref5 !== void 0 ? _ref5 : 'Unknown error structure', replaceBigInt);
692
734
  };
693
- var PapiApi = /*#__PURE__*/function () {
694
- function PapiApi(config) {
735
+ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
736
+ function PapiApi() {
737
+ var _this;
695
738
  _classCallCheck(this, PapiApi);
696
- this._ttlMs = DEFAULT_TTL_MS;
697
- this.initialized = false;
698
- this.disconnectAllowed = true;
699
- this._config = config;
739
+ _this = _callSuper(this, PapiApi, arguments);
740
+ _this.type = 'PAPI';
741
+ return _this;
700
742
  }
743
+ _inherits(PapiApi, _PolkadotApi);
701
744
  return _createClass(PapiApi, [{
702
- key: "getType",
703
- value: function getType() {
704
- return 'PAPI';
705
- }
706
- }, {
707
- key: "getConfig",
708
- value: function getConfig() {
709
- return this._config;
710
- }
711
- }, {
712
- key: "getApi",
713
- value: function getApi() {
714
- return this.api;
715
- }
716
- }, {
717
745
  key: "init",
718
746
  value: function () {
719
747
  var _init = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(chain) {
720
- var _this = this;
748
+ var _this2 = this;
721
749
  var clientTtlMs,
722
750
  _args = arguments;
723
751
  return _regenerator().w(function (_context2) {
724
752
  while (1) switch (_context2.n) {
725
753
  case 0:
726
754
  clientTtlMs = _args.length > 1 && _args[1] !== undefined ? _args[1] : DEFAULT_TTL_MS;
727
- if (!(this.initialized || isExternalChain(chain))) {
755
+ if (!(this._chain !== undefined || isExternalChain(chain))) {
728
756
  _context2.n = 1;
729
757
  break;
730
758
  }
@@ -734,11 +762,10 @@ var PapiApi = /*#__PURE__*/function () {
734
762
  this._chain = chain;
735
763
  _context2.n = 2;
736
764
  return resolveChainApi(this._config, chain, function (wsUrl, c) {
737
- return _this.createApiInstance(wsUrl, c);
765
+ return _this2.createApiInstance(wsUrl, c);
738
766
  });
739
767
  case 2:
740
- this.api = _context2.v;
741
- this.initialized = true;
768
+ this._api = _context2.v;
742
769
  case 3:
743
770
  return _context2.a(2);
744
771
  }
@@ -1113,7 +1140,7 @@ var PapiApi = /*#__PURE__*/function () {
1113
1140
  key: "getDryRunCall",
1114
1141
  value: function () {
1115
1142
  var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(options) {
1116
- var _this2 = this;
1143
+ var _this3 = this;
1117
1144
  var tx, chain, destination, address, feeAsset, bypassOptions, version, _options$useRootOrigi, useRootOrigin, _getAssetsObject, supportsDryRunApi, basePayload, resolvedTx, performDryRunCall, getExecutionSuccessFromResult, findFailureObjectFromResult, extractFailureReasonFromResult, result, isSuccess, failureOutputReason, initialFailureReason, resolvedFeeAsset, actualWeight, weight, forwardedXcms, destParaId, USE_XCM_PAYMENT_API_CHAINS, overriddenWeight, xcmFee, _yield$this$getPaymen, executionFee, fee, _t2, _t3;
1118
1145
  return _regenerator().w(function (_context10) {
1119
1146
  while (1) switch (_context10.n) {
@@ -1153,7 +1180,7 @@ var PapiApi = /*#__PURE__*/function () {
1153
1180
  resolvedTx = _t2;
1154
1181
  performDryRunCall = /*#__PURE__*/function () {
1155
1182
  var _ref10 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(includeVersion) {
1156
- var _this2$api$getUnsafeA;
1183
+ var _this3$api$getUnsafeA;
1157
1184
  var callArgs, versionNum;
1158
1185
  return _regenerator().w(function (_context1) {
1159
1186
  while (1) switch (_context1.n) {
@@ -1163,7 +1190,7 @@ var PapiApi = /*#__PURE__*/function () {
1163
1190
  versionNum = Number(version.charAt(1));
1164
1191
  callArgs.push(versionNum);
1165
1192
  }
1166
- return _context1.a(2, (_this2$api$getUnsafeA = _this2.api.getUnsafeApi().apis.DryRunApi).dry_run_call.apply(_this2$api$getUnsafeA, callArgs));
1193
+ return _context1.a(2, (_this3$api$getUnsafeA = _this3.api.getUnsafeApi().apis.DryRunApi).dry_run_call.apply(_this3$api$getUnsafeA, callArgs));
1167
1194
  }
1168
1195
  }, _callee1);
1169
1196
  }));
@@ -1440,7 +1467,7 @@ var PapiApi = /*#__PURE__*/function () {
1440
1467
  key: "getXcmPaymentApiFee",
1441
1468
  value: function () {
1442
1469
  var _getXcmPaymentApiFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(chain, localXcm, forwardedXcm, asset, version) {
1443
- var _this3 = this,
1470
+ var _this4 = this,
1444
1471
  _execFeeRes$value;
1445
1472
  var transformXcm,
1446
1473
  overridenWeight,
@@ -1468,7 +1495,7 @@ var PapiApi = /*#__PURE__*/function () {
1468
1495
  while (1) switch (_context13.n) {
1469
1496
  case 0:
1470
1497
  _context13.n = 1;
1471
- return _this3.api.getUnsafeApi().apis.XcmPaymentApi.query_xcm_weight(transformedXcm);
1498
+ return _this4.api.getUnsafeApi().apis.XcmPaymentApi.query_xcm_weight(transformedXcm);
1472
1499
  case 1:
1473
1500
  weightRes = _context13.v;
1474
1501
  return _context13.a(2, weightRes.value);
@@ -1724,22 +1751,12 @@ var PapiApi = /*#__PURE__*/function () {
1724
1751
  }
1725
1752
  return getBridgeStatus;
1726
1753
  }()
1727
- }, {
1728
- key: "setDisconnectAllowed",
1729
- value: function setDisconnectAllowed(allowed) {
1730
- this.disconnectAllowed = allowed;
1731
- }
1732
- }, {
1733
- key: "getDisconnectAllowed",
1734
- value: function getDisconnectAllowed() {
1735
- return this.disconnectAllowed;
1736
- }
1737
1754
  }, {
1738
1755
  key: "disconnect",
1739
1756
  value: function disconnect() {
1740
1757
  var _this$_config$apiOver;
1741
1758
  var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
1742
- if (!this.initialized) return Promise.resolve();
1759
+ if (!this._chain) return Promise.resolve();
1743
1760
  if (!force && !this.disconnectAllowed) return Promise.resolve();
1744
1761
  var api = isConfig(this._config) ? (_this$_config$apiOver = this._config.apiOverrides) === null || _this$_config$apiOver === void 0 ? void 0 : _this$_config$apiOver[this._chain] : this._config;
1745
1762
  // Own client provided, destroy only if force true
@@ -1819,7 +1836,7 @@ var PapiApi = /*#__PURE__*/function () {
1819
1836
  return signAndSubmitFinalized;
1820
1837
  }()
1821
1838
  }]);
1822
- }();
1839
+ }(PolkadotApi);
1823
1840
 
1824
1841
  var createChainClient = function createChainClient(chain, api) {
1825
1842
  var papiApi = new PapiApi(api);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk",
3
- "version": "13.0.0-rc.1",
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": "13.0.0-rc.1"
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"