@paraspell/sdk-common 11.12.2 → 11.12.4

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
@@ -34,6 +34,9 @@ function _arrayLikeToArray(r, a) {
34
34
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
35
35
  return n;
36
36
  }
37
+ function _arrayWithHoles(r) {
38
+ if (Array.isArray(r)) return r;
39
+ }
37
40
  function _arrayWithoutHoles(r) {
38
41
  if (Array.isArray(r)) return _arrayLikeToArray(r);
39
42
  }
@@ -88,9 +91,39 @@ function _createForOfIteratorHelper(r, e) {
88
91
  function _iterableToArray(r) {
89
92
  if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
90
93
  }
94
+ function _iterableToArrayLimit(r, l) {
95
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
96
+ if (null != t) {
97
+ var e,
98
+ n,
99
+ i,
100
+ u,
101
+ a = [],
102
+ f = true,
103
+ o = false;
104
+ try {
105
+ 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);
106
+ } catch (r) {
107
+ o = true, n = r;
108
+ } finally {
109
+ try {
110
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
111
+ } finally {
112
+ if (o) throw n;
113
+ }
114
+ }
115
+ return a;
116
+ }
117
+ }
118
+ function _nonIterableRest() {
119
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
120
+ }
91
121
  function _nonIterableSpread() {
92
122
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
93
123
  }
124
+ function _slicedToArray(r, e) {
125
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
126
+ }
94
127
  function _toConsumableArray(r) {
95
128
  return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
96
129
  }
@@ -221,8 +254,16 @@ var _deepEqual = function deepEqual(obj1, obj2) {
221
254
  return true;
222
255
  };
223
256
 
