@polkadot/types-known 8.10.1 → 8.11.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.
@@ -11,6 +11,6 @@ const packageInfo = {
11
11
  name: '@polkadot/types-known',
12
12
  path: typeof __dirname === 'string' ? __dirname : 'auto',
13
13
  type: 'cjs',
14
- version: '8.10.1'
14
+ version: '8.11.1'
15
15
  };
16
16
  exports.packageInfo = packageInfo;
package/cjs/util.js CHANGED
@@ -9,6 +9,7 @@ exports.getSpecAlias = getSpecAlias;
9
9
  exports.getSpecExtensions = getSpecExtensions;
10
10
  exports.getSpecHasher = getSpecHasher;
11
11
  exports.getSpecRpc = getSpecRpc;
12
+ exports.getSpecRuntime = getSpecRuntime;
12
13
  exports.getSpecTypes = getSpecTypes;
13
14
  exports.getUpgradeVersion = getUpgradeVersion;
14
15
 
@@ -36,7 +37,7 @@ function filterVersions() {
36
37
  let {
37
38
  minmax: [min, max]
38
39
  } = _ref;
39
- return ((0, _util.isUndefined)(min) || (0, _util.isNull)(min) || specVersion >= min) && ((0, _util.isUndefined)(max) || (0, _util.isNull)(max) || specVersion <= max);
40
+ return (min === undefined || min === null || specVersion >= min) && (max === undefined || max === null || specVersion <= max);
40
41
  }).reduce((result, _ref2) => {
41
42
  let {
42
43
  types
@@ -109,19 +110,34 @@ function getSpecRpc(_ref6, chainName, specName) {
109
110
  });
110
111
  }
111
112
  /**
112
- * @description Based on the chain and runtimeVersion, get the applicable alias definitions (ready for registration)
113
+ * @description Based on the chain and runtimeVersion, get the applicable runtime definitions (ready for registration)
113
114
  */
114
115
 
115
116
 
116
- function getSpecAlias(_ref7, chainName, specName) {
117
+ function getSpecRuntime(_ref7, chainName, specName) {
117
118
  let {
118
119
  knownTypes
119
120
  } = _ref7;
120
121
  return withNames(chainName, specName, (c, s) => {
121
122
  var _knownTypes$typesBund25, _knownTypes$typesBund26, _knownTypes$typesBund27, _knownTypes$typesBund28, _knownTypes$typesBund29, _knownTypes$typesBund30;
122
123
 
124
+ return (0, _util.objectSpread)({}, (_knownTypes$typesBund25 = knownTypes.typesBundle) === null || _knownTypes$typesBund25 === void 0 ? void 0 : (_knownTypes$typesBund26 = _knownTypes$typesBund25.spec) === null || _knownTypes$typesBund26 === void 0 ? void 0 : (_knownTypes$typesBund27 = _knownTypes$typesBund26[s]) === null || _knownTypes$typesBund27 === void 0 ? void 0 : _knownTypes$typesBund27.runtime, (_knownTypes$typesBund28 = knownTypes.typesBundle) === null || _knownTypes$typesBund28 === void 0 ? void 0 : (_knownTypes$typesBund29 = _knownTypes$typesBund28.chain) === null || _knownTypes$typesBund29 === void 0 ? void 0 : (_knownTypes$typesBund30 = _knownTypes$typesBund29[c]) === null || _knownTypes$typesBund30 === void 0 ? void 0 : _knownTypes$typesBund30.runtime);
125
+ });
126
+ }
127
+ /**
128
+ * @description Based on the chain and runtimeVersion, get the applicable alias definitions (ready for registration)
129
+ */
130
+
131
+
132
+ function getSpecAlias(_ref8, chainName, specName) {
133
+ let {
134
+ knownTypes
135
+ } = _ref8;
136
+ return withNames(chainName, specName, (c, s) => {
137
+ var _knownTypes$typesBund31, _knownTypes$typesBund32, _knownTypes$typesBund33, _knownTypes$typesBund34, _knownTypes$typesBund35, _knownTypes$typesBund36;
138
+
123
139
  return (// as per versions, first spec, then chain then finally non-versioned
124
- (0, _util.objectSpread)({}, (_knownTypes$typesBund25 = knownTypes.typesBundle) === null || _knownTypes$typesBund25 === void 0 ? void 0 : (_knownTypes$typesBund26 = _knownTypes$typesBund25.spec) === null || _knownTypes$typesBund26 === void 0 ? void 0 : (_knownTypes$typesBund27 = _knownTypes$typesBund26[s]) === null || _knownTypes$typesBund27 === void 0 ? void 0 : _knownTypes$typesBund27.alias, (_knownTypes$typesBund28 = knownTypes.typesBundle) === null || _knownTypes$typesBund28 === void 0 ? void 0 : (_knownTypes$typesBund29 = _knownTypes$typesBund28.chain) === null || _knownTypes$typesBund29 === void 0 ? void 0 : (_knownTypes$typesBund30 = _knownTypes$typesBund29[c]) === null || _knownTypes$typesBund30 === void 0 ? void 0 : _knownTypes$typesBund30.alias, knownTypes.typesAlias)
140
+ (0, _util.objectSpread)({}, (_knownTypes$typesBund31 = knownTypes.typesBundle) === null || _knownTypes$typesBund31 === void 0 ? void 0 : (_knownTypes$typesBund32 = _knownTypes$typesBund31.spec) === null || _knownTypes$typesBund32 === void 0 ? void 0 : (_knownTypes$typesBund33 = _knownTypes$typesBund32[s]) === null || _knownTypes$typesBund33 === void 0 ? void 0 : _knownTypes$typesBund33.alias, (_knownTypes$typesBund34 = knownTypes.typesBundle) === null || _knownTypes$typesBund34 === void 0 ? void 0 : (_knownTypes$typesBund35 = _knownTypes$typesBund34.chain) === null || _knownTypes$typesBund35 === void 0 ? void 0 : (_knownTypes$typesBund36 = _knownTypes$typesBund35[c]) === null || _knownTypes$typesBund36 === void 0 ? void 0 : _knownTypes$typesBund36.alias, knownTypes.typesAlias)
125
141
  );
126
142
  });
127
143
  }
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "./cjs/detectPackage.js"
21
21
  ],
22
22
  "type": "module",
23
- "version": "8.10.1",
23
+ "version": "8.11.1",
24
24
  "main": "./cjs/index.js",
25
25
  "module": "./index.js",
26
26
  "types": "./index.d.ts",
@@ -147,11 +147,11 @@
147
147
  }
