@paraspell/sdk-dedot 14.5.3 → 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 +20 -25
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getEvmPrivateKeyHex, getNativeAssetSymbol, getOtherAssets, NumberFormatError, createClientCache, MAX_CLIENTS, EXTENSION_MS, createClientPoolHelpers, BatchMode, isConfig, RoutingResolutionError, addXcmVersionHeader, createBridgedXcmPrefix, isCustomChain, isSenderSigner, PolkadotApi, UnsupportedOperationError, buildDryRunError, resolveModuleError, RuntimeApiUnavailableError, wrapTxBypass, localizeLocation, createAssetId, isAssetEqual, RELAY_LOCATION, SubmitTransactionError, replaceBigInt, createChainClient as createChainClient$1, getBalance as getBalance$1, Foreign, ForeignAbstract, Native, findAssetInfo, getAllAssetsSymbols, getAssets, getAssetsObject, getExistentialDeposit, getNativeAssets, getRelayChainSymbol, getSupportedAssets, getTChain, isChainEvm, convertSs58 as convertSs58$1, Builder as Builder$1, getBridgeStatus as getBridgeStatus$1, getParaEthTransferFees as getParaEthTransferFees$1, DRY_RUN_CLIENT_TIMEOUT_MS, dryRun as dryRun$1, dryRunOrigin as dryRunOrigin$1 } from '@paraspell/sdk-core';
|
|
1
|
+
import { getEvmPrivateKeyHex, getNativeAssetSymbol, getOtherAssets, NumberFormatError, createClientCache, MAX_CLIENTS, EXTENSION_MS, createClientPoolHelpers, BatchMode, isConfig, RoutingResolutionError, addXcmVersionHeader, createBridgedXcmPrefix, isCustomChain, isSenderSigner, PolkadotApi, UnsupportedOperationError, buildDryRunError, resolveModuleError, RuntimeApiUnavailableError, wrapTxBypass, localizeLocation, createAssetId, isAssetEqual, RELAY_LOCATION, RuntimeApiError, SubmitTransactionError, replaceBigInt, createChainClient as createChainClient$1, getBalance as getBalance$1, Foreign, ForeignAbstract, Native, findAssetInfo, getAllAssetsSymbols, getAssets, getAssetsObject, getExistentialDeposit, getNativeAssets, getRelayChainSymbol, getSupportedAssets, getTChain, isChainEvm, convertSs58 as convertSs58$1, Builder as Builder$1, getBridgeStatus as getBridgeStatus$1, getParaEthTransferFees as getParaEthTransferFees$1, DRY_RUN_CLIENT_TIMEOUT_MS, dryRun as dryRun$1, dryRunOrigin as dryRunOrigin$1 } from '@paraspell/sdk-core';
|
|
2
2
|
export * from '@paraspell/sdk-core';
|
|
3
3
|
import { stringPascalCase, isEvmAddress, decodeAddress, isHex, u8aToHex, hexToU8a, stringToU8a, blake2AsHex, xxhashAsHex } from 'dedot/utils';
|
|
4
4
|
import { ParaSpellError, snakeToCamel, lowercaseFirstLetter } from '@paraspell/sdk-common';
|
|
@@ -411,15 +411,12 @@ var getLocationTokenId = function getLocationTokenId(location, chain) {
|
|
|
411
411
|
};
|
|
412
412
|
|
|
413
413
|
var computeOriginFee = function computeOriginFee(dryRun, chain, executionFee) {
|
|
414
|
-
var isFeeAsset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
415
414
|
// Extract delivery fees from emitted events
|
|
416
415
|
var deliveryFees = [];
|
|
417
|
-
var assetConversionFee = 0n;
|
|
418
416
|
var _iterator = _createForOfIteratorHelper(dryRun.value.emittedEvents),
|
|
419
417
|
_step;
|
|
420
418
|
try {
|
|
421
419
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
422
|
-
var _e$value, _e$value2;
|
|
423
420
|
var e = _step.value;
|
|
424
421
|
var isXcmEvent = ["XcmPallet", "PolkadotXcm", "CumulusXcm"].includes(e.pallet);
|
|
425
422
|
var isFeesPaid = e.palletEvent.name === "FeesPaid";
|
|
@@ -444,26 +441,19 @@ var computeOriginFee = function computeOriginFee(dryRun, chain, executionFee) {
|
|
|
444
441
|
_iterator2.f();
|
|
445
442
|
}
|
|
446
443
|
}
|
|
447
|
-
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) {
|
|
448
|
-
assetConversionFee += e.value.value.amount_in;
|
|
449
|
-
}
|
|
450
444
|
}
|
|
451
445
|
} catch (err) {
|
|
452
446
|
_iterator.e(err);
|
|
453
447
|
} finally {
|
|
454
448
|
_iterator.f();
|
|
455
449
|
}
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
return acc + df.plancks;
|
|
464
|
-
}, 0n);
|
|
465
|
-
return totalDeliveryFees + executionFee;
|
|
466
|
-
}
|
|
450
|
+
var nativeAssetSymbol = getNativeAssetSymbol(chain);
|
|
451
|
+
var totalDeliveryFees = deliveryFees.filter(function (df) {
|
|
452
|
+
return df.tokenSymbol === nativeAssetSymbol;
|
|
453
|
+
}).reduce(function (acc, df) {
|
|
454
|
+
return acc + df.plancks;
|
|
455
|
+
}, 0n);
|
|
456
|
+
return totalDeliveryFees + executionFee;
|
|
467
457
|
};
|
|
468
458
|
|
|
469
459
|
var isValidSubstrateAddress = function isValidSubstrateAddress(address) {
|
|
@@ -1515,8 +1505,7 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1515
1505
|
key: "getXcmWeight",
|
|
1516
1506
|
value: function () {
|
|
1517
1507
|
var _getXcmWeight = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(xcm) {
|
|
1518
|
-
var
|
|
1519
|
-
var result, okValue;
|
|
1508
|
+
var result, _result$value5, refTime, proofSize;
|
|
1520
1509
|
return _regenerator().w(function (_context10) {
|
|
1521
1510
|
while (1) switch (_context10.n) {
|
|
1522
1511
|
case 0:
|
|
@@ -1524,10 +1513,16 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1524
1513
|
return this.api.call.xcmPaymentApi.queryXcmWeight(!xcm.type ? _transform(xcm) : xcm);
|
|
1525
1514
|
case 1:
|
|
1526
1515
|
result = _context10.v;
|
|
1527
|
-
|
|
1516
|
+
if (!result.isErr) {
|
|
1517
|
+
_context10.n = 2;
|
|
1518
|
+
break;
|
|
1519
|
+
}
|
|
1520
|
+
throw new RuntimeApiError("Failed to get XCM weight for payment fee calculation. Reason: ".concat(JSON.stringify(result.err)));
|
|
1521
|
+
case 2:
|
|
1522
|
+
_result$value5 = result.value, refTime = _result$value5.refTime, proofSize = _result$value5.proofSize;
|
|
1528
1523
|
return _context10.a(2, {
|
|
1529
|
-
refTime:
|
|
1530
|
-
proofSize:
|
|
1524
|
+
refTime: refTime,
|
|
1525
|
+
proofSize: proofSize
|
|
1531
1526
|
});
|
|
1532
1527
|
}
|
|
1533
1528
|
}, _callee10, this);
|
|
@@ -1549,7 +1544,7 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1549
1544
|
key: "getDryRunXcm",
|
|
1550
1545
|
value: function () {
|
|
1551
1546
|
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(_ref1) {
|
|
1552
|
-
var _result$
|
|
1547
|
+
var _result$value6;
|
|
1553
1548
|
var originLocation, xcm, asset, chain, version, supportsDryRunApi, transformedOriginLocation, result, executionResult, isSuccess, failure, actualWeight, weight, forwardedXcms, destParaId, fee;
|
|
1554
1549
|
return _regenerator().w(function (_context11) {
|
|
1555
1550
|
while (1) switch (_context11.n) {
|
|
@@ -1567,7 +1562,7 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1567
1562
|
return this.api.call.dryRunApi.dryRunXcm(transformedOriginLocation, xcm);
|
|
1568
1563
|
case 2:
|
|
1569
1564
|
result = _context11.v;
|
|
1570
|
-
executionResult = result === null || result === void 0 || (_result$
|
|
1565
|
+
executionResult = result === null || result === void 0 || (_result$value6 = result.value) === null || _result$value6 === void 0 ? void 0 : _result$value6.executionResult;
|
|
1571
1566
|
isSuccess = result.isOk && executionResult.type === "Complete";
|
|
1572
1567
|
if (isSuccess) {
|
|
1573
1568
|
_context11.n = 3;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk-dedot",
|
|
3
|
-
"version": "14.5.
|
|
3
|
+
"version": "14.5.4",
|
|
4
4
|
"description": "Dedot-based SDK for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@paraspell/sdk-common": "14.5.
|
|
26
|
-
"@paraspell/sdk-core": "14.5.
|
|
25
|
+
"@paraspell/sdk-common": "14.5.4",
|
|
26
|
+
"@paraspell/sdk-core": "14.5.4"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"dedot": ">= 1.4.0",
|