@dedot/codegen 0.0.1-next.fecbe32d.13 → 0.1.0
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.
- package/{generator → chaintypes/generator}/ApiGen.d.ts +16 -16
- package/{generator → chaintypes/generator}/ConstsGen.d.ts +1 -1
- package/{generator → chaintypes/generator}/ConstsGen.js +5 -5
- package/{generator → chaintypes/generator}/ErrorsGen.d.ts +1 -1
- package/{generator → chaintypes/generator}/ErrorsGen.js +9 -9
- package/{generator → chaintypes/generator}/EventsGen.d.ts +1 -1
- package/{generator → chaintypes/generator}/EventsGen.js +9 -9
- package/{generator → chaintypes/generator}/IndexGen.d.ts +1 -1
- package/chaintypes/generator/IndexGen.js +17 -0
- package/{generator → chaintypes/generator}/JsonRpcGen.d.ts +3 -2
- package/{generator → chaintypes/generator}/JsonRpcGen.js +8 -8
- package/{generator → chaintypes/generator}/QueryGen.d.ts +1 -1
- package/{generator → chaintypes/generator}/QueryGen.js +15 -15
- package/{generator → chaintypes/generator}/RuntimeApisGen.d.ts +1 -1
- package/{generator → chaintypes/generator}/RuntimeApisGen.js +11 -11
- package/{generator → chaintypes/generator}/TxGen.d.ts +1 -1
- package/{generator → chaintypes/generator}/TxGen.js +16 -14
- package/chaintypes/generator/TypesGen.d.ts +11 -0
- package/chaintypes/generator/TypesGen.js +55 -0
- package/chaintypes/index.d.ts +3 -0
- package/chaintypes/index.js +49 -0
- package/chaintypes/templates/consts.hbs +7 -0
- package/chaintypes/templates/errors.hbs +7 -0
- package/chaintypes/templates/events.hbs +7 -0
- package/chaintypes/templates/index.hbs +27 -0
- package/chaintypes/templates/json-rpc.hbs +5 -0
- package/chaintypes/templates/query.hbs +7 -0
- package/chaintypes/templates/runtime.hbs +8 -0
- package/chaintypes/templates/tx.hbs +9 -0
- package/{templates → chaintypes/templates}/types.hbs +1 -1
- package/cjs/{generator → chaintypes/generator}/ConstsGen.js +5 -5
- package/cjs/{generator → chaintypes/generator}/ErrorsGen.js +9 -9
- package/cjs/{generator → chaintypes/generator}/EventsGen.js +9 -9
- package/cjs/chaintypes/generator/IndexGen.js +21 -0
- package/cjs/{generator → chaintypes/generator}/JsonRpcGen.js +10 -10
- package/cjs/{generator → chaintypes/generator}/QueryGen.js +15 -15
- package/cjs/{generator → chaintypes/generator}/RuntimeApisGen.js +14 -14
- package/cjs/{generator → chaintypes/generator}/TxGen.js +16 -14
- package/cjs/chaintypes/generator/TypesGen.js +59 -0
- package/cjs/chaintypes/index.js +77 -0
- package/cjs/chaintypes/templates/consts.hbs +7 -0
- package/cjs/chaintypes/templates/errors.hbs +7 -0
- package/cjs/chaintypes/templates/events.hbs +7 -0
- package/cjs/chaintypes/templates/index.hbs +27 -0
- package/cjs/chaintypes/templates/json-rpc.hbs +5 -0
- package/cjs/chaintypes/templates/query.hbs +7 -0
- package/cjs/chaintypes/templates/runtime.hbs +8 -0
- package/cjs/chaintypes/templates/tx.hbs +9 -0
- package/cjs/{templates → chaintypes/templates}/types.hbs +1 -1
- package/cjs/index.js +4 -62
- package/cjs/{generator/TypesGen.js → shared/BaseTypesGen.js} +111 -159
- package/cjs/{generator → shared}/TypeImports.js +27 -9
- package/cjs/shared/index.js +19 -0
- package/cjs/{generator → shared}/known-codecs.js +23 -4
- package/cjs/typink/generator/ConstructorQueryGen.js +24 -0
- package/cjs/typink/generator/ConstructorTxGen.js +24 -0
- package/cjs/typink/generator/EventsGen.js +35 -0
- package/cjs/typink/generator/IndexGen.js +24 -0
- package/cjs/typink/generator/QueryGen.js +72 -0
- package/cjs/typink/generator/TxGen.js +25 -0
- package/cjs/typink/generator/TypesGen.js +28 -0
- package/cjs/typink/generator/index.js +23 -0
- package/cjs/typink/index.js +40 -0
- package/cjs/typink/templates/constructor-query.hbs +7 -0
- package/cjs/typink/templates/constructor-tx.hbs +7 -0
- package/cjs/typink/templates/events.hbs +8 -0
- package/cjs/typink/templates/index.hbs +16 -0
- package/cjs/typink/templates/query.hbs +7 -0
- package/cjs/typink/templates/tx.hbs +7 -0
- package/cjs/typink/templates/types.hbs +5 -0
- package/cjs/{generator/utils.js → utils.js} +4 -4
- package/index.d.ts +2 -3
- package/index.js +2 -48
- package/package.json +15 -17
- package/{generator/TypesGen.d.ts → shared/BaseTypesGen.d.ts} +12 -11
- package/{generator/TypesGen.js → shared/BaseTypesGen.js} +108 -156
- package/{generator → shared}/TypeImports.d.ts +12 -3
- package/{generator → shared}/TypeImports.js +27 -9
- package/shared/index.d.ts +3 -0
- package/shared/index.js +3 -0
- package/{generator → shared}/known-codecs.d.ts +1 -1
- package/{generator → shared}/known-codecs.js +21 -2
- package/typink/generator/ConstructorQueryGen.d.ts +6 -0
- package/typink/generator/ConstructorQueryGen.js +20 -0
- package/typink/generator/ConstructorTxGen.d.ts +6 -0
- package/typink/generator/ConstructorTxGen.js +20 -0
- package/typink/generator/EventsGen.d.ts +7 -0
- package/typink/generator/EventsGen.js +31 -0
- package/typink/generator/IndexGen.d.ts +6 -0
- package/typink/generator/IndexGen.js +20 -0
- package/typink/generator/QueryGen.d.ts +12 -0
- package/typink/generator/QueryGen.js +68 -0
- package/typink/generator/TxGen.d.ts +6 -0
- package/typink/generator/TxGen.js +21 -0
- package/typink/generator/TypesGen.d.ts +7 -0
- package/typink/generator/TypesGen.js +24 -0
- package/typink/generator/index.d.ts +7 -0
- package/typink/generator/index.js +7 -0
- package/typink/index.d.ts +2 -0
- package/typink/index.js +33 -0
- package/typink/templates/constructor-query.hbs +7 -0
- package/typink/templates/constructor-tx.hbs +7 -0
- package/typink/templates/events.hbs +8 -0
- package/typink/templates/index.hbs +16 -0
- package/typink/templates/query.hbs +7 -0
- package/typink/templates/tx.hbs +7 -0
- package/typink/templates/types.hbs +5 -0
- package/{generator/utils.d.ts → utils.d.ts} +1 -1
- package/{generator/utils.js → utils.js} +4 -4
- package/cjs/generator/IndexGen.js +0 -17
- package/cjs/templates/consts.hbs +0 -7
- package/cjs/templates/errors.hbs +0 -7
- package/cjs/templates/events.hbs +0 -7
- package/cjs/templates/index.hbs +0 -22
- package/cjs/templates/json-rpc.hbs +0 -5
- package/cjs/templates/query.hbs +0 -7
- package/cjs/templates/runtime.hbs +0 -8
- package/cjs/templates/tx.hbs +0 -9
- package/generator/IndexGen.js +0 -13
- package/templates/consts.hbs +0 -7
- package/templates/errors.hbs +0 -7
- package/templates/events.hbs +0 -7
- package/templates/index.hbs +0 -22
- package/templates/json-rpc.hbs +0 -5
- package/templates/query.hbs +0 -7
- package/templates/runtime.hbs +0 -8
- package/templates/tx.hbs +0 -9
- /package/{generator → chaintypes/generator}/ApiGen.js +0 -0
- /package/{generator → chaintypes/generator}/index.d.ts +0 -0
- /package/{generator → chaintypes/generator}/index.js +0 -0
- /package/cjs/{generator → chaintypes/generator}/ApiGen.js +0 -0
- /package/cjs/{generator → chaintypes/generator}/index.js +0 -0
- /package/cjs/{generator/dirname.js → dirname.js} +0 -0
- /package/{generator/dirname.d.ts → dirname.d.ts} +0 -0
- /package/{generator/dirname.js → dirname.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TypesGen } from '
|
|
1
|
+
import { TypesGen } from './TypesGen.js';
|
|
2
2
|
export declare abstract class ApiGen {
|
|
3
3
|
readonly typesGen: TypesGen;
|
|
4
4
|
constructor(typesGen: TypesGen);
|
|
@@ -10,49 +10,49 @@ export declare abstract class ApiGen {
|
|
|
10
10
|
name: string;
|
|
11
11
|
typeId: number | undefined;
|
|
12
12
|
}[];
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
typeDef: {
|
|
14
|
+
type: "Struct";
|
|
15
15
|
value: {
|
|
16
|
-
fields: import("dedot").Field[];
|
|
16
|
+
fields: import("@dedot/codecs").Field[];
|
|
17
17
|
};
|
|
18
18
|
} | {
|
|
19
|
-
|
|
19
|
+
type: "Enum";
|
|
20
20
|
value: {
|
|
21
21
|
members: {
|
|
22
22
|
name: string;
|
|
23
|
-
fields: import("dedot").Field[];
|
|
23
|
+
fields: import("@dedot/codecs").Field[];
|
|
24
24
|
index: number;
|
|
25
25
|
docs: string[];
|
|
26
26
|
}[];
|
|
27
27
|
};
|
|
28
28
|
} | {
|
|
29
|
-
|
|
29
|
+
type: "Sequence";
|
|
30
30
|
value: {
|
|
31
31
|
typeParam: number;
|
|
32
32
|
};
|
|
33
33
|
} | {
|
|
34
|
-
|
|
34
|
+
type: "SizedVec";
|
|
35
35
|
value: {
|
|
36
36
|
len: number;
|
|
37
37
|
typeParam: number;
|
|
38
38
|
};
|
|
39
39
|
} | {
|
|
40
|
-
|
|
40
|
+
type: "Tuple";
|
|
41
41
|
value: {
|
|
42
42
|
fields: number[];
|
|
43
43
|
};
|
|
44
44
|
} | {
|
|
45
|
-
|
|
45
|
+
type: "Primitive";
|
|
46
46
|
value: {
|
|
47
47
|
kind: "bool" | "u8" | "i8" | "u16" | "i16" | "u32" | "i32" | "u64" | "i64" | "u128" | "i128" | "u256" | "i256" | "str" | "char";
|
|
48
48
|
};
|
|
49
49
|
} | {
|
|
50
|
-
|
|
50
|
+
type: "Compact";
|
|
51
51
|
value: {
|
|
52
52
|
typeParam: number;
|
|
53
53
|
};
|
|
54
54
|
} | {
|
|
55
|
-
|
|
55
|
+
type: "BitSequence";
|
|
56
56
|
value: {
|
|
57
57
|
bitOrderType: number;
|
|
58
58
|
bitStoreType: number;
|
|
@@ -67,13 +67,13 @@ export declare abstract class ApiGen {
|
|
|
67
67
|
entries: {
|
|
68
68
|
name: string;
|
|
69
69
|
modifier: string;
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
storageType: {
|
|
71
|
+
type: "Plain";
|
|
72
72
|
value: {
|
|
73
73
|
valueTypeId: number;
|
|
74
74
|
};
|
|
75
75
|
} | {
|
|
76
|
-
|
|
76
|
+
type: "Map";
|
|
77
77
|
value: {
|
|
78
78
|
hashers: ("identity" | "blake2_128" | "blake2_256" | "blake2_128Concat" | "twox128" | "twox256" | "twox64Concat")[];
|
|
79
79
|
keyTypeId: number;
|
|
@@ -134,5 +134,5 @@ export declare abstract class ApiGen {
|
|
|
134
134
|
}>;
|
|
135
135
|
};
|
|
136
136
|
};
|
|
137
|
-
get registry(): import("dedot").PortableRegistry;
|
|
137
|
+
get registry(): import("@dedot/codecs").PortableRegistry;
|
|
138
138
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { normalizeName, stringCamelCase } from '@dedot/utils';
|
|
2
|
+
import { beautifySourceCode, commentBlock, compileTemplate } from '../../utils.js';
|
|
2
3
|
import { ApiGen } from './ApiGen.js';
|
|
3
|
-
import { beautifySourceCode, commentBlock, compileTemplate } from './utils.js';
|
|
4
4
|
export class ConstsGen extends ApiGen {
|
|
5
|
-
generate() {
|
|
5
|
+
generate(useSubPaths = false) {
|
|
6
6
|
const { pallets } = this.metadata;
|
|
7
7
|
this.typesGen.clearCache();
|
|
8
|
-
this.typesGen.typeImports.addKnownType('GenericChainConsts');
|
|
8
|
+
this.typesGen.typeImports.addKnownType('GenericChainConsts', 'RpcVersion');
|
|
9
9
|
let defTypeOut = '';
|
|
10
10
|
for (let pallet of pallets) {
|
|
11
11
|
const typedConstants = pallet.constants.map((one) => ({
|
|
@@ -20,8 +20,8 @@ export class ConstsGen extends ApiGen {
|
|
|
20
20
|
${commentBlock('Generic pallet constant')}[name: string]: any,
|
|
21
21
|
},`;
|
|
22
22
|
}
|
|
23
|
-
const importTypes = this.typesGen.typeImports.toImports();
|
|
24
|
-
const template = compileTemplate('consts.hbs');
|
|
23
|
+
const importTypes = this.typesGen.typeImports.toImports({ useSubPaths });
|
|
24
|
+
const template = compileTemplate('chaintypes/templates/consts.hbs');
|
|
25
25
|
return beautifySourceCode(template({ importTypes, defTypeOut }));
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { assert, stringCamelCase, stringPascalCase } from '@dedot/utils';
|
|
2
|
+
import { beautifySourceCode, commentBlock, compileTemplate } from '../../utils.js';
|
|
2
3
|
import { ApiGen } from './ApiGen.js';
|
|
3
|
-
import { beautifySourceCode, commentBlock, compileTemplate } from './utils.js';
|
|
4
4
|
export class ErrorsGen extends ApiGen {
|
|
5
|
-
generate() {
|
|
5
|
+
generate(useSubPaths = false) {
|
|
6
6
|
const { pallets } = this.metadata;
|
|
7
7
|
this.typesGen.clearCache();
|
|
8
|
-
this.typesGen.typeImports.addKnownType('GenericChainErrors', 'GenericPalletError');
|
|
8
|
+
this.typesGen.typeImports.addKnownType('GenericChainErrors', 'GenericPalletError', 'RpcVersion');
|
|
9
9
|
let defTypeOut = '';
|
|
10
10
|
for (let pallet of pallets) {
|
|
11
11
|
const errorTypeId = pallet.error;
|
|
@@ -16,21 +16,21 @@ export class ErrorsGen extends ApiGen {
|
|
|
16
16
|
defTypeOut += commentBlock(`Pallet \`${pallet.name}\`'s errors`);
|
|
17
17
|
defTypeOut += `${stringCamelCase(pallet.name)}: {
|
|
18
18
|
${errorDefs
|
|
19
|
-
.map(({ name, docs }) => `${commentBlock(docs)}${stringPascalCase(name)}: GenericPalletError
|
|
19
|
+
.map(({ name, docs }) => `${commentBlock(docs)}${stringPascalCase(name)}: GenericPalletError<Rv>`)
|
|
20
20
|
.join(',\n')}
|
|
21
21
|
|
|
22
|
-
${commentBlock('Generic pallet error')}[error: string]: GenericPalletError
|
|
22
|
+
${commentBlock('Generic pallet error')}[error: string]: GenericPalletError<Rv>,
|
|
23
23
|
},`;
|
|
24
24
|
}
|
|
25
|
-
const importTypes = this.typesGen.typeImports.toImports();
|
|
26
|
-
const template = compileTemplate('errors.hbs');
|
|
25
|
+
const importTypes = this.typesGen.typeImports.toImports({ useSubPaths });
|
|
26
|
+
const template = compileTemplate('chaintypes/templates/errors.hbs');
|
|
27
27
|
return beautifySourceCode(template({ importTypes, defTypeOut }));
|
|
28
28
|
}
|
|
29
29
|
#getErrorDefs(errorTypeId) {
|
|
30
30
|
const def = this.metadata.types[errorTypeId];
|
|
31
31
|
assert(def, `Error def not found for id ${errorTypeId}`);
|
|
32
|
-
const {
|
|
33
|
-
assert(
|
|
32
|
+
const { type, value } = def.typeDef;
|
|
33
|
+
assert(type === 'Enum', 'Invalid pallet error type!');
|
|
34
34
|
return value.members;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { assert, stringCamelCase, stringPascalCase } from '@dedot/utils';
|
|
2
|
+
import { beautifySourceCode, commentBlock, compileTemplate } from '../../utils.js';
|
|
2
3
|
import { ApiGen } from './ApiGen.js';
|
|
3
|
-
import { beautifySourceCode, commentBlock, compileTemplate } from './utils.js';
|
|
4
4
|
export class EventsGen extends ApiGen {
|
|
5
|
-
generate() {
|
|
5
|
+
generate(useSubPaths = false) {
|
|
6
6
|
const { pallets } = this.metadata;
|
|
7
7
|
this.typesGen.clearCache();
|
|
8
|
-
this.typesGen.typeImports.addKnownType('GenericChainEvents', 'GenericPalletEvent');
|
|
8
|
+
this.typesGen.typeImports.addKnownType('GenericChainEvents', 'GenericPalletEvent', 'RpcVersion');
|
|
9
9
|
let defTypeOut = '';
|
|
10
10
|
for (let pallet of pallets) {
|
|
11
11
|
const eventTypeId = pallet.event;
|
|
@@ -28,21 +28,21 @@ export class EventsGen extends ApiGen {
|
|
|
28
28
|
}
|
|
29
29
|
return { ...def, genericParts };
|
|
30
30
|
})
|
|
31
|
-
.map(({ name, docs, fields, genericParts }) => `${commentBlock(docs)}${stringPascalCase(name)}: GenericPalletEvent
|
|
31
|
+
.map(({ name, docs, fields, genericParts }) => `${commentBlock(docs)}${stringPascalCase(name)}: GenericPalletEvent<Rv, ${genericParts.join(', ')}>`)
|
|
32
32
|
.join(',\n')}
|
|
33
33
|
|
|
34
|
-
${commentBlock('Generic pallet event')}[prop: string]: GenericPalletEvent
|
|
34
|
+
${commentBlock('Generic pallet event')}[prop: string]: GenericPalletEvent<Rv>,
|
|
35
35
|
},`;
|
|
36
36
|
}
|
|
37
|
-
const importTypes = this.typesGen.typeImports.toImports();
|
|
38
|
-
const template = compileTemplate('events.hbs');
|
|
37
|
+
const importTypes = this.typesGen.typeImports.toImports({ useSubPaths });
|
|
38
|
+
const template = compileTemplate('chaintypes/templates/events.hbs');
|
|
39
39
|
return beautifySourceCode(template({ importTypes, defTypeOut }));
|
|
40
40
|
}
|
|
41
41
|
#getEventDefs(typeId) {
|
|
42
42
|
const def = this.metadata.types[typeId];
|
|
43
43
|
assert(def, `Event def not found for id ${typeId}`);
|
|
44
|
-
const {
|
|
45
|
-
assert(
|
|
44
|
+
const { type, value } = def.typeDef;
|
|
45
|
+
assert(type === 'Enum', 'Invalid pallet event type!');
|
|
46
46
|
return value.members;
|
|
47
47
|
}
|
|
48
48
|
#generateMemberDefType(fields) {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { stringPascalCase } from '@dedot/utils';
|
|
2
|
+
import { TypeImports } from '../../shared/index.js';
|
|
3
|
+
import { beautifySourceCode, compileTemplate } from '../../utils.js';
|
|
4
|
+
export class IndexGen {
|
|
5
|
+
chain;
|
|
6
|
+
constructor(chain) {
|
|
7
|
+
this.chain = chain;
|
|
8
|
+
}
|
|
9
|
+
async generate(useSubPaths = false) {
|
|
10
|
+
const interfaceName = stringPascalCase(this.chain);
|
|
11
|
+
const typeImports = new TypeImports();
|
|
12
|
+
typeImports.addKnownType('GenericSubstrateApi', 'RpcLegacy', 'RpcV2', 'RpcVersion');
|
|
13
|
+
const importTypes = typeImports.toImports({ useSubPaths });
|
|
14
|
+
const template = compileTemplate('chaintypes/templates/index.hbs');
|
|
15
|
+
return beautifySourceCode(template({ importTypes, interfaceName }));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { ApiGen
|
|
1
|
+
import { ApiGen } from './ApiGen.js';
|
|
2
|
+
import { TypesGen } from './TypesGen.js';
|
|
2
3
|
export declare class JsonRpcGen extends ApiGen {
|
|
3
4
|
readonly typesGen: TypesGen;
|
|
4
5
|
readonly rpcMethods: string[];
|
|
5
6
|
constructor(typesGen: TypesGen, rpcMethods: string[]);
|
|
6
|
-
generate(): Promise<string>;
|
|
7
|
+
generate(useSubPaths?: boolean): Promise<string>;
|
|
7
8
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { subscriptionsInfo } from '@dedot/
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { subscriptionsInfo } from '@dedot/api';
|
|
2
|
+
import { beautifySourceCode, compileTemplate } from '../../utils.js';
|
|
3
|
+
import { ApiGen } from './ApiGen.js';
|
|
4
4
|
const HIDDEN_RPCS = [
|
|
5
5
|
// Ref: https://github.com/paritytech/polkadot-sdk/blob/43415ef58c143b985e09015cd000dbd65f6d3997/substrate/client/rpc-servers/src/lib.rs#L152C9-L158
|
|
6
6
|
'rpc_methods',
|
|
@@ -38,13 +38,13 @@ export class JsonRpcGen extends ApiGen {
|
|
|
38
38
|
HIDDEN_RPCS.filter((one) => !rpcMethods.includes(one)).forEach((one) => rpcMethods.push(one));
|
|
39
39
|
rpcMethods.sort();
|
|
40
40
|
}
|
|
41
|
-
generate() {
|
|
41
|
+
generate(useSubPaths = false) {
|
|
42
42
|
this.typesGen.clearCache();
|
|
43
|
-
this.typesGen.typeImports.addKnownType('GenericJsonRpcApis');
|
|
44
|
-
this.typesGen.typeImports.
|
|
43
|
+
this.typesGen.typeImports.addKnownType('GenericJsonRpcApis', 'RpcVersion');
|
|
44
|
+
this.typesGen.typeImports.addKnownJsonRpcType('JsonRpcApis');
|
|
45
45
|
const toExclude = Object.values(subscriptionsInfo).flat();
|
|
46
|
-
const importTypes = this.typesGen.typeImports.toImports();
|
|
47
|
-
const template = compileTemplate('json-rpc.hbs');
|
|
46
|
+
const importTypes = this.typesGen.typeImports.toImports({ useSubPaths });
|
|
47
|
+
const template = compileTemplate('chaintypes/templates/json-rpc.hbs');
|
|
48
48
|
const jsonRpcMethods = this.rpcMethods
|
|
49
49
|
.filter((one) => !ALIAS_RPCS.includes(one)) // exclude alias rpcs
|
|
50
50
|
.filter((one) => !toExclude.includes(one)) // exclude unsubscribe methods
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { normalizeName, stringCamelCase } from '@dedot/utils';
|
|
2
|
+
import { beautifySourceCode, commentBlock, compileTemplate } from '../../utils.js';
|
|
2
3
|
import { ApiGen } from './ApiGen.js';
|
|
3
|
-
import { beautifySourceCode, commentBlock, compileTemplate } from './utils.js';
|
|
4
4
|
export class QueryGen extends ApiGen {
|
|
5
|
-
generate() {
|
|
5
|
+
generate(useSubPaths = false) {
|
|
6
6
|
const { pallets } = this.metadata;
|
|
7
7
|
this.typesGen.clearCache();
|
|
8
|
-
this.typesGen.typeImports.addKnownType('GenericChainStorage', 'GenericStorageQuery', 'Callback');
|
|
8
|
+
this.typesGen.typeImports.addKnownType('GenericChainStorage', 'GenericStorageQuery', 'Callback', 'RpcVersion');
|
|
9
9
|
let defTypeOut = '';
|
|
10
10
|
for (let pallet of pallets) {
|
|
11
11
|
const storage = pallet.storage;
|
|
@@ -14,33 +14,33 @@ export class QueryGen extends ApiGen {
|
|
|
14
14
|
const queries = storage.entries.map((one) => this.#generateEntry(one));
|
|
15
15
|
const queryDefs = queries.map(({ name, valueType, keyType, docs, keyTypeOut }) => {
|
|
16
16
|
if (keyTypeOut) {
|
|
17
|
-
return `${commentBlock(docs)}${name}: GenericStorageQuery<(${keyType}) => ${valueType}, ${keyTypeOut}>`;
|
|
17
|
+
return `${commentBlock(docs)}${name}: GenericStorageQuery<Rv, (${keyType}) => ${valueType}, ${keyTypeOut}>`;
|
|
18
18
|
}
|
|
19
19
|
else {
|
|
20
|
-
return `${commentBlock(docs)}${name}: GenericStorageQuery<(${keyType}) => ${valueType}>`;
|
|
20
|
+
return `${commentBlock(docs)}${name}: GenericStorageQuery<Rv, (${keyType}) => ${valueType}>`;
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
defTypeOut += commentBlock(`Pallet \`${pallet.name}\`'s storage queries`);
|
|
24
24
|
defTypeOut += `${stringCamelCase(pallet.name)}: {
|
|
25
25
|
${queryDefs.join(',\n')}
|
|
26
26
|
|
|
27
|
-
${commentBlock('Generic pallet storage query')}[storage: string]: GenericStorageQuery
|
|
27
|
+
${commentBlock('Generic pallet storage query')}[storage: string]: GenericStorageQuery<Rv>;
|
|
28
28
|
},`;
|
|
29
29
|
}
|
|
30
|
-
const importTypes = this.typesGen.typeImports.toImports();
|
|
31
|
-
const template = compileTemplate('query.hbs');
|
|
30
|
+
const importTypes = this.typesGen.typeImports.toImports({ useSubPaths });
|
|
31
|
+
const template = compileTemplate('chaintypes/templates/query.hbs');
|
|
32
32
|
return beautifySourceCode(template({ importTypes, defTypeOut }));
|
|
33
33
|
}
|
|
34
34
|
#generateEntry(entry) {
|
|
35
|
-
const { name,
|
|
35
|
+
const { name, storageType, docs, modifier } = entry;
|
|
36
36
|
let valueType, keyTypeOut, keyTypeIn;
|
|
37
|
-
if (type
|
|
38
|
-
valueType = this.typesGen.generateType(
|
|
37
|
+
if (storageType.type === 'Plain') {
|
|
38
|
+
valueType = this.typesGen.generateType(storageType.value.valueTypeId, 1, true);
|
|
39
39
|
}
|
|
40
|
-
else if (type
|
|
41
|
-
valueType = this.typesGen.generateType(
|
|
42
|
-
keyTypeOut = this.typesGen.generateType(
|
|
43
|
-
keyTypeIn = this.typesGen.generateType(
|
|
40
|
+
else if (storageType.type === 'Map') {
|
|
41
|
+
valueType = this.typesGen.generateType(storageType.value.valueTypeId, 1, true);
|
|
42
|
+
keyTypeOut = this.typesGen.generateType(storageType.value.keyTypeId, 1, true);
|
|
43
|
+
keyTypeIn = this.typesGen.generateType(storageType.value.keyTypeId, 1);
|
|
44
44
|
}
|
|
45
45
|
else {
|
|
46
46
|
throw Error('Invalid entry type!');
|
|
@@ -5,5 +5,5 @@ export declare class RuntimeApisGen extends ApiGen {
|
|
|
5
5
|
readonly typesGen: TypesGen;
|
|
6
6
|
readonly runtimeApis: Record<string, number>;
|
|
7
7
|
constructor(typesGen: TypesGen, runtimeApis: Record<string, number>);
|
|
8
|
-
generate(): Promise<string>;
|
|
8
|
+
generate(useSubPaths?: boolean): Promise<string>;
|
|
9
9
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { getRuntimeApiNames, getRuntimeApiSpecs } from '@dedot/specs';
|
|
1
|
+
import { getRuntimeApiNames, getRuntimeApiSpecs } from '@dedot/runtime-specs';
|
|
2
2
|
import { calcRuntimeApiHash, stringSnakeCase, stringCamelCase } from '@dedot/utils';
|
|
3
|
+
import { findKnownCodecType } from '../../shared/index.js';
|
|
4
|
+
import { beautifySourceCode, commentBlock, compileTemplate, isNativeType, TUPLE_TYPE_REGEX, WRAPPER_TYPE_REGEX, } from '../../utils.js';
|
|
3
5
|
import { ApiGen } from './ApiGen.js';
|
|
4
|
-
import { findKnownCodecType } from './known-codecs.js';
|
|
5
|
-
import { beautifySourceCode, commentBlock, compileTemplate, isNativeType, TUPLE_TYPE_REGEX, WRAPPER_TYPE_REGEX, } from './utils.js';
|
|
6
6
|
export class RuntimeApisGen extends ApiGen {
|
|
7
7
|
typesGen;
|
|
8
8
|
runtimeApis;
|
|
@@ -11,9 +11,9 @@ export class RuntimeApisGen extends ApiGen {
|
|
|
11
11
|
this.typesGen = typesGen;
|
|
12
12
|
this.runtimeApis = runtimeApis;
|
|
13
13
|
}
|
|
14
|
-
generate() {
|
|
14
|
+
generate(useSubPaths = false) {
|
|
15
15
|
this.typesGen.clearCache();
|
|
16
|
-
this.typesGen.typeImports.addKnownType('GenericRuntimeApis', 'GenericRuntimeApiMethod');
|
|
16
|
+
this.typesGen.typeImports.addKnownType('GenericRuntimeApis', 'GenericRuntimeApiMethod', 'RpcVersion');
|
|
17
17
|
let runtimeCallsOut = '';
|
|
18
18
|
if (this.metadata.apis.length > 0) {
|
|
19
19
|
this.metadata.apis.forEach((runtimeApi) => {
|
|
@@ -22,7 +22,7 @@ export class RuntimeApisGen extends ApiGen {
|
|
|
22
22
|
runtimeCallsOut += `${stringCamelCase(runtimeApiName)}: {
|
|
23
23
|
${methods.map((method) => this.#generateMethodDef(runtimeApiName, method)).join('\n')}
|
|
24
24
|
|
|
25
|
-
${commentBlock('Generic runtime api call')}[method: string]: GenericRuntimeApiMethod
|
|
25
|
+
${commentBlock('Generic runtime api call')}[method: string]: GenericRuntimeApiMethod<Rv>
|
|
26
26
|
}`;
|
|
27
27
|
});
|
|
28
28
|
}
|
|
@@ -39,12 +39,12 @@ export class RuntimeApisGen extends ApiGen {
|
|
|
39
39
|
}))
|
|
40
40
|
.join('\n')}
|
|
41
41
|
|
|
42
|
-
${commentBlock('Generic runtime api call')}[method: string]: GenericRuntimeApiMethod
|
|
42
|
+
${commentBlock('Generic runtime api call')}[method: string]: GenericRuntimeApiMethod<Rv>
|
|
43
43
|
}`;
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
-
const importTypes = this.typesGen.typeImports.toImports();
|
|
47
|
-
const template = compileTemplate('runtime.hbs');
|
|
46
|
+
const importTypes = this.typesGen.typeImports.toImports({ useSubPaths });
|
|
47
|
+
const template = compileTemplate('chaintypes/templates/runtime.hbs');
|
|
48
48
|
return beautifySourceCode(template({ importTypes, runtimeCallsOut }));
|
|
49
49
|
}
|
|
50
50
|
#isOptionalType(type) {
|
|
@@ -68,7 +68,7 @@ export class RuntimeApisGen extends ApiGen {
|
|
|
68
68
|
.map(({ name, isOptional, plainType }) => `${stringCamelCase(name)}${isOptional ? '?' : ''}: ${plainType}`)
|
|
69
69
|
.join(', ');
|
|
70
70
|
const typeOut = this.#getGeneratedTypeName(type, false);
|
|
71
|
-
return `${commentBlock(docs, '\n', defaultDocs, typedParams.map(({ plainType, name }) => `@param {${plainType}} ${name}`))}${methodName}: GenericRuntimeApiMethod<(${paramsOut}) => Promise<${typeOut}>>`;
|
|
71
|
+
return `${commentBlock(docs, '\n', defaultDocs, typedParams.map(({ plainType, name }) => `@param {${plainType}} ${name}`))}${methodName}: GenericRuntimeApiMethod<Rv, (${paramsOut}) => Promise<${typeOut}>>`;
|
|
72
72
|
}
|
|
73
73
|
#generateMethodDef(runtimeApiName, methodDef) {
|
|
74
74
|
const { name: methodName, inputs, output, docs } = methodDef;
|
|
@@ -89,7 +89,7 @@ export class RuntimeApisGen extends ApiGen {
|
|
|
89
89
|
const paramsOut = typedInputs
|
|
90
90
|
.map(({ name, type, isOptional }) => `${stringCamelCase(name)}${isOptional ? '?' : ''}: ${type}`)
|
|
91
91
|
.join(', ');
|
|
92
|
-
return `${commentBlock(docs, '\n', defaultDocs, typedInputs.map(({ type, name }) => `@param {${type}} ${name}`))}${stringCamelCase(methodName)}: GenericRuntimeApiMethod<(${paramsOut}) => Promise<${typeOut}>>`;
|
|
92
|
+
return `${commentBlock(docs, '\n', defaultDocs, typedInputs.map(({ type, name }) => `@param {${type}} ${name}`))}${stringCamelCase(methodName)}: GenericRuntimeApiMethod<Rv, (${paramsOut}) => Promise<${typeOut}>>`;
|
|
93
93
|
}
|
|
94
94
|
#targetRuntimeApiSpecs() {
|
|
95
95
|
const specs = Object.entries(this.runtimeApis).map(([runtimeApiHash, version]) => {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { stringCamelCase, stringPascalCase } from '@dedot/utils';
|
|
2
|
+
import { beautifySourceCode, commentBlock, compileTemplate, isReservedWord } from '../../utils.js';
|
|
2
3
|
import { ApiGen } from '../generator/index.js';
|
|
3
|
-
import { beautifySourceCode, commentBlock, compileTemplate, isReservedWord } from './utils.js';
|
|
4
4
|
export class TxGen extends ApiGen {
|
|
5
|
-
generate() {
|
|
5
|
+
generate(useSubPaths = false) {
|
|
6
6
|
const { pallets, types } = this.metadata;
|
|
7
7
|
this.typesGen.clearCache();
|
|
8
|
-
this.typesGen.typeImports.addKnownType('GenericChainTx', 'GenericTxCall', 'ISubmittableExtrinsic', 'ISubmittableResult', 'IRuntimeTxCall');
|
|
8
|
+
this.typesGen.typeImports.addKnownType('GenericChainTx', 'GenericTxCall', 'ISubmittableExtrinsic', 'ISubmittableResult', 'IRuntimeTxCall', 'RpcVersion', 'RpcV2', 'ISubmittableExtrinsicLegacy');
|
|
9
9
|
const { callTypeId, addressTypeId, signatureTypeId } = this.metadata.extrinsic;
|
|
10
10
|
const callTypeIn = this.typesGen.generateType(callTypeId, 1);
|
|
11
11
|
const addressTypeIn = this.typesGen.generateType(addressTypeId, 1);
|
|
@@ -17,11 +17,11 @@ export class TxGen extends ApiGen {
|
|
|
17
17
|
for (let pallet of pallets) {
|
|
18
18
|
if (pallet.calls === undefined)
|
|
19
19
|
continue;
|
|
20
|
-
const {
|
|
21
|
-
if (type
|
|
20
|
+
const { typeDef } = types[pallet.calls];
|
|
21
|
+
if (typeDef.type !== 'Enum')
|
|
22
22
|
continue;
|
|
23
|
-
const isFlatEnum =
|
|
24
|
-
const typedTxs =
|
|
23
|
+
const isFlatEnum = typeDef.value.members.every((m) => m.fields.length === 0);
|
|
24
|
+
const typedTxs = typeDef.value.members
|
|
25
25
|
.map((one) => ({
|
|
26
26
|
functionName: stringCamelCase(one.name),
|
|
27
27
|
params: one.fields.map((f) => ({
|
|
@@ -41,22 +41,24 @@ export class TxGen extends ApiGen {
|
|
|
41
41
|
txDefsOut += commentBlock(`Pallet \`${pallet.name}\`'s transaction calls`);
|
|
42
42
|
txDefsOut += `${stringCamelCase(pallet.name)}: {
|
|
43
43
|
${typedTxs
|
|
44
|
-
.map(({ functionName, params, docs, callInput }) => `${commentBlock(docs, '\n', params.map((p) => `@param {${p.type}} ${p.normalizedName} ${p.docs}`))}${functionName}: GenericTxCall<(${params.map((p) => `${p.normalizedName}: ${p.type}`).join(', ')}) => ChainSubmittableExtrinsic
|
|
44
|
+
.map(({ functionName, params, docs, callInput }) => `${commentBlock(docs, '\n', params.map((p) => `@param {${p.type}} ${p.normalizedName} ${p.docs}`))}${functionName}: GenericTxCall<Rv, (${params.map((p) => `${p.normalizedName}: ${p.type}`).join(', ')}) => ChainSubmittableExtrinsic<Rv, ${callInput}>>`)
|
|
45
45
|
.join(',\n')}
|
|
46
46
|
|
|
47
|
-
${commentBlock('Generic pallet tx call')}[callName: string]: GenericTxCall<TxCall
|
|
47
|
+
${commentBlock('Generic pallet tx call')}[callName: string]: GenericTxCall<Rv, TxCall<Rv>>,
|
|
48
48
|
},`;
|
|
49
49
|
}
|
|
50
|
-
const importTypes = this.typesGen.typeImports.toImports();
|
|
50
|
+
const importTypes = this.typesGen.typeImports.toImports({ useSubPaths });
|
|
51
51
|
// TODO make explicit separate type for Extra
|
|
52
52
|
const defTypes = `
|
|
53
|
-
export type ChainSubmittableExtrinsic<T extends IRuntimeTxCall = ${callTypeIn}> =
|
|
53
|
+
export type ChainSubmittableExtrinsic<Rv extends RpcVersion, T extends IRuntimeTxCall = ${callTypeIn}> =
|
|
54
54
|
Extrinsic<${addressTypeIn}, T, ${signatureTypeIn}, any[]> &
|
|
55
|
-
|
|
55
|
+
(Rv extends RpcV2
|
|
56
|
+
? ISubmittableExtrinsic<ISubmittableResult<FrameSystemEventRecord>>
|
|
57
|
+
: ISubmittableExtrinsicLegacy<ISubmittableResult<FrameSystemEventRecord>>)
|
|
56
58
|
|
|
57
|
-
export type TxCall = (...args: any[]) => ChainSubmittableExtrinsic
|
|
59
|
+
export type TxCall<Rv extends RpcVersion> = (...args: any[]) => ChainSubmittableExtrinsic<Rv>;
|
|
58
60
|
`;
|
|
59
|
-
const template = compileTemplate('tx.hbs');
|
|
61
|
+
const template = compileTemplate('chaintypes/templates/tx.hbs');
|
|
60
62
|
return beautifySourceCode(template({ importTypes, defTypes, txDefsOut }));
|
|
61
63
|
}
|
|
62
64
|
#normalizeParamName(name) {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MetadataLatest, PortableRegistry, TypeId } from '@dedot/codecs';
|
|
2
|
+
import { EnumOptions } from '@dedot/shape';
|
|
3
|
+
import { BaseTypesGen } from '../../shared/index.js';
|
|
4
|
+
export declare class TypesGen extends BaseTypesGen {
|
|
5
|
+
metadata: MetadataLatest;
|
|
6
|
+
registry: PortableRegistry;
|
|
7
|
+
constructor(metadata: MetadataLatest);
|
|
8
|
+
generate(useSubPaths?: boolean): Promise<string>;
|
|
9
|
+
shouldGenerateTypeIn(id: TypeId): boolean;
|
|
10
|
+
getEnumOptions(typeId: TypeId): EnumOptions;
|
|
11
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { PortableRegistry } from '@dedot/codecs';
|
|
2
|
+
import { BaseTypesGen } from '../../shared/index.js';
|
|
3
|
+
import { beautifySourceCode, commentBlock, compileTemplate } from '../../utils.js';
|
|
4
|
+
// Skip generate types for these
|
|
5
|
+
// as we do have native types for them
|
|
6
|
+
const SKIP_TYPES = [
|
|
7
|
+
'BoundedBTreeMap',
|
|
8
|
+
'BoundedBTreeSet',
|
|
9
|
+
'BoundedVec',
|
|
10
|
+
'Box',
|
|
11
|
+
'BTreeMap',
|
|
12
|
+
'BTreeSet',
|
|
13
|
+
'Cow',
|
|
14
|
+
'Option',
|
|
15
|
+
'Range',
|
|
16
|
+
'RangeInclusive',
|
|
17
|
+
'Result',
|
|
18
|
+
'WeakBoundedVec',
|
|
19
|
+
'WrapperKeepOpaque',
|
|
20
|
+
'WrapperOpaque',
|
|
21
|
+
];
|
|
22
|
+
export class TypesGen extends BaseTypesGen {
|
|
23
|
+
metadata;
|
|
24
|
+
registry;
|
|
25
|
+
constructor(metadata) {
|
|
26
|
+
super(metadata.types);
|
|
27
|
+
this.metadata = metadata;
|
|
28
|
+
this.skipTypes = SKIP_TYPES;
|
|
29
|
+
this.registry = new PortableRegistry(this.metadata);
|
|
30
|
+
this.includedTypes = this.includeTypes();
|
|
31
|
+
}
|
|
32
|
+
generate(useSubPaths = false) {
|
|
33
|
+
this.clearCache();
|
|
34
|
+
let defTypeOut = '';
|
|
35
|
+
Object.values(this.includedTypes)
|
|
36
|
+
.filter(({ skip, knownType }) => !(skip || knownType))
|
|
37
|
+
.forEach(({ name, nameOut, id, docs }) => {
|
|
38
|
+
defTypeOut += `${commentBlock(docs)}export type ${nameOut} = ${this.generateType(id, 0, true)};\n\n`;
|
|
39
|
+
if (this.shouldGenerateTypeIn(id)) {
|
|
40
|
+
defTypeOut += `export type ${name} = ${this.generateType(id)};\n\n`;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
const importTypes = this.typeImports.toImports({ excludeModules: ['./types'], useSubPaths });
|
|
44
|
+
const template = compileTemplate('chaintypes/templates/types.hbs');
|
|
45
|
+
return beautifySourceCode(template({ importTypes, defTypeOut }));
|
|
46
|
+
}
|
|
47
|
+
shouldGenerateTypeIn(id) {
|
|
48
|
+
const { callTypeId } = this.metadata.extrinsic;
|
|
49
|
+
const palletCallTypeIds = this.registry.getFieldTypeIdsFromEnum(callTypeId);
|
|
50
|
+
return callTypeId === id || palletCallTypeIds.includes(id);
|
|
51
|
+
}
|
|
52
|
+
getEnumOptions(typeId) {
|
|
53
|
+
return this.registry.getEnumOptions(typeId);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { MetadataLatest } from '@dedot/codecs';
|
|
2
|
+
export declare function generateTypesFromEndpoint(chain: string, endpoint: string, outDir?: string, extension?: string, useSubPaths?: boolean): Promise<void>;
|
|
3
|
+
export declare function generateTypes(chain: string, metadata: MetadataLatest, rpcMethods: string[], runtimeApis: Record<string, number>, outDir?: string, extension?: string, useSubPaths?: boolean): Promise<void>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { LegacyClient } from '@dedot/api';
|
|
2
|
+
import { WsProvider } from '@dedot/providers';
|
|
3
|
+
import { stringCamelCase } from '@dedot/utils';
|
|
4
|
+
import * as fs from 'fs';
|
|
5
|
+
import * as path from 'path';
|
|
6
|
+
import { ConstsGen, ErrorsGen, EventsGen, IndexGen, JsonRpcGen, QueryGen, RuntimeApisGen, TxGen, TypesGen, } from './generator/index.js';
|
|
7
|
+
export async function generateTypesFromEndpoint(chain, endpoint, outDir, extension = 'd.ts', useSubPaths = false) {
|
|
8
|
+
const api = await LegacyClient.new(new WsProvider(endpoint));
|
|
9
|
+
const { methods } = await api.rpc.rpc_methods();
|
|
10
|
+
const apis = api.runtimeVersion.apis || {};
|
|
11
|
+
if (!chain) {
|
|
12
|
+
chain = stringCamelCase(api.runtimeVersion.specName || 'local');
|
|
13
|
+
}
|
|
14
|
+
await generateTypes(chain, api.metadata.latest, methods, apis, outDir, extension, useSubPaths);
|
|
15
|
+
await api.disconnect();
|
|
16
|
+
}
|
|
17
|
+
export async function generateTypes(chain, metadata, rpcMethods, runtimeApis, outDir = '.', extension = 'd.ts', useSubPaths = false) {
|
|
18
|
+
const dirPath = path.resolve(outDir, chain);
|
|
19
|
+
const defTypesFileName = path.join(dirPath, `types.${extension}`);
|
|
20
|
+
const constsTypesFileName = path.join(dirPath, `consts.${extension}`);
|
|
21
|
+
const queryTypesFileName = path.join(dirPath, `query.${extension}`);
|
|
22
|
+
const jsonRpcFileName = path.join(dirPath, `json-rpc.${extension}`);
|
|
23
|
+
const indexFileName = path.join(dirPath, `index.${extension}`);
|
|
24
|
+
const errorsFileName = path.join(dirPath, `errors.${extension}`);
|
|
25
|
+
const eventsFileName = path.join(dirPath, `events.${extension}`);
|
|
26
|
+
const runtimeApisFileName = path.join(dirPath, `runtime.${extension}`);
|
|
27
|
+
const txFileName = path.join(dirPath, `tx.${extension}`);
|
|
28
|
+
if (!fs.existsSync(dirPath)) {
|
|
29
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
30
|
+
}
|
|
31
|
+
const typesGen = new TypesGen(metadata);
|
|
32
|
+
const constsGen = new ConstsGen(typesGen);
|
|
33
|
+
const queryGen = new QueryGen(typesGen);
|
|
34
|
+
const jsonRpcGen = new JsonRpcGen(typesGen, rpcMethods);
|
|
35
|
+
const indexGen = new IndexGen(chain);
|
|
36
|
+
const errorsGen = new ErrorsGen(typesGen);
|
|
37
|
+
const eventsGen = new EventsGen(typesGen);
|
|
38
|
+
const runtimeApisGen = new RuntimeApisGen(typesGen, runtimeApis);
|
|
39
|
+
const txGen = new TxGen(typesGen);
|
|
40
|
+
fs.writeFileSync(defTypesFileName, await typesGen.generate(useSubPaths));
|
|
41
|
+
fs.writeFileSync(errorsFileName, await errorsGen.generate(useSubPaths));
|
|
42
|
+
fs.writeFileSync(eventsFileName, await eventsGen.generate(useSubPaths));
|
|
43
|
+
fs.writeFileSync(jsonRpcFileName, await jsonRpcGen.generate(useSubPaths));
|
|
44
|
+
fs.writeFileSync(queryTypesFileName, await queryGen.generate(useSubPaths));
|
|
45
|
+
fs.writeFileSync(constsTypesFileName, await constsGen.generate(useSubPaths));
|
|
46
|
+
fs.writeFileSync(txFileName, await txGen.generate(useSubPaths));
|
|
47
|
+
fs.writeFileSync(indexFileName, await indexGen.generate(useSubPaths));
|
|
48
|
+
fs.writeFileSync(runtimeApisFileName, await runtimeApisGen.generate(useSubPaths));
|
|
49
|
+
}
|