148
148
  },
149
149
  "dependencies": {
150
- "@babel/runtime": "^7.18.3",
151
- "@polkadot/networks": "^9.6.2",
152
- "@polkadot/types": "8.10.1",
153
- "@polkadot/types-codec": "8.10.1",
154
- "@polkadot/types-create": "8.10.1",
155
- "@polkadot/util": "^9.6.2"
150
+ "@babel/runtime": "^7.18.6",
151
+ "@polkadot/networks": "^9.7.1",
152
+ "@polkadot/types": "8.11.1",
153
+ "@polkadot/types-codec": "8.11.1",
154
+ "@polkadot/types-create": "8.11.1",
155
+ "@polkadot/util": "^9.7.1"
156
156
  }
157
157
  }
package/packageInfo.js CHANGED
@@ -5,5 +5,5 @@ export const packageInfo = {
5
5
  name: '@polkadot/types-known',
6
6
  path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
7
7
  type: 'esm',
8
- version: '8.10.1'
8
+ version: '8.11.1'
9
9
  };
package/util.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /// <reference types="bn.js" />
2
2
  import type { ExtDef } from '@polkadot/types/extrinsic/signedExtensions/types';
3
3
  import type { Hash } from '@polkadot/types/interfaces';
4
- import type { ChainUpgradeVersion, CodecHasher, DefinitionRpc, DefinitionRpcSub, OverrideModuleType, Registry, RegistryTypes } from '@polkadot/types/types';
4
+ import type { ChainUpgradeVersion, CodecHasher, DefinitionRpc, DefinitionRpcSub, DefinitionsCall, OverrideModuleType, Registry, RegistryTypes } from '@polkadot/types/types';
5
5
  import type { Text } from '@polkadot/types-codec';
