@paraspell/sdk-pjs 8.9.9 → 8.10.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.cjs +26 -10
- package/dist/index.mjs +26 -10
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -16,6 +16,9 @@ function _arrayLikeToArray(r, a) {
|
|
|
16
16
|
function _arrayWithHoles(r) {
|
|
17
17
|
if (Array.isArray(r)) return r;
|
|
18
18
|
}
|
|
19
|
+
function _arrayWithoutHoles(r) {
|
|
20
|
+
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
21
|
+
}
|
|
19
22
|
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
20
23
|
try {
|
|
21
24
|
var i = n[a](c),
|
|
@@ -63,6 +66,9 @@ function _defineProperty(e, r, t) {
|
|
|
63
66
|
writable: true
|
|
64
67
|
}) : e[r] = t, e;
|
|
65
68
|
}
|
|
69
|
+
function _iterableToArray(r) {
|
|
70
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
71
|
+
}
|
|
66
72
|
function _iterableToArrayLimit(r, l) {
|
|
67
73
|
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
68
74
|
if (null != t) {
|
|
@@ -90,6 +96,9 @@ function _iterableToArrayLimit(r, l) {
|
|
|
90
96
|
function _nonIterableRest() {
|
|
91
97
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
92
98
|
}
|
|
99
|
+
function _nonIterableSpread() {
|
|
100
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
101
|
+
}
|
|
93
102
|
function ownKeys(e, r) {
|
|
94
103
|
var t = Object.keys(e);
|
|
95
104
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -415,6 +424,9 @@ function _regeneratorRuntime() {
|
|
|
415
424
|
function _slicedToArray(r, e) {
|
|
416
425
|
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
417
426
|
}
|
|
427
|
+
function _toConsumableArray(r) {
|
|
428
|
+
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
429
|
+
}
|
|
418
430
|
function _toPrimitive(t, r) {
|
|
419
431
|
if ("object" != typeof t || !t) return t;
|
|
420
432
|
var e = t[Symbol.toPrimitive];
|
|
@@ -945,7 +957,8 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
945
957
|
key: "getDryRun",
|
|
946
958
|
value: function () {
|
|
947
959
|
var _getDryRun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(_ref4) {
|
|
948
|
-
var
|
|
960
|
+
var _this$api$call$dryRun;
|
|
961
|
+
var tx, address, node, supportsDryRunApi, isBifrost, DEFAULT_XCM_VERSION, response, result, isSuccess, moduleError, failureReason, executionFee, fee, actualWeight, weight;
|
|
949
962
|
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
950
963
|
while (1) switch (_context16.prev = _context16.next) {
|
|
951
964
|
case 0:
|
|
@@ -957,18 +970,21 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
957
970
|
}
|
|
958
971
|
throw new sdkCore.NodeNotSupportedError("DryRunApi is not available on node ".concat(node));
|
|
959
972
|
case 4:
|
|
960
|
-
|
|
961
|
-
|
|
973
|
+
// Bifrost requires a third parameter XCM version
|
|
974
|
+
isBifrost = node === 'BifrostPolkadot' || node === 'BifrostKusama';
|
|
975
|
+
DEFAULT_XCM_VERSION = 3;
|
|
976
|
+
_context16.next = 8;
|
|
977
|
+
return (_this$api$call$dryRun = this.api.call.dryRunApi).dryRunCall.apply(_this$api$call$dryRun, [{
|
|
962
978
|
system: {
|
|
963
979
|
Signed: address
|
|
964
980
|
}
|
|
965
|
-
}, tx);
|
|
966
|
-
case
|
|
981
|
+
}, tx].concat(_toConsumableArray(isBifrost ? [DEFAULT_XCM_VERSION] : [])));
|
|
982
|
+
case 8:
|
|
967
983
|
response = _context16.sent;
|
|
968
984
|
result = response.toHuman();
|
|
969
985
|
isSuccess = result.Ok && result.Ok.executionResult.Ok;
|
|
970
986
|
if (isSuccess) {
|
|
971
|
-
_context16.next =
|
|
987
|
+
_context16.next = 15;
|
|
972
988
|
break;
|
|
973
989
|
}
|
|
974
990
|
moduleError = result.Ok.executionResult.Err.error.Module;
|
|
@@ -977,10 +993,10 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
977
993
|
success: false,
|
|
978
994
|
failureReason: failureReason
|
|
979
995
|
});
|
|
980
|
-
case 13:
|
|
981
|
-
_context16.next = 15;
|
|
982
|
-
return this.calculateTransactionFee(tx, address);
|
|
983
996
|
case 15:
|
|
997
|
+
_context16.next = 17;
|
|
998
|
+
return this.calculateTransactionFee(tx, address);
|
|
999
|
+
case 17:
|
|
984
1000
|
executionFee = _context16.sent;
|
|
985
1001
|
fee = sdkCore.computeFeeFromDryRunPjs(result, node, executionFee);
|
|
986
1002
|
actualWeight = response.toJSON().ok.executionResult.ok.actualWeight;
|
|
@@ -993,7 +1009,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
993
1009
|
fee: fee,
|
|
994
1010
|
weight: weight
|
|
995
1011
|
});
|
|
996
|
-
case
|
|
1012
|
+
case 22:
|
|
997
1013
|
case "end":
|
|
998
1014
|
return _context16.stop();
|
|
999
1015
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -15,6 +15,9 @@ function _arrayLikeToArray(r, a) {
|
|
|
15
15
|
function _arrayWithHoles(r) {
|
|
16
16
|
if (Array.isArray(r)) return r;
|
|
17
17
|
}
|
|
18
|
+
function _arrayWithoutHoles(r) {
|
|
19
|
+
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
20
|
+
}
|
|
18
21
|
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
19
22
|
try {
|
|
20
23
|
var i = n[a](c),
|
|
@@ -62,6 +65,9 @@ function _defineProperty(e, r, t) {
|
|
|
62
65
|
writable: true
|
|
63
66
|
}) : e[r] = t, e;
|
|
64
67
|
}
|
|
68
|
+
function _iterableToArray(r) {
|
|
69
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
70
|
+
}
|
|
65
71
|
function _iterableToArrayLimit(r, l) {
|
|
66
72
|
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
67
73
|
if (null != t) {
|
|
@@ -89,6 +95,9 @@ function _iterableToArrayLimit(r, l) {
|
|
|
89
95
|
function _nonIterableRest() {
|
|
90
96
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
91
97
|
}
|
|
98
|
+
function _nonIterableSpread() {
|
|
99
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
100
|
+
}
|
|
92
101
|
function ownKeys(e, r) {
|
|
93
102
|
var t = Object.keys(e);
|
|
94
103
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -414,6 +423,9 @@ function _regeneratorRuntime() {
|
|
|
414
423
|
function _slicedToArray(r, e) {
|
|
415
424
|
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
416
425
|
}
|
|
426
|
+
function _toConsumableArray(r) {
|
|
427
|
+
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
428
|
+
}
|
|
417
429
|
function _toPrimitive(t, r) {
|
|
418
430
|
if ("object" != typeof t || !t) return t;
|
|
419
431
|
var e = t[Symbol.toPrimitive];
|
|
@@ -944,7 +956,8 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
944
956
|
key: "getDryRun",
|
|
945
957
|
value: function () {
|
|
946
958
|
var _getDryRun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(_ref4) {
|
|
947
|
-
var
|
|
959
|
+
var _this$api$call$dryRun;
|
|
960
|
+
var tx, address, node, supportsDryRunApi, isBifrost, DEFAULT_XCM_VERSION, response, result, isSuccess, moduleError, failureReason, executionFee, fee, actualWeight, weight;
|
|
948
961
|
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
949
962
|
while (1) switch (_context16.prev = _context16.next) {
|
|
950
963
|
case 0:
|
|
@@ -956,18 +969,21 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
956
969
|
}
|
|
957
970
|
throw new NodeNotSupportedError("DryRunApi is not available on node ".concat(node));
|
|
958
971
|
case 4:
|
|
959
|
-
|
|
960
|
-
|
|
972
|
+
// Bifrost requires a third parameter XCM version
|
|
973
|
+
isBifrost = node === 'BifrostPolkadot' || node === 'BifrostKusama';
|
|
974
|
+
DEFAULT_XCM_VERSION = 3;
|
|
975
|
+
_context16.next = 8;
|
|
976
|
+
return (_this$api$call$dryRun = this.api.call.dryRunApi).dryRunCall.apply(_this$api$call$dryRun, [{
|
|
961
977
|
system: {
|
|
962
978
|
Signed: address
|
|
963
979
|
}
|
|
964
|
-
}, tx);
|
|
965
|
-
case
|
|
980
|
+
}, tx].concat(_toConsumableArray(isBifrost ? [DEFAULT_XCM_VERSION] : [])));
|
|
981
|
+
case 8:
|
|
966
982
|
response = _context16.sent;
|
|
967
983
|
result = response.toHuman();
|
|
968
984
|
isSuccess = result.Ok && result.Ok.executionResult.Ok;
|
|
969
985
|
if (isSuccess) {
|
|
970
|
-
_context16.next =
|
|
986
|
+
_context16.next = 15;
|
|
971
987
|
break;
|
|
972
988
|
}
|
|
973
989
|
moduleError = result.Ok.executionResult.Err.error.Module;
|
|
@@ -976,10 +992,10 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
976
992
|
success: false,
|
|
977
993
|
failureReason: failureReason
|
|
978
994
|
});
|
|
979
|
-
case 13:
|
|
980
|
-
_context16.next = 15;
|
|
981
|
-
return this.calculateTransactionFee(tx, address);
|
|
982
995
|
case 15:
|
|
996
|
+
_context16.next = 17;
|
|
997
|
+
return this.calculateTransactionFee(tx, address);
|
|
998
|
+
case 17:
|
|
983
999
|
executionFee = _context16.sent;
|
|
984
1000
|
fee = computeFeeFromDryRunPjs(result, node, executionFee);
|
|
985
1001
|
actualWeight = response.toJSON().ok.executionResult.ok.actualWeight;
|
|
@@ -992,7 +1008,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
992
1008
|
fee: fee,
|
|
993
1009
|
weight: weight
|
|
994
1010
|
});
|
|
995
|
-
case
|
|
1011
|
+
case 22:
|
|
996
1012
|
case "end":
|
|
997
1013
|
return _context16.stop();
|
|
998
1014
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk-pjs",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.10.0",
|
|
4
4
|
"description": "Polkadot.js based SDK for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@snowbridge/contract-types": "0.1.45",
|
|
28
28
|
"ethers": "^6.13.5",
|
|
29
29
|
"viem": "^2.23.15",
|
|
30
|
-
"@paraspell/sdk-core": "8.
|
|
30
|
+
"@paraspell/sdk-core": "8.10.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@polkadot/api": ">= 15.0 < 16",
|