@paraspell/sdk-pjs 12.0.1 → 12.0.3
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 +79 -78
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -80,14 +80,14 @@ Latest news:
|
|
|
80
80
|
```
|
|
81
81
|
|
|
82
82
|
### Sending XCM
|
|
83
|
-
|
|
84
|
-
For full documentation with examples on this feature head over to [official documentation](https://paraspell.github.io/docs/sdk/xcmPallet.html).
|
|
83
|
+
For full documentation on XCM Transfers head over to [official documentation](https://paraspell.github.io/docs/sdk/xcmPallet.html).
|
|
85
84
|
|
|
86
85
|
#### Transfer assets from Parachain to Parachain
|
|
86
|
+
|
|
87
87
|
```ts
|
|
88
88
|
const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
89
|
-
.from(
|
|
90
|
-
.to(
|
|
89
|
+
.from(TChain)
|
|
90
|
+
.to(TChain /*,customParaId - optional*/ | Location object /*Only works for PolkadotXCM pallet*/)
|
|
91
91
|
.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}, ..])
|
|
92
92
|
.address(address | Location object /*If you are sending through xTokens, you need to pass the destination and address Location in one object (x2)*/)
|
|
93
93
|
.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.
|
|
@@ -120,10 +120,11 @@ await builder.disconnect()
|
|
|
120
120
|
```
|
|
121
121
|
|
|
122
122
|
#### Transfer assets from the Relay chain to the Parachain
|
|
123
|
+
|
|
123
124
|
```ts
|
|
124
125
|
const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
125
|
-
.from(
|
|
126
|
-
.to(
|
|
126
|
+
.from(TRelaychain) // Kusama | Polkadot | Westend | Paseo
|
|
127
|
+
.to(TChain/*,customParaId - optional*/ | Location object)
|
|
127
128
|
.currency({symbol: 'DOT', amount: amount /*Use "ALL" to transfer everything*/})
|
|
128
129
|
.address(address | Location object)
|
|
129
130
|
/*.xcmVersion(Version.V3/V4/V5) //Optional parameter for manual override of XCM Version used in call
|
|
@@ -153,10 +154,11 @@ await builder.disconnect()
|
|
|
153
154
|
```
|
|
154
155
|
|
|
155
156
|
#### Transfer assets from Parachain to Relay chain
|
|
157
|
+
|
|
156
158
|
```ts
|
|
157
159
|
const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
158
|
-
.from(
|
|
159
|
-
.to(
|
|
160
|
+
.from(TChain)
|
|
161
|
+
.to(TRelaychain) // Kusama | Polkadot | Westend | Paseo
|
|
160
162
|
.currency({symbol: 'DOT', amount: amount /*Use "ALL" to transfer everything*/})
|
|
161
163
|
.address(address | Location object)
|
|
162
164
|
/*.xcmVersion(Version.V3/V4/V5) //Optional parameter for manual override of XCM Version used in call
|
|
@@ -186,10 +188,11 @@ await builder.disconnect()
|
|
|
186
188
|
```
|
|
187
189
|
|
|
188
190
|
#### Local transfers
|
|
191
|
+
|
|
189
192
|
```ts
|
|
190
193
|
const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
191
|
-
.from(
|
|
192
|
-
.to(
|
|
194
|
+
.from(TChain)
|
|
195
|
+
.to(TChain) //Has to be the same as the origin (from)
|
|
193
196
|
.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}, ..])
|
|
194
197
|
.address(address)
|
|
195
198
|
|
|
@@ -217,16 +220,17 @@ await builder.disconnect()
|
|
|
217
220
|
```
|
|
218
221
|
|
|
219
222
|
#### Batch calls
|
|
223
|
+
|
|
220
224
|
```ts
|
|
221
225
|
const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
222
|
-
.from(
|
|
223
|
-
.to(
|
|
226
|
+
.from(TChain) //Ensure, that origin chain is the same in all batched XCM Calls.
|
|
227
|
+
.to(TChain2) //Any compatible Parachain
|
|
224
228
|
.currency({currencySelection, amount}) //Currency to transfer - options as in scenarios above
|
|
225
229
|
.address(address | Location object)
|
|
226
230
|
.addToBatch()
|
|
227
231
|
|
|
228
|
-
.from(
|
|
229
|
-
.to(
|
|
232
|
+
.from(TChain) //Ensure, that origin chain is the same in all batched XCM Calls.
|
|
233
|
+
.to(TChain3) //Any compatible Parachain
|
|
230
234
|
.currency({currencySelection, amount}) //Currency to transfer - options as in scenarios above
|
|
231
235
|
.address(address | Location object)
|
|
232
236
|
.addToBatch()
|
|
@@ -241,10 +245,11 @@ await builder.disconnect()
|
|
|
241
245
|
```
|
|
242
246
|
|
|
243
247
|
#### Asset claim:
|
|
248
|
+
|
|
244
249
|
```ts
|
|
245
250
|
//Claim XCM trapped assets from the selected chain
|
|
246
251
|
const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
247
|
-
.claimFrom(
|
|
252
|
+
.claimFrom(TChain)
|
|
248
253
|
.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}, ..]
|
|
249
254
|
)
|
|
250
255
|
.address(address | Location object)
|
|
@@ -260,8 +265,8 @@ await builder.disconnect()
|
|
|
260
265
|
```ts
|
|
261
266
|
//Builder pattern
|
|
262
267
|
const result = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
263
|
-
.from(
|
|
264
|
-
.to(
|
|
268
|
+
.from(TChain)
|
|
269
|
+
.to(TChain)
|
|
265
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*/}]})
|
|
266
271
|
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in same fee asset as selected currency.*/
|
|
267
272
|
.address(ADDRESS)
|
|
@@ -275,13 +280,12 @@ const result = hasDryRunSupport(chain)
|
|
|
275
280
|
```
|
|
276
281
|
|
|
277
282
|
#### Dry run preview:
|
|
278
|
-
More on this feature in [official documentation](https://paraspell.github.io/docs/sdk/xcmPallet.html#preview-your-call-results)
|
|
279
283
|
|
|
280
284
|
```ts
|
|
281
285
|
//Builder pattern
|
|
282
286
|
const result = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
283
|
-
.from(
|
|
284
|
-
.to(
|
|
287
|
+
.from(TChain)
|
|
288
|
+
.to(TChain)
|
|
285
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*/}]})
|
|
286
290
|
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in same fee asset as selected currency.*/
|
|
287
291
|
.address(ADDRESS)
|
|
@@ -291,8 +295,6 @@ const result = await Builder(/*chain api/builder_config/ws_url_string/ws_url_arr
|
|
|
291
295
|
|
|
292
296
|
### Localhost test setup
|
|
293
297
|
|
|
294
|
-
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).
|
|
295
|
-
|
|
296
298
|
```ts
|
|
297
299
|
const builder = await Builder({
|
|
298
300
|
development: true, // Optional: Enforces overrides for all chains used
|
|
@@ -303,8 +305,8 @@ const builder = await Builder({
|
|
|
303
305
|
//ChainName: ...
|
|
304
306
|
}
|
|
305
307
|
})
|
|
306
|
-
.from(
|
|
307
|
-
.to(
|
|
308
|
+
.from(TChain)
|
|
309
|
+
.to(TChain)
|
|
308
310
|
.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
311
|
.address(address)
|
|
310
312
|
|
|
@@ -316,14 +318,14 @@ await builder.disconnect()
|
|
|
316
318
|
|
|
317
319
|
### XCM Fee queries
|
|
318
320
|
|
|
319
|
-
For full documentation with examples
|
|
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-pjs";
|
|
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,64 @@ import { getExistentialDeposit } from "@paraspell/sdk-pjs";
|
|
|
425
427
|
|
|
426
428
|
//Currency is an optional parameter. If you wish to query native asset, 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-pjs";
|
|
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
441
|
|
|
440
|
-
For full documentation with examples
|
|
442
|
+
For full documentation with output examples of asset queries, head over to [official documentation](https://paraspell.github.io/docs/sdk/AssetPallet.html).
|
|
441
443
|
|
|
442
444
|
```ts
|
|
443
445
|
import { getSupportedDestinations, getFeeAssets, getAssetsObject, getAssetId, getRelayChainSymbol, getNativeAssets, getNativeAssets, getOtherAssets, getAllAssetsSymbols, hasSupportForAsset, getAssetDecimals, getParaId, getTChain, getAssetLocation, CHAINS, findAssetInfo, findAssetInfoOrThrow } from '@paraspell/sdk-pjs'
|
|
444
446
|
|
|
445
447
|
//Get chains that support the specific asset related to origin
|
|
446
|
-
getSupportedDestinations(
|
|
447
|
-
|
|
448
|
-
// Retrieve Fee asset queries (Assets accepted as XCM Fee on specific chain)
|
|
449
|
-
getFeeAssets(CHAIN)
|
|
450
|
-
|
|
451
|
-
// Get Location for asset ID or symbol on a specific chain
|
|
452
|
-
getAssetLocation(CHAIN, { symbol: symbol } | { id: assetId })
|
|
448
|
+
getSupportedDestinations(TChain, CURRENCY)
|
|
453
449
|
|
|
454
450
|
//Find out whether asset is registered on chain and return its entire parameters. If not found, returns null.
|
|
455
|
-
findAssetInfo(
|
|
451
|
+
findAssetInfo(TChain, CURRENCY, DESTINATION?)
|
|
456
452
|
|
|
457
453
|
//Find out whether asset is registered on chain and return its entire parameters. If not found, returns error.
|
|
458
|
-
findAssetInfoOrThrow(
|
|
454
|
+
findAssetInfoOrThrow(TChain, CURRENCY, DESTINATION?)
|
|
455
|
+
|
|
456
|
+
// Retrieve Fee asset queries (Assets accepted as XCM Fee on specific chain)
|
|
457
|
+
getFeeAssets(TChain)
|
|
458
|
+
|
|
459
|
+
// Get Location for asset ID or symbol on a specific chain
|
|
460
|
+
getAssetLocation(TChain, { symbol: symbol } | { id: assetId })
|
|
459
461
|
|
|
460
462
|
// Retrieve assets object from assets.json for a particular chain, including information about native and foreign assets
|
|
461
|
-
getAssetsObject(
|
|
463
|
+
getAssetsObject(TChain)
|
|
462
464
|
|
|
463
465
|
// Retrieve foreign assetId for a particular chain and asset symbol
|
|
464
|
-
getAssetId(
|
|
466
|
+
getAssetId(TChain, ASSET_SYMBOL)
|
|
465
467
|
|
|
466
468
|
// Retrieve the symbol of the relay chain for a particular chain. Either "DOT" or "KSM"
|
|
467
|
-
getRelayChainSymbol(
|
|
469
|
+
getRelayChainSymbol(TChain)
|
|
468
470
|
|
|
469
471
|
// Retrieve string array of native assets symbols for a particular chain
|
|
470
|
-
getNativeAssets(
|
|
472
|
+
getNativeAssets(TChain)
|
|
471
473
|
|
|
472
474
|
// Retrieve object array of foreign assets for a particular chain. Each object has a symbol and an assetId property
|
|
473
|
-
getOtherAssets(
|
|
475
|
+
getOtherAssets(TChain)
|
|
474
476
|
|
|
475
477
|
// Retrieve string array of all asset symbols. (native and foreign assets are merged into a single array)
|
|
476
|
-
getAllAssetsSymbols(
|
|
478
|
+
getAllAssetsSymbols(TChain)
|
|
477
479
|
|
|
478
480
|
// Check if a chain supports a particular asset. (Both native and foreign assets are searched). Returns boolean
|
|
479
|
-
hasSupportForAsset(
|
|
481
|
+
hasSupportForAsset(TChain, ASSET_SYMBOL)
|
|
480
482
|
|
|
481
483
|
// Get decimals for specific asset
|
|
482
|
-
getAssetDecimals(
|
|
484
|
+
getAssetDecimals(TChain, ASSET_SYMBOL)
|
|
483
485
|
|
|
484
486
|
// Get specific chain id
|
|
485
|
-
getParaId(
|
|
487
|
+
getParaId(TChain)
|
|
486
488
|
|
|
487
489
|
// Get specific TChain from chainID
|
|
488
490
|
getTChain(paraID: number, ecosystem: 'Polkadot' | 'Kusama' | 'Ethereum' | 'Paseo' | 'Westend') //When the Ethereum ecosystem is selected, please fill chainID as 1 to select Ethereum.
|
|
@@ -493,25 +495,25 @@ CHAINS
|
|
|
493
495
|
|
|
494
496
|
### Parachain XCM Pallet queries
|
|
495
497
|
|
|
496
|
-
For full documentation with examples
|
|
498
|
+
For full documentation with output examples of pallet queries, head over to [official documentation](https://paraspell.github.io/docs/sdk/NodePallets.html).
|
|
497
499
|
|
|
498
500
|
```ts
|
|
499
501
|
import { getDefaultPallet, getSupportedPallets, getPalletIndex, getNativeAssetsPallet, getOtherAssetsPallets, SUPPORTED_PALLETS } from '@paraspell/sdk-pjs';
|
|
500
502
|
|
|
501
503
|
//Retrieve default pallet for specific Parachain
|
|
502
|
-
getDefaultPallet(
|
|
504
|
+
getDefaultPallet(chain: TChain)
|
|
503
505
|
|
|
504
506
|
// Returns an array of supported pallets for a specific Parachain
|
|
505
|
-
getSupportedPallets(
|
|
507
|
+
getSupportedPallets(chain: TChain)
|
|
506
508
|
|
|
507
509
|
//Returns index of XCM Pallet used by Parachain
|
|
508
|
-
getPalletIndex(
|
|
510
|
+
getPalletIndex(chain: TChain)
|
|
509
511
|
|
|
510
512
|
//Returns all pallets for local transfers of native assets for specific chain.
|
|
511
513
|
getNativeAssetsPallet(chain: TChain)
|
|
512
514
|
|
|
513
515
|
//Returns all pallets for local transfers of foreign assets for specific chain.
|
|
514
|
-
getOtherAssetsPallets(
|
|
516
|
+
getOtherAssetsPallets(chain: TChain)
|
|
515
517
|
|
|
516
518
|
// Print all pallets that are currently supported
|
|
517
519
|
console.log(SUPPORTED_PALLETS)
|
|
@@ -548,9 +550,8 @@ Published under [MIT License](https://github.com/paraspell/xcm-tools/blob/main/p
|
|
|
548
550
|
|
|
549
551
|
## Supported by
|
|
550
552
|
|
|
551
|
-
<div
|
|
552
|
-
|
|
553
|
-
<img width="
|
|
554
|
-
|
|
555
|
-
</p>
|
|
553
|
+
<div>
|
|
554
|
+
<div align="center" style="margin-top: 20px;">
|
|
555
|
+
<img width="750" alt="version" src="https://github.com/user-attachments/assets/29e4b099-d90c-46d6-a3ce-94edfbda003c" />
|
|
556
|
+
</div>
|
|
556
557
|
</div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk-pjs",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.3",
|
|
4
4
|
"description": "Polkadot.js based SDK for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@snowbridge/contract-types": "0.2.17",
|
|
28
28
|
"ethers": "^6.15.0",
|
|
29
29
|
"viem": "^2.40.3",
|
|
30
|
-
"@paraspell/sdk-core": "12.0.
|
|
30
|
+
"@paraspell/sdk-core": "12.0.3"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@polkadot/api": ">= 16.0 < 17",
|