@paraspell/sdk-common 14.2.1 → 14.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 +48 -9
- package/dist/index.mjs +13 -4
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Supported Polkadot / Kusama / Westend / Paseo parachains.
|
|
3
3
|
*/
|
|
4
|
-
declare const PARACHAINS: readonly ["AssetHubPolkadot", "Acala", "Ajuna", "Astar", "BifrostPolkadot", "BridgeHubPolkadot", "Centrifuge", "Darwinia", "EnergyWebX", "Hydration", "Heima", "Jamton", "CoretimePolkadot", "Collectives", "Crust", "NeuroWeb", "Pendulum", "Mythos", "Peaq", "PeoplePolkadot", "Unique", "Xode", "AssetHubKusama", "BridgeHubKusama", "Karura", "CoretimeKusama", "Encointer", "Basilisk", "BifrostKusama", "Curio", "CrustShadow", "
|
|
4
|
+
declare const PARACHAINS: readonly ["AssetHubPolkadot", "Acala", "Ajuna", "Astar", "BifrostPolkadot", "BridgeHubPolkadot", "Centrifuge", "Darwinia", "EnergyWebX", "Hydration", "Heima", "Jamton", "CoretimePolkadot", "Collectives", "Crust", "NeuroWeb", "Pendulum", "Mythos", "Peaq", "PeoplePolkadot", "Unique", "Xode", "AssetHubKusama", "BridgeHubKusama", "Karura", "CoretimeKusama", "Encointer", "Basilisk", "BifrostKusama", "Curio", "CrustShadow", "RobonomicsPolkadot", "PeopleKusama", "Shiden", "AssetHubWestend", "BridgeHubWestend", "CollectivesWestend", "CoretimeWestend", "Penpal", "PeopleWestend", "AssetHubPaseo", "EnergyWebXPaseo", "HeimaPaseo", "HydrationPaseo", "PeoplePaseo"];
|
|
5
5
|
/**
|
|
6
6
|
* Relaychains.
|
|
7
7
|
*/
|
|
@@ -9,7 +9,7 @@ declare const RELAYCHAINS: readonly ["Polkadot", "Kusama", "Westend", "Paseo"];
|
|
|
9
9
|
/**
|
|
10
10
|
* All Substrate chains (parachains + relaychains).
|
|
11
11
|
*/
|
|
12
|
-
declare const SUBSTRATE_CHAINS: readonly ["AssetHubPolkadot", "Acala", "Ajuna", "Astar", "BifrostPolkadot", "BridgeHubPolkadot", "Centrifuge", "Darwinia", "EnergyWebX", "Hydration", "Heima", "Jamton", "CoretimePolkadot", "Collectives", "Crust", "NeuroWeb", "Pendulum", "Mythos", "Peaq", "PeoplePolkadot", "Unique", "Xode", "AssetHubKusama", "BridgeHubKusama", "Karura", "CoretimeKusama", "Encointer", "Basilisk", "BifrostKusama", "Curio", "CrustShadow", "
|
|
12
|
+
declare const SUBSTRATE_CHAINS: readonly ["AssetHubPolkadot", "Acala", "Ajuna", "Astar", "BifrostPolkadot", "BridgeHubPolkadot", "Centrifuge", "Darwinia", "EnergyWebX", "Hydration", "Heima", "Jamton", "CoretimePolkadot", "Collectives", "Crust", "NeuroWeb", "Pendulum", "Mythos", "Peaq", "PeoplePolkadot", "Unique", "Xode", "AssetHubKusama", "BridgeHubKusama", "Karura", "CoretimeKusama", "Encointer", "Basilisk", "BifrostKusama", "Curio", "CrustShadow", "RobonomicsPolkadot", "PeopleKusama", "Shiden", "AssetHubWestend", "BridgeHubWestend", "CollectivesWestend", "CoretimeWestend", "Penpal", "PeopleWestend", "AssetHubPaseo", "EnergyWebXPaseo", "HeimaPaseo", "HydrationPaseo", "PeoplePaseo", "Polkadot", "Kusama", "Westend", "Paseo"];
|
|
13
13
|
/**
|
|
14
14
|
* External chains (non-Substrate/Polkadot ecosystem chains).
|
|
15
15
|
*/
|
|
@@ -21,7 +21,7 @@ declare const DEFAULT_SS58_PREFIX = 42;
|
|
|
21
21
|
/**
|
|
22
22
|
* All supported chains.
|
|
23
23
|
*/
|
|
24
|
-
declare const CHAINS: readonly ["AssetHubPolkadot", "Acala", "Ajuna", "Astar", "BifrostPolkadot", "BridgeHubPolkadot", "Centrifuge", "Darwinia", "EnergyWebX", "Hydration", "Heima", "Jamton", "CoretimePolkadot", "Collectives", "Crust", "NeuroWeb", "Pendulum", "Mythos", "Peaq", "PeoplePolkadot", "Unique", "Xode", "AssetHubKusama", "BridgeHubKusama", "Karura", "CoretimeKusama", "Encointer", "Basilisk", "BifrostKusama", "Curio", "CrustShadow", "
|
|
24
|
+
declare const CHAINS: readonly ["AssetHubPolkadot", "Acala", "Ajuna", "Astar", "BifrostPolkadot", "BridgeHubPolkadot", "Centrifuge", "Darwinia", "EnergyWebX", "Hydration", "Heima", "Jamton", "CoretimePolkadot", "Collectives", "Crust", "NeuroWeb", "Pendulum", "Mythos", "Peaq", "PeoplePolkadot", "Unique", "Xode", "AssetHubKusama", "BridgeHubKusama", "Karura", "CoretimeKusama", "Encointer", "Basilisk", "BifrostKusama", "Curio", "CrustShadow", "RobonomicsPolkadot", "PeopleKusama", "Shiden", "AssetHubWestend", "BridgeHubWestend", "CollectivesWestend", "CoretimeWestend", "Penpal", "PeopleWestend", "AssetHubPaseo", "EnergyWebXPaseo", "HeimaPaseo", "HydrationPaseo", "PeoplePaseo", "Polkadot", "Kusama", "Westend", "Paseo", "Ethereum", "EthereumTestnet"];
|
|
25
25
|
|
|
26
26
|
declare class ParaSpellError extends Error {
|
|
27
27
|
constructor(message: string);
|
|
@@ -39,9 +39,47 @@ declare enum Parents {
|
|
|
39
39
|
TWO = 2
|
|
40
40
|
}
|
|
41
41
|
type TJunctionType = 'Parachain' | 'AccountId32' | 'AccountIndex64' | 'AccountKey20' | 'PalletInstance' | 'GeneralIndex' | 'GeneralKey' | 'OnlyChild' | 'Plurality' | 'GlobalConsensus';
|
|
42
|
-
type
|
|
43
|
-
type
|
|
44
|
-
|
|
42
|
+
type TNetworkKey = 'polkadot' | 'kusama' | 'paseo' | 'westend' | 'rococo' | 'wococo' | 'bitcoinCore' | 'bitcoinCash' | 'polkadotBulletin';
|
|
43
|
+
type TUnitNetworkId = {
|
|
44
|
+
[K in TNetworkKey]: Record<K, null>;
|
|
45
|
+
}[TNetworkKey];
|
|
46
|
+
type TNetworkId = Capitalize<TNetworkKey> | TUnitNetworkId | {
|
|
47
|
+
ByGenesis: THexString;
|
|
48
|
+
} | {
|
|
49
|
+
ByFork: {
|
|
50
|
+
blockNumber: TStringOrNumberOrBigInt;
|
|
51
|
+
blockHash: THexString;
|
|
52
|
+
};
|
|
53
|
+
} | {
|
|
54
|
+
Ethereum: {
|
|
55
|
+
chainId: TStringOrNumberOrBigInt;
|
|
56
|
+
};
|
|
57
|
+
} | null;
|
|
58
|
+
type TBodyId = string | {
|
|
59
|
+
Moniker: THexString;
|
|
60
|
+
} | {
|
|
61
|
+
Index: TStringOrNumberOrBigInt;
|
|
62
|
+
} | null;
|
|
63
|
+
type TBodyPart = string | {
|
|
64
|
+
Members: {
|
|
65
|
+
count: TStringOrNumberOrBigInt;
|
|
66
|
+
};
|
|
67
|
+
} | {
|
|
68
|
+
Fraction: {
|
|
69
|
+
nom: TStringOrNumberOrBigInt;
|
|
70
|
+
denom: TStringOrNumberOrBigInt;
|
|
71
|
+
};
|
|
72
|
+
} | {
|
|
73
|
+
AtLeastProportion: {
|
|
74
|
+
nom: TStringOrNumberOrBigInt;
|
|
75
|
+
denom: TStringOrNumberOrBigInt;
|
|
76
|
+
};
|
|
77
|
+
} | {
|
|
78
|
+
MoreThanProportion: {
|
|
79
|
+
nom: TStringOrNumberOrBigInt;
|
|
80
|
+
denom: TStringOrNumberOrBigInt;
|
|
81
|
+
};
|
|
82
|
+
} | null;
|
|
45
83
|
type TStringOrNumber = string | number;
|
|
46
84
|
type TStringOrNumberOrBigInt = TStringOrNumber | bigint;
|
|
47
85
|
type THexString = string;
|
|
@@ -79,7 +117,7 @@ type TJunctionGeneralKey = {
|
|
|
79
117
|
};
|
|
80
118
|
};
|
|
81
119
|
type TJunctionOnlyChild = {
|
|
82
|
-
OnlyChild: string;
|
|
120
|
+
OnlyChild: string | null;
|
|
83
121
|
};
|
|
84
122
|
type TJunctionPlurality = {
|
|
85
123
|
Plurality: {
|
|
@@ -119,6 +157,7 @@ declare enum Version {
|
|
|
119
157
|
declare const isTLocation: (value: unknown) => value is TLocation;
|
|
120
158
|
|
|
121
159
|
declare const ETHEREUM_BRIDGE_ORIGINS: TSubstrateChain[];
|
|
160
|
+
declare const isEthereumBridgeOrigin: <TCustomChain extends string = never>(chain: TChain | TCustomChain, externalChain: TExternalChain) => boolean;
|
|
122
161
|
declare const isSubstrateBridge: <TCustomChain extends string = never>(origin: TChain | TCustomChain, destination: TChain | TCustomChain) => boolean;
|
|
123
162
|
declare const isSnowbridge: <TCustomChain extends string = never>(_origin: TChain | TCustomChain, destination: TChain | TCustomChain) => boolean;
|
|
124
163
|
declare const isBridge: <TCustomChain extends string = never>(origin: TChain | TCustomChain, destination: TChain | TCustomChain) => boolean;
|
|
@@ -177,5 +216,5 @@ declare const replaceBigInt: (_key: string, value: unknown) => unknown;
|
|
|
177
216
|
declare const lowercaseFirstLetter: (value: string) => string;
|
|
178
217
|
declare const snakeToCamel: (str: string) => string;
|
|
179
218
|
|
|
180
|
-
export { CHAINS, DEFAULT_SS58_PREFIX, ETHEREUM_BRIDGE_ORIGINS, EXTERNAL_CHAINS, PARACHAINS, ParaSpellError, Parents, RELAYCHAINS, SUBSTRATE_CHAINS, Version, deepEqual, getJunctionValue, hasJunction, isBridge, isChain, isCustomChain, isExternalChain, isPrimitive, isRelayChain, isSnowbridge, isSubstrateBridge, isSubstrateChain, isSystemChain, isTLocation, isTrustedChain, lowercaseFirstLetter, replaceBigInt, snakeToCamel };
|
|
181
|
-
export type { TChain, TExternalChain, TJunction, TJunctionAccountId32, TJunctionAccountIndex64, TJunctionAccountKey20, TJunctionGeneralIndex, TJunctionGeneralKey, TJunctionGlobalConsensus, TJunctionOnlyChild, TJunctionPalletInstance, TJunctionParachain, TJunctionPlurality, TJunctionType, TJunctions, TLocation, TParachain, TRelaychain, TSubstrateChain };
|
|
219
|
+
export { CHAINS, DEFAULT_SS58_PREFIX, ETHEREUM_BRIDGE_ORIGINS, EXTERNAL_CHAINS, PARACHAINS, ParaSpellError, Parents, RELAYCHAINS, SUBSTRATE_CHAINS, Version, deepEqual, getJunctionValue, hasJunction, isBridge, isChain, isCustomChain, isEthereumBridgeOrigin, isExternalChain, isPrimitive, isRelayChain, isSnowbridge, isSubstrateBridge, isSubstrateChain, isSystemChain, isTLocation, isTrustedChain, lowercaseFirstLetter, replaceBigInt, snakeToCamel };
|
|
220
|
+
export type { TChain, TExternalChain, TJunction, TJunctionAccountId32, TJunctionAccountIndex64, TJunctionAccountKey20, TJunctionGeneralIndex, TJunctionGeneralKey, TJunctionGlobalConsensus, TJunctionOnlyChild, TJunctionPalletInstance, TJunctionParachain, TJunctionPlurality, TJunctionType, TJunctions, TLocation, TParachain, TRelaychain, TStringOrNumberOrBigInt, TSubstrateChain };
|
package/dist/index.mjs
CHANGED
|
@@ -5,11 +5,11 @@ var PARACHAINS = [
|
|
|
5
5
|
// Polkadot chains
|
|
6
6
|
'AssetHubPolkadot', 'Acala', 'Ajuna', 'Astar', 'BifrostPolkadot', 'BridgeHubPolkadot', 'Centrifuge', 'Darwinia', 'EnergyWebX', 'Hydration', 'Heima', 'Jamton', 'CoretimePolkadot', 'Collectives', 'Crust', 'NeuroWeb', 'Pendulum', 'Mythos', 'Peaq', 'PeoplePolkadot', 'Unique', 'Xode',
|
|
7
7
|
// Kusama chains
|
|
8
|
-
'AssetHubKusama', 'BridgeHubKusama', 'Karura', 'CoretimeKusama', 'Encointer', 'Basilisk', 'BifrostKusama', 'Curio', 'CrustShadow', '
|
|
8
|
+
'AssetHubKusama', 'BridgeHubKusama', 'Karura', 'CoretimeKusama', 'Encointer', 'Basilisk', 'BifrostKusama', 'Curio', 'CrustShadow', 'RobonomicsPolkadot', 'PeopleKusama', 'Shiden',
|
|
9
9
|
// Westend testnet chains
|
|
10
10
|
'AssetHubWestend', 'BridgeHubWestend', 'CollectivesWestend', 'CoretimeWestend', 'Penpal', 'PeopleWestend',
|
|
11
11
|
// Paseo testnet chains
|
|
12
|
-
'AssetHubPaseo', 'EnergyWebXPaseo', 'HeimaPaseo', 'HydrationPaseo', '
|
|
12
|
+
'AssetHubPaseo', 'EnergyWebXPaseo', 'HeimaPaseo', 'HydrationPaseo', 'PeoplePaseo'];
|
|
13
13
|
/**
|
|
14
14
|
* Relaychains.
|
|
15
15
|
*/
|
|
@@ -339,7 +339,16 @@ var isTrustedChain = function isTrustedChain(chain) {
|
|
|
339
339
|
};
|
|
340
340
|
|
|
341
341
|
var COMPATIBLE_BRIDGES = [['AssetHubPolkadot', 'AssetHubKusama']];
|
|
342
|
-
var
|
|
342
|
+
var ETHEREUM_BRIDGE_ORIGINS_MAP = {
|
|
343
|
+
Ethereum: ['AssetHubPolkadot', 'Hydration', 'BifrostPolkadot', 'Mythos'],
|
|
344
|
+
EthereumTestnet: ['AssetHubPaseo', 'AssetHubWestend']
|
|
345
|
+
};
|
|
346
|
+
var ETHEREUM_BRIDGE_ORIGINS = Object.values(ETHEREUM_BRIDGE_ORIGINS_MAP).flat();
|
|
347
|
+
var isEthereumBridgeOrigin = function isEthereumBridgeOrigin(chain, externalChain) {
|
|
348
|
+
return ETHEREUM_BRIDGE_ORIGINS_MAP[externalChain].some(function (c) {
|
|
349
|
+
return c === chain;
|
|
350
|
+
});
|
|
351
|
+
};
|
|
343
352
|
var isSubstrateBridge = function isSubstrateBridge(origin, destination) {
|
|
344
353
|
if (isExternalChain(origin) || isExternalChain(destination)) return false;
|
|
345
354
|
if (!origin.startsWith('AssetHub') || !destination.startsWith('AssetHub')) return false;
|
|
@@ -479,4 +488,4 @@ var snakeToCamel = function snakeToCamel(str) {
|
|
|
479
488
|
});
|
|
480
489
|
};
|
|
481
490
|
|
|
482
|
-
export { CHAINS, DEFAULT_SS58_PREFIX, ETHEREUM_BRIDGE_ORIGINS, EXTERNAL_CHAINS, PARACHAINS, ParaSpellError, Parents, RELAYCHAINS, SUBSTRATE_CHAINS, Version, _deepEqual as deepEqual, getJunctionValue, hasJunction, isBridge, isChain, isCustomChain, isExternalChain, isPrimitive, isRelayChain, isSnowbridge, isSubstrateBridge, isSubstrateChain, isSystemChain, isTLocation, isTrustedChain, lowercaseFirstLetter, replaceBigInt, snakeToCamel };
|
|
491
|
+
export { CHAINS, DEFAULT_SS58_PREFIX, ETHEREUM_BRIDGE_ORIGINS, EXTERNAL_CHAINS, PARACHAINS, ParaSpellError, Parents, RELAYCHAINS, SUBSTRATE_CHAINS, Version, _deepEqual as deepEqual, getJunctionValue, hasJunction, isBridge, isChain, isCustomChain, isEthereumBridgeOrigin, isExternalChain, isPrimitive, isRelayChain, isSnowbridge, isSubstrateBridge, isSubstrateChain, isSystemChain, isTLocation, isTrustedChain, lowercaseFirstLetter, replaceBigInt, snakeToCamel };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk-common",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.3.0",
|
|
4
4
|
"description": "SDK common code for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,18 +26,18 @@
|
|
|
26
26
|
"@babel/plugin-syntax-import-attributes": "^7.29.7",
|
|
27
27
|
"@babel/preset-env": "^7.29.7",
|
|
28
28
|
"@codecov/rollup-plugin": "^2.0.1",
|
|
29
|
-
"@polkadot-api/substrate-bindings": "^0.
|
|
29
|
+
"@polkadot-api/substrate-bindings": "^0.21.0",
|
|
30
30
|
"@rollup/plugin-babel": "^7.1.0",
|
|
31
31
|
"@rollup/plugin-json": "^6.1.0",
|
|
32
32
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
33
33
|
"@types/cli-progress": "^3.11.6",
|
|
34
|
-
"@vitest/coverage-v8": "^4.1.
|
|
34
|
+
"@vitest/coverage-v8": "^4.1.11",
|
|
35
35
|
"cli-progress": "^3.12.0",
|
|
36
36
|
"dotenv": "^17.4.2",
|
|
37
37
|
"picocolors": "^1.1.1",
|
|
38
|
-
"polkadot-api": "^
|
|
39
|
-
"rollup": "^4.62.
|
|
40
|
-
"rollup-plugin-dts": "^6.
|
|
38
|
+
"polkadot-api": "^3.0.0",
|
|
39
|
+
"rollup": "^4.62.5",
|
|
40
|
+
"rollup-plugin-dts": "^6.5.1"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"compile": "tsc --noEmit",
|