@paraspell/sdk-core 8.4.0 → 8.4.2
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 +34 -9
- package/dist/index.mjs +34 -9
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -13921,7 +13921,7 @@ var resolveParaId = function resolveParaId(paraId, destination) {
|
|
|
13921
13921
|
|
|
13922
13922
|
var calculateFee = /*#__PURE__*/function () {
|
|
13923
13923
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(ahApi) {
|
|
13924
|
-
var DEFAULT_FEE, feeStorageItem, leFeeHex, leFee,
|
|
13924
|
+
var DEFAULT_FEE, feeStorageItem, leFeeHex, bytes, reversedHex, validReversedHex, leFee, transferBridgeFee, transferAssethubExecutionFee, totalFee, finalFee;
|
|
13925
13925
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
13926
13926
|
while (1) switch (_context.prev = _context.next) {
|
|
13927
13927
|
case 0:
|
|
@@ -13934,11 +13934,16 @@ var calculateFee = /*#__PURE__*/function () {
|
|
|
13934
13934
|
_context.next = 7;
|
|
13935
13935
|
return ahApi.disconnect();
|
|
13936
13936
|
case 7:
|
|
13937
|
-
|
|
13938
|
-
|
|
13939
|
-
|
|
13940
|
-
|
|
13941
|
-
|
|
13937
|
+
bytes = leFeeHex.match(/.{1,2}/g) || [];
|
|
13938
|
+
reversedHex = bytes.reverse().join('');
|
|
13939
|
+
validReversedHex = reversedHex === '' ? '0' : reversedHex;
|
|
13940
|
+
leFee = BigInt('0x' + validReversedHex);
|
|
13941
|
+
transferBridgeFee = leFee === 0n ? DEFAULT_FEE : BigInt(leFee.toString());
|
|
13942
|
+
transferAssethubExecutionFee = 2200000000n;
|
|
13943
|
+
totalFee = transferBridgeFee + transferAssethubExecutionFee; // Adding a 10% margin
|
|
13944
|
+
finalFee = totalFee * 110n / 100n;
|
|
13945
|
+
return _context.abrupt("return", finalFee.toString());
|
|
13946
|
+
case 16:
|
|
13942
13947
|
case "end":
|
|
13943
13948
|
return _context.stop();
|
|
13944
13949
|
}
|
|
@@ -19073,15 +19078,35 @@ var getNode = function getNode(node) {
|
|
|
19073
19078
|
return nodeMap[node];
|
|
19074
19079
|
};
|
|
19075
19080
|
|
|
19081
|
+
var shuffleArray = function shuffleArray(array) {
|
|
19082
|
+
var copy = _toConsumableArray(array);
|
|
19083
|
+
for (var i = copy.length - 1; i > 0; i--) {
|
|
19084
|
+
var j = Math.floor(Math.random() * (i + 1));
|
|
19085
|
+
var _ref = [copy[j], copy[i]];
|
|
19086
|
+
copy[i] = _ref[0];
|
|
19087
|
+
copy[j] = _ref[1];
|
|
19088
|
+
}
|
|
19089
|
+
return copy;
|
|
19090
|
+
};
|
|
19091
|
+
|
|
19092
|
+
var shuffleWsProviders = function shuffleWsProviders(node, wsProviders) {
|
|
19093
|
+
var ALLOWED_NODES = ['Hydration'];
|
|
19094
|
+
if (ALLOWED_NODES.includes(node)) {
|
|
19095
|
+
return shuffleArray(wsProviders);
|
|
19096
|
+
}
|
|
19097
|
+
return wsProviders;
|
|
19098
|
+
};
|
|
19099
|
+
|
|
19076
19100
|
var createApiInstanceForNode = /*#__PURE__*/function () {
|
|
19077
19101
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(api, node) {
|
|
19078
|
-
var wsUrl;
|
|
19102
|
+
var wsUrl, resolvedWsUrl;
|
|
19079
19103
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
19080
19104
|
while (1) switch (_context.prev = _context.next) {
|
|
19081
19105
|
case 0:
|
|
19082
19106
|
wsUrl = getNodeProviders(node);
|
|
19083
|
-
|
|
19084
|
-
|
|
19107
|
+
resolvedWsUrl = Array.isArray(wsUrl) ? shuffleWsProviders(node, wsUrl) : wsUrl;
|
|
19108
|
+
return _context.abrupt("return", api.createApiInstance(resolvedWsUrl));
|
|
19109
|
+
case 3:
|
|
19085
19110
|
case "end":
|
|
19086
19111
|
return _context.stop();
|
|
19087
19112
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -13919,7 +13919,7 @@ var resolveParaId = function resolveParaId(paraId, destination) {
|
|
|
13919
13919
|
|
|
13920
13920
|
var calculateFee = /*#__PURE__*/function () {
|
|
13921
13921
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(ahApi) {
|
|
13922
|
-
var DEFAULT_FEE, feeStorageItem, leFeeHex, leFee,
|
|
13922
|
+
var DEFAULT_FEE, feeStorageItem, leFeeHex, bytes, reversedHex, validReversedHex, leFee, transferBridgeFee, transferAssethubExecutionFee, totalFee, finalFee;
|
|
13923
13923
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
13924
13924
|
while (1) switch (_context.prev = _context.next) {
|
|
13925
13925
|
case 0:
|
|
@@ -13932,11 +13932,16 @@ var calculateFee = /*#__PURE__*/function () {
|
|
|
13932
13932
|
_context.next = 7;
|
|
13933
13933
|
return ahApi.disconnect();
|
|
13934
13934
|
case 7:
|
|
13935
|
-
|
|
13936
|
-
|
|
13937
|
-
|
|
13938
|
-
|
|
13939
|
-
|
|
13935
|
+
bytes = leFeeHex.match(/.{1,2}/g) || [];
|
|
13936
|
+
reversedHex = bytes.reverse().join('');
|
|
13937
|
+
validReversedHex = reversedHex === '' ? '0' : reversedHex;
|
|
13938
|
+
leFee = BigInt('0x' + validReversedHex);
|
|
13939
|
+
transferBridgeFee = leFee === 0n ? DEFAULT_FEE : BigInt(leFee.toString());
|
|
13940
|
+
transferAssethubExecutionFee = 2200000000n;
|
|
13941
|
+
totalFee = transferBridgeFee + transferAssethubExecutionFee; // Adding a 10% margin
|
|
13942
|
+
finalFee = totalFee * 110n / 100n;
|
|
13943
|
+
return _context.abrupt("return", finalFee.toString());
|
|
13944
|
+
case 16:
|
|
13940
13945
|
case "end":
|
|
13941
13946
|
return _context.stop();
|
|
13942
13947
|
}
|
|
@@ -19071,15 +19076,35 @@ var getNode = function getNode(node) {
|
|
|
19071
19076
|
return nodeMap[node];
|
|
19072
19077
|
};
|
|
19073
19078
|
|
|
19079
|
+
var shuffleArray = function shuffleArray(array) {
|
|
19080
|
+
var copy = _toConsumableArray(array);
|
|
19081
|
+
for (var i = copy.length - 1; i > 0; i--) {
|
|
19082
|
+
var j = Math.floor(Math.random() * (i + 1));
|
|
19083
|
+
var _ref = [copy[j], copy[i]];
|
|
19084
|
+
copy[i] = _ref[0];
|
|
19085
|
+
copy[j] = _ref[1];
|
|
19086
|
+
}
|
|
19087
|
+
return copy;
|
|
19088
|
+
};
|
|
19089
|
+
|
|
19090
|
+
var shuffleWsProviders = function shuffleWsProviders(node, wsProviders) {
|
|
19091
|
+
var ALLOWED_NODES = ['Hydration'];
|
|
19092
|
+
if (ALLOWED_NODES.includes(node)) {
|
|
19093
|
+
return shuffleArray(wsProviders);
|
|
19094
|
+
}
|
|
19095
|
+
return wsProviders;
|
|
19096
|
+
};
|
|
19097
|
+
|
|
19074
19098
|
var createApiInstanceForNode = /*#__PURE__*/function () {
|
|
19075
19099
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(api, node) {
|
|
19076
|
-
var wsUrl;
|
|
19100
|
+
var wsUrl, resolvedWsUrl;
|
|
19077
19101
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
19078
19102
|
while (1) switch (_context.prev = _context.next) {
|
|
19079
19103
|
case 0:
|
|
19080
19104
|
wsUrl = getNodeProviders(node);
|
|
19081
|
-
|
|
19082
|
-
|
|
19105
|
+
resolvedWsUrl = Array.isArray(wsUrl) ? shuffleWsProviders(node, wsUrl) : wsUrl;
|
|
19106
|
+
return _context.abrupt("return", api.createApiInstance(resolvedWsUrl));
|
|
19107
|
+
case 3:
|
|
19083
19108
|
case "end":
|
|
19084
19109
|
return _context.stop();
|
|
19085
19110
|
}
|