@polkadot/types-known 10.4.1 → 10.5.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 (65) hide show
  1. package/chain/index.d.ts +1 -2
  2. package/chain/index.js +1 -2
  3. package/cjs/chain/index.js +2 -2
  4. package/cjs/packageInfo.js +1 -1
  5. package/cjs/spec/centrifuge-chain.js +10 -9
  6. package/cjs/spec/index.js +22 -23
  7. package/cjs/spec/kusama.js +57 -30
  8. package/cjs/spec/node-template.js +2 -2
  9. package/cjs/spec/node.js +2 -2
  10. package/cjs/spec/polkadot.js +22 -13
  11. package/cjs/spec/rococo.js +19 -11
  12. package/cjs/spec/shell.js +2 -2
  13. package/cjs/spec/statemint.js +12 -9
  14. package/cjs/spec/westend.js +33 -16
  15. package/cjs/upgrades/e2e/index.js +3 -6
  16. package/cjs/upgrades/e2e/kusama.js +2 -2
  17. package/cjs/upgrades/e2e/polkadot.js +2 -2
  18. package/cjs/upgrades/e2e/westend.js +2 -2
  19. package/cjs/upgrades/index.js +2 -2
  20. package/cjs/upgrades/manual/index.js +3 -6
  21. package/cjs/upgrades/manual/kusama.js +2 -2
  22. package/cjs/upgrades/manual/polkadot.js +2 -2
  23. package/cjs/upgrades/manual/westend.js +2 -2
  24. package/cjs/util.js +36 -18
  25. package/package.json +6 -6
  26. package/packageInfo.js +1 -1
  27. package/spec/centrifuge-chain.d.ts +1 -2
  28. package/spec/centrifuge-chain.js +9 -9
  29. package/spec/index.d.ts +1 -2
  30. package/spec/index.js +10 -11
  31. package/spec/kusama.d.ts +1 -2
  32. package/spec/kusama.js +56 -30
  33. package/spec/node-template.d.ts +1 -2
  34. package/spec/node-template.js +1 -2
  35. package/spec/node.d.ts +1 -2
  36. package/spec/node.js +1 -2
  37. package/spec/polkadot.d.ts +1 -2
  38. package/spec/polkadot.js +21 -13
  39. package/spec/rococo.d.ts +1 -2
  40. package/spec/rococo.js +18 -11
  41. package/spec/shell.d.ts +1 -2
  42. package/spec/shell.js +1 -2
  43. package/spec/statemint.d.ts +1 -2
  44. package/spec/statemint.js +11 -9
  45. package/spec/westend.d.ts +1 -2
  46. package/spec/westend.js +32 -16
  47. package/upgrades/e2e/index.d.ts +3 -3
  48. package/upgrades/e2e/index.js +3 -3
  49. package/upgrades/e2e/kusama.d.ts +1 -2
  50. package/upgrades/e2e/kusama.js +1 -2
  51. package/upgrades/e2e/polkadot.d.ts +1 -2
  52. package/upgrades/e2e/polkadot.js +1 -2
  53. package/upgrades/e2e/westend.d.ts +1 -2
  54. package/upgrades/e2e/westend.js +1 -2
  55. package/upgrades/index.d.ts +1 -2
  56. package/upgrades/index.js +1 -2
  57. package/upgrades/manual/index.d.ts +3 -3
  58. package/upgrades/manual/index.js +3 -3
  59. package/upgrades/manual/kusama.d.ts +1 -2
  60. package/upgrades/manual/kusama.js +1 -2
  61. package/upgrades/manual/polkadot.d.ts +1 -2
  62. package/upgrades/manual/polkadot.js +1 -2
  63. package/upgrades/manual/westend.d.ts +1 -2
  64. package/upgrades/manual/westend.js +1 -2
  65. package/util.js +36 -17
