@dedot/cli 0.0.1-next.c3d95ac1.3 → 0.0.1-next.d9aff57d.57
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.
|
@@ -27,17 +27,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.chaintypes = void 0;
|
|
30
|
-
const path = __importStar(require("path"));
|
|
31
|
-
const codegen_1 = require("@dedot/codegen");
|
|
32
|
-
const codecs_1 = require("@dedot/codecs");
|
|
33
|
-
const dedot_1 = require("dedot");
|
|
34
|
-
const substrate_hex_1 = __importDefault(require("@polkadot/types-support/metadata/v15/substrate-hex"));
|
|
35
30
|
const static_substrate_1 = require("@polkadot/types-support/metadata/static-substrate");
|
|
31
|
+
const substrate_hex_1 = __importDefault(require("@polkadot/types-support/metadata/v15/substrate-hex"));
|
|
32
|
+
const api_1 = require("@dedot/api");
|
|
33
|
+
const codecs_1 = require("@dedot/codecs");
|
|
34
|
+
const codegen_1 = require("@dedot/codegen");
|
|
35
|
+
const path = __importStar(require("path"));
|
|
36
36
|
exports.chaintypes = {
|
|
37
37
|
command: 'chaintypes',
|
|
38
38
|
describe: 'Generate chain types & APIs for a Substrate-based blockchain',
|
|
39
39
|
handler: async (yargs) => {
|
|
40
|
-
const { wsUrl, output = '', chain = '', dts = true } = yargs;
|
|
40
|
+
const { wsUrl, output = '', chain = '', dts = true, subpath = true } = yargs;
|
|
41
41
|
const outDir = path.resolve(output);
|
|
42
42
|
const extension = dts ? 'd.ts' : 'ts';
|
|
43
43
|
if (wsUrl === 'substrate') {
|
|
@@ -50,11 +50,11 @@ exports.chaintypes = {
|
|
|
50
50
|
acc[name] = version;
|
|
51
51
|
return acc;
|
|
52
52
|
}, {});
|
|
53
|
-
await (0, codegen_1.generateTypes)('substrate', metadata.latest, rpcMethods, runtimeApis, outDir, extension);
|
|
53
|
+
await (0, codegen_1.generateTypes)('substrate', metadata.latest, rpcMethods, runtimeApis, outDir, extension, subpath);
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
56
56
|
console.log(`- Generating chaintypes via endpoint ${wsUrl}`);
|
|
57
|
-
await (0, codegen_1.generateTypesFromEndpoint)(chain, wsUrl, outDir, extension);
|
|
57
|
+
await (0, codegen_1.generateTypesFromEndpoint)(chain, wsUrl, outDir, extension, subpath);
|
|
58
58
|
}
|
|
59
59
|
console.log(`- DONE! Output: ${outDir}`);
|
|
60
60
|
},
|
|
@@ -82,14 +82,20 @@ exports.chaintypes = {
|
|
|
82
82
|
describe: 'Generate d.ts files',
|
|
83
83
|
alias: 'd',
|
|
84
84
|
default: true,
|
|
85
|
+
})
|
|
86
|
+
.option('subpath', {
|
|
87
|
+
type: 'boolean',
|
|
88
|
+
describe: 'Using subpath for shared packages',
|
|
89
|
+
alias: 's',
|
|
90
|
+
default: true,
|
|
85
91
|
})); // TODO check to verify inputs
|
|
86
92
|
},
|
|
87
93
|
};
|
|
88
94
|
const getRuntimeVersion = (metadata) => {
|
|
89
95
|
const registry = new codecs_1.PortableRegistry(metadata.latest);
|
|
90
|
-
const executor = new
|
|
96
|
+
const executor = new api_1.ConstantExecutor({
|
|
91
97
|
registry,
|
|
92
|
-
|
|
98
|
+
metadata,
|
|
93
99
|
});
|
|
94
100
|
return executor.execute('system', 'version');
|
|
95
101
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dedot/cli",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.d9aff57d.57+d9aff57",
|
|
4
4
|
"author": "Thang X. Vu <thang@coongcrafts.io>",
|
|
5
5
|
"bin": {
|
|
6
6
|
"dedot": "./bin/dedot",
|
|
@@ -14,8 +14,10 @@
|
|
|
14
14
|
"start": "ts-node src/index.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@dedot/
|
|
18
|
-
"@
|
|
17
|
+
"@dedot/api": "0.0.1-next.d9aff57d.57+d9aff57",
|
|
18
|
+
"@dedot/codecs": "0.0.1-next.d9aff57d.57+d9aff57",
|
|
19
|
+
"@dedot/codegen": "0.0.1-next.d9aff57d.57+d9aff57",
|
|
20
|
+
"@polkadot/types-support": "^11.0.2",
|
|
19
21
|
"yargs": "^17.7.2"
|
|
20
22
|
},
|
|
21
23
|
"devDependencies": {
|
|
@@ -26,5 +28,5 @@
|
|
|
26
28
|
"directory": "dist"
|
|
27
29
|
},
|
|
28
30
|
"license": "Apache-2.0",
|
|
29
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "d9aff57dcbd8e15455da9627cbc43f07cb6c0afc"
|
|
30
32
|
}
|