@paraspell/sdk 10.11.9 → 11.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 +92 -86
- package/dist/index.cjs +63 -63
- package/dist/index.d.ts +25 -25
- package/dist/index.mjs +64 -64
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -73,11 +73,13 @@ NOTES:
|
|
|
73
73
|
- Local transfers are now available for every currency and every chain. To try them, simply use the same origin and destination parameters.
|
|
74
74
|
- Transfer info queries are now all in the Builder pattern and don't require any imports other than the builder.
|
|
75
75
|
- You can now query Ethereum asset balances on Ethereum via balance query
|
|
76
|
+
- The Builder() now accepts an optional configuration object (To enhance localhost experience and testing). This object can contain apiOverrides and a development flag. More information in the "Localhost test setup" section.
|
|
76
77
|
```
|
|
77
78
|
|
|
78
79
|
```
|
|
79
80
|
Latest news:
|
|
80
|
-
-
|
|
81
|
+
- V10 > V11 Migration guide https://paraspell.github.io/docs/migration/v10-to-v11.html
|
|
82
|
+
- Brand new asset decimal abstraction introduced. It can be turned on in Builder config. Will be turned on by default in next major release.
|
|
81
83
|
```
|
|
82
84
|
|
|
83
85
|
### Sending XCM
|
|
@@ -86,16 +88,16 @@ For full documentation with examples on this feature head over to [official docu
|
|
|
86
88
|
|
|
87
89
|
#### Transfer assets from Parachain to Parachain
|
|
88
90
|
```ts
|
|
89
|
-
const builder = Builder(/*
|
|
90
|
-
.from(
|
|
91
|
-
.to(
|
|
92
|
-
.currency({id: currencyID, amount: amount} | {symbol: currencySymbol, amount: amount} | {symbol: Native('currencySymbol'), amount: amount} | {symbol: Foreign('currencySymbol'), amount: amount} | {symbol: ForeignAbstract('currencySymbol'), amount: amount} | {
|
|
93
|
-
.address(address |
|
|
91
|
+
const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
92
|
+
.from(CHAIN)
|
|
93
|
+
.to(CHAIN /*,customParaId - optional*/ | Location object /*Only works for PolkadotXCM pallet*/)
|
|
94
|
+
.currency({id: currencyID, amount: amount} | {symbol: currencySymbol, amount: amount} | {symbol: Native('currencySymbol'), amount: amount} | {symbol: Foreign('currencySymbol'), amount: amount} | {symbol: ForeignAbstract('currencySymbol'), amount: amount} | {location: AssetLocationString, amount: amount | AssetLocationJson, amount: amount} | {location: Override('Custom Location'), amount: amount} | [{currencySelection /*for example symbol: symbol or id: id, or location: location*/, amount: amount}, {currencySelection}, ..])
|
|
95
|
+
.address(address | Location object /*If you are sending through xTokens, you need to pass the destination and address Location in one object (x2)*/)
|
|
94
96
|
.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.
|
|
95
|
-
/*.ahAddress(ahAddress) - OPTIONAL - used when origin is EVM
|
|
96
|
-
.feeAsset({symbol: 'symbol'} || {id: 'id'} || {
|
|
97
|
-
.xcmVersion(Version.
|
|
98
|
-
.customPallet('Pallet','pallet_function') //Optional parameter for manual override of XCM Pallet and function used in call (If they are named differently on some
|
|
97
|
+
/*.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)
|
|
98
|
+
.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
|
|
99
|
+
.xcmVersion(Version.V3/V4/V5) //Optional parameter for manual override of XCM Version used in call
|
|
100
|
+
.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.*/
|
|
99
101
|
|
|
100
102
|
const tx = await builder.build()
|
|
101
103
|
|
|
@@ -119,15 +121,16 @@ const tx = await builder.build()
|
|
|
119
121
|
await builder.disconnect()
|
|
120
122
|
*/
|
|
121
123
|
```
|
|
124
|
+
|
|
122
125
|
#### Transfer assets from the Relay chain to the Parachain
|
|
123
126
|
```ts
|
|
124
|
-
const builder = Builder(/*
|
|
125
|
-
.from(
|
|
126
|
-
.to(
|
|
127
|
+
const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
128
|
+
.from(RELAY_CHAIN) // Kusama | Polkadot | Westend | Paseo
|
|
129
|
+
.to(CHAIN/*,customParaId - optional*/ | Location object)
|
|
127
130
|
.currency({symbol: 'DOT', amount: amount})
|
|
128
|
-
.address(address |
|
|
129
|
-
/*.xcmVersion(Version.
|
|
130
|
-
.customPallet('Pallet','pallet_function') //Optional parameter for manual override of XCM Pallet and function used in call (If they are named differently on some
|
|
131
|
+
.address(address | Location object)
|
|
132
|
+
/*.xcmVersion(Version.V3/V4/V5) //Optional parameter for manual override of XCM Version used in call
|
|
133
|
+
.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.*/
|
|
131
134
|
|
|
132
135
|
const tx = await builder.build()
|
|
133
136
|
|
|
@@ -151,15 +154,16 @@ const tx = await builder.build()
|
|
|
151
154
|
await builder.disconnect()
|
|
152
155
|
*/
|
|
153
156
|
```
|
|
157
|
+
|
|
154
158
|
#### Transfer assets from Parachain to Relay chain
|
|
155
159
|
```ts
|
|
156
|
-
const builder = Builder(/*
|
|
157
|
-
.from(
|
|
158
|
-
.to(
|
|
160
|
+
const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
161
|
+
.from(CHAIN)
|
|
162
|
+
.to(RELAY_CHAIN) // Kusama | Polkadot | Westend | Paseo
|
|
159
163
|
.currency({symbol: 'DOT', amount: amount})
|
|
160
|
-
.address(address |
|
|
161
|
-
/*.xcmVersion(Version.
|
|
162
|
-
.customPallet('Pallet','pallet_function') //Optional parameter for manual override of XCM Pallet and function used in call (If they are named differently on some
|
|
164
|
+
.address(address | Location object)
|
|
165
|
+
/*.xcmVersion(Version.V3/V4/V5) //Optional parameter for manual override of XCM Version used in call
|
|
166
|
+
.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.*/
|
|
163
167
|
|
|
164
168
|
const tx = await builder.build()
|
|
165
169
|
|
|
@@ -186,10 +190,10 @@ await builder.disconnect()
|
|
|
186
190
|
|
|
187
191
|
#### Local transfers
|
|
188
192
|
```ts
|
|
189
|
-
const builder = Builder(/*
|
|
190
|
-
.from(
|
|
191
|
-
.to(
|
|
192
|
-
.currency({id: currencyID, amount: amount} | {symbol: currencySymbol, amount: amount} | {symbol: Native('currencySymbol'), amount: amount} | {symbol: Foreign('currencySymbol'), amount: amount} | {symbol: ForeignAbstract('currencySymbol'), amount: amount} | {
|
|
193
|
+
const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
194
|
+
.from(CHAIN)
|
|
195
|
+
.to(CHAIN) //Has to be the same as the origin (from)
|
|
196
|
+
.currency({id: currencyID, amount: amount} | {symbol: currencySymbol, amount: amount} | {symbol: Native('currencySymbol'), amount: amount} | {symbol: Foreign('currencySymbol'), amount: amount} | {symbol: ForeignAbstract('currencySymbol'), amount: amount} | {location: AssetLocationString, amount: amount | AssetLocationJson, amount: amount} | {location: Override('Custom Location'), amount: amount} | [{currencySelection /*for example symbol: symbol or id: id, or location: location*/, amount: amount}, {currencySelection}, ..])
|
|
193
197
|
.address(address)
|
|
194
198
|
|
|
195
199
|
const tx = await builder.build()
|
|
@@ -217,17 +221,17 @@ await builder.disconnect()
|
|
|
217
221
|
|
|
218
222
|
#### Batch calls
|
|
219
223
|
```ts
|
|
220
|
-
const builder = Builder(/*
|
|
221
|
-
.from(
|
|
222
|
-
.to(
|
|
224
|
+
const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
225
|
+
.from(CHAIN) //Ensure, that origin chain is the same in all batched XCM Calls.
|
|
226
|
+
.to(CHAIN_2) //Any compatible Parachain
|
|
223
227
|
.currency({currencySelection, amount}) //Currency to transfer - options as in scenarios above
|
|
224
|
-
.address(address |
|
|
228
|
+
.address(address | Location object)
|
|
225
229
|
.addToBatch()
|
|
226
230
|
|
|
227
|
-
.from(
|
|
228
|
-
.to(
|
|
231
|
+
.from(CHAIN) //Ensure, that origin chain is the same in all batched XCM Calls.
|
|
232
|
+
.to(CHAIN_3) //Any compatible Parachain
|
|
229
233
|
.currency({currencySelection, amount}) //Currency to transfer - options as in scenarios above
|
|
230
|
-
.address(address |
|
|
234
|
+
.address(address | Location object)
|
|
231
235
|
.addToBatch()
|
|
232
236
|
|
|
233
237
|
const tx = await builder.buildBatch({
|
|
@@ -242,11 +246,12 @@ await builder.disconnect()
|
|
|
242
246
|
#### Asset claim:
|
|
243
247
|
```ts
|
|
244
248
|
//Claim XCM trapped assets from the selected chain
|
|
245
|
-
const builder = Builder(/*
|
|
246
|
-
.claimFrom(
|
|
247
|
-
.
|
|
248
|
-
|
|
249
|
-
|
|
249
|
+
const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
250
|
+
.claimFrom(CHAIN)
|
|
251
|
+
.currency({id: currencyID, amount: amount} | {symbol: currencySymbol, amount: amount} | {symbol: Native('currencySymbol'), amount: amount} | {symbol: Foreign('currencySymbol'), amount: amount} | {symbol: ForeignAbstract('currencySymbol'), amount: amount} | {location: AssetLocationString, amount: amount | AssetLocationJson, amount: amount} | [{currencySelection /*for example symbol: symbol or id: id, or location: location*/, amount: amount}, {currencySelection}, ..]
|
|
252
|
+
)
|
|
253
|
+
.address(address | Location object)
|
|
254
|
+
/*.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.*/
|
|
250
255
|
|
|
251
256
|
const tx = await builder.build()
|
|
252
257
|
|
|
@@ -257,19 +262,19 @@ await builder.disconnect()
|
|
|
257
262
|
#### Dry run your XCM Calls:
|
|
258
263
|
```ts
|
|
259
264
|
//Builder pattern
|
|
260
|
-
const result = await Builder(
|
|
261
|
-
.from(
|
|
262
|
-
.to(
|
|
263
|
-
.currency({id: currencyID, amount: amount} | {symbol: currencySymbol, amount: amount} | {symbol: Native('currencySymbol'), amount: amount} | {symbol: Foreign('currencySymbol'), amount: amount} | {symbol: ForeignAbstract('currencySymbol'), amount: amount} | {
|
|
265
|
+
const result = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
266
|
+
.from(CHAIN)
|
|
267
|
+
.to(CHAIN_2)
|
|
268
|
+
.currency({id: currencyID, amount: amount} | {symbol: currencySymbol, amount: amount} | {symbol: Native('currencySymbol'), amount: amount} | {symbol: Foreign('currencySymbol'), amount: amount} | {symbol: ForeignAbstract('currencySymbol'), amount: amount} | {location: AssetLocationString, amount: amount | AssetLocationJson, amount: amount} | {location: Override('Custom Location'), amount: amount} | {[{currencySelection, isFeeAsset?: true /* for example symbol: symbol or id: id, or Location: Location*/, amount: amount}]})
|
|
264
269
|
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in same fee asset as selected currency.*/
|
|
265
270
|
.address(ADDRESS)
|
|
266
271
|
.senderAddress(SENDER_ADDRESS)
|
|
267
272
|
.dryRun()
|
|
268
273
|
|
|
269
274
|
//Check Parachain for DryRun support - returns true/false
|
|
270
|
-
import { hasDryRunSupport } from "@paraspell/sdk
|
|
275
|
+
import { hasDryRunSupport } from "@paraspell/sdk";
|
|
271
276
|
|
|
272
|
-
const result = hasDryRunSupport(
|
|
277
|
+
const result = hasDryRunSupport(chain)
|
|
273
278
|
```
|
|
274
279
|
|
|
275
280
|
### Localhost test setup
|
|
@@ -279,6 +284,7 @@ SDK offers enhanced localhost support. You can pass an object containing overrid
|
|
|
279
284
|
```ts
|
|
280
285
|
const builder = await Builder({
|
|
281
286
|
development: true, // Optional: Enforces overrides for all chains used
|
|
287
|
+
decimalAbstraction: true //Abstracts decimals, so 1 as input amount equals 10_000_000_000 if selected asset is DOT.
|
|
282
288
|
apiOverrides: {
|
|
283
289
|
Hydration: // "wsEndpointString" | papiClient
|
|
284
290
|
BridgeHubPolkadot: // "wsEndpointString" | papiClient
|
|
@@ -287,7 +293,7 @@ const builder = await Builder({
|
|
|
287
293
|
})
|
|
288
294
|
.from(CHAIN)
|
|
289
295
|
.to(CHAIN)
|
|
290
|
-
.currency({id: currencyID, amount: amount} | {symbol: currencySymbol, amount: amount} | {symbol: Native('currencySymbol'), amount: amount} | {symbol: Foreign('currencySymbol'), amount: amount} | {symbol: ForeignAbstract('currencySymbol'), amount: amount} | {
|
|
296
|
+
.currency({id: currencyID, amount: amount} | {symbol: currencySymbol, amount: amount} | {symbol: Native('currencySymbol'), amount: amount} | {symbol: Foreign('currencySymbol'), amount: amount} | {symbol: ForeignAbstract('currencySymbol'), amount: amount} | {location: AssetLocationString, amount: amount | AssetLocationJson, amount: amount} | {location: Override('Custom Location'), amount: amount} | [{currencySelection, isFeeAsset?: true /* for example symbol: symbol or id: id, or Location: Location*/, amount: amount}])
|
|
291
297
|
.address(address)
|
|
292
298
|
|
|
293
299
|
const tx = await builder.build()
|
|
@@ -302,7 +308,7 @@ For full documentation with examples on this feature, head to [official document
|
|
|
302
308
|
|
|
303
309
|
#### XCM Transfer info
|
|
304
310
|
```ts
|
|
305
|
-
const info = await Builder(/*
|
|
311
|
+
const info = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
306
312
|
.from(ORIGIN_CHAIN)
|
|
307
313
|
.to(DESTINATION_CHAIN)
|
|
308
314
|
.currency(CURRENCY)
|
|
@@ -314,7 +320,7 @@ const info = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
|
314
320
|
|
|
315
321
|
#### Transferable amount
|
|
316
322
|
```ts
|
|
317
|
-
const transferable = await Builder(/*
|
|
323
|
+
const transferable = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
318
324
|
.from(ORIGIN_CHAIN)
|
|
319
325
|
.to(DESTINATION_CHAIN)
|
|
320
326
|
.currency(CURRENCY)
|
|
@@ -326,7 +332,7 @@ const transferable = await Builder(/*node api/ws_url_string/ws_url_array - optio
|
|
|
326
332
|
|
|
327
333
|
#### Verify ED on destination
|
|
328
334
|
```ts
|
|
329
|
-
const ed = await Builder(/*
|
|
335
|
+
const ed = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
330
336
|
.from(ORIGIN_CHAIN)
|
|
331
337
|
.to(DESTINATION_CHAIN)
|
|
332
338
|
.currency(CURRENCY)
|
|
@@ -340,7 +346,7 @@ const ed = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
|
340
346
|
|
|
341
347
|
##### More accurate query using DryRun
|
|
342
348
|
```ts
|
|
343
|
-
const fee = await Builder(/*
|
|
349
|
+
const fee = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
344
350
|
.from(ORIGIN_CHAIN)
|
|
345
351
|
.to(DESTINATION_CHAIN)
|
|
346
352
|
.currency(CURRENCY)
|
|
@@ -352,7 +358,7 @@ const fee = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
|
352
358
|
|
|
353
359
|
##### Less accurate query using Payment info
|
|
354
360
|
```ts
|
|
355
|
-
const fee = await Builder(/*
|
|
361
|
+
const fee = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
356
362
|
.from(ORIGIN_CHAIN)
|
|
357
363
|
.to(DESTINATION_CHAIN)
|
|
358
364
|
.currency(CURRENCY)
|
|
@@ -365,7 +371,7 @@ const fee = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
|
365
371
|
|
|
366
372
|
##### More accurate query using DryRun
|
|
367
373
|
```ts
|
|
368
|
-
const fee = await Builder(/*
|
|
374
|
+
const fee = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
369
375
|
.from(ORIGIN_CHAIN)
|
|
370
376
|
.to(DESTINATION_CHAIN)
|
|
371
377
|
.currency(CURRENCY)
|
|
@@ -377,7 +383,7 @@ const fee = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
|
377
383
|
|
|
378
384
|
##### Less accurate query using Payment info
|
|
379
385
|
```ts
|
|
380
|
-
const fee = await Builder(/*
|
|
386
|
+
const fee = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
381
387
|
.from(ORIGIN_CHAIN)
|
|
382
388
|
.to(DESTINATION_CHAIN)
|
|
383
389
|
.currency(CURRENCY)
|
|
@@ -390,8 +396,8 @@ const fee = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
|
390
396
|
```ts
|
|
391
397
|
import { getAssetBalance } from "@paraspell/sdk";
|
|
392
398
|
|
|
393
|
-
//Retrieves the asset balance for a given account on a specified
|
|
394
|
-
const balance = await getAssetBalance({address,
|
|
399
|
+
//Retrieves the asset balance for a given account on a specified chain (You do not need to specify if it is native or foreign).
|
|
400
|
+
const balance = await getAssetBalance({address, chain, currency /*- {id: currencyID} | {symbol: currencySymbol} | {symbol: Native('currencySymbol')} | {symbol: Foreign('currencySymbol')} | {symbol: ForeignAbstract('currencySymbol')} | {location: AssetLocationString | AssetLocationJson}*/, api /* api/ws_url_string optional */});
|
|
395
401
|
```
|
|
396
402
|
|
|
397
403
|
#### Ethereum bridge fees
|
|
@@ -406,15 +412,15 @@ const fees = await getParaEthTransferFees(/*api - optional (Can also be WS port
|
|
|
406
412
|
import { getExistentialDeposit } from "@paraspell/sdk";
|
|
407
413
|
|
|
408
414
|
//Currency is an optional parameter. If you wish to query a native asset, the currency parameter is not necessary.
|
|
409
|
-
//Currency can be either {symbol: assetSymbol}, {id: assetId}, {
|
|
410
|
-
const ed = getExistentialDeposit(
|
|
415
|
+
//Currency can be either {symbol: assetSymbol}, {id: assetId}, {location: assetLocation}.
|
|
416
|
+
const ed = getExistentialDeposit(chain, currency?)
|
|
411
417
|
```
|
|
412
418
|
|
|
413
419
|
#### Convert SS58 address
|
|
414
420
|
```ts
|
|
415
421
|
import { convertSs58 } from "@paraspell/sdk";
|
|
416
422
|
|
|
417
|
-
let result = convertSs58(address,
|
|
423
|
+
let result = convertSs58(address, chain) // returns converted address in string
|
|
418
424
|
```
|
|
419
425
|
|
|
420
426
|
### Asset queries
|
|
@@ -422,49 +428,49 @@ let result = convertSs58(address, node) // returns converted address in string
|
|
|
422
428
|
For full documentation with examples on this feature, head over to [official documentation](https://paraspell.github.io/docs/sdk/AssetPallet.html).
|
|
423
429
|
|
|
424
430
|
```ts
|
|
425
|
-
import { getSupportedDestinations, getFeeAssets, getAssetsObject, getAssetId, getRelayChainSymbol, getNativeAssets, getNativeAssets, getOtherAssets, getAllAssetsSymbols, hasSupportForAsset, getAssetDecimals, getParaId,
|
|
431
|
+
import { getSupportedDestinations, getFeeAssets, getAssetsObject, getAssetId, getRelayChainSymbol, getNativeAssets, getNativeAssets, getOtherAssets, getAllAssetsSymbols, hasSupportForAsset, getAssetDecimals, getParaId, getTChain, getAssetLocation, CHAINS } from '@paraspell/sdk'
|
|
426
432
|
|
|
427
433
|
//Get chains that support the specific asset related to origin
|
|
428
|
-
getSupportedDestinations(
|
|
434
|
+
getSupportedDestinations(CHAIN, CURRENCY)
|
|
429
435
|
|
|
430
|
-
// Retrieve Fee asset queries (Assets accepted as XCM Fee on specific
|
|
431
|
-
getFeeAssets(
|
|
436
|
+
// Retrieve Fee asset queries (Assets accepted as XCM Fee on specific chain)
|
|
437
|
+
getFeeAssets(CHAIN)
|
|
432
438
|
|
|
433
|
-
// Get
|
|
434
|
-
|
|
439
|
+
// Get Location for asset ID or symbol on a specific chain
|
|
440
|
+
getAssetLocation(CHAIN, { symbol: symbol } | { id: assetId })
|
|
435
441
|
|
|
436
|
-
// Retrieve assets object from assets.json for a particular
|
|
437
|
-
getAssetsObject(
|
|
442
|
+
// Retrieve assets object from assets.json for a particular chain, including information about native and foreign assets
|
|
443
|
+
getAssetsObject(CHAIN)
|
|
438
444
|
|
|
439
|
-
// Retrieve foreign assetId for a particular
|
|
440
|
-
getAssetId(
|
|
445
|
+
// Retrieve foreign assetId for a particular chain and asset symbol
|
|
446
|
+
getAssetId(CHAIN, ASSET_SYMBOL)
|
|
441
447
|
|
|
442
|
-
// Retrieve the symbol of the relay chain for a particular
|
|
443
|
-
getRelayChainSymbol(
|
|
448
|
+
// Retrieve the symbol of the relay chain for a particular chain. Either "DOT" or "KSM"
|
|
449
|
+
getRelayChainSymbol(CHAIN)
|
|
444
450
|
|
|
445
|
-
// Retrieve string array of native assets symbols for a particular
|
|
446
|
-
getNativeAssets(
|
|
451
|
+
// Retrieve string array of native assets symbols for a particular chain
|
|
452
|
+
getNativeAssets(CHAIN)
|
|
447
453
|
|
|
448
|
-
// Retrieve object array of foreign assets for a particular
|
|
449
|
-
getOtherAssets(
|
|
454
|
+
// Retrieve object array of foreign assets for a particular chain. Each object has a symbol and an assetId property
|
|
455
|
+
getOtherAssets(CHAIN)
|
|
450
456
|
|
|
451
457
|
// Retrieve string array of all asset symbols. (native and foreign assets are merged into a single array)
|
|
452
|
-
getAllAssetsSymbols(
|
|
458
|
+
getAllAssetsSymbols(CHAIN)
|
|
453
459
|
|
|
454
|
-
// Check if a
|
|
455
|
-
hasSupportForAsset(
|
|
460
|
+
// Check if a chain supports a particular asset. (Both native and foreign assets are searched). Returns boolean
|
|
461
|
+
hasSupportForAsset(CHAIN, ASSET_SYMBOL)
|
|
456
462
|
|
|
457
463
|
// Get decimals for specific asset
|
|
458
|
-
getAssetDecimals(
|
|
464
|
+
getAssetDecimals(CHAIN, ASSET_SYMBOL)
|
|
459
465
|
|
|
460
|
-
// Get specific
|
|
461
|
-
getParaId(
|
|
466
|
+
// Get specific chain id
|
|
467
|
+
getParaId(CHAIN)
|
|
462
468
|
|
|
463
|
-
// Get specific
|
|
464
|
-
|
|
469
|
+
// Get specific TChain from chainID
|
|
470
|
+
getTChain(paraID: number, ecosystem: 'Polkadot' | 'Kusama' | 'Ethereum' | 'Paseo' | 'Westend') //When the Ethereum ecosystem is selected, please fill chainID as 1 to select Ethereum.
|
|
465
471
|
|
|
466
|
-
// Import all compatible
|
|
467
|
-
|
|
472
|
+
// Import all compatible chains as constant
|
|
473
|
+
CHAINS
|
|
468
474
|
```
|
|
469
475
|
|
|
470
476
|
### Parachain XCM Pallet queries
|
|
@@ -475,13 +481,13 @@ For full documentation with examples on this feature head over to [official docu
|
|
|
475
481
|
import { getDefaultPallet, getSupportedPallets, getPalletIndex SUPPORTED_PALLETS } from '@paraspell/sdk';
|
|
476
482
|
|
|
477
483
|
//Retrieve default pallet for specific Parachain
|
|
478
|
-
getDefaultPallet(
|
|
484
|
+
getDefaultPallet(CHAIN)
|
|
479
485
|
|
|
480
486
|
// Returns an array of supported pallets for a specific Parachain
|
|
481
|
-
getSupportedPallets(
|
|
487
|
+
getSupportedPallets(CHAIN)
|
|
482
488
|
|
|
483
489
|
//Returns index of XCM Pallet used by Parachain
|
|
484
|
-
getPalletIndex(
|
|
490
|
+
getPalletIndex(CHAIN)
|
|
485
491
|
|
|
486
492
|
// Print all pallets that are currently supported
|
|
487
493
|
console.log(SUPPORTED_PALLETS)
|