@polkadot/types-known 9.14.2 → 10.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.
Files changed (54) hide show
  1. package/bundle.js +2 -5
  2. package/chain/index.js +0 -4
  3. package/cjs/bundle.js +8 -34
  4. package/cjs/chain/index.js +2 -11
  5. package/cjs/detectOther.js +3 -10
  6. package/cjs/detectPackage.js +6 -11
  7. package/cjs/index.js +3 -15
  8. package/cjs/packageInfo.js +2 -16
  9. package/cjs/spec/centrifuge-chain.js +99 -93
  10. package/cjs/spec/index.js +23 -32
  11. package/cjs/spec/kusama.js +201 -195
  12. package/cjs/spec/node-template.js +12 -20
  13. package/cjs/spec/node.js +12 -20
  14. package/cjs/spec/polkadot.js +77 -82
  15. package/cjs/spec/rococo.js +52 -59
  16. package/cjs/spec/shell.js +10 -18
  17. package/cjs/spec/statemint.js +49 -50
  18. package/cjs/spec/westend.js +95 -96
  19. package/cjs/upgrades/e2e/index.js +11 -26
  20. package/cjs/upgrades/e2e/kusama.js +4176 -14
  21. package/cjs/upgrades/e2e/polkadot.js +2626 -14
  22. package/cjs/upgrades/e2e/westend.js +4014 -14
  23. package/cjs/upgrades/index.js +23 -40
  24. package/cjs/upgrades/manual/index.js +11 -26
  25. package/cjs/upgrades/manual/kusama.js +20 -13
  26. package/cjs/upgrades/manual/polkadot.js +13 -11
  27. package/cjs/upgrades/manual/westend.js +18 -11
  28. package/cjs/upgrades/types.js +2 -1
  29. package/cjs/util.js +55 -105
  30. package/detectOther.js +0 -3
  31. package/detectPackage.js +2 -7
  32. package/index.js +2 -5
  33. package/package.json +11 -8
  34. package/packageInfo.js +1 -11
  35. package/spec/centrifuge-chain.js +95 -84
  36. package/spec/index.js +20 -25
  37. package/spec/kusama.js +197 -187
  38. package/spec/node-template.js +10 -13
  39. package/spec/node.js +10 -13
  40. package/spec/polkadot.js +74 -75
  41. package/spec/rococo.js +48 -52
  42. package/spec/shell.js +8 -11
  43. package/spec/statemint.js +45 -42
  44. package/spec/westend.js +91 -88
  45. package/upgrades/e2e/index.js +3 -6
  46. package/upgrades/e2e/kusama.js +4174 -7
  47. package/upgrades/e2e/polkadot.js +2624 -7
  48. package/upgrades/e2e/westend.js +4012 -7
  49. package/upgrades/index.js +17 -25
  50. package/upgrades/manual/index.js +3 -6
  51. package/upgrades/manual/kusama.js +18 -6
  52. package/upgrades/manual/polkadot.js +11 -4
  53. package/upgrades/manual/westend.js +16 -4
  54. package/util.js +42 -77
package/upgrades/index.js CHANGED
@@ -1,34 +1,26 @@
1
- // Copyright 2017-2023 @polkadot/types-known authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
1
  import { selectableNetworks } from '@polkadot/networks';
5
2
  import { BN, hexToU8a } from '@polkadot/util';
6
- import * as allKnown from "./e2e/index.js";
7
-
8
- // testnets are not available in the networks map
3
+ import * as allKnown from './e2e/index.js';
9
4
  const NET_EXTRA = {
10
- westend: {
11
- genesisHash: ['0xe143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e']
12
- }
5
+ westend: {
6
+ genesisHash: ['0xe143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e']
7
+ }
13
8
  };
14
-
15
9
  /** @internal */
