@paraspell/sdk-core 8.4.0 → 8.4.1

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 CHANGED
@@ -19073,15 +19073,35 @@ var getNode = function getNode(node) {
19073
19073
  return nodeMap[node];
19074
19074
  };
19075
19075
 
19076
+ var shuffleArray = function shuffleArray(array) {
19077
+ var copy = _toConsumableArray(array);
19078
+ for (var i = copy.length - 1; i > 0; i--) {
19079
+ var j = Math.floor(Math.random() * (i + 1));
19080
+ var _ref = [copy[j], copy[i]];
19081
+ copy[i] = _ref[0];
19082
+ copy[j] = _ref[1];
19083
+ }
19084
+ return copy;
19085
+ };
19086
+
19087
+ var shuffleWsProviders = function shuffleWsProviders(node, wsProviders) {
19088
+ var ALLOWED_NODES = ['Hydration'];
19089
+ if (ALLOWED_NODES.includes(node)) {
19090
+ return shuffleArray(wsProviders);
19091
+ }
19092
+ return wsProviders;
19093
+ };
19094
+
19076
19095
  var createApiInstanceForNode = /*#__PURE__*/function () {
19077
19096
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(api, node) {
19078
- var wsUrl;
19097
+ var wsUrl, resolvedWsUrl;
19079
19098
  return _regeneratorRuntime().wrap(function _callee$(_context) {
19080
19099
  while (1) switch (_context.prev = _context.next) {
19081
19100
  case 0:
19082
19101
  wsUrl = getNodeProviders(node);
19083
- return _context.abrupt("return", api.createApiInstance(wsUrl));
19084
- case 2:
19102
+ resolvedWsUrl = Array.isArray(wsUrl) ? shuffleWsProviders(node, wsUrl) : wsUrl;
19103
+ return _context.abrupt("return", api.createApiInstance(resolvedWsUrl));
19104
+ case 3:
19085
19105
  case "end":
19086
19106
  return _context.stop();
19087
19107
  }
package/dist/index.mjs CHANGED
@@ -19071,15 +19071,35 @@ var getNode = function getNode(node) {
19071
19071
  return nodeMap[node];
19072
19072
  };
19073
19073
 
19074
+ var shuffleArray = function shuffleArray(array) {
19075
+ var copy = _toConsumableArray(array);
19076
+ for (var i = copy.length - 1; i > 0; i--) {
19077
+ var j = Math.floor(Math.random() * (i + 1));
19078
+ var _ref = [copy[j], copy[i]];
19079
+ copy[i] = _ref[0];
19080
+ copy[j] = _ref[1];
19081
+ }
19082
+ return copy;
19083
+ };
19084
+
19085
+ var shuffleWsProviders = function shuffleWsProviders(node, wsProviders) {
19086
+ var ALLOWED_NODES = ['Hydration'];
19087
+ if (ALLOWED_NODES.includes(node)) {
19088
+ return shuffleArray(wsProviders);
19089
+ }
19090
+ return wsProviders;
19091
+ };
19092
+
19074
19093
  var createApiInstanceForNode = /*#__PURE__*/function () {
19075
19094
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(api, node) {
19076
- var wsUrl;
19095
+ var wsUrl, resolvedWsUrl;
19077
19096
  return _regeneratorRuntime().wrap(function _callee$(_context) {
19078
19097
  while (1) switch (_context.prev = _context.next) {
19079
19098
  case 0:
19080
19099
  wsUrl = getNodeProviders(node);
19081
- return _context.abrupt("return", api.createApiInstance(wsUrl));
19082
- case 2:
19100
+ resolvedWsUrl = Array.isArray(wsUrl) ? shuffleWsProviders(node, wsUrl) : wsUrl;
19101
+ return _context.abrupt("return", api.createApiInstance(resolvedWsUrl));
19102
+ case 3:
19083
19103
  case "end":
19084
19104
  return _context.stop();
19085
19105
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk-core",
3
- "version": "8.4.0",
3
+ "version": "8.4.1",
4
4
  "description": "SDK core for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",