@paraspell/sdk 13.7.2 → 13.9.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 +60 -31
- package/package.json +3 -5
package/dist/index.mjs
CHANGED
|
@@ -693,6 +693,37 @@ var _transform = function transform(obj) {
|
|
|
693
693
|
}
|
|
694
694
|
};
|
|
695
695
|
|
|
696
|
+
var fetchPalletList = /*#__PURE__*/function () {
|
|
697
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(client) {
|
|
698
|
+
var _yield$client$getFina, hash, bytes, meta;
|
|
699
|
+
return _regenerator().w(function (_context) {
|
|
700
|
+
while (1) switch (_context.n) {
|
|
701
|
+
case 0:
|
|
702
|
+
_context.n = 1;
|
|
703
|
+
return client.getFinalizedBlock();
|
|
704
|
+
case 1:
|
|
705
|
+
_yield$client$getFina = _context.v;
|
|
706
|
+
hash = _yield$client$getFina.hash;
|
|
707
|
+
_context.n = 2;
|
|
708
|
+
return client.getMetadata(hash);
|
|
709
|
+
case 2:
|
|
710
|
+
bytes = _context.v;
|
|
711
|
+
meta = unifyMetadata(decAnyMetadata(bytes));
|
|
712
|
+
return _context.a(2, meta.pallets.map(function (p) {
|
|
713
|
+
return {
|
|
714
|
+
name: p.name,
|
|
715
|
+
index: p.index,
|
|
716
|
+
hasExtrinsics: p.calls !== undefined
|
|
717
|
+
};
|
|
718
|
+
}));
|
|
719
|
+
}
|
|
720
|
+
}, _callee);
|
|
721
|
+
}));
|
|
722
|
+
return function fetchPalletList(_x) {
|
|
723
|
+
return _ref.apply(this, arguments);
|
|
724
|
+
};
|
|
725
|
+
}();
|
|
726
|
+
|
|
696
727
|
var clientPool = createClientCache(MAX_CLIENTS, /*#__PURE__*/function () {
|
|
697
728
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(client) {
|
|
698
729
|
return _regenerator().w(function (_context) {
|
|
@@ -719,13 +750,23 @@ var extractDryRunXcmFailureReason = function extractDryRunXcmFailureReason(resul
|
|
|
719
750
|
var executionResult = result === null || result === void 0 || (_result$value = result.value) === null || _result$value === void 0 ? void 0 : _result$value.execution_result;
|
|
720
751
|
var error = executionResult === null || executionResult === void 0 || (_executionResult$valu = executionResult.value) === null || _executionResult$valu === void 0 ? void 0 : _executionResult$valu.error;
|
|
721
752
|
var failureType = (_ref2 = (_ref3 = (_ref4 = (_error$error$type = error === null || error === void 0 || (_error$error = error.error) === null || _error$error === void 0 ? void 0 : _error$error.type) !== null && _error$error$type !== void 0 ? _error$error$type : error === null || error === void 0 || (_error$value = error.value) === null || _error$value === void 0 || (_error$value = _error$value.error) === null || _error$value === void 0 ? void 0 : _error$value.type) !== null && _ref4 !== void 0 ? _ref4 : error === null || error === void 0 || (_error$value2 = error.value) === null || _error$value2 === void 0 || (_error$value2 = _error$value2.value) === null || _error$value2 === void 0 ? void 0 : _error$value2.type) !== null && _ref3 !== void 0 ? _ref3 : error === null || error === void 0 || (_error$value3 = error.value) === null || _error$value3 === void 0 ? void 0 : _error$value3.type) !== null && _ref2 !== void 0 ? _ref2 : error === null || error === void 0 ? void 0 : error.type;
|
|
753
|
+
var failureIndex = typeof (error === null || error === void 0 ? void 0 : error.index) === 'number' ? error.index : undefined;
|
|
722
754
|
if (typeof failureType === 'string') {
|
|
723
|
-
return
|
|
755
|
+
return {
|
|
756
|
+
failureReason: failureType,
|
|
757
|
+
failureIndex: failureIndex
|
|
758
|
+
};
|
|
724
759
|
}
|
|
725
760
|
if (typeof (executionResult === null || executionResult === void 0 ? void 0 : executionResult.type) === 'string') {
|
|
726
|
-
return
|
|
761
|
+
return {
|
|
762
|
+
failureReason: executionResult.type,
|
|
763
|
+
failureIndex: failureIndex
|
|
764
|
+
};
|
|
727
765
|
}
|
|
728
|
-
return
|
|
766
|
+
return {
|
|
767
|
+
failureReason: JSON.stringify((_ref5 = (_result$value2 = result === null || result === void 0 ? void 0 : result.value) !== null && _result$value2 !== void 0 ? _result$value2 : result) !== null && _ref5 !== void 0 ? _ref5 : 'Unknown error structure', replaceBigInt),
|
|
768
|
+
failureIndex: failureIndex
|
|
769
|
+
};
|
|
729
770
|
};
|
|
730
771
|
var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
731
772
|
function PapiApi() {
|
|
@@ -1005,35 +1046,18 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1005
1046
|
}, {
|
|
1006
1047
|
key: "fetchPalletList",
|
|
1007
1048
|
value: function () {
|
|
1008
|
-
var
|
|
1009
|
-
var _yield$this$api$getFi2, hash, bytes, meta;
|
|
1049
|
+
var _fetchPalletList2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
|
|
1010
1050
|
return _regenerator().w(function (_context7) {
|
|
1011
1051
|
while (1) switch (_context7.n) {
|
|
1012
1052
|
case 0:
|
|
1013
|
-
_context7.
|
|
1014
|
-
return this.api.getFinalizedBlock();
|
|
1015
|
-
case 1:
|
|
1016
|
-
_yield$this$api$getFi2 = _context7.v;
|
|
1017
|
-
hash = _yield$this$api$getFi2.hash;
|
|
1018
|
-
_context7.n = 2;
|
|
1019
|
-
return this.api.getMetadata(hash);
|
|
1020
|
-
case 2:
|
|
1021
|
-
bytes = _context7.v;
|
|
1022
|
-
meta = unifyMetadata(decAnyMetadata(bytes));
|
|
1023
|
-
return _context7.a(2, meta.pallets.map(function (p) {
|
|
1024
|
-
return {
|
|
1025
|
-
name: p.name,
|
|
1026
|
-
index: p.index,
|
|
1027
|
-
hasExtrinsics: p.calls !== undefined
|
|
1028
|
-
};
|
|
1029
|
-
}));
|
|
1053
|
+
return _context7.a(2, fetchPalletList(this.api));
|
|
1030
1054
|
}
|
|
1031
1055
|
}, _callee7, this);
|
|
1032
1056
|
}));
|
|
1033
|
-
function fetchPalletList() {
|
|
1034
|
-
return
|
|
1057
|
+
function fetchPalletList$1() {
|
|
1058
|
+
return _fetchPalletList2.apply(this, arguments);
|
|
1035
1059
|
}
|
|
1036
|
-
return fetchPalletList;
|
|
1060
|
+
return fetchPalletList$1;
|
|
1037
1061
|
}()
|
|
1038
1062
|
}, {
|
|
1039
1063
|
key: "getMethod",
|
|
@@ -1260,17 +1284,20 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1260
1284
|
return result;
|
|
1261
1285
|
};
|
|
1262
1286
|
extractFailureReasonFromResult = function extractFailureReasonFromResult(result) {
|
|
1263
|
-
var _obj$value, _ref10, _result$value6;
|
|
1287
|
+
var _obj$value, _obj$value2, _ref10, _result$value6;
|
|
1264
1288
|
var obj = findFailureObjectFromResult(result);
|
|
1265
|
-
|
|
1289
|
+
var failureIndex = typeof (obj === null || obj === void 0 || (_obj$value = obj.value) === null || _obj$value === void 0 ? void 0 : _obj$value.index) === 'number' ? obj.value.index : undefined;
|
|
1290
|
+
if (obj !== null && obj !== void 0 && obj.type && obj !== null && obj !== void 0 && (_obj$value2 = obj.value) !== null && _obj$value2 !== void 0 && (_obj$value2 = _obj$value2.error) !== null && _obj$value2 !== void 0 && _obj$value2.type) {
|
|
1266
1291
|
return {
|
|
1267
1292
|
failureReason: obj.type,
|
|
1268
|
-
failureSubReason: obj.value.error.type
|
|
1293
|
+
failureSubReason: obj.value.error.type,
|
|
1294
|
+
failureIndex: failureIndex
|
|
1269
1295
|
};
|
|
1270
1296
|
}
|
|
1271
1297
|
if (obj !== null && obj !== void 0 && obj.type) {
|
|
1272
1298
|
return {
|
|
1273
|
-
failureReason: obj.type
|
|
1299
|
+
failureReason: obj.type,
|
|
1300
|
+
failureIndex: failureIndex
|
|
1274
1301
|
};
|
|
1275
1302
|
}
|
|
1276
1303
|
return {
|
|
@@ -1315,6 +1342,7 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1315
1342
|
success: false,
|
|
1316
1343
|
failureReason: failureOutputReason.failureReason,
|
|
1317
1344
|
failureSubReason: failureOutputReason.failureSubReason,
|
|
1345
|
+
failureIndex: failureOutputReason.failureIndex,
|
|
1318
1346
|
asset: resolvedFeeAsset.asset
|
|
1319
1347
|
}));
|
|
1320
1348
|
case 12:
|
|
@@ -1664,7 +1692,7 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1664
1692
|
value: function () {
|
|
1665
1693
|
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(_ref12) {
|
|
1666
1694
|
var _ref13, _processAssetsDeposit, _ref14, _ref15, _ref16, _ref17, _ref18;
|
|
1667
|
-
var originLocation, xcm, chain, origin, asset, feeAsset, originFee, amount, version, transformedOriginLocation, result, isSuccess, failureReason, execResult, weight, forwardedXcms, destParaId, _fee, emitted, reversedEvents, palletsWithIssued, isFeeAsset, feeAssetFeeEvent, processedAssetsAmount, feeEvent, feeEventValue, fee, processedFee;
|
|
1695
|
+
var originLocation, xcm, chain, origin, asset, feeAsset, originFee, amount, version, transformedOriginLocation, result, isSuccess, _extractDryRunXcmFail, failureReason, failureIndex, execResult, weight, forwardedXcms, destParaId, _fee, emitted, reversedEvents, palletsWithIssued, isFeeAsset, feeAssetFeeEvent, processedAssetsAmount, feeEvent, feeEventValue, fee, processedFee;
|
|
1668
1696
|
return _regenerator().w(function (_context16) {
|
|
1669
1697
|
while (1) switch (_context16.n) {
|
|
1670
1698
|
case 0:
|
|
@@ -1685,10 +1713,11 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1685
1713
|
_context16.n = 3;
|
|
1686
1714
|
break;
|
|
1687
1715
|
}
|
|
1688
|
-
|
|
1716
|
+
_extractDryRunXcmFail = extractDryRunXcmFailureReason(result), failureReason = _extractDryRunXcmFail.failureReason, failureIndex = _extractDryRunXcmFail.failureIndex;
|
|
1689
1717
|
return _context16.a(2, {
|
|
1690
1718
|
success: false,
|
|
1691
1719
|
failureReason: failureReason,
|
|
1720
|
+
failureIndex: failureIndex,
|
|
1692
1721
|
asset: asset
|
|
1693
1722
|
});
|
|
1694
1723
|
case 3:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.9.0",
|
|
4
4
|
"description": "SDK for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@polkadot-labs/hdkd": "^0.0.28",
|
|
28
28
|
"@polkadot-labs/hdkd-helpers": "^0.0.30",
|
|
29
29
|
"viem": "^2.51.3",
|
|
30
|
-
"@paraspell/sdk-core": "13.
|
|
30
|
+
"@paraspell/sdk-core": "13.9.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"polkadot-api": ">= 2 < 3"
|
|
@@ -44,11 +44,9 @@
|
|
|
44
44
|
"@scure/bip32": "^2.2.0",
|
|
45
45
|
"@scure/bip39": "^2.2.0",
|
|
46
46
|
"@vitest/coverage-v8": "^4.1.7",
|
|
47
|
-
"axios": "^1.16.1",
|
|
48
47
|
"dotenv": "^17.4.2",
|
|
49
48
|
"rollup": "^4.60.4",
|
|
50
|
-
"rollup-plugin-dts": "^6.4.1"
|
|
51
|
-
"tslib": "^2.8.1"
|
|
49
|
+
"rollup-plugin-dts": "^6.4.1"
|
|
52
50
|
},
|
|
53
51
|
"scripts": {
|
|
54
52
|
"compile": "tsc --noEmit",
|