@paraspell/sdk 14.5.3 → 14.6.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.
Files changed (2) hide show
  1. package/dist/index.mjs +13 -23
  2. package/package.json +9 -9
package/dist/index.mjs CHANGED
@@ -369,15 +369,12 @@ var getLocationTokenId = function getLocationTokenId(location, chain) {
369
369
  };
370
370
 
371
371
  var computeOriginFee = function computeOriginFee(dryRun, chain, executionFee) {
372
- var isFeeAsset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
373
372
  // Extract delivery fees from emitted events
374
373
  var deliveryFees = [];
375
- var assetConversionFee = 0n;
376
374
  var _iterator = _createForOfIteratorHelper(dryRun.value.emitted_events),
377
375
  _step;
378
376
  try {
379
377
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
380
- var _e$value, _e$value2;
381
378
  var e = _step.value;
382
379
  var isXcmEvent = e.type === 'XcmPallet' || e.type === 'PolkadotXcm' || e.type === 'CumulusXcm';
383
380
  var isFeesPaid = e.value.type === 'FeesPaid';
@@ -402,26 +399,19 @@ var computeOriginFee = function computeOriginFee(dryRun, chain, executionFee) {
402
399
  _iterator2.f();
403
400
  }
404
401
  }
405
- if (isFeeAsset && e.type === 'AssetConversion' && ((_e$value = e.value) === null || _e$value === void 0 ? void 0 : _e$value.type) === 'SwapCreditExecuted' && (_e$value2 = e.value) !== null && _e$value2 !== void 0 && _e$value2.value && e.value.value.amount_in !== undefined && e.value.value.amount_in !== null) {
406
- assetConversionFee += e.value.value.amount_in;
407
- }
408
402
  }
409
403
  } catch (err) {
410
404
  _iterator.e(err);
411
405
  } finally {
412
406
  _iterator.f();
413
407
  }
414
- if (isFeeAsset && assetConversionFee > 0n) {
415
- return assetConversionFee;
416
- } else {
417
- var nativeAssetSymbol = getNativeAssetSymbol(chain);
418
- var totalDeliveryFees = deliveryFees.filter(function (df) {
419
- return df.tokenSymbol === nativeAssetSymbol;
420
- }).reduce(function (acc, df) {
421
- return acc + df.plancks;
422
- }, 0n);
423
- return totalDeliveryFees + executionFee;
424
- }
408
+ var nativeAssetSymbol = getNativeAssetSymbol(chain);
409
+ var totalDeliveryFees = deliveryFees.filter(function (df) {
410
+ return df.tokenSymbol === nativeAssetSymbol;
411
+ }).reduce(function (acc, df) {
412
+ return acc + df.plancks;
413
+ }, 0n);
414
+ return totalDeliveryFees + executionFee;
425
415
  };
426
416
 