224
- var isDotKsmBridge = function isDotKsmBridge(origin, destination) {
225
- return origin === 'AssetHubPolkadot' && destination === 'AssetHubKusama' || origin === 'AssetHubKusama' && destination === 'AssetHubPolkadot';
257
+ var COMPATIBLE_BRIDGES = [['AssetHubPolkadot', 'AssetHubKusama']];
258
+ var isSubstrateBridge = function isSubstrateBridge(origin, destination) {
259
+ if (isExternalChain(origin) || isExternalChain(destination)) return false;
260
+ if (!origin.startsWith('AssetHub') || !destination.startsWith('AssetHub')) return false;
261
+ return COMPATIBLE_BRIDGES.some(function (_ref) {
262
+ var _ref2 = _slicedToArray(_ref, 2),
263
+ a = _ref2[0],
264
+ b = _ref2[1];
265
+ return a === origin && b === destination || b === origin && a === destination;
266
+ });
226
267
  };
227
268
 
228
269
  var flattenJunctions = function flattenJunctions(junctions) {
@@ -293,10 +334,10 @@ exports.SUBSTRATE_CHAINS = SUBSTRATE_CHAINS;
293
334
  exports.deepEqual = _deepEqual;
294
335
  exports.getJunctionValue = getJunctionValue;
295
336
  exports.hasJunction = hasJunction;
296
- exports.isDotKsmBridge = isDotKsmBridge;
297
337
  exports.isExternalChain = isExternalChain;
298
338
  exports.isPrimitive = isPrimitive;
299
339
  exports.isRelayChain = isRelayChain;
340
+ exports.isSubstrateBridge = isSubstrateBridge;
300
341
  exports.isSystemChain = isSystemChain;
301
342
  exports.isTLocation = isTLocation;
302
343
  exports.isTrustedChain = isTrustedChain;
package/dist/index.d.ts CHANGED
@@ -144,12 +144,12 @@ declare const isTrustedChain: (chain: TChain) => boolean;
144
144
  declare const isPrimitive: (obj: unknown) => boolean;
145
145
  declare const deepEqual: (obj1: unknown, obj2: unknown) => boolean;
146
146
 
147
- declare const isDotKsmBridge: (origin: TChain, destination: TChain) => boolean;
147
+ declare const isSubstrateBridge: (origin: TChain, destination: TChain) => boolean;
148
148
 
149
149
  declare const getJunctionValue: <T = unknown>(location: TLocation, junctionType: TJunctionType) => T | undefined;
150
150
  declare const hasJunction: (location: TLocation, junctionType: TJunctionType, junctionValue?: unknown) => boolean;
151
151
 
152
152
  declare const replaceBigInt: (_key: string, value: unknown) => unknown;
153
153
 
154
- export { CHAINS, EXTERNAL_CHAINS, PARACHAINS, Parents, RELAYCHAINS, SUBSTRATE_CHAINS, Version, deepEqual, getJunctionValue, hasJunction, isDotKsmBridge, isExternalChain, isPrimitive, isRelayChain, isSystemChain, isTLocation, isTrustedChain, replaceBigInt };
154
+ export { CHAINS, EXTERNAL_CHAINS, PARACHAINS, Parents, RELAYCHAINS, SUBSTRATE_CHAINS, Version, deepEqual, getJunctionValue, hasJunction, isExternalChain, isPrimitive, isRelayChain, isSubstrateBridge, isSystemChain, isTLocation, isTrustedChain, replaceBigInt };
155
155
  export type { TChain, TExternalChain, TJunction, TJunctionGeneralIndex, TJunctionParachain, TJunctionType, TJunctions, TLocation, TNode, TNodeDotKsmWithRelayChains, TNodePolkadotKusama, TNodeWithRelayChains, TParachain, TRelaychain, TSubstrateChain };
package/dist/index.mjs CHANGED
@@ -32,6 +32,9 @@ function _arrayLikeToArray(r, a) {
32
32
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
33
33
  return n;
34
34
  }
35
+ function _arrayWithHoles(r) {
36
+ if (Array.isArray(r)) return r;
37
+ }
35
38
  function _arrayWithoutHoles(r) {
36
39
  if (Array.isArray(r)) return _arrayLikeToArray(r);
37
40
  }
@@ -86,9 +89,39 @@ function _createForOfIteratorHelper(r, e) {
86
89
  function _iterableToArray(r) {
87
90
  if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
88
91
  }
92
+ function _iterableToArrayLimit(r, l) {
93
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
94
+ if (null != t) {
95
+ var e,
96
+ n,
97
+ i,
98
+ u,
99
+ a = [],
100
+ f = true,
101
+ o = false;
102
+ try {
103
+ 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);
104
+ } catch (r) {
105
+ o = true, n = r;
106
+ } finally {
107
+ try {
108
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
109
+ } finally {
110
+ if (o) throw n;
111
+ }
112
+ }
113
+ return a;
114
+ }
115
+ }
116
+ function _nonIterableRest() {
117
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
118
+ }
89
119
  function _nonIterableSpread() {
90
120
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
91
121
  }
122
+ function _slicedToArray(r, e) {
123
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
124
+ }
92
125
  function _toConsumableArray(r) {
93
126
  return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
94
127
  }
@@ -219,8 +252,16 @@ var _deepEqual = function deepEqual(obj1, obj2) {
219
252
  return true;
220
253
  };
221
254
 
222
- var isDotKsmBridge = function isDotKsmBridge(origin, destination) {
223
- return origin === 'AssetHubPolkadot' && destination === 'AssetHubKusama' || origin === 'AssetHubKusama' && destination === 'AssetHubPolkadot';
255
+ var COMPATIBLE_BRIDGES = [['AssetHubPolkadot', 'AssetHubKusama']];
256
+ var isSubstrateBridge = function isSubstrateBridge(origin, destination) {
257
+ if (isExternalChain(origin) || isExternalChain(destination)) return false;
258
+ if (!origin.startsWith('AssetHub') || !destination.startsWith('AssetHub')) return false;
259
+ return COMPATIBLE_BRIDGES.some(function (_ref) {
260
+ var _ref2 = _slicedToArray(_ref, 2),
261
+ a = _ref2[0],
262
+ b = _ref2[1];
263
+ return a === origin && b === destination || b === origin && a === destination;
264
+ });
224
265
  };
225
266
 
226
267
  var flattenJunctions = function flattenJunctions(junctions) {
@@ -283,4 +324,4 @@ var replaceBigInt = function replaceBigInt(_key, value) {
283
324
  return typeof value === 'bigint' ? value.toString() : value;
284
325
  };
285
326
 
286
- export { CHAINS, EXTERNAL_CHAINS, PARACHAINS, Parents, RELAYCHAINS, SUBSTRATE_CHAINS, Version, _deepEqual as deepEqual, getJunctionValue, hasJunction, isDotKsmBridge, isExternalChain, isPrimitive, isRelayChain, isSystemChain, isTLocation, isTrustedChain, replaceBigInt };
327
+ export { CHAINS, EXTERNAL_CHAINS, PARACHAINS, Parents, RELAYCHAINS, SUBSTRATE_CHAINS, Version, _deepEqual as deepEqual, getJunctionValue, hasJunction, isExternalChain, isPrimitive, isRelayChain, isSubstrateBridge, isSystemChain, isTLocation, isTrustedChain, replaceBigInt };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk-common",
3
- "version": "11.12.2",
3
+ "version": "11.12.4",
4
4
  "description": "SDK common code for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",