6
6
  import type { BN } from '@polkadot/util';
7
7
  /**
@@ -17,6 +17,10 @@ export declare function getSpecHasher({ knownTypes }: Registry, chainName: Text
17
17
  * @description Based on the chain and runtimeVersion, get the applicable rpc definitions (ready for registration)
18
18
  */
19
19
  export declare function getSpecRpc({ knownTypes }: Registry, chainName: Text | string, specName: Text | string): Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>>;
20
+ /**
21
+ * @description Based on the chain and runtimeVersion, get the applicable runtime definitions (ready for registration)
22
+ */
23
+ export declare function getSpecRuntime({ knownTypes }: Registry, chainName: Text | string, specName: Text | string): DefinitionsCall;
20
24
  /**
21
25
  * @description Based on the chain and runtimeVersion, get the applicable alias definitions (ready for registration)
22
26
  */
package/util.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // Copyright 2017-2022 @polkadot/types-known authors & contributors
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- import { bnToBn, isNull, isUndefined, objectSpread } from '@polkadot/util';
3
+ import { bnToBn, objectSpread } from '@polkadot/util';
4
4
  import typesChain from "./chain/index.js";
5
5
  import typesSpec from "./spec/index.js";
6
6
  import upgrades from "./upgrades/index.js";
@@ -15,7 +15,7 @@ function withNames(chainName, specName, fn) {
15
15
  function filterVersions(versions = [], specVersion) {
16
16
  return versions.filter(({
17
17
  minmax: [min, max]
18
- }) => (isUndefined(min) || isNull(min) || specVersion >= min) && (isUndefined(max) || isNull(max) || specVersion <= max)).reduce((result, {
18
+ }) => (min === undefined || min === null || specVersion >= min) && (max === undefined || max === null || specVersion <= max)).reduce((result, {
19
19
  types
20
20
  }) => objectSpread(result, types), {});
21
21
  }
@@ -75,6 +75,19 @@ export function getSpecRpc({
75
75
  return objectSpread({}, (_knownTypes$typesBund19 = knownTypes.typesBundle) === null || _knownTypes$typesBund19 === void 0 ? void 0 : (_knownTypes$typesBund20 = _knownTypes$typesBund19.spec) === null || _knownTypes$typesBund20 === void 0 ? void 0 : (_knownTypes$typesBund21 = _knownTypes$typesBund20[s]) === null || _knownTypes$typesBund21 === void 0 ? void 0 : _knownTypes$typesBund21.rpc, (_knownTypes$typesBund22 = knownTypes.typesBundle) === null || _knownTypes$typesBund22 === void 0 ? void 0 : (_knownTypes$typesBund23 = _knownTypes$typesBund22.chain) === null || _knownTypes$typesBund23 === void 0 ? void 0 : (_knownTypes$typesBund24 = _knownTypes$typesBund23[c]) === null || _knownTypes$typesBund24 === void 0 ? void 0 : _knownTypes$typesBund24.rpc);
76
76
  });
77
77
  }