16
10
  function mapRaw([network, versions]) {
17
- const chain = selectableNetworks.find(n => n.network === network) || NET_EXTRA[network];
18
- if (!chain) {
19
- throw new Error(`Unable to find info for chain ${network}`);
20
- }
21
- return {
22
- genesisHash: hexToU8a(chain.genesisHash[0]),
23
- network,
24
- versions: versions.map(([blockNumber, specVersion, apis]) => ({
25
- apis,
26
- blockNumber: new BN(blockNumber),
27
- specVersion: new BN(specVersion)
28
- }))
29
- };
11
+ const chain = selectableNetworks.find((n) => n.network === network) || NET_EXTRA[network];
12
+ if (!chain) {
13
+ throw new Error(`Unable to find info for chain ${network}`);
14
+ }
15
+ return {
16
+ genesisHash: hexToU8a(chain.genesisHash[0]),
17
+ network,
18
+ versions: versions.map(([blockNumber, specVersion, apis]) => ({
19
+ apis,
20
+ blockNumber: new BN(blockNumber),
21
+ specVersion: new BN(specVersion)
22
+ }))
23
+ };
30
24
  }
31
-
32
- // Type overrides for specific spec types & versions as given in runtimeVersion
33
25
  const upgrades = Object.entries(allKnown).map(mapRaw);
34
26
  export default upgrades;
@@ -1,6 +1,3 @@
1
- // Copyright 2017-2023 @polkadot/types-known authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- export { default as kusama } from "./kusama.js";
5
- export { default as polkadot } from "./polkadot.js";
6
- export { default as westend } from "./westend.js";
1
+ export { default as kusama } from './kusama.js';
2
+ export { default as polkadot } from './polkadot.js';
3
+ export { default as westend } from './westend.js';
@@ -1,7 +1,19 @@
1
- // Copyright 2017-2023 @polkadot/types-known authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- const upgrades = [[0, 1020], [26669, 1021], [38245, 1022], [54248, 1023], [59659, 1024], [67651, 1025], [82191, 1027], [83238, 1028], [101503, 1029], [203466, 1030], [295787, 1031], [461692, 1032], [504329, 1033], [569327, 1038], [587687, 1039], [653183, 1040], [693488, 1042], [901442, 1045], [1375086, 1050], [1445458, 1051], [1472960, 1052], [1475648, 1053], [1491596, 1054], [1574408, 1055], [2064961, 1058], [2201991, 1062], [2671528, 2005], [2704202, 2007], [2728002, 2008], [2832534, 2011], [2962294, 2012], [3240000, 2013], [3274408, 2015], [3323565, 2019], [3534175, 2022], [3860281, 2023], [4143129, 2024], [4401242, 2025], [4841367, 2026], [5961600, 2027], [6137912, 2028], [6561855, 2029], [7100891, 2030], [7468792, 9010], [7668600, 9030], [7812476, 9040], [8010981, 9050], [8073833, 9070], [8555825, 9080], [8945245, 9090], [9611377, 9100], [9625129, 9111], [9866422, 9122], [10403784, 9130], [10960765, 9150], [11006614, 9151], [11404482, 9160], [11601803, 9170], [12008022, 9180], [12405451, 9190], [12665416, 9200], [12909508, 9220], [13109752, 9230], [13555777, 9250], [13727747, 9260], [14248044, 9271], [14433840, 9280], [14645900, 9291], [15048375, 9300], [15426015, 9320],
5
- // we have 9340 via system.setStorage (whitelist.WhitelistedCallDispatched event)
6
- [15680713, 9340], [15756296, 9350]];
1
+ const upgrades = [
2
+ [0, 1020], [26669, 1021], [38245, 1022], [54248, 1023], [59659, 1024],
3
+ [67651, 1025], [82191, 1027], [83238, 1028], [101503, 1029], [203466, 1030],
4
+ [295787, 1031], [461692, 1032], [504329, 1033], [569327, 1038], [587687, 1039],
5
+ [653183, 1040], [693488, 1042], [901442, 1045], [1375086, 1050], [1445458, 1051],
6
+ [1472960, 1052], [1475648, 1053], [1491596, 1054], [1574408, 1055], [2064961, 1058],
7
+ [2201991, 1062], [2671528, 2005], [2704202, 2007], [2728002, 2008], [2832534, 2011],
8
+ [2962294, 2012], [3240000, 2013], [3274408, 2015], [3323565, 2019], [3534175, 2022],
9
+ [3860281, 2023], [4143129, 2024], [4401242, 2025], [4841367, 2026], [5961600, 2027],
10
+ [6137912, 2028], [6561855, 2029], [7100891, 2030], [7468792, 9010], [7668600, 9030],
11
+ [7812476, 9040], [8010981, 9050], [8073833, 9070], [8555825, 9080], [8945245, 9090],
12
+ [9611377, 9100], [9625129, 9111], [9866422, 9122], [10403784, 9130], [10960765, 9150],
13
+ [11006614, 9151], [11404482, 9160], [11601803, 9170], [12008022, 9180], [12405451, 9190],
14
+ [12665416, 9200], [12909508, 9220], [13109752, 9230], [13555777, 9250], [13727747, 9260],
15
+ [14248044, 9271], [14433840, 9280], [14645900, 9291], [15048375, 9300], [15426015, 9320],
16
+ // we have 9340 via system.setStorage (whitelist.WhitelistedCallDispatched event)
17
+ [15680713, 9340], [15756296, 9350]
18
+ ];
7
19
  export default upgrades;
