@paraspell/sdk-pjs 9.2.2 → 10.0.1
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 +115 -68
- package/dist/index.cjs +8 -21
- package/dist/index.d.ts +8 -31
- package/dist/index.mjs +10 -18
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -47,12 +47,12 @@ pnpm | npm install || yarn add @paraspell/sdk-pjs
|
|
|
47
47
|
### Importing package to your project
|
|
48
48
|
|
|
49
49
|
Builder pattern:
|
|
50
|
-
```
|
|
50
|
+
```ts
|
|
51
51
|
import { Builder } from '@paraspell/sdk-pjs'
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
Other patterns:
|
|
55
|
-
```
|
|
55
|
+
```ts
|
|
56
56
|
// ESM
|
|
57
57
|
import * as paraspell from '@paraspell/sdk-pjs'
|
|
58
58
|
|
|
@@ -61,27 +61,27 @@ const paraspell = require('@paraspell/sdk-pjs')
|
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
Interaction with further asset symbol abstraction:
|
|
64
|
-
```
|
|
64
|
+
```ts
|
|
65
65
|
import { Native, Foreign, ForeignAbstract } from '@paraspell/sdk-pjs'; //Only needed when advanced asset symbol selection is used. PJS version.
|
|
66
66
|
```
|
|
67
|
+
|
|
67
68
|
## Implementation
|
|
68
69
|
|
|
69
70
|
```
|
|
70
71
|
NOTES:
|
|
71
|
-
-
|
|
72
|
-
- More information on v8 major breaking change: https://github.com/paraspell/xcm-tools/pull/554
|
|
73
|
-
- XCM SDK Now supports API Failsafe - If one endpoint doesn't work it automatically switches to the next one.
|
|
74
|
-
- Builder now allows you to directly disconnect API.
|
|
72
|
+
- Local transfers are now available for every currency and every chain. To try them, simply use same origin and destination parameters.
|
|
75
73
|
```
|
|
76
74
|
|
|
77
75
|
```
|
|
78
76
|
Latest news:
|
|
79
|
-
-
|
|
77
|
+
- Transfer info queries are now all in Builder pattern and don't require any imports other than builder.
|
|
80
78
|
```
|
|
81
79
|
|
|
82
|
-
###
|
|
80
|
+
### Sending XCM:
|
|
81
|
+
|
|
82
|
+
For full documentation with examples on this feature head over to [official documentation](https://paraspell.github.io/docs/sdk/xcmPallet.html).
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
#### Transfer assets from Parachain to Parachain
|
|
85
85
|
```ts
|
|
86
86
|
const builder = Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
87
87
|
.from(NODE)
|
|
@@ -116,7 +116,7 @@ const tx = await builder.build()
|
|
|
116
116
|
await builder.disconnect()
|
|
117
117
|
*/
|
|
118
118
|
```
|
|
119
|
-
|
|
119
|
+
#### Transfer assets from the Relay chain to Parachain
|
|
120
120
|
```ts
|
|
121
121
|
const builder = Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
122
122
|
.from(RELAY_NODE) //Kusama or Polkadot
|
|
@@ -124,7 +124,7 @@ const builder = Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
|
124
124
|
.currency({symbol: 'DOT', amount: amount})
|
|
125
125
|
.address(address | Multilocation object)
|
|
126
126
|
/*.xcmVersion(Version.V1/V2/V3/V4) //Optional parameter for manual override of XCM Version used in call
|
|
127
|
-
|
|
127
|
+
.customPallet('Pallet','pallet_function') //Optional parameter for manual override of XCM Pallet and function used in call (If they are named differently on some node but syntax stays the same). Both pallet name and function required. Pallet name must be CamelCase, function name snake_case.*/
|
|
128
128
|
|
|
129
129
|
const tx = await builder.build()
|
|
130
130
|
|
|
@@ -148,7 +148,7 @@ const tx = await builder.build()
|
|
|
148
148
|
await builder.disconnect()
|
|
149
149
|
*/
|
|
150
150
|
```
|
|
151
|
-
|
|
151
|
+
#### Transfer assets from Parachain to Relay chain
|
|
152
152
|
```ts
|
|
153
153
|
const builder = Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
154
154
|
.from(NODE)
|
|
@@ -181,7 +181,7 @@ await builder.disconnect()
|
|
|
181
181
|
*/
|
|
182
182
|
```
|
|
183
183
|
|
|
184
|
-
|
|
184
|
+
#### Local transfers
|
|
185
185
|
```ts
|
|
186
186
|
const builder = Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
187
187
|
.from(NODE)
|
|
@@ -212,9 +212,8 @@ await builder.disconnect()
|
|
|
212
212
|
*/
|
|
213
213
|
```
|
|
214
214
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
```js
|
|
215
|
+
#### Batch calls
|
|
216
|
+
```ts
|
|
218
217
|
const builder = Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
219
218
|
.from(NODE) //Ensure, that origin node is the same in all batched XCM Calls.
|
|
220
219
|
.to(NODE_2) //Any compatible Parachain
|
|
@@ -237,7 +236,7 @@ const tx = await builder.buildBatch({
|
|
|
237
236
|
await builder.disconnect()
|
|
238
237
|
```
|
|
239
238
|
|
|
240
|
-
|
|
239
|
+
#### Asset claim:
|
|
241
240
|
```ts
|
|
242
241
|
//Claim XCM trapped assets from the selected chain
|
|
243
242
|
const builder = Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
@@ -252,87 +251,130 @@ const tx = await builder.build()
|
|
|
252
251
|
await builder.disconnect()
|
|
253
252
|
```
|
|
254
253
|
|
|
255
|
-
|
|
254
|
+
#### Dry run your XCM Calls:
|
|
256
255
|
```ts
|
|
257
256
|
//Builder pattern
|
|
258
257
|
const result = await Builder(API /*optional*/)
|
|
259
258
|
.from(NODE)
|
|
260
259
|
.to(NODE_2)
|
|
261
260
|
.currency({id: currencyID, amount: amount} | {symbol: currencySymbol, amount: amount} | {symbol: Native('currencySymbol'), amount: amount} | {symbol: Foreign('currencySymbol'), amount: amount} | {symbol: ForeignAbstract('currencySymbol'), amount: amount} | {multilocation: AssetMultilocationString, amount: amount | AssetMultilocationJson, amount: amount} | {multilocation: Override('Custom Multilocation'), amount: amount} | {multiasset: {currencySelection, isFeeAsset?: true /* for example symbol: symbol or id: id, or multilocation: multilocation*/, amount: amount}})
|
|
261
|
+
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in same fee asset as selected currency.*/
|
|
262
262
|
.address(ADDRESS)
|
|
263
263
|
.senderAddress(SENDER_ADDRESS)
|
|
264
264
|
.dryRun()
|
|
265
265
|
|
|
266
|
-
//Function pattern
|
|
267
|
-
await getDryRun({api /*optional*/, node, address /*sender address*/, tx /* Extrinsic object */})
|
|
268
|
-
|
|
269
266
|
//Check Parachain for DryRun support - returns true/false
|
|
270
267
|
import { hasDryRunSupport } from "@paraspell/sdk-pjs";
|
|
271
268
|
|
|
272
269
|
const result = hasDryRunSupport(node)
|
|
273
270
|
```
|
|
274
271
|
|
|
275
|
-
### XCM Fee
|
|
276
|
-
Following queries allow you to query fee from both Origin and Destination of the XCM Message. You can get accurate result from DryRun query(Requires token balance) or less accurate from Payment info query (Doesn't require token balance).
|
|
272
|
+
### XCM Fee queries
|
|
277
273
|
|
|
278
|
-
|
|
279
|
-
The query is designed to retrieve you XCM fee at any cost, but fallbacking to Payment info if DryRun query fails or is not supported by either origin or destination. This query requires user to have token balance (Token that they are sending and origin native asset to pay for execution fees on origin).
|
|
274
|
+
For full documentation with examples on this feature head over to [official documentation](https://paraspell.github.io/docs/sdk/xcmUtils.html).
|
|
280
275
|
|
|
276
|
+
#### XCM Transfer info
|
|
277
|
+
```ts
|
|
278
|
+
const info = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
279
|
+
.from(ORIGIN_CHAIN)
|
|
280
|
+
.to(DESTINATION_CHAIN)
|
|
281
|
+
.currency(CURRENCY)
|
|
282
|
+
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in same fee asset as selected currency.*/
|
|
283
|
+
.address(RECIPIENT_ADDRESS)
|
|
284
|
+
.senderAddress(SENDER_ADDRESS)
|
|
285
|
+
.getTransferInfo()
|
|
281
286
|
```
|
|
282
|
-
|
|
287
|
+
|
|
288
|
+
#### Transferable amount
|
|
289
|
+
```ts
|
|
290
|
+
const transferable = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
291
|
+
.from(ORIGIN_CHAIN)
|
|
292
|
+
.to(DESTINATION_CHAIN)
|
|
293
|
+
.currency(CURRENCY)
|
|
294
|
+
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in same fee asset as selected currency.*/
|
|
295
|
+
.address(RECIPIENT_ADDRESS)
|
|
296
|
+
.senderAddress(SENDER_ADDRESS)
|
|
297
|
+
.getTransferableAmount()
|
|
283
298
|
```
|
|
284
299
|
|
|
300
|
+
#### Verify ED on destination
|
|
285
301
|
```ts
|
|
286
|
-
const
|
|
302
|
+
const ed = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
287
303
|
.from(ORIGIN_CHAIN)
|
|
288
304
|
.to(DESTINATION_CHAIN)
|
|
289
305
|
.currency(CURRENCY)
|
|
306
|
+
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in same fee asset as selected currency.*/
|
|
290
307
|
.address(RECIPIENT_ADDRESS)
|
|
291
308
|
.senderAddress(SENDER_ADDRESS)
|
|
292
|
-
.
|
|
309
|
+
.verifyEdOnDestination()
|
|
293
310
|
```
|
|
294
311
|
|
|
295
|
-
####
|
|
296
|
-
This query is designed to retrieve you approximate fee and doesn't require any token balance.
|
|
312
|
+
#### XCM Fee (Origin and Dest.)
|
|
297
313
|
|
|
298
|
-
|
|
299
|
-
|
|
314
|
+
##### More accurate query using DryRun
|
|
315
|
+
```ts
|
|
316
|
+
const fee = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
317
|
+
.from(ORIGIN_CHAIN)
|
|
318
|
+
.to(DESTINATION_CHAIN)
|
|
319
|
+
.currency(CURRENCY)
|
|
320
|
+
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in same fee asset as selected currency.*/
|
|
321
|
+
.address(RECIPIENT_ADDRESS)
|
|
322
|
+
.senderAddress(SENDER_ADDRESS)
|
|
323
|
+
.getXcmFee(/*{disableFallback: true / false}*/) //Fallback is optional. When fallback is disabled, you only get notified of 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.
|
|
300
324
|
```
|
|
301
325
|
|
|
326
|
+
##### Less accurate query using Payment info
|
|
302
327
|
```ts
|
|
303
328
|
const fee = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
304
329
|
.from(ORIGIN_CHAIN)
|
|
305
330
|
.to(DESTINATION_CHAIN)
|
|
306
331
|
.currency(CURRENCY)
|
|
307
332
|
.address(RECIPIENT_ADDRESS)
|
|
308
|
-
.senderAddress(SENDER_ADDRESS)
|
|
333
|
+
.senderAddress(SENDER_ADDRESS)
|
|
309
334
|
.getXcmFeeEstimate()
|
|
310
335
|
```
|
|
311
336
|
|
|
312
|
-
|
|
313
|
-
```ts
|
|
314
|
-
import { getAssetBalance, getTransferInfo, getOriginFeeDetails, getTransferableAmount, getParaEthTransferFees, verifyEdOnDestination } from "@paraspell/sdk-pjs";
|
|
337
|
+
#### XCM Fee (Origin only)
|
|
315
338
|
|
|
316
|
-
|
|
317
|
-
|
|
339
|
+
##### More accurate query using DryRun
|
|
340
|
+
```ts
|
|
341
|
+
const fee = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
342
|
+
.from(ORIGIN_CHAIN)
|
|
343
|
+
.to(DESTINATION_CHAIN)
|
|
344
|
+
.currency(CURRENCY)
|
|
345
|
+
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in same fee asset as selected currency.*/
|
|
346
|
+
.address(RECIPIENT_ADDRESS)
|
|
347
|
+
.senderAddress(SENDER_ADDRESS)
|
|
348
|
+
.getOriginXcmFee(/*{disableFallback: true / false}*/) //Fallback is optional. When fallback is disabled, you only get notified of 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.
|
|
349
|
+
```
|
|
318
350
|
|
|
319
|
-
|
|
320
|
-
|
|
351
|
+
##### Less accurate query using Payment info
|
|
352
|
+
```ts
|
|
353
|
+
const fee = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
354
|
+
.from(ORIGIN_CHAIN)
|
|
355
|
+
.to(DESTINATION_CHAIN)
|
|
356
|
+
.currency(CURRENCY)
|
|
357
|
+
.address(RECIPIENT_ADDRESS)
|
|
358
|
+
.senderAddress(SENDER_ADDRESS)
|
|
359
|
+
.getOriginXcmFeeEstimate()
|
|
360
|
+
```
|
|
321
361
|
|
|
322
|
-
|
|
323
|
-
|
|
362
|
+
#### Asset balance
|
|
363
|
+
```ts
|
|
364
|
+
import { getAssetBalance } from "@paraspell/sdk-pjs";
|
|
324
365
|
|
|
325
|
-
//
|
|
326
|
-
await
|
|
366
|
+
//Retrieves the asset balance for a given account on a specified node (You do not need to specify if it is native or foreign).
|
|
367
|
+
const balance = await getAssetBalance({address, node, currency /*- {id: currencyID} | {symbol: currencySymbol} | {symbol: Native('currencySymbol')} | {symbol: Foreign('currencySymbol')} | {symbol: ForeignAbstract('currencySymbol')} | {multilocation: AssetMultilocationString | AssetMultilocationJson}*/, api /* api/ws_url_string optional */});
|
|
368
|
+
```
|
|
327
369
|
|
|
328
|
-
|
|
329
|
-
|
|
370
|
+
#### Ethereum bridge fees
|
|
371
|
+
```ts
|
|
372
|
+
import { getParaEthTransferFees } from "@paraspell/sdk-pjs";
|
|
330
373
|
|
|
331
|
-
|
|
332
|
-
await verifyEdOnDestination(node, currency: {symbol: || id: || multilocation: .. ,amount: 100000n}, address)
|
|
374
|
+
const fees = await getParaEthTransferFees(/*api - optional (Can also be WS port string or array o WS ports. Must be AssetHubPolkadot WS!)*/)
|
|
333
375
|
```
|
|
334
376
|
|
|
335
|
-
|
|
377
|
+
#### Existential deposit queries
|
|
336
378
|
```ts
|
|
337
379
|
import { getExistentialDeposit } from "@paraspell/sdk-pjs";
|
|
338
380
|
|
|
@@ -341,7 +383,7 @@ import { getExistentialDeposit } from "@paraspell/sdk-pjs";
|
|
|
341
383
|
const ed = getExistentialDeposit(node, currency?)
|
|
342
384
|
```
|
|
343
385
|
|
|
344
|
-
|
|
386
|
+
#### Convert SS58 address
|
|
345
387
|
```ts
|
|
346
388
|
import { convertSs58 } from "@paraspell/sdk-pjs";
|
|
347
389
|
|
|
@@ -350,61 +392,66 @@ let result = convertSs58(address, node) // returns converted address in string
|
|
|
350
392
|
|
|
351
393
|
### Asset queries:
|
|
352
394
|
|
|
395
|
+
For full documentation with examples on this feature head over to [official documentation](https://paraspell.github.io/docs/sdk/AssetPallet.html).
|
|
396
|
+
|
|
353
397
|
```ts
|
|
354
398
|
import { getFeeAssets, getAssetsObject, getAssetId, getRelayChainSymbol, getNativeAssets, getNativeAssets, getOtherAssets, getAllAssetsSymbols, hasSupportForAsset, getAssetDecimals, getParaId, getTNode, getAssetMultiLocation, NODE_NAMES } from '@paraspell/sdk-pjs'
|
|
355
399
|
|
|
356
400
|
// Retrieve Fee asset queries (Assets accepted as XCM Fee on specific node)
|
|
357
|
-
getFeeAssets(
|
|
401
|
+
getFeeAssets(NODE)
|
|
402
|
+
|
|
403
|
+
// Get multilocation for asset id or symbol on specific chain
|
|
404
|
+
getAssetMultiLocation(NODE, { symbol: symbol } | { id: assetId })
|
|
358
405
|
|
|
359
406
|
// Retrieve assets object from assets.json for particular node including information about native and foreign assets
|
|
360
|
-
getAssetsObject(
|
|
407
|
+
getAssetsObject(NODE)
|
|
361
408
|
|
|
362
409
|
// Retrieve foreign assetId for a particular node and asset symbol
|
|
363
|
-
getAssetId(
|
|
410
|
+
getAssetId(NODE, ASSET_SYMBOL)
|
|
364
411
|
|
|
365
412
|
// Retrieve the symbol of the relay chain for a particular node. Either "DOT" or "KSM"
|
|
366
|
-
getRelayChainSymbol(
|
|
413
|
+
getRelayChainSymbol(NODE)
|
|
367
414
|
|
|
368
415
|
// Retrieve string array of native assets symbols for particular node
|
|
369
|
-
getNativeAssets(
|
|
416
|
+
getNativeAssets(NODE)
|
|
370
417
|
|
|
371
418
|
// Retrieve object array of foreign assets for a particular node. Each object has a symbol and assetId property
|
|
372
|
-
getOtherAssets(
|
|
419
|
+
getOtherAssets(NODE)
|
|
373
420
|
|
|
374
421
|
// Retrieve string array of all assets symbols. (native and foreign assets are merged into a single array)
|
|
375
|
-
getAllAssetsSymbols(
|
|
422
|
+
getAllAssetsSymbols(NODE)
|
|
376
423
|
|
|
377
424
|
// Check if a node supports a particular asset. (Both native and foreign assets are searched). Returns boolean
|
|
378
|
-
hasSupportForAsset(
|
|
425
|
+
hasSupportForAsset(NODE, ASSET_SYMBOL)
|
|
379
426
|
|
|
380
427
|
// Get decimals for specific asset
|
|
381
|
-
getAssetDecimals(
|
|
428
|
+
getAssetDecimals(NODE, ASSET_SYMBOL)
|
|
382
429
|
|
|
383
430
|
// Get specific node id
|
|
384
|
-
getParaId(
|
|
431
|
+
getParaId(NODE)
|
|
385
432
|
|
|
386
433
|
// Get specific TNode from nodeID
|
|
387
|
-
getTNode(
|
|
434
|
+
getTNode(paraID: number, ecosystem: 'polkadot' || 'kusama' || 'ethereum') //When Ethereum ecosystem is selected please fill nodeID as 1 to select Ethereum.
|
|
388
435
|
|
|
389
436
|
// Import all compatible nodes as constant
|
|
390
437
|
NODE_NAMES
|
|
391
|
-
|
|
392
|
-
// Get multilocation for asset id or symbol on specific chain
|
|
393
|
-
getAssetMultiLocation(chainFrom, { symbol: symbol } | { id: assetId })
|
|
394
438
|
```
|
|
395
439
|
|
|
396
440
|
### Parachain XCM Pallet queries
|
|
441
|
+
|
|
442
|
+
For full documentation with examples on this feature head over to [official documentation](https://paraspell.github.io/docs/sdk/NodePallets.html).
|
|
443
|
+
|
|
397
444
|
```ts
|
|
398
445
|
import { getDefaultPallet, getSupportedPallets, getPalletIndex SUPPORTED_PALLETS } from '@paraspell/sdk-pjs';
|
|
399
446
|
|
|
400
447
|
//Retrieve default pallet for specific Parachain
|
|
401
|
-
getDefaultPallet(
|
|
448
|
+
getDefaultPallet(NODE)
|
|
402
449
|
|
|
403
450
|
// Returns an array of supported pallets for a specific Parachain
|
|
404
|
-
getSupportedPallets(
|
|
451
|
+
getSupportedPallets(NODE)
|
|
405
452
|
|
|
406
453
|
//Returns index of XCM Pallet used by Parachain
|
|
407
|
-
getPalletIndex(
|
|
454
|
+
getPalletIndex(NODE)
|
|
408
455
|
|
|
409
456
|
// Print all pallets that are currently supported
|
|
410
457
|
console.log(SUPPORTED_PALLETS)
|
package/dist/index.cjs
CHANGED
|
@@ -1204,12 +1204,6 @@ var getBalanceNative = createPolkadotJsApiCall(sdkCore.getBalanceNative);
|
|
|
1204
1204
|
* @returns The balance of the foreign asset as a bigint, or null if not found.
|
|
1205
1205
|
*/
|
|
1206
1206
|
var getBalanceForeign = createPolkadotJsApiCall(sdkCore.getBalanceForeign);
|
|
1207
|
-
/**
|
|
1208
|
-
* Retrieves detailed transfer information for a cross-chain transfer.
|
|
1209
|
-
*
|
|
1210
|
-
* @returns A Promise that resolves to the transfer information.
|
|
1211
|
-
*/
|
|
1212
|
-
var getTransferInfo = createPolkadotJsApiCall(sdkCore.getTransferInfo);
|
|
1213
1207
|
/**
|
|
1214
1208
|
* Retrieves the asset balance for a given account on a specified node.
|
|
1215
1209
|
*
|
|
@@ -1222,11 +1216,14 @@ var getAssetBalance = createPolkadotJsApiCall(sdkCore.getAssetBalance);
|
|
|
1222
1216
|
* @returns An extrinsic representing the claim transaction.
|
|
1223
1217
|
*/
|
|
1224
1218
|
var claimAssets = createPolkadotJsApiCall(sdkCore.claimAssets);
|
|
1219
|
+
/**
|
|
1220
|
+
* @deprecated This function is deprecated and will be removed in a future version.
|
|
1221
|
+
* Please use `builder.getOriginXcmFee()` or `builder.getOriginXcmFeeEstimate()` instead,
|
|
1222
|
+
* where `builder` is an instance of `Builder()`.
|
|
1223
|
+
* For more details, please refer to the documentation:
|
|
1224
|
+
* {@link https://paraspell.github.io/docs/sdk/xcmPallet.html#xcm-fee-origin-and-dest}
|
|
1225
|
+
*/
|
|
1225
1226
|
var getOriginFeeDetails = createPolkadotJsApiCall(sdkCore.getOriginFeeDetails);
|
|
1226
|
-
var getMaxNativeTransferableAmount = createPolkadotJsApiCall(sdkCore.getMaxNativeTransferableAmount);
|
|
1227
|
-
var getMaxForeignTransferableAmount = createPolkadotJsApiCall(sdkCore.getMaxForeignTransferableAmount);
|
|
1228
|
-
var getTransferableAmount = createPolkadotJsApiCall(sdkCore.getTransferableAmount);
|
|
1229
|
-
var verifyEdOnDestination = createPolkadotJsApiCall(sdkCore.verifyEdOnDestination);
|
|
1230
1227
|
|
|
1231
1228
|
var assets = /*#__PURE__*/Object.freeze({
|
|
1232
1229
|
__proto__: null,
|
|
@@ -1245,8 +1242,6 @@ var assets = /*#__PURE__*/Object.freeze({
|
|
|
1245
1242
|
getBalanceForeign: getBalanceForeign,
|
|
1246
1243
|
getBalanceNative: getBalanceNative,
|
|
1247
1244
|
getExistentialDeposit: sdkCore.getExistentialDeposit,
|
|
1248
|
-
getMaxForeignTransferableAmount: getMaxForeignTransferableAmount,
|
|
1249
|
-
getMaxNativeTransferableAmount: getMaxNativeTransferableAmount,
|
|
1250
1245
|
getNativeAssetSymbol: sdkCore.getNativeAssetSymbol,
|
|
1251
1246
|
getNativeAssets: sdkCore.getNativeAssets,
|
|
1252
1247
|
getOriginFeeDetails: getOriginFeeDetails,
|
|
@@ -1254,11 +1249,8 @@ var assets = /*#__PURE__*/Object.freeze({
|
|
|
1254
1249
|
getRelayChainSymbol: sdkCore.getRelayChainSymbol,
|
|
1255
1250
|
getSupportedAssets: sdkCore.getSupportedAssets,
|
|
1256
1251
|
getTNode: sdkCore.getTNode,
|
|
1257
|
-
getTransferInfo: getTransferInfo,
|
|
1258
|
-
getTransferableAmount: getTransferableAmount,
|
|
1259
1252
|
hasSupportForAsset: sdkCore.hasSupportForAsset,
|
|
1260
|
-
isNodeEvm: sdkCore.isNodeEvm
|
|
1261
|
-
verifyEdOnDestination: verifyEdOnDestination
|
|
1253
|
+
isNodeEvm: sdkCore.isNodeEvm
|
|
1262
1254
|
});
|
|
1263
1255
|
|
|
1264
1256
|
var convertSs58 = function convertSs58(address, node) {
|
|
@@ -1852,16 +1844,11 @@ exports.getAssetBalance = getAssetBalance;
|
|
|
1852
1844
|
exports.getBalanceForeign = getBalanceForeign;
|
|
1853
1845
|
exports.getBalanceNative = getBalanceNative;
|
|
1854
1846
|
exports.getBridgeStatus = getBridgeStatus;
|
|
1855
|
-
exports.getMaxForeignTransferableAmount = getMaxForeignTransferableAmount;
|
|
1856
|
-
exports.getMaxNativeTransferableAmount = getMaxNativeTransferableAmount;
|
|
1857
1847
|
exports.getOriginFeeDetails = getOriginFeeDetails;
|
|
1858
1848
|
exports.getParaEthTransferFees = getParaEthTransferFees;
|
|
1859
1849
|
exports.getTokenBalance = getTokenBalance;
|
|
1860
|
-
exports.getTransferInfo = getTransferInfo;
|
|
1861
|
-
exports.getTransferableAmount = getTransferableAmount;
|
|
1862
1850
|
exports.send = send;
|
|
1863
1851
|
exports.transferEthToPolkadot = transferEthToPolkadot;
|
|
1864
|
-
exports.verifyEdOnDestination = verifyEdOnDestination;
|
|
1865
1852
|
exports.xcmPallet = transfer;
|
|
1866
1853
|
Object.keys(sdkCore).forEach(function (k) {
|
|
1867
1854
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
package/dist/index.d.ts
CHANGED
|
@@ -30,14 +30,6 @@ declare const getBalanceNative: (options: _paraspell_sdk_core.TGetBalanceNativeO
|
|
|
30
30
|
declare const getBalanceForeign: (options: _paraspell_sdk_core.TGetBalanceForeignOptionsBase & {
|
|
31
31
|
api?: TPjsApiOrUrl;
|
|
32
32
|
}) => Promise<bigint>;
|
|
33
|
-
/**
|
|
34
|
-
* Retrieves detailed transfer information for a cross-chain transfer.
|
|
35
|
-
*
|
|
36
|
-
* @returns A Promise that resolves to the transfer information.
|
|
37
|
-
*/
|
|
38
|
-
declare const getTransferInfo: (options: _paraspell_sdk_core.TGetTransferInfoOptionsBase & {
|
|
39
|
-
api?: TPjsApiOrUrl;
|
|
40
|
-
}) => Promise<_paraspell_sdk_core.TTransferInfo>;
|
|
41
33
|
/**
|
|
42
34
|
* Retrieves the asset balance for a given account on a specified node.
|
|
43
35
|
*
|
|
@@ -54,21 +46,16 @@ declare const getAssetBalance: (options: _paraspell_sdk_core.TGetAssetBalanceOpt
|
|
|
54
46
|
declare const claimAssets: (options: _paraspell_sdk_core.TAssetClaimOptionsBase & {
|
|
55
47
|
api?: TPjsApiOrUrl;
|
|
56
48
|
}) => Promise<Extrinsic>;
|
|
49
|
+
/**
|
|
50
|
+
* @deprecated This function is deprecated and will be removed in a future version.
|
|
51
|
+
* Please use `builder.getOriginXcmFee()` or `builder.getOriginXcmFeeEstimate()` instead,
|
|
52
|
+
* where `builder` is an instance of `Builder()`.
|
|
53
|
+
* For more details, please refer to the documentation:
|
|
54
|
+
* {@link https://paraspell.github.io/docs/sdk/xcmPallet.html#xcm-fee-origin-and-dest}
|
|
55
|
+
*/
|
|
57
56
|
declare const getOriginFeeDetails: (options: _paraspell_sdk_core.TGetOriginFeeDetailsOptionsBase & {
|
|
58
57
|
api?: TPjsApiOrUrl;
|
|
59
58
|
}) => Promise<_paraspell_sdk_core.TOriginFeeDetails>;
|
|
60
|
-
declare const getMaxNativeTransferableAmount: (options: _paraspell_sdk_core.TGetMaxNativeTransferableAmountOptionsBase & {
|
|
61
|
-
api?: TPjsApiOrUrl;
|
|
62
|
-
}) => Promise<bigint>;
|
|
63
|
-
declare const getMaxForeignTransferableAmount: (options: _paraspell_sdk_core.TGetMaxForeignTransferableAmountOptionsBase & {
|
|
64
|
-
api?: TPjsApiOrUrl;
|
|
65
|
-
}) => Promise<bigint>;
|
|
66
|
-
declare const getTransferableAmount: (options: _paraspell_sdk_core.TGetTransferableAmountOptionsBase & {
|
|
67
|
-
api?: TPjsApiOrUrl;
|
|
68
|
-
}) => Promise<bigint>;
|
|
69
|
-
declare const verifyEdOnDestination: (options: _paraspell_sdk_core.TVerifyEdOnDestinationOptionsBase & {
|
|
70
|
-
api?: TPjsApiOrUrl;
|
|
71
|
-
}) => Promise<boolean>;
|
|
72
59
|
|
|
73
60
|
declare const assets_Foreign: typeof Foreign;
|
|
74
61
|
declare const assets_ForeignAbstract: typeof ForeignAbstract;
|
|
@@ -85,8 +72,6 @@ declare const assets_getAssetsObject: typeof getAssetsObject;
|
|
|
85
72
|
declare const assets_getBalanceForeign: typeof getBalanceForeign;
|
|
86
73
|
declare const assets_getBalanceNative: typeof getBalanceNative;
|
|
87
74
|
declare const assets_getExistentialDeposit: typeof getExistentialDeposit;
|
|
88
|
-
declare const assets_getMaxForeignTransferableAmount: typeof getMaxForeignTransferableAmount;
|
|
89
|
-
declare const assets_getMaxNativeTransferableAmount: typeof getMaxNativeTransferableAmount;
|
|
90
75
|
declare const assets_getNativeAssetSymbol: typeof getNativeAssetSymbol;
|
|
91
76
|
declare const assets_getNativeAssets: typeof getNativeAssets;
|
|
92
77
|
declare const assets_getOriginFeeDetails: typeof getOriginFeeDetails;
|
|
@@ -94,11 +79,8 @@ declare const assets_getOtherAssets: typeof getOtherAssets;
|
|
|
94
79
|
declare const assets_getRelayChainSymbol: typeof getRelayChainSymbol;
|
|
95
80
|
declare const assets_getSupportedAssets: typeof getSupportedAssets;
|
|
96
81
|
declare const assets_getTNode: typeof getTNode;
|
|
97
|
-
declare const assets_getTransferInfo: typeof getTransferInfo;
|
|
98
|
-
declare const assets_getTransferableAmount: typeof getTransferableAmount;
|
|
99
82
|
declare const assets_hasSupportForAsset: typeof hasSupportForAsset;
|
|
100
83
|
declare const assets_isNodeEvm: typeof isNodeEvm;
|
|
101
|
-
declare const assets_verifyEdOnDestination: typeof verifyEdOnDestination;
|
|
102
84
|
declare namespace assets {
|
|
103
85
|
export {
|
|
104
86
|
assets_Foreign as Foreign,
|
|
@@ -116,8 +98,6 @@ declare namespace assets {
|
|
|
116
98
|
assets_getBalanceForeign as getBalanceForeign,
|
|
117
99
|
assets_getBalanceNative as getBalanceNative,
|
|
118
100
|
assets_getExistentialDeposit as getExistentialDeposit,
|
|
119
|
-
assets_getMaxForeignTransferableAmount as getMaxForeignTransferableAmount,
|
|
120
|
-
assets_getMaxNativeTransferableAmount as getMaxNativeTransferableAmount,
|
|
121
101
|
assets_getNativeAssetSymbol as getNativeAssetSymbol,
|
|
122
102
|
assets_getNativeAssets as getNativeAssets,
|
|
123
103
|
assets_getOriginFeeDetails as getOriginFeeDetails,
|
|
@@ -125,11 +105,8 @@ declare namespace assets {
|
|
|
125
105
|
assets_getRelayChainSymbol as getRelayChainSymbol,
|
|
126
106
|
assets_getSupportedAssets as getSupportedAssets,
|
|
127
107
|
assets_getTNode as getTNode,
|
|
128
|
-
assets_getTransferInfo as getTransferInfo,
|
|
129
|
-
assets_getTransferableAmount as getTransferableAmount,
|
|
130
108
|
assets_hasSupportForAsset as hasSupportForAsset,
|
|
131
109
|
assets_isNodeEvm as isNodeEvm,
|
|
132
|
-
assets_verifyEdOnDestination as verifyEdOnDestination,
|
|
133
110
|
};
|
|
134
111
|
}
|
|
135
112
|
|
|
@@ -271,5 +248,5 @@ declare namespace transfer {
|
|
|
271
248
|
|
|
272
249
|
declare const createApiInstanceForNode: (node: TNodeDotKsmWithRelayChains) => Promise<_polkadot_api.ApiPromise>;
|
|
273
250
|
|
|
274
|
-
export { Builder, EvmBuilder, approveToken, assets, claimAssets, convertSs58, createApiInstanceForNode, depositToken, dryRun, dryRunOrigin, getAssetBalance, getBalanceForeign, getBalanceNative, getBridgeStatus,
|
|
251
|
+
export { Builder, EvmBuilder, approveToken, assets, claimAssets, convertSs58, createApiInstanceForNode, depositToken, dryRun, dryRunOrigin, getAssetBalance, getBalanceForeign, getBalanceNative, getBridgeStatus, getOriginFeeDetails, getParaEthTransferFees, getTokenBalance, send, transferEthToPolkadot, transfer as xcmPallet };
|
|
275
252
|
export type { Extrinsic, GeneralBuilder, TPjsApi, TPjsApiOrUrl };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BatchMode, createApiInstanceForNode as createApiInstanceForNode$1, getNode, isForeignAsset, computeFeeFromDryRunPjs, resolveModuleError, getAssetsObject, NodeNotSupportedError, getBalanceNative as getBalanceNative$1, getBalanceForeign as getBalanceForeign$1,
|
|
1
|
+
import { BatchMode, createApiInstanceForNode as createApiInstanceForNode$1, getNode, isForeignAsset, computeFeeFromDryRunPjs, resolveModuleError, getAssetsObject, NodeNotSupportedError, getBalanceNative as getBalanceNative$1, getBalanceForeign as getBalanceForeign$1, getAssetBalance as getAssetBalance$1, claimAssets as claimAssets$1, getOriginFeeDetails as getOriginFeeDetails$1, Foreign, ForeignAbstract, Native, Override, findAsset, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTNode, hasSupportForAsset, isNodeEvm, convertSs58 as convertSs58$1, getParaId, ETH_CHAIN_ID, InvalidCurrencyError, isEthersSigner, isOverrideMultiLocationSpecifier, validateAddress, transferMoonbeamToEth, transferMoonbeamEvm, Builder as Builder$1, getParaEthTransferFees as getParaEthTransferFees$1, DRY_RUN_CLIENT_TIMEOUT_MS, getBridgeStatus as getBridgeStatus$1, send as send$1, dryRun as dryRun$1, dryRunOrigin as dryRunOrigin$1 } from '@paraspell/sdk-core';
|
|
2
2
|
export * from '@paraspell/sdk-core';
|
|
3
3
|
import { WsProvider, ApiPromise } from '@polkadot/api';
|
|
4
4
|
import { u32 } from '@polkadot/types';
|
|
@@ -1203,12 +1203,6 @@ var getBalanceNative = createPolkadotJsApiCall(getBalanceNative$1);
|
|
|
1203
1203
|
* @returns The balance of the foreign asset as a bigint, or null if not found.
|
|
1204
1204
|
*/
|
|
1205
1205
|
var getBalanceForeign = createPolkadotJsApiCall(getBalanceForeign$1);
|
|
1206
|
-
/**
|
|
1207
|
-
* Retrieves detailed transfer information for a cross-chain transfer.
|
|
1208
|
-
*
|
|
1209
|
-
* @returns A Promise that resolves to the transfer information.
|
|
1210
|
-
*/
|
|
1211
|
-
var getTransferInfo = createPolkadotJsApiCall(getTransferInfo$1);
|
|
1212
1206
|
/**
|
|
1213
1207
|
* Retrieves the asset balance for a given account on a specified node.
|
|
1214
1208
|
*
|
|
@@ -1221,11 +1215,14 @@ var getAssetBalance = createPolkadotJsApiCall(getAssetBalance$1);
|
|
|
1221
1215
|
* @returns An extrinsic representing the claim transaction.
|
|
1222
1216
|
*/
|
|
1223
1217
|
var claimAssets = createPolkadotJsApiCall(claimAssets$1);
|
|
1218
|
+
/**
|
|
1219
|
+
* @deprecated This function is deprecated and will be removed in a future version.
|
|
1220
|
+
* Please use `builder.getOriginXcmFee()` or `builder.getOriginXcmFeeEstimate()` instead,
|
|
1221
|
+
* where `builder` is an instance of `Builder()`.
|
|
1222
|
+
* For more details, please refer to the documentation:
|
|
1223
|
+
* {@link https://paraspell.github.io/docs/sdk/xcmPallet.html#xcm-fee-origin-and-dest}
|
|
1224
|
+
*/
|
|
1224
1225
|
var getOriginFeeDetails = createPolkadotJsApiCall(getOriginFeeDetails$1);
|
|
1225
|
-
var getMaxNativeTransferableAmount = createPolkadotJsApiCall(getMaxNativeTransferableAmount$1);
|
|
1226
|
-
var getMaxForeignTransferableAmount = createPolkadotJsApiCall(getMaxForeignTransferableAmount$1);
|
|
1227
|
-
var getTransferableAmount = createPolkadotJsApiCall(getTransferableAmount$1);
|
|
1228
|
-
var verifyEdOnDestination = createPolkadotJsApiCall(verifyEdOnDestination$1);
|
|
1229
1226
|
|
|
1230
1227
|
var assets = /*#__PURE__*/Object.freeze({
|
|
1231
1228
|
__proto__: null,
|
|
@@ -1244,8 +1241,6 @@ var assets = /*#__PURE__*/Object.freeze({
|
|
|
1244
1241
|
getBalanceForeign: getBalanceForeign,
|
|
1245
1242
|
getBalanceNative: getBalanceNative,
|
|
1246
1243
|
getExistentialDeposit: getExistentialDeposit,
|
|
1247
|
-
getMaxForeignTransferableAmount: getMaxForeignTransferableAmount,
|
|
1248
|
-
getMaxNativeTransferableAmount: getMaxNativeTransferableAmount,
|
|
1249
1244
|
getNativeAssetSymbol: getNativeAssetSymbol,
|
|
1250
1245
|
getNativeAssets: getNativeAssets,
|
|
1251
1246
|
getOriginFeeDetails: getOriginFeeDetails,
|
|
@@ -1253,11 +1248,8 @@ var assets = /*#__PURE__*/Object.freeze({
|
|
|
1253
1248
|
getRelayChainSymbol: getRelayChainSymbol,
|
|
1254
1249
|
getSupportedAssets: getSupportedAssets,
|
|
1255
1250
|
getTNode: getTNode,
|
|
1256
|
-
getTransferInfo: getTransferInfo,
|
|
1257
|
-
getTransferableAmount: getTransferableAmount,
|
|
1258
1251
|
hasSupportForAsset: hasSupportForAsset,
|
|
1259
|
-
isNodeEvm: isNodeEvm
|
|
1260
|
-
verifyEdOnDestination: verifyEdOnDestination
|
|
1252
|
+
isNodeEvm: isNodeEvm
|
|
1261
1253
|
});
|
|
1262
1254
|
|
|
1263
1255
|
var convertSs58 = function convertSs58(address, node) {
|
|
@@ -1837,4 +1829,4 @@ var transfer = /*#__PURE__*/Object.freeze({
|
|
|
1837
1829
|
transferEthToPolkadot: transferEthToPolkadot
|
|
1838
1830
|
});
|
|
1839
1831
|
|
|
1840
|
-
export { Builder, EvmBuilder, approveToken, assets, claimAssets, convertSs58, createApiInstanceForNode, depositToken, dryRun, dryRunOrigin, getAssetBalance, getBalanceForeign, getBalanceNative, getBridgeStatus,
|
|
1832
|
+
export { Builder, EvmBuilder, approveToken, assets, claimAssets, convertSs58, createApiInstanceForNode, depositToken, dryRun, dryRunOrigin, getAssetBalance, getBalanceForeign, getBalanceNative, getBridgeStatus, getOriginFeeDetails, getParaEthTransferFees, getTokenBalance, send, transferEthToPolkadot, transfer as xcmPallet };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk-pjs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.1",
|
|
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.1.50",
|
|
28
28
|
"ethers": "^6.13.7",
|
|
29
29
|
"viem": "^2.28.1",
|
|
30
|
-
"@paraspell/sdk-core": "
|
|
30
|
+
"@paraspell/sdk-core": "10.0.1"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@polkadot/api": ">= 15.0 < 16",
|