@paraspell/sdk 10.4.10 → 10.5.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 CHANGED
@@ -397,7 +397,10 @@ let result = convertSs58(address, node) // returns converted address in string
397
397
  For full documentation with examples on this feature, head over to [official documentation](https://paraspell.github.io/docs/sdk/AssetPallet.html).
398
398
 
399
399
  ```ts
400
- import { getFeeAssets, getAssetsObject, getAssetId, getRelayChainSymbol, getNativeAssets, getNativeAssets, getOtherAssets, getAllAssetsSymbols, hasSupportForAsset, getAssetDecimals, getParaId, getTNode, getAssetMultiLocation, NODE_NAMES } from '@paraspell/sdk'
400
+ import { getSupportedDestinations, getFeeAssets, getAssetsObject, getAssetId, getRelayChainSymbol, getNativeAssets, getNativeAssets, getOtherAssets, getAllAssetsSymbols, hasSupportForAsset, getAssetDecimals, getParaId, getTNode, getAssetMultiLocation, NODE_NAMES } from '@paraspell/sdk'
401
+
402
+ //Get chains that support the specific asset related to origin
403
+ getSupportedDestinations(NODE, CURRENCY)
401
404
 
402
405
  // Retrieve Fee asset queries (Assets accepted as XCM Fee on specific node)
403
406
  getFeeAssets(NODE)
package/dist/index.cjs CHANGED
@@ -1238,11 +1238,11 @@ var PapiApi = /*#__PURE__*/function () {
1238
1238
  value: function () {
1239
1239
  var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(_ref6) {
1240
1240
  var _this = this;
1241
- var tx, address, node, isFeeAsset, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, performDryRunCall, getExecutionSuccessFromResult, extractFailureReasonFromResult, result, isSuccess, failureOutputReason, initialFailureReason, executionFee, fee, actualWeight, weight, forwardedXcms, destParaId;
1241
+ var tx, address, node, asset, feeAsset, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, performDryRunCall, getExecutionSuccessFromResult, extractFailureReasonFromResult, result, isSuccess, failureOutputReason, initialFailureReason, actualWeight, weight, forwardedXcms, destParaId, executionFee, hasMultiLocation, xcmFee, fee;
1242
1242
  return _regenerator().w(function (_context18) {
1243
1243
  while (1) switch (_context18.n) {
1244
1244
  case 0:
1245
- tx = _ref6.tx, address = _ref6.address, node = _ref6.node, isFeeAsset = _ref6.isFeeAsset;
1245
+ tx = _ref6.tx, address = _ref6.address, node = _ref6.node, asset = _ref6.asset, feeAsset = _ref6.feeAsset;
1246
1246
  supportsDryRunApi = sdkCore.getAssetsObject(node).supportsDryRunApi;
1247
1247
  if (supportsDryRunApi) {
1248
1248
  _context18.n = 1;
@@ -1331,11 +1331,6 @@ var PapiApi = /*#__PURE__*/function () {
1331
1331
  failureReason: failureOutputReason
1332
1332
  }));
1333
1333
  case 5:
1334
- _context18.n = 6;
1335
- return this.calculateTransactionFee(tx, address);
1336
- case 6:
1337
- executionFee = _context18.v;
1338
- fee = sdkCore.computeFeeFromDryRun(result, node, executionFee, isFeeAsset);
1339
1334
  actualWeight = result.value.execution_result.value.actual_weight;
1340
1335
  weight = actualWeight ? {
1341
1336
  refTime: actualWeight.ref_time,
@@ -1343,6 +1338,32 @@ var PapiApi = /*#__PURE__*/function () {
1343
1338
  } : undefined;
1344
1339
  forwardedXcms = result.value.forwarded_xcms.length > 0 ? result.value.forwarded_xcms[0] : [];
1345
1340
  destParaId = forwardedXcms.length === 0 ? undefined : forwardedXcms[0].value.interior.type === 'Here' ? 0 : forwardedXcms[0].value.interior.value.value;
1341
+ _context18.n = 6;
1342
+ return this.calculateTransactionFee(tx, address);
1343
+ case 6:
1344
+ executionFee = _context18.v;
1345
+ hasMultiLocation = feeAsset ? Boolean(feeAsset.multiLocation) : Boolean(asset === null || asset === void 0 ? void 0 : asset.multiLocation);
1346
+ if (!(sdkCore.hasXcmPaymentApiSupport(node) && result.value.local_xcm && hasMultiLocation)) {
1347
+ _context18.n = 8;
1348
+ break;
1349
+ }
1350
+ _context18.n = 7;
1351
+ return this.getXcmPaymentApiFee(result.value.local_xcm, feeAsset !== null && feeAsset !== void 0 ? feeAsset : asset);
1352
+ case 7:
1353
+ xcmFee = _context18.v;
1354
+ if (!(typeof xcmFee === 'bigint')) {
1355
+ _context18.n = 8;
1356
+ break;
1357
+ }
1358
+ return _context18.a(2, Promise.resolve({
1359
+ success: true,
1360
+ fee: xcmFee,
1361
+ weight: weight,
1362
+ forwardedXcms: forwardedXcms,
1363
+ destParaId: destParaId
1364
+ }));
1365
+ case 8:
1366
+ fee = sdkCore.computeFeeFromDryRun(result, node, executionFee, !!feeAsset);
1346
1367
  return _context18.a(2, Promise.resolve({
1347
1368
  success: true,
1348
1369
  fee: fee,
@@ -1458,7 +1479,7 @@ var PapiApi = /*#__PURE__*/function () {
1458
1479
  } : undefined;
1459
1480
  forwardedXcms = result.value.forwarded_xcms.length > 0 ? result.value.forwarded_xcms[0] : [];
1460
1481
  destParaId = forwardedXcms.length === 0 ? undefined : forwardedXcms[0].value.interior.type === 'Here' ? 0 : forwardedXcms[0].value.interior.value.value;
1461
- if (!(node === 'Moonbeam' || node === 'Moonriver')) {
1482
+ if (!(sdkCore.hasXcmPaymentApiSupport(node) && asset)) {
1462
1483
  _context21.n = 5;
1463
1484
  break;
1464
1485
  }
@@ -1466,6 +1487,10 @@ var PapiApi = /*#__PURE__*/function () {
1466
1487
  return this.getXcmPaymentApiFee(xcm, asset);
1467
1488
  case 4:
1468
1489
  _fee = _context21.v;
1490
+ if (!(typeof _fee === 'bigint')) {
1491
+ _context21.n = 5;
1492
+ break;
1493
+ }
1469
1494
  return _context21.a(2, {
1470
1495
  success: true,
1471
1496
  fee: _fee,
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, normalizeMultiLocation, InvalidCurrencyError, isAssetEqual, 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';
1
+ import { InvalidParameterError, BatchMode, getNodeProviders, createApiInstanceForNode as createApiInstanceForNode$1, NodeNotSupportedError, Parents, Version, getNode, isForeignAsset, computeFeeFromDryRun, hasXcmPaymentApiSupport, getAssetsObject, normalizeMultiLocation, InvalidCurrencyError, isAssetEqual, 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';
@@ -1237,11 +1237,11 @@ var PapiApi = /*#__PURE__*/function () {
1237
1237
  value: function () {
1238
1238
  var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(_ref6) {
1239
1239
  var _this = this;
1240
- var tx, address, node, isFeeAsset, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, performDryRunCall, getExecutionSuccessFromResult, extractFailureReasonFromResult, result, isSuccess, failureOutputReason, initialFailureReason, executionFee, fee, actualWeight, weight, forwardedXcms, destParaId;
1240
+ var tx, address, node, asset, feeAsset, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, performDryRunCall, getExecutionSuccessFromResult, extractFailureReasonFromResult, result, isSuccess, failureOutputReason, initialFailureReason, actualWeight, weight, forwardedXcms, destParaId, executionFee, hasMultiLocation, xcmFee, fee;
1241
1241
  return _regenerator().w(function (_context18) {
1242
1242
  while (1) switch (_context18.n) {
1243
1243
  case 0:
1244
- tx = _ref6.tx, address = _ref6.address, node = _ref6.node, isFeeAsset = _ref6.isFeeAsset;
1244
+ tx = _ref6.tx, address = _ref6.address, node = _ref6.node, asset = _ref6.asset, feeAsset = _ref6.feeAsset;
1245
1245
  supportsDryRunApi = getAssetsObject(node).supportsDryRunApi;
1246
1246
  if (supportsDryRunApi) {
1247
1247
  _context18.n = 1;
@@ -1330,11 +1330,6 @@ var PapiApi = /*#__PURE__*/function () {
1330
1330
  failureReason: failureOutputReason
1331
1331
  }));
1332
1332
  case 5:
1333
- _context18.n = 6;
1334
- return this.calculateTransactionFee(tx, address);
1335
- case 6:
1336
- executionFee = _context18.v;
1337
- fee = computeFeeFromDryRun(result, node, executionFee, isFeeAsset);
1338
1333
  actualWeight = result.value.execution_result.value.actual_weight;
1339
1334
  weight = actualWeight ? {
1340
1335
  refTime: actualWeight.ref_time,
@@ -1342,6 +1337,32 @@ var PapiApi = /*#__PURE__*/function () {
1342
1337
  } : undefined;
1343
1338
  forwardedXcms = result.value.forwarded_xcms.length > 0 ? result.value.forwarded_xcms[0] : [];
1344
1339
  destParaId = forwardedXcms.length === 0 ? undefined : forwardedXcms[0].value.interior.type === 'Here' ? 0 : forwardedXcms[0].value.interior.value.value;
1340
+ _context18.n = 6;
1341
+ return this.calculateTransactionFee(tx, address);
1342
+ case 6:
1343
+ executionFee = _context18.v;
1344
+ hasMultiLocation = feeAsset ? Boolean(feeAsset.multiLocation) : Boolean(asset === null || asset === void 0 ? void 0 : asset.multiLocation);
1345
+ if (!(hasXcmPaymentApiSupport(node) && result.value.local_xcm && hasMultiLocation)) {
1346
+ _context18.n = 8;
1347
+ break;
1348
+ }
1349
+ _context18.n = 7;
1350
+ return this.getXcmPaymentApiFee(result.value.local_xcm, feeAsset !== null && feeAsset !== void 0 ? feeAsset : asset);
1351
+ case 7:
1352
+ xcmFee = _context18.v;
1353
+ if (!(typeof xcmFee === 'bigint')) {
1354
+ _context18.n = 8;
1355
+ break;
1356
+ }
1357
+ return _context18.a(2, Promise.resolve({
1358
+ success: true,
1359
+ fee: xcmFee,
1360
+ weight: weight,
1361
+ forwardedXcms: forwardedXcms,
1362
+ destParaId: destParaId
1363
+ }));
1364
+ case 8:
1365
+ fee = computeFeeFromDryRun(result, node, executionFee, !!feeAsset);
1345
1366
  return _context18.a(2, Promise.resolve({
1346
1367
  success: true,
1347
1368
  fee: fee,
@@ -1457,7 +1478,7 @@ var PapiApi = /*#__PURE__*/function () {
1457
1478
  } : undefined;
1458
1479
  forwardedXcms = result.value.forwarded_xcms.length > 0 ? result.value.forwarded_xcms[0] : [];
1459
1480
  destParaId = forwardedXcms.length === 0 ? undefined : forwardedXcms[0].value.interior.type === 'Here' ? 0 : forwardedXcms[0].value.interior.value.value;
1460
- if (!(node === 'Moonbeam' || node === 'Moonriver')) {
1481
+ if (!(hasXcmPaymentApiSupport(node) && asset)) {
1461
1482
  _context21.n = 5;
1462
1483
  break;
1463
1484
  }
@@ -1465,6 +1486,10 @@ var PapiApi = /*#__PURE__*/function () {
1465
1486
  return this.getXcmPaymentApiFee(xcm, asset);
1466
1487
  case 4:
1467
1488
  _fee = _context21.v;
1489
+ if (!(typeof _fee === 'bigint')) {
1490
+ _context21.n = 5;
1491
+ break;
1492
+ }
1468
1493
  return _context21.a(2, {
1469
1494
  success: true,
1470
1495
  fee: _fee,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk",
3
- "version": "10.4.10",
3
+ "version": "10.5.1",
4
4
  "description": "SDK for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,7 +25,7 @@
25
25
  "dependencies": {
26
26
  "@noble/hashes": "^1.8.0",
27
27
  "viem": "^2.30.5",
28
- "@paraspell/sdk-core": "10.4.10"
28
+ "@paraspell/sdk-core": "10.5.1"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "polkadot-api": ">= 1.13.0 < 2"