@dedot/codegen 0.0.1-alpha.4 → 0.0.1-alpha.40
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 +15 -15
- package/chaintypes/generator/ConstsGen.d.ts +4 -0
- package/{generator → chaintypes/generator}/ConstsGen.js +8 -9
- package/chaintypes/generator/ErrorsGen.d.ts +5 -0
- package/{generator → chaintypes/generator}/ErrorsGen.js +11 -12
- package/chaintypes/generator/EventsGen.d.ts +5 -0
- package/{generator → chaintypes/generator}/EventsGen.js +11 -12
- package/chaintypes/generator/IndexGen.d.ts +5 -0
- package/chaintypes/generator/IndexGen.js +17 -0
- package/chaintypes/generator/JsonRpcGen.d.ts +8 -0
- package/chaintypes/generator/JsonRpcGen.js +55 -0
- package/chaintypes/generator/QueryGen.d.ts +5 -0
- package/chaintypes/generator/QueryGen.js +63 -0
- package/chaintypes/generator/RuntimeApisGen.d.ts +9 -0
- package/chaintypes/generator/RuntimeApisGen.js +189 -0
- package/chaintypes/generator/TxGen.d.ts +5 -0
- package/{generator → chaintypes/generator}/TxGen.js +18 -16
- package/chaintypes/generator/TypesGen.d.ts +11 -0
- package/chaintypes/generator/TypesGen.js +55 -0
- package/chaintypes/generator/index.d.ts +10 -0
- package/chaintypes/generator/index.js +10 -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/chaintypes/templates/types.hbs +5 -0
- package/cjs/{generator → chaintypes/generator}/ConstsGen.js +12 -13
- package/cjs/chaintypes/generator/ErrorsGen.js +40 -0
- package/cjs/{generator → chaintypes/generator}/EventsGen.js +17 -18
- package/cjs/chaintypes/generator/IndexGen.js +21 -0
- package/cjs/chaintypes/generator/JsonRpcGen.js +59 -0
- package/cjs/chaintypes/generator/QueryGen.js +67 -0
- package/cjs/chaintypes/generator/RuntimeApisGen.js +193 -0
- package/cjs/{generator → chaintypes/generator}/TxGen.js +27 -25
- package/cjs/chaintypes/generator/TypesGen.js +59 -0
- package/cjs/chaintypes/generator/index.js +26 -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/chaintypes/templates/types.hbs +5 -0
- package/cjs/{types.js → dirname.js} +3 -0
- package/cjs/index.js +4 -62
- package/cjs/{generator/TypesGen.js → shared/BaseTypesGen.js} +123 -177
- package/cjs/{generator → shared}/TypeImports.js +29 -3
- package/cjs/{generator → shared}/index.js +3 -10
- package/cjs/shared/known-codecs.js +170 -0
- package/cjs/typink/generator/ConstructorQueryGen.js +24 -0
- package/cjs/typink/generator/ConstructorTxGen.js +24 -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 +22 -0
- package/cjs/typink/index.js +37 -0
- package/cjs/typink/templates/constructor-query.hbs +7 -0
- package/cjs/typink/templates/constructor-tx.hbs +7 -0
- package/cjs/typink/templates/index.hbs +14 -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} +35 -11
- package/dirname.d.ts +1 -0
- package/dirname.js +6 -0
- package/index.d.ts +2 -4
- package/index.js +2 -48
- package/package.json +18 -19
- package/{generator/TypesGen.d.ts → shared/BaseTypesGen.d.ts} +13 -12
- package/{generator/TypesGen.js → shared/BaseTypesGen.js} +112 -166
- package/{generator → shared}/TypeImports.d.ts +12 -1
- package/{generator → shared}/TypeImports.js +29 -3
- package/shared/index.d.ts +3 -0
- package/shared/index.js +3 -0
- package/shared/known-codecs.d.ts +23 -0
- package/shared/known-codecs.js +139 -0
- 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/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 +6 -0
- package/typink/generator/index.js +6 -0
- package/typink/index.d.ts +2 -0
- package/typink/index.js +30 -0
- package/typink/templates/constructor-query.hbs +7 -0
- package/typink/templates/constructor-tx.hbs +7 -0
- package/typink/templates/index.hbs +14 -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} +6 -2
- package/{generator/utils.js → utils.js} +33 -9
- package/cjs/genSupportedChainTypes.js +0 -79
- package/cjs/generator/ErrorsGen.js +0 -41
- package/cjs/generator/IndexGen.js +0 -18
- package/cjs/generator/QueryGen.js +0 -59
- package/cjs/generator/RpcGen.js +0 -175
- package/cjs/generator/RuntimeApisGen.js +0 -120
- package/cjs/packageInfo.js +0 -5
- package/genSupportedChainTypes.d.ts +0 -1
- package/genSupportedChainTypes.js +0 -74
- package/generator/ConstsGen.d.ts +0 -4
- package/generator/ErrorsGen.d.ts +0 -5
- package/generator/EventsGen.d.ts +0 -5
- package/generator/IndexGen.d.ts +0 -6
- package/generator/IndexGen.js +0 -14
- package/generator/QueryGen.d.ts +0 -5
- package/generator/QueryGen.js +0 -55
- package/generator/RpcGen.d.ts +0 -10
- package/generator/RpcGen.js +0 -171
- package/generator/RuntimeApisGen.d.ts +0 -9
- package/generator/RuntimeApisGen.js +0 -116
- package/generator/TxGen.d.ts +0 -5
- package/generator/index.d.ts +0 -10
- package/generator/index.js +0 -10
- package/packageInfo.d.ts +0 -4
- package/packageInfo.js +0 -2
- package/types.d.ts +0 -6
- package/types.js +0 -1
- /package/{generator → chaintypes/generator}/ApiGen.js +0 -0
- /package/cjs/{generator → chaintypes/generator}/ApiGen.js +0 -0
|
@@ -0,0 +1,170 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.checkKnownCodecType = exports.findKnownWrapperCodec = exports.findKnownCodec = exports.findKnownCodecType = exports.looseTypeCodecs = exports.normalizeCodecName = void 0;
|
|
27
|
+
const Codecs = __importStar(require("@dedot/codecs"));
|
|
28
|
+
const codecs_1 = require("@dedot/codecs");
|
|
29
|
+
const $ = __importStar(require("@dedot/shape"));
|
|
30
|
+
const utils_1 = require("@dedot/utils");
|
|
31
|
+
const normalizeCodecName = (name) => {
|
|
32
|
+
return name.startsWith('$') ? name : `$${name}`;
|
|
33
|
+
};
|
|
34
|
+
exports.normalizeCodecName = normalizeCodecName;
|
|
35
|
+
// Known paths for codecs (primitives) that are shared between
|
|
36
|
+
// different substrate-based blockchains
|
|
37
|
+
const KNOWN_PATHS = [
|
|
38
|
+
'sp_core::crypto::AccountId32',
|
|
39
|
+
'sp_runtime::generic::era::Era',
|
|
40
|
+
'sp_runtime::multiaddress::MultiAddress',
|
|
41
|
+
/^sp_runtime::DispatchError$/,
|
|
42
|
+
'sp_runtime::ModuleError',
|
|
43
|
+
'sp_runtime::TokenError',
|
|
44
|
+
'sp_arithmetic::ArithmeticError',
|
|
45
|
+
'sp_runtime::TransactionalError',
|
|
46
|
+
'frame_support::dispatch::DispatchInfo',
|
|
47
|
+
'frame_system::Phase',
|
|
48
|
+
'sp_version::RuntimeVersion',
|
|
49
|
+
'fp_account::AccountId20',
|
|
50
|
+
'account::AccountId20',
|
|
51
|
+
'polkadot_runtime_common::claims::EthereumAddress',
|
|
52
|
+
'pallet_identity::types::Data',
|
|
53
|
+
'sp_runtime::generic::digest::Digest',
|
|
54
|
+
'sp_runtime::generic::digest::DigestItem',
|
|
55
|
+
'sp_runtime::generic::header::Header',
|
|
56
|
+
'sp_runtime::generic::unchecked_extrinsic::UncheckedExtrinsic',
|
|
57
|
+
/^primitive_types::\w+$/,
|
|
58
|
+
/^sp_arithmetic::per_things::\w+$/,
|
|
59
|
+
/^sp_arithmetic::fixed_point::\w+$/,
|
|
60
|
+
'ink_primitives::types::Hash',
|
|
61
|
+
{ path: 'ink_primitives::types::AccountId', codec: 'AccountId32' },
|
|
62
|
+
];
|
|
63
|
+
const WRAPPER_TYPE_REGEX = /^(\w+)<(.*)>$/;
|
|
64
|
+
const TUPLE_TYPE_REGEX = /^\[(.*)]$/;
|
|
65
|
+
const KNOWN_WRAPPER_TYPES = ['Option', 'Vec', 'Result', 'Array'];
|
|
66
|
+
/**
|
|
67
|
+
* Collection of codec types with loose input types
|
|
68
|
+
*
|
|
69
|
+
* Loose codecs are codecs with different typeIn & typeOut,
|
|
70
|
+
* E.g: Codec `$AccountId32`, we have its typeIn is `AccountId32Like` & typeOut is `AccountId32`
|
|
71
|
+
*
|
|
72
|
+
* This registry keep track the list of codecs which follow this convention
|
|
73
|
+
*/
|
|
74
|
+
exports.looseTypeCodecs = {
|
|
75
|
+
$AccountId20: codecs_1.$AccountId20,
|
|
76
|
+
$EthereumAddress: codecs_1.$EthereumAddress,
|
|
77
|
+
$AccountId32: codecs_1.$AccountId32,
|
|
78
|
+
$ConsensusEngineId: codecs_1.$ConsensusEngineId,
|
|
79
|
+
$StorageKey: codecs_1.$StorageKey,
|
|
80
|
+
$StorageData: codecs_1.$StorageData,
|
|
81
|
+
$PrefixedStorageKey: codecs_1.$PrefixedStorageKey,
|
|
82
|
+
$Bytes: codecs_1.$Bytes,
|
|
83
|
+
$RawBytes: codecs_1.$RawBytes,
|
|
84
|
+
$MultiAddress: codecs_1.$MultiAddress,
|
|
85
|
+
$OpaqueExtrinsic: codecs_1.$OpaqueExtrinsic,
|
|
86
|
+
$UncheckedExtrinsic: codecs_1.$UncheckedExtrinsic,
|
|
87
|
+
$Era: codecs_1.$Era,
|
|
88
|
+
};
|
|
89
|
+
function findKnownCodecType(name) {
|
|
90
|
+
const normalizedName = (0, exports.normalizeCodecName)(name);
|
|
91
|
+
const $knownCodec = exports.looseTypeCodecs[normalizedName];
|
|
92
|
+
if ($knownCodec) {
|
|
93
|
+
return {
|
|
94
|
+
name: normalizedName,
|
|
95
|
+
$codec: $knownCodec,
|
|
96
|
+
typeIn: `${name}Like`,
|
|
97
|
+
typeOut: name,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
const $codec = findKnownCodec(name);
|
|
101
|
+
if ($codec.nativeType && $[name]) {
|
|
102
|
+
return {
|
|
103
|
+
name: normalizedName,
|
|
104
|
+
$codec,
|
|
105
|
+
typeIn: $codec.nativeType,
|
|
106
|
+
typeOut: $codec.nativeType,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
name: normalizedName,
|
|
111
|
+
$codec,
|
|
112
|
+
typeIn: name,
|
|
113
|
+
typeOut: name,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
exports.findKnownCodecType = findKnownCodecType;
|
|
117
|
+
function findKnownCodec(typeName) {
|
|
118
|
+
// @ts-ignore
|
|
119
|
+
const $codec = findKnownWrapperCodec(typeName) || Codecs[(0, exports.normalizeCodecName)(typeName)] || $[typeName];
|
|
120
|
+
(0, utils_1.assert)($codec, `Known codec not found - ${typeName}`);
|
|
121
|
+
return $codec;
|
|
122
|
+
}
|
|
123
|
+
exports.findKnownCodec = findKnownCodec;
|
|
124
|
+
function findKnownWrapperCodec(typeName) {
|
|
125
|
+
const matchNames = typeName.match(WRAPPER_TYPE_REGEX);
|
|
126
|
+
if (matchNames) {
|
|
127
|
+
const [_, wrapper, inner] = matchNames;
|
|
128
|
+
if (KNOWN_WRAPPER_TYPES.includes(wrapper)) {
|
|
129
|
+
// @ts-ignore
|
|
130
|
+
const $Wrapper = $[wrapper];
|
|
131
|
+
if (inner.match(TUPLE_TYPE_REGEX) || inner.match(WRAPPER_TYPE_REGEX)) {
|
|
132
|
+
return $Wrapper(findKnownWrapperCodec(inner));
|
|
133
|
+
}
|
|
134
|
+
const $inners = inner.split(',').map((one) => findKnownCodec(one.trim()));
|
|
135
|
+
return $Wrapper(...$inners);
|
|
136
|
+
}
|
|
137
|
+
throw new Error(`Unknown wrapper type ${wrapper} from ${typeName}`);
|
|
138
|
+
}
|
|
139
|
+
else if (typeName.match(TUPLE_TYPE_REGEX)) {
|
|
140
|
+
const $inner = typeName
|
|
141
|
+
.slice(1, -1)
|
|
142
|
+
.split(',')
|
|
143
|
+
.filter((x) => x)
|
|
144
|
+
.map((one) => findKnownCodec(one.trim()));
|
|
145
|
+
return $.Tuple(...$inner);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
exports.findKnownWrapperCodec = findKnownWrapperCodec;
|
|
149
|
+
function checkKnownCodecType(path) {
|
|
150
|
+
const joinedPath = Array.isArray(path) ? path.join('::') : path;
|
|
151
|
+
const knownPath = KNOWN_PATHS.find((one) => {
|
|
152
|
+
if (typeof one === 'string') {
|
|
153
|
+
return one === joinedPath;
|
|
154
|
+
}
|
|
155
|
+
else if (one instanceof RegExp) {
|
|
156
|
+
return one.test(joinedPath);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
return one.path === joinedPath;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
if (!knownPath) {
|
|
163
|
+
return [false, ''];
|
|
164
|
+
}
|
|
165
|
+
if (typeof knownPath === 'string' || knownPath instanceof RegExp) {
|
|
166
|
+
return [true, joinedPath.split('::').at(-1)];
|
|
167
|
+
}
|
|
168
|
+
return [true, knownPath.codec];
|
|
169
|
+
}
|
|
170
|
+
exports.checkKnownCodecType = checkKnownCodecType;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConstructorQueryGen = void 0;
|
|
4
|
+
const utils_js_1 = require("../../utils.js");
|
|
5
|
+
const QueryGen_js_1 = require("./QueryGen.js");
|
|
6
|
+
class ConstructorQueryGen extends QueryGen_js_1.QueryGen {
|
|
7
|
+
generate(useSubPaths = false) {
|
|
8
|
+
this.typesGen.clearCache();
|
|
9
|
+
this.typesGen.typeImports.addKnownType('GenericSubstrateApi');
|
|
10
|
+
this.typesGen.typeImports.addContractType('GenericConstructorQuery', 'GenericConstructorQueryCall', 'ConstructorCallOptions', 'ContractInstantiateResult');
|
|
11
|
+
const { constructors } = this.contractMetadata.spec;
|
|
12
|
+
const constructorsOut = this.doGenerate(constructors, 'ConstructorCallOptions');
|
|
13
|
+
const importTypes = this.typesGen.typeImports.toImports({ useSubPaths });
|
|
14
|
+
const template = (0, utils_js_1.compileTemplate)('typink/templates/constructor-query.hbs');
|
|
15
|
+
return (0, utils_js_1.beautifySourceCode)(template({ importTypes, constructorsOut }));
|
|
16
|
+
}
|
|
17
|
+
generateMethodDef(def) {
|
|
18
|
+
const { args } = def;
|
|
19
|
+
args.forEach(({ type: { type } }) => this.importType(type));
|
|
20
|
+
const paramsOut = this.generateParamsOut(args);
|
|
21
|
+
return `GenericConstructorQueryCall<ChainApi, (${paramsOut && `${paramsOut},`} options: ConstructorCallOptions) => Promise<ContractInstantiateResult<ChainApi>>>`;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.ConstructorQueryGen = ConstructorQueryGen;
|
|
@@ -0,0 +1,24 @@
|
|
|
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 QueryGen_js_1 = require("./QueryGen.js");
|
|
6
|
+
class ConstructorTxGen extends QueryGen_js_1.QueryGen {
|
|
7
|
+
generate(useSubPaths = false) {
|
|
8
|
+
this.typesGen.clearCache();
|
|
9
|
+
this.typesGen.typeImports.addKnownType('GenericSubstrateApi');
|
|
10
|
+
this.typesGen.typeImports.addContractType('GenericConstructorTx', 'GenericConstructorTxCall', 'ConstructorTxOptions', 'GenericInstantiateSubmittableExtrinsic');
|
|
11
|
+
const { constructors } = this.contractMetadata.spec;
|
|
12
|
+
const constructorsOut = this.doGenerate(constructors, 'ConstructorTxOptions');
|
|
13
|
+
const importTypes = this.typesGen.typeImports.toImports({ useSubPaths });
|
|
14
|
+
const template = (0, utils_js_1.compileTemplate)('typink/templates/constructor-tx.hbs');
|
|
15
|
+
return (0, utils_js_1.beautifySourceCode)(template({ importTypes, constructorsOut }));
|
|
16
|
+
}
|
|
17
|
+
generateMethodDef(def) {
|
|
18
|
+
const { args } = def;
|
|
19
|
+
args.forEach(({ type: { type } }) => this.importType(type));
|
|
20
|
+
const paramsOut = this.generateParamsOut(args);
|
|
21
|
+
return `GenericConstructorTxCall<ChainApi, (${paramsOut && `${paramsOut},`} options: ConstructorTxOptions) => GenericInstantiateSubmittableExtrinsic<ChainApi>>`;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.ConstructorTxGen = ConstructorTxGen;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IndexGen = void 0;
|
|
4
|
+
const utils_1 = require("@dedot/utils");
|
|
5
|
+
const index_js_1 = require("../../shared/index.js");
|
|
6
|
+
const utils_js_1 = require("../../utils.js");
|
|
7
|
+
const SUFFIX = 'contract_api';
|
|
8
|
+
class IndexGen {
|
|
9
|
+
contractMetadata;
|
|
10
|
+
constructor(contractMetadata) {
|
|
11
|
+
this.contractMetadata = contractMetadata;
|
|
12
|
+
}
|
|
13
|
+
generate(useSubPaths = false) {
|
|
14
|
+
const contractName = (0, utils_1.stringPascalCase)(`${this.contractMetadata.contract.name}_${SUFFIX}`);
|
|
15
|
+
const typeImports = new index_js_1.TypeImports();
|
|
16
|
+
typeImports.addKnownType('VersionedGenericSubstrateApi', 'RpcVersion', 'RpcV2');
|
|
17
|
+
typeImports.addContractType('GenericContractApi');
|
|
18
|
+
typeImports.addChainType('SubstrateApi');
|
|
19
|
+
const importTypes = typeImports.toImports({ useSubPaths });
|
|
20
|
+
const template = (0, utils_js_1.compileTemplate)('typink/templates/index.hbs');
|
|
21
|
+
return (0, utils_js_1.beautifySourceCode)(template({ contractName, importTypes }));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.IndexGen = IndexGen;
|
|
@@ -0,0 +1,72 @@
|
|
|
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
|
+
contractMetadata;
|
|
9
|
+
typesGen;
|
|
10
|
+
constructor(contractMetadata, typeGen) {
|
|
11
|
+
this.contractMetadata = contractMetadata;
|
|
12
|
+
this.typesGen = typeGen;
|
|
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');
|
|
18
|
+
const { messages } = this.contractMetadata.spec;
|
|
19
|
+
const queryCallsOut = this.doGenerate(messages, 'ContractCallOptions');
|
|
20
|
+
const importTypes = this.typesGen.typeImports.toImports({ useSubPaths });
|
|
21
|
+
const template = (0, utils_js_1.compileTemplate)('typink/templates/query.hbs');
|
|
22
|
+
return (0, utils_js_1.beautifySourceCode)(template({ importTypes, queryCallsOut }));
|
|
23
|
+
}
|
|
24
|
+
doGenerate(messages, optionsTypeName) {
|
|
25
|
+
let callsOut = '';
|
|
26
|
+
messages.forEach((messageDef) => {
|
|
27
|
+
const { label, docs, selector, args } = messageDef;
|
|
28
|
+
callsOut += `${(0, utils_js_1.commentBlock)(docs, '\n', args.map((arg) => `@param {${this.typesGen.generateType(arg.type.type, 1)}} ${(0, utils_1.stringCamelCase)(arg.label)}`), optionsTypeName ? `@param {${optionsTypeName}} options` : '', '\n', `@selector ${selector}`)}`;
|
|
29
|
+
callsOut += `${(0, contracts_1.normalizeLabel)(label)}: ${this.generateMethodDef(messageDef)};\n\n`;
|
|
30
|
+
});
|
|
31
|
+
return callsOut;
|
|
32
|
+
}
|
|
33
|
+
generateMethodDef(def) {
|
|
34
|
+
const { args, returnType } = def;
|
|
35
|
+
this.importType(returnType.type);
|
|
36
|
+
args.forEach(({ type: { type } }) => this.importType(type));
|
|
37
|
+
const paramsOut = this.generateParamsOut(args);
|
|
38
|
+
const typeOut = this.typesGen.generateType(returnType.type, 0, true);
|
|
39
|
+
return `GenericContractQueryCall<ChainApi, (${paramsOut && `${paramsOut},`} options: ContractCallOptions) => Promise<GenericContractCallResult<${typeOut}, ContractCallResult<ChainApi>>>>`;
|
|
40
|
+
}
|
|
41
|
+
generateParamsOut(args) {
|
|
42
|
+
return args
|
|
43
|
+
.map(({ type: { type }, label }) => `${(0, utils_1.stringCamelCase)(label)}: ${this.typesGen.generateType(type, 1)}`)
|
|
44
|
+
.join(', ');
|
|
45
|
+
}
|
|
46
|
+
importType(typeId) {
|
|
47
|
+
const contractType = this.contractMetadata.types[typeId];
|
|
48
|
+
const typeDef = (0, contracts_1.normalizeContractTypeDef)(this.contractMetadata.types[typeId].type.def);
|
|
49
|
+
if (this.typesGen.includedTypes[contractType.id]) {
|
|
50
|
+
this.typesGen.addTypeImport(this.typesGen.includedTypes[contractType.id].name);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const { type, value } = typeDef;
|
|
54
|
+
switch (type) {
|
|
55
|
+
case 'Compact':
|
|
56
|
+
case 'Primitive':
|
|
57
|
+
case 'BitSequence':
|
|
58
|
+
return;
|
|
59
|
+
case 'Struct':
|
|
60
|
+
return value.fields.forEach(({ typeId }) => this.importType(typeId));
|
|
61
|
+
case 'Enum':
|
|
62
|
+
return value.members.forEach(({ fields }) => fields.map(({ typeId }) => this.importType(typeId)).flat());
|
|
63
|
+
case 'Tuple':
|
|
64
|
+
return value.fields.forEach((typeId) => this.importType(typeId));
|
|
65
|
+
case 'SizedVec':
|
|
66
|
+
return this.importType(value.typeParam);
|
|
67
|
+
case 'Sequence':
|
|
68
|
+
return this.importType(value.typeParam);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.QueryGen = QueryGen;
|
|
@@ -0,0 +1,25 @@
|
|
|
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');
|
|
11
|
+
const { messages } = this.contractMetadata.spec;
|
|
12
|
+
const txMessages = messages.filter((one) => one.mutates);
|
|
13
|
+
const txCallsOut = this.doGenerate(txMessages, 'ContractTxOptions');
|
|
14
|
+
const importTypes = this.typesGen.typeImports.toImports({ useSubPaths });
|
|
15
|
+
const template = (0, utils_js_1.compileTemplate)('typink/templates/tx.hbs');
|
|
16
|
+
return (0, utils_js_1.beautifySourceCode)(template({ importTypes, txCallsOut }));
|
|
17
|
+
}
|
|
18
|
+
generateMethodDef(def) {
|
|
19
|
+
const { args } = def;
|
|
20
|
+
args.forEach(({ type: { type } }) => this.importType(type));
|
|
21
|
+
const paramsOut = this.generateParamsOut(args);
|
|
22
|
+
return `GenericContractTxCall<ChainApi, (${paramsOut && `${paramsOut},`} options: ContractTxOptions) => ContractSubmittableExtrinsic<ChainApi>>`;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.TxGen = TxGen;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TypesGen = void 0;
|
|
4
|
+
const contracts_1 = require("@dedot/contracts");
|
|
5
|
+
const index_js_1 = require("../../shared/index.js");
|
|
6
|
+
const utils_js_1 = require("../../utils.js");
|
|
7
|
+
const SKIP_TYPES = ['Result', 'Option'];
|
|
8
|
+
class TypesGen extends index_js_1.BaseTypesGen {
|
|
9
|
+
contractMetadata;
|
|
10
|
+
constructor(contractMetadata) {
|
|
11
|
+
super((0, contracts_1.extractContractTypes)(contractMetadata));
|
|
12
|
+
this.contractMetadata = contractMetadata;
|
|
13
|
+
this.skipTypes = SKIP_TYPES;
|
|
14
|
+
this.includedTypes = this.includeTypes();
|
|
15
|
+
}
|
|
16
|
+
generate(useSubPaths = false) {
|
|
17
|
+
let defTypeOut = '';
|
|
18
|
+
Object.values(this.includedTypes)
|
|
19
|
+
.filter(({ skip, knownType }) => !(skip || knownType))
|
|
20
|
+
.forEach(({ nameOut, id }) => {
|
|
21
|
+
defTypeOut += `export type ${nameOut} = ${this.generateType(id, 0, true)};\n\n`;
|
|
22
|
+
});
|
|
23
|
+
const importTypes = this.typeImports.toImports({ excludeModules: ['./types'], useSubPaths });
|
|
24
|
+
const template = (0, utils_js_1.compileTemplate)('typink/templates/types.hbs');
|
|
25
|
+
return (0, utils_js_1.beautifySourceCode)(template({ importTypes, defTypeOut }));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.TypesGen = TypesGen;
|
|
@@ -0,0 +1,22 @@
|
|
|
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);
|
|
@@ -0,0 +1,37 @@
|
|
|
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.generateContractTypes = void 0;
|
|
7
|
+
const contracts_1 = require("@dedot/contracts");
|
|
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 generateContractTypes(metadata, contract, outDir = '.', extension = 'd.ts', useSubPaths = false) {
|
|
12
|
+
let contractMetadata = typeof metadata === 'string' ? (0, contracts_1.parseRawMetadata)(metadata) : metadata;
|
|
13
|
+
contract = contract || contractMetadata.contract.name;
|
|
14
|
+
const dirPath = path_1.default.resolve(outDir, contract);
|
|
15
|
+
const typesFileName = path_1.default.join(dirPath, `types.${extension}`);
|
|
16
|
+
const queryTypesFileName = path_1.default.join(dirPath, `query.${extension}`);
|
|
17
|
+
const txTypesFileName = path_1.default.join(dirPath, `tx.${extension}`);
|
|
18
|
+
const constructorTxTypesFileName = path_1.default.join(dirPath, `constructor-tx.${extension}`);
|
|
19
|
+
const constructorQueryTypesFileName = path_1.default.join(dirPath, `constructor-query.${extension}`);
|
|
20
|
+
const indexTypesFileName = path_1.default.join(dirPath, `index.${extension}`);
|
|
21
|
+
if (!fs_1.default.existsSync(dirPath)) {
|
|
22
|
+
fs_1.default.mkdirSync(dirPath, { recursive: true });
|
|
23
|
+
}
|
|
24
|
+
const typesGen = new index_js_1.TypesGen(contractMetadata);
|
|
25
|
+
const queryGen = new index_js_1.QueryGen(contractMetadata, typesGen);
|
|
26
|
+
const txGen = new index_js_1.TxGen(contractMetadata, typesGen);
|
|
27
|
+
const constructorTxGen = new index_js_1.ConstructorTxGen(contractMetadata, typesGen);
|
|
28
|
+
const constructorQueryGen = new index_js_1.ConstructorQueryGen(contractMetadata, typesGen);
|
|
29
|
+
const indexGen = new index_js_1.IndexGen(contractMetadata);
|
|
30
|
+
fs_1.default.writeFileSync(typesFileName, await typesGen.generate(useSubPaths));
|
|
31
|
+
fs_1.default.writeFileSync(queryTypesFileName, await queryGen.generate(useSubPaths));
|
|
32
|
+
fs_1.default.writeFileSync(txTypesFileName, await txGen.generate(useSubPaths));
|
|
33
|
+
fs_1.default.writeFileSync(constructorQueryTypesFileName, await constructorQueryGen.generate(useSubPaths));
|
|
34
|
+
fs_1.default.writeFileSync(constructorTxTypesFileName, await constructorTxGen.generate(useSubPaths));
|
|
35
|
+
fs_1.default.writeFileSync(indexTypesFileName, await indexGen.generate(useSubPaths));
|
|
36
|
+
}
|
|
37
|
+
exports.generateContractTypes = generateContractTypes;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Generated by dedot cli
|
|
2
|
+
|
|
3
|
+
{{{importTypes}}}
|
|
4
|
+
import { ContractQuery } from './query';
|
|
5
|
+
import { ContractTx } from './tx';
|
|
6
|
+
import { ConstructorQuery } from './constructor-query';
|
|
7
|
+
import { ConstructorTx } from './constructor-tx';
|
|
8
|
+
|
|
9
|
+
export interface {{{contractName}}}<Rv extends RpcVersion = RpcV2, ChainApi extends VersionedGenericSubstrateApi = SubstrateApi> extends GenericContractApi<Rv, ChainApi> {
|
|
10
|
+
query: ContractQuery<ChainApi[Rv]>;
|
|
11
|
+
tx: ContractTx<ChainApi[Rv]>;
|
|
12
|
+
constructorQuery: ConstructorQuery<ChainApi[Rv]>;
|
|
13
|
+
constructorTx: ConstructorTx<ChainApi[Rv]>;
|
|
14
|
+
}
|
|
@@ -26,17 +26,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.
|
|
29
|
+
exports.isNativeType = exports.isReservedWord = exports.compileTemplate = exports.beautifySourceCode = exports.commentBlock = exports.TUPLE_TYPE_REGEX = exports.WRAPPER_TYPE_REGEX = void 0;
|
|
30
30
|
const fs = __importStar(require("fs"));
|
|
31
31
|
const handlebars_1 = __importDefault(require("handlebars"));
|
|
32
32
|
const path = __importStar(require("path"));
|
|
33
|
-
const process = __importStar(require("process"));
|
|
34
33
|
const prettier = __importStar(require("prettier"));
|
|
34
|
+
const dirname_1 = require("./dirname");
|
|
35
35
|
exports.WRAPPER_TYPE_REGEX = /^(\w+)<(.*)>$/;
|
|
36
36
|
exports.TUPLE_TYPE_REGEX = /^\[(.*)]$/;
|
|
37
37
|
const commentBlock = (...docs) => {
|
|
38
38
|
const flatLines = docs.flat();
|
|
39
|
-
if (flatLines.length === 0) {
|
|
39
|
+
if (flatLines.length === 0 || !flatLines.some((o) => !!o)) {
|
|
40
40
|
return '';
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
@@ -48,18 +48,13 @@ ${flatLines.map((line) => `* ${line.replaceAll(/\s+/g, ' ').trim()}`).join('\n')
|
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
exports.commentBlock = commentBlock;
|
|
51
|
-
const resolveFilePath = (relativePath) => {
|
|
52
|
-
relativePath = Array.isArray(relativePath) ? relativePath : [relativePath];
|
|
53
|
-
return path.resolve(process.cwd(), ...relativePath);
|
|
54
|
-
};
|
|
55
|
-
exports.resolveFilePath = resolveFilePath;
|
|
56
51
|
const beautifySourceCode = async (source) => {
|
|
57
|
-
const prettierOptions = await prettier.resolveConfig((0,
|
|
52
|
+
const prettierOptions = await prettier.resolveConfig(path.resolve((0, dirname_1.currentDirname)(), '../../../.prettierrc.cjs'));
|
|
58
53
|
return prettier.format(source, { parser: 'babel-ts', ...prettierOptions });
|
|
59
54
|
};
|
|
60
55
|
exports.beautifySourceCode = beautifySourceCode;
|
|
61
|
-
const compileTemplate = (
|
|
62
|
-
const templateFilePath = (0,
|
|
56
|
+
const compileTemplate = (templateFile) => {
|
|
57
|
+
const templateFilePath = path.resolve((0, dirname_1.currentDirname)(), templateFile);
|
|
63
58
|
return handlebars_1.default.compile(fs.readFileSync(templateFilePath, 'utf8'));
|
|
64
59
|
};
|
|
65
60
|
exports.compileTemplate = compileTemplate;
|
|
@@ -71,3 +66,32 @@ const TS_RESERVED_WORDS = ['new', 'class'];
|
|
|
71
66
|
*/
|
|
72
67
|
const isReservedWord = (word) => TS_RESERVED_WORDS.includes(word);
|
|
73
68
|
exports.isReservedWord = isReservedWord;
|
|
69
|
+
const TS_PRIMITIVE_TYPES = [
|
|
70
|
+
'void',
|
|
71
|
+
'undefined',
|
|
72
|
+
'null',
|
|
73
|
+
'number',
|
|
74
|
+
'boolean',
|
|
75
|
+
'bigint',
|
|
76
|
+
'Map',
|
|
77
|
+
'Set',
|
|
78
|
+
'string',
|
|
79
|
+
'any',
|
|
80
|
+
'Array',
|
|
81
|
+
'Record',
|
|
82
|
+
];
|
|
83
|
+
/**
|
|
84
|
+
* Check if a type is native JS/TS type
|
|
85
|
+
* @param type
|
|
86
|
+
*/
|
|
87
|
+
const isNativeType = (type) => {
|
|
88
|
+
return TS_PRIMITIVE_TYPES.some((one) => {
|
|
89
|
+
if (typeof one === 'string') {
|
|
90
|
+
return one === type;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
return type.match(one);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
exports.isNativeType = isNativeType;
|
package/dirname.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function currentDirname(): string;
|
package/dirname.js
ADDED
package/index.d.ts
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare function generateTypesFromChain(network: NetworkInfo, endpoint: string, outDir: string): Promise<void>;
|
|
4
|
-
export declare function generateTypes(network: NetworkInfo, metadata: MetadataLatest, rpcMethods: string[], runtimeApis: any[], outDir?: string): Promise<void>;
|
|
1
|
+
export * from './chaintypes/index.js';
|
|
2
|
+
export * from './typink/index.js';
|
package/index.js
CHANGED
|
@@ -1,48 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import * as path from 'path';
|
|
4
|
-
import { ConstsGen, ErrorsGen, EventsGen, IndexGen, QueryGen, RpcGen, RuntimeApisGen, TxGen, TypesGen, } from './generator';
|
|
5
|
-
import { stringCamelCase } from '@polkadot/util';
|
|
6
|
-
export async function generateTypesFromChain(network, endpoint, outDir) {
|
|
7
|
-
const api = await Dedot.create(endpoint);
|
|
8
|
-
const { methods } = await api.rpc.rpc.methods();
|
|
9
|
-
const apis = api.runtimeVersion?.apis || [];
|
|
10
|
-
if (!network.chain) {
|
|
11
|
-
network.chain = stringCamelCase(api.runtimeVersion?.specName || api.runtimeChain || 'local');
|
|
12
|
-
}
|
|
13
|
-
await generateTypes(network, api.metadataLatest, methods, apis, outDir);
|
|
14
|
-
await api.disconnect();
|
|
15
|
-
}
|
|
16
|
-
export async function generateTypes(network, metadata, rpcMethods, runtimeApis, outDir = '.') {
|
|
17
|
-
const dirPath = path.resolve(outDir, network.chain);
|
|
18
|
-
const defTypesFileName = path.join(dirPath, `types.ts`);
|
|
19
|
-
const constsTypesFileName = path.join(dirPath, `consts.ts`);
|
|
20
|
-
const queryTypesFileName = path.join(dirPath, `query.ts`);
|
|
21
|
-
const rpcCallsFileName = path.join(dirPath, `rpc.ts`);
|
|
22
|
-
const indexFileName = path.join(dirPath, `index.ts`);
|
|
23
|
-
const errorsFileName = path.join(dirPath, `errors.ts`);
|
|
24
|
-
const eventsFileName = path.join(dirPath, `events.ts`);
|
|
25
|
-
const runtimeApisFileName = path.join(dirPath, `runtime.ts`);
|
|
26
|
-
const txFileName = path.join(dirPath, `tx.ts`);
|
|
27
|
-
if (!fs.existsSync(dirPath)) {
|
|
28
|
-
fs.mkdirSync(dirPath, { recursive: true });
|
|
29
|
-
}
|
|
30
|
-
const typesGen = new TypesGen(metadata);
|
|
31
|
-
const constsGen = new ConstsGen(typesGen);
|
|
32
|
-
const queryGen = new QueryGen(typesGen);
|
|
33
|
-
const rpcGen = new RpcGen(typesGen, rpcMethods);
|
|
34
|
-
const indexGen = new IndexGen(network);
|
|
35
|
-
const errorsGen = new ErrorsGen(typesGen);
|
|
36
|
-
const eventsGen = new EventsGen(typesGen);
|
|
37
|
-
const runtimeApisGen = new RuntimeApisGen(typesGen, runtimeApis);
|
|
38
|
-
const txGen = new TxGen(typesGen);
|
|
39
|
-
fs.writeFileSync(defTypesFileName, await typesGen.generate());
|
|
40
|
-
fs.writeFileSync(errorsFileName, await errorsGen.generate());
|
|
41
|
-
fs.writeFileSync(eventsFileName, await eventsGen.generate());
|
|
42
|
-
fs.writeFileSync(rpcCallsFileName, await rpcGen.generate());
|
|
43
|
-
fs.writeFileSync(queryTypesFileName, await queryGen.generate());
|
|
44
|
-
fs.writeFileSync(constsTypesFileName, await constsGen.generate());
|
|
45
|
-
fs.writeFileSync(txFileName, await txGen.generate());
|
|
46
|
-
fs.writeFileSync(indexFileName, await indexGen.generate());
|
|
47
|
-
fs.writeFileSync(runtimeApisFileName, await runtimeApisGen.generate());
|
|
48
|
-
}
|
|
1
|
+
export * from './chaintypes/index.js';
|
|
2
|
+
export * from './typink/index.js';
|