78
+ /**
79
+ * @description Based on the chain and runtimeVersion, get the applicable runtime definitions (ready for registration)
80
+ */
81
+
82
+ export function getSpecRuntime({
83
+ knownTypes
84
+ }, chainName, specName) {
85
+ return withNames(chainName, specName, (c, s) => {
86
+ var _knownTypes$typesBund25, _knownTypes$typesBund26, _knownTypes$typesBund27, _knownTypes$typesBund28, _knownTypes$typesBund29, _knownTypes$typesBund30;
87
+
88
+ return objectSpread({}, (_knownTypes$typesBund25 = knownTypes.typesBundle) === null || _knownTypes$typesBund25 === void 0 ? void 0 : (_knownTypes$typesBund26 = _knownTypes$typesBund25.spec) === null || _knownTypes$typesBund26 === void 0 ? void 0 : (_knownTypes$typesBund27 = _knownTypes$typesBund26[s]) === null || _knownTypes$typesBund27 === void 0 ? void 0 : _knownTypes$typesBund27.runtime, (_knownTypes$typesBund28 = knownTypes.typesBundle) === null || _knownTypes$typesBund28 === void 0 ? void 0 : (_knownTypes$typesBund29 = _knownTypes$typesBund28.chain) === null || _knownTypes$typesBund29 === void 0 ? void 0 : (_knownTypes$typesBund30 = _knownTypes$typesBund29[c]) === null || _knownTypes$typesBund30 === void 0 ? void 0 : _knownTypes$typesBund30.runtime);
89
+ });
90
+ }
78
91
  /**
79
92
  * @description Based on the chain and runtimeVersion, get the applicable alias definitions (ready for registration)
80
93
  */
@@ -83,10 +96,10 @@ export function getSpecAlias({
83
96
  knownTypes
84
97
  }, chainName, specName) {
85
98
  return withNames(chainName, specName, (c, s) => {
86
- var _knownTypes$typesBund25, _knownTypes$typesBund26, _knownTypes$typesBund27, _knownTypes$typesBund28, _knownTypes$typesBund29, _knownTypes$typesBund30;
99
+ var _knownTypes$typesBund31, _knownTypes$typesBund32, _knownTypes$typesBund33, _knownTypes$typesBund34, _knownTypes$typesBund35, _knownTypes$typesBund36;
87
100
 
88
101
  return (// as per versions, first spec, then chain then finally non-versioned
89
- objectSpread({}, (_knownTypes$typesBund25 = knownTypes.typesBundle) === null || _knownTypes$typesBund25 === void 0 ? void 0 : (_knownTypes$typesBund26 = _knownTypes$typesBund25.spec) === null || _knownTypes$typesBund26 === void 0 ? void 0 : (_knownTypes$typesBund27 = _knownTypes$typesBund26[s]) === null || _knownTypes$typesBund27 === void 0 ? void 0 : _knownTypes$typesBund27.alias, (_knownTypes$typesBund28 = knownTypes.typesBundle) === null || _knownTypes$typesBund28 === void 0 ? void 0 : (_knownTypes$typesBund29 = _knownTypes$typesBund28.chain) === null || _knownTypes$typesBund29 === void 0 ? void 0 : (_knownTypes$typesBund30 = _knownTypes$typesBund29[c]) === null || _knownTypes$typesBund30 === void 0 ? void 0 : _knownTypes$typesBund30.alias, knownTypes.typesAlias)
102
+ objectSpread({}, (_knownTypes$typesBund31 = knownTypes.typesBundle) === null || _knownTypes$typesBund31 === void 0 ? void 0 : (_knownTypes$typesBund32 = _knownTypes$typesBund31.spec) === null || _knownTypes$typesBund32 === void 0 ? void 0 : (_knownTypes$typesBund33 = _knownTypes$typesBund32[s]) === null || _knownTypes$typesBund33 === void 0 ? void 0 : _knownTypes$typesBund33.alias, (_knownTypes$typesBund34 = knownTypes.typesBundle) === null || _knownTypes$typesBund34 === void 0 ? void 0 : (_knownTypes$typesBund35 = _knownTypes$typesBund34.chain) === null || _knownTypes$typesBund35 === void 0 ? void 0 : (_knownTypes$typesBund36 = _knownTypes$typesBund35[c]) === null || _knownTypes$typesBund36 === void 0 ? void 0 : _knownTypes$typesBund36.alias, knownTypes.typesAlias)
90
103
  );
91
104
  });
92
105
  }