@dedot/codegen 0.13.2 → 0.14.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.
- package/cjs/typink/generator/ConstructorTxGen.js +2 -2
- package/cjs/typink/generator/TxGen.js +1 -1
- package/cjs/typink/templates/constructor-tx.hbs +4 -1
- package/cjs/typink/templates/index.hbs +1 -1
- package/package.json +10 -10
- package/typink/generator/ConstructorTxGen.js +2 -2
- package/typink/generator/TxGen.js +1 -1
- package/typink/templates/constructor-tx.hbs +4 -1
- package/typink/templates/index.hbs +1 -1
|
@@ -7,7 +7,7 @@ class ConstructorTxGen extends QueryGen_js_1.QueryGen {
|
|
|
7
7
|
generate(useSubPaths = false) {
|
|
8
8
|
this.typesGen.clearCache();
|
|
9
9
|
this.typesGen.typeImports.addKnownType('GenericSubstrateApi');
|
|
10
|
-
this.typesGen.typeImports.addContractType('GenericConstructorTx', 'GenericConstructorTxCall', 'ConstructorTxOptions', 'GenericInstantiateSubmittableExtrinsic');
|
|
10
|
+
this.typesGen.typeImports.addContractType('GenericConstructorTx', 'GenericConstructorTxCall', 'ConstructorTxOptions', 'GenericContractApi', 'GenericInstantiateSubmittableExtrinsic');
|
|
11
11
|
const { constructors } = this.contractMetadata.spec;
|
|
12
12
|
const constructorsOut = this.doGenerate(constructors, 'ConstructorTxOptions');
|
|
13
13
|
const importTypes = this.typesGen.typeImports.toImports({ useSubPaths });
|
|
@@ -16,7 +16,7 @@ class ConstructorTxGen extends QueryGen_js_1.QueryGen {
|
|
|
16
16
|
}
|
|
17
17
|
generateMethodDef(def, optionsParamName = 'options') {
|
|
18
18
|
const paramsOut = this.generateParamsOut(def.args);
|
|
19
|
-
return `GenericConstructorTxCall<ChainApi, (${paramsOut && `${paramsOut},`} ${optionsParamName}
|
|
19
|
+
return `GenericConstructorTxCall<ChainApi, (${paramsOut && `${paramsOut},`} ${optionsParamName}?: ConstructorTxOptions) => GenericInstantiateSubmittableExtrinsic<ChainApi, ContractApi>>`;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
exports.ConstructorTxGen = ConstructorTxGen;
|
|
@@ -17,7 +17,7 @@ class TxGen extends QueryGen_js_1.QueryGen {
|
|
|
17
17
|
}
|
|
18
18
|
generateMethodDef(def, optionsParamName = 'options') {
|
|
19
19
|
const paramsOut = this.generateParamsOut(def.args);
|
|
20
|
-
return `GenericContractTxCall<ChainApi, (${paramsOut && `${paramsOut},`} ${optionsParamName}
|
|
20
|
+
return `GenericContractTxCall<ChainApi, (${paramsOut && `${paramsOut},`} ${optionsParamName}?: ContractTxOptions) => ContractSubmittableExtrinsic<ChainApi>>`;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
exports.TxGen = TxGen;
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
{{{ importTypes }}}
|
|
4
4
|
|
|
5
|
-
export interface ConstructorTx<
|
|
5
|
+
export interface ConstructorTx<
|
|
6
|
+
ChainApi extends GenericSubstrateApi,
|
|
7
|
+
ContractApi extends GenericContractApi = GenericContractApi,
|
|
8
|
+
> extends GenericConstructorTx<ChainApi> {
|
|
6
9
|
{{{ constructorsOut }}}
|
|
7
10
|
}
|
|
@@ -13,7 +13,7 @@ export * from './types.js';
|
|
|
13
13
|
query: ContractQuery<ChainApi[Rv]>;
|
|
14
14
|
tx: ContractTx<ChainApi[Rv]>;
|
|
15
15
|
constructorQuery: ConstructorQuery<ChainApi[Rv]>;
|
|
16
|
-
constructorTx: ConstructorTx<ChainApi[Rv]>;
|
|
16
|
+
constructorTx: ConstructorTx<ChainApi[Rv], {{{interfaceName}}}>;
|
|
17
17
|
events: ContractEvents<ChainApi[Rv]>;
|
|
18
18
|
storage: {
|
|
19
19
|
root(): Promise<{{{rootStorageName}}}>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dedot/codegen",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"description": "Generate types",
|
|
5
5
|
"author": "Thang X. Vu <thang@dedot.dev>",
|
|
6
6
|
"homepage": "https://dedot.dev",
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
"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
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dedot/api": "0.
|
|
22
|
-
"@dedot/codecs": "0.
|
|
23
|
-
"@dedot/contracts": "0.
|
|
24
|
-
"@dedot/providers": "0.
|
|
25
|
-
"@dedot/runtime-specs": "0.
|
|
26
|
-
"@dedot/shape": "0.
|
|
27
|
-
"@dedot/types": "0.
|
|
28
|
-
"@dedot/utils": "0.
|
|
21
|
+
"@dedot/api": "0.14.1",
|
|
22
|
+
"@dedot/codecs": "0.14.1",
|
|
23
|
+
"@dedot/contracts": "0.14.1",
|
|
24
|
+
"@dedot/providers": "0.14.1",
|
|
25
|
+
"@dedot/runtime-specs": "0.14.1",
|
|
26
|
+
"@dedot/shape": "0.14.1",
|
|
27
|
+
"@dedot/types": "0.14.1",
|
|
28
|
+
"@dedot/utils": "0.14.1",
|
|
29
29
|
"handlebars": "^4.7.8",
|
|
30
30
|
"prettier": "^3.5.3"
|
|
31
31
|
},
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"node": ">=18"
|
|
38
38
|
},
|
|
39
39
|
"license": "Apache-2.0",
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "d5adec49781a6e0b45910055dcaf9bf472a39a6b",
|
|
41
41
|
"module": "./index.js",
|
|
42
42
|
"types": "./index.d.ts",
|
|
43
43
|
"exports": {
|
|
@@ -4,7 +4,7 @@ export class ConstructorTxGen extends QueryGen {
|
|
|
4
4
|
generate(useSubPaths = false) {
|
|
5
5
|
this.typesGen.clearCache();
|
|
6
6
|
this.typesGen.typeImports.addKnownType('GenericSubstrateApi');
|
|
7
|
-
this.typesGen.typeImports.addContractType('GenericConstructorTx', 'GenericConstructorTxCall', 'ConstructorTxOptions', 'GenericInstantiateSubmittableExtrinsic');
|
|
7
|
+
this.typesGen.typeImports.addContractType('GenericConstructorTx', 'GenericConstructorTxCall', 'ConstructorTxOptions', 'GenericContractApi', 'GenericInstantiateSubmittableExtrinsic');
|
|
8
8
|
const { constructors } = this.contractMetadata.spec;
|
|
9
9
|
const constructorsOut = this.doGenerate(constructors, 'ConstructorTxOptions');
|
|
10
10
|
const importTypes = this.typesGen.typeImports.toImports({ useSubPaths });
|
|
@@ -13,6 +13,6 @@ export class ConstructorTxGen extends QueryGen {
|
|
|
13
13
|
}
|
|
14
14
|
generateMethodDef(def, optionsParamName = 'options') {
|
|
15
15
|
const paramsOut = this.generateParamsOut(def.args);
|
|
16
|
-
return `GenericConstructorTxCall<ChainApi, (${paramsOut && `${paramsOut},`} ${optionsParamName}
|
|
16
|
+
return `GenericConstructorTxCall<ChainApi, (${paramsOut && `${paramsOut},`} ${optionsParamName}?: ConstructorTxOptions) => GenericInstantiateSubmittableExtrinsic<ChainApi, ContractApi>>`;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -14,6 +14,6 @@ export class TxGen extends QueryGen {
|
|
|
14
14
|
}
|
|
15
15
|
generateMethodDef(def, optionsParamName = 'options') {
|
|
16
16
|
const paramsOut = this.generateParamsOut(def.args);
|
|
17
|
-
return `GenericContractTxCall<ChainApi, (${paramsOut && `${paramsOut},`} ${optionsParamName}
|
|
17
|
+
return `GenericContractTxCall<ChainApi, (${paramsOut && `${paramsOut},`} ${optionsParamName}?: ContractTxOptions) => ContractSubmittableExtrinsic<ChainApi>>`;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
{{{ importTypes }}}
|
|
4
4
|
|
|
5
|
-
export interface ConstructorTx<
|
|
5
|
+
export interface ConstructorTx<
|
|
6
|
+
ChainApi extends GenericSubstrateApi,
|
|
7
|
+
ContractApi extends GenericContractApi = GenericContractApi,
|
|
8
|
+
> extends GenericConstructorTx<ChainApi> {
|
|
6
9
|
{{{ constructorsOut }}}
|
|
7
10
|
}
|
|
@@ -13,7 +13,7 @@ export * from './types.js';
|
|
|
13
13
|
query: ContractQuery<ChainApi[Rv]>;
|
|
14
14
|
tx: ContractTx<ChainApi[Rv]>;
|
|
15
15
|
constructorQuery: ConstructorQuery<ChainApi[Rv]>;
|
|
16
|
-
constructorTx: ConstructorTx<ChainApi[Rv]>;
|
|
16
|
+
constructorTx: ConstructorTx<ChainApi[Rv], {{{interfaceName}}}>;
|
|
17
17
|
events: ContractEvents<ChainApi[Rv]>;
|
|
18
18
|
storage: {
|
|
19
19
|
root(): Promise<{{{rootStorageName}}}>;
|