@paraspell/sdk-pjs 14.3.3 → 14.3.5
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 +68 -7
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getNativeAssetSymbol, getOtherAssets, hasJunction, getJunctionValue, getEvmPrivateKeyHex, UnsupportedOperationError, createClientCache, MAX_CLIENTS, EXTENSION_MS, createClientPoolHelpers, BatchMode, isConfig, isCustomChain, isSenderSigner, PolkadotApi, buildDryRunError, resolveModuleError, RuntimeApiUnavailableError, wrapTxBypass, normalizeLocation, localizeLocation, createAssetId,
|
|
1
|
+
import { getNativeAssetSymbol, getOtherAssets, hasJunction, getJunctionValue, getEvmPrivateKeyHex, UnsupportedOperationError, createClientCache, MAX_CLIENTS, EXTENSION_MS, createClientPoolHelpers, BatchMode, isConfig, Version, RoutingResolutionError, addXcmVersionHeader, createBridgedXcmPrefix, isCustomChain, isSenderSigner, PolkadotApi, buildDryRunError, resolveModuleError, RuntimeApiUnavailableError, wrapTxBypass, normalizeLocation, localizeLocation, createAssetId, isAssetEqual, RELAY_LOCATION, SubmitTransactionError, 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 { Keyring, WsProvider, ApiPromise } from '@polkadot/api';
|
|
4
4
|
import { snakeToCamel, lowercaseFirstLetter } from '@paraspell/sdk-common';
|
|
@@ -10,6 +10,9 @@ function _arrayLikeToArray(r, a) {
|
|
|
10
10
|
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
11
11
|
return n;
|
|
12
12
|
}
|
|
13
|
+
function _arrayWithHoles(r) {
|
|
14
|
+
if (Array.isArray(r)) return r;
|
|
15
|
+
}
|
|
13
16
|
function _arrayWithoutHoles(r) {
|
|
14
17
|
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
15
18
|
}
|
|
@@ -143,6 +146,33 @@ function _isNativeReflectConstruct() {
|
|
|
143
146
|
function _iterableToArray(r) {
|
|
144
147
|
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
145
148
|
}
|
|
149
|
+
function _iterableToArrayLimit(r, l) {
|
|
150
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
151
|
+
if (null != t) {
|
|
152
|
+
var e,
|
|
153
|
+
n,
|
|
154
|
+
i,
|
|
155
|
+
u,
|
|
156
|
+
a = [],
|
|
157
|
+
f = true,
|
|
158
|
+
o = false;
|
|
159
|
+
try {
|
|
160
|
+
if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
161
|
+
} catch (r) {
|
|
162
|
+
o = true, n = r;
|
|
163
|
+
} finally {
|
|
164
|
+
try {
|
|
165
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
166
|
+
} finally {
|
|
167
|
+
if (o) throw n;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return a;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
function _nonIterableRest() {
|
|
174
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
175
|
+
}
|
|
146
176
|
function _nonIterableSpread() {
|
|
147
177
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
148
178
|
}
|
|
@@ -285,6 +315,9 @@ function _setPrototypeOf(t, e) {
|
|
|
285
315
|
return t.__proto__ = e, t;
|
|
286
316
|
}, _setPrototypeOf(t, e);
|
|
287
317
|
}
|
|
318
|
+
function _slicedToArray(r, e) {
|
|
319
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
320
|
+
}
|
|
288
321
|
function _toConsumableArray(r) {
|
|
289
322
|
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
290
323
|
}
|
|
@@ -327,9 +360,9 @@ var getLocationTokenId = function getLocationTokenId(location, chain) {
|
|
|
327
360
|
var foreignAssets = getOtherAssets(chain);
|
|
328
361
|
if (location.interior.X2 && hasJunction(location, 'PalletInstance', '50') && hasJunction(location, 'GeneralIndex')) {
|
|
329
362
|
var _foreignAssets$find$s, _foreignAssets$find;
|
|
330
|
-
var assetId = getJunctionValue(location, 'GeneralIndex');
|
|
363
|
+
var assetId = String(getJunctionValue(location, 'GeneralIndex')).replace(/,/g, '');
|
|
331
364
|
return (_foreignAssets$find$s = (_foreignAssets$find = foreignAssets.find(function (asset) {
|
|
332
|
-
return asset.assetId ===
|
|
365
|
+
return asset.assetId === assetId;
|
|
333
366
|
})) === null || _foreignAssets$find === void 0 ? void 0 : _foreignAssets$find.symbol) !== null && _foreignAssets$find$s !== void 0 ? _foreignAssets$find$s : null;
|
|
334
367
|
}
|
|
335
368
|
return null;
|
|
@@ -827,11 +860,11 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
827
860
|
value: function () {
|
|
828
861
|
var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(options) {
|
|
829
862
|
var _this3 = this;
|
|
830
|
-
var tx, address,
|
|
863
|
+
var tx, address, chain, destination, version, _options$useRootOrigi, useRootOrigin, bypassOptions, supportsDryRunApi, feeAsset, basePayload, resolvedTx, resolvedFeeAsset, performDryRunCall, findFailingEventInResult, getExecutionSuccessFromResult, extractFailureReasonFromResult, response, resultHuman, resultJson, isSuccess, failureErr, shouldRetryWithVersion, msg, _resultJson, _msg, _resultJson2, forwardedXcms, actualWeight, weight, destParaId, overriddenWeight, xcmFee, _yield$this$getPaymen, executionFee, fee, _t, _t2, _t3, _t4;
|
|
831
864
|
return _regenerator().w(function (_context0) {
|
|
832
865
|
while (1) switch (_context0.p = _context0.n) {
|
|
833
866
|
case 0:
|
|
834
|
-
tx = options.tx, address = options.address,
|
|
867
|
+
tx = options.tx, address = options.address, chain = options.chain, destination = options.destination, version = options.version, _options$useRootOrigi = options.useRootOrigin, useRootOrigin = _options$useRootOrigi === void 0 ? false : _options$useRootOrigi, bypassOptions = options.bypassOptions;
|
|
835
868
|
supportsDryRunApi = this.hasDryRunSupport(chain);
|
|
836
869
|
if (supportsDryRunApi) {
|
|
837
870
|
_context0.n = 1;
|
|
@@ -839,6 +872,7 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
839
872
|
}
|
|
840
873
|
throw new RuntimeApiUnavailableError(chain, 'DryRunApi');
|
|
841
874
|
case 1:
|
|
875
|
+
feeAsset = this.getMethod(tx) === 'execute' ? options.feeAsset : undefined;
|
|
842
876
|
basePayload = useRootOrigin ? {
|
|
843
877
|
system: {
|
|
844
878
|
Root: null
|
|
@@ -865,7 +899,9 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
865
899
|
case 4:
|
|
866
900
|
resolvedTx = _t;
|
|
867
901
|
_context0.n = 5;
|
|
868
|
-
return this.resolveFeeAsset(options)
|
|
902
|
+
return this.resolveFeeAsset(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
903
|
+
feeAsset: feeAsset
|
|
904
|
+
}));
|
|
869
905
|
case 5:
|
|
870
906
|
resolvedFeeAsset = _context0.v;
|
|
871
907
|
performDryRunCall = /*#__PURE__*/function () {
|
|
@@ -1067,7 +1103,9 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1067
1103
|
case 20:
|
|
1068
1104
|
resolvedFeeAsset = {
|
|
1069
1105
|
isCustomAsset: false,
|
|
1070
|
-
asset: this.resolveDefaultFeeAsset(options)
|
|
1106
|
+
asset: this.resolveDefaultFeeAsset(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
1107
|
+
feeAsset: feeAsset
|
|
1108
|
+
}))
|
|
1071
1109
|
};
|
|
1072
1110
|
case 21:
|
|
1073
1111
|
_context0.n = 22;
|
|
@@ -1416,6 +1454,26 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1416
1454
|
}
|
|
1417
1455
|
return getDryRunXcm;
|
|
1418
1456
|
}()
|
|
1457
|
+
}, {
|
|
1458
|
+
key: "createBridgedForwardedXcms",
|
|
1459
|
+
value: function createBridgedForwardedXcms(forwardedXcm, params) {
|
|
1460
|
+
var _Object$keys = Object.keys(forwardedXcm),
|
|
1461
|
+
_Object$keys2 = _slicedToArray(_Object$keys, 1),
|
|
1462
|
+
versionKey = _Object$keys2[0];
|
|
1463
|
+
var version = Object.values(Version).find(function (v) {
|
|
1464
|
+
return v.toLowerCase() === versionKey.toLowerCase();
|
|
1465
|
+
});
|
|
1466
|
+
if (!version) {
|
|
1467
|
+
throw new RoutingResolutionError("Unsupported XCM version ".concat(versionKey, " in the forwarded XCM"));
|
|
1468
|
+
}
|
|
1469
|
+
var exportMessage = forwardedXcm[versionKey].find(function (instruction) {
|
|
1470
|
+
return 'exportMessage' in instruction;
|
|
1471
|
+
});
|
|
1472
|
+
if (!exportMessage) {
|
|
1473
|
+
throw new RoutingResolutionError('ExportMessage instruction not found in the forwarded XCM');
|
|
1474
|
+
}
|
|
1475
|
+
return [addXcmVersionHeader(params.destination, version), [addXcmVersionHeader([].concat(_toConsumableArray(createBridgedXcmPrefix(version, params)), _toConsumableArray(exportMessage.exportMessage.xcm)), version)]];
|
|
1476
|
+
}
|
|
1419
1477
|
}, {
|
|
1420
1478
|
key: "getBridgeStatus",
|
|
1421
1479
|
value: function () {
|
|
@@ -1492,6 +1550,9 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1492
1550
|
releaseClient(key);
|
|
1493
1551
|
}
|
|
1494
1552
|
}
|
|
1553
|
+
if (force || _typeof(api) !== 'object' || Array.isArray(api)) {
|
|
1554
|
+
this.resetChain();
|
|
1555
|
+
}
|
|
1495
1556
|
return Promise.resolve();
|
|
1496
1557
|
}
|
|
1497
1558
|
}, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk-pjs",
|
|
3
|
-
"version": "14.3.
|
|
3
|
+
"version": "14.3.5",
|
|
4
4
|
"description": "Polkadot.js 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.3.
|
|
26
|
-
"@paraspell/sdk-core": "14.3.
|
|
25
|
+
"@paraspell/sdk-common": "14.3.5",
|
|
26
|
+
"@paraspell/sdk-core": "14.3.5"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@polkadot/api": ">= 16.0 < 17",
|