@dedot/codegen 0.0.1-alpha.23 → 0.0.1-alpha.25

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.
@@ -30,18 +30,20 @@ class RuntimeApisGen extends RpcGen_1.RpcGen {
30
30
  });
31
31
  }
32
32
  else {
33
- const specsByModule = this.#runtimeApisSpecsByModule();
34
- Object.values(specsByModule).forEach((specs) => {
35
- specs.forEach(({ methods, runtimeApiName, runtimeApiHash, version }) => {
36
- runtimeCallsOut += (0, utils_1.commentBlock)(`@runtimeapi: ${runtimeApiName} - ${runtimeApiHash}`, `@version: ${version}`);
37
- runtimeCallsOut += `${(0, util_1.stringCamelCase)(runtimeApiName)}: {
33
+ const specs = this.#targetRuntimeApiSpecs();
34
+ specs.forEach(({ methods, runtimeApiName, runtimeApiHash, version }) => {
35
+ runtimeCallsOut += (0, utils_1.commentBlock)(`@runtimeapi: ${runtimeApiName} - ${runtimeApiHash}`, `@version: ${version}`);
36
+ runtimeCallsOut += `${(0, util_1.stringCamelCase)(runtimeApiName)}: {
38
37
  ${Object.keys(methods)
39
- .map((methodName) => this.#generateMethodDefFromSpec({ ...methods[methodName], runtimeApiName, methodName }))
40
- .join('\n')}
38
+ .map((methodName) => this.#generateMethodDefFromSpec({
39
+ ...methods[methodName],
40
+ runtimeApiName,
41
+ methodName,
42
+ }))
43
+ .join('\n')}
41
44
 
42
45
  ${(0, utils_1.commentBlock)('Generic runtime api call')}[method: string]: GenericRuntimeApiMethod
43
46
  }`;
44
- });
45
47
  });
46
48
  }
47
49
  const importTypes = this.typesGen.typeImports.toImports();
@@ -92,7 +94,7 @@ class RuntimeApisGen extends RpcGen_1.RpcGen {
92
94
  .join(', ');
93
95
  return `${(0, utils_1.commentBlock)(docs, '\n', defaultDocs, typedInputs.map(({ type, name }) => `@param {${type}} ${name}`))}${(0, util_1.stringCamelCase)(methodName)}: GenericRuntimeApiMethod<(${paramsOut}) => Promise<${typeOut}>>`;
94
96
  }
95
- #runtimeApisSpecsByModule() {
97
+ #targetRuntimeApiSpecs() {
96
98
  const specs = this.runtimeApis.map(([runtimeApiHash, version]) => {
97
99
  const runtimeApiSpec = (0, specs_1.findRuntimeApiSpec)(runtimeApiHash, version);
98
100
  if (!runtimeApiSpec)
@@ -106,15 +108,8 @@ class RuntimeApisGen extends RpcGen_1.RpcGen {
106
108
  if (!spec) {
107
109
  return o;
108
110
  }
109
- const { moduleName } = spec;
110
- if (!moduleName) {
111
- return o;
112
- }
113
- return {
114
- ...o,
115
- [moduleName]: o[moduleName] ? [...o[moduleName], spec] : [spec],
116
- };
117
- }, {});
111
+ return [...o, spec];
112
+ }, []);
118
113
  }
119
114
  }
120
115
  exports.RuntimeApisGen = RuntimeApisGen;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.currentDirname = () => {
4
+ return __dirname;
5
+ };
@@ -26,12 +26,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.isReservedWord = exports.compileTemplate = exports.beautifySourceCode = exports.resolveFilePath = exports.commentBlock = exports.TUPLE_TYPE_REGEX = exports.WRAPPER_TYPE_REGEX = void 0;
29
+ exports.isReservedWord = exports.compileTemplate = exports.beautifySourceCode = exports.commentBlock = exports.TUPLE_TYPE_REGEX = exports.WRAPPER_TYPE_REGEX = void 0;
30
30
  const fs = __importStar(require("fs"));
31
31
  const handlebars_1 = __importDefault(require("handlebars"));
32
32
  const path = __importStar(require("path"));
33
- const process = __importStar(require("process"));
34
33
  const prettier = __importStar(require("prettier"));
34
+ const dirname_1 = require("./dirname");
35
35
  exports.WRAPPER_TYPE_REGEX = /^(\w+)<(.*)>$/;
36
36
  exports.TUPLE_TYPE_REGEX = /^\[(.*)]$/;
37
37
  const commentBlock = (...docs) => {
@@ -48,18 +48,13 @@ ${flatLines.map((line) => `* ${line.replaceAll(/\s+/g, ' ').trim()}`).join('\n')
48
48
  }
49
49
  };
50
50
  exports.commentBlock = commentBlock;
51
- const resolveFilePath = (relativePath) => {
52
- relativePath = Array.isArray(relativePath) ? relativePath : [relativePath];
53
- return path.resolve(process.cwd(), ...relativePath);
54
- };
55
- exports.resolveFilePath = resolveFilePath;
56
51
  const beautifySourceCode = async (source) => {
57
- const prettierOptions = await prettier.resolveConfig((0, exports.resolveFilePath)('./.prettierrc.js'));
52
+ const prettierOptions = await prettier.resolveConfig(path.resolve((0, dirname_1.currentDirname)(), '../../../../.prettierrc.js'));
58
53
  return prettier.format(source, { parser: 'babel-ts', ...prettierOptions });
59
54
  };
60
55
  exports.beautifySourceCode = beautifySourceCode;
61
56
  const compileTemplate = (templateFileName) => {
62
- const templateFilePath = (0, exports.resolveFilePath)(`packages/codegen/src/templates/${templateFileName}`);
57
+ const templateFilePath = path.resolve((0, dirname_1.currentDirname)(), `../templates/${templateFileName}`);
63
58
  return handlebars_1.default.compile(fs.readFileSync(templateFilePath, 'utf8'));
64
59
  };
65
60
  exports.compileTemplate = compileTemplate;
package/cjs/index.js CHANGED
@@ -27,29 +27,32 @@ exports.generateTypes = exports.generateTypesFromChain = void 0;
27
27
  const dedot_1 = require("dedot");
28
28
  const fs = __importStar(require("fs"));
29
29
  const path = __importStar(require("path"));
30
- const process = __importStar(require("process"));
31
30
  const generator_1 = require("./generator");
31
+ const util_1 = require("@polkadot/util");
32
32
  async function generateTypesFromChain(network, endpoint, outDir) {
33
33
  const api = await dedot_1.Dedot.create(endpoint);
34
34
  const { methods } = await api.rpc.rpc.methods();
35
35
  const apis = api.runtimeVersion?.apis || [];
36
+ if (!network.chain) {
37
+ network.chain = (0, util_1.stringCamelCase)(api.runtimeVersion?.specName || api.runtimeChain || 'local');
38
+ }
36
39
  await generateTypes(network, api.metadataLatest, methods, apis, outDir);
37
40
  await api.disconnect();
38
41
  }
39
42
  exports.generateTypesFromChain = generateTypesFromChain;
40
43
  async function generateTypes(network, metadata, rpcMethods, runtimeApis, outDir = '.') {
41
- const dirPath = path.resolve(process.cwd(), outDir, network.chain);
42
- const defTypesFileName = path.join(dirPath, `types.ts`);
43
- const constsTypesFileName = path.join(dirPath, `consts.ts`);
44
- const queryTypesFileName = path.join(dirPath, `query.ts`);
45
- const rpcCallsFileName = path.join(dirPath, `rpc.ts`);
46
- const indexFileName = path.join(dirPath, `index.ts`);
47
- const errorsFileName = path.join(dirPath, `errors.ts`);
48
- const eventsFileName = path.join(dirPath, `events.ts`);
49
- const runtimeApisFileName = path.join(dirPath, `runtime.ts`);
50
- const txFileName = path.join(dirPath, `tx.ts`);
44
+ const dirPath = path.resolve(outDir, network.chain);
45
+ const defTypesFileName = path.join(dirPath, `types.d.ts`);
46
+ const constsTypesFileName = path.join(dirPath, `consts.d.ts`);
47
+ const queryTypesFileName = path.join(dirPath, `query.d.ts`);
48
+ const rpcCallsFileName = path.join(dirPath, `rpc.d.ts`);
49
+ const indexFileName = path.join(dirPath, `index.d.ts`);
50
+ const errorsFileName = path.join(dirPath, `errors.d.ts`);
51
+ const eventsFileName = path.join(dirPath, `events.d.ts`);
52
+ const runtimeApisFileName = path.join(dirPath, `runtime.d.ts`);
53
+ const txFileName = path.join(dirPath, `tx.d.ts`);
51
54
  if (!fs.existsSync(dirPath)) {
52
- fs.mkdirSync(dirPath);
55
+ fs.mkdirSync(dirPath, { recursive: true });
53
56
  }
54
57
  const typesGen = new generator_1.TypesGen(metadata);
55
58
  const constsGen = new generator_1.ConstsGen(typesGen);
@@ -2,4 +2,4 @@
2
2
  // THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.packageInfo = void 0;
5
- exports.packageInfo = { name: '@dedot/codegen', version: '0.0.1-alpha.22' };
5
+ exports.packageInfo = { name: '@dedot/codegen', version: '0.0.1-alpha.24' };
@@ -0,0 +1,7 @@
1
+ // Generated by @dedot/codegen
2
+
3
+ {{{ importTypes }}}
4
+
5
+ export interface ChainConsts extends GenericChainConsts {
6
+ {{{ defTypeOut }}}
7
+ }
@@ -0,0 +1,7 @@
1
+ // Generated by @dedot/codegen
2
+
3
+ {{{ importTypes }}}
4
+
5
+ export interface ChainErrors extends GenericChainErrors {
6
+ {{{ defTypeOut }}}
7
+ }
@@ -0,0 +1,7 @@
1
+ // Generated by @dedot/codegen
2
+
3
+ {{{ importTypes }}}
4
+
5
+ export interface ChainEvents extends GenericChainEvents {
6
+ {{{ defTypeOut }}}
7
+ }
@@ -0,0 +1,22 @@
1
+ // Generated by @dedot/codegen
2
+
3
+ import { GenericSubstrateApi } from '@dedot/types';
4
+ import { ChainConsts } from './consts';
5
+ import { ChainStorage } from './query';
6
+ import { RpcCalls } from './rpc';
7
+ import { ChainErrors } from './errors';
8
+ import { ChainEvents } from './events';
9
+ import { RuntimeApis } from './runtime';
10
+ import { ChainTx } from './tx';
11
+
12
+ export * from './types';
13
+
14
+ export interface {{{interfaceName}}}Api extends GenericSubstrateApi {
15
+ rpc: RpcCalls;
16
+ consts: ChainConsts;
17
+ query: ChainStorage;
18
+ errors: ChainErrors;
19
+ events: ChainEvents;
20
+ call: RuntimeApis;
21
+ tx: ChainTx;
22
+ }
@@ -0,0 +1,7 @@
1
+ // Generated by @dedot/codegen
2
+
3
+ {{{ importTypes }}}
4
+
5
+ export interface ChainStorage extends GenericChainStorage {
6
+ {{{ defTypeOut }}}
7
+ }
@@ -0,0 +1,7 @@
1
+ // Generated by @dedot/codegen
2
+
3
+ {{{ importTypes }}}
4
+
5
+ export interface RpcCalls extends GenericRpcCalls {
6
+ {{{rpcCallsOut}}}
7
+ }
@@ -0,0 +1,8 @@
1
+ // Generated by @dedot/codegen
2
+
3
+ {{{ importTypes }}}
4
+
5
+ export interface RuntimeApis extends GenericRuntimeApis {
6
+ {{{ runtimeCallsOut }}}
7
+ }
8
+
@@ -0,0 +1,9 @@
1
+ // Generated by @dedot/codegen
2
+
3
+ {{{ importTypes }}}
4
+
5
+ {{{ defTypes }}}
6
+
7
+ export interface ChainTx extends GenericChainTx<TxCall> {
8
+ {{{ txDefsOut }}}
9
+ }
@@ -0,0 +1,5 @@
1
+ // Generated by @dedot/codegen
2
+
3
+ {{{ importTypes }}}
4
+
5
+ {{{ defTypeOut }}}
@@ -27,18 +27,20 @@ export class RuntimeApisGen extends RpcGen {
27
27
  });
28
28
  }
29
29
  else {
30
- const specsByModule = this.#runtimeApisSpecsByModule();
31
- Object.values(specsByModule).forEach((specs) => {
32
- specs.forEach(({ methods, runtimeApiName, runtimeApiHash, version }) => {
33
- runtimeCallsOut += commentBlock(`@runtimeapi: ${runtimeApiName} - ${runtimeApiHash}`, `@version: ${version}`);
34
- runtimeCallsOut += `${stringCamelCase(runtimeApiName)}: {
30
+ const specs = this.#targetRuntimeApiSpecs();
31
+ specs.forEach(({ methods, runtimeApiName, runtimeApiHash, version }) => {
32
+ runtimeCallsOut += commentBlock(`@runtimeapi: ${runtimeApiName} - ${runtimeApiHash}`, `@version: ${version}`);
33
+ runtimeCallsOut += `${stringCamelCase(runtimeApiName)}: {
35
34
  ${Object.keys(methods)
36
- .map((methodName) => this.#generateMethodDefFromSpec({ ...methods[methodName], runtimeApiName, methodName }))
37
- .join('\n')}
35
+ .map((methodName) => this.#generateMethodDefFromSpec({
36
+ ...methods[methodName],
37
+ runtimeApiName,
38
+ methodName,
39
+ }))
40
+ .join('\n')}
38
41
 
39
42
  ${commentBlock('Generic runtime api call')}[method: string]: GenericRuntimeApiMethod
40
43
  }`;
41
- });
42
44
  });
43
45
  }
44
46
  const importTypes = this.typesGen.typeImports.toImports();
@@ -89,7 +91,7 @@ export class RuntimeApisGen extends RpcGen {
89
91
  .join(', ');
90
92
  return `${commentBlock(docs, '\n', defaultDocs, typedInputs.map(({ type, name }) => `@param {${type}} ${name}`))}${stringCamelCase(methodName)}: GenericRuntimeApiMethod<(${paramsOut}) => Promise<${typeOut}>>`;
91
93
  }
92
- #runtimeApisSpecsByModule() {
94
+ #targetRuntimeApiSpecs() {
93
95
  const specs = this.runtimeApis.map(([runtimeApiHash, version]) => {
94
96
  const runtimeApiSpec = findRuntimeApiSpec(runtimeApiHash, version);
95
97
  if (!runtimeApiSpec)
@@ -103,14 +105,7 @@ export class RuntimeApisGen extends RpcGen {
103
105
  if (!spec) {
104
106
  return o;
105
107
  }
106
- const { moduleName } = spec;
107
- if (!moduleName) {
108
- return o;
109
- }
110
- return {
111
- ...o,
112
- [moduleName]: o[moduleName] ? [...o[moduleName], spec] : [spec],
113
- };
114
- }, {});
108
+ return [...o, spec];
109
+ }, []);
115
110
  }