@@ -1,5 +1,12 @@
1
- // Copyright 2017-2023 @polkadot/types-known authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- const upgrades = [[0, 0], [29231, 1], [188836, 5], [199405, 6], [214264, 7], [244358, 8], [303079, 9], [314201, 10], [342400, 11], [443963, 12], [528470, 13], [687751, 14], [746085, 15], [787923, 16], [799302, 17], [1205128, 18], [1603423, 23], [1733218, 24], [2005673, 25], [2436698, 26], [3613564, 27], [3899547, 28], [4345767, 29], [4876134, 30], [5661442, 9050], [6321619, 9080], [6713249, 9090], [7217907, 9100], [7229126, 9110], [7560558, 9122], [8115869, 9140], [8638103, 9151], [9280179, 9170], [9738717, 9180], [10156856, 9190], [10458576, 9200], [10655116, 9220], [10879371, 9230], [11328884, 9250], [11532856, 9260], [11933818, 9270], [12217535, 9280], [12245277, 9281], [12532644, 9291], [12876189, 9300]];
1
+ const upgrades = [
2
+ [0, 0], [29231, 1], [188836, 5], [199405, 6], [214264, 7],
3
+ [244358, 8], [303079, 9], [314201, 10], [342400, 11], [443963, 12],
4
+ [528470, 13], [687751, 14], [746085, 15], [787923, 16], [799302, 17],
5
+ [1205128, 18], [1603423, 23], [1733218, 24], [2005673, 25], [2436698, 26],
6
+ [3613564, 27], [3899547, 28], [4345767, 29], [4876134, 30], [5661442, 9050],
7
+ [6321619, 9080], [6713249, 9090], [7217907, 9100], [7229126, 9110], [7560558, 9122],
8
+ [8115869, 9140], [8638103, 9151], [9280179, 9170], [9738717, 9180], [10156856, 9190],
9
+ [10458576, 9200], [10655116, 9220], [10879371, 9230], [11328884, 9250], [11532856, 9260],
10
+ [11933818, 9270], [12217535, 9280], [12245277, 9281], [12532644, 9291], [12876189, 9300]
11
+ ];
5
12
  export default upgrades;
