@paraspell/sdk 14.5.2 → 14.5.4
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/dist/index.mjs +13 -23
- package/package.json +3 -3
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
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
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
|
|
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 (!
|
|
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 &&
|
|
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' &&
|
|
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' &&
|
|
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')) &&
|
|
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
|
+
"version": "14.5.4",
|
|
4
4
|
"description": "SDK for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@noble/hashes": "^2.4.0",
|
|
26
|
-
"@paraspell/sdk-core": "14.5.
|
|
26
|
+
"@paraspell/sdk-core": "14.5.4",
|
|
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",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"viem": "^2.57.13"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@paraspell/descriptors": "14.5.
|
|
34
|
+
"@paraspell/descriptors": "14.5.4",
|
|
35
35
|
"polkadot-api": ">= 3 < 4"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|