116
111
  }
@@ -0,0 +1 @@
1
+ export function currentDirname(): string;
@@ -0,0 +1,6 @@
1
+ import { dirname } from 'path';
2
+ import { fileURLToPath } from 'url';
3
+ export const currentDirname = () => {
4
+ const __filename = fileURLToPath(import.meta.url);
5
+ return dirname(__filename);
6
+ };
@@ -1,7 +1,6 @@
1
1
  export declare const WRAPPER_TYPE_REGEX: RegExp;
2
2
  export declare const TUPLE_TYPE_REGEX: RegExp;
3
3
  export declare const commentBlock: (...docs: (string | string[])[]) => string;
4
- export declare const resolveFilePath: (relativePath: string | string[]) => string;
5
4
  export declare const beautifySourceCode: (source: string) => Promise<string>;
6
5
  export declare const compileTemplate: (templateFileName: string) => HandlebarsTemplateDelegate<any>;
7
6
  /**
@@ -1,8 +1,8 @@
1
1
  import * as fs from 'fs';
2
2
  import handlebars from 'handlebars';
3
3
  import * as path from 'path';
4
- import * as process from 'process';
5
4
  import * as prettier from 'prettier';
5
+ import { currentDirname } from './dirname';
6
6
  export const WRAPPER_TYPE_REGEX = /^(\w+)<(.*)>$/;
7
7
  export const TUPLE_TYPE_REGEX = /^\[(.*)]$/;
8
8
  export const commentBlock = (...docs) => {
@@ -18,16 +18,12 @@ ${flatLines.map((line) => `* ${line.replaceAll(/\s+/g, ' ').trim()}`).join('\n')
18
18
  `;
19
19
  }
20
20
  };
21
- export const resolveFilePath = (relativePath) => {
22
- relativePath = Array.isArray(relativePath) ? relativePath : [relativePath];
23
- return path.resolve(process.cwd(), ...relativePath);
24
- };
25
21
  export const beautifySourceCode = async (source) => {
26
- const prettierOptions = await prettier.resolveConfig(resolveFilePath('./.prettierrc.js'));
22
+ const prettierOptions = await prettier.resolveConfig(path.resolve(currentDirname(), '../../../../.prettierrc.js'));
27
23
  return prettier.format(source, { parser: 'babel-ts', ...prettierOptions });
28
24
  };
29
25
  export const compileTemplate = (templateFileName) => {
30
- const templateFilePath = resolveFilePath(`packages/codegen/src/templates/${templateFileName}`);
26
+ const templateFilePath = path.resolve(currentDirname(), `../templates/${templateFileName}`);
31
27
  return handlebars.compile(fs.readFileSync(templateFilePath, 'utf8'));
32
28
  };
33
29
  // TODO add more reserved words
package/index.js CHANGED
@@ -1,28 +1,31 @@
1
1
  import { Dedot } from 'dedot';
2
2
  import * as fs from 'fs';
3
3
  import * as path from 'path';
4
- import * as process from 'process';
5
- import { ConstsGen, ErrorsGen, EventsGen, IndexGen, QueryGen, RpcGen, TypesGen, RuntimeApisGen, TxGen, } from './generator';
4
+ import { ConstsGen, ErrorsGen, EventsGen, IndexGen, QueryGen, RpcGen, RuntimeApisGen, TxGen, TypesGen, } from './generator';
5
+ import { stringCamelCase } from '@polkadot/util';
6
6
  export async function generateTypesFromChain(network, endpoint, outDir) {
7
7
  const api = await Dedot.create(endpoint);
8
8
  const { methods } = await api.rpc.rpc.methods();
9
9
  const apis = api.runtimeVersion?.apis || [];
10
+ if (!network.chain) {
11
+ network.chain = stringCamelCase(api.runtimeVersion?.specName || api.runtimeChain || 'local');
12
+ }
10
13
  await generateTypes(network, api.metadataLatest, methods, apis, outDir);
11
14
  await api.disconnect();
12
15
  }
13
16
  export async function generateTypes(network, metadata, rpcMethods, runtimeApis, outDir = '.') {
14
- const dirPath = path.resolve(process.cwd(), outDir, network.chain);
15
- const defTypesFileName = path.join(dirPath, `types.ts`);
16
- const constsTypesFileName = path.join(dirPath, `consts.ts`);
17
- const queryTypesFileName = path.join(dirPath, `query.ts`);
18
- const rpcCallsFileName = path.join(dirPath, `rpc.ts`);
19
- const indexFileName = path.join(dirPath, `index.ts`);
20
- const errorsFileName = path.join(dirPath, `errors.ts`);
21
- const eventsFileName = path.join(dirPath, `events.ts`);
22
- const runtimeApisFileName = path.join(dirPath, `runtime.ts`);
23
- const txFileName = path.join(dirPath, `tx.ts`);
17
+ const dirPath = path.resolve(outDir, network.chain);
18
+ const defTypesFileName = path.join(dirPath, `types.d.ts`);
19
+ const constsTypesFileName = path.join(dirPath, `consts.d.ts`);
20
+ const queryTypesFileName = path.join(dirPath, `query.d.ts`);
21
+ const rpcCallsFileName = path.join(dirPath, `rpc.d.ts`);
22
+ const indexFileName = path.join(dirPath, `index.d.ts`);
23
+ const errorsFileName = path.join(dirPath, `errors.d.ts`);
24
+ const eventsFileName = path.join(dirPath, `events.d.ts`);
25
+ const runtimeApisFileName = path.join(dirPath, `runtime.d.ts`);
26
+ const txFileName = path.join(dirPath, `tx.d.ts`);
24
27
  if (!fs.existsSync(dirPath)) {
25
- fs.mkdirSync(dirPath);
28
+ fs.mkdirSync(dirPath, { recursive: true });
26
29
  }
27
30
  const typesGen = new TypesGen(metadata);
28
31
  const constsGen = new ConstsGen(typesGen);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dedot/codegen",
3
- "version": "0.0.1-alpha.23",
3
+ "version": "0.0.1-alpha.25",
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",
@@ -12,16 +12,17 @@
12
12
  "main": "./cjs/index.js",
13
13
  "type": "module",
14
14
  "scripts": {
15
- "build": "tsc --project tsconfig.build.json && tsc --project tsconfig.build.cjs.json",
16
- "clean": "rm -rf ./dist && rm -rf ./tsconfig.tsbuildinfo ./tsconfig.build.tsbuildinfo"
15
+ "build": "tsc --project tsconfig.build.json && tsc --project tsconfig.build.cjs.json && yarn copy",
16
+ "clean": "rm -rf ./dist && rm -rf ./tsconfig.tsbuildinfo ./tsconfig.build.tsbuildinfo",
17
+ "copy": "cp -R ./src/templates ./dist && cp -R ./src/templates ./dist/cjs"
17
18
  },
18
19
  "dependencies": {
19
- "@dedot/codecs": "0.0.1-alpha.23",
20
- "@dedot/shape": "0.0.1-alpha.23",
21
- "@dedot/specs": "0.0.1-alpha.23",
22
- "@dedot/utils": "0.0.1-alpha.23",
20
+ "@dedot/codecs": "0.0.1-alpha.25",
21
+ "@dedot/shape": "0.0.1-alpha.25",
22
+ "@dedot/specs": "0.0.1-alpha.25",
23
+ "@dedot/utils": "0.0.1-alpha.25",
23
24
  "@polkadot/util": "^12.6.2",
24
- "dedot": "0.0.1-alpha.23",
25
+ "dedot": "0.0.1-alpha.25",
25
26
  "handlebars": "^4.7.8",
26
27
  "prettier": "^3.0.3"
27
28
  },
@@ -30,7 +31,7 @@
30
31
  "directory": "dist"
31
32
  },
32
33
  "license": "Apache-2.0",
33
- "gitHead": "d0aaaf353a6596d5dcd9277b241799bd544a2bd2",
34
+ "gitHead": "44b180e85a3126e45dcf408fcb3d32adc4bedeca",
34
35
  "module": "./index.js",
35
36
  "types": "./index.d.ts",
36
37
  "exports": {
package/packageInfo.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
2
2
 
3
- export const packageInfo = { name: '@dedot/codegen', version: '0.0.1-alpha.23' };
3
+ export const packageInfo = { name: '@dedot/codegen', version: '0.0.1-alpha.25' };
@@ -0,0 +1,7 @@
1
+ // Generated by @dedot/codegen
2
+
3
+ {{{ importTypes }}}
4
+
5
+ export interface ChainConsts extends GenericChainConsts {
6
+ {{{ defTypeOut }}}
7
+ }
@@ -0,0 +1,7 @@
1
+ // Generated by @dedot/codegen
2
+
3
+ {{{ importTypes }}}
4
+
5
+ export interface ChainErrors extends GenericChainErrors {
6
+ {{{ defTypeOut }}}
7
+ }
@@ -0,0 +1,7 @@
1
+ // Generated by @dedot/codegen
2
+
3
+ {{{ importTypes }}}
4
+
5
+ export interface ChainEvents extends GenericChainEvents {
6
+ {{{ defTypeOut }}}
7
+ }
@@ -0,0 +1,22 @@
1
+ // Generated by @dedot/codegen
2
+
3
+ import { GenericSubstrateApi } from '@dedot/types';
4
+ import { ChainConsts } from './consts';
5
+ import { ChainStorage } from './query';
6
+ import { RpcCalls } from './rpc';
7
+ import { ChainErrors } from './errors';
8
+ import { ChainEvents } from './events';
9
+ import { RuntimeApis } from './runtime';
10
+ import { ChainTx } from './tx';
11
+
12
+ export * from './types';
13
+
14
+ export interface {{{interfaceName}}}Api extends GenericSubstrateApi {
15
+ rpc: RpcCalls;
16
+ consts: ChainConsts;
17
+ query: ChainStorage;
18
+ errors: ChainErrors;
19
+ events: ChainEvents;
20
+ call: RuntimeApis;
21
+ tx: ChainTx;
22
+ }
@@ -0,0 +1,7 @@
1
+ // Generated by @dedot/codegen
2
+
3
+ {{{ importTypes }}}
4
+
5
+ export interface ChainStorage extends GenericChainStorage {
6
+ {{{ defTypeOut }}}
7
+ }
@@ -0,0 +1,7 @@
1
+ // Generated by @dedot/codegen
2
+
3
+ {{{ importTypes }}}
4
+
5
+ export interface RpcCalls extends GenericRpcCalls {
6
+ {{{rpcCallsOut}}}
7
+ }
@@ -0,0 +1,8 @@
1
+ // Generated by @dedot/codegen
2
+
3
+ {{{ importTypes }}}
4
+
5
+ export interface RuntimeApis extends GenericRuntimeApis {
6
+ {{{ runtimeCallsOut }}}
7
+ }
8
+
@@ -0,0 +1,9 @@
1
+ // Generated by @dedot/codegen
2
+
3
+ {{{ importTypes }}}
4
+
5
+ {{{ defTypes }}}
6
+
7
+ export interface ChainTx extends GenericChainTx<TxCall> {
8
+ {{{ txDefsOut }}}
9
+ }
@@ -0,0 +1,5 @@
1
+ // Generated by @dedot/codegen
2
+
3
+ {{{ importTypes }}}
4
+
5
+ {{{ defTypeOut }}}