@paraspell/sdk 12.0.1 → 12.0.2
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 +77 -78
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -79,14 +79,14 @@ Latest news:
|
|
|
79
79
|
```
|
|
80
80
|
|
|
81
81
|
### Sending XCM
|
|
82
|
-
|
|
83
|
-
For full documentation with examples on this feature head over to [official documentation](https://paraspell.github.io/docs/sdk/xcmPallet.html).
|
|
82
|
+
For full documentation on XCM Transfers head over to [official documentation](https://paraspell.github.io/docs/sdk/xcmPallet.html).
|
|
84
83
|
|
|
85
84
|
#### Transfer assets from Parachain to Parachain
|
|
85
|
+
|
|
86
86
|
```ts
|
|
87
87
|
const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
88
|
-
.from(
|
|
89
|
-
.to(
|
|
88
|
+
.from(TChain)
|
|
89
|
+
.to(TChain /*,customParaId - optional*/ | Location object /*Only works for PolkadotXCM pallet*/)
|
|
90
90
|
.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}, ..])
|
|
91
91
|
.address(address | Location object /*If you are sending through xTokens, you need to pass the destination and address Location in one object (x2)*/)
|
|
92
92
|
.senderAddress(address) // - 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.
|
|
@@ -119,10 +119,11 @@ await builder.disconnect()
|
|
|
119
119
|
```
|
|
120
120
|
|
|
121
121
|
#### Transfer assets from the Relay chain to the Parachain
|
|
122
|
+
|
|
122
123
|
```ts
|
|
123
124
|
const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
124
|
-
.from(
|
|
125
|
-
.to(
|
|
125
|
+
.from(TRelaychain) // Kusama | Polkadot | Westend | Paseo
|
|
126
|
+
.to(TChain/*,customParaId - optional*/ | Location object)
|
|
126
127
|
.currency({symbol: 'DOT', amount: amount /*Use "ALL" to transfer everything*/})
|
|
127
128
|
.address(address | Location object)
|
|
128
129
|
/*.xcmVersion(Version.V3/V4/V5) //Optional parameter for manual override of XCM Version used in call
|
|
@@ -152,10 +153,11 @@ await builder.disconnect()
|
|
|
152
153
|
```
|
|
153
154
|
|
|
154
155
|
#### Transfer assets from Parachain to Relay chain
|
|
156
|
+
|
|
155
157
|
```ts
|
|
156
158
|
const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
157
|
-
.from(
|
|
158
|
-
.to(
|
|
159
|
+
.from(TChain)
|
|
160
|
+
.to(TRelaychain) // Kusama | Polkadot | Westend | Paseo
|
|
159
161
|
.currency({symbol: 'DOT', amount: amount /*Use "ALL" to transfer everything*/})
|
|
160
162
|
.address(address | Location object)
|
|
161
163
|
/*.xcmVersion(Version.V3/V4/V5) //Optional parameter for manual override of XCM Version used in call
|
|
@@ -185,10 +187,11 @@ await builder.disconnect()
|
|
|
185
187
|
```
|
|
186
188
|
|
|
187
189
|
#### Local transfers
|
|
190
|
+
|
|
188
191
|
```ts
|
|
189
192
|
const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
190
|
-
.from(
|
|
191
|
-
.to(
|
|
193
|
+
.from(TChain)
|
|
194
|
+
.to(TChain) //Has to be the same as the origin (from)
|
|
192
195
|
.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}, ..])
|
|
193
196
|
.address(address)
|
|
194
197
|
|
|
@@ -216,16 +219,17 @@ await builder.disconnect()
|
|
|
216
219
|
```
|
|
217
220
|
|
|
218
221
|
#### Batch calls
|
|
222
|
+
|
|
219
223
|
```ts
|
|
220
224
|
const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
221
|
-
.from(
|
|
222
|
-
.to(
|
|
225
|
+
.from(TChain) //Ensure, that origin chain is the same in all batched XCM Calls.
|
|
226
|
+
.to(TChain2) //Any compatible Parachain
|
|
223
227
|
.currency({currencySelection, amount}) //Currency to transfer - options as in scenarios above
|
|
224
228
|
.address(address | Location object)
|
|
225
229
|
.addToBatch()
|
|
226
230
|
|
|
227
|
-
.from(
|
|
228
|
-
.to(
|
|
231
|
+
.from(TChain) //Ensure, that origin chain is the same in all batched XCM Calls.
|
|
232
|
+
.to(TChain3) //Any compatible Parachain
|
|
229
233
|
.currency({currencySelection, amount}) //Currency to transfer - options as in scenarios above
|
|
230
234
|
.address(address | Location object)
|
|
231
235
|
.addToBatch()
|
|
@@ -240,10 +244,11 @@ await builder.disconnect()
|
|
|
240
244
|
```
|
|
241
245
|
|
|
242
246
|
#### Asset claim:
|
|
247
|
+
|
|
243
248
|
```ts
|
|
244
249
|
//Claim XCM trapped assets from the selected chain
|
|
245
250
|
const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
246
|
-
.claimFrom(
|
|
251
|
+
.claimFrom(TChain)
|
|
247
252
|
.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}, ..]
|
|
248
253
|
)
|
|
249
254
|
.address(address | Location object)
|
|
@@ -256,11 +261,12 @@ await builder.disconnect()
|
|
|
256
261
|
```
|
|
257
262
|
|
|
258
263
|
#### Dry run your XCM Calls:
|
|
264
|
+
|
|
259
265
|
```ts
|
|
260
266
|
//Builder pattern
|
|
261
267
|
const result = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
262
|
-
.from(
|
|
263
|
-
.to(
|
|
268
|
+
.from(TChain)
|
|
269
|
+
.to(TChain)
|
|
264
270
|
.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*/}]})
|
|
265
271
|
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in same fee asset as selected currency.*/
|
|
266
272
|
.address(ADDRESS)
|
|
@@ -270,17 +276,16 @@ const result = await Builder(/*chain api/builder_config/ws_url_string/ws_url_arr
|
|
|
270
276
|
//Check Parachain for DryRun support - returns true/false
|
|
271
277
|
import { hasDryRunSupport } from "@paraspell/sdk";
|
|
272
278
|
|
|
273
|
-
const result = hasDryRunSupport(
|
|
279
|
+
const result = hasDryRunSupport(TChain)
|
|
274
280
|
```
|
|
275
281
|
|
|
276
282
|
#### Dry run preview:
|
|
277
|
-
More on this feature in [official documentation](https://paraspell.github.io/docs/sdk/xcmPallet.html#preview-your-call-results)
|
|
278
283
|
|
|
279
284
|
```ts
|
|
280
285
|
//Builder pattern
|
|
281
286
|
const result = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
282
|
-
.from(
|
|
283
|
-
.to(
|
|
287
|
+
.from(TChain)
|
|
288
|
+
.to(TChain)
|
|
284
289
|
.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*/}]})
|
|
285
290
|
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in same fee asset as selected currency.*/
|
|
286
291
|
.address(ADDRESS)
|
|
@@ -290,8 +295,6 @@ const result = await Builder(/*chain api/builder_config/ws_url_string/ws_url_arr
|
|
|
290
295
|
|
|
291
296
|
### Localhost test setup
|
|
292
297
|
|
|
293
|
-
SDK offers enhanced localhost support. You can pass an object containing overrides for all WS endpoints (Including hops) used in the test transfer. This allows for advanced localhost testing such as localhost dry-run or xcm-fee queries. More information about available options can be found in the [official documentation](https://paraspell.github.io/docs/sdk/xcmPallet.html#localhost-testing-setup).
|
|
294
|
-
|
|
295
298
|
```ts
|
|
296
299
|
const builder = await Builder({
|
|
297
300
|
development: true, // Optional: Enforces overrides for all chains used
|
|
@@ -303,8 +306,8 @@ const builder = await Builder({
|
|
|
303
306
|
//ChainName: ...
|
|
304
307
|
}
|
|
305
308
|
})
|
|
306
|
-
.from(
|
|
307
|
-
.to(
|
|
309
|
+
.from(TChain)
|
|
310
|
+
.to(TChain)
|
|
308
311
|
.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*/}])
|
|
309
312
|
.address(address)
|
|
310
313
|
|
|
@@ -315,15 +318,14 @@ await builder.disconnect()
|
|
|
315
318
|
```
|
|
316
319
|
|
|
317
320
|
### XCM Fee queries
|
|
318
|
-
|
|
319
|
-
For full documentation with examples on this feature, head to [official documentation](https://paraspell.github.io/docs/sdk/xcmUtils.html).
|
|
321
|
+
For full documentation with output examples of XCM Fee queries, head to [official documentation](https://paraspell.github.io/docs/sdk/xcmUtils.html).
|
|
320
322
|
|
|
321
323
|
#### XCM Transfer info
|
|
322
324
|
```ts
|
|
323
325
|
const info = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
324
|
-
.from(
|
|
325
|
-
.to(
|
|
326
|
-
.currency(
|
|
326
|
+
.from(TChain)
|
|
327
|
+
.to(TChain)
|
|
328
|
+
.currency(CURRENCY_SPEC)
|
|
327
329
|
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
|
|
328
330
|
.address(RECIPIENT_ADDRESS)
|
|
329
331
|
.senderAddress(SENDER_ADDRESS)
|
|
@@ -333,9 +335,9 @@ const info = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array
|
|
|
333
335
|
#### Transferable amount
|
|
334
336
|
```ts
|
|
335
337
|
const transferable = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
336
|
-
.from(
|
|
337
|
-
.to(
|
|
338
|
-
.currency(
|
|
338
|
+
.from(TChain)
|
|
339
|
+
.to(TChain)
|
|
340
|
+
.currency(CURRENCY_SPEC)
|
|
339
341
|
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
|
|
340
342
|
.address(RECIPIENT_ADDRESS)
|
|
341
343
|
.senderAddress(SENDER_ADDRESS)
|
|
@@ -345,9 +347,9 @@ const transferable = await Builder(/*chain api/builder_config/ws_url_string/ws_u
|
|
|
345
347
|
#### Minimal transferable amount
|
|
346
348
|
```ts
|
|
347
349
|
const transferable = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
348
|
-
.from(
|
|
349
|
-
.to(
|
|
350
|
-
.currency(
|
|
350
|
+
.from(TChain)
|
|
351
|
+
.to(TChain)
|
|
352
|
+
.currency(CURRENCY_SPEC)
|
|
351
353
|
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
|
|
352
354
|
.address(RECIPIENT_ADDRESS)
|
|
353
355
|
.senderAddress(SENDER_ADDRESS)
|
|
@@ -357,9 +359,9 @@ const transferable = await Builder(/*chain api/builder_config/ws_url_string/ws_u
|
|
|
357
359
|
#### Receivable amount
|
|
358
360
|
```ts
|
|
359
361
|
const receivable = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
360
|
-
.from(
|
|
361
|
-
.to(
|
|
362
|
-
.currency(
|
|
362
|
+
.from(TChain)
|
|
363
|
+
.to(TChain)
|
|
364
|
+
.currency(CURRENCY_SPEC)
|
|
363
365
|
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
|
|
364
366
|
.address(RECIPIENT_ADDRESS)
|
|
365
367
|
.senderAddress(SENDER_ADDRESS)
|
|
@@ -369,9 +371,9 @@ const receivable = await Builder(/*chain api/builder_config/ws_url_string/ws_url
|
|
|
369
371
|
#### Verify ED on destination
|
|
370
372
|
```ts
|
|
371
373
|
const ed = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
372
|
-
.from(
|
|
373
|
-
.to(
|
|
374
|
-
.currency(
|
|
374
|
+
.from(TChain)
|
|
375
|
+
.to(TChain)
|
|
376
|
+
.currency(CURRENCY_SPEC)
|
|
375
377
|
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
|
|
376
378
|
.address(RECIPIENT_ADDRESS)
|
|
377
379
|
.senderAddress(SENDER_ADDRESS)
|
|
@@ -382,9 +384,9 @@ const ed = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array -
|
|
|
382
384
|
|
|
383
385
|
```ts
|
|
384
386
|
const fee = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
385
|
-
.from(
|
|
386
|
-
.to(
|
|
387
|
-
.currency(
|
|
387
|
+
.from(TChain)
|
|
388
|
+
.to(TChain)
|
|
389
|
+
.currency(CURRENCY_SPEC)
|
|
388
390
|
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
|
|
389
391
|
.address(RECIPIENT_ADDRESS)
|
|
390
392
|
.senderAddress(SENDER_ADDRESS)
|
|
@@ -395,9 +397,9 @@ const fee = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array
|
|
|
395
397
|
|
|
396
398
|
```ts
|
|
397
399
|
const fee = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
398
|
-
.from(
|
|
399
|
-
.to(
|
|
400
|
-
.currency(
|
|
400
|
+
.from(TChain)
|
|
401
|
+
.to(TChain)
|
|
402
|
+
.currency(CURRENCY_SPEC)
|
|
401
403
|
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
|
|
402
404
|
.address(RECIPIENT_ADDRESS)
|
|
403
405
|
.senderAddress(SENDER_ADDRESS)
|
|
@@ -409,7 +411,7 @@ const fee = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array
|
|
|
409
411
|
import { getBalance } from "@paraspell/sdk";
|
|
410
412
|
|
|
411
413
|
//Retrieves the asset balance for a given account on a specified chain (You do not need to specify if it is native or foreign).
|
|
412
|
-
const balance = await getBalance({
|
|
414
|
+
const balance = await getBalance({ADDRESS, TChain, CURRENCY_SPEC /*- {id: currencyID} | {symbol: currencySymbol} | {symbol: Native('currencySymbol')} | {symbol: Foreign('currencySymbol')} | {symbol: ForeignAbstract('currencySymbol')} | {location: AssetLocationString | AssetLocationJson}*/, api /* api/ws_url_string optional */});
|
|
413
415
|
```
|
|
414
416
|
|
|
415
417
|
#### Ethereum bridge fees
|
|
@@ -425,64 +427,63 @@ import { getExistentialDeposit } from "@paraspell/sdk";
|
|
|
425
427
|
|
|
426
428
|
//Currency is an optional parameter. If you wish to query a native asset, the currency parameter is not necessary.
|
|
427
429
|
//Currency can be either {symbol: assetSymbol}, {id: assetId}, {location: assetLocation}.
|
|
428
|
-
const ed = getExistentialDeposit(
|
|
430
|
+
const ed = getExistentialDeposit(Tchain, CURRENCY_SPEC?)
|
|
429
431
|
```
|
|
430
432
|
|
|
431
433
|
#### Convert SS58 address
|
|
432
434
|
```ts
|
|
433
435
|
import { convertSs58 } from "@paraspell/sdk";
|
|
434
436
|
|
|
435
|
-
let result = convertSs58(
|
|
437
|
+
let result = convertSs58(ADDRESS, TChain) // returns converted address in string
|
|
436
438
|
```
|
|
437
439
|
|
|
438
440
|
### Asset queries
|
|
439
|
-
|
|
440
|
-
For full documentation with examples on this feature, head over to [official documentation](https://paraspell.github.io/docs/sdk/AssetPallet.html).
|
|
441
|
+
For full documentation with output examples of asset queries, head over to [official documentation](https://paraspell.github.io/docs/sdk/AssetPallet.html).
|
|
441
442
|
|
|
442
443
|
```ts
|
|
443
444
|
import { getSupportedDestinations, getFeeAssets, getAssetsObject, getAssetId, getRelayChainSymbol, getNativeAssets, getNativeAssets, getOtherAssets, getAllAssetsSymbols, hasSupportForAsset, getAssetDecimals, getParaId, getTChain, getAssetLocation, CHAINS, findAssetInfo, findAssetInfoOrThrow } from '@paraspell/sdk'
|
|
444
445
|
|
|
445
446
|
//Get chains that support the specific asset related to origin
|
|
446
|
-
getSupportedDestinations(
|
|
447
|
+
getSupportedDestinations(TChain, CURRENCY)
|
|
447
448
|
|
|
448
449
|
//Find out whether asset is registered on chain and return its entire parameters. If not found, returns null.
|
|
449
|
-
findAssetInfo(
|
|
450
|
+
findAssetInfo(TChain, CURRENCY, DESTINATION?)
|
|
450
451
|
|
|
451
452
|
//Find out whether asset is registered on chain and return its entire parameters. If not found, returns error.
|
|
452
|
-
findAssetInfoOrThrow(
|
|
453
|
+
findAssetInfoOrThrow(TChain, CURRENCY, DESTINATION?)
|
|
453
454
|
|
|
454
455
|
// Retrieve Fee asset queries (Assets accepted as XCM Fee on specific chain)
|
|
455
|
-
getFeeAssets(
|
|
456
|
+
getFeeAssets(TChain)
|
|
456
457
|
|
|
457
458
|
// Get Location for asset ID or symbol on a specific chain
|
|
458
|
-
getAssetLocation(
|
|
459
|
+
getAssetLocation(TChain, { symbol: symbol } | { id: assetId })
|
|
459
460
|
|
|
460
461
|
// Retrieve assets object from assets.json for a particular chain, including information about native and foreign assets
|
|
461
|
-
getAssetsObject(
|
|
462
|
+
getAssetsObject(TChain)
|
|
462
463
|
|
|
463
464
|
// Retrieve foreign assetId for a particular chain and asset symbol
|
|
464
|
-
getAssetId(
|
|
465
|
+
getAssetId(TChain, ASSET_SYMBOL)
|
|
465
466
|
|
|
466
467
|
// Retrieve the symbol of the relay chain for a particular chain. Either "DOT" or "KSM"
|
|
467
|
-
getRelayChainSymbol(
|
|
468
|
+
getRelayChainSymbol(TChain)
|
|
468
469
|
|
|
469
470
|
// Retrieve string array of native assets symbols for a particular chain
|
|
470
|
-
getNativeAssets(
|
|
471
|
+
getNativeAssets(TChain)
|
|
471
472
|
|
|
472
473
|
// Retrieve object array of foreign assets for a particular chain. Each object has a symbol and an assetId property
|
|
473
|
-
getOtherAssets(
|
|
474
|
+
getOtherAssets(TChain)
|
|
474
475
|
|
|
475
476
|
// Retrieve string array of all asset symbols. (native and foreign assets are merged into a single array)
|
|
476
|
-
getAllAssetsSymbols(
|
|
477
|
+
getAllAssetsSymbols(TChain)
|
|
477
478
|
|
|
478
479
|
// Check if a chain supports a particular asset. (Both native and foreign assets are searched). Returns boolean
|
|
479
|
-
hasSupportForAsset(
|
|
480
|
+
hasSupportForAsset(TChain, ASSET_SYMBOL)
|
|
480
481
|
|
|
481
482
|
// Get decimals for specific asset
|
|
482
|
-
getAssetDecimals(
|
|
483
|
+
getAssetDecimals(TChain, ASSET_SYMBOL)
|
|
483
484
|
|
|
484
485
|
// Get specific chain id
|
|
485
|
-
getParaId(
|
|
486
|
+
getParaId(TChain)
|
|
486
487
|
|
|
487
488
|
// Get specific TChain from chainID
|
|
488
489
|
getTChain(paraID: number, ecosystem: 'Polkadot' | 'Kusama' | 'Ethereum' | 'Paseo' | 'Westend') //When the Ethereum ecosystem is selected, please fill chainID as 1 to select Ethereum.
|
|
@@ -492,26 +493,25 @@ CHAINS
|
|
|
492
493
|
```
|
|
493
494
|
|
|
494
495
|
### Parachain XCM Pallet queries
|
|
495
|
-
|
|
496
|
-
For full documentation with examples on this feature head over to [official documentation](https://paraspell.github.io/docs/sdk/NodePallets.html).
|
|
496
|
+
For full documentation with output examples of pallet queries, head over to [official documentation](https://paraspell.github.io/docs/sdk/NodePallets.html).
|
|
497
497
|
|
|
498
498
|
```ts
|
|
499
499
|
import { getDefaultPallet, getSupportedPallets, getPalletIndex, getNativeAssetsPallet, getOtherAssetsPallets, SUPPORTED_PALLETS } from '@paraspell/sdk';
|
|
500
500
|
|
|
501
501
|
//Retrieve default pallet for specific Parachain
|
|
502
|
-
getDefaultPallet(
|
|
502
|
+
getDefaultPallet(chain: TChain)
|
|
503
503
|
|
|
504
504
|
// Returns an array of supported pallets for a specific Parachain
|
|
505
|
-
getSupportedPallets(
|
|
505
|
+
getSupportedPallets(chain: TChain)
|
|
506
506
|
|
|
507
507
|
//Returns index of XCM Pallet used by Parachain
|
|
508
|
-
getPalletIndex(
|
|
508
|
+
getPalletIndex(chain: TChain)
|
|
509
509
|
|
|
510
510
|
//Returns all pallets for local transfers of native assets for specific chain.
|
|
511
511
|
getNativeAssetsPallet(chain: TChain)
|
|
512
512
|
|
|
513
513
|
//Returns all pallets for local transfers of foreign assets for specific chain.
|
|
514
|
-
getOtherAssetsPallets(
|
|
514
|
+
getOtherAssetsPallets(chain: TChain)
|
|
515
515
|
|
|
516
516
|
// Print all pallets that are currently supported
|
|
517
517
|
console.log(SUPPORTED_PALLETS)
|
|
@@ -548,9 +548,8 @@ Published under [MIT License](https://github.com/paraspell/xcm-tools/blob/main/p
|
|
|
548
548
|
|
|
549
549
|
## Supported by
|
|
550
550
|
|
|
551
|
-
<div
|
|
552
|
-
|
|
553
|
-
<img width="
|
|
554
|
-
|
|
555
|
-
</p>
|
|
551
|
+
<div>
|
|
552
|
+
<div align="center" style="margin-top: 20px;">
|
|
553
|
+
<img width="750" alt="version" src="https://github.com/user-attachments/assets/29e4b099-d90c-46d6-a3ce-94edfbda003c" />
|
|
554
|
+
</div>
|
|
556
555
|
</div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.2",
|
|
4
4
|
"description": "SDK for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@noble/hashes": "^2.0.1",
|
|
27
27
|
"@polkadot-api/legacy-provider": "^0.3.6",
|
|
28
28
|
"viem": "^2.40.3",
|
|
29
|
-
"@paraspell/sdk-core": "12.0.
|
|
29
|
+
"@paraspell/sdk-core": "12.0.2"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"polkadot-api": ">= 1.22.0 < 2"
|