427
417
  var signEcdsa = function signEcdsa(input, privateKey) {
@@ -1409,7 +1399,7 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1409
1399
  case 18:
1410
1400
  _yield$this$getPaymen = _context10.v;
1411
1401
  executionFee = _yield$this$getPaymen.partialFee;
1412
- fee = computeOriginFee(result, chain, executionFee, !!feeAsset);
1402
+ fee = computeOriginFee(result, chain, executionFee);
1413
1403
  return _context10.a(2, Promise.resolve({
1414
1404
  success: true,
1415
1405
  fee: fee,
@@ -1718,7 +1708,7 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1718
1708
  } : undefined;
1719
1709
  forwardedXcms = result.value.forwarded_xcms.length > 0 ? result.value.forwarded_xcms[0] : [];
1720
1710
  destParaId = extractDestParaId(forwardedXcms);
1721
- if (!(this.hasXcmPaymentApiSupport(chain) && asset)) {
1711
+ if (!this.hasXcmPaymentApiSupport(chain)) {
1722
1712
  _context16.n = 5;
1723
1713
  break;
1724
1714
  }
@@ -1738,13 +1728,13 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1738
1728
  emitted = result.value.emitted_events; // We want to look for the last event
1739
1729
  reversedEvents = _toConsumableArray(emitted).reverse();
1740
1730
  palletsWithIssued = ['Balances', 'ForeignAssets', 'Assets'];
1741
- isFeeAsset = origin === 'AssetHubPolkadot' && feeAsset && asset && isAssetEqual(feeAsset, asset);
1731
+ isFeeAsset = origin === 'AssetHubPolkadot' && feeAsset && isAssetEqual(feeAsset, asset);
1742
1732
  feeAssetFeeEvent = (_ref12 = isFeeAsset ? _toConsumableArray(emitted).find(function (event) {
1743
1733
  return (event.type === 'ForeignAssets' || event.type === 'Assets') && event.value.type === 'Issued';
1744
1734
  }) : undefined) !== null && _ref12 !== void 0 ? _ref12 : isFeeAsset ? _toConsumableArray(emitted).find(function (event) {
1745
1735
  return event.type === 'Tokens' && event.value.type === 'Deposited';
1746
1736
  }) : undefined;
1747
- processedAssetsAmount = chain === 'AssetHubPolkadot' && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== 'DOT' ? processAssetsDepositedEvents(emitted, amount, 'Assets', 'Deposited', true) : (_processAssetsDeposit = processAssetsDepositedEvents(emitted, amount, 'Balances', 'Minted', false)) !== null && _processAssetsDeposit !== void 0 ? _processAssetsDeposit : processAssetsDepositedEvents(emitted, amount, 'Balances', 'Issued', false);
1737
+ processedAssetsAmount = chain === 'AssetHubPolkadot' && asset.symbol !== 'DOT' ? processAssetsDepositedEvents(emitted, amount, 'Assets', 'Deposited', true) : (_processAssetsDeposit = processAssetsDepositedEvents(emitted, amount, 'Balances', 'Minted', false)) !== null && _processAssetsDeposit !== void 0 ? _processAssetsDeposit : processAssetsDepositedEvents(emitted, amount, 'Balances', 'Issued', false);
1748
1738
  feeEvent = (_ref13 = (_ref14 = (_ref15 = (_ref16 = (_ref17 = feeAssetFeeEvent !== null && feeAssetFeeEvent !== void 0 ? feeAssetFeeEvent : chain === 'Mythos' ? reversedEvents.find(function (event) {
1749
1739
  return event.type === 'Balances' && event.value.type === 'Issued';
1750
1740
  }) : undefined) !== null && _ref17 !== void 0 ? _ref17 : processedAssetsAmount !== undefined ? {
@@ -1755,7 +1745,7 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1755
1745
  amount: processedAssetsAmount
1756
1746
  }
1757
1747
  }
1758
- } : undefined) !== null && _ref16 !== void 0 ? _ref16 : origin === 'Mythos' || chain === 'AssetHubPolkadot' && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== 'DOT' ? reversedEvents.find(function (event) {
1748
+ } : undefined) !== null && _ref16 !== void 0 ? _ref16 : origin === 'Mythos' || chain === 'AssetHubPolkadot' && asset.symbol !== 'DOT' ? reversedEvents.find(function (event) {
1759
1749
  return event.type === 'AssetConversion' && event.value.type === 'SwapCreditExecuted';
1760
1750
  }) : undefined) !== null && _ref15 !== void 0 ? _ref15 :
1761
1751
  // Prefer to Minted event
@@ -1785,7 +1775,7 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1785
1775
  if (feeAssetFeeEvent) {
1786
1776
  fee = amount - originFee - feeEventValue.amount;
1787
1777
  }
1788
- processedFee = (isRelayChain(chain) || chain.includes('AssetHub')) && (asset === null || asset === void 0 ? void 0 : asset.symbol) === 'DOT' ? padValueBy(fee, 30) : fee;
1778
+ processedFee = (isRelayChain(chain) || chain.includes('AssetHub')) && asset.symbol === 'DOT' ? padValueBy(fee, 30) : fee;
1789
1779
  return _context16.a(2, Promise.resolve({
1790
1780
  success: true,
1791
1781
  fee: processedFee,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk",
3
- "version": "14.5.3",
3
+ "version": "14.6.0",
4
4
  "description": "SDK for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,21 +23,21 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "@noble/hashes": "^2.4.0",
26
- "@paraspell/sdk-core": "14.5.3",
26
+ "@paraspell/sdk-core": "14.6.0",
27
27
  "@polkadot-api/signers-common": "^0.4.0",
28
28
  "@polkadot-api/substrate-bindings": "^0.21.2",
29
29
  "@polkadot-labs/hdkd": "^0.0.32",
30
30
  "@polkadot-labs/hdkd-helpers": "^0.0.34",
31
- "viem": "^2.57.13"
31
+ "viem": "^2.58.8"
32
32
  },
33
33
  "peerDependencies": {
34
- "@paraspell/descriptors": "14.5.3",
34
+ "@paraspell/descriptors": "14.6.0",
35
35
  "polkadot-api": ">= 3 < 4"
36
36
  },
37
37
  "devDependencies": {
38
- "@acala-network/chopsticks": "^1.5.2",
38
+ "@acala-network/chopsticks": "^1.6.4",
39
39
  "@babel/plugin-syntax-import-attributes": "^7.29.7",
40
- "@babel/preset-env": "^7.29.7",
40
+ "@babel/preset-env": "^7.29.14",
41
41
  "@codecov/rollup-plugin": "^2.0.1",
42
42
  "@noble/curves": "^2.4.0",
43
43
  "@rollup/plugin-babel": "^7.1.0",
@@ -45,10 +45,10 @@
45
45
  "@rollup/plugin-typescript": "^12.3.1",
46
46
  "@scure/bip32": "^2.4.0",
47
47
  "@scure/bip39": "^2.4.0",
48
- "@vitest/coverage-v8": "^5.0.5",
49
- "dotenv": "^18.0.9",
48
+ "@vitest/coverage-v8": "^5.1.2",
49
+ "dotenv": "^18.0.10",
50
50
  "polkadot-api": "^3.3.0",
51
- "rollup": "^4.66.0",
51
+ "rollup": "^4.68.8",
52
52
  "rollup-plugin-dts": "^6.5.1"
53
53
  },
54
54
  "scripts": {