@paraspell/sdk-pjs 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 +109 -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,7 +251,7 @@ 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*/)
|
|
@@ -263,76 +262,113 @@ const result = await Builder(API /*optional*/)
|
|
|
263
262
|
.senderAddress(SENDER_ADDRESS)
|
|
264
263
|
.dryRun()
|
|
265
264
|
|
|
266
|
-
//Function pattern
|
|
267
|
-
await getDryRun({api /*optional*/, node, address /*sender address*/, tx /* Extrinsic object */})
|
|
268
|
-
|
|
269
265
|
//Check Parachain for DryRun support - returns true/false
|
|
270
266
|
import { hasDryRunSupport } from "@paraspell/sdk-pjs";
|
|
271
267
|
|
|
272
268
|
const result = hasDryRunSupport(node)
|
|
273
269
|
```
|
|
274
270
|
|
|
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).
|
|
271
|
+
### XCM Fee queries
|
|
277
272
|
|
|
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).
|
|
273
|
+
For full documentation with examples on this feature head over to [official documentation](https://paraspell.github.io/docs/sdk/xcmUtils.html).
|
|
280
274
|
|
|
275
|
+
#### XCM Transfer info
|
|
276
|
+
```ts
|
|
277
|
+
const info = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
278
|
+
.from(ORIGIN_CHAIN)
|
|
279
|
+
.to(DESTINATION_CHAIN)
|
|
280
|
+
.currency(CURRENCY)
|
|
281
|
+
.address(RECIPIENT_ADDRESS)
|
|
282
|
+
.senderAddress(SENDER_ADDRESS)
|
|
283
|
+
.getTransferInfo()
|
|
281
284
|
```
|
|
282
|
-
|
|
285
|
+
|
|
286
|
+
#### Transferable amount
|
|
287
|
+
```ts
|
|
288
|
+
const transferable = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
289
|
+
.from(ORIGIN_CHAIN)
|
|
290
|
+
.to(DESTINATION_CHAIN)
|
|
291
|
+
.currency(CURRENCY)
|
|
292
|
+
.address(RECIPIENT_ADDRESS)
|
|
293
|
+
.senderAddress(SENDER_ADDRESS)
|
|
294
|
+
.getTransferableAmount()
|
|
283
295
|
```
|
|
284
296
|
|
|
297
|
+
#### Verify ED on destination
|
|
285
298
|
```ts
|
|
286
|
-
const
|
|
299
|
+
const ed = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
287
300
|
.from(ORIGIN_CHAIN)
|
|
288
301
|
.to(DESTINATION_CHAIN)
|
|
289
302
|
.currency(CURRENCY)
|
|
290
303
|
.address(RECIPIENT_ADDRESS)
|
|
291
304
|
.senderAddress(SENDER_ADDRESS)
|
|
292
|
-
.
|
|
305
|
+
.verifyEdOnDestination()
|
|
293
306
|
```
|
|
294
307
|
|
|
295
|
-
####
|
|
296
|
-
This query is designed to retrieve you approximate fee and doesn't require any token balance.
|
|
308
|
+
#### XCM Fee (Origin and Dest.)
|
|
297
309
|
|
|
298
|
-
|
|
299
|
-
|
|
310
|
+
##### More accurate query using DryRun
|
|
311
|
+
```ts
|
|
312
|
+
const fee = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
313
|
+
.from(ORIGIN_CHAIN)
|
|
314
|
+
.to(DESTINATION_CHAIN)
|
|
315
|
+
.currency(CURRENCY)
|
|
316
|
+
.address(RECIPIENT_ADDRESS)
|
|
317
|
+
.senderAddress(SENDER_ADDRESS)
|
|
318
|
+
.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
319
|
```
|
|
301
320
|
|
|
321
|
+
##### Less accurate query using Payment info
|
|
302
322
|
```ts
|
|
303
323
|
const fee = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
304
324
|
.from(ORIGIN_CHAIN)
|
|
305
325
|
.to(DESTINATION_CHAIN)
|
|
306
326
|
.currency(CURRENCY)
|
|
307
327
|
.address(RECIPIENT_ADDRESS)
|
|
308
|
-
.senderAddress(SENDER_ADDRESS)
|
|
328
|
+
.senderAddress(SENDER_ADDRESS)
|
|
309
329
|
.getXcmFeeEstimate()
|
|
310
330
|
```
|
|
311
331
|
|
|
312
|
-
|
|
313
|
-
```ts
|
|
314
|
-
import { getAssetBalance, getTransferInfo, getOriginFeeDetails, getTransferableAmount, getParaEthTransferFees, verifyEdOnDestination } from "@paraspell/sdk-pjs";
|
|
332
|
+
#### XCM Fee (Origin only)
|
|
315
333
|
|
|
316
|
-
|
|
317
|
-
|
|
334
|
+
##### More accurate query using DryRun
|
|
335
|
+
```ts
|
|
336
|
+
const fee = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
337
|
+
.from(ORIGIN_CHAIN)
|
|
338
|
+
.to(DESTINATION_CHAIN)
|
|
339
|
+
.currency(CURRENCY)
|
|
340
|
+
.address(RECIPIENT_ADDRESS)
|
|
341
|
+
.senderAddress(SENDER_ADDRESS)
|
|
342
|
+
.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.
|
|
343
|
+
```
|
|
318
344
|
|
|
319
|
-
|
|
320
|
-
|
|
345
|
+
##### Less accurate query using Payment info
|
|
346
|
+
```ts
|
|
347
|
+
const fee = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
348
|
+
.from(ORIGIN_CHAIN)
|
|
349
|
+
.to(DESTINATION_CHAIN)
|
|
350
|
+
.currency(CURRENCY)
|
|
351
|
+
.address(RECIPIENT_ADDRESS)
|
|
352
|
+
.senderAddress(SENDER_ADDRESS)
|
|
353
|
+
.getOriginXcmFeeEstimate()
|
|
354
|
+
```
|
|
321
355
|
|
|
322
|
-
|
|
323
|
-
|
|
356
|
+
#### Asset balance
|
|
357
|
+
```ts
|
|
358
|
+
import { getAssetBalance } from "@paraspell/sdk-pjs";
|
|
324
359
|
|
|
325
|
-
//
|
|
326
|
-
await
|
|
360
|
+
//Retrieves the asset balance for a given account on a specified node (You do not need to specify if it is native or foreign).
|
|
361
|
+
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 */});
|
|
362
|
+
```
|
|
327
363
|
|
|
328
|
-
|
|
329
|
-
|
|
364
|
+
#### Ethereum bridge fees
|
|
365
|
+
```ts
|
|
366
|
+
import { getParaEthTransferFees } from "@paraspell/sdk-pjs";
|
|
330
367
|
|
|
331
|
-
|
|
332
|
-
await verifyEdOnDestination(node, currency: {symbol: || id: || multilocation: .. ,amount: 100000n}, address)
|
|
368
|
+
const fees = await getParaEthTransferFees(/*api - optional (Can also be WS port string or array o WS ports. Must be AssetHubPolkadot WS!)*/)
|
|
333
369
|
```
|
|
334
370
|
|
|
335
|
-
|
|
371
|
+
#### Existential deposit queries
|
|
336
372
|
```ts
|
|
337
373
|
import { getExistentialDeposit } from "@paraspell/sdk-pjs";
|
|
338
374
|
|
|
@@ -341,7 +377,7 @@ import { getExistentialDeposit } from "@paraspell/sdk-pjs";
|
|
|
341
377
|
const ed = getExistentialDeposit(node, currency?)
|
|
342
378
|
```
|
|
343
379
|
|
|
344
|
-
|
|
380
|
+
#### Convert SS58 address
|
|
345
381
|
```ts
|
|
346
382
|
import { convertSs58 } from "@paraspell/sdk-pjs";
|
|
347
383
|
|
|
@@ -350,61 +386,66 @@ let result = convertSs58(address, node) // returns converted address in string
|
|
|
350
386
|
|
|
351
387
|
### Asset queries:
|
|
352
388
|
|
|
389
|
+
For full documentation with examples on this feature head over to [official documentation](https://paraspell.github.io/docs/sdk/AssetPallet.html).
|
|
390
|
+
|
|
353
391
|
```ts
|
|
354
392
|
import { getFeeAssets, getAssetsObject, getAssetId, getRelayChainSymbol, getNativeAssets, getNativeAssets, getOtherAssets, getAllAssetsSymbols, hasSupportForAsset, getAssetDecimals, getParaId, getTNode, getAssetMultiLocation, NODE_NAMES } from '@paraspell/sdk-pjs'
|
|
355
393
|
|
|
356
394
|
// Retrieve Fee asset queries (Assets accepted as XCM Fee on specific node)
|
|
357
|
-
getFeeAssets(
|
|
395
|
+
getFeeAssets(NODE)
|
|
396
|
+
|
|
397
|
+
// Get multilocation for asset id or symbol on specific chain
|
|
398
|
+
getAssetMultiLocation(NODE, { symbol: symbol } | { id: assetId })
|
|
358
399
|
|
|
359
400
|
// Retrieve assets object from assets.json for particular node including information about native and foreign assets
|
|
360
|
-
getAssetsObject(
|
|
401
|
+
getAssetsObject(NODE)
|
|
361
402
|
|
|
362
403
|
// Retrieve foreign assetId for a particular node and asset symbol
|
|
363
|
-
getAssetId(
|
|
404
|
+
getAssetId(NODE, ASSET_SYMBOL)
|
|
364
405
|
|
|
365
406
|
// Retrieve the symbol of the relay chain for a particular node. Either "DOT" or "KSM"
|
|
366
|
-
getRelayChainSymbol(
|
|
407
|
+
getRelayChainSymbol(NODE)
|
|
367
408
|
|
|
368
409
|
// Retrieve string array of native assets symbols for particular node
|
|
369
|
-
getNativeAssets(
|
|
410
|
+
getNativeAssets(NODE)
|
|
370
411
|
|
|
371
412
|
// Retrieve object array of foreign assets for a particular node. Each object has a symbol and assetId property
|
|
372
|
-
getOtherAssets(
|
|
413
|
+
getOtherAssets(NODE)
|
|
373
414
|
|
|
374
415
|
// Retrieve string array of all assets symbols. (native and foreign assets are merged into a single array)
|
|
375
|
-
getAllAssetsSymbols(
|
|
416
|
+
getAllAssetsSymbols(NODE)
|
|
376
417
|
|
|
377
418
|
// Check if a node supports a particular asset. (Both native and foreign assets are searched). Returns boolean
|
|
378
|
-
hasSupportForAsset(
|
|
419
|
+
hasSupportForAsset(NODE, ASSET_SYMBOL)
|
|
379
420
|
|
|
380
421
|
// Get decimals for specific asset
|
|
381
|
-
getAssetDecimals(
|
|
422
|
+
getAssetDecimals(NODE, ASSET_SYMBOL)
|
|
382
423
|
|
|
383
424
|
// Get specific node id
|
|
384
|
-
getParaId(
|
|
425
|
+
getParaId(NODE)
|
|
385
426
|
|
|
386
427
|
// Get specific TNode from nodeID
|
|
387
|
-
getTNode(
|
|
428
|
+
getTNode(paraID: number, ecosystem: 'polkadot' || 'kusama' || 'ethereum') //When Ethereum ecosystem is selected please fill nodeID as 1 to select Ethereum.
|
|
388
429
|
|
|
389
430
|
// Import all compatible nodes as constant
|
|
390
431
|
NODE_NAMES
|
|
391
|
-
|
|
392
|
-
// Get multilocation for asset id or symbol on specific chain
|
|
393
|
-
getAssetMultiLocation(chainFrom, { symbol: symbol } | { id: assetId })
|
|
394
432
|
```
|
|
395
433
|
|
|
396
434
|
### Parachain XCM Pallet queries
|
|
435
|
+
|
|
436
|
+
For full documentation with examples on this feature head over to [official documentation](https://paraspell.github.io/docs/sdk/NodePallets.html).
|
|
437
|
+
|
|
397
438
|
```ts
|
|
398
439
|
import { getDefaultPallet, getSupportedPallets, getPalletIndex SUPPORTED_PALLETS } from '@paraspell/sdk-pjs';
|
|
399
440
|
|
|
400
441
|
//Retrieve default pallet for specific Parachain
|
|
401
|
-
getDefaultPallet(
|
|
442
|
+
getDefaultPallet(NODE)
|
|
402
443
|
|
|
403
444
|
// Returns an array of supported pallets for a specific Parachain
|
|
404
|
-
getSupportedPallets(
|
|
445
|
+
getSupportedPallets(NODE)
|
|
405
446
|
|
|
406
447
|
//Returns index of XCM Pallet used by Parachain
|
|
407
|
-
getPalletIndex(
|
|
448
|
+
getPalletIndex(NODE)
|
|
408
449
|
|
|
409
450
|
// Print all pallets that are currently supported
|
|
410
451
|
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.0",
|
|
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.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@polkadot/api": ">= 15.0 < 16",
|