@paraspell/sdk-common 12.2.1 → 12.3.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.d.ts CHANGED
@@ -13,11 +13,11 @@ declare const SUBSTRATE_CHAINS: readonly ["AssetHubPolkadot", "Acala", "Ajuna",
13
13
  /**
14
14
  * External chains (non-Substrate/Polkadot ecosystem chains).
15
15
  */
16
- declare const EXTERNAL_CHAINS: readonly ["Ethereum"];
16
+ declare const EXTERNAL_CHAINS: readonly ["Ethereum", "EthereumTestnet"];
17
17
  /**
18
18
  * All supported chains.
19
19
  */
20
- declare const CHAINS: readonly ["AssetHubPolkadot", "Acala", "Ajuna", "Astar", "BifrostPolkadot", "BridgeHubPolkadot", "Centrifuge", "Darwinia", "EnergyWebX", "Hydration", "Interlay", "Heima", "Jamton", "Moonbeam", "CoretimePolkadot", "Collectives", "Crust", "Manta", "Nodle", "NeuroWeb", "Pendulum", "Phala", "KiltSpiritnet", "Curio", "Mythos", "Peaq", "RobonomicsPolkadot", "PeoplePolkadot", "Unique", "Xode", "AssetHubKusama", "BridgeHubKusama", "Karura", "Kintsugi", "Moonriver", "CoretimeKusama", "Encointer", "Altair", "Amplitude", "Basilisk", "BifrostKusama", "CrustShadow", "Crab", "Laos", "Quartz", "PeopleKusama", "Shiden", "Zeitgeist", "AssetHubWestend", "BridgeHubWestend", "CollectivesWestend", "CoretimeWestend", "Penpal", "PeopleWestend", "AjunaPaseo", "AssetHubPaseo", "BifrostPaseo", "BridgeHubPaseo", "CoretimePaseo", "EnergyWebXPaseo", "HeimaPaseo", "HydrationPaseo", "KiltPaseo", "LaosPaseo", "NeuroWebPaseo", "PAssetHub", "PeoplePaseo", "ZeitgeistPaseo", "Polkadot", "Kusama", "Westend", "Paseo", "Ethereum"];
20
+ declare const CHAINS: readonly ["AssetHubPolkadot", "Acala", "Ajuna", "Astar", "BifrostPolkadot", "BridgeHubPolkadot", "Centrifuge", "Darwinia", "EnergyWebX", "Hydration", "Interlay", "Heima", "Jamton", "Moonbeam", "CoretimePolkadot", "Collectives", "Crust", "Manta", "Nodle", "NeuroWeb", "Pendulum", "Phala", "KiltSpiritnet", "Curio", "Mythos", "Peaq", "RobonomicsPolkadot", "PeoplePolkadot", "Unique", "Xode", "AssetHubKusama", "BridgeHubKusama", "Karura", "Kintsugi", "Moonriver", "CoretimeKusama", "Encointer", "Altair", "Amplitude", "Basilisk", "BifrostKusama", "CrustShadow", "Crab", "Laos", "Quartz", "PeopleKusama", "Shiden", "Zeitgeist", "AssetHubWestend", "BridgeHubWestend", "CollectivesWestend", "CoretimeWestend", "Penpal", "PeopleWestend", "AjunaPaseo", "AssetHubPaseo", "BifrostPaseo", "BridgeHubPaseo", "CoretimePaseo", "EnergyWebXPaseo", "HeimaPaseo", "HydrationPaseo", "KiltPaseo", "LaosPaseo", "NeuroWebPaseo", "PAssetHub", "PeoplePaseo", "ZeitgeistPaseo", "Polkadot", "Kusama", "Westend", "Paseo", "Ethereum", "EthereumTestnet"];
21
21
 
22
22
  type TParachain = (typeof PARACHAINS)[number];
23
23
  type TRelaychain = (typeof RELAYCHAINS)[number];
@@ -110,6 +110,10 @@ declare enum Version {
110
110
 
111
111
  declare const isTLocation: (value: unknown) => value is TLocation;
112
112
 
113
+ declare const isSubstrateBridge: (origin: TChain, destination: TChain) => boolean;
114
+ declare const isSnowbridge: (_origin: TChain, destination: TChain) => boolean;
115
+ declare const isBridge: (origin: TChain, destination: TChain) => boolean;
116
+
113
117
  /**
114
118
  * Determines whether a given chain is a relaychain.
115
119
  *
@@ -136,12 +140,10 @@ declare const isTrustedChain: (chain: TChain) => boolean;
136
140
  declare const isPrimitive: (obj: unknown) => boolean;
137
141
  declare const deepEqual: (obj1: unknown, obj2: unknown) => boolean;
138
142
 
139
- declare const isSubstrateBridge: (origin: TChain, destination: TChain) => boolean;
140
-
141
143
  declare const getJunctionValue: <T = unknown>(location: TLocation, junctionType: TJunctionType) => T | undefined;
142
144
  declare const hasJunction: (location: TLocation, junctionType: TJunctionType, junctionValue?: unknown) => boolean;
143
145
 
144
146
  declare const replaceBigInt: (_key: string, value: unknown) => unknown;
145
147
 
146
- export { CHAINS, EXTERNAL_CHAINS, PARACHAINS, Parents, RELAYCHAINS, SUBSTRATE_CHAINS, Version, deepEqual, getJunctionValue, hasJunction, isExternalChain, isPrimitive, isRelayChain, isSubstrateBridge, isSystemChain, isTLocation, isTrustedChain, replaceBigInt };
147
- export type { TChain, TExternalChain, TJunction, TJunctionGeneralIndex, TJunctionParachain, TJunctionType, TJunctions, TLocation, TParachain, TRelaychain, TSubstrateChain };
148
+ export { CHAINS, EXTERNAL_CHAINS, PARACHAINS, Parents, RELAYCHAINS, SUBSTRATE_CHAINS, Version, deepEqual, getJunctionValue, hasJunction, isBridge, isExternalChain, isPrimitive, isRelayChain, isSnowbridge, isSubstrateBridge, isSystemChain, isTLocation, isTrustedChain, replaceBigInt };
149
+ export type { TChain, TExternalChain, TJunction, TJunctionAccountId32, TJunctionAccountIndex64, TJunctionAccountKey20, TJunctionGeneralIndex, TJunctionGeneralKey, TJunctionGlobalConsensus, TJunctionOnlyChild, TJunctionPalletInstance, TJunctionParachain, TJunctionPlurality, TJunctionType, TJunctions, TLocation, TParachain, TRelaychain, TSubstrateChain };
package/dist/index.mjs CHANGED
@@ -21,7 +21,7 @@ var SUBSTRATE_CHAINS = [].concat(PARACHAINS, RELAYCHAINS);
21
21
  /**
22
22
  * External chains (non-Substrate/Polkadot ecosystem chains).
23
23
  */
24
- var EXTERNAL_CHAINS = ['Ethereum'];
24
+ var EXTERNAL_CHAINS = ['Ethereum', 'EthereumTestnet'];
25
25
  /**
26
26
  * All supported chains.
27
27
  */
@@ -199,6 +199,24 @@ var isTrustedChain = function isTrustedChain(chain) {
199
199
  return isTrustedByAh(chain) || isSystemChain(chain);
200
200
  };
201
201
 
202
+ var COMPATIBLE_BRIDGES = [['AssetHubPolkadot', 'AssetHubKusama']];
203
+ var isSubstrateBridge = function isSubstrateBridge(origin, destination) {
204
+ if (isExternalChain(origin) || isExternalChain(destination)) return false;
205
+ if (!origin.startsWith('AssetHub') || !destination.startsWith('AssetHub')) return false;
206
+ return COMPATIBLE_BRIDGES.some(function (_ref) {
207
+ var _ref2 = _slicedToArray(_ref, 2),
208
+ a = _ref2[0],
209
+ b = _ref2[1];
210
+ return a === origin && b === destination || b === origin && a === destination;
211
+ });
212
+ };
213
+ var isSnowbridge = function isSnowbridge(_origin, destination) {
214
+ return isExternalChain(destination);
215
+ };
216
+ var isBridge = function isBridge(origin, destination) {
217
+ return isSubstrateBridge(origin, destination) || isSnowbridge(origin, destination);
218
+ };
219
+
202
220
  var isPrimitive = function isPrimitive(obj) {
203
221
  return obj !== Object(obj);
204
222
  };
@@ -252,18 +270,6 @@ var _deepEqual = function deepEqual(obj1, obj2) {
252
270
  return true;
253
271
  };
254
272
 
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
- });
265
- };
266
-
267
273
  var flattenJunctions = function flattenJunctions(junctions) {
268
274
  if (junctions.Here !== undefined) {
269
275
  return [];
@@ -324,4 +330,4 @@ var replaceBigInt = function replaceBigInt(_key, value) {
324
330
  return typeof value === 'bigint' ? value.toString() : value;
325
331
  };
326
332
 
327
- export { CHAINS, EXTERNAL_CHAINS, PARACHAINS, Parents, RELAYCHAINS, SUBSTRATE_CHAINS, Version, _deepEqual as deepEqual, getJunctionValue, hasJunction, isExternalChain, isPrimitive, isRelayChain, isSubstrateBridge, isSystemChain, isTLocation, isTrustedChain, replaceBigInt };
333
+ export { CHAINS, EXTERNAL_CHAINS, PARACHAINS, Parents, RELAYCHAINS, SUBSTRATE_CHAINS, Version, _deepEqual as deepEqual, getJunctionValue, hasJunction, isBridge, isExternalChain, isPrimitive, isRelayChain, isSnowbridge, isSubstrateBridge, isSystemChain, isTLocation, isTrustedChain, replaceBigInt };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk-common",
3
- "version": "12.2.1",
3
+ "version": "12.3.0",
4
4
  "description": "SDK common code for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",