@dedot/codegen 0.17.1-next.6d398d60.0 → 0.17.1-next.9d03d21b.3
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/cjs/sol/generator/ConstructorQueryGen.js +1 -0
- package/cjs/sol/generator/ConstructorTxGen.js +1 -0
- package/cjs/sol/generator/EventsGen.js +1 -0
- package/cjs/sol/generator/QueryGen.js +1 -0
- package/cjs/sol/generator/TxGen.js +1 -0
- package/cjs/sol/generator/TypesGen.js +3 -0
- package/cjs/sol/templates/constructor-query.hbs +7 -0
- package/cjs/sol/templates/constructor-tx.hbs +11 -0
- package/cjs/sol/templates/events.hbs +7 -0
- package/cjs/sol/templates/index.hbs +23 -0
- package/cjs/sol/templates/query.hbs +7 -0
- package/cjs/sol/templates/tx.hbs +7 -0
- package/cjs/sol/templates/types.hbs +5 -0
- package/package.json +11 -11
- package/sol/generator/ConstructorQueryGen.js +1 -0
- package/sol/generator/ConstructorTxGen.js +1 -0
- package/sol/generator/EventsGen.js +1 -0
- package/sol/generator/QueryGen.js +1 -0
- package/sol/generator/TxGen.js +1 -0
- package/sol/generator/TypesGen.d.ts +1 -0
- package/sol/generator/TypesGen.js +3 -0
- package/sol/templates/constructor-query.hbs +7 -0
- package/sol/templates/constructor-tx.hbs +11 -0
- package/sol/templates/events.hbs +7 -0
- package/sol/templates/index.hbs +23 -0
- package/sol/templates/query.hbs +7 -0
- package/sol/templates/tx.hbs +7 -0
- package/sol/templates/types.hbs +5 -0
|
@@ -11,6 +11,7 @@ class ConstructorQueryGen {
|
|
|
11
11
|
this.typesGen = typesGen;
|
|
12
12
|
}
|
|
13
13
|
generate(useSubPaths = false) {
|
|
14
|
+
this.typesGen.clearCache();
|
|
14
15
|
this.typesGen.typeImports.addKnownType('GenericSubstrateApi');
|
|
15
16
|
this.typesGen.typeImports.addContractType('GenericConstructorQuery', 'GenericConstructorQueryCall', 'GenericConstructorCallResult', 'ConstructorCallOptions', 'ContractInstantiateResult', 'MetadataType');
|
|
16
17
|
let constructor = this.findConstructor();
|
|
@@ -5,6 +5,7 @@ const utils_js_1 = require("../../utils.js");
|
|
|
5
5
|
const ConstructorQueryGen_js_1 = require("./ConstructorQueryGen.js");
|
|
6
6
|
class ConstructorTxGen extends ConstructorQueryGen_js_1.ConstructorQueryGen {
|
|
7
7
|
generate(useSubPaths = false) {
|
|
8
|
+
this.typesGen.clearCache();
|
|
8
9
|
this.typesGen.typeImports.addKnownType('GenericSubstrateApi');
|
|
9
10
|
this.typesGen.typeImports.addContractType('GenericConstructorTx', 'SolGenericContractApi', 'GenericConstructorTxCall', 'ConstructorTxOptions', 'GenericInstantiateSubmittableExtrinsic', 'MetadataType');
|
|
10
11
|
let constructor = this.findConstructor();
|
|
@@ -11,6 +11,7 @@ class EventsGen {
|
|
|
11
11
|
this.typesGen = typesGen;
|
|
12
12
|
}
|
|
13
13
|
generate(useSubPaths = false) {
|
|
14
|
+
this.typesGen.clearCache();
|
|
14
15
|
this.typesGen.typeImports.addKnownType('GenericSubstrateApi');
|
|
15
16
|
this.typesGen.typeImports.addContractType('GenericContractEvents', 'GenericContractEvent', 'MetadataType');
|
|
16
17
|
const events = this.abi.filter((o) => o.type === 'event');
|
|
@@ -12,6 +12,7 @@ class QueryGen {
|
|
|
12
12
|
this.typesGen = typesGen;
|
|
13
13
|
}
|
|
14
14
|
generate(useSubPaths = false) {
|
|
15
|
+
this.typesGen.clearCache();
|
|
15
16
|
this.typesGen.typeImports.addKnownType('GenericSubstrateApi');
|
|
16
17
|
this.typesGen.typeImports.addContractType('GenericContractQuery', 'GenericContractQueryCall', 'ContractCallOptions', 'GenericContractCallResult', 'ContractCallResult', 'MetadataType');
|
|
17
18
|
const functions = this.abi.filter((item) => item.type === 'function');
|
|
@@ -5,6 +5,7 @@ const utils_js_1 = require("../../utils.js");
|
|
|
5
5
|
const QueryGen_js_1 = require("./QueryGen.js");
|
|
6
6
|
class TxGen extends QueryGen_js_1.QueryGen {
|
|
7
7
|
generate(useSubPaths = false) {
|
|
8
|
+
this.typesGen.clearCache();
|
|
8
9
|
this.typesGen.typeImports.addKnownType('GenericSubstrateApi');
|
|
9
10
|
this.typesGen.typeImports.addContractType('GenericContractTx', 'GenericContractTxCall', 'ContractTxOptions', 'ContractSubmittableExtrinsic', 'MetadataType');
|
|
10
11
|
const txFunctions = this.abi.filter((item) => item.type === 'function' && item.stateMutability !== 'view');
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Generated by dedot cli
|
|
2
|
+
|
|
3
|
+
{{{ importTypes }}}
|
|
4
|
+
|
|
5
|
+
export interface ConstructorTx<
|
|
6
|
+
ChainApi extends GenericSubstrateApi,
|
|
7
|
+
ContractApi extends SolGenericContractApi,
|
|
8
|
+
Type extends MetadataType
|
|
9
|
+
> extends GenericConstructorTx <ChainApi, Type> {
|
|
10
|
+
{{{ constructorsOut }}}
|
|
11
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Generated by dedot cli
|
|
2
|
+
|
|
3
|
+
{{{importTypes}}}
|
|
4
|
+
import { ContractQuery } from './query.js';
|
|
5
|
+
import { ContractTx } from './tx.js';
|
|
6
|
+
import { ConstructorQuery } from './constructor-query.js';
|
|
7
|
+
import { ConstructorTx } from './constructor-tx.js';
|
|
8
|
+
import { ContractEvents } from './events.js';
|
|
9
|
+
|
|
10
|
+
export * from './types.js';
|
|
11
|
+
|
|
12
|
+
{{{interfaceDocs}}}export interface {{{interfaceName}}}<Rv extends RpcVersion = RpcVersion, ChainApi extends VersionedGenericSubstrateApi = SubstrateApi> extends SolGenericContractApi<Rv, ChainApi> {
|
|
13
|
+
metadataType: 'sol';
|
|
14
|
+
query: ContractQuery<ChainApi[Rv], 'sol'>;
|
|
15
|
+
tx: ContractTx<ChainApi[Rv], 'sol'>;
|
|
16
|
+
constructorQuery: ConstructorQuery<ChainApi[Rv], 'sol'>;
|
|
17
|
+
events: ContractEvents<ChainApi[Rv], 'sol'>;
|
|
18
|
+
constructorTx: ConstructorTx<ChainApi[Rv], {{{interfaceName}}}, 'sol'>;
|
|
19
|
+
|
|
20
|
+
types: {
|
|
21
|
+
ChainApi: ChainApi[Rv];
|
|
22
|
+
};
|
|
23
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dedot/codegen",
|
|
3
|
-
"version": "0.17.1-next.
|
|
3
|
+
"version": "0.17.1-next.9d03d21b.3+9d03d21b",
|
|
4
4
|
"description": "Generate types",
|
|
5
5
|
"author": "Thang X. Vu <thang@dedot.dev>",
|
|
6
6
|
"homepage": "https://dedot.dev",
|
|
@@ -16,17 +16,17 @@
|
|
|
16
16
|
"build": "tsc --project tsconfig.build.json && tsc --project tsconfig.build.cjs.json && yarn copy",
|
|
17
17
|
"test": "npx vitest --watch=false",
|
|
18
18
|
"clean": "rm -rf ./dist && rm -rf ./tsconfig.tsbuildinfo ./tsconfig.build.tsbuildinfo",
|
|
19
|
-
"copy": "cp -R ./src/chaintypes/templates ./dist/chaintypes && cp -R ./src/chaintypes/templates ./dist/cjs/chaintypes && cp -R ./src/typink/templates ./dist/typink && cp -R ./src/typink/templates ./dist/cjs/typink"
|
|
19
|
+
"copy": "cp -R ./src/chaintypes/templates ./dist/chaintypes && cp -R ./src/chaintypes/templates ./dist/cjs/chaintypes && cp -R ./src/typink/templates ./dist/typink && cp -R ./src/typink/templates ./dist/cjs/typink && cp -R ./src/sol/templates ./dist/sol && cp -R ./src/sol/templates ./dist/cjs/sol"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@dedot/api": "0.17.1-next.
|
|
23
|
-
"@dedot/codecs": "0.17.1-next.
|
|
24
|
-
"@dedot/contracts": "0.17.1-next.
|
|
25
|
-
"@dedot/providers": "0.17.1-next.
|
|
26
|
-
"@dedot/runtime-specs": "0.17.1-next.
|
|
27
|
-
"@dedot/shape": "0.17.1-next.
|
|
28
|
-
"@dedot/types": "0.17.1-next.
|
|
29
|
-
"@dedot/utils": "0.17.1-next.
|
|
22
|
+
"@dedot/api": "0.17.1-next.9d03d21b.3+9d03d21b",
|
|
23
|
+
"@dedot/codecs": "0.17.1-next.9d03d21b.3+9d03d21b",
|
|
24
|
+
"@dedot/contracts": "0.17.1-next.9d03d21b.3+9d03d21b",
|
|
25
|
+
"@dedot/providers": "0.17.1-next.9d03d21b.3+9d03d21b",
|
|
26
|
+
"@dedot/runtime-specs": "0.17.1-next.9d03d21b.3+9d03d21b",
|
|
27
|
+
"@dedot/shape": "0.17.1-next.9d03d21b.3+9d03d21b",
|
|
28
|
+
"@dedot/types": "0.17.1-next.9d03d21b.3+9d03d21b",
|
|
29
|
+
"@dedot/utils": "0.17.1-next.9d03d21b.3+9d03d21b",
|
|
30
30
|
"handlebars": "^4.7.8",
|
|
31
31
|
"prettier": "^3.6.2"
|
|
32
32
|
},
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"node": ">=18"
|
|
39
39
|
},
|
|
40
40
|
"license": "Apache-2.0",
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "9d03d21b0b652b14222301b64682940047514172",
|
|
42
42
|
"module": "./index.js",
|
|
43
43
|
"types": "./index.d.ts",
|
|
44
44
|
"exports": {
|
|
@@ -8,6 +8,7 @@ export class ConstructorQueryGen {
|
|
|
8
8
|
this.typesGen = typesGen;
|
|
9
9
|
}
|
|
10
10
|
generate(useSubPaths = false) {
|
|
11
|
+
this.typesGen.clearCache();
|
|
11
12
|
this.typesGen.typeImports.addKnownType('GenericSubstrateApi');
|
|
12
13
|
this.typesGen.typeImports.addContractType('GenericConstructorQuery', 'GenericConstructorQueryCall', 'GenericConstructorCallResult', 'ConstructorCallOptions', 'ContractInstantiateResult', 'MetadataType');
|
|
13
14
|
let constructor = this.findConstructor();
|
|
@@ -2,6 +2,7 @@ import { beautifySourceCode, compileTemplate } from '../../utils.js';
|
|
|
2
2
|
import { ConstructorQueryGen } from './ConstructorQueryGen.js';
|
|
3
3
|
export class ConstructorTxGen extends ConstructorQueryGen {
|
|
4
4
|
generate(useSubPaths = false) {
|
|
5
|
+
this.typesGen.clearCache();
|
|
5
6
|
this.typesGen.typeImports.addKnownType('GenericSubstrateApi');
|
|
6
7
|
this.typesGen.typeImports.addContractType('GenericConstructorTx', 'SolGenericContractApi', 'GenericConstructorTxCall', 'ConstructorTxOptions', 'GenericInstantiateSubmittableExtrinsic', 'MetadataType');
|
|
7
8
|
let constructor = this.findConstructor();
|
|
@@ -8,6 +8,7 @@ export class EventsGen {
|
|
|
8
8
|
this.typesGen = typesGen;
|
|
9
9
|
}
|
|
10
10
|
generate(useSubPaths = false) {
|
|
11
|
+
this.typesGen.clearCache();
|
|
11
12
|
this.typesGen.typeImports.addKnownType('GenericSubstrateApi');
|
|
12
13
|
this.typesGen.typeImports.addContractType('GenericContractEvents', 'GenericContractEvent', 'MetadataType');
|
|
13
14
|
const events = this.abi.filter((o) => o.type === 'event');
|
|
@@ -9,6 +9,7 @@ export class QueryGen {
|
|
|
9
9
|
this.typesGen = typesGen;
|
|
10
10
|
}
|
|
11
11
|
generate(useSubPaths = false) {
|
|
12
|
+
this.typesGen.clearCache();
|
|
12
13
|
this.typesGen.typeImports.addKnownType('GenericSubstrateApi');
|
|
13
14
|
this.typesGen.typeImports.addContractType('GenericContractQuery', 'GenericContractQueryCall', 'ContractCallOptions', 'GenericContractCallResult', 'ContractCallResult', 'MetadataType');
|
|
14
15
|
const functions = this.abi.filter((item) => item.type === 'function');
|
package/sol/generator/TxGen.js
CHANGED
|
@@ -2,6 +2,7 @@ import { beautifySourceCode, compileTemplate } from '../../utils.js';
|
|
|
2
2
|
import { QueryGen } from './QueryGen.js';
|
|
3
3
|
export class TxGen extends QueryGen {
|
|
4
4
|
generate(useSubPaths = false) {
|
|
5
|
+
this.typesGen.clearCache();
|
|
5
6
|
this.typesGen.typeImports.addKnownType('GenericSubstrateApi');
|
|
6
7
|
this.typesGen.typeImports.addContractType('GenericContractTx', 'GenericContractTxCall', 'ContractTxOptions', 'ContractSubmittableExtrinsic', 'MetadataType');
|
|
7
8
|
const txFunctions = this.abi.filter((item) => item.type === 'function' && item.stateMutability !== 'view');
|
|
@@ -12,4 +12,5 @@ export declare class TypesGen {
|
|
|
12
12
|
generateType(typeDef: SolAbiTypeDef, abiItem?: SolAbiItem, nestedLevel?: number, typeOut?: boolean): string;
|
|
13
13
|
generateObjectType(components: SolAbiTypeDef[], nestedLevel?: number, typeOut?: boolean): string;
|
|
14
14
|
addTypeImport(typeName: string | string[]): void;
|
|
15
|
+
clearCache(): void;
|
|
15
16
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Generated by dedot cli
|
|
2
|
+
|
|
3
|
+
{{{ importTypes }}}
|
|
4
|
+
|
|
5
|
+
export interface ConstructorTx<
|
|
6
|
+
ChainApi extends GenericSubstrateApi,
|
|
7
|
+
ContractApi extends SolGenericContractApi,
|
|
8
|
+
Type extends MetadataType
|
|
9
|
+
> extends GenericConstructorTx <ChainApi, Type> {
|
|
10
|
+
{{{ constructorsOut }}}
|
|
11
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Generated by dedot cli
|
|
2
|
+
|
|
3
|
+
{{{importTypes}}}
|
|
4
|
+
import { ContractQuery } from './query.js';
|
|
5
|
+
import { ContractTx } from './tx.js';
|
|
6
|
+
import { ConstructorQuery } from './constructor-query.js';
|
|
7
|
+
import { ConstructorTx } from './constructor-tx.js';
|
|
8
|
+
import { ContractEvents } from './events.js';
|
|
9
|
+
|
|
10
|
+
export * from './types.js';
|
|
11
|
+
|
|
12
|
+
{{{interfaceDocs}}}export interface {{{interfaceName}}}<Rv extends RpcVersion = RpcVersion, ChainApi extends VersionedGenericSubstrateApi = SubstrateApi> extends SolGenericContractApi<Rv, ChainApi> {
|
|
13
|
+
metadataType: 'sol';
|
|
14
|
+
query: ContractQuery<ChainApi[Rv], 'sol'>;
|
|
15
|
+
tx: ContractTx<ChainApi[Rv], 'sol'>;
|
|
16
|
+
constructorQuery: ConstructorQuery<ChainApi[Rv], 'sol'>;
|
|
17
|
+
events: ContractEvents<ChainApi[Rv], 'sol'>;
|
|
18
|
+
constructorTx: ConstructorTx<ChainApi[Rv], {{{interfaceName}}}, 'sol'>;
|
|
19
|
+
|
|
20
|
+
types: {
|
|
21
|
+
ChainApi: ChainApi[Rv];
|
|
22
|
+
};
|
|
23
|
+
}
|