@paraspell/sdk-dedot 13.10.0 → 13.11.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/dist/index.mjs +17 -14
- 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,
|
|
1
|
+
import { getEvmPrivateKeyHex, getNativeAssetSymbol, getOtherAssets, NumberFormatError, createClientCache, MAX_CLIENTS, EXTENSION_MS, createClientPoolHelpers, BatchMode, isConfig, isCustomChain, isSenderSigner, PolkadotApi, UnsupportedOperationError, getFailingInstruction, resolveModuleError, RuntimeApiUnavailableError, wrapTxBypass, localizeLocation, createAssetId, addXcmVersionHeader, isAssetEqual, RELAY_LOCATION, replaceBigInt, createChainClient as createChainClient$1, getBalance as getBalance$1, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getExistentialDeposit, getNativeAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, 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 } from 'dedot/utils';
|
|
4
4
|
import { Keyring } from '@polkadot/keyring';
|
|
@@ -1034,7 +1034,7 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1034
1034
|
value: function resolveDefaultFeeAsset(_ref0) {
|
|
1035
1035
|
var chain = _ref0.chain,
|
|
1036
1036
|
feeAsset = _ref0.feeAsset;
|
|
1037
|
-
return feeAsset !== null && feeAsset !== void 0 ? feeAsset :
|
|
1037
|
+
return feeAsset !== null && feeAsset !== void 0 ? feeAsset : this.findNativeAssetInfoOrThrow(chain);
|
|
1038
1038
|
}
|
|
1039
1039
|
}, {
|
|
1040
1040
|
key: "resolveFeeAsset",
|
|
@@ -1069,9 +1069,9 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1069
1069
|
case 3:
|
|
1070
1070
|
return _context6.a(2, {
|
|
1071
1071
|
isCustomAsset: true,
|
|
1072
|
-
asset:
|
|
1072
|
+
asset: this.findAssetInfoOrThrow(chain, {
|
|
1073
1073
|
id: assetId
|
|
1074
|
-
}
|
|
1074
|
+
})
|
|
1075
1075
|
});
|
|
1076
1076
|
}
|
|
1077
1077
|
}, _callee6, this);
|
|
@@ -1086,15 +1086,15 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1086
1086
|
value: function () {
|
|
1087
1087
|
var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(options) {
|
|
1088
1088
|
var _this2 = this,
|
|
1089
|
-
|
|
1089
|
+
_result3,
|
|
1090
1090
|
_resValue$executionRe,
|
|
1091
1091
|
_execRes$actualWeight;
|
|
1092
|
-
var tx, address, feeAsset, chain, destination, version, _options$useRootOrigi, useRootOrigin, bypassOptions, supportsDryRunApi, basePayload, resolvedTx, resolvedFeeAsset, performDryRunCall, findFailingEventInResult, getExecutionSuccessFromResult, extractFailureReasonFromResult, result, isSuccess, failureErr, shouldRetryWithVersion, msg, _msg, resValue, execRes, forwardedXcms, actualWeight, weight, destParaId, localXcm, USE_XCM_PAYMENT_API_CHAINS, overriddenWeight, xcmFee, _yield$this$getPaymen, executionFee, fee, _t, _t2, _t3, _t4;
|
|
1092
|
+
var tx, address, feeAsset, chain, destination, version, _options$useRootOrigi, useRootOrigin, bypassOptions, supportsDryRunApi, basePayload, resolvedTx, resolvedFeeAsset, performDryRunCall, findFailingEventInResult, getExecutionSuccessFromResult, extractFailureReasonFromResult, result, isSuccess, failureErr, shouldRetryWithVersion, msg, _result, _msg, _result2, resValue, execRes, forwardedXcms, actualWeight, weight, destParaId, localXcm, USE_XCM_PAYMENT_API_CHAINS, overriddenWeight, xcmFee, _yield$this$getPaymen, executionFee, fee, _t, _t2, _t3, _t4;
|
|
1093
1093
|
return _regenerator().w(function (_context7) {
|
|
1094
1094
|
while (1) switch (_context7.p = _context7.n) {
|
|
1095
1095
|
case 0:
|
|
1096
1096
|
tx = options.tx, address = options.address, feeAsset = options.feeAsset, chain = options.chain, destination = options.destination, version = options.version, _options$useRootOrigi = options.useRootOrigin, useRootOrigin = _options$useRootOrigi === void 0 ? false : _options$useRootOrigi, bypassOptions = options.bypassOptions;
|
|
1097
|
-
supportsDryRunApi =
|
|
1097
|
+
supportsDryRunApi = this.hasDryRunSupport(chain);
|
|
1098
1098
|
if (supportsDryRunApi) {
|
|
1099
1099
|
_context7.n = 1;
|
|
1100
1100
|
break;
|
|
@@ -1262,6 +1262,7 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1262
1262
|
failureReason: failureErr.failureReason,
|
|
1263
1263
|
failureSubReason: failureErr.failureSubReason,
|
|
1264
1264
|
failureIndex: failureErr.failureIndex,
|
|
1265
|
+
failureInstruction: getFailingInstruction((_result = result) === null || _result === void 0 || (_result = _result.value) === null || _result === void 0 ? void 0 : _result.localXcm, failureErr.failureIndex),
|
|
1265
1266
|
asset: resolvedFeeAsset.asset
|
|
1266
1267
|
});
|
|
1267
1268
|
case 14:
|
|
@@ -1274,10 +1275,11 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1274
1275
|
failureReason: failureErr.failureReason || "Unknown error",
|
|
1275
1276
|
failureSubReason: failureErr.failureSubReason,
|
|
1276
1277
|
failureIndex: failureErr.failureIndex,
|
|
1278
|
+
failureInstruction: getFailingInstruction((_result2 = result) === null || _result2 === void 0 || (_result2 = _result2.value) === null || _result2 === void 0 ? void 0 : _result2.localXcm, failureErr.failureIndex),
|
|
1277
1279
|
asset: resolvedFeeAsset.asset
|
|
1278
1280
|
});
|
|
1279
1281
|
case 15:
|
|
1280
|
-
resValue = (
|
|
1282
|
+
resValue = (_result3 = result) === null || _result3 === void 0 ? void 0 : _result3.value;
|
|
1281
1283
|
execRes = resValue === null || resValue === void 0 || (_resValue$executionRe = resValue.executionResult) === null || _resValue$executionRe === void 0 ? void 0 : _resValue$executionRe.value;
|
|
1282
1284
|
forwardedXcms = result.value.forwardedXcms.length > 0 ? result.value.forwardedXcms[0] : [];
|
|
1283
1285
|
actualWeight = (_execRes$actualWeight = execRes === null || execRes === void 0 ? void 0 : execRes.actualWeight) !== null && _execRes$actualWeight !== void 0 ? _execRes$actualWeight : execRes === null || execRes === void 0 ? void 0 : execRes.actual_weight;
|
|
@@ -1285,7 +1287,7 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1285
1287
|
destParaId = this.extractDestParaId(forwardedXcms);
|
|
1286
1288
|
localXcm = resValue === null || resValue === void 0 ? void 0 : resValue.localXcm;
|
|
1287
1289
|
USE_XCM_PAYMENT_API_CHAINS = ["Astar"];
|
|
1288
|
-
if (!(
|
|
1290
|
+
if (!(this.hasXcmPaymentApiSupport(chain) && localXcm && (feeAsset || USE_XCM_PAYMENT_API_CHAINS.includes(chain) || chain.startsWith("AssetHub") && destination === "Ethereum") || resolvedFeeAsset.isCustomAsset)) {
|
|
1289
1291
|
_context7.n = 21;
|
|
1290
1292
|
break;
|
|
1291
1293
|
}
|
|
@@ -1482,7 +1484,7 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1482
1484
|
case 6:
|
|
1483
1485
|
assets = (_deliveryFeeRes = deliveryFeeRes) === null || _deliveryFeeRes === void 0 || (_deliveryFeeRes = _deliveryFeeRes.value) === null || _deliveryFeeRes === void 0 ? void 0 : _deliveryFeeRes.value;
|
|
1484
1486
|
deliveryFeeResolved = deliveryFeeRes && (assets === null || assets === void 0 ? void 0 : assets.length) > 0 ? (_assets$0$fun$value = (_assets$ = assets[0]) === null || _assets$ === void 0 || (_assets$ = _assets$.fun) === null || _assets$ === void 0 ? void 0 : _assets$.value) !== null && _assets$0$fun$value !== void 0 ? _assets$0$fun$value : 0n : 0n;
|
|
1485
|
-
nativeAsset =
|
|
1487
|
+
nativeAsset = this.findNativeAssetInfoOrThrow(chain);
|
|
1486
1488
|
if (!(isAssetEqual(asset, nativeAsset) || usedThirdParam)) {
|
|
1487
1489
|
_context0.n = 7;
|
|
1488
1490
|
break;
|
|
@@ -1532,7 +1534,7 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1532
1534
|
return _context1.a(2, undefined);
|
|
1533
1535
|
case 2:
|
|
1534
1536
|
ahApi = this.clone();
|
|
1535
|
-
assetHubChain = "AssetHub".concat(
|
|
1537
|
+
assetHubChain = "AssetHub".concat(this.getRelayChainOf(chain));
|
|
1536
1538
|
_context1.n = 3;
|
|
1537
1539
|
return ahApi.init(assetHubChain);
|
|
1538
1540
|
case 3:
|
|
@@ -1604,7 +1606,7 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1604
1606
|
while (1) switch (_context11.n) {
|
|
1605
1607
|
case 0:
|
|
1606
1608
|
originLocation = _ref10.originLocation, xcm = _ref10.xcm, asset = _ref10.asset, chain = _ref10.chain, version = _ref10.version;
|
|
1607
|
-
supportsDryRunApi =
|
|
1609
|
+
supportsDryRunApi = this.hasDryRunSupport(chain);
|
|
1608
1610
|
if (supportsDryRunApi) {
|
|
1609
1611
|
_context11.n = 1;
|
|
1610
1612
|
break;
|
|
@@ -1627,6 +1629,7 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1627
1629
|
success: false,
|
|
1628
1630
|
failureReason: failureReason,
|
|
1629
1631
|
failureIndex: failureIndex,
|
|
1632
|
+
failureInstruction: getFailingInstruction(xcm, failureIndex),
|
|
1630
1633
|
asset: asset
|
|
1631
1634
|
});
|
|
1632
1635
|
case 3:
|
|
@@ -1634,7 +1637,7 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1634
1637
|
weight = actualWeight ? actualWeight : undefined;
|
|
1635
1638
|
forwardedXcms = result.value.forwardedXcms.length > 0 ? result.value.forwardedXcms[0] : [];
|
|
1636
1639
|
destParaId = this.extractDestParaId(forwardedXcms);
|
|
1637
|
-
if (!
|
|
1640
|
+
if (!this.hasXcmPaymentApiSupport(chain)) {
|
|
1638
1641
|
_context11.n = 6;
|
|
1639
1642
|
break;
|
|
1640
1643
|
}
|
|
@@ -1749,7 +1752,7 @@ var DedotApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1749
1752
|
if (force) {
|
|
1750
1753
|
void this.api.disconnect();
|
|
1751
1754
|
} else {
|
|
1752
|
-
var key = api === undefined ?
|
|
1755
|
+
var key = api === undefined ? this.getChainProviders(chain) : api;
|
|
1753
1756
|
releaseClient(key);
|
|
1754
1757
|
}
|
|
1755
1758
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk-dedot",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.11.0",
|
|
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-core": "13.
|
|
26
|
-
"@paraspell/sdk-common": "13.
|
|
25
|
+
"@paraspell/sdk-core": "13.11.0",
|
|
26
|
+
"@paraspell/sdk-common": "13.11.0"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"dedot": ">= 1.3.0",
|