@@ -123,7 +123,7 @@ Use the [`create-interchain-app`](https://github.com/hyperweb-io/create-intercha
123
123
124
124
``` sh
125
125
cia --boilerplate telescope
126
-
126
+ ```
127
127
128
128
Then, you'll navigate into ` ./your-project/packages/telescope ` package for the next steps.
129
129
@@ -212,6 +212,29 @@ Download with a config file:
212
212
telescope download --config ./protod.config.json --out ./git-modules
213
213
```
214
214
215
+ protod.config.json example:
216
+ ``` json
217
+ {
218
+ "repos" : [
219
+ { "owner" : " cosmos" , "repo" : " cosmos-sdk" , "branch" : " release/v0.50.x" },
220
+ { "owner" : " cosmos" , "repo" : " ibc-go" },
221
+ ],
222
+ "protoDirMapping" : {
223
+ "gogo/protobuf/master" : " ." ,
224
+ "googleapis/googleapis/master" : " ." ,
225
+ "protocolbuffers/protobuf/main" : " src"
226
+ },
227
+ "outDir" : " protos" ,
228
+ "ssh" : true ,
229
+ "tempRepoDir" : " git-modules" ,
230
+ "targets" : [
231
+ " cosmos/**/*.proto" ,
232
+ " cosmwasm/**/*.proto" ,
233
+ " ibc/**/*.proto" ,
234
+ ]
235
+ }
236
+ ```
237
+
215
238
Download from a specific repo:
216
239
``` sh
217
240
telescope download --git-repo owner/repository --targets cosmos/auth/v1beta1/auth.proto
@@ -225,7 +248,97 @@ telescope transpile
225
248
226
249
Use customized telescope option:
227
250
``` sh
228
- telescope transpile --config your-config.json
251
+ telescope transpile --config telescope-config.json
252
+ ```
253
+
254
+ telescope-config.json exmaple:
255
+ ``` json
256
+ {
257
+ "protoDirs" : [
258
+ " ./protos/"
259
+ ],
260
+ "outPath" : " ./codegen/" ,
261
+ "options" : {
262
+ "classesUseArrowFunctions" : true ,
263
+ "env" : " v-next" ,
264
+ "useInterchainJs" : true ,
265
+ "useSDKTypes" : false ,
266
+ "prototypes" : {
267
+ "enableRegistryLoader" : false ,
268
+ "enableMessageComposer" : false ,
269
+ "enabled" : true ,
270
+ "parser" : {
271
+ "keepCase" : false
272
+ },
273
+ "methods" : {
274
+ "fromJSON" : false ,
275
+ "toJSON" : false ,
276
+ "encode" : true ,
277
+ "decode" : true ,
278
+ "fromPartial" : true ,
279
+ "toAmino" : true ,
280
+ "fromAmino" : true ,
281
+ "fromProto" : false ,
282
+ "toProto" : false ,
283
+ "fromProtoMsg" : false ,
284
+ "toProtoMsg" : false ,
285
+ "toAminoMsg" : true ,
286
+ "fromAminoMsg" : true
287
+ },
288
+ "addTypeUrlToDecoders" : false ,
289
+ "addTypeUrlToObjects" : true ,
290
+ "addAminoTypeToObjects" : true ,
291
+ "typingsFormat" : {
292
+ "duration" : " duration" ,
293
+ "timestamp" : " date" ,
294
+ "useExact" : false ,
295
+ "useDeepPartial" : true ,
296
+ "num64" : " bigint" ,
297
+ "customTypes" : {
298
+ "useCosmosSDKDec" : true ,
299
+ "useEnhancedDecimal" : false
300
+ },
301
+ "useTelescopeGeneratedType" : true ,
302
+ "autoFixUndefinedEnumDefault" : true
303
+ }
304
+ },
305
+ "bundle" : {
306
+ "enabled" : false
307
+ },
308
+ "stargateClients" : {
309
+ "enabled" : false
310
+ },
311
+ "lcdClients" : {
312
+ "enabled" : false
313
+ },
314
+ "rpcClients" : {
315
+ "enabled" : false
316
+ },
317
+ "helperFunctions" : {
318
+ "enabled" : true ,
319
+ "useGlobalDecoderRegistry" : true ,
320
+ "hooks" : {
321
+ "react" : true ,
322
+ "vue" : false
323
+ }
324
+ },
325
+ "interfaces" : {
326
+ "enabled" : true ,
327
+ "useGlobalDecoderRegistry" : true ,
328
+ "registerAllDecodersToGlobal" : false ,
329
+ "useUnionTypes" : true
330
+ },
331
+ "aminoEncoding" : {
332
+ "enabled" : true ,
333
+ "useLegacyInlineEncoding" : false ,
334
+ "disableMsgTypes" : false ,
335
+ "useProtoOptionality" : true ,
336
+ "customTypes" : {
337
+ "useCosmosSDKDec" : true
338
+ }
339
+ }
340
+ }
341
+ }
229
342
```
230
343
231
344
### CIA
@@ -1274,7 +1387,7 @@ The nameMappers object supports three service types: All, Query, and Msg. Each p
1274
1387
` ` ` js
1275
1388
{
1276
1389
" pattern" : {
1277
- funcBody: (name: string ) => string, // Function to transform the method name
1390
+ funcBody : (ctx : AliasNameMappersContext ) => string , // Function to transform the method name
1278
1391
hookPrefix?: string // Prefix for the hook function (default: "use")
1279
1392
}
1280
1393
}
@@ -1294,24 +1407,18 @@ const options: TelescopeOptions = {
1294
1407
nameMappers: {
1295
1408
All: {
1296
1409
" cosmos.gov.v1beta1.*Vote*" : {
1297
- funcBody: (ctx: AliasNameMappersContext) => {
1298
- return `helper${ctx.name}`;
1299
- },
1410
+ funcBody : (ctx ) => ` helper${ctx .name } ` ,
1300
1411
hookPrefix: " use" ,
1301
1412
},
1302
1413
},
1303
1414
Query: {
1304
1415
" cosmos.gov.v1beta1.*Deposits*" : {
1305
- funcBody: (ctx: AliasNameMappersContext) => {
1306
- return `goOver${ctx.name}`;
1307
- },
1416
+ funcBody : (ctx ) => ` goOver${ctx .name } ` ,
1308
1417
},
1309
1418
},
1310
1419
Msg: {
1311
1420
" cosmos.gov.v1beta1.*VoteWeighted*" : {
1312
- funcBody: (ctx: AliasNameMappersContext) => {
1313
- return `lets${ctx.name}`;
1314
- },
1421
+ funcBody : (ctx ) => ` lets${ctx .name } ` ,
1315
1422
hookPrefix: " useTx" ,
1316
1423
},
1317
1424
},
0 commit comments