@dedot/codegen 0.0.1-next.7198a1c5.13 → 0.0.1-next.91b52b9f.16

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.
@@ -96,7 +96,7 @@ class RuntimeApisGen extends RpcGen_1.RpcGen {
96
96
  }
97
97
  #targetRuntimeApiSpecs() {
98
98
  const specs = this.runtimeApis.map(([runtimeApiHash, version]) => {
99
- const runtimeApiSpec = (0, specs_1.findRuntimeApiSpec)(runtimeApiHash, version);
99
+ const runtimeApiSpec = this.#findRuntimeApiSpec(runtimeApiHash, version);
100
100
  if (!runtimeApiSpec)
101
101
  return;
102
102
  return {
@@ -111,5 +111,9 @@ class RuntimeApisGen extends RpcGen_1.RpcGen {
111
111
  return [...o, spec];
112
112
  }, []);
113
113
  }
114
+ #findRuntimeApiSpec = (runtimeApiHash, version) => {
115
+ const runtimeApiName = (0, specs_1.getRuntimeApiNames)().find((one) => (0, utils_2.calculateRuntimeApiHash)(one) === runtimeApiHash);
116
+ return (0, specs_1.getRuntimeApiSpecs)().find((one) => one.runtimeApiName === runtimeApiName && one.version === version);
117
+ };
114
118
  }
115
119
  exports.RuntimeApisGen = RuntimeApisGen;
@@ -1,4 +1,4 @@
1
- import { findRuntimeApiSpec } from '@dedot/specs';
1
+ import { getRuntimeApiNames, getRuntimeApiSpecs } from '@dedot/specs';
2
2
  import { beautifySourceCode, commentBlock, compileTemplate } from './utils';
3
3
  import { calculateRuntimeApiHash, stringSnakeCase } from '@dedot/utils';
4
4
  import { RpcGen } from './RpcGen';
@@ -93,7 +93,7 @@ export class RuntimeApisGen extends RpcGen {
93
93
  }
94
94
  #targetRuntimeApiSpecs() {
95
95
  const specs = this.runtimeApis.map(([runtimeApiHash, version]) => {
96
- const runtimeApiSpec = findRuntimeApiSpec(runtimeApiHash, version);
96
+ const runtimeApiSpec = this.#findRuntimeApiSpec(runtimeApiHash, version);
97
97
  if (!runtimeApiSpec)
98
98
  return;
99
99
  return {
@@ -108,4 +108,8 @@ export class RuntimeApisGen extends RpcGen {
108
108
  return [...o, spec];
109
109
  }, []);
110
110
  }
111
+ #findRuntimeApiSpec = (runtimeApiHash, version) => {
112
+ const runtimeApiName = getRuntimeApiNames().find((one) => calculateRuntimeApiHash(one) === runtimeApiHash);
113
+ return getRuntimeApiSpecs().find((one) => one.runtimeApiName === runtimeApiName && one.version === version);
114
+ };
111
115
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dedot/codegen",
3
- "version": "0.0.1-next.7198a1c5.13+7198a1c",
3
+ "version": "0.0.1-next.91b52b9f.16+91b52b9",
4
4
  "description": "Generate types",
5
5
  "author": "Thang X. Vu <thang@coongcrafts.io>",
6
6
  "homepage": "https://github.com/dedotdev/dedot/tree/main/packages/codegen",
@@ -18,12 +18,12 @@
18
18
  "copy": "cp -R ./src/templates ./dist && cp -R ./src/templates ./dist/cjs"
19
19
  },
20
20
  "dependencies": {
21
- "@dedot/codecs": "0.0.1-next.7198a1c5.13+7198a1c",
22
- "@dedot/shape": "0.0.1-next.7198a1c5.13+7198a1c",
23
- "@dedot/specs": "0.0.1-next.7198a1c5.13+7198a1c",
24
- "@dedot/utils": "0.0.1-next.7198a1c5.13+7198a1c",
21
+ "@dedot/codecs": "0.0.1-next.91b52b9f.16+91b52b9",
22
+ "@dedot/shape": "0.0.1-next.91b52b9f.16+91b52b9",
23
+ "@dedot/specs": "0.0.1-next.91b52b9f.16+91b52b9",
24
+ "@dedot/utils": "0.0.1-next.91b52b9f.16+91b52b9",
25
25
  "@polkadot/util": "^12.6.2",
26
- "dedot": "0.0.1-next.7198a1c5.13+7198a1c",
26
+ "dedot": "0.0.1-next.91b52b9f.16+91b52b9",
27
27
  "handlebars": "^4.7.8",
28
28
  "prettier": "^3.0.3"
29
29
  },
@@ -32,7 +32,7 @@
32
32
  "directory": "dist"
33
33
  },
34
34
  "license": "Apache-2.0",
35
- "gitHead": "7198a1c5939de990631fd8501e4620d7482e5f36",
35
+ "gitHead": "91b52b9fd16fe468b34a958e6367fd2a7891268f",
36
36
  "module": "./index.js",
37
37
  "types": "./index.d.ts",
38
38
  "exports": {