@dedot/codegen 0.0.1-next.be305dd5.15 → 0.0.1-next.ce93b605.2
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/genSupportedChainTypes.js +4 -0
- package/cjs/generator/RpcGen.js +1 -1
- package/cjs/generator/TypesGen.js +3 -3
- package/cjs/generator/known-types.js +33 -0
- package/cjs/packageInfo.js +1 -1
- package/genSupportedChainTypes.js +4 -0
- package/generator/RpcGen.js +1 -1
- package/generator/TypesGen.js +3 -3
- package/generator/known-types.d.ts +6 -0
- package/generator/known-types.js +30 -0
- package/package.json +7 -7
- package/packageInfo.js +1 -1
- /package/cjs/generator/{known_codecs.js → known-codecs.js} +0 -0
- /package/generator/{known_codecs.d.ts → known-codecs.d.ts} +0 -0
- /package/generator/{known_codecs.js → known-codecs.js} +0 -0
|
@@ -38,6 +38,10 @@ const NETWORKS = [
|
|
|
38
38
|
chain: 'kusamaAssetHub',
|
|
39
39
|
endpoint: 'wss://kusama-asset-hub-rpc.polkadot.io/',
|
|
40
40
|
},
|
|
41
|
+
{
|
|
42
|
+
chain: 'rococo',
|
|
43
|
+
endpoint: 'wss://rococo-rpc.polkadot.io/',
|
|
44
|
+
},
|
|
41
45
|
{
|
|
42
46
|
chain: 'rococoAssetHub',
|
|
43
47
|
endpoint: 'wss://rococo-asset-hub-rpc.polkadot.io/',
|
package/cjs/generator/RpcGen.js
CHANGED
|
@@ -5,7 +5,7 @@ const specs_1 = require("@dedot/specs");
|
|
|
5
5
|
const utils_1 = require("@dedot/utils");
|
|
6
6
|
const generator_1 = require("../generator");
|
|
7
7
|
const utils_2 = require("./utils");
|
|
8
|
-
const known_codecs_1 = require("./
|
|
8
|
+
const known_codecs_1 = require("./known-codecs");
|
|
9
9
|
const HIDDEN_RPCS = [
|
|
10
10
|
// Ref: https://github.com/paritytech/polkadot-sdk/blob/43415ef58c143b985e09015cd000dbd65f6d3997/substrate/client/rpc-servers/src/lib.rs#L152C9-L158
|
|
11
11
|
'rpc_methods',
|
|
@@ -5,9 +5,9 @@ const util_1 = require("@polkadot/util");
|
|
|
5
5
|
const codecs_1 = require("@dedot/codecs");
|
|
6
6
|
const utils_1 = require("@dedot/utils");
|
|
7
7
|
const utils_2 = require("./utils");
|
|
8
|
-
const
|
|
8
|
+
const known_types_1 = require("./known-types");
|
|
9
9
|
const TypeImports_1 = require("./TypeImports");
|
|
10
|
-
const known_codecs_1 = require("./
|
|
10
|
+
const known_codecs_1 = require("./known-codecs");
|
|
11
11
|
// Skip generate types for these
|
|
12
12
|
// as we do have native types for them
|
|
13
13
|
const SKIP_TYPES = [
|
|
@@ -426,7 +426,7 @@ class TypesGen {
|
|
|
426
426
|
this.typeImports.addCodecType(typeName);
|
|
427
427
|
return;
|
|
428
428
|
}
|
|
429
|
-
if (
|
|
429
|
+
if (known_types_1.knownTypes.includes(typeName)) {
|
|
430
430
|
this.typeImports.addKnownType(typeName);
|
|
431
431
|
}
|
|
432
432
|
else {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.knownTypes = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Known type names registered in @dedot/types
|
|
6
|
+
* Since TS interfaces are trim-off when compiling,
|
|
7
|
+
* So we need to register them explicitly here for RPC codegen process
|
|
8
|
+
*/
|
|
9
|
+
exports.knownTypes = [
|
|
10
|
+
'ExtrinsicOrHash',
|
|
11
|
+
'EpochAuthorship',
|
|
12
|
+
'BlockStats',
|
|
13
|
+
'Prevotes',
|
|
14
|
+
'Precommits',
|
|
15
|
+
'RoundState',
|
|
16
|
+
'ReportedRoundStates',
|
|
17
|
+
'JustificationNotification',
|
|
18
|
+
'EncodedFinalityProofs',
|
|
19
|
+
'LeavesProof',
|
|
20
|
+
'StorageKind',
|
|
21
|
+
'RpcMethods',
|
|
22
|
+
'ReadProof',
|
|
23
|
+
'StorageChangeSet',
|
|
24
|
+
'TraceBlockResponse',
|
|
25
|
+
'MigrationStatusResult',
|
|
26
|
+
'ChainType',
|
|
27
|
+
'ChainProperties',
|
|
28
|
+
'Health',
|
|
29
|
+
'SyncState',
|
|
30
|
+
'PeerInfo',
|
|
31
|
+
'NodeRole',
|
|
32
|
+
'NetworkState',
|
|
33
|
+
];
|
package/cjs/packageInfo.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
// THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.packageInfo = void 0;
|
|
5
|
-
exports.packageInfo = { name: '@dedot/codegen', version: '0.0.1-alpha.
|
|
5
|
+
exports.packageInfo = { name: '@dedot/codegen', version: '0.0.1-alpha.27' };
|
|
@@ -33,6 +33,10 @@ const NETWORKS = [
|
|
|
33
33
|
chain: 'kusamaAssetHub',
|
|
34
34
|
endpoint: 'wss://kusama-asset-hub-rpc.polkadot.io/',
|
|
35
35
|
},
|
|
36
|
+
{
|
|
37
|
+
chain: 'rococo',
|
|
38
|
+
endpoint: 'wss://rococo-rpc.polkadot.io/',
|
|
39
|
+
},
|
|
36
40
|
{
|
|
37
41
|
chain: 'rococoAssetHub',
|
|
38
42
|
endpoint: 'wss://rococo-asset-hub-rpc.polkadot.io/',
|
package/generator/RpcGen.js
CHANGED
|
@@ -2,7 +2,7 @@ import { findAliasRpcSpec, findRpcSpec, isUnsubscribeMethod } from '@dedot/specs
|
|
|
2
2
|
import { isNativeType } from '@dedot/utils';
|
|
3
3
|
import { ApiGen } from '../generator';
|
|
4
4
|
import { beautifySourceCode, commentBlock, compileTemplate, TUPLE_TYPE_REGEX, WRAPPER_TYPE_REGEX } from './utils';
|
|
5
|
-
import { findKnownCodecType } from './
|
|
5
|
+
import { findKnownCodecType } from './known-codecs';
|
|
6
6
|
const HIDDEN_RPCS = [
|
|
7
7
|
// Ref: https://github.com/paritytech/polkadot-sdk/blob/43415ef58c143b985e09015cd000dbd65f6d3997/substrate/client/rpc-servers/src/lib.rs#L152C9-L158
|
|
8
8
|
'rpc_methods',
|
package/generator/TypesGen.js
CHANGED
|
@@ -2,9 +2,9 @@ import { stringPascalCase } from '@polkadot/util';
|
|
|
2
2
|
import { PortableRegistry } from '@dedot/codecs';
|
|
3
3
|
import { isNativeType, normalizeName } from '@dedot/utils';
|
|
4
4
|
import { beautifySourceCode, commentBlock, compileTemplate } from './utils';
|
|
5
|
-
import {
|
|
5
|
+
import { knownTypes } from './known-types';
|
|
6
6
|
import { TypeImports } from './TypeImports';
|
|
7
|
-
import { findKnownCodec, findKnownCodecType, isKnownCodecType } from './
|
|
7
|
+
import { findKnownCodec, findKnownCodecType, isKnownCodecType } from './known-codecs';
|
|
8
8
|
// Skip generate types for these
|
|
9
9
|
// as we do have native types for them
|
|
10
10
|
const SKIP_TYPES = [
|
|
@@ -423,7 +423,7 @@ export class TypesGen {
|
|
|
423
423
|
this.typeImports.addCodecType(typeName);
|
|
424
424
|
return;
|
|
425
425
|
}
|
|
426
|
-
if (
|
|
426
|
+
if (knownTypes.includes(typeName)) {
|
|
427
427
|
this.typeImports.addKnownType(typeName);
|
|
428
428
|
}
|
|
429
429
|
else {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Known type names registered in @dedot/types
|
|
3
|
+
* Since TS interfaces are trim-off when compiling,
|
|
4
|
+
* So we need to register them explicitly here for RPC codegen process
|
|
5
|
+
*/
|
|
6
|
+
export const knownTypes = [
|
|
7
|
+
'ExtrinsicOrHash',
|
|
8
|
+
'EpochAuthorship',
|
|
9
|
+
'BlockStats',
|
|
10
|
+
'Prevotes',
|
|
11
|
+
'Precommits',
|
|
12
|
+
'RoundState',
|
|
13
|
+
'ReportedRoundStates',
|
|
14
|
+
'JustificationNotification',
|
|
15
|
+
'EncodedFinalityProofs',
|
|
16
|
+
'LeavesProof',
|
|
17
|
+
'StorageKind',
|
|
18
|
+
'RpcMethods',
|
|
19
|
+
'ReadProof',
|
|
20
|
+
'StorageChangeSet',
|
|
21
|
+
'TraceBlockResponse',
|
|
22
|
+
'MigrationStatusResult',
|
|
23
|
+
'ChainType',
|
|
24
|
+
'ChainProperties',
|
|
25
|
+
'Health',
|
|
26
|
+
'SyncState',
|
|
27
|
+
'PeerInfo',
|
|
28
|
+
'NodeRole',
|
|
29
|
+
'NetworkState',
|
|
30
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dedot/codegen",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.ce93b605.2+ce93b60",
|
|
4
4
|
"description": "Generate types",
|
|
5
5
|
"author": "Thang X. Vu <thang@coongcrafts.io>",
|
|
6
6
|
"homepage": "https://github.com/dedotdev/dedot/tree/main/packages/codegen",
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
"copy": "cp -R ./src/templates ./dist && cp -R ./src/templates ./dist/cjs"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dedot/codecs": "0.0.1-next.
|
|
22
|
-
"@dedot/shape": "0.0.1-next.
|
|
23
|
-
"@dedot/specs": "0.0.1-next.
|
|
24
|
-
"@dedot/utils": "0.0.1-next.
|
|
21
|
+
"@dedot/codecs": "0.0.1-next.ce93b605.2+ce93b60",
|
|
22
|
+
"@dedot/shape": "0.0.1-next.ce93b605.2+ce93b60",
|
|
23
|
+
"@dedot/specs": "0.0.1-next.ce93b605.2+ce93b60",
|
|
24
|
+
"@dedot/utils": "0.0.1-next.ce93b605.2+ce93b60",
|
|
25
25
|
"@polkadot/util": "^12.6.2",
|
|
26
|
-
"dedot": "0.0.1-next.
|
|
26
|
+
"dedot": "0.0.1-next.ce93b605.2+ce93b60",
|
|
27
27
|
"handlebars": "^4.7.8",
|
|
28
28
|
"prettier": "^3.0.3"
|
|
29
29
|
},
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"directory": "dist"
|
|
33
33
|
},
|
|
34
34
|
"license": "Apache-2.0",
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "ce93b60580f35ca55e074f94324a8704904257c4",
|
|
36
36
|
"module": "./index.js",
|
|
37
37
|
"types": "./index.d.ts",
|
|
38
38
|
"exports": {
|
package/packageInfo.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
|
|
2
|
-
export const packageInfo = { name: '@dedot/codegen', version: '0.0.1-alpha.
|
|
2
|
+
export const packageInfo = { name: '@dedot/codegen', version: '0.0.1-alpha.27' };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|