-
Notifications
You must be signed in to change notification settings - Fork 39
/
codegen.js
executable file
·103 lines (97 loc) · 3.15 KB
/
codegen.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/usr/bin/env node
const { join } = require('path');
const { writeFileSync } = require('fs');
const telescope = require('@osmonauts/telescope').default;
const outPath = join(__dirname, '/../src');
telescope({
protoDirs: [
'cosmos-sdk-0.45/proto',
'cosmos-sdk-0.45/third_party/proto',
'wasmd-0.28/proto',
'wasmd-0.28/third_party/proto',
],
outPath: outPath,
options: {
logLevel: 0,
useSDKTypes: false,
tsDisable: {
disableAll: false
},
eslintDisable: {
disableAll: true
},
bundle: {
enabled: false
},
prototypes: {
includePackageVar: true,
excluded: {
protos: [
'cosmos/authz/v1beta1/event.proto',
'cosmos/base/reflection/v2alpha1/reflection.proto',
'cosmos/crypto/secp256r1/keys.proto',
'ibc/core/port/v1/query.proto',
'ibc/lightclients/solomachine/v2/solomachine.proto',
'tendermint/libs/bits/types.proto',
'google/api/httpbody.proto',
'tendermint/blockchain/types.proto',
'tendermint/consensus/types.proto',
'tendermint/consensus/wal.proto',
'tendermint/mempool/types.proto',
'tendermint/p2p/conn.proto',
'tendermint/p2p/pex.proto',
'tendermint/privval/types.proto',
'tendermint/rpc/grpc/types.proto',
'tendermint/state/types.proto',
'tendermint/statesync/types.proto',
'tendermint/store/types.proto',
'tendermint/types/canonical.proto',
'tendermint/types/events.proto',
]
},
methods: {
// There are users who need those functions. CosmJS does not need them directly.
// See https://github.com/cosmos/cosmjs/pull/1329
fromJSON: true,
toJSON: true,
},
typingsFormat: {
useDeepPartial: true,
useExact: true,
timestamp: 'timestamp',
duration: 'duration'
}
},
lcdClients: {
enabled: false
},
rpcClients: {
enabled: true,
inline: true,
extensions: false,
camelCase: false,
enabledServices: [
'Msg',
'Query',
'Service',
'ReflectionService',
'ABCIApplication'
]
},
aminoEncoding: {
enabled: false
}
}
}).then(() => {
// Create index.ts
const index_ts = `
// Auto-generated, see scripts/codegen.js!
// Exports we want to provide at the root of the "cosmjs-types" package
export { DeepPartial, Exact } from "./helpers";
`;
writeFileSync(`${outPath}/index.ts`, index_ts);
console.log('✨ All Done!');
}, (e) => {
console.error(e);
process.exit(1);
});