@dedot/codegen 0.17.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/index.js +1 -0
- package/cjs/sol/generator/ConstructorQueryGen.js +56 -0
- package/cjs/sol/generator/ConstructorTxGen.js +22 -0
- package/cjs/sol/generator/EventsGen.js +39 -0
- package/cjs/sol/generator/IndexGen.js +27 -0
- package/cjs/sol/generator/QueryGen.js +51 -0
- package/cjs/sol/generator/TxGen.js +22 -0
- package/cjs/sol/generator/TypesGen.js +219 -0
- package/cjs/sol/generator/index.js +23 -0
- package/cjs/sol/index.js +42 -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/cjs/typink/generator/ConstructorQueryGen.js +2 -2
- package/cjs/typink/generator/ConstructorTxGen.js +2 -2
- package/cjs/typink/generator/EventsGen.js +2 -2
- package/cjs/typink/generator/IndexGen.js +1 -1
- package/cjs/typink/generator/QueryGen.js +2 -2
- package/cjs/typink/generator/TxGen.js +2 -2
- package/cjs/typink/templates/constructor-query.hbs +1 -1
- package/cjs/typink/templates/constructor-tx.hbs +3 -2
- package/cjs/typink/templates/events.hbs +1 -1
- package/cjs/typink/templates/index.hbs +8 -7
- package/cjs/typink/templates/query.hbs +1 -1
- package/cjs/typink/templates/tx.hbs +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +12 -11
- package/sol/generator/ConstructorQueryGen.d.ts +12 -0
- package/sol/generator/ConstructorQueryGen.js +52 -0
- package/sol/generator/ConstructorTxGen.d.ts +6 -0
- package/sol/generator/ConstructorTxGen.js +18 -0
- package/sol/generator/EventsGen.d.ts +10 -0
- package/sol/generator/EventsGen.js +35 -0
- package/sol/generator/IndexGen.d.ts +7 -0
- package/sol/generator/IndexGen.js +23 -0
- package/sol/generator/QueryGen.d.ts +11 -0
- package/sol/generator/QueryGen.js +47 -0
- package/sol/generator/TxGen.d.ts +6 -0
- package/sol/generator/TxGen.js +18 -0
- package/sol/generator/TypesGen.d.ts +16 -0
- package/sol/generator/TypesGen.js +215 -0
- package/sol/generator/index.d.ts +7 -0
- package/sol/generator/index.js +7 -0
- package/sol/index.d.ts +3 -0
- package/sol/index.js +35 -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
- package/typink/generator/ConstructorQueryGen.js +2 -2
- package/typink/generator/ConstructorTxGen.js +2 -2
- package/typink/generator/EventsGen.js +2 -2
- package/typink/generator/IndexGen.js +1 -1
- package/typink/generator/QueryGen.js +2 -2
- package/typink/generator/TxGen.js +2 -2
- package/typink/templates/constructor-query.hbs +1 -1
- package/typink/templates/constructor-tx.hbs +3 -2
- package/typink/templates/events.hbs +1 -1
- package/typink/templates/index.hbs +8 -7
- package/typink/templates/query.hbs +1 -1
- package/typink/templates/tx.hbs +1 -1
package/cjs/index.js
CHANGED
|
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./types.js"), exports);
|
|
18
18
|
__exportStar(require("./chaintypes/index.js"), exports);
|
|
19
19
|
__exportStar(require("./typink/index.js"), exports);
|
|
20
|
+
__exportStar(require("./sol/index.js"), exports);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConstructorQueryGen = void 0;
|
|
4
|
+
const utils_1 = require("@dedot/utils");
|
|
5
|
+
const utils_js_1 = require("../../utils.js");
|
|
6
|
+
class ConstructorQueryGen {
|
|
7
|
+
abi;
|
|
8
|
+
typesGen;
|
|
9
|
+
constructor(abi, typesGen) {
|
|
10
|
+
this.abi = abi;
|
|
11
|
+
this.typesGen = typesGen;
|
|
12
|
+
}
|
|
13
|
+
generate(useSubPaths = false) {
|
|
14
|
+
this.typesGen.clearCache();
|
|
15
|
+
this.typesGen.typeImports.addKnownType('GenericSubstrateApi');
|
|
16
|
+
this.typesGen.typeImports.addContractType('GenericConstructorQuery', 'GenericConstructorQueryCall', 'GenericConstructorCallResult', 'ConstructorCallOptions', 'ContractInstantiateResult', 'MetadataType');
|
|
17
|
+
let constructor = this.findConstructor();
|
|
18
|
+
const constructorsOut = this.doGenerateConstructorFragment(constructor, 'ConstructorCallOptions');
|
|
19
|
+
const importTypes = this.typesGen.typeImports.toImports({ useSubPaths });
|
|
20
|
+
const template = (0, utils_js_1.compileTemplate)('sol/templates/constructor-query.hbs');
|
|
21
|
+
return (0, utils_js_1.beautifySourceCode)(template({ importTypes, constructorsOut }));
|
|
22
|
+
}
|
|
23
|
+
doGenerateConstructorFragment(abiItem, optionsTypeName) {
|
|
24
|
+
let callsOut = '';
|
|
25
|
+
const { inputs = [] } = abiItem;
|
|
26
|
+
// In case there is an arg has label `options`,
|
|
27
|
+
// we use the name `_options` for the last options param
|
|
28
|
+
// This is just and edge case, so this approach works for now
|
|
29
|
+
const optionsParamName = inputs.some(({ name }) => name === 'options') ? '_options' : 'options';
|
|
30
|
+
callsOut += `${(0, utils_js_1.commentBlock)(inputs.map((input, idx) => `@param {${this.typesGen.generateType(input, abiItem, 1)}} ${(0, utils_1.stringCamelCase)(input.name || `arg${idx}`)}`), optionsTypeName ? `@param {${optionsTypeName}} ${optionsParamName}` : '')}`;
|
|
31
|
+
callsOut += `new: ${this.generateMethodDef(abiItem, optionsParamName)};\n\n`;
|
|
32
|
+
return callsOut;
|
|
33
|
+
}
|
|
34
|
+
generateMethodDef(abiItem, optionsParamName = 'options') {
|
|
35
|
+
const paramsOut = this.generateParamsOut(abiItem);
|
|
36
|
+
return `GenericConstructorQueryCall<ChainApi, (${paramsOut && `${paramsOut},`} ${optionsParamName}?: ConstructorCallOptions) => Promise<GenericConstructorCallResult<[], ContractInstantiateResult<ChainApi>>>, Type>`;
|
|
37
|
+
}
|
|
38
|
+
generateParamsOut(abiItem) {
|
|
39
|
+
return abiItem.inputs
|
|
40
|
+
.map((input, idx) => `${(0, utils_1.stringCamelCase)(input.name || `arg${idx}`)}: ${this.typesGen.generateType(input, abiItem, 1)}`)
|
|
41
|
+
.join(', ');
|
|
42
|
+
}
|
|
43
|
+
findConstructor() {
|
|
44
|
+
let constructor = this.abi.find((item) => item.type === 'constructor');
|
|
45
|
+
// Fallback to default constructor
|
|
46
|
+
if (!constructor) {
|
|
47
|
+
constructor = {
|
|
48
|
+
inputs: [],
|
|
49
|
+
stateMutability: 'nonpayable',
|
|
50
|
+
type: 'constructor',
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return constructor;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.ConstructorQueryGen = ConstructorQueryGen;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConstructorTxGen = void 0;
|
|
4
|
+
const utils_js_1 = require("../../utils.js");
|
|
5
|
+
const ConstructorQueryGen_js_1 = require("./ConstructorQueryGen.js");
|
|
6
|
+
class ConstructorTxGen extends ConstructorQueryGen_js_1.ConstructorQueryGen {
|
|
7
|
+
generate(useSubPaths = false) {
|
|
8
|
+
this.typesGen.clearCache();
|
|
9
|
+
this.typesGen.typeImports.addKnownType('GenericSubstrateApi');
|
|
10
|
+
this.typesGen.typeImports.addContractType('GenericConstructorTx', 'SolGenericContractApi', 'GenericConstructorTxCall', 'ConstructorTxOptions', 'GenericInstantiateSubmittableExtrinsic', 'MetadataType');
|
|
11
|
+
let constructor = this.findConstructor();
|
|
12
|
+
const constructorsOut = this.doGenerateConstructorFragment(constructor, 'ConstructorTxOptions');
|
|
13
|
+
const importTypes = this.typesGen.typeImports.toImports({ useSubPaths });
|
|
14
|
+
const template = (0, utils_js_1.compileTemplate)('sol/templates/constructor-tx.hbs');
|
|
15
|
+
return (0, utils_js_1.beautifySourceCode)(template({ importTypes, constructorsOut }));
|
|
16
|
+
}
|
|
17
|
+
generateMethodDef(abiItem, optionsParamName = 'options') {
|
|
18
|
+
const paramsOut = this.generateParamsOut(abiItem);
|
|
19
|
+
return `GenericConstructorTxCall<ChainApi, (${paramsOut && `${paramsOut},`} ${optionsParamName}?: ConstructorTxOptions) => GenericInstantiateSubmittableExtrinsic<ChainApi, ContractApi>, Type>`;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.ConstructorTxGen = ConstructorTxGen;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EventsGen = void 0;
|
|
4
|
+
const utils_1 = require("@dedot/utils");
|
|
5
|
+
const utils_js_1 = require("../../utils.js");
|
|
6
|
+
class EventsGen {
|
|
7
|
+
abi;
|
|
8
|
+
typesGen;
|
|
9
|
+
constructor(abi, typesGen) {
|
|
10
|
+
this.abi = abi;
|
|
11
|
+
this.typesGen = typesGen;
|
|
12
|
+
}
|
|
13
|
+
generate(useSubPaths = false) {
|
|
14
|
+
this.typesGen.clearCache();
|
|
15
|
+
this.typesGen.typeImports.addKnownType('GenericSubstrateApi');
|
|
16
|
+
this.typesGen.typeImports.addContractType('GenericContractEvents', 'GenericContractEvent', 'MetadataType');
|
|
17
|
+
const events = this.abi.filter((o) => o.type === 'event');
|
|
18
|
+
let eventsOut = '';
|
|
19
|
+
events.forEach((event) => {
|
|
20
|
+
const { name, anonymous } = event;
|
|
21
|
+
eventsOut += `${(0, utils_1.stringPascalCase)(name)}: ${this.#generateEventDef(event)};\n\n`;
|
|
22
|
+
});
|
|
23
|
+
const importTypes = this.typesGen.typeImports.toImports({ useSubPaths });
|
|
24
|
+
const template = (0, utils_js_1.compileTemplate)('sol/templates/events.hbs');
|
|
25
|
+
return (0, utils_js_1.beautifySourceCode)(template({ importTypes, eventsOut }));
|
|
26
|
+
}
|
|
27
|
+
#generateEventDef(abiItem) {
|
|
28
|
+
const { name } = abiItem;
|
|
29
|
+
const paramsOut = this.generateParamsOut(abiItem);
|
|
30
|
+
return `GenericContractEvent<'${(0, utils_1.stringPascalCase)(name)}', {${paramsOut}}, Type>`;
|
|
31
|
+
}
|
|
32
|
+
generateParamsOut(abiItem) {
|
|
33
|
+
const { inputs } = abiItem;
|
|
34
|
+
return inputs
|
|
35
|
+
.map((o, idx) => `${(0, utils_js_1.commentBlock)(`@indexed: ${o.indexed}`)}${(0, utils_1.stringCamelCase)(o.name || `arg${idx}`)}: ${this.typesGen.generateType(o, abiItem, 1)}`)
|
|
36
|
+
.join(', ');
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.EventsGen = EventsGen;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IndexGen = void 0;
|
|
4
|
+
const index_js_1 = require("../../shared/index.js");
|
|
5
|
+
const utils_js_1 = require("../../utils.js");
|
|
6
|
+
class IndexGen {
|
|
7
|
+
interfaceName;
|
|
8
|
+
typesGen;
|
|
9
|
+
constructor(interfaceName, typesGen) {
|
|
10
|
+
this.interfaceName = interfaceName;
|
|
11
|
+
this.typesGen = typesGen;
|
|
12
|
+
}
|
|
13
|
+
generate(useSubPaths = false) {
|
|
14
|
+
const interfaceName = this.interfaceName;
|
|
15
|
+
const typeImports = new index_js_1.TypeImports();
|
|
16
|
+
typeImports.addKnownType('VersionedGenericSubstrateApi', 'RpcVersion', 'RpcV2');
|
|
17
|
+
typeImports.addContractType('SolGenericContractApi', 'SolRegistry');
|
|
18
|
+
typeImports.addChainType('SubstrateApi');
|
|
19
|
+
const importTypes = typeImports.toImports({ useSubPaths });
|
|
20
|
+
const template = (0, utils_js_1.compileTemplate)('sol/templates/index.hbs');
|
|
21
|
+
return (0, utils_js_1.beautifySourceCode)(template({
|
|
22
|
+
interfaceName,
|
|
23
|
+
importTypes,
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.IndexGen = IndexGen;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QueryGen = void 0;
|
|
4
|
+
const contracts_1 = require("@dedot/contracts");
|
|
5
|
+
const utils_1 = require("@dedot/utils");
|
|
6
|
+
const utils_js_1 = require("../../utils.js");
|
|
7
|
+
class QueryGen {
|
|
8
|
+
abi;
|
|
9
|
+
typesGen;
|
|
10
|
+
constructor(abi, typesGen) {
|
|
11
|
+
this.abi = abi;
|
|
12
|
+
this.typesGen = typesGen;
|
|
13
|
+
}
|
|
14
|
+
generate(useSubPaths = false) {
|
|
15
|
+
this.typesGen.clearCache();
|
|
16
|
+
this.typesGen.typeImports.addKnownType('GenericSubstrateApi');
|
|
17
|
+
this.typesGen.typeImports.addContractType('GenericContractQuery', 'GenericContractQueryCall', 'ContractCallOptions', 'GenericContractCallResult', 'ContractCallResult', 'MetadataType');
|
|
18
|
+
const functions = this.abi.filter((item) => item.type === 'function');
|
|
19
|
+
const queryCallsOut = this.doGenerate(functions, 'ContractCallOptions');
|
|
20
|
+
const importTypes = this.typesGen.typeImports.toImports({ useSubPaths });
|
|
21
|
+
const template = (0, utils_js_1.compileTemplate)('sol/templates/query.hbs');
|
|
22
|
+
return (0, utils_js_1.beautifySourceCode)(template({ importTypes, queryCallsOut }));
|
|
23
|
+
}
|
|
24
|
+
doGenerate(functions, optionsTypeName) {
|
|
25
|
+
let callsOut = '';
|
|
26
|
+
functions.forEach((def) => {
|
|
27
|
+
const { inputs, name } = def;
|
|
28
|
+
// In case there is an arg has label `options`,
|
|
29
|
+
// we use the name `_options` for the last options param
|
|
30
|
+
// This is just and edge case, so this approach works for now
|
|
31
|
+
const optionsParamName = inputs.some(({ name }) => name === 'options') ? '_options' : 'options';
|
|
32
|
+
callsOut += `${(0, utils_js_1.commentBlock)(inputs.map((input, idx) => `@param {${this.typesGen.generateType(input, def, 1)}} ${(0, utils_1.stringCamelCase)(input.name || `arg${idx}`)}`), optionsTypeName ? `@param {${optionsTypeName}} ${optionsParamName}` : '')}`;
|
|
33
|
+
callsOut += `${(0, contracts_1.normalizeLabel)(name)}: ${this.generateMethodDef(def, optionsParamName)};\n\n`;
|
|
34
|
+
});
|
|
35
|
+
return callsOut;
|
|
36
|
+
}
|
|
37
|
+
generateMethodDef(abiItem, optionsParamName = 'options') {
|
|
38
|
+
const { outputs } = abiItem;
|
|
39
|
+
const paramsOut = this.generateParamsOut(abiItem);
|
|
40
|
+
const typeOutInner = `${outputs.map((o) => this.typesGen.generateType(o, abiItem, 1, true)).join(',')}`;
|
|
41
|
+
// If there is only one output, we don't need to wrap it in a tuple, for user-friendly
|
|
42
|
+
const typeOut = outputs.length === 1 ? typeOutInner : `[${typeOutInner}]`;
|
|
43
|
+
return `GenericContractQueryCall<ChainApi, (${paramsOut && `${paramsOut},`} ${optionsParamName}?: ContractCallOptions) => Promise<GenericContractCallResult<${typeOut}, ContractCallResult<ChainApi>>>, Type>`;
|
|
44
|
+
}
|
|
45
|
+
generateParamsOut(abiItem) {
|
|
46
|
+
return abiItem.inputs
|
|
47
|
+
.map((input, idx) => `${(0, utils_1.stringCamelCase)(input.name || `arg${idx}`)}: ${this.typesGen.generateType(input, abiItem, 1)}`)
|
|
48
|
+
.join(', ');
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.QueryGen = QueryGen;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TxGen = void 0;
|
|
4
|
+
const utils_js_1 = require("../../utils.js");
|
|
5
|
+
const QueryGen_js_1 = require("./QueryGen.js");
|
|
6
|
+
class TxGen extends QueryGen_js_1.QueryGen {
|
|
7
|
+
generate(useSubPaths = false) {
|
|
8
|
+
this.typesGen.clearCache();
|
|
9
|
+
this.typesGen.typeImports.addKnownType('GenericSubstrateApi');
|
|
10
|
+
this.typesGen.typeImports.addContractType('GenericContractTx', 'GenericContractTxCall', 'ContractTxOptions', 'ContractSubmittableExtrinsic', 'MetadataType');
|
|
11
|
+
const txFunctions = this.abi.filter((item) => item.type === 'function' && item.stateMutability !== 'view');
|
|
12
|
+
const txCallsOut = this.doGenerate(txFunctions, 'ContractTxOptions');
|
|
13
|
+
const importTypes = this.typesGen.typeImports.toImports({ useSubPaths });
|
|
14
|
+
const template = (0, utils_js_1.compileTemplate)('sol/templates/tx.hbs');
|
|
15
|
+
return (0, utils_js_1.beautifySourceCode)(template({ importTypes, txCallsOut }));
|
|
16
|
+
}
|
|
17
|
+
generateMethodDef(abiItem, optionsParamName = 'options') {
|
|
18
|
+
const paramsOut = this.generateParamsOut(abiItem);
|
|
19
|
+
return `GenericContractTxCall<ChainApi, (${paramsOut && `${paramsOut},`} ${optionsParamName}?: ContractTxOptions) => ContractSubmittableExtrinsic<ChainApi>, Type>`;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.TxGen = TxGen;
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TypesGen = exports.BASIC_KNOWN_TYPES = exports.SUPPORTED_SOLIDITY_TYPES = void 0;
|
|
4
|
+
const utils_1 = require("@dedot/utils");
|
|
5
|
+
const TypeImports_js_1 = require("../../shared/TypeImports.js");
|
|
6
|
+
const utils_js_1 = require("../../utils.js");
|
|
7
|
+
const INT_TYPES = /^int(\d+)?(\[(\d+)?])*?$/;
|
|
8
|
+
const UINT_TYPES = /^uint(\d+)?(\[(\d+)?])*?$/;
|
|
9
|
+
const BYTES_TYPES = /^bytes(\d+)?(\[(\d+)?])*?$/;
|
|
10
|
+
const FIXED_TYPES = /^fixed(\d+x\d+)?(\[(\d+)?])*?$/;
|
|
11
|
+
const UNFIXED_TYPES = /^ufixed(\d+x\d+)?(\[(\d+)?])*?$/;
|
|
12
|
+
const STRING_TYPES = /^string(\[(\d+)?])*?$/;
|
|
13
|
+
const BOOL_TYPES = /^bool(\[(\d+)?])*?$/;
|
|
14
|
+
const ADDRESS_TYPES = /^address(\[(\d+)?])*?$/;
|
|
15
|
+
const FUNCTION_TYPES = /^function(\[(\d+)?])*?$/;
|
|
16
|
+
const COMPONENT_TYPES = /^tuple(\[(\d+)?])*?$/;
|
|
17
|
+
const ARRAY_DIM = /\[(\d+)?]/g;
|
|
18
|
+
const ONLY_ARRAY_DIM = /^\[(\d+)?]$/;
|
|
19
|
+
exports.SUPPORTED_SOLIDITY_TYPES = [
|
|
20
|
+
INT_TYPES,
|
|
21
|
+
UINT_TYPES,
|
|
22
|
+
BYTES_TYPES,
|
|
23
|
+
FIXED_TYPES,
|
|
24
|
+
UNFIXED_TYPES,
|
|
25
|
+
STRING_TYPES,
|
|
26
|
+
BOOL_TYPES,
|
|
27
|
+
ADDRESS_TYPES,
|
|
28
|
+
FUNCTION_TYPES,
|
|
29
|
+
COMPONENT_TYPES,
|
|
30
|
+
];
|
|
31
|
+
exports.BASIC_KNOWN_TYPES = [
|
|
32
|
+
/^(H160)$/,
|
|
33
|
+
/^(FixedBytes)<(\d+)>$/,
|
|
34
|
+
/^(Bytes)$/,
|
|
35
|
+
/^(BytesLike)$/,
|
|
36
|
+
/^(Fixed)<(\d+),(\d+)>$/,
|
|
37
|
+
/^(UFixed)<(\d+),(\d+)>$/,
|
|
38
|
+
/^(FixedArray)$/,
|
|
39
|
+
];
|
|
40
|
+
class TypesGen {
|
|
41
|
+
abi;
|
|
42
|
+
typeImports;
|
|
43
|
+
constructor(abi) {
|
|
44
|
+
this.abi = abi;
|
|
45
|
+
this.typeImports = new TypeImports_js_1.TypeImports();
|
|
46
|
+
}
|
|
47
|
+
generate(useSubPaths = false) {
|
|
48
|
+
let defTypeOut = '';
|
|
49
|
+
this.abi.forEach((abiItem) => {
|
|
50
|
+
if (abiItem.type === 'fallback' || abiItem.type === 'receive')
|
|
51
|
+
return;
|
|
52
|
+
if (abiItem.type === 'function' || abiItem.type === 'constructor' || abiItem.type === 'event') {
|
|
53
|
+
const { inputs } = abiItem;
|
|
54
|
+
inputs
|
|
55
|
+
.filter((o) => o.components && o.components.length > 0)
|
|
56
|
+
.forEach((o) => {
|
|
57
|
+
defTypeOut += `export type ${this.generateTypeName(o, abiItem)} = ${this.generateType(o, abiItem, 0)};\n\n`;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
if (abiItem.type === 'function') {
|
|
61
|
+
const { outputs } = abiItem;
|
|
62
|
+
outputs
|
|
63
|
+
.filter((o) => o.components && o.components.length > 0)
|
|
64
|
+
.forEach((o) => {
|
|
65
|
+
defTypeOut += `export type ${this.generateTypeName(o, abiItem, true)} = ${this.generateType(o, abiItem, 0, true)};\n\n`;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
const importTypes = this.typeImports.toImports({ excludeModules: ['./types.js'], useSubPaths });
|
|
70
|
+
const template = (0, utils_js_1.compileTemplate)('sol/templates/types.hbs');
|
|
71
|
+
return (0, utils_js_1.beautifySourceCode)(template({ importTypes, defTypeOut }));
|
|
72
|
+
}
|
|
73
|
+
generateTypeName(typeDef, abiItem, typeOut = false) {
|
|
74
|
+
if (abiItem.type === 'fallback' || abiItem.type === 'receive')
|
|
75
|
+
return '';
|
|
76
|
+
if (COMPONENT_TYPES.test(typeDef.type)) {
|
|
77
|
+
const baseName = abiItem.type === 'constructor'
|
|
78
|
+
? `${typeDef.name}_input`
|
|
79
|
+
: `${abiItem.name}_${typeDef.name}_${typeOut ? 'output' : 'input'}`;
|
|
80
|
+
return (0, utils_1.stringPascalCase)(baseName);
|
|
81
|
+
}
|
|
82
|
+
return '';
|
|
83
|
+
}
|
|
84
|
+
generateType(typeDef, abiItem, nestedLevel = 0, typeOut = false) {
|
|
85
|
+
if (nestedLevel > 0 && abiItem) {
|
|
86
|
+
let typeName = this.generateTypeName(typeDef, abiItem, typeOut);
|
|
87
|
+
if (typeName.length === 0) {
|
|
88
|
+
typeName = this.#generateType(typeDef, nestedLevel, typeOut);
|
|
89
|
+
return typeName;
|
|
90
|
+
}
|
|
91
|
+
this.addTypeImport(typeName);
|
|
92
|
+
return typeName;
|
|
93
|
+
}
|
|
94
|
+
return this.#generateType(typeDef, nestedLevel, typeOut);
|
|
95
|
+
}
|
|
96
|
+
#generateType(typeDef, nestedLevel = 0, typeOut = false) {
|
|
97
|
+
const { type } = typeDef;
|
|
98
|
+
let baseType = this.#generateBaseType(typeDef, nestedLevel, typeOut);
|
|
99
|
+
if (!COMPONENT_TYPES.test(type)) {
|
|
100
|
+
// baseType of component types are all generated types, eg: { a: bigint, b: string }
|
|
101
|
+
// So we don't import them here.
|
|
102
|
+
this.addTypeImport(baseType);
|
|
103
|
+
}
|
|
104
|
+
// Match all array dimensions
|
|
105
|
+
const dimensions = type.match(ARRAY_DIM);
|
|
106
|
+
dimensions
|
|
107
|
+
// Match each dimension to see if fixed array or dynamic array (eg: [3] vs [])
|
|
108
|
+
?.map((o) => o.match(ONLY_ARRAY_DIM))
|
|
109
|
+
.forEach(([_, n]) => {
|
|
110
|
+
if (n) {
|
|
111
|
+
this.addTypeImport('FixedArray');
|
|
112
|
+
baseType = `FixedArray<${baseType}, ${n}>`;
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
baseType = (0, utils_js_1.isNativeType)(baseType.replaceAll('[]', '')) ? `${baseType}[]` : `Array<${baseType}>`;
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
return baseType;
|
|
119
|
+
}
|
|
120
|
+
#generateBaseType(typeDef, nestedLevel = 0, typeOut = false) {
|
|
121
|
+
const { type } = typeDef;
|
|
122
|
+
if (INT_TYPES.test(type)) {
|
|
123
|
+
const [_, bitsStr] = type.match(INT_TYPES);
|
|
124
|
+
// Default to 256 when unspecified
|
|
125
|
+
const bits = bitsStr ? parseInt(bitsStr) : 256;
|
|
126
|
+
const isSafeNumber = bits <= 48;
|
|
127
|
+
return isSafeNumber ? `number` : 'bigint';
|
|
128
|
+
}
|
|
129
|
+
else if (UINT_TYPES.test(type)) {
|
|
130
|
+
const [_, bitsStr] = type.match(UINT_TYPES);
|
|
131
|
+
// Default to 256 when unspecified
|
|
132
|
+
const bits = bitsStr ? parseInt(bitsStr) : 256;
|
|
133
|
+
const isSafeNumber = bits <= 48;
|
|
134
|
+
return isSafeNumber ? `number` : 'bigint';
|
|
135
|
+
}
|
|
136
|
+
else if (BYTES_TYPES.test(type)) {
|
|
137
|
+
const [_, n] = type.match(BYTES_TYPES);
|
|
138
|
+
if (n) {
|
|
139
|
+
return `FixedBytes<${n}>`;
|
|
140
|
+
}
|
|
141
|
+
if (typeOut) {
|
|
142
|
+
return `Bytes`;
|
|
143
|
+
}
|
|
144
|
+
return `BytesLike`;
|
|
145
|
+
}
|
|
146
|
+
else if (BOOL_TYPES.test(type)) {
|
|
147
|
+
return 'boolean';
|
|
148
|
+
}
|
|
149
|
+
else if (STRING_TYPES.test(type)) {
|
|
150
|
+
return 'string';
|
|
151
|
+
}
|
|
152
|
+
else if (COMPONENT_TYPES.test(type)) {
|
|
153
|
+
const { components = [] } = typeDef;
|
|
154
|
+
if (components.length === 0) {
|
|
155
|
+
return '[]';
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
const objectType = this.generateObjectType(components, nestedLevel + 1, typeOut);
|
|
159
|
+
return `${objectType}`;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
else if (ADDRESS_TYPES.test(type)) {
|
|
163
|
+
return `H160`;
|
|
164
|
+
}
|
|
165
|
+
else if (FUNCTION_TYPES.test(type)) {
|
|
166
|
+
// Function type is an address (20 bytes) followed by a function selector (4 bytes).
|
|
167
|
+
// Ref: https://docs.soliditylang.org/en/latest/abi-spec.html#:~:text=function%3A%20an%20address%20(20%20bytes)%20followed%20by%20a%20function%20selector%20(4%20bytes).%20Encoded%20identical%20to%20bytes24.
|
|
168
|
+
return `FixedBytes<24>`;
|
|
169
|
+
}
|
|
170
|
+
else if (FIXED_TYPES.test(type)) {
|
|
171
|
+
const [_, denotation] = type.match(FIXED_TYPES);
|
|
172
|
+
// Ref: https://docs.soliditylang.org/en/latest/abi-spec.html#:~:text=fixed%2C%20ufixed%3A%20synonyms%20for%20fixed128x18%2C%20ufixed128x18%20respectively.%20For%20computing%20the%20function%20selector%2C%20fixed128x18%20and%20ufixed128x18%20have%20to%20be%20used.
|
|
173
|
+
const [m, n] = denotation ? denotation.split('x').map((s) => parseInt(s)) : [128, 18];
|
|
174
|
+
return `Fixed<${m},${n}>`;
|
|
175
|
+
}
|
|
176
|
+
else if (UNFIXED_TYPES.test(type)) {
|
|
177
|
+
const [_, denotation] = type.match(UNFIXED_TYPES);
|
|
178
|
+
// Ref: https://docs.soliditylang.org/en/latest/abi-spec.html#:~:text=fixed%2C%20ufixed%3A%20synonyms%20for%20fixed128x18%2C%20ufixed128x18%20respectively.%20For%20computing%20the%20function%20selector%2C%20fixed128x18%20and%20ufixed128x18%20have%20to%20be%20used.
|
|
179
|
+
const [m, n] = denotation ? denotation.split('x').map((s) => parseInt(s)) : [128, 18];
|
|
180
|
+
return `UFixed<${m},${n}>`;
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
throw new Error(`Unsupported Solidity type: ${type}`);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
generateObjectType(components, nestedLevel = 0, typeOut = false) {
|
|
187
|
+
const props = components.map((typeDef) => {
|
|
188
|
+
const type = this.generateType(typeDef, undefined, nestedLevel + 1, typeOut);
|
|
189
|
+
return {
|
|
190
|
+
name: typeDef.name,
|
|
191
|
+
type,
|
|
192
|
+
};
|
|
193
|
+
});
|
|
194
|
+
if (props.length > 0 && props.at(0).name.length === 0) {
|
|
195
|
+
return `[${props.map(({ type }) => `${type}`).join(', ')}]`;
|
|
196
|
+
}
|
|
197
|
+
return `{${props.map(({ name, type }) => `${name}: ${type}`).join(',\n')}}`;
|
|
198
|
+
}
|
|
199
|
+
addTypeImport(typeName) {
|
|
200
|
+
if (Array.isArray(typeName)) {
|
|
201
|
+
typeName.forEach((one) => this.addTypeImport(one));
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
if ((0, utils_js_1.isNativeType)(typeName)) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
const re = exports.BASIC_KNOWN_TYPES.find((re) => typeName.match(re));
|
|
208
|
+
if (re) {
|
|
209
|
+
const typeBase = typeName.match(re)[1];
|
|
210
|
+
this.typeImports.addCodecType(typeBase);
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
this.typeImports.addPortableType(typeName);
|
|
214
|
+
}
|
|
215
|
+
clearCache() {
|
|
216
|
+
this.typeImports.clear();
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
exports.TypesGen = TypesGen;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./IndexGen.js"), exports);
|
|
18
|
+
__exportStar(require("./QueryGen.js"), exports);
|
|
19
|
+
__exportStar(require("./TypesGen.js"), exports);
|
|
20
|
+
__exportStar(require("./TxGen.js"), exports);
|
|
21
|
+
__exportStar(require("./ConstructorTxGen.js"), exports);
|
|
22
|
+
__exportStar(require("./ConstructorQueryGen.js"), exports);
|
|
23
|
+
__exportStar(require("./EventsGen.js"), exports);
|
package/cjs/sol/index.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.generateSolContractTypes = void 0;
|
|
7
|
+
const utils_1 = require("@dedot/utils");
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const index_js_1 = require("./generator/index.js");
|
|
11
|
+
async function generateSolContractTypes(abi, contract = 'contract', outDir = '.', extension = 'd.ts', useSubPaths = false) {
|
|
12
|
+
let abiItems = typeof abi === 'string' ? JSON.parse(abi) : abi;
|
|
13
|
+
const contractName = contract;
|
|
14
|
+
const dirPath = path_1.default.resolve(outDir, (0, utils_1.stringDashCase)(contractName));
|
|
15
|
+
const typesFileName = path_1.default.join(dirPath, `types.${extension}`);
|
|
16
|
+
const queryTypesFileName = path_1.default.join(dirPath, `query.${extension}`);
|
|
17
|
+
const eventsTypesFileName = path_1.default.join(dirPath, `events.${extension}`);
|
|
18
|
+
const txTypesFileName = path_1.default.join(dirPath, `tx.${extension}`);
|
|
19
|
+
const constructorTxTypesFileName = path_1.default.join(dirPath, `constructor-tx.${extension}`);
|
|
20
|
+
const constructorQueryTypesFileName = path_1.default.join(dirPath, `constructor-query.${extension}`);
|
|
21
|
+
const indexTypesFileName = path_1.default.join(dirPath, `index.${extension}`);
|
|
22
|
+
if (!fs_1.default.existsSync(dirPath)) {
|
|
23
|
+
fs_1.default.mkdirSync(dirPath, { recursive: true });
|
|
24
|
+
}
|
|
25
|
+
const interfaceName = `${(0, utils_1.stringPascalCase)(`${contractName}`)}ContractApi`;
|
|
26
|
+
const typesGen = new index_js_1.TypesGen(abiItems);
|
|
27
|
+
const queryGen = new index_js_1.QueryGen(abiItems, typesGen);
|
|
28
|
+
const eventsGen = new index_js_1.EventsGen(abiItems, typesGen);
|
|
29
|
+
const txGen = new index_js_1.TxGen(abiItems, typesGen);
|
|
30
|
+
const constructorTxGen = new index_js_1.ConstructorTxGen(abiItems, typesGen);
|
|
31
|
+
const constructorQueryGen = new index_js_1.ConstructorQueryGen(abiItems, typesGen);
|
|
32
|
+
const indexGen = new index_js_1.IndexGen(interfaceName, typesGen);
|
|
33
|
+
fs_1.default.writeFileSync(typesFileName, await typesGen.generate(useSubPaths));
|
|
34
|
+
fs_1.default.writeFileSync(queryTypesFileName, await queryGen.generate(useSubPaths));
|
|
35
|
+
fs_1.default.writeFileSync(eventsTypesFileName, await eventsGen.generate(useSubPaths));
|
|
36
|
+
fs_1.default.writeFileSync(txTypesFileName, await txGen.generate(useSubPaths));
|
|
37
|
+
fs_1.default.writeFileSync(constructorQueryTypesFileName, await constructorQueryGen.generate(useSubPaths));
|
|
38
|
+
fs_1.default.writeFileSync(constructorTxTypesFileName, await constructorTxGen.generate(useSubPaths));
|
|
39
|
+
fs_1.default.writeFileSync(indexTypesFileName, await indexGen.generate(useSubPaths));
|
|
40
|
+
return { interfaceName, outputFolder: dirPath };
|
|
41
|
+
}
|
|
42
|
+
exports.generateSolContractTypes = generateSolContractTypes;
|
|
@@ -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
|
+
}
|
|
@@ -7,7 +7,7 @@ class ConstructorQueryGen 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('GenericConstructorQuery', 'GenericConstructorQueryCall', 'GenericConstructorCallResult', 'ConstructorCallOptions', 'ContractInstantiateResult');
|
|
10
|
+
this.typesGen.typeImports.addContractType('GenericConstructorQuery', 'GenericConstructorQueryCall', 'GenericConstructorCallResult', 'ConstructorCallOptions', 'ContractInstantiateResult', 'MetadataType');
|
|
11
11
|
const { constructors } = this.contractMetadata.spec;
|
|
12
12
|
const constructorsOut = this.doGenerate(constructors, 'ConstructorCallOptions');
|
|
13
13
|
const importTypes = this.typesGen.typeImports.toImports({ useSubPaths });
|
|
@@ -20,7 +20,7 @@ class ConstructorQueryGen extends QueryGen_js_1.QueryGen {
|
|
|
20
20
|
const typeOutRaw = this.typesGen.generateType(returnType.type, 0, true);
|
|
21
21
|
// Unwrap langError result
|
|
22
22
|
const typeOut = typeOutRaw.match(/^(\w+)<(.*), (.*)>$/).at(2);
|
|
23
|
-
return `GenericConstructorQueryCall<ChainApi, (${paramsOut && `${paramsOut},`} ${optionsParamName}?: ConstructorCallOptions) => Promise<GenericConstructorCallResult<${typeOut}, ContractInstantiateResult<ChainApi
|
|
23
|
+
return `GenericConstructorQueryCall<ChainApi, (${paramsOut && `${paramsOut},`} ${optionsParamName}?: ConstructorCallOptions) => Promise<GenericConstructorCallResult<${typeOut}, ContractInstantiateResult<ChainApi>>>, Type>`;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
exports.ConstructorQueryGen = ConstructorQueryGen;
|
|
@@ -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', '
|
|
10
|
+
this.typesGen.typeImports.addContractType('GenericConstructorTx', 'GenericConstructorTxCall', 'ConstructorTxOptions', 'InkGenericContractApi', 'GenericInstantiateSubmittableExtrinsic', 'MetadataType');
|
|
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}?: ConstructorTxOptions) => GenericInstantiateSubmittableExtrinsic<ChainApi, ContractApi
|
|
19
|
+
return `GenericConstructorTxCall<ChainApi, (${paramsOut && `${paramsOut},`} ${optionsParamName}?: ConstructorTxOptions) => GenericInstantiateSubmittableExtrinsic<ChainApi, ContractApi>, Type>`;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
exports.ConstructorTxGen = ConstructorTxGen;
|
|
@@ -8,7 +8,7 @@ class EventsGen extends QueryGen_js_1.QueryGen {
|
|
|
8
8
|
generate(useSubPaths = false) {
|
|
9
9
|
this.typesGen.clearCache();
|
|
10
10
|
this.typesGen.typeImports.addKnownType('GenericSubstrateApi');
|
|
11
|
-
this.typesGen.typeImports.addContractType('GenericContractEvents', 'GenericContractEvent');
|
|
11
|
+
this.typesGen.typeImports.addContractType('GenericContractEvents', 'GenericContractEvent', 'MetadataType');
|
|
12
12
|
const { events } = this.contractMetadata.spec;
|
|
13
13
|
let eventsOut = '';
|
|
14
14
|
const isV5 = this.contractMetadata.version === 5;
|
|
@@ -24,7 +24,7 @@ class EventsGen extends QueryGen_js_1.QueryGen {
|
|
|
24
24
|
#generateEventDef(event) {
|
|
25
25
|
const { args, label } = event;
|
|
26
26
|
const paramsOut = this.generateParamsOut(args);
|
|
27
|
-
return `GenericContractEvent<'${(0, utils_1.stringPascalCase)(label)}', {${paramsOut}}>`;
|
|
27
|
+
return `GenericContractEvent<'${(0, utils_1.stringPascalCase)(label)}', {${paramsOut}}, Type>`;
|
|
28
28
|
}
|
|
29
29
|
generateParamsOut(args) {
|
|
30
30
|
return args
|