@paraspell/sdk-common 10.11.10 → 11.0.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 +49 -49
- package/dist/index.d.ts +42 -37
- package/dist/index.mjs +44 -44
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Supported Polkadot / Kusama / Westend / Paseo parachains.
|
|
5
|
+
*/
|
|
6
|
+
var PARACHAINS = ['AssetHubPolkadot', 'Acala', 'Ajuna', 'Astar', 'BifrostPolkadot', 'BridgeHubPolkadot', 'BridgeHubKusama', 'Centrifuge', 'ComposableFinance', 'Darwinia', 'EnergyWebX', 'EnergyWebXPaseo', 'Hydration', 'IntegriteeKusama', 'IntegriteePaseo', 'Interlay', 'Heima', 'Jamton', 'Moonbeam', 'AssetHubKusama', 'CoretimeKusama', 'CoretimePolkadot', 'Encointer', 'Altair', 'Amplitude', 'Basilisk', 'BifrostKusama', 'CrustShadow', 'Crab', 'Karura', 'Kintsugi', 'Moonriver', 'Laos', 'Quartz', 'RobonomicsKusama', 'RobonomicsPolkadot', 'PeoplePolkadot', 'PeopleKusama', 'Shiden', 'Unique', 'Crust', 'Manta', 'Nodle', 'NeuroWeb', 'Pendulum', 'Zeitgeist', 'Collectives', 'Phala', 'Subsocial', 'KiltSpiritnet', 'Curio', 'Mythos', 'Peaq', 'Polimec',
|
|
7
|
+
// Westend testnet chains
|
|
8
|
+
'AssetHubWestend', 'BridgeHubWestend', 'CollectivesWestend', 'CoretimeWestend', 'PeopleWestend', 'Penpal',
|
|
9
|
+
// Paseo testnet chains
|
|
10
|
+
'AssetHubPaseo', 'BridgeHubPaseo', 'CoretimePaseo', 'PAssetHub', 'PeoplePaseo', 'AjunaPaseo', 'BifrostPaseo', 'HeimaPaseo', 'HydrationPaseo', 'KiltPaseo', 'LaosPaseo', 'NeuroWebPaseo', 'NodlePaseo', 'ZeitgeistPaseo'];
|
|
11
|
+
/**
|
|
12
|
+
* Relaychains.
|
|
13
|
+
*/
|
|
14
|
+
var RELAYCHAINS = ['Polkadot', 'Kusama', 'Westend', 'Paseo'];
|
|
15
|
+
/**
|
|
16
|
+
* All Substrate chains (parachains + relaychains).
|
|
17
|
+
*/
|
|
18
|
+
var SUBSTRATE_CHAINS = [].concat(PARACHAINS, RELAYCHAINS);
|
|
19
|
+
/**
|
|
20
|
+
* External chains (non-Substrate/Polkadot ecosystem chains).
|
|
21
|
+
*/
|
|
22
|
+
var EXTERNAL_CHAINS = ['Ethereum'];
|
|
23
|
+
/**
|
|
24
|
+
* All supported chains.
|
|
25
|
+
*/
|
|
26
|
+
var CHAINS = [].concat(PARACHAINS, RELAYCHAINS, EXTERNAL_CHAINS);
|
|
27
|
+
|
|
3
28
|
function _arrayLikeToArray(r, a) {
|
|
4
29
|
(null == a || a > r.length) && (a = r.length);
|
|
5
30
|
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
@@ -82,32 +107,7 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
82
107
|
}
|
|
83
108
|
}
|
|
84
109
|
|
|
85
|
-
|
|
86
|
-
* Supported nodes excluding relay chains and Ethereum.
|
|
87
|
-
*/
|
|
88
|
-
var NODE_NAMES_DOT_KSM = ['AssetHubPolkadot', 'Acala', 'Ajuna', 'Astar', 'BifrostPolkadot', 'BridgeHubPolkadot', 'BridgeHubKusama', 'Centrifuge', 'ComposableFinance', 'Darwinia', 'EnergyWebX', 'EnergyWebXPaseo', 'Hydration', 'IntegriteeKusama', 'IntegriteePaseo', 'Interlay', 'Heima', 'Jamton', 'Moonbeam', 'AssetHubKusama', 'CoretimeKusama', 'CoretimePolkadot', 'Encointer', 'Altair', 'Amplitude', 'Basilisk', 'BifrostKusama', 'CrustShadow', 'Crab', 'Karura', 'Kintsugi', 'Moonriver', 'Laos', 'Quartz', 'RobonomicsKusama', 'RobonomicsPolkadot', 'PeoplePolkadot', 'PeopleKusama', 'Shiden', 'Unique', 'Crust', 'Manta', 'Nodle', 'NeuroWeb', 'Pendulum', 'Zeitgeist', 'Collectives', 'Phala', 'Subsocial', 'KiltSpiritnet', 'Curio', 'Mythos', 'Peaq', 'Polimec',
|
|
89
|
-
// Westend testnet chains
|
|
90
|
-
'AssetHubWestend', 'BridgeHubWestend', 'CollectivesWestend', 'CoretimeWestend', 'PeopleWestend', 'Penpal',
|
|
91
|
-
// Paseo testnet chains
|
|
92
|
-
'AssetHubPaseo', 'BridgeHubPaseo', 'CoretimePaseo', 'PAssetHub', 'PeoplePaseo', 'AjunaPaseo', 'BifrostPaseo', 'HeimaPaseo', 'HydrationPaseo', 'KiltPaseo', 'LaosPaseo', 'NeuroWebPaseo', 'NodlePaseo', 'ZeitgeistPaseo'];
|
|
93
|
-
/**
|
|
94
|
-
* Supported nodes including Ethereum.
|
|
95
|
-
*/
|
|
96
|
-
var NODE_NAMES = [].concat(NODE_NAMES_DOT_KSM, ['Ethereum']);
|
|
97
|
-
/**
|
|
98
|
-
* Relay chains.
|
|
99
|
-
*/
|
|
100
|
-
var RELAY_CHAINS = ['Polkadot', 'Kusama', 'Westend', 'Paseo'];
|
|
101
|
-
/**
|
|
102
|
-
* Supported nodes including relay chains and Ethereum.
|
|
103
|
-
*/
|
|
104
|
-
var NODES_WITH_RELAY_CHAINS = [].concat(_toConsumableArray(NODE_NAMES), RELAY_CHAINS);
|
|
105
|
-
/**
|
|
106
|
-
* Supported nodes including relay chains and excluding Ethereum.
|
|
107
|
-
*/
|
|
108
|
-
var NODES_WITH_RELAY_CHAINS_DOT_KSM = [].concat(NODE_NAMES_DOT_KSM, RELAY_CHAINS);
|
|
109
|
-
|
|
110
|
-
var isTMultiLocation = function isTMultiLocation(value) {
|
|
110
|
+
var isTLocation = function isTLocation(value) {
|
|
111
111
|
return _typeof(value) === 'object' && value !== null && 'parents' in value && 'interior' in value;
|
|
112
112
|
};
|
|
113
113
|
|
|
@@ -129,23 +129,23 @@ exports.Version = void 0;
|
|
|
129
129
|
})(exports.Version || (exports.Version = {}));
|
|
130
130
|
|
|
131
131
|
/**
|
|
132
|
-
* Determines whether a given
|
|
132
|
+
* Determines whether a given chain is a relaychain.
|
|
133
133
|
*
|
|
134
|
-
* @param
|
|
135
|
-
* @returns True if the
|
|
134
|
+
* @param chain - The chain to check.
|
|
135
|
+
* @returns True if the chain is a relaychain; otherwise, false.
|
|
136
136
|
*/
|
|
137
|
-
var isRelayChain = function isRelayChain(
|
|
138
|
-
return
|
|
137
|
+
var isRelayChain = function isRelayChain(chain) {
|
|
138
|
+
return RELAYCHAINS.includes(chain);
|
|
139
139
|
};
|
|
140
140
|
/**
|
|
141
|
-
* Checks if a given
|
|
141
|
+
* Checks if a given chain is a system chain.
|
|
142
142
|
*
|
|
143
|
-
* @param
|
|
144
|
-
* @returns True if the
|
|
143
|
+
* @param chain - The chain to check.
|
|
144
|
+
* @returns True if the chain is a system chain; otherwise, false.
|
|
145
145
|
*/
|
|
146
|
-
var isSystemChain = function isSystemChain(
|
|
146
|
+
var isSystemChain = function isSystemChain(chain) {
|
|
147
147
|
var systemChains = ['AssetHubPolkadot', 'AssetHubKusama', 'AssetHubWestend', 'AssetHubPaseo', 'BridgeHubPolkadot', 'BridgeHubKusama', 'BridgeHubWestend', 'BridgeHubPaseo', 'PeoplePolkadot', 'PeopleKusama', 'PeopleWestend', 'PeoplePaseo', 'CoretimePolkadot', 'CoretimeKusama', 'CoretimeWestend', 'CoretimePaseo', 'Collectives', 'CollectivesWestend', 'Mythos'];
|
|
148
|
-
return systemChains.includes(
|
|
148
|
+
return systemChains.includes(chain) || isRelayChain(chain);
|
|
149
149
|
};
|
|
150
150
|
|
|
151
151
|
var isPrimitive = function isPrimitive(obj) {
|
|
@@ -227,11 +227,11 @@ var flattenJunctions = function flattenJunctions(junctions) {
|
|
|
227
227
|
return result;
|
|
228
228
|
};
|
|
229
229
|
|
|
230
|
-
var findMatchingJunction = function findMatchingJunction(
|
|
231
|
-
if (
|
|
230
|
+
var findMatchingJunction = function findMatchingJunction(location, junctionType) {
|
|
231
|
+
if (location.interior === 'Here') {
|
|
232
232
|
return undefined;
|
|
233
233
|
}
|
|
234
|
-
var allJunctions = flattenJunctions(
|
|
234
|
+
var allJunctions = flattenJunctions(location.interior);
|
|
235
235
|
return allJunctions.find(function (junction) {
|
|
236
236
|
var keys = Object.keys(junction);
|
|
237
237
|
if (keys.length !== 1) {
|
|
@@ -241,12 +241,12 @@ var findMatchingJunction = function findMatchingJunction(multiLocation, junction
|
|
|
241
241
|
return key === junctionType;
|
|
242
242
|
});
|
|
243
243
|
};
|
|
244
|
-
var getJunctionValue = function getJunctionValue(
|
|
245
|
-
var matchingJunction = findMatchingJunction(
|
|
244
|
+
var getJunctionValue = function getJunctionValue(location, junctionType) {
|
|
245
|
+
var matchingJunction = findMatchingJunction(location, junctionType);
|
|
246
246
|
return matchingJunction ? matchingJunction[junctionType] : undefined;
|
|
247
247
|
};
|
|
248
|
-
var hasJunction = function hasJunction(
|
|
249
|
-
var matchingJunction = findMatchingJunction(
|
|
248
|
+
var hasJunction = function hasJunction(location, junctionType, junctionValue) {
|
|
249
|
+
var matchingJunction = findMatchingJunction(location, junctionType);
|
|
250
250
|
if (!matchingJunction) {
|
|
251
251
|
return false;
|
|
252
252
|
}
|
|
@@ -265,11 +265,11 @@ var replaceBigInt = function replaceBigInt(_key, value) {
|
|
|
265
265
|
return typeof value === 'bigint' ? value.toString() : value;
|
|
266
266
|
};
|
|
267
267
|
|
|
268
|
-
exports.
|
|
269
|
-
exports.
|
|
270
|
-
exports.
|
|
271
|
-
exports.
|
|
272
|
-
exports.
|
|
268
|
+
exports.CHAINS = CHAINS;
|
|
269
|
+
exports.EXTERNAL_CHAINS = EXTERNAL_CHAINS;
|
|
270
|
+
exports.PARACHAINS = PARACHAINS;
|
|
271
|
+
exports.RELAYCHAINS = RELAYCHAINS;
|
|
272
|
+
exports.SUBSTRATE_CHAINS = SUBSTRATE_CHAINS;
|
|
273
273
|
exports.deepEqual = _deepEqual;
|
|
274
274
|
exports.getJunctionValue = getJunctionValue;
|
|
275
275
|
exports.hasJunction = hasJunction;
|
|
@@ -277,5 +277,5 @@ exports.isDotKsmBridge = isDotKsmBridge;
|
|
|
277
277
|
exports.isPrimitive = isPrimitive;
|
|
278
278
|
exports.isRelayChain = isRelayChain;
|
|
279
279
|
exports.isSystemChain = isSystemChain;
|
|
280
|
-
exports.
|
|
280
|
+
exports.isTLocation = isTLocation;
|
|
281
281
|
exports.replaceBigInt = replaceBigInt;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,23 +1,37 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Supported
|
|
2
|
+
* Supported Polkadot / Kusama / Westend / Paseo parachains.
|
|
3
3
|
*/
|
|
4
|
-
declare const
|
|
4
|
+
declare const PARACHAINS: readonly ["AssetHubPolkadot", "Acala", "Ajuna", "Astar", "BifrostPolkadot", "BridgeHubPolkadot", "BridgeHubKusama", "Centrifuge", "ComposableFinance", "Darwinia", "EnergyWebX", "EnergyWebXPaseo", "Hydration", "IntegriteeKusama", "IntegriteePaseo", "Interlay", "Heima", "Jamton", "Moonbeam", "AssetHubKusama", "CoretimeKusama", "CoretimePolkadot", "Encointer", "Altair", "Amplitude", "Basilisk", "BifrostKusama", "CrustShadow", "Crab", "Karura", "Kintsugi", "Moonriver", "Laos", "Quartz", "RobonomicsKusama", "RobonomicsPolkadot", "PeoplePolkadot", "PeopleKusama", "Shiden", "Unique", "Crust", "Manta", "Nodle", "NeuroWeb", "Pendulum", "Zeitgeist", "Collectives", "Phala", "Subsocial", "KiltSpiritnet", "Curio", "Mythos", "Peaq", "Polimec", "AssetHubWestend", "BridgeHubWestend", "CollectivesWestend", "CoretimeWestend", "PeopleWestend", "Penpal", "AssetHubPaseo", "BridgeHubPaseo", "CoretimePaseo", "PAssetHub", "PeoplePaseo", "AjunaPaseo", "BifrostPaseo", "HeimaPaseo", "HydrationPaseo", "KiltPaseo", "LaosPaseo", "NeuroWebPaseo", "NodlePaseo", "ZeitgeistPaseo"];
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Relaychains.
|
|
7
7
|
*/
|
|
8
|
-
declare const
|
|
8
|
+
declare const RELAYCHAINS: readonly ["Polkadot", "Kusama", "Westend", "Paseo"];
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* All Substrate chains (parachains + relaychains).
|
|
11
11
|
*/
|
|
12
|
-
declare const
|
|
12
|
+
declare const SUBSTRATE_CHAINS: readonly ["AssetHubPolkadot", "Acala", "Ajuna", "Astar", "BifrostPolkadot", "BridgeHubPolkadot", "BridgeHubKusama", "Centrifuge", "ComposableFinance", "Darwinia", "EnergyWebX", "EnergyWebXPaseo", "Hydration", "IntegriteeKusama", "IntegriteePaseo", "Interlay", "Heima", "Jamton", "Moonbeam", "AssetHubKusama", "CoretimeKusama", "CoretimePolkadot", "Encointer", "Altair", "Amplitude", "Basilisk", "BifrostKusama", "CrustShadow", "Crab", "Karura", "Kintsugi", "Moonriver", "Laos", "Quartz", "RobonomicsKusama", "RobonomicsPolkadot", "PeoplePolkadot", "PeopleKusama", "Shiden", "Unique", "Crust", "Manta", "Nodle", "NeuroWeb", "Pendulum", "Zeitgeist", "Collectives", "Phala", "Subsocial", "KiltSpiritnet", "Curio", "Mythos", "Peaq", "Polimec", "AssetHubWestend", "BridgeHubWestend", "CollectivesWestend", "CoretimeWestend", "PeopleWestend", "Penpal", "AssetHubPaseo", "BridgeHubPaseo", "CoretimePaseo", "PAssetHub", "PeoplePaseo", "AjunaPaseo", "BifrostPaseo", "HeimaPaseo", "HydrationPaseo", "KiltPaseo", "LaosPaseo", "NeuroWebPaseo", "NodlePaseo", "ZeitgeistPaseo", "Polkadot", "Kusama", "Westend", "Paseo"];
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* External chains (non-Substrate/Polkadot ecosystem chains).
|
|
15
15
|
*/
|
|
16
|
-
declare const
|
|
16
|
+
declare const EXTERNAL_CHAINS: readonly ["Ethereum"];
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* All supported chains.
|
|
19
19
|
*/
|
|
20
|
-
declare const
|
|
20
|
+
declare const CHAINS: readonly ["AssetHubPolkadot", "Acala", "Ajuna", "Astar", "BifrostPolkadot", "BridgeHubPolkadot", "BridgeHubKusama", "Centrifuge", "ComposableFinance", "Darwinia", "EnergyWebX", "EnergyWebXPaseo", "Hydration", "IntegriteeKusama", "IntegriteePaseo", "Interlay", "Heima", "Jamton", "Moonbeam", "AssetHubKusama", "CoretimeKusama", "CoretimePolkadot", "Encointer", "Altair", "Amplitude", "Basilisk", "BifrostKusama", "CrustShadow", "Crab", "Karura", "Kintsugi", "Moonriver", "Laos", "Quartz", "RobonomicsKusama", "RobonomicsPolkadot", "PeoplePolkadot", "PeopleKusama", "Shiden", "Unique", "Crust", "Manta", "Nodle", "NeuroWeb", "Pendulum", "Zeitgeist", "Collectives", "Phala", "Subsocial", "KiltSpiritnet", "Curio", "Mythos", "Peaq", "Polimec", "AssetHubWestend", "BridgeHubWestend", "CollectivesWestend", "CoretimeWestend", "PeopleWestend", "Penpal", "AssetHubPaseo", "BridgeHubPaseo", "CoretimePaseo", "PAssetHub", "PeoplePaseo", "AjunaPaseo", "BifrostPaseo", "HeimaPaseo", "HydrationPaseo", "KiltPaseo", "LaosPaseo", "NeuroWebPaseo", "NodlePaseo", "ZeitgeistPaseo", "Polkadot", "Kusama", "Westend", "Paseo", "Ethereum"];
|
|
21
|
+
|
|
22
|
+
type TParachain = (typeof PARACHAINS)[number];
|
|
23
|
+
type TRelaychain = (typeof RELAYCHAINS)[number];
|
|
24
|
+
type TSubstrateChain = (typeof SUBSTRATE_CHAINS)[number];
|
|
25
|
+
type TExternalChain = (typeof EXTERNAL_CHAINS)[number];
|
|
26
|
+
type TChain = (typeof CHAINS)[number];
|
|
27
|
+
/** @deprecated Use `TChain` instead. */
|
|
28
|
+
type TNode = TChain;
|
|
29
|
+
/** @deprecated Use `TChain` instead. */
|
|
30
|
+
type TNodeWithRelayChains = TChain;
|
|
31
|
+
/** @deprecated Use `TParachain` instead. */
|
|
32
|
+
type TNodePolkadotKusama = TParachain;
|
|
33
|
+
/** @deprecated Use `TSubstrateChain` instead. */
|
|
34
|
+
type TNodeDotKsmWithRelayChains = TSubstrateChain;
|
|
21
35
|
|
|
22
36
|
declare enum Parents {
|
|
23
37
|
ZERO = 0,
|
|
@@ -77,7 +91,7 @@ type TJunctionGlobalConsensus = {
|
|
|
77
91
|
GlobalConsensus: TNetworkId | object;
|
|
78
92
|
};
|
|
79
93
|
type TJunction = TJunctionParachain | TJunctionAccountId32 | TJunctionAccountIndex64 | TJunctionAccountKey20 | TJunctionPalletInstance | TJunctionGeneralIndex | TJunctionGeneralKey | TJunctionOnlyChild | TJunctionPlurality | TJunctionGlobalConsensus;
|
|
80
|
-
|
|
94
|
+
type TJunctions = {
|
|
81
95
|
Here?: null;
|
|
82
96
|
X1?: TJunction | TJunction[];
|
|
83
97
|
X2?: TJunction[];
|
|
@@ -87,20 +101,11 @@ interface TJunctions {
|
|
|
87
101
|
X6?: TJunction[];
|
|
88
102
|
X7?: TJunction[];
|
|
89
103
|
X8?: TJunction[];
|
|
90
|
-
}
|
|
91
|
-
|
|
104
|
+
};
|
|
105
|
+
type TLocation = {
|
|
92
106
|
parents: TStringOrNumber;
|
|
93
107
|
interior: TJunctions | 'Here';
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
type TNode = (typeof NODE_NAMES)[number];
|
|
97
|
-
type TRelayChain = (typeof RELAY_CHAINS)[number];
|
|
98
|
-
type TNodePolkadotKusama = Exclude<TNode, 'Ethereum'>;
|
|
99
|
-
type TNodeWithRelayChains = (typeof NODES_WITH_RELAY_CHAINS)[number];
|
|
100
|
-
type TNodeDotKsmWithRelayChains = Exclude<TNodeWithRelayChains, 'Ethereum'>;
|
|
101
|
-
|
|
102
|
-
type TEcosystemType = 'polkadot' | 'kusama' | 'westend' | 'paseo' | 'ethereum';
|
|
103
|
-
type TRelayChainSymbol = 'DOT' | 'KSM' | 'WND' | 'PAS';
|
|
108
|
+
};
|
|
104
109
|
|
|
105
110
|
/**
|
|
106
111
|
* The XCM version.
|
|
@@ -111,32 +116,32 @@ declare enum Version {
|
|
|
111
116
|
V5 = "V5"
|
|
112
117
|
}
|
|
113
118
|
|
|
114
|
-
declare const
|
|
119
|
+
declare const isTLocation: (value: unknown) => value is TLocation;
|
|
115
120
|
|
|
116
121
|
/**
|
|
117
|
-
* Determines whether a given
|
|
122
|
+
* Determines whether a given chain is a relaychain.
|
|
118
123
|
*
|
|
119
|
-
* @param
|
|
120
|
-
* @returns True if the
|
|
124
|
+
* @param chain - The chain to check.
|
|
125
|
+
* @returns True if the chain is a relaychain; otherwise, false.
|
|
121
126
|
*/
|
|
122
|
-
declare const isRelayChain: (
|
|
127
|
+
declare const isRelayChain: (chain: TChain) => chain is TRelaychain;
|
|
123
128
|
/**
|
|
124
|
-
* Checks if a given
|
|
129
|
+
* Checks if a given chain is a system chain.
|
|
125
130
|
*
|
|
126
|
-
* @param
|
|
127
|
-
* @returns True if the
|
|
131
|
+
* @param chain - The chain to check.
|
|
132
|
+
* @returns True if the chain is a system chain; otherwise, false.
|
|
128
133
|
*/
|
|
129
|
-
declare const isSystemChain: (
|
|
134
|
+
declare const isSystemChain: (chain: TChain) => boolean;
|
|
130
135
|
|
|
131
136
|
declare const isPrimitive: (obj: unknown) => boolean;
|
|
132
137
|
declare const deepEqual: (obj1: unknown, obj2: unknown) => boolean;
|
|
133
138
|
|
|
134
|
-
declare const isDotKsmBridge: (origin:
|
|
139
|
+
declare const isDotKsmBridge: (origin: TChain, destination: TChain) => boolean;
|
|
135
140
|
|
|
136
|
-
declare const getJunctionValue: <T = unknown>(
|
|
137
|
-
declare const hasJunction: (
|
|
141
|
+
declare const getJunctionValue: <T = unknown>(location: TLocation, junctionType: TJunctionType) => T | undefined;
|
|
142
|
+
declare const hasJunction: (location: TLocation, junctionType: TJunctionType, junctionValue?: unknown) => boolean;
|
|
138
143
|
|
|
139
144
|
declare const replaceBigInt: (_key: string, value: unknown) => unknown;
|
|
140
145
|
|
|
141
|
-
export {
|
|
142
|
-
export type {
|
|
146
|
+
export { CHAINS, EXTERNAL_CHAINS, PARACHAINS, Parents, RELAYCHAINS, SUBSTRATE_CHAINS, Version, deepEqual, getJunctionValue, hasJunction, isDotKsmBridge, isPrimitive, isRelayChain, isSystemChain, isTLocation, replaceBigInt };
|
|
147
|
+
export type { TChain, TExternalChain, TJunction, TJunctionGeneralIndex, TJunctionParachain, TJunctionType, TJunctions, TLocation, TNode, TNodeDotKsmWithRelayChains, TNodePolkadotKusama, TNodeWithRelayChains, TParachain, TRelaychain, TSubstrateChain };
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supported Polkadot / Kusama / Westend / Paseo parachains.
|
|
3
|
+
*/
|
|
4
|
+
var PARACHAINS = ['AssetHubPolkadot', 'Acala', 'Ajuna', 'Astar', 'BifrostPolkadot', 'BridgeHubPolkadot', 'BridgeHubKusama', 'Centrifuge', 'ComposableFinance', 'Darwinia', 'EnergyWebX', 'EnergyWebXPaseo', 'Hydration', 'IntegriteeKusama', 'IntegriteePaseo', 'Interlay', 'Heima', 'Jamton', 'Moonbeam', 'AssetHubKusama', 'CoretimeKusama', 'CoretimePolkadot', 'Encointer', 'Altair', 'Amplitude', 'Basilisk', 'BifrostKusama', 'CrustShadow', 'Crab', 'Karura', 'Kintsugi', 'Moonriver', 'Laos', 'Quartz', 'RobonomicsKusama', 'RobonomicsPolkadot', 'PeoplePolkadot', 'PeopleKusama', 'Shiden', 'Unique', 'Crust', 'Manta', 'Nodle', 'NeuroWeb', 'Pendulum', 'Zeitgeist', 'Collectives', 'Phala', 'Subsocial', 'KiltSpiritnet', 'Curio', 'Mythos', 'Peaq', 'Polimec',
|
|
5
|
+
// Westend testnet chains
|
|
6
|
+
'AssetHubWestend', 'BridgeHubWestend', 'CollectivesWestend', 'CoretimeWestend', 'PeopleWestend', 'Penpal',
|
|
7
|
+
// Paseo testnet chains
|
|
8
|
+
'AssetHubPaseo', 'BridgeHubPaseo', 'CoretimePaseo', 'PAssetHub', 'PeoplePaseo', 'AjunaPaseo', 'BifrostPaseo', 'HeimaPaseo', 'HydrationPaseo', 'KiltPaseo', 'LaosPaseo', 'NeuroWebPaseo', 'NodlePaseo', 'ZeitgeistPaseo'];
|
|
9
|
+
/**
|
|
10
|
+
* Relaychains.
|
|
11
|
+
*/
|
|
12
|
+
var RELAYCHAINS = ['Polkadot', 'Kusama', 'Westend', 'Paseo'];
|
|
13
|
+
/**
|
|
14
|
+
* All Substrate chains (parachains + relaychains).
|
|
15
|
+
*/
|
|
16
|
+
var SUBSTRATE_CHAINS = [].concat(PARACHAINS, RELAYCHAINS);
|
|
17
|
+
/**
|
|
18
|
+
* External chains (non-Substrate/Polkadot ecosystem chains).
|
|
19
|
+
*/
|
|
20
|
+
var EXTERNAL_CHAINS = ['Ethereum'];
|
|
21
|
+
/**
|
|
22
|
+
* All supported chains.
|
|
23
|
+
*/
|
|
24
|
+
var CHAINS = [].concat(PARACHAINS, RELAYCHAINS, EXTERNAL_CHAINS);
|
|
25
|
+
|
|
1
26
|
function _arrayLikeToArray(r, a) {
|
|
2
27
|
(null == a || a > r.length) && (a = r.length);
|
|
3
28
|
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
@@ -80,32 +105,7 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
80
105
|
}
|
|
81
106
|
}
|
|
82
107
|
|
|
83
|
-
|
|
84
|
-
* Supported nodes excluding relay chains and Ethereum.
|
|
85
|
-
*/
|
|
86
|
-
var NODE_NAMES_DOT_KSM = ['AssetHubPolkadot', 'Acala', 'Ajuna', 'Astar', 'BifrostPolkadot', 'BridgeHubPolkadot', 'BridgeHubKusama', 'Centrifuge', 'ComposableFinance', 'Darwinia', 'EnergyWebX', 'EnergyWebXPaseo', 'Hydration', 'IntegriteeKusama', 'IntegriteePaseo', 'Interlay', 'Heima', 'Jamton', 'Moonbeam', 'AssetHubKusama', 'CoretimeKusama', 'CoretimePolkadot', 'Encointer', 'Altair', 'Amplitude', 'Basilisk', 'BifrostKusama', 'CrustShadow', 'Crab', 'Karura', 'Kintsugi', 'Moonriver', 'Laos', 'Quartz', 'RobonomicsKusama', 'RobonomicsPolkadot', 'PeoplePolkadot', 'PeopleKusama', 'Shiden', 'Unique', 'Crust', 'Manta', 'Nodle', 'NeuroWeb', 'Pendulum', 'Zeitgeist', 'Collectives', 'Phala', 'Subsocial', 'KiltSpiritnet', 'Curio', 'Mythos', 'Peaq', 'Polimec',
|
|
87
|
-
// Westend testnet chains
|
|
88
|
-
'AssetHubWestend', 'BridgeHubWestend', 'CollectivesWestend', 'CoretimeWestend', 'PeopleWestend', 'Penpal',
|
|
89
|
-
// Paseo testnet chains
|
|
90
|
-
'AssetHubPaseo', 'BridgeHubPaseo', 'CoretimePaseo', 'PAssetHub', 'PeoplePaseo', 'AjunaPaseo', 'BifrostPaseo', 'HeimaPaseo', 'HydrationPaseo', 'KiltPaseo', 'LaosPaseo', 'NeuroWebPaseo', 'NodlePaseo', 'ZeitgeistPaseo'];
|
|
91
|
-
/**
|
|
92
|
-
* Supported nodes including Ethereum.
|
|
93
|
-
*/
|
|
94
|
-
var NODE_NAMES = [].concat(NODE_NAMES_DOT_KSM, ['Ethereum']);
|
|
95
|
-
/**
|
|
96
|
-
* Relay chains.
|
|
97
|
-
*/
|
|
98
|
-
var RELAY_CHAINS = ['Polkadot', 'Kusama', 'Westend', 'Paseo'];
|
|
99
|
-
/**
|
|
100
|
-
* Supported nodes including relay chains and Ethereum.
|
|
101
|
-
*/
|
|
102
|
-
var NODES_WITH_RELAY_CHAINS = [].concat(_toConsumableArray(NODE_NAMES), RELAY_CHAINS);
|
|
103
|
-
/**
|
|
104
|
-
* Supported nodes including relay chains and excluding Ethereum.
|
|
105
|
-
*/
|
|
106
|
-
var NODES_WITH_RELAY_CHAINS_DOT_KSM = [].concat(NODE_NAMES_DOT_KSM, RELAY_CHAINS);
|
|
107
|
-
|
|
108
|
-
var isTMultiLocation = function isTMultiLocation(value) {
|
|
108
|
+
var isTLocation = function isTLocation(value) {
|
|
109
109
|
return _typeof(value) === 'object' && value !== null && 'parents' in value && 'interior' in value;
|
|
110
110
|
};
|
|
111
111
|
|
|
@@ -127,23 +127,23 @@ var Version;
|
|
|
127
127
|
})(Version || (Version = {}));
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
|
-
* Determines whether a given
|
|
130
|
+
* Determines whether a given chain is a relaychain.
|
|
131
131
|
*
|
|
132
|
-
* @param
|
|
133
|
-
* @returns True if the
|
|
132
|
+
* @param chain - The chain to check.
|
|
133
|
+
* @returns True if the chain is a relaychain; otherwise, false.
|
|
134
134
|
*/
|
|
135
|
-
var isRelayChain = function isRelayChain(
|
|
136
|
-
return
|
|
135
|
+
var isRelayChain = function isRelayChain(chain) {
|
|
136
|
+
return RELAYCHAINS.includes(chain);
|
|
137
137
|
};
|
|
138
138
|
/**
|
|
139
|
-
* Checks if a given
|
|
139
|
+
* Checks if a given chain is a system chain.
|
|
140
140
|
*
|
|
141
|
-
* @param
|
|
142
|
-
* @returns True if the
|
|
141
|
+
* @param chain - The chain to check.
|
|
142
|
+
* @returns True if the chain is a system chain; otherwise, false.
|
|
143
143
|
*/
|
|
144
|
-
var isSystemChain = function isSystemChain(
|
|
144
|
+
var isSystemChain = function isSystemChain(chain) {
|
|
145
145
|
var systemChains = ['AssetHubPolkadot', 'AssetHubKusama', 'AssetHubWestend', 'AssetHubPaseo', 'BridgeHubPolkadot', 'BridgeHubKusama', 'BridgeHubWestend', 'BridgeHubPaseo', 'PeoplePolkadot', 'PeopleKusama', 'PeopleWestend', 'PeoplePaseo', 'CoretimePolkadot', 'CoretimeKusama', 'CoretimeWestend', 'CoretimePaseo', 'Collectives', 'CollectivesWestend', 'Mythos'];
|
|
146
|
-
return systemChains.includes(
|
|
146
|
+
return systemChains.includes(chain) || isRelayChain(chain);
|
|
147
147
|
};
|
|
148
148
|
|
|
149
149
|
var isPrimitive = function isPrimitive(obj) {
|
|
@@ -225,11 +225,11 @@ var flattenJunctions = function flattenJunctions(junctions) {
|
|
|
225
225
|
return result;
|
|
226
226
|
};
|
|
227
227
|
|
|
228
|
-
var findMatchingJunction = function findMatchingJunction(
|
|
229
|
-
if (
|
|
228
|
+
var findMatchingJunction = function findMatchingJunction(location, junctionType) {
|
|
229
|
+
if (location.interior === 'Here') {
|
|
230
230
|
return undefined;
|
|
231
231
|
}
|
|
232
|
-
var allJunctions = flattenJunctions(
|
|
232
|
+
var allJunctions = flattenJunctions(location.interior);
|
|
233
233
|
return allJunctions.find(function (junction) {
|
|
234
234
|
var keys = Object.keys(junction);
|
|
235
235
|
if (keys.length !== 1) {
|
|
@@ -239,12 +239,12 @@ var findMatchingJunction = function findMatchingJunction(multiLocation, junction
|
|
|
239
239
|
return key === junctionType;
|
|
240
240
|
});
|
|
241
241
|
};
|
|
242
|
-
var getJunctionValue = function getJunctionValue(
|
|
243
|
-
var matchingJunction = findMatchingJunction(
|
|
242
|
+
var getJunctionValue = function getJunctionValue(location, junctionType) {
|
|
243
|
+
var matchingJunction = findMatchingJunction(location, junctionType);
|
|
244
244
|
return matchingJunction ? matchingJunction[junctionType] : undefined;
|
|
245
245
|
};
|
|
246
|
-
var hasJunction = function hasJunction(
|
|
247
|
-
var matchingJunction = findMatchingJunction(
|
|
246
|
+
var hasJunction = function hasJunction(location, junctionType, junctionValue) {
|
|
247
|
+
var matchingJunction = findMatchingJunction(location, junctionType);
|
|
248
248
|
if (!matchingJunction) {
|
|
249
249
|
return false;
|
|
250
250
|
}
|
|
@@ -263,4 +263,4 @@ var replaceBigInt = function replaceBigInt(_key, value) {
|
|
|
263
263
|
return typeof value === 'bigint' ? value.toString() : value;
|
|
264
264
|
};
|
|
265
265
|
|
|
266
|
-
export {
|
|
266
|
+
export { CHAINS, EXTERNAL_CHAINS, PARACHAINS, Parents, RELAYCHAINS, SUBSTRATE_CHAINS, Version, _deepEqual as deepEqual, getJunctionValue, hasJunction, isDotKsmBridge, isPrimitive, isRelayChain, isSystemChain, isTLocation, replaceBigInt };
|