@@ -21,37 +21,69 @@ A "babel for the Cosmos", Telescope is a TypeScript Transpiler for Cosmos Protob
21
21
22
22
The following blockchain libraries (generated by Telescope) are available via npm
23
23
24
- * [ akashjs] ( https://www.npmjs.com/package/akashjs )
25
- * [ comdex] ( https://www.npmjs.com/package/comdex )
26
24
* [ osmojs] ( https://www.npmjs.com/package/osmojs )
27
- * [ pylonsjs] ( https://www.npmjs.com/package/pylonsjs )
28
25
* [ stargazejs] ( https://www.npmjs.com/package/stargazejs )
29
26
* [ juno-network] ( https://www.npmjs.com/package/juno-network )
27
+ * [ stridejs] ( https://www.npmjs.com/package/stridejs )
28
+ * [ akashjs] ( https://www.npmjs.com/package/akashjs )
29
+ * [ comdex] ( https://www.npmjs.com/package/comdex )
30
+ * [ pylonsjs] ( https://www.npmjs.com/package/pylonsjs )
31
+
32
+ 🎥 [ Checkout our video playlist] ( https://www.youtube.com/watch?v=n82MsLe82mk&list=PL-lMkVv7GZwyQaK6bp6kMdOS5mzosxytC ) to learn how to use ` telescope ` !
30
33
31
34
## Table of contents
32
35
33
- - [ Telescope] ( #telescope )
36
+ - [ Telescope 🔭 ] ( #telescope- )
34
37
- [ Table of contents] ( #table-of-contents )
35
- - [ QuickStart] ( #quickstart )
38
+ - [ Quickstart] ( #quickstart )
39
+ - [ Generate] ( #generate )
40
+ - [ Add Protobufs] ( #add-protobufs )
41
+ - [ Transpile] ( #transpile )
42
+ - [ Build] ( #build )
36
43
- [ Usage] ( #usage )
37
- - [ Programmatic Usage] ( #programatic-usage )
38
- - [ Options] ( #options )
39
- - [ Types] ( #types )
40
- - [ Composing Messages] ( #composing-messages )
41
- - [ Calculating Fees] ( #calculating-fees )
42
- - [ Stargate Clients] ( #stargate-clients )
43
- - [ Creating Signers] ( #creating-signers )
44
- - [ Broadcasting Messages] ( #broadcasting-messages )
45
- - [ LCD Clients] ( #lcd-clients )
46
- - [ RPC Clients] ( #rpc-clients )
47
- - [ CosmWasm] ( #cosmwasm )
48
- - [ Dependencies] ( #dependencies )
49
- - [ Manually Registering Types] ( #manually-registering-types )
50
- - [ Troubleshooting] ( #troubleshooting )
51
- - [ Development] ( #developing )
52
- - [ Sponsors] ( #sponsors )
53
- - [ Related] ( #related )
54
- - [ Credits] ( #credits )
44
+ - [ Programatic Usage] ( #programatic-usage )
45
+ - [ Options] ( #options )
46
+ - [ Amino Encoding] ( #amino-encoding )
47
+ - [ Prototypes Options] ( #prototypes-options )
48
+ - [ Prototypes Methods] ( #prototypes-methods )
49
+ - [ LCD Client Options] ( #lcd-client-options )
50
+ - [ RPC Client Options] ( #rpc-client-options )
51
+ - [ Stargate Client Options] ( #stargate-client-options )
52
+ - [ Typings and Formating] ( #typings-and-formating )
53
+ - [ Protobuf parser] ( #protobuf-parser )
54
+ - [ Typescript Disabling] ( #typescript-disabling )
55
+ - [ ESLint Disabling] ( #eslint-disabling )
56
+ - [ Bundle] ( #bundle )
57
+ - [ Output] ( #output )
58
+ - [ Types] ( #types )
59
+ - [ Timestamp] ( #timestamp )
60
+ - [ Duration] ( #duration )
61
+ - [ Composing Messages] ( #composing-messages )
62
+ - [ Calculating Fees] ( #calculating-fees )
63
+ - [ Stargate Clients] ( #stargate-clients )
64
+ - [ Creating Signers] ( #creating-signers )
65
+ - [ Amino Signer] ( #amino-signer )
66
+ - [ Proto Signer] ( #proto-signer )
67
+ - [ Broadcasting messages] ( #broadcasting-messages )
68
+ - [ LCD Clients] ( #lcd-clients )
69
+ - [ LCD Clients Classes] ( #lcd-clients-classes )
70
+ - [ RPC Clients] ( #rpc-clients )
71
+ - [ RPC Client Classes] ( #rpc-client-classes )
72
+ - [ Manually registering types] ( #manually-registering-types )
73
+ - [ CosmWasm] ( #cosmwasm )
74
+ - [ Dependencies] ( #dependencies )
75
+ - [ Troubleshooting] ( #troubleshooting )
76
+ - [ Create React App] ( #create-react-app )
77
+ - [ Babel] ( #babel )
78
+ - [ Developing] ( #developing )
79
+ - [ Initial setup] ( #initial-setup )
80
+ - [ Building] ( #building )
81
+ - [ Tests] ( #tests )
82
+ - [ Generators] ( #generators )
83
+ - [ Sponsors] ( #sponsors )
84
+ - [ Related] ( #related )
85
+ - [ Credits] ( #credits )
86
+ - [ Disclaimer] ( #disclaimer )
55
87
56
88
## Quickstart
57
89
@@ -135,14 +167,6 @@ telescope({
135
167
136
168
// all options are totally optional ;)
137
169
options: {
138
- prototypes: {
139
- includePackageVar: false ,
140
- typingsFormat: {
141
- useExact: false ,
142
- timestamp: ' date' ,
143
- duration: ' duration'
144
- },
145
- }
146
170
aminoEncoding: {
147
171
enabled: true
148
172
},
@@ -186,12 +210,6 @@ telescope({
186
210
187
211
## Options
188
212
189
- ### Bundle
190
-
191
- | option | description | defaults |
192
- | ------------------------------ | -------------------------------------------------------------- | ---------- |
193
- | ` bundle.enabled ` | bundle all files into a scoped index file | ` true ` |
194
-
195
213
### Amino Encoding
196
214
197
215
| option | description | defaults |
@@ -205,12 +223,27 @@ telescope({
205
223
206
224
| option | description | defaults |
207
225
| ----------------------------------------- | -------------------------------------------------------------- | ---------- |
226
+ | ` prototypes.enabled ` | enables the generation of proto encoding methods | ` true ` |
208
227
| ` prototypes.includePackageVar ` | export a ` protoPackage ` variable to indicate package name | ` false ` |
209
228
| ` prototypes.excluded.packages ` | exclude a set of packages from transpilation | ` undefined ` |
210
229
| ` prototypes.excluded.protos ` | exclude a set of proto files from transpilation | ` undefined ` |
211
- | ` prototypes.fieldDefaultIsOptional ` | boolean value representing default optionality of field | ` false ` |
212
- | ` prototypes.useOptionalNullable ` | use ` (gogoproto.nullable) ` values in determining optionality | ` true ` |
213
- | ` prototypes.allowUndefinedTypes ` | boolean value allowing ` Type ` s to be ` undefined ` | ` false ` |
230
+ | ` prototypes.fieldDefaultIsOptional ` | boolean value representing default optionality of field | ` false ` |
231
+ | ` prototypes.useOptionalNullable ` | use ` (gogoproto.nullable) ` values in determining optionality | ` true ` |
232
+ | ` prototypes.allowUndefinedTypes ` | boolean value allowing ` Type ` s to be ` undefined ` | ` false ` |
233
+ | ` prototypes.optionalQueryParams ` | boolean value setting queryParams to be optional | ` false ` |
234
+ | ` prototypes.optionalPageRequests ` | boolean value setting ` PageRequest ` fields to optional | ` false ` |
235
+
236
+ ### Prototypes Methods
237
+
238
+ | option | description | defaults|
239
+ | ---------------------------------- | ----------------------------------------------------------------- | ------- |
240
+ | ` prototypes.methods.encode ` | boolean to enable ` encode ` method on proto objects | ` true ` |
241
+ | ` prototypes.methods.decode ` | boolean to enable ` decode ` method on proto objects | ` true ` |
242
+ | ` prototypes.methods.fromJSON ` | boolean to enable ` fromJSON ` method on proto objects | ` true ` |
243
+ | ` prototypes.methods.toJSON ` | boolean to enable ` toJSON ` method on proto objects | ` true ` |
244
+ | ` prototypes.methods.fromPartial ` | boolean to enable ` fromPartial ` method on proto objects | ` true ` |
245
+ | ` prototypes.methods.fromSDK ` | boolean to enable ` fromSDK ` method on proto objects | ` false ` |
246
+ | ` prototypes.methods.toSDK ` | boolean to enable ` toSDK ` method on proto objects | ` false ` |
214
247
215
248
### LCD Client Options
216
249
@@ -222,15 +255,17 @@ telescope({
222
255
| ` lcdClients.scopedIsExclusive ` | will allow both scoped bundles and all RPC Clients | ` true ` |
223
256
224
257
See [ LCD Clients] ( #lcd-clients ) for more info.
258
+
225
259
### RPC Client Options
226
260
227
- | option | description | defaults |
228
- | ------------------------------ | -------------------------------------------------------------- | ---------- |
229
- | ` rpcClients.enabled ` | generate RPC clients that can interact with proto messages | ` true ` |
230
- | ` rpcClients.bundle ` | will generate factory bundle aggregate of all RPC Clients | ` true ` |
231
- | ` rpcClients.camelCase ` | use camel-case for RPC methods when generating RPC clients | ` true ` |
232
- | ` rpcClients.scoped ` | will generate factory of scoped RPC Clients | ` undefined ` |
233
- | ` rpcClients.scopedIsExclusive ` | will allow both scoped bundles and all RPC Clients | ` true ` |
261
+ | option | description | defaults |
262
+ | ------------------------------ | -------------------------------------------------------------- | ----------------------------- |
263
+ | ` rpcClients.enabled ` | generate RPC clients that can interact with proto messages | ` true ` |
264
+ | ` rpcClients.bundle ` | will generate factory bundle aggregate of all RPC Clients | ` true ` |
265
+ | ` rpcClients.camelCase ` | use camel-case for RPC methods when generating RPC clients | ` true ` |
266
+ | ` rpcClients.scoped ` | will generate factory of scoped RPC Clients | ` undefined ` |
267
+ | ` rpcClients.scopedIsExclusive ` | will allow both scoped bundles and all RPC Clients | ` true ` |
268
+ | ` rpcClients.enabledServices ` | which services to enable | [ ` Msg ` ,` Query ` ,` Service ` ] |
234
269
235
270
See [ RPC Clients] ( #rpc-clients ) for more info.
236
271
@@ -253,7 +288,7 @@ See [RPC Clients](#rpc-clients) for more info.
253
288
254
289
| option | description | defaults |
255
290
| ----------------------------------------- | -------------------------------------------------------------- | --------- |
256
- | ` prototypes.parser.keepCase ` | passes ` keepCase ` to protobuf ` parse() ` to keep original casing | ` false ` |
291
+ | ` prototypes.parser.keepCase ` | passes ` keepCase ` to protobuf ` parse() ` to keep original casing | ` true ` |
257
292
| ` prototypes.parser.alternateCommentMode ` | passes ` alternateCommentMode ` to protobuf ` parse() ` method | ` true ` |
258
293
| ` prototypes.parser.preferTrailingComment ` | passes ` preferTrailingComment ` to protobuf ` parse() ` method | ` false ` |
259
294
@@ -265,6 +300,27 @@ See [RPC Clients](#rpc-clients) for more info.
265
300
| ` tsDisable.patterns ` | if set, will include ` //@ts-nocheck ` on matched patterns | ` [] ` |
266
301
| ` tsDisable.files ` | if set, will include ` //@ts-nocheck ` on matched files | ` [] ` |
267
302
303
+ ### ESLint Disabling
304
+
305
+ | option | description | defaults |
306
+ | -------------------------------------------- | ---------------------------------------------------------------- | ---------|
307
+ | ` eslintDisable.disableAll ` | if true, will include ` /* eslint-disable */ ` on every output file | ` false ` |
308
+ | ` eslintDisable.patterns ` | if set, will include ` /* eslint-disable */ ` on matched patterns | ` [] ` |
309
+ | ` eslintDisable.files ` | if set, will include ` /* eslint-disable */ ` on matched files | ` [] ` |
310
+
311
+ ### Bundle
312
+
313
+ | option | description | defaults |
314
+ | ------------------------------ | -------------------------------------------------------------- | ---------- |
315
+ | ` bundle.enabled ` | bundle all files into a scoped index file | ` true ` |
316
+
317
+ ### Output
318
+
319
+ | option | description | defaults |
320
+ | ------------------------------ | ----------------------------------------------------------------- | ---------- |
321
+ | ` removeUnusedImports ` | removes unused imports | ` true ` |
322
+ | ` classesUseArrowFunctions ` | classes use arrow functions instead of ` bind() ` ing in constructors | ` false ` |
323
+
268
324
## Types
269
325
270
326
### Timestamp
@@ -369,12 +425,12 @@ To broadcast messages, you'll want to use either [keplr](https://docs.keplr.app/
369
425
Likely you'll want to use the Amino, so unless you need proto, you should use this one:
370
426
371
427
``` js
372
- import { getOfflineSigner as getOfflineSignerAmino } from ' @osmonauts/helpers ' ;
428
+ import { getOfflineSigner as getOfflineSignerAmino } from ' cosmjs-utils ' ;
373
429
```
374
430
### Proto Signer
375
431
376
432
``` js
377
- import { getOfflineSigner as getOfflineSignerProto } from ' @osmonauts/helpers ' ;
433
+ import { getOfflineSigner as getOfflineSignerProto } from ' cosmjs-utils ' ;
378
434
```
379
435
380
436
WARNING: NOT RECOMMENDED TO USE PLAIN-TEXT MNEMONICS. Please take care of your security and use best practices such as AES encryption and/or methods from 12factor applications.
@@ -457,13 +513,13 @@ const options: TelescopeOptions = {
457
513
This will generate a nice helper in the ` ClientFactory ` , which you can then use to query multiple modules from a single object:
458
514
459
515
``` js
460
- import { osmosis } from ' ./proto ' ;
516
+ import { osmosis } from ' ./codegen ' ;
461
517
462
518
const main = async () => {
463
519
const client = await osmosis .ClientFactory .createLCDClient ({ restEndpoint: REST_ENDPOINT });
464
520
465
521
// now you can query the modules
466
- const poolInfo = await client .osmosis .gamm .v1beta1 .pool ({ poolId: " 1" });
522
+ const pool = await client .osmosis .gamm .v1beta1 .pool ({ poolId: " 1" });
467
523
const balance = await client .cosmos .bank .v1beta1 .allBalances ({ address: ' osmo1addresshere' });
468
524
};
469
525
```
@@ -476,8 +532,8 @@ If you want to instantiate a single client, for any module that has a `Query` ty
476
532
import { osmosis } from " osmojs" ;
477
533
478
534
export const main = async () => {
479
- const LCDClient = osmosis . gamm . v1beta1 . LCDQueryClient ;
480
- const client = new LCDClient ({ restEndpoint : REST_ENDPOINT });
535
+ const requestClient = new LCDClient ({ restEndpoint : REST_ENDPOINT }) ;
536
+ const client = new osmosis.gamm.v1beta1.LCDQueryClient ({ requestClient });
481
537
const pools = await client .pools ();
482
538
console .log (pools);
483
539
};
@@ -529,8 +585,11 @@ This will generate helpers `createRPCQueryClient` and `createRPCTxClient` in the
529
585
import { osmosis } from ' ./proto' ;
530
586
531
587
const main = async () => {
532
- const query = await osmosis .ClientFactory .createRPCQueryClient ({ rpc });
533
- const tx = await osmosis .ClientFactory .createRPCMsgClient ({ rpc });
588
+ const client = await osmosis .ClientFactory .createRPCQueryClient ({ rpcEndpoint });
589
+
590
+ // now you can query the modules
591
+ const pool = await client .osmosis .gamm .v1beta1 .pool ({ poolId: " 1" });
592
+ const balance = await client .cosmos .bank .v1beta1 .allBalances ({ address: ' osmo1addresshere' });
534
593
};
535
594
```
536
595
@@ -548,7 +607,7 @@ const QueryClient = osmosis.gamm.v1beta1.QueryClientImpl;
548
607
const ServiceClient = cosmos .base .tendermint .v1beta1 .ServiceClientImpl ;
549
608
```
550
609
551
- Here is an example of making a query
610
+ Here is an example of making a query if you want to use the RPC client classes manually:
552
611
553
612
``` js
554
613
import { osmosis } from " osmojs" ;
@@ -638,14 +697,13 @@ const options: TelescopeOptions = {
638
697
639
698
If you don't use the boilerplate, you will need to manually install
640
699
641
- - ` @osmonauts/helpers `
642
700
- ` @cosmjs/amino `
643
701
- ` @cosmjs/proto-signing `
644
702
- ` @cosmjs/stargate `
645
703
- ` @cosmjs/tendermint-rpc `
646
704
647
705
``` sh
648
- yarn add @osmonauts/helpers @ cosmjs/amino @cosmjs/proto-signing @cosmjs/stargate @cosmjs/tendermint-rpc
706
+ yarn add @cosmjs/amino @cosmjs/proto-signing @cosmjs/stargate @cosmjs/tendermint-rpc
649
707
```
650
708
651
709
If you use the LCD Client generation, you'll need to add
@@ -717,7 +775,7 @@ Checkout these related projects:
717
775
718
776
## Credits
719
777
720
- 🛠 Built by Cosmology — if you like our tools, please consider delegating to [ our validator ⚛️] ( https://cosmology.tech/validator )
778
+ 🛠 Built by Cosmology — if you like our tools, please consider delegating to [ our validator ⚛️] ( https://cosmology.tech/validator )
721
779
722
780
Thanks to these engineers, teams and projects for inspiring Telescope:
723
781
@@ -732,4 +790,4 @@ Thanks to these engineers, teams and projects for inspiring Telescope:
732
790
733
791
AS DESCRIBED IN THE TELESCOPE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
734
792
735
- No developer or entity involved in creating Telescope will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the Telescope code or Telescope CLI, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.
793
+ No developer or entity involved in creating Telescope will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the Telescope code or Telescope CLI, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.
0 commit comments