@@ -1,5 +1,17 @@
1
- // Copyright 2017-2023 @polkadot/types-known authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- const upgrades = [[214356, 4], [392764, 7], [409740, 8], [809976, 20], [877581, 24], [879238, 25], [889472, 26], [902937, 27], [932751, 28], [991142, 29], [1030162, 31], [1119657, 32], [1199282, 33], [1342534, 34], [1392263, 35], [1431703, 36], [1433369, 37], [1490972, 41], [2087397, 43], [2316688, 44], [2549864, 45], [3925782, 46], [3925843, 47], [4207800, 48], [4627944, 49], [5124076, 50], [5478664, 900], [5482450, 9000], [5584305, 9010], [5784566, 9030], [5879822, 9031], [5896856, 9032], [5897316, 9033], [6117927, 9050], [6210274, 9070], [6379314, 9080], [6979141, 9090], [7568453, 9100], [7766394, 9111], [7911691, 9120], [7968866, 9121], [7982889, 9122], [8514322, 9130], [9091726, 9140], [9091774, 9150], [9406726, 9160], [9921066, 9170], [10007115, 9180], [10480973, 9190], [10578091, 9200], [10678509, 9210], [10811001, 9220], [11096116, 9230], [11409279, 9250], [11584820, 9251], [11716837, 9260], [11876919, 9261], [11987927, 9270], [12077324, 9271], [12301871, 9280], [12604343, 9290], [12841034, 9300], [13128237, 9310], [13272363, 9320], [13483497, 9330], [13649433, 9340], [13761100, 9350]];
1
+ const upgrades = [
2
+ [214356, 4], [392764, 7], [409740, 8], [809976, 20], [877581, 24],
3
+ [879238, 25], [889472, 26], [902937, 27], [932751, 28], [991142, 29],
4
+ [1030162, 31], [1119657, 32], [1199282, 33], [1342534, 34], [1392263, 35],
5
+ [1431703, 36], [1433369, 37], [1490972, 41], [2087397, 43], [2316688, 44],
6
+ [2549864, 45], [3925782, 46], [3925843, 47], [4207800, 48], [4627944, 49],
7
+ [5124076, 50], [5478664, 900], [5482450, 9000], [5584305, 9010], [5784566, 9030],
8
+ [5879822, 9031], [5896856, 9032], [5897316, 9033], [6117927, 9050], [6210274, 9070],
9
+ [6379314, 9080], [6979141, 9090], [7568453, 9100], [7766394, 9111], [7911691, 9120],
10
+ [7968866, 9121], [7982889, 9122], [8514322, 9130], [9091726, 9140], [9091774, 9150],
11
+ [9406726, 9160], [9921066, 9170], [10007115, 9180], [10480973, 9190], [10578091, 9200],
12
+ [10678509, 9210], [10811001, 9220], [11096116, 9230], [11409279, 9250], [11584820, 9251],
13
+ [11716837, 9260], [11876919, 9261], [11987927, 9270], [12077324, 9271], [12301871, 9280],
14
+ [12604343, 9290], [12841034, 9300], [13128237, 9310], [13272363, 9320], [13483497, 9330],
15
+ [13649433, 9340], [13761100, 9350]
16
+ ];
5
17
  export default upgrades;
package/util.js CHANGED
@@ -1,119 +1,84 @@
1
- // Copyright 2017-2023 @polkadot/types-known authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
1
  import { bnToBn, objectSpread } from '@polkadot/util';
5
- import typesChain from "./chain/index.js";
6
- import typesSpec from "./spec/index.js";
7
- import upgrades from "./upgrades/index.js";
8
-
2
+ import typesChain from './chain/index.js';
3
+ import typesSpec from './spec/index.js';
4
+ import upgrades from './upgrades/index.js';
9
5
  /**
10
6
  * @description Perform the callback function using the stringified spec/chain
11
7
  * @internal
12
8
  * */
13
9
  function withNames(chainName, specName, fn) {
14
- return fn(chainName.toString(), specName.toString());
10
+ return fn(chainName.toString(), specName.toString());
15
11
  }
16
-
17
12
  /**
18
13
  * @descriptionFflatten a VersionedType[] into a Record<string, string>
19
14
  * @internal
20
15
  * */
21
16
  function filterVersions(versions = [], specVersion) {
22
- return versions.filter(({
23
- minmax: [min, max]
24
- }) => (min === undefined || min === null || specVersion >= min) && (max === undefined || max === null || specVersion <= max)).reduce((result, {
25
- types
26
- }) => objectSpread(result, types), {});
17
+ return versions
18
+ .filter(({ minmax: [min, max] }) => (min === undefined || min === null || specVersion >= min) &&
19
+ (max === undefined || max === null || specVersion <= max))
20
+ .reduce((result, { types }) => objectSpread(result, types), {});
27
21
  }
28
-
29
22
  /**
30
23
  * @description Based on the chain and runtimeVersion, get the applicable signed extensions (ready for registration)
31
24
  */
32
- export function getSpecExtensions({
33
- knownTypes
34
- }, chainName, specName) {
35
- return withNames(chainName, specName, (c, s) => {
36
- var _knownTypes$typesBund, _knownTypes$typesBund2, _knownTypes$typesBund3, _knownTypes$typesBund4, _knownTypes$typesBund5, _knownTypes$typesBund6;
37
- return objectSpread({}, (_knownTypes$typesBund = knownTypes.typesBundle) == null ? void 0 : (_knownTypes$typesBund2 = _knownTypes$typesBund.spec) == null ? void 0 : (_knownTypes$typesBund3 = _knownTypes$typesBund2[s]) == null ? void 0 : _knownTypes$typesBund3.signedExtensions, (_knownTypes$typesBund4 = knownTypes.typesBundle) == null ? void 0 : (_knownTypes$typesBund5 = _knownTypes$typesBund4.chain) == null ? void 0 : (_knownTypes$typesBund6 = _knownTypes$typesBund5[c]) == null ? void 0 : _knownTypes$typesBund6.signedExtensions);
38
- });
25
+ export function getSpecExtensions({ knownTypes }, chainName, specName) {
26
+ return withNames(chainName, specName, (c, s) => objectSpread({}, knownTypes.typesBundle?.spec?.[s]?.signedExtensions, knownTypes.typesBundle?.chain?.[c]?.signedExtensions));
39
27
  }
40
-
41
28
  /**
42
29
  * @description Based on the chain and runtimeVersion, get the applicable types (ready for registration)
43
30
  */
44
- export function getSpecTypes({
45
- knownTypes
46
- }, chainName, specName, specVersion) {
47
- const _specVersion = bnToBn(specVersion).toNumber();
48
- return withNames(chainName, specName, (c, s) => {
49
- var _knownTypes$typesBund7, _knownTypes$typesBund8, _knownTypes$typesBund9, _knownTypes$typesBund10, _knownTypes$typesBund11, _knownTypes$typesBund12, _knownTypes$typesSpec, _knownTypes$typesChai;
50
- return (
51
- // The order here is always, based on -
52
- // - spec then chain
53
- // - typesBundle takes higher precedence
54
- // - types is the final catch-all override
55
- objectSpread({}, filterVersions(typesSpec[s], _specVersion), filterVersions(typesChain[c], _specVersion), filterVersions((_knownTypes$typesBund7 = knownTypes.typesBundle) == null ? void 0 : (_knownTypes$typesBund8 = _knownTypes$typesBund7.spec) == null ? void 0 : (_knownTypes$typesBund9 = _knownTypes$typesBund8[s]) == null ? void 0 : _knownTypes$typesBund9.types, _specVersion), filterVersions((_knownTypes$typesBund10 = knownTypes.typesBundle) == null ? void 0 : (_knownTypes$typesBund11 = _knownTypes$typesBund10.chain) == null ? void 0 : (_knownTypes$typesBund12 = _knownTypes$typesBund11[c]) == null ? void 0 : _knownTypes$typesBund12.types, _specVersion), (_knownTypes$typesSpec = knownTypes.typesSpec) == null ? void 0 : _knownTypes$typesSpec[s], (_knownTypes$typesChai = knownTypes.typesChain) == null ? void 0 : _knownTypes$typesChai[c], knownTypes.types)
56
- );
57
- });
31
+ export function getSpecTypes({ knownTypes }, chainName, specName, specVersion) {
32
+ const _specVersion = bnToBn(specVersion).toNumber();
33
+ return withNames(chainName, specName, (c, s) =>
34
+ // The order here is always, based on -
35
+ // - spec then chain
36
+ // - typesBundle takes higher precedence
37
+ // - types is the final catch-all override
38
+ objectSpread({}, filterVersions(typesSpec[s], _specVersion), filterVersions(typesChain[c], _specVersion), filterVersions(knownTypes.typesBundle?.spec?.[s]?.types, _specVersion), filterVersions(knownTypes.typesBundle?.chain?.[c]?.types, _specVersion), knownTypes.typesSpec?.[s], knownTypes.typesChain?.[c], knownTypes.types));
58
39
  }
59
-
60
40
  /**
61
41
  * @description Based on the chain or spec, return the hasher used
62
42
  */
63
- export function getSpecHasher({
64
- knownTypes
65
- }, chainName, specName) {
66
- return withNames(chainName, specName, (c, s) => {
67
- var _knownTypes$typesBund13, _knownTypes$typesBund14, _knownTypes$typesBund15, _knownTypes$typesBund16, _knownTypes$typesBund17, _knownTypes$typesBund18;
68
- return knownTypes.hasher || ((_knownTypes$typesBund13 = knownTypes.typesBundle) == null ? void 0 : (_knownTypes$typesBund14 = _knownTypes$typesBund13.chain) == null ? void 0 : (_knownTypes$typesBund15 = _knownTypes$typesBund14[c]) == null ? void 0 : _knownTypes$typesBund15.hasher) || ((_knownTypes$typesBund16 = knownTypes.typesBundle) == null ? void 0 : (_knownTypes$typesBund17 = _knownTypes$typesBund16.spec) == null ? void 0 : (_knownTypes$typesBund18 = _knownTypes$typesBund17[s]) == null ? void 0 : _knownTypes$typesBund18.hasher) || null;
69
- });
43
+ export function getSpecHasher({ knownTypes }, chainName, specName) {
44
+ return withNames(chainName, specName, (c, s) => knownTypes.hasher ||
45
+ knownTypes.typesBundle?.chain?.[c]?.hasher ||
46
+ knownTypes.typesBundle?.spec?.[s]?.hasher ||
47
+ null);
70
48
  }
71
-
72
49
  /**
73
50
  * @description Based on the chain and runtimeVersion, get the applicable rpc definitions (ready for registration)
74
51
  */
75
- export function getSpecRpc({
76
- knownTypes
77
- }, chainName, specName) {
78
- return withNames(chainName, specName, (c, s) => {
79
- var _knownTypes$typesBund19, _knownTypes$typesBund20, _knownTypes$typesBund21, _knownTypes$typesBund22, _knownTypes$typesBund23, _knownTypes$typesBund24;
80
- return objectSpread({}, (_knownTypes$typesBund19 = knownTypes.typesBundle) == null ? void 0 : (_knownTypes$typesBund20 = _knownTypes$typesBund19.spec) == null ? void 0 : (_knownTypes$typesBund21 = _knownTypes$typesBund20[s]) == null ? void 0 : _knownTypes$typesBund21.rpc, (_knownTypes$typesBund22 = knownTypes.typesBundle) == null ? void 0 : (_knownTypes$typesBund23 = _knownTypes$typesBund22.chain) == null ? void 0 : (_knownTypes$typesBund24 = _knownTypes$typesBund23[c]) == null ? void 0 : _knownTypes$typesBund24.rpc);
81
- });
52
+ export function getSpecRpc({ knownTypes }, chainName, specName) {
53
+ return withNames(chainName, specName, (c, s) => objectSpread({}, knownTypes.typesBundle?.spec?.[s]?.rpc, knownTypes.typesBundle?.chain?.[c]?.rpc));
82
54
  }
83
-
84
55
  /**
85
56
  * @description Based on the chain and runtimeVersion, get the applicable runtime definitions (ready for registration)
86
57
  */
87
- export function getSpecRuntime({
88
- knownTypes
89
- }, chainName, specName) {
90
- return withNames(chainName, specName, (c, s) => {
91
- var _knownTypes$typesBund25, _knownTypes$typesBund26, _knownTypes$typesBund27, _knownTypes$typesBund28, _knownTypes$typesBund29, _knownTypes$typesBund30;
92
- return objectSpread({}, (_knownTypes$typesBund25 = knownTypes.typesBundle) == null ? void 0 : (_knownTypes$typesBund26 = _knownTypes$typesBund25.spec) == null ? void 0 : (_knownTypes$typesBund27 = _knownTypes$typesBund26[s]) == null ? void 0 : _knownTypes$typesBund27.runtime, (_knownTypes$typesBund28 = knownTypes.typesBundle) == null ? void 0 : (_knownTypes$typesBund29 = _knownTypes$typesBund28.chain) == null ? void 0 : (_knownTypes$typesBund30 = _knownTypes$typesBund29[c]) == null ? void 0 : _knownTypes$typesBund30.runtime);
93
- });
58
+ export function getSpecRuntime({ knownTypes }, chainName, specName) {
59
+ return withNames(chainName, specName, (c, s) => objectSpread({}, knownTypes.typesBundle?.spec?.[s]?.runtime, knownTypes.typesBundle?.chain?.[c]?.runtime));
94
60
  }
95
-
96
61
  /**
97
62
  * @description Based on the chain and runtimeVersion, get the applicable alias definitions (ready for registration)
98
63
  */
99
- export function getSpecAlias({
100
- knownTypes
101
- }, chainName, specName) {
102
- return withNames(chainName, specName, (c, s) => {
103
- var _knownTypes$typesBund31, _knownTypes$typesBund32, _knownTypes$typesBund33, _knownTypes$typesBund34, _knownTypes$typesBund35, _knownTypes$typesBund36;
104
- return (
105
- // as per versions, first spec, then chain then finally non-versioned
106
- objectSpread({}, (_knownTypes$typesBund31 = knownTypes.typesBundle) == null ? void 0 : (_knownTypes$typesBund32 = _knownTypes$typesBund31.spec) == null ? void 0 : (_knownTypes$typesBund33 = _knownTypes$typesBund32[s]) == null ? void 0 : _knownTypes$typesBund33.alias, (_knownTypes$typesBund34 = knownTypes.typesBundle) == null ? void 0 : (_knownTypes$typesBund35 = _knownTypes$typesBund34.chain) == null ? void 0 : (_knownTypes$typesBund36 = _knownTypes$typesBund35[c]) == null ? void 0 : _knownTypes$typesBund36.alias, knownTypes.typesAlias)
107
- );
108
- });
64
+ export function getSpecAlias({ knownTypes }, chainName, specName) {
65
+ return withNames(chainName, specName, (c, s) =>
66
+ // as per versions, first spec, then chain then finally non-versioned
67
+ objectSpread({}, knownTypes.typesBundle?.spec?.[s]?.alias, knownTypes.typesBundle?.chain?.[c]?.alias, knownTypes.typesAlias));
109
68
  }
110
-
111
69
  /**
112
70
  * @description Returns a version record for known chains where upgrades are being tracked
113
71
  */
114
72
  export function getUpgradeVersion(genesisHash, blockNumber) {
115
- const known = upgrades.find(u => genesisHash.eq(u.genesisHash));
116
- return known ? [known.versions.reduce((last, version) => {
117
- return blockNumber.gt(version.blockNumber) ? version : last;
118
- }, undefined), known.versions.find(version => blockNumber.lte(version.blockNumber))] : [undefined, undefined];
73
+ const known = upgrades.find((u) => genesisHash.eq(u.genesisHash));
74
+ return known
75
+ ? [
76
+ known.versions.reduce((last, version) => {
77
+ return blockNumber.gt(version.blockNumber)
78
+ ? version
79
+ : last;
80
+ }, undefined),
81
+ known.versions.find((version) => blockNumber.lte(version.blockNumber))
82
+ ]
83
+ : [undefined, undefined];
119
84
  }