package/spec/polkadot.js CHANGED
@@ -1,4 +1,3 @@
1
- import { objectSpread } from '@polkadot/util';
2
1
  const sharedTypes = {
3
2
  CompactAssignments: 'CompactAssignmentsWith16',
4
3
  DispatchErrorModule: 'DispatchErrorModuleU8',
@@ -26,41 +25,51 @@ const addrAccountIdTypes = {
26
25
  LookupSource: 'AccountId',
27
26
  ValidatorPrefs: 'ValidatorPrefsWithCommission'
28
27
  };
29
- const versioned = [
28
+ export const versioned = [
30
29
  {
31
30
  minmax: [0, 12],
32
- types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
31
+ types: {
32
+ ...sharedTypes,
33
+ ...addrAccountIdTypes,
33
34
  CompactAssignments: 'CompactAssignmentsTo257',
34
35
  OpenTip: 'OpenTipTo225',
35
36
  RefCount: 'RefCountTo259'
36
- })
37
+ }
37
38
  },
38
39
  {
39
40
  minmax: [13, 22],
40
- types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
41
+ types: {
42
+ ...sharedTypes,
43
+ ...addrAccountIdTypes,
41
44
  CompactAssignments: 'CompactAssignmentsTo257',
42
45
  RefCount: 'RefCountTo259'
43
- })
46
+ }
44
47
  },
45
48
  {
46
49
  minmax: [23, 24],
47
- types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
50
+ types: {
51
+ ...sharedTypes,
52
+ ...addrAccountIdTypes,
48
53
  RefCount: 'RefCountTo259'
49
- })
54
+ }
50
55
  },
51
56
  {
52
57
  minmax: [25, 27],
53
- types: objectSpread({}, sharedTypes, addrAccountIdTypes)
58
+ types: {
59
+ ...sharedTypes,
60
+ ...addrAccountIdTypes
61
+ }
54
62
  },
55
63
  {
56
64
  minmax: [28, 29],
57
- types: objectSpread({}, sharedTypes, {
65
+ types: {
66
+ ...sharedTypes,
58
67
  AccountInfo: 'AccountInfoWithDualRefCount'
59
- })
68
+ }
60
69
  },
61
70
  {
62
71
  minmax: [30, 9109],
63
- types: objectSpread({}, sharedTypes)
72
+ types: { ...sharedTypes }
64
73
  },
