@paraspell/sdk 9.2.2 → 10.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 +107 -66
- package/dist/index.cjs +11 -24
- package/dist/index.d.ts +12 -38
- package/dist/index.mjs +12 -20
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -48,13 +48,13 @@ pnpm | npm install || yarn add @paraspell/sdk
|
|
|
48
48
|
### Importing package to your project
|
|
49
49
|
|
|
50
50
|
Builder pattern:
|
|
51
|
-
```
|
|
51
|
+
```ts
|
|
52
52
|
// Polkadot API version
|
|
53
53
|
import { Builder } from '@paraspell/sdk'
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
Other patterns:
|
|
57
|
-
```
|
|
57
|
+
```ts
|
|
58
58
|
// ESM
|
|
59
59
|
import * as paraspell from '@paraspell/sdk'
|
|
60
60
|
|
|
@@ -63,29 +63,26 @@ const paraspell = require('@paraspell/sdk')
|
|
|
63
63
|
```
|
|
64
64
|
|
|
65
65
|
Interaction with further asset symbol abstraction:
|
|
66
|
-
```
|
|
66
|
+
```ts
|
|
67
67
|
import { Native, Foreign, ForeignAbstract } from '@paraspell/sdk'; //Only needed when advanced asset symbol selection is used.
|
|
68
68
|
```
|
|
69
69
|
## Implementation
|
|
70
70
|
|
|
71
71
|
```
|
|
72
72
|
NOTES:
|
|
73
|
-
-
|
|
74
|
-
- You can now query foreign asset minimal deposits also.
|
|
75
|
-
- Since v8, amount moved closer to currency selection and specifying from and to parameters is no longer optional to save code.
|
|
76
|
-
- More information on v8 major breaking change: https://github.com/paraspell/xcm-tools/pull/554
|
|
77
|
-
- XCM SDK Now supports API Failsafe - If one endpoint doesn't work it automatically switches to the next one.
|
|
78
|
-
- Builder now allows you to directly disconnect API.
|
|
73
|
+
- Local transfers are now available for every currency and every chain. To try them, simply use same origin and destination parameters.
|
|
79
74
|
```
|
|
80
75
|
|
|
81
76
|
```
|
|
82
77
|
Latest news:
|
|
83
|
-
-
|
|
78
|
+
- Transfer info queries are now all in Builder pattern and don't require any imports other than builder.
|
|
84
79
|
```
|
|
85
80
|
|
|
86
|
-
###
|
|
81
|
+
### Sending XCM:
|
|
87
82
|
|
|
88
|
-
|
|
83
|
+
For full documentation with examples on this feature head over to [official documentation](https://paraspell.github.io/docs/sdk/xcmPallet.html).
|
|
84
|
+
|
|
85
|
+
#### Transfer assets from Parachain to Parachain
|
|
89
86
|
```ts
|
|
90
87
|
const builder = Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
91
88
|
.from(NODE)
|
|
@@ -120,7 +117,7 @@ const tx = await builder.build()
|
|
|
120
117
|
await builder.disconnect()
|
|
121
118
|
*/
|
|
122
119
|
```
|
|
123
|
-
|
|
120
|
+
#### Transfer assets from the Relay chain to Parachain
|
|
124
121
|
```ts
|
|
125
122
|
const builder = Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
126
123
|
.from(RELAY_NODE) //Kusama or Polkadot
|
|
@@ -152,7 +149,7 @@ const tx = await builder.build()
|
|
|
152
149
|
await builder.disconnect()
|
|
153
150
|
*/
|
|
154
151
|
```
|
|
155
|
-
|
|
152
|
+
#### Transfer assets from Parachain to Relay chain
|
|
156
153
|
```ts
|
|
157
154
|
const builder = Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
158
155
|
.from(NODE)
|
|
@@ -185,7 +182,7 @@ await builder.disconnect()
|
|
|
185
182
|
*/
|
|
186
183
|
```
|
|
187
184
|
|
|
188
|
-
|
|
185
|
+
#### Local transfers
|
|
189
186
|
```ts
|
|
190
187
|
const builder = Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
191
188
|
.from(NODE)
|
|
@@ -216,9 +213,8 @@ await builder.disconnect()
|
|
|
216
213
|
*/
|
|
217
214
|
```
|
|
218
215
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
```js
|
|
216
|
+
#### Batch calls
|
|
217
|
+
```ts
|
|
222
218
|
const builder = Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
223
219
|
.from(NODE) //Ensure, that origin node is the same in all batched XCM Calls.
|
|
224
220
|
.to(NODE_2) //Any compatible Parachain
|
|
@@ -241,7 +237,7 @@ const tx = await builder.buildBatch({
|
|
|
241
237
|
await builder.disconnect()
|
|
242
238
|
```
|
|
243
239
|
|
|
244
|
-
|
|
240
|
+
#### Asset claim:
|
|
245
241
|
```ts
|
|
246
242
|
//Claim XCM trapped assets from the selected chain
|
|
247
243
|
const builder = Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
@@ -256,7 +252,7 @@ const tx = await builder.build()
|
|
|
256
252
|
await builder.disconnect()
|
|
257
253
|
```
|
|
258
254
|
|
|
259
|
-
|
|
255
|
+
#### Dry run your XCM Calls:
|
|
260
256
|
```ts
|
|
261
257
|
//Builder pattern
|
|
262
258
|
const result = await Builder(API /*optional*/)
|
|
@@ -273,67 +269,107 @@ import { hasDryRunSupport } from "@paraspell/sdk-pjs";
|
|
|
273
269
|
const result = hasDryRunSupport(node)
|
|
274
270
|
```
|
|
275
271
|
|
|
276
|
-
### XCM Fee
|
|
277
|
-
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
|
|
278
273
|
|
|
279
|
-
|
|
280
|
-
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).
|
|
281
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
|
+
.address(RECIPIENT_ADDRESS)
|
|
283
|
+
.senderAddress(SENDER_ADDRESS)
|
|
284
|
+
.getTransferInfo()
|
|
282
285
|
```
|
|
283
|
-
|
|
286
|
+
|
|
287
|
+
#### Transferable amount
|
|
288
|
+
```ts
|
|
289
|
+
const transferable = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
290
|
+
.from(ORIGIN_CHAIN)
|
|
291
|
+
.to(DESTINATION_CHAIN)
|
|
292
|
+
.currency(CURRENCY)
|
|
293
|
+
.address(RECIPIENT_ADDRESS)
|
|
294
|
+
.senderAddress(SENDER_ADDRESS)
|
|
295
|
+
.getTransferableAmount()
|
|
284
296
|
```
|
|
285
297
|
|
|
298
|
+
#### Verify ED on destination
|
|
286
299
|
```ts
|
|
287
|
-
const
|
|
300
|
+
const ed = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
288
301
|
.from(ORIGIN_CHAIN)
|
|
289
302
|
.to(DESTINATION_CHAIN)
|
|
290
303
|
.currency(CURRENCY)
|
|
291
304
|
.address(RECIPIENT_ADDRESS)
|
|
292
305
|
.senderAddress(SENDER_ADDRESS)
|
|
293
|
-
.
|
|
306
|
+
.verifyEdOnDestination()
|
|
294
307
|
```
|
|
295
308
|
|
|
296
|
-
####
|
|
297
|
-
This query is designed to retrieve you approximate fee and doesn't require any token balance.
|
|
309
|
+
#### XCM Fee (Origin and Dest.)
|
|
298
310
|
|
|
299
|
-
|
|
300
|
-
|
|
311
|
+
##### More accurate query using DryRun
|
|
312
|
+
```ts
|
|
313
|
+
const fee = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
314
|
+
.from(ORIGIN_CHAIN)
|
|
315
|
+
.to(DESTINATION_CHAIN)
|
|
316
|
+
.currency(CURRENCY)
|
|
317
|
+
.address(RECIPIENT_ADDRESS)
|
|
318
|
+
.senderAddress(SENDER_ADDRESS)
|
|
319
|
+
.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.
|
|
301
320
|
```
|
|
302
321
|
|
|
322
|
+
##### Less accurate query using Payment info
|
|
303
323
|
```ts
|
|
304
324
|
const fee = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
305
325
|
.from(ORIGIN_CHAIN)
|
|
306
326
|
.to(DESTINATION_CHAIN)
|
|
307
327
|
.currency(CURRENCY)
|
|
308
328
|
.address(RECIPIENT_ADDRESS)
|
|
309
|
-
.senderAddress(SENDER_ADDRESS)
|
|
329
|
+
.senderAddress(SENDER_ADDRESS)
|
|
310
330
|
.getXcmFeeEstimate()
|
|
311
331
|
```
|
|
312
332
|
|
|
313
|
-
|
|
314
|
-
```ts
|
|
315
|
-
import { getAssetBalance, getTransferInfo, getOriginFeeDetails, getTransferableAmount, getParaEthTransferFees, verifyEdOnDestination } from "@paraspell/sdk";
|
|
333
|
+
#### XCM Fee (Origin only)
|
|
316
334
|
|
|
317
|
-
|
|
318
|
-
|
|
335
|
+
##### More accurate query using DryRun
|
|
336
|
+
```ts
|
|
337
|
+
const fee = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
338
|
+
.from(ORIGIN_CHAIN)
|
|
339
|
+
.to(DESTINATION_CHAIN)
|
|
340
|
+
.currency(CURRENCY)
|
|
341
|
+
.address(RECIPIENT_ADDRESS)
|
|
342
|
+
.senderAddress(SENDER_ADDRESS)
|
|
343
|
+
.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.
|
|
344
|
+
```
|
|
319
345
|
|
|
320
|
-
|
|
321
|
-
|
|
346
|
+
##### Less accurate query using Payment info
|
|
347
|
+
```ts
|
|
348
|
+
const fee = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
349
|
+
.from(ORIGIN_CHAIN)
|
|
350
|
+
.to(DESTINATION_CHAIN)
|
|
351
|
+
.currency(CURRENCY)
|
|
352
|
+
.address(RECIPIENT_ADDRESS)
|
|
353
|
+
.senderAddress(SENDER_ADDRESS)
|
|
354
|
+
.getOriginXcmFeeEstimate()
|
|
355
|
+
```
|
|
322
356
|
|
|
323
|
-
|
|
324
|
-
|
|
357
|
+
#### Asset balance
|
|
358
|
+
```ts
|
|
359
|
+
import { getAssetBalance } from "@paraspell/sdk";
|
|
325
360
|
|
|
326
|
-
//
|
|
327
|
-
await
|
|
361
|
+
//Retrieves the asset balance for a given account on a specified node (You do not need to specify if it is native or foreign).
|
|
362
|
+
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 */});
|
|
363
|
+
```
|
|
328
364
|
|
|
329
|
-
|
|
330
|
-
|
|
365
|
+
#### Ethereum bridge fees
|
|
366
|
+
```ts
|
|
367
|
+
import { getParaEthTransferFees } from "@paraspell/sdk";
|
|
331
368
|
|
|
332
|
-
|
|
333
|
-
await verifyEdOnDestination(node, currency: {symbol: || id: || multilocation: .. ,amount: 100000n}, address)
|
|
369
|
+
const fees = await getParaEthTransferFees(/*api - optional (Can also be WS port string or array o WS ports. Must be AssetHubPolkadot WS!)*/)
|
|
334
370
|
```
|
|
335
371
|
|
|
336
|
-
|
|
372
|
+
#### Existential deposit queries
|
|
337
373
|
```ts
|
|
338
374
|
import { getExistentialDeposit } from "@paraspell/sdk";
|
|
339
375
|
|
|
@@ -342,7 +378,7 @@ import { getExistentialDeposit } from "@paraspell/sdk";
|
|
|
342
378
|
const ed = getExistentialDeposit(node, currency?)
|
|
343
379
|
```
|
|
344
380
|
|
|
345
|
-
|
|
381
|
+
#### Convert SS58 address
|
|
346
382
|
```ts
|
|
347
383
|
import { convertSs58 } from "@paraspell/sdk";
|
|
348
384
|
|
|
@@ -351,61 +387,66 @@ let result = convertSs58(address, node) // returns converted address in string
|
|
|
351
387
|
|
|
352
388
|
### Asset queries:
|
|
353
389
|
|
|
390
|
+
For full documentation with examples on this feature head over to [official documentation](https://paraspell.github.io/docs/sdk/AssetPallet.html).
|
|
391
|
+
|
|
354
392
|
```ts
|
|
355
393
|
import { getFeeAssets, getAssetsObject, getAssetId, getRelayChainSymbol, getNativeAssets, getNativeAssets, getOtherAssets, getAllAssetsSymbols, hasSupportForAsset, getAssetDecimals, getParaId, getTNode, getAssetMultiLocation, NODE_NAMES } from '@paraspell/sdk'
|
|
356
394
|
|
|
357
395
|
// Retrieve Fee asset queries (Assets accepted as XCM Fee on specific node)
|
|
358
|
-
getFeeAssets(
|
|
396
|
+
getFeeAssets(NODE)
|
|
397
|
+
|
|
398
|
+
// Get multilocation for asset id or symbol on specific chain
|
|
399
|
+
getAssetMultiLocation(NODE, { symbol: symbol } | { id: assetId })
|
|
359
400
|
|
|
360
401
|
// Retrieve assets object from assets.json for particular node including information about native and foreign assets
|
|
361
|
-
getAssetsObject(
|
|
402
|
+
getAssetsObject(NODE)
|
|
362
403
|
|
|
363
404
|
// Retrieve foreign assetId for a particular node and asset symbol
|
|
364
|
-
getAssetId(
|
|
405
|
+
getAssetId(NODE, ASSET_SYMBOL)
|
|
365
406
|
|
|
366
407
|
// Retrieve the symbol of the relay chain for a particular node. Either "DOT" or "KSM"
|
|
367
|
-
getRelayChainSymbol(
|
|
408
|
+
getRelayChainSymbol(NODE)
|
|
368
409
|
|
|
369
410
|
// Retrieve string array of native assets symbols for particular node
|
|
370
|
-
getNativeAssets(
|
|
411
|
+
getNativeAssets(NODE)
|
|
371
412
|
|
|
372
413
|
// Retrieve object array of foreign assets for a particular node. Each object has a symbol and assetId property
|
|
373
|
-
getOtherAssets(
|
|
414
|
+
getOtherAssets(NODE)
|
|
374
415
|
|
|
375
416
|
// Retrieve string array of all assets symbols. (native and foreign assets are merged into a single array)
|
|
376
|
-
getAllAssetsSymbols(
|
|
417
|
+
getAllAssetsSymbols(NODE)
|
|
377
418
|
|
|
378
419
|
// Check if a node supports a particular asset. (Both native and foreign assets are searched). Returns boolean
|
|
379
|
-
hasSupportForAsset(
|
|
420
|
+
hasSupportForAsset(NODE, ASSET_SYMBOL)
|
|
380
421
|
|
|
381
422
|
// Get decimals for specific asset
|
|
382
|
-
getAssetDecimals(
|
|
423
|
+
getAssetDecimals(NODE, ASSET_SYMBOL)
|
|
383
424
|
|
|
384
425
|
// Get specific node id
|
|
385
|
-
getParaId(
|
|
426
|
+
getParaId(NODE)
|
|
386
427
|
|
|
387
428
|
// Get specific TNode from nodeID
|
|
388
|
-
getTNode(
|
|
429
|
+
getTNode(paraID: number, ecosystem: 'polkadot' || 'kusama' || 'ethereum') //When Ethereum ecosystem is selected please fill nodeID as 1 to select Ethereum.
|
|
389
430
|
|
|
390
431
|
// Import all compatible nodes as constant
|
|
391
432
|
NODE_NAMES
|
|
392
|
-
|
|
393
|
-
// Get multilocation for asset id or symbol on specific chain
|
|
394
|
-
getAssetMultiLocation(chainFrom, { symbol: symbol } | { id: assetId })
|
|
395
433
|
```
|
|
396
434
|
|
|
397
435
|
### Parachain XCM Pallet queries
|
|
436
|
+
|
|
437
|
+
For full documentation with examples on this feature head over to [official documentation](https://paraspell.github.io/docs/sdk/NodePallets.html).
|
|
438
|
+
|
|
398
439
|
```ts
|
|
399
440
|
import { getDefaultPallet, getSupportedPallets, getPalletIndex SUPPORTED_PALLETS } from '@paraspell/sdk';
|
|
400
441
|
|
|
401
442
|
//Retrieve default pallet for specific Parachain
|
|
402
|
-
getDefaultPallet(
|
|
443
|
+
getDefaultPallet(NODE)
|
|
403
444
|
|
|
404
445
|
// Returns an array of supported pallets for a specific Parachain
|
|
405
|
-
getSupportedPallets(
|
|
446
|
+
getSupportedPallets(NODE)
|
|
406
447
|
|
|
407
448
|
//Returns index of XCM Pallet used by Parachain
|
|
408
|
-
getPalletIndex(
|
|
449
|
+
getPalletIndex(NODE)
|
|
409
450
|
|
|
410
451
|
// Print all pallets that are currently supported
|
|
411
452
|
console.log(SUPPORTED_PALLETS)
|
package/dist/index.cjs
CHANGED
|
@@ -1686,12 +1686,6 @@ var getBalanceNative = createPapiApiCall(sdkCore.getBalanceNative);
|
|
|
1686
1686
|
* @returns The balance of the foreign asset as a bigint, or null if not found.
|
|
1687
1687
|
*/
|
|
1688
1688
|
var getBalanceForeign = createPapiApiCall(sdkCore.getBalanceForeign);
|
|
1689
|
-
/**
|
|
1690
|
-
* Retrieves detailed transfer information for a cross-chain transfer.
|
|
1691
|
-
*
|
|
1692
|
-
* @returns A Promise that resolves to the transfer information.
|
|
1693
|
-
*/
|
|
1694
|
-
var getTransferInfo = createPapiApiCall(sdkCore.getTransferInfo);
|
|
1695
1689
|
/**
|
|
1696
1690
|
* Retrieves the asset balance for a given account on a specified node.
|
|
1697
1691
|
*
|
|
@@ -1704,11 +1698,14 @@ var getAssetBalance = createPapiApiCall(sdkCore.getAssetBalance);
|
|
|
1704
1698
|
* @returns An extrinsic representing the claim transaction.
|
|
1705
1699
|
*/
|
|
1706
1700
|
var claimAssets = createPapiApiCall(sdkCore.claimAssets);
|
|
1701
|
+
/**
|
|
1702
|
+
* @deprecated This function is deprecated and will be removed in a future version.
|
|
1703
|
+
* Please use `builder.getOriginXcmFee()` or `builder.getOriginXcmFeeEstimate()` instead,
|
|
1704
|
+
* where `builder` is an instance of `Builder()`.
|
|
1705
|
+
* For more details, please refer to the documentation:
|
|
1706
|
+
* {@link https://paraspell.github.io/docs/sdk/xcmPallet.html#xcm-fee-origin-and-dest}
|
|
1707
|
+
*/
|
|
1707
1708
|
var getOriginFeeDetails = createPapiApiCall(sdkCore.getOriginFeeDetails);
|
|
1708
|
-
var getMaxNativeTransferableAmount = createPapiApiCall(sdkCore.getMaxNativeTransferableAmount);
|
|
1709
|
-
var getMaxForeignTransferableAmount = createPapiApiCall(sdkCore.getMaxForeignTransferableAmount);
|
|
1710
|
-
var getTransferableAmount = createPapiApiCall(sdkCore.getTransferableAmount);
|
|
1711
|
-
var verifyEdOnDestination = createPapiApiCall(sdkCore.verifyEdOnDestination);
|
|
1712
1709
|
|
|
1713
1710
|
var assets = /*#__PURE__*/Object.freeze({
|
|
1714
1711
|
__proto__: null,
|
|
@@ -1727,8 +1724,6 @@ var assets = /*#__PURE__*/Object.freeze({
|
|
|
1727
1724
|
getBalanceForeign: getBalanceForeign,
|
|
1728
1725
|
getBalanceNative: getBalanceNative,
|
|
1729
1726
|
getExistentialDeposit: sdkCore.getExistentialDeposit,
|
|
1730
|
-
getMaxForeignTransferableAmount: getMaxForeignTransferableAmount,
|
|
1731
|
-
getMaxNativeTransferableAmount: getMaxNativeTransferableAmount,
|
|
1732
1727
|
getNativeAssetSymbol: sdkCore.getNativeAssetSymbol,
|
|
1733
1728
|
getNativeAssets: sdkCore.getNativeAssets,
|
|
1734
1729
|
getOriginFeeDetails: getOriginFeeDetails,
|
|
@@ -1736,11 +1731,8 @@ var assets = /*#__PURE__*/Object.freeze({
|
|
|
1736
1731
|
getRelayChainSymbol: sdkCore.getRelayChainSymbol,
|
|
1737
1732
|
getSupportedAssets: sdkCore.getSupportedAssets,
|
|
1738
1733
|
getTNode: sdkCore.getTNode,
|
|
1739
|
-
getTransferInfo: getTransferInfo,
|
|
1740
|
-
getTransferableAmount: getTransferableAmount,
|
|
1741
1734
|
hasSupportForAsset: sdkCore.hasSupportForAsset,
|
|
1742
|
-
isNodeEvm: sdkCore.isNodeEvm
|
|
1743
|
-
verifyEdOnDestination: verifyEdOnDestination
|
|
1735
|
+
isNodeEvm: sdkCore.isNodeEvm
|
|
1744
1736
|
});
|
|
1745
1737
|
|
|
1746
1738
|
var convertSs58 = function convertSs58(address, node) {
|
|
@@ -1943,14 +1935,14 @@ var getBridgeStatus = /*#__PURE__*/function () {
|
|
|
1943
1935
|
return _ref2.apply(this, arguments);
|
|
1944
1936
|
};
|
|
1945
1937
|
}();
|
|
1946
|
-
var
|
|
1938
|
+
var getOriginXcmFee = createPapiApiCall(sdkCore.getOriginXcmFee);
|
|
1947
1939
|
|
|
1948
1940
|
var transfer = /*#__PURE__*/Object.freeze({
|
|
1949
1941
|
__proto__: null,
|
|
1950
1942
|
dryRun: dryRun,
|
|
1951
1943
|
dryRunOrigin: dryRunOrigin,
|
|
1952
1944
|
getBridgeStatus: getBridgeStatus,
|
|
1953
|
-
|
|
1945
|
+
getOriginXcmFee: getOriginXcmFee,
|
|
1954
1946
|
getParaEthTransferFees: getParaEthTransferFees,
|
|
1955
1947
|
send: send
|
|
1956
1948
|
});
|
|
@@ -1967,15 +1959,10 @@ exports.getAssetBalance = getAssetBalance;
|
|
|
1967
1959
|
exports.getBalanceForeign = getBalanceForeign;
|
|
1968
1960
|
exports.getBalanceNative = getBalanceNative;
|
|
1969
1961
|
exports.getBridgeStatus = getBridgeStatus;
|
|
1970
|
-
exports.getFeeForOriginNode = getFeeForOriginNode;
|
|
1971
|
-
exports.getMaxForeignTransferableAmount = getMaxForeignTransferableAmount;
|
|
1972
|
-
exports.getMaxNativeTransferableAmount = getMaxNativeTransferableAmount;
|
|
1973
1962
|
exports.getOriginFeeDetails = getOriginFeeDetails;
|
|
1963
|
+
exports.getOriginXcmFee = getOriginXcmFee;
|
|
1974
1964
|
exports.getParaEthTransferFees = getParaEthTransferFees;
|
|
1975
|
-
exports.getTransferInfo = getTransferInfo;
|
|
1976
|
-
exports.getTransferableAmount = getTransferableAmount;
|
|
1977
1965
|
exports.send = send;
|
|
1978
|
-
exports.verifyEdOnDestination = verifyEdOnDestination;
|
|
1979
1966
|
exports.xcmPallet = transfer;
|
|
1980
1967
|
Object.keys(sdkCore).forEach(function (k) {
|
|
1981
1968
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
package/dist/index.d.ts
CHANGED
|
@@ -28,14 +28,6 @@ declare const getBalanceNative: (options: _paraspell_sdk_core.TGetBalanceNativeO
|
|
|
28
28
|
declare const getBalanceForeign: (options: _paraspell_sdk_core.TGetBalanceForeignOptionsBase & {
|
|
29
29
|
api?: TPapiApiOrUrl;
|
|
30
30
|
}) => Promise<bigint>;
|
|
31
|
-
/**
|
|
32
|
-
* Retrieves detailed transfer information for a cross-chain transfer.
|
|
33
|
-
*
|
|
34
|
-
* @returns A Promise that resolves to the transfer information.
|
|
35
|
-
*/
|
|
36
|
-
declare const getTransferInfo: (options: _paraspell_sdk_core.TGetTransferInfoOptionsBase & {
|
|
37
|
-
api?: TPapiApiOrUrl;
|
|
38
|
-
}) => Promise<_paraspell_sdk_core.TTransferInfo>;
|
|
39
31
|
/**
|
|
40
32
|
* Retrieves the asset balance for a given account on a specified node.
|
|
41
33
|
*
|
|
@@ -52,21 +44,16 @@ declare const getAssetBalance: (options: _paraspell_sdk_core.TGetAssetBalanceOpt
|
|
|
52
44
|
declare const claimAssets: (options: _paraspell_sdk_core.TAssetClaimOptionsBase & {
|
|
53
45
|
api?: TPapiApiOrUrl;
|
|
54
46
|
}) => Promise<TPapiTransaction>;
|
|
47
|
+
/**
|
|
48
|
+
* @deprecated This function is deprecated and will be removed in a future version.
|
|
49
|
+
* Please use `builder.getOriginXcmFee()` or `builder.getOriginXcmFeeEstimate()` instead,
|
|
50
|
+
* where `builder` is an instance of `Builder()`.
|
|
51
|
+
* For more details, please refer to the documentation:
|
|
52
|
+
* {@link https://paraspell.github.io/docs/sdk/xcmPallet.html#xcm-fee-origin-and-dest}
|
|
53
|
+
*/
|
|
55
54
|
declare const getOriginFeeDetails: (options: _paraspell_sdk_core.TGetOriginFeeDetailsOptionsBase & {
|
|
56
55
|
api?: TPapiApiOrUrl;
|
|
57
56
|
}) => Promise<_paraspell_sdk_core.TOriginFeeDetails>;
|
|
58
|
-
declare const getMaxNativeTransferableAmount: (options: _paraspell_sdk_core.TGetMaxNativeTransferableAmountOptionsBase & {
|
|
59
|
-
api?: TPapiApiOrUrl;
|
|
60
|
-
}) => Promise<bigint>;
|
|
61
|
-
declare const getMaxForeignTransferableAmount: (options: _paraspell_sdk_core.TGetMaxForeignTransferableAmountOptionsBase & {
|
|
62
|
-
api?: TPapiApiOrUrl;
|
|
63
|
-
}) => Promise<bigint>;
|
|
64
|
-
declare const getTransferableAmount: (options: _paraspell_sdk_core.TGetTransferableAmountOptionsBase & {
|
|
65
|
-
api?: TPapiApiOrUrl;
|
|
66
|
-
}) => Promise<bigint>;
|
|
67
|
-
declare const verifyEdOnDestination: (options: _paraspell_sdk_core.TVerifyEdOnDestinationOptionsBase & {
|
|
68
|
-
api?: TPapiApiOrUrl;
|
|
69
|
-
}) => Promise<boolean>;
|
|
70
57
|
|
|
71
58
|
declare const assets_Foreign: typeof Foreign;
|
|
72
59
|
declare const assets_ForeignAbstract: typeof ForeignAbstract;
|
|
@@ -83,8 +70,6 @@ declare const assets_getAssetsObject: typeof getAssetsObject;
|
|
|
83
70
|
declare const assets_getBalanceForeign: typeof getBalanceForeign;
|
|
84
71
|
declare const assets_getBalanceNative: typeof getBalanceNative;
|
|
85
72
|
declare const assets_getExistentialDeposit: typeof getExistentialDeposit;
|
|
86
|
-
declare const assets_getMaxForeignTransferableAmount: typeof getMaxForeignTransferableAmount;
|
|
87
|
-
declare const assets_getMaxNativeTransferableAmount: typeof getMaxNativeTransferableAmount;
|
|
88
73
|
declare const assets_getNativeAssetSymbol: typeof getNativeAssetSymbol;
|
|
89
74
|
declare const assets_getNativeAssets: typeof getNativeAssets;
|
|
90
75
|
declare const assets_getOriginFeeDetails: typeof getOriginFeeDetails;
|
|
@@ -92,11 +77,8 @@ declare const assets_getOtherAssets: typeof getOtherAssets;
|
|
|
92
77
|
declare const assets_getRelayChainSymbol: typeof getRelayChainSymbol;
|
|
93
78
|
declare const assets_getSupportedAssets: typeof getSupportedAssets;
|
|
94
79
|
declare const assets_getTNode: typeof getTNode;
|
|
95
|
-
declare const assets_getTransferInfo: typeof getTransferInfo;
|
|
96
|
-
declare const assets_getTransferableAmount: typeof getTransferableAmount;
|
|
97
80
|
declare const assets_hasSupportForAsset: typeof hasSupportForAsset;
|
|
98
81
|
declare const assets_isNodeEvm: typeof isNodeEvm;
|
|
99
|
-
declare const assets_verifyEdOnDestination: typeof verifyEdOnDestination;
|
|
100
82
|
declare namespace assets {
|
|
101
83
|
export {
|
|
102
84
|
assets_Foreign as Foreign,
|
|
@@ -114,8 +96,6 @@ declare namespace assets {
|
|
|
114
96
|
assets_getBalanceForeign as getBalanceForeign,
|
|
115
97
|
assets_getBalanceNative as getBalanceNative,
|
|
116
98
|
assets_getExistentialDeposit as getExistentialDeposit,
|
|
117
|
-
assets_getMaxForeignTransferableAmount as getMaxForeignTransferableAmount,
|
|
118
|
-
assets_getMaxNativeTransferableAmount as getMaxNativeTransferableAmount,
|
|
119
99
|
assets_getNativeAssetSymbol as getNativeAssetSymbol,
|
|
120
100
|
assets_getNativeAssets as getNativeAssets,
|
|
121
101
|
assets_getOriginFeeDetails as getOriginFeeDetails,
|
|
@@ -123,11 +103,8 @@ declare namespace assets {
|
|
|
123
103
|
assets_getRelayChainSymbol as getRelayChainSymbol,
|
|
124
104
|
assets_getSupportedAssets as getSupportedAssets,
|
|
125
105
|
assets_getTNode as getTNode,
|
|
126
|
-
assets_getTransferInfo as getTransferInfo,
|
|
127
|
-
assets_getTransferableAmount as getTransferableAmount,
|
|
128
106
|
assets_hasSupportForAsset as hasSupportForAsset,
|
|
129
107
|
assets_isNodeEvm as isNodeEvm,
|
|
130
|
-
assets_verifyEdOnDestination as verifyEdOnDestination,
|
|
131
108
|
};
|
|
132
109
|
}
|
|
133
110
|
|
|
@@ -226,12 +203,9 @@ declare const getParaEthTransferFees: (ahApi?: TPapiApiOrUrl) => Promise<[bigint
|
|
|
226
203
|
* Gets the Ethereum bridge status.
|
|
227
204
|
*/
|
|
228
205
|
declare const getBridgeStatus: (ahApi?: TPapiApiOrUrl) => Promise<_paraspell_sdk_core.TBridgeStatus>;
|
|
229
|
-
declare const
|
|
206
|
+
declare const getOriginXcmFee: (options: _paraspell_sdk_core.TGetOriginXcmFeeBaseOptions<TPapiTransaction> & {
|
|
230
207
|
api?: TPapiApiOrUrl;
|
|
231
|
-
}) => Promise<{
|
|
232
|
-
fee?: bigint;
|
|
233
|
-
feeType?: _paraspell_sdk_core.TFeeType;
|
|
234
|
-
dryRunError?: string;
|
|
208
|
+
}) => Promise<_paraspell_sdk_core.TXcmFeeDetail & {
|
|
235
209
|
forwardedXcms?: any;
|
|
236
210
|
destParaId?: number;
|
|
237
211
|
}>;
|
|
@@ -239,7 +213,7 @@ declare const getFeeForOriginNode: (options: _paraspell_sdk_core.TGetFeeForOrigi
|
|
|
239
213
|
declare const transfer_dryRun: typeof dryRun;
|
|
240
214
|
declare const transfer_dryRunOrigin: typeof dryRunOrigin;
|
|
241
215
|
declare const transfer_getBridgeStatus: typeof getBridgeStatus;
|
|
242
|
-
declare const
|
|
216
|
+
declare const transfer_getOriginXcmFee: typeof getOriginXcmFee;
|
|
243
217
|
declare const transfer_getParaEthTransferFees: typeof getParaEthTransferFees;
|
|
244
218
|
declare const transfer_send: typeof send;
|
|
245
219
|
declare namespace transfer {
|
|
@@ -247,7 +221,7 @@ declare namespace transfer {
|
|
|
247
221
|
transfer_dryRun as dryRun,
|
|
248
222
|
transfer_dryRunOrigin as dryRunOrigin,
|
|
249
223
|
transfer_getBridgeStatus as getBridgeStatus,
|
|
250
|
-
|
|
224
|
+
transfer_getOriginXcmFee as getOriginXcmFee,
|
|
251
225
|
transfer_getParaEthTransferFees as getParaEthTransferFees,
|
|
252
226
|
transfer_send as send,
|
|
253
227
|
};
|
|
@@ -255,5 +229,5 @@ declare namespace transfer {
|
|
|
255
229
|
|
|
256
230
|
declare const createApiInstanceForNode: (node: TNodeDotKsmWithRelayChains) => Promise<polkadot_api.PolkadotClient>;
|
|
257
231
|
|
|
258
|
-
export { Builder, EvmBuilder, assets, claimAssets, convertSs58, createApiInstanceForNode, dryRun, dryRunOrigin, getAssetBalance, getBalanceForeign, getBalanceNative, getBridgeStatus,
|
|
232
|
+
export { Builder, EvmBuilder, assets, claimAssets, convertSs58, createApiInstanceForNode, dryRun, dryRunOrigin, getAssetBalance, getBalanceForeign, getBalanceNative, getBridgeStatus, getOriginFeeDetails, getOriginXcmFee, getParaEthTransferFees, send, transfer as xcmPallet };
|
|
259
233
|
export type { GeneralBuilder, TEvmNodeFromPapi, TPapiApi, TPapiApiOrUrl, TPapiTransaction };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InvalidParameterError, BatchMode, getNodeProviders, createApiInstanceForNode as createApiInstanceForNode$1, NodeNotSupportedError, Parents, Version, getNode, isForeignAsset, computeFeeFromDryRun, getAssetsObject, getBalanceNative as getBalanceNative$1, getBalanceForeign as getBalanceForeign$1,
|
|
1
|
+
import { InvalidParameterError, BatchMode, getNodeProviders, createApiInstanceForNode as createApiInstanceForNode$1, NodeNotSupportedError, Parents, Version, getNode, isForeignAsset, computeFeeFromDryRun, getAssetsObject, 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, transferMoonbeamEvm, validateAddress, transferMoonbeamToEth, Builder as Builder$1, getParaEthTransferFees as getParaEthTransferFees$1, getBridgeStatus as getBridgeStatus$1, send as send$1, dryRun as dryRun$1, dryRunOrigin as dryRunOrigin$1, getOriginXcmFee as getOriginXcmFee$1 } from '@paraspell/sdk-core';
|
|
2
2
|
export * from '@paraspell/sdk-core';
|
|
3
3
|
import { blake2b } from '@noble/hashes/blake2';
|
|
4
4
|
import { bytesToHex } from '@noble/hashes/utils';
|
|
@@ -1685,12 +1685,6 @@ var getBalanceNative = createPapiApiCall(getBalanceNative$1);
|
|
|
1685
1685
|
* @returns The balance of the foreign asset as a bigint, or null if not found.
|
|
1686
1686
|
*/
|
|
1687
1687
|
var getBalanceForeign = createPapiApiCall(getBalanceForeign$1);
|
|
1688
|
-
/**
|
|
1689
|
-
* Retrieves detailed transfer information for a cross-chain transfer.
|
|
1690
|
-
*
|
|
1691
|
-
* @returns A Promise that resolves to the transfer information.
|
|
1692
|
-
*/
|
|
1693
|
-
var getTransferInfo = createPapiApiCall(getTransferInfo$1);
|
|
1694
1688
|
/**
|
|
1695
1689
|
* Retrieves the asset balance for a given account on a specified node.
|
|
1696
1690
|
*
|
|
@@ -1703,11 +1697,14 @@ var getAssetBalance = createPapiApiCall(getAssetBalance$1);
|
|
|
1703
1697
|
* @returns An extrinsic representing the claim transaction.
|
|
1704
1698
|
*/
|
|
1705
1699
|
var claimAssets = createPapiApiCall(claimAssets$1);
|
|
1700
|
+
/**
|
|
1701
|
+
* @deprecated This function is deprecated and will be removed in a future version.
|
|
1702
|
+
* Please use `builder.getOriginXcmFee()` or `builder.getOriginXcmFeeEstimate()` instead,
|
|
1703
|
+
* where `builder` is an instance of `Builder()`.
|
|
1704
|
+
* For more details, please refer to the documentation:
|
|
1705
|
+
* {@link https://paraspell.github.io/docs/sdk/xcmPallet.html#xcm-fee-origin-and-dest}
|
|
1706
|
+
*/
|
|
1706
1707
|
var getOriginFeeDetails = createPapiApiCall(getOriginFeeDetails$1);
|
|
1707
|
-
var getMaxNativeTransferableAmount = createPapiApiCall(getMaxNativeTransferableAmount$1);
|
|
1708
|
-
var getMaxForeignTransferableAmount = createPapiApiCall(getMaxForeignTransferableAmount$1);
|
|
1709
|
-
var getTransferableAmount = createPapiApiCall(getTransferableAmount$1);
|
|
1710
|
-
var verifyEdOnDestination = createPapiApiCall(verifyEdOnDestination$1);
|
|
1711
1708
|
|
|
1712
1709
|
var assets = /*#__PURE__*/Object.freeze({
|
|
1713
1710
|
__proto__: null,
|
|
@@ -1726,8 +1723,6 @@ var assets = /*#__PURE__*/Object.freeze({
|
|
|
1726
1723
|
getBalanceForeign: getBalanceForeign,
|
|
1727
1724
|
getBalanceNative: getBalanceNative,
|
|
1728
1725
|
getExistentialDeposit: getExistentialDeposit,
|
|
1729
|
-
getMaxForeignTransferableAmount: getMaxForeignTransferableAmount,
|
|
1730
|
-
getMaxNativeTransferableAmount: getMaxNativeTransferableAmount,
|
|
1731
1726
|
getNativeAssetSymbol: getNativeAssetSymbol,
|
|
1732
1727
|
getNativeAssets: getNativeAssets,
|
|
1733
1728
|
getOriginFeeDetails: getOriginFeeDetails,
|
|
@@ -1735,11 +1730,8 @@ var assets = /*#__PURE__*/Object.freeze({
|
|
|
1735
1730
|
getRelayChainSymbol: getRelayChainSymbol,
|
|
1736
1731
|
getSupportedAssets: getSupportedAssets,
|
|
1737
1732
|
getTNode: getTNode,
|
|
1738
|
-
getTransferInfo: getTransferInfo,
|
|
1739
|
-
getTransferableAmount: getTransferableAmount,
|
|
1740
1733
|
hasSupportForAsset: hasSupportForAsset,
|
|
1741
|
-
isNodeEvm: isNodeEvm
|
|
1742
|
-
verifyEdOnDestination: verifyEdOnDestination
|
|
1734
|
+
isNodeEvm: isNodeEvm
|
|
1743
1735
|
});
|
|
1744
1736
|
|
|
1745
1737
|
var convertSs58 = function convertSs58(address, node) {
|
|
@@ -1942,16 +1934,16 @@ var getBridgeStatus = /*#__PURE__*/function () {
|
|
|
1942
1934
|
return _ref2.apply(this, arguments);
|
|
1943
1935
|
};
|
|
1944
1936
|
}();
|
|
1945
|
-
var
|
|
1937
|
+
var getOriginXcmFee = createPapiApiCall(getOriginXcmFee$1);
|
|
1946
1938
|
|
|
1947
1939
|
var transfer = /*#__PURE__*/Object.freeze({
|
|
1948
1940
|
__proto__: null,
|
|
1949
1941
|
dryRun: dryRun,
|
|
1950
1942
|
dryRunOrigin: dryRunOrigin,
|
|
1951
1943
|
getBridgeStatus: getBridgeStatus,
|
|
1952
|
-
|
|
1944
|
+
getOriginXcmFee: getOriginXcmFee,
|
|
1953
1945
|
getParaEthTransferFees: getParaEthTransferFees,
|
|
1954
1946
|
send: send
|
|
1955
1947
|
});
|
|
1956
1948
|
|
|
1957
|
-
export { Builder, EvmBuilder, assets, claimAssets, convertSs58, createApiInstanceForNode, dryRun, dryRunOrigin, getAssetBalance, getBalanceForeign, getBalanceNative, getBridgeStatus,
|
|
1949
|
+
export { Builder, EvmBuilder, assets, claimAssets, convertSs58, createApiInstanceForNode, dryRun, dryRunOrigin, getAssetBalance, getBalanceForeign, getBalanceNative, getBridgeStatus, getOriginFeeDetails, getOriginXcmFee, getParaEthTransferFees, send, transfer as xcmPallet };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"description": "SDK for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"ethers": "^6.13.7",
|
|
28
28
|
"quick-lru": "^7.0.1",
|
|
29
29
|
"viem": "^2.28.1",
|
|
30
|
-
"@paraspell/sdk-core": "
|
|
30
|
+
"@paraspell/sdk-core": "10.0.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"polkadot-api": ">= 1.10.2 < 2"
|