65
74
  {
66
75
  // metadata v14
@@ -78,4 +87,3 @@ const versioned = [
78
87
  // }
79
88
  // }
80
89
  ];
81
- export default versioned;
package/spec/rococo.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  import type { OverrideVersionedType } from '@polkadot/types/types';
2
- declare const versioned: OverrideVersionedType[];
3
- export default versioned;
2
+ export declare const versioned: OverrideVersionedType[];
package/spec/rococo.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { mapXcmTypes } from '@polkadot/types-create';
2
- import { objectSpread } from '@polkadot/util';
3
2
  /* eslint-disable sort-keys */
4
3
  const sharedTypes = {
5
4
  DispatchErrorModule: 'DispatchErrorModuleU8',
@@ -7,34 +6,43 @@ const sharedTypes = {
7
6
  Keys: 'SessionKeys7B',
8
7
  Weight: 'WeightV1'
9
8
  };
10
- const versioned = [
9
+ export const versioned = [
11
10
  {
12
11
  minmax: [0, 200],
13
- types: objectSpread({}, sharedTypes, {
12
+ types: {
13
+ ...sharedTypes,
14
14
  AccountInfo: 'AccountInfoWithDualRefCount',
15
15
  Address: 'AccountId',
16
16
  LookupSource: 'AccountId'
17
- })
17
+ }
18
18
  },
19
19
  {
20
20
  minmax: [201, 214],
21
- types: objectSpread({}, sharedTypes, {
21
+ types: {
22
+ ...sharedTypes,
22
23
  AccountInfo: 'AccountInfoWithDualRefCount'
23
- })
24
+ }
24
25
  },
25
26
  {
26
27
  minmax: [215, 228],
27
- types: objectSpread({}, sharedTypes, {
28
+ types: {
29
+ ...sharedTypes,
28
30
  Keys: 'SessionKeys6'
29
- })
31
+ }
30
32
  },
31
33
  {
32
34
  minmax: [229, 9099],
33
- types: objectSpread({}, sharedTypes, mapXcmTypes('V0'))
35
+ types: {
36
+ ...sharedTypes,
37
+ ...mapXcmTypes('V0')
38
+ }
34
39
  },
35
40
  {
36
41
  minmax: [9100, 9105],
37
- types: objectSpread({}, sharedTypes, mapXcmTypes('V1'))
42
+ types: {
43
+ ...sharedTypes,
44
+ ...mapXcmTypes('V1')
45
+ }
38
46
  },
39
47
  {
40
48
  // metadata v14
@@ -52,4 +60,3 @@ const versioned = [
52
60
  // }
53
61
  // }
54
62
  ];
55
- export default versioned;
package/spec/shell.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  import type { OverrideVersionedType } from '@polkadot/types/types';
2
- declare const versioned: OverrideVersionedType[];
3
- export default versioned;
2
+ export declare const versioned: OverrideVersionedType[];
package/spec/shell.js CHANGED
@@ -1,4 +1,4 @@
1
- const versioned = [
1
+ export const versioned = [
2
2
  {
3
3
  minmax: [0, undefined],
4
4
  types: {
@@ -6,4 +6,3 @@ const versioned = [
6
6
  }
7
7
  }
8
8
  ];
9
- export default versioned;
@@ -1,3 +1,2 @@
1
1
  import type { OverrideVersionedType } from '@polkadot/types/types';
2
- declare const versioned: OverrideVersionedType[];
3
- export default versioned;
2
+ export declare const versioned: OverrideVersionedType[];
package/spec/statemint.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { mapXcmTypes } from '@polkadot/types-create';
2
- import { objectSpread } from '@polkadot/util';
3
2
  const sharedTypes = {
4
3
  DispatchErrorModule: 'DispatchErrorModuleU8',
5
4
  TAssetBalance: 'u128',
@@ -16,21 +15,25 @@ const sharedTypes = {
16
15
  },
17
16
  Weight: 'WeightV1'
18
17
  };
19
- const versioned = [
18
+ export const versioned = [
20
19
  {
21
20
  minmax: [0, 3],
22
- types: objectSpread({
21
+ types: {
23
22
  // Enum was modified mid-flight -
24
23
  // https://github.com/paritytech/substrate/pull/10382/files#diff-e4e016b33a82268b6208dc974eea841bad47597865a749fee2f937eb6fdf67b4R498
25
- DispatchError: 'DispatchErrorPre6First'
26
- }, sharedTypes, mapXcmTypes('V0'))
24
+ DispatchError: 'DispatchErrorPre6First',
25
+ ...sharedTypes,
26
+ ...mapXcmTypes('V0')
27
+ }
27
28
  },
28
29
  {
29
30
  minmax: [4, 5],
30
- types: objectSpread({
31
+ types: {
31
32
  // As above, see https://github.com/polkadot-js/api/issues/5301
32
- DispatchError: 'DispatchErrorPre6First'
33
- }, sharedTypes, mapXcmTypes('V1'))
33
+ DispatchError: 'DispatchErrorPre6First',
34
+ ...sharedTypes,
35
+ ...mapXcmTypes('V1')
36
+ }
34
37
  },
35
38
  {
36
39
  // metadata V14
@@ -48,4 +51,3 @@ const versioned = [
48
51
  // }
49
52
  // }
50
53
  ];
51
- export default versioned;
package/spec/westend.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  import type { OverrideVersionedType } from '@polkadot/types/types';
2
- declare const versioned: OverrideVersionedType[];
3
- export default versioned;
2
+ export declare const versioned: OverrideVersionedType[];
package/spec/westend.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { mapXcmTypes } from '@polkadot/types-create';
2
- import { objectSpread } from '@polkadot/util';
3
2
  const sharedTypes = {
4
3
  // 16 validators
5
4
  CompactAssignments: 'CompactAssignmentsWith16',
@@ -22,10 +21,12 @@ const addrAccountIdTypes = {
22
21
  RawSolution: 'RawSolutionWith16',
23
22
  ValidatorPrefs: 'ValidatorPrefsWithCommission'
24
23
  };
25
- const versioned = [
24
+ export const versioned = [
26
25
  {
27
26
  minmax: [1, 2],
28
- types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
27
+ types: {
28
+ ...sharedTypes,
29
+ ...addrAccountIdTypes,
29
30
  CompactAssignments: 'CompactAssignmentsTo257',
30
31
  DispatchInfo: 'DispatchInfoTo244',
31
32
  Heartbeat: 'HeartbeatTo244',
@@ -33,52 +34,68 @@ const versioned = [
33
34
  OpenTip: 'OpenTipTo225',
34
35
  RefCount: 'RefCountTo259',
35
36
  Weight: 'u32'
36
- })
37
+ }
37
38
  },
38
39
  {
39
40
  minmax: [3, 22],
40
- types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
41
+ types: {
42
+ ...sharedTypes,
43
+ ...addrAccountIdTypes,
41
44
  CompactAssignments: 'CompactAssignmentsTo257',
42
45
  DispatchInfo: 'DispatchInfoTo244',
43
46
  Heartbeat: 'HeartbeatTo244',
44
47
  OpenTip: 'OpenTipTo225',
45
48
  RefCount: 'RefCountTo259'
46
- })
49
+ }
47
50
  },
48
51
  {
49
52
  minmax: [23, 42],
50
- types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
53
+ types: {
54
+ ...sharedTypes,
55
+ ...addrAccountIdTypes,
51
56
  CompactAssignments: 'CompactAssignmentsTo257',
52
57
  DispatchInfo: 'DispatchInfoTo244',
53
58
  Heartbeat: 'HeartbeatTo244',
54
59
  RefCount: 'RefCountTo259'
55
- })
60
+ }
56
61
  },
57
62
  {
58
63
  minmax: [43, 44],
59
- types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
64
+ types: {
65
+ ...sharedTypes,
66
+ ...addrAccountIdTypes,
60
67
  DispatchInfo: 'DispatchInfoTo244',
61
68
  Heartbeat: 'HeartbeatTo244',
62
69
  RefCount: 'RefCountTo259'
63
- })
70
+ }
64
71
  },
65
72
  {
66
73
  minmax: [45, 47],
67
- types: objectSpread({}, sharedTypes, addrAccountIdTypes)
74
+ types: {
75
+ ...sharedTypes,
76
+ ...addrAccountIdTypes
77
+ }
68
78
  },
69
79
  {
70
80
  minmax: [48, 49],
71
- types: objectSpread({}, sharedTypes, {
81
+ types: {
82
+ ...sharedTypes,
72
83
  AccountInfo: 'AccountInfoWithDualRefCount'
73
- })
84
+ }
74
85
  },
75
86
  {
76
87
  minmax: [50, 9099],
77
- types: objectSpread({}, sharedTypes, mapXcmTypes('V0'))
88
+ types: {
89
+ ...sharedTypes,
90
+ ...mapXcmTypes('V0')
91
+ }
78
92
  },
79
93
  {
80
94
  minmax: [9100, 9105],
81
- types: objectSpread({}, sharedTypes, mapXcmTypes('V1'))
95
+ types: {
96
+ ...sharedTypes,
97
+ ...mapXcmTypes('V1')
98
+ }
82
99
  },
83
100
  {
84
101
  // metadata v14
@@ -96,4 +113,3 @@ const versioned = [
96
113
  // }
97
114
  // }
98
115
  ];
99
- export default versioned;
@@ -1,3 +1,3 @@
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
+ export { upgrades as kusama } from './kusama.js';
2
+ export { upgrades as polkadot } from './polkadot.js';
3
+ export { upgrades as westend } from './westend.js';
@@ -1,3 +1,3 @@
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
+ export { upgrades as kusama } from './kusama.js';
2
+ export { upgrades as polkadot } from './polkadot.js';
3
+ export { upgrades as westend } from './westend.js';
@@ -1,3 +1,2 @@
1
1
  import type { ChainUpgradesExpanded } from '../types.js';
2
- declare const upgrades: ChainUpgradesExpanded;
3
- export default upgrades;
2
+ export declare const upgrades: ChainUpgradesExpanded;
@@ -1,4 +1,4 @@
1
- const upgrades = [
1
+ export const upgrades = [
2
2
  [
3
3
  0,
4
4
  1020,
@@ -4172,4 +4172,3 @@ const upgrades = [
4172
4172
  ]
4173
4173
  ]
4174
4174
  ];
4175
- export default upgrades;
@@ -1,3 +1,2 @@
1
1
  import type { ChainUpgradesExpanded } from '../types.js';
2
- declare const upgrades: ChainUpgradesExpanded;
3
- export default upgrades;
2
+ export declare const upgrades: ChainUpgradesExpanded;
@@ -1,4 +1,4 @@
1
- const upgrades = [
1
+ export const upgrades = [
2
2
  [
3
3
  0,
4
4
  0,
@@ -2622,4 +2622,3 @@ const upgrades = [
2622
2622
  ]
2623
2623
  ]
2624
2624
  ];
2625
- export default upgrades;
@@ -1,3 +1,2 @@
1
1
  import type { ChainUpgradesExpanded } from '../types.js';
2
- declare const upgrades: ChainUpgradesExpanded;
3
- export default upgrades;
2
+ export declare const upgrades: ChainUpgradesExpanded;
@@ -1,4 +1,4 @@
1
- const upgrades = [
1
+ export const upgrades = [
2
2
  [
3
3
  214356,
4
4
  4,
@@ -4010,4 +4010,3 @@ const upgrades = [
4010
4010
  ]
4011
4011
  ]
4012
4012
  ];
4013
- export default upgrades;
@@ -1,3 +1,2 @@
1
1
  import type { ChainUpgrades } from '@polkadot/types/types';
2
- declare const upgrades: ChainUpgrades[];
3
- export default upgrades;
2
+ export declare const upgrades: ChainUpgrades[];
package/upgrades/index.js CHANGED
@@ -22,5 +22,4 @@ function mapRaw([network, versions]) {
22
22
  }))
23
23
  };
24
24
  }
25
- const upgrades = Object.entries(allKnown).map(mapRaw);
26
- export default upgrades;
25
+ export const upgrades = Object.entries(allKnown).map(mapRaw);
@@ -1,3 +1,3 @@
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
+ export { upgrades as kusama } from './kusama.js';
2
+ export { upgrades as polkadot } from './polkadot.js';
3
+ export { upgrades as westend } from './westend.js';
@@ -1,3 +1,3 @@
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
+ export { upgrades as kusama } from './kusama.js';
2
+ export { upgrades as polkadot } from './polkadot.js';
3
+ export { upgrades as westend } from './westend.js';
@@ -1,3 +1,2 @@
1
1
  import type { ChainUpgradesRaw } from '../types.js';
2
- declare const upgrades: ChainUpgradesRaw;
3
- export default upgrades;
2
+ export declare const upgrades: ChainUpgradesRaw;
@@ -1,4 +1,4 @@
1
- const upgrades = [
1
+ export const upgrades = [
2
2
  [0, 1020], [26669, 1021], [38245, 1022], [54248, 1023], [59659, 1024],
3
3
  [67651, 1025], [82191, 1027], [83238, 1028], [101503, 1029], [203466, 1030],
4
4
  [295787, 1031], [461692, 1032], [504329, 1033], [569327, 1038], [587687, 1039],
@@ -16,4 +16,3 @@ const upgrades = [
16
16
  // we have 9340 via system.setStorage (whitelist.WhitelistedCallDispatched event)
17
17
  [15680713, 9340], [15756296, 9350]
18
18
  ];
19
- export default upgrades;
@@ -1,3 +1,2 @@
1
1
  import type { ChainUpgradesRaw } from '../types.js';
2
- declare const upgrades: ChainUpgradesRaw;
3
- export default upgrades;
2
+ export declare const upgrades: ChainUpgradesRaw;
@@ -1,4 +1,4 @@
1
- const upgrades = [
1
+ export const upgrades = [
2
2
  [0, 0], [29231, 1], [188836, 5], [199405, 6], [214264, 7],
3
3
  [244358, 8], [303079, 9], [314201, 10], [342400, 11], [443963, 12],
4
4
  [528470, 13], [687751, 14], [746085, 15], [787923, 16], [799302, 17],
@@ -9,4 +9,3 @@ const upgrades = [
9
9
  [10458576, 9200], [10655116, 9220], [10879371, 9230], [11328884, 9250], [11532856, 9260],
10
10
  [11933818, 9270], [12217535, 9280], [12245277, 9281], [12532644, 9291], [12876189, 9300]
11
11
  ];
12
- export default upgrades;
@@ -1,3 +1,2 @@
1
1
  import type { ChainUpgradesRaw } from '../types.js';
2
- declare const upgrades: ChainUpgradesRaw;
3
- export default upgrades;
2
+ export declare const upgrades: ChainUpgradesRaw;
@@ -1,4 +1,4 @@
1
- const upgrades = [
1
+ export const upgrades = [
2
2
  [214356, 4], [392764, 7], [409740, 8], [809976, 20], [877581, 24],
3
3
  [879238, 25], [889472, 26], [902937, 27], [932751, 28], [991142, 29],
4
4
  [1030162, 31], [1119657, 32], [1199282, 33], [1342534, 34], [1392263, 35],
@@ -14,4 +14,3 @@ const upgrades = [
14
14
  [12604343, 9290], [12841034, 9300], [13128237, 9310], [13272363, 9320], [13483497, 9330],
15
15
  [13649433, 9340], [13761100, 9350]
16
16
  ];
17
- export default upgrades;
package/util.js CHANGED
@@ -1,7 +1,7 @@
1
- import { bnToBn, objectSpread } from '@polkadot/util';
2
- import typesChain from './chain/index.js';
3
- import typesSpec from './spec/index.js';
4
- import upgrades from './upgrades/index.js';
1
+ import { bnToBn } from '@polkadot/util';
2
+ import { typesChain } from './chain/index.js';
3
+ import { typesSpec } from './spec/index.js';
4
+ import { upgrades } from './upgrades/index.js';
5
5
  /**
6
6
  * @description Perform the callback function using the stringified spec/chain
7
7
  * @internal
@@ -17,25 +17,35 @@ function filterVersions(versions = [], specVersion) {
17
17
  return versions
18
18
  .filter(({ minmax: [min, max] }) => (min === undefined || min === null || specVersion >= min) &&
19
19
  (max === undefined || max === null || specVersion <= max))
20
- .reduce((result, { types }) => objectSpread(result, types), {});
20
+ .reduce((result, { types }) => ({ ...result, ...types }), {});
21
21
  }
22
22
  /**
23
23
  * @description Based on the chain and runtimeVersion, get the applicable signed extensions (ready for registration)
24
24
  */
25
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));
26
+ return withNames(chainName, specName, (c, s) => ({
27
+ ...(knownTypes.typesBundle?.spec?.[s]?.signedExtensions ?? {}),
28
+ ...(knownTypes.typesBundle?.chain?.[c]?.signedExtensions ?? {})
29
+ }));
27
30
  }
28
31
  /**
29
32
  * @description Based on the chain and runtimeVersion, get the applicable types (ready for registration)
30
33
  */
31
34
  export function getSpecTypes({ knownTypes }, chainName, specName, specVersion) {
32
35
  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));
36
+ return withNames(chainName, specName, (c, s) => ({
37
+ // The order here is always, based on -
38
+ // - spec then chain
39
+ // - typesBundle takes higher precedence
40
+ // - types is the final catch-all override
41
+ ...filterVersions(typesSpec[s], _specVersion),
42
+ ...filterVersions(typesChain[c], _specVersion),
43
+ ...filterVersions(knownTypes.typesBundle?.spec?.[s]?.types, _specVersion),
44
+ ...filterVersions(knownTypes.typesBundle?.chain?.[c]?.types, _specVersion),
45
+ ...(knownTypes.typesSpec?.[s] ?? {}),
46
+ ...(knownTypes.typesChain?.[c] ?? {}),
47
+ ...(knownTypes.types ?? {})
48
+ }));
39
49
  }
40
50
  /**
41
51
  * @description Based on the chain or spec, return the hasher used
@@ -50,21 +60,30 @@ export function getSpecHasher({ knownTypes }, chainName, specName) {
50
60
  * @description Based on the chain and runtimeVersion, get the applicable rpc definitions (ready for registration)
51
61
  */
52
62
  export function getSpecRpc({ knownTypes }, chainName, specName) {
53
- return withNames(chainName, specName, (c, s) => objectSpread({}, knownTypes.typesBundle?.spec?.[s]?.rpc, knownTypes.typesBundle?.chain?.[c]?.rpc));
63
+ return withNames(chainName, specName, (c, s) => ({
64
+ ...(knownTypes.typesBundle?.spec?.[s]?.rpc ?? {}),
65
+ ...(knownTypes.typesBundle?.chain?.[c]?.rpc ?? {})
66
+ }));
54
67
  }
55
68
  /**
56
69
  * @description Based on the chain and runtimeVersion, get the applicable runtime definitions (ready for registration)
57
70
  */
58
71
  export function getSpecRuntime({ knownTypes }, chainName, specName) {
59
- return withNames(chainName, specName, (c, s) => objectSpread({}, knownTypes.typesBundle?.spec?.[s]?.runtime, knownTypes.typesBundle?.chain?.[c]?.runtime));
72
+ return withNames(chainName, specName, (c, s) => ({
73
+ ...(knownTypes.typesBundle?.spec?.[s]?.runtime ?? {}),
74
+ ...(knownTypes.typesBundle?.chain?.[c]?.runtime ?? {})
75
+ }));
60
76
  }
61
77
  /**
62
78
  * @description Based on the chain and runtimeVersion, get the applicable alias definitions (ready for registration)
63
79
  */
64
80
  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));
81
+ return withNames(chainName, specName, (c, s) => ({
82
+ // as per versions, first spec, then chain then finally non-versioned
83
+ ...(knownTypes.typesBundle?.spec?.[s]?.alias ?? {}),
84
+ ...(knownTypes.typesBundle?.chain?.[c]?.alias ?? {}),
85
+ ...(knownTypes.typesAlias ?? {})
86
+ }));
68
87
  }
69
88
  /**
70
89
  * @description Returns a version record for known chains where upgrades are being tracked