@hyperweb/telescope 1.15.0 → 1.15.1
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/README.md +208 -181
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Telescope 🔭
|
|
2
2
|
|
|
3
|
+
> ⚠️ **Important**: Please upgrade to `@hyperweb/telescope` to leverage new features like generating MCP servers and agents for AI-powered blockchain interactions!
|
|
4
|
+
|
|
3
5
|
<p align="center">
|
|
4
6
|
<img width="280" src="https://user-images.githubusercontent.com/545047/175660665-5cbde84b-0928-4e59-ab56-be6adb2f3a7e.png"/>
|
|
5
7
|
</p>
|
|
@@ -24,9 +26,9 @@
|
|
|
24
26
|
<img src="https://user-images.githubusercontent.com/545047/178129981-5a7d18ed-d2b5-4d85-b828-ca084d38501e.png"/>
|
|
25
27
|
</p>
|
|
26
28
|
|
|
27
|
-
Telescope
|
|
29
|
+
Telescope is a TypeScript Transpiler for Cosmos Protobufs. It generates strongly-typed TypeScript libraries for Cosmos blockchains, providing developers with type-safe interfaces to build applications. Think of Telescope as "Babel for the Cosmos" - simply point to your protobuf files and generate fully-typed libraries for building dApps.
|
|
28
30
|
|
|
29
|
-
The following blockchain libraries (generated by Telescope) are available via npm
|
|
31
|
+
The following blockchain libraries (generated by Telescope) are available via npm:
|
|
30
32
|
|
|
31
33
|
* [osmojs](https://www.npmjs.com/package/osmojs)
|
|
32
34
|
* [dydx](https://www.npmjs.com/package/@dydxprotocol/v4-client-js)
|
|
@@ -36,7 +38,7 @@ The following blockchain libraries (generated by Telescope) are available via np
|
|
|
36
38
|
* [injectivejs](https://www.npmjs.com/package/injectivejs)
|
|
37
39
|
* [quicksilverjs](https://www.npmjs.com/package/quicksilverjs)
|
|
38
40
|
|
|
39
|
-
🎥 [
|
|
41
|
+
🎥 [Check out our video course](https://cosmology.zone/learn/telescope) to learn how to use `telescope`!
|
|
40
42
|
|
|
41
43
|
## Table of contents
|
|
42
44
|
|
|
@@ -50,7 +52,7 @@ The following blockchain libraries (generated by Telescope) are available via np
|
|
|
50
52
|
- [Build](#build)
|
|
51
53
|
- [Publishing](#publishing)
|
|
52
54
|
- [Usage](#usage)
|
|
53
|
-
- [
|
|
55
|
+
- [Programmatic Usage](#programmatic-usage)
|
|
54
56
|
- [Options](#options)
|
|
55
57
|
- [Amino Encoding](#amino-encoding)
|
|
56
58
|
- [Implemented Interface Options](#implemented-interface-options)
|
|
@@ -66,11 +68,12 @@ The following blockchain libraries (generated by Telescope) are available via np
|
|
|
66
68
|
- [Mobx](#mobx)
|
|
67
69
|
- [Pinia](#pinia)
|
|
68
70
|
- [Vue Query](#vue-query)
|
|
69
|
-
- [Typings and
|
|
71
|
+
- [Typings and Formatting](#typings-and-formatting)
|
|
70
72
|
- [Protobuf parser](#protobuf-parser)
|
|
71
73
|
- [Typescript Disabling](#typescript-disabling)
|
|
72
74
|
- [ESLint Disabling](#eslint-disabling)
|
|
73
75
|
- [Bundle](#bundle)
|
|
76
|
+
- [MCP Server](#mcp-server)
|
|
74
77
|
- [Output](#output)
|
|
75
78
|
- [Types](#types)
|
|
76
79
|
- [Timestamp](#timestamp)
|
|
@@ -81,7 +84,7 @@ The following blockchain libraries (generated by Telescope) are available via np
|
|
|
81
84
|
- [Creating Signers](#creating-signers)
|
|
82
85
|
- [Amino Signer](#amino-signer)
|
|
83
86
|
- [Proto Signer](#proto-signer)
|
|
84
|
-
- [Broadcasting
|
|
87
|
+
- [Broadcasting Messages](#broadcasting-messages)
|
|
85
88
|
- [LCD Clients](#lcd-clients)
|
|
86
89
|
- [LCD Clients Classes](#lcd-clients-classes)
|
|
87
90
|
- [RPC Clients](#rpc-clients)
|
|
@@ -90,7 +93,7 @@ The following blockchain libraries (generated by Telescope) are available via np
|
|
|
90
93
|
- [gRPC-gateway Client](#grpc-gateway-client)
|
|
91
94
|
- [RPC Client Classes](#rpc-client-classes)
|
|
92
95
|
- [Instant RPC Methods](#instant-rpc-methods)
|
|
93
|
-
- [Manually
|
|
96
|
+
- [Manually Registering Types](#manually-registering-types)
|
|
94
97
|
- [JSON Patch Protos](#json-patch-protos)
|
|
95
98
|
- [CosmWasm](#cosmwasm)
|
|
96
99
|
- [Helper Functions Configuration](#helper-functions-configuration)
|
|
@@ -109,7 +112,7 @@ The following blockchain libraries (generated by Telescope) are available via np
|
|
|
109
112
|
|
|
110
113
|
## Quickstart
|
|
111
114
|
|
|
112
|
-
Follow the instructions below to generate a new
|
|
115
|
+
Follow the instructions below to generate a new TypeScript package that you can publish to npm. You can also follow the video tutorial: https://youtu.be/iQf6p65fbdY
|
|
113
116
|
|
|
114
117
|
`create-interchain-app`
|
|
115
118
|
```sh
|
|
@@ -125,66 +128,69 @@ Use the [`create-interchain-app`](https://github.com/hyperweb-io/create-intercha
|
|
|
125
128
|
cia --boilerplate telescope
|
|
126
129
|
```
|
|
127
130
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
If some required options are missing, it will prompt to ask for the info.
|
|
131
|
+
Next, navigate to the `./your-project/packages/telescope` directory to continue.
|
|
131
132
|
|
|
132
|
-
|
|
133
|
+
If any required options are missing, the CLI will prompt you for the necessary information.
|
|
133
134
|
|
|
134
|
-
|
|
135
|
+
For detailed CLI `generate` commands, please refer to our documentation.
|
|
135
136
|
|
|
136
|
-
|
|
137
|
+
### Download Protos
|
|
137
138
|
|
|
138
|
-
You can
|
|
139
|
+
You can download proto files using the `download-protos` command provided in the boilerplate:
|
|
139
140
|
|
|
140
141
|
```sh
|
|
141
142
|
yarn download-protos
|
|
142
143
|
```
|
|
143
144
|
|
|
144
|
-
|
|
145
|
+
After running this command, you'll see:
|
|
146
|
+
- Cloned repositories in `./git-modules`
|
|
147
|
+
- Proto files in `./protos`
|
|
145
148
|
|
|
146
|
-
For detailed
|
|
149
|
+
These proto files are downloaded based on your configuration. For detailed CLI `download` commands, please refer to our documentation.
|
|
147
150
|
|
|
148
151
|
### Transpile
|
|
149
152
|
|
|
150
|
-
To
|
|
153
|
+
To generate TypeScript files for your chain, run the `yarn codegen` command:
|
|
151
154
|
|
|
152
|
-
```
|
|
155
|
+
```sh
|
|
153
156
|
yarn codegen
|
|
154
157
|
```
|
|
155
158
|
|
|
156
159
|
### Build
|
|
157
160
|
|
|
158
|
-
Finally,
|
|
161
|
+
Finally, build your package to generate JavaScript files and TypeScript definitions:
|
|
159
162
|
|
|
160
163
|
```sh
|
|
164
|
+
yarn install
|
|
161
165
|
yarn build
|
|
162
166
|
```
|
|
163
167
|
|
|
164
168
|
### Publishing
|
|
165
169
|
|
|
166
|
-
|
|
170
|
+
Your generated code is now in the `./src` folder, ready for publishing. If you used the `create-interchain-app` boilerplate, use `lerna` to publish (refer to the boilerplate's README for detailed instructions). Alternatively, run `npm publish` from your repository.
|
|
167
171
|
|
|
168
172
|
# Usage
|
|
169
173
|
|
|
170
174
|
## Advanced Install
|
|
171
|
-
|
|
175
|
+
|
|
176
|
+
The following sections describe various methods to install and use Telescope.
|
|
172
177
|
|
|
173
178
|
### Telescope CLI
|
|
174
|
-
|
|
179
|
+
|
|
180
|
+
Install Telescope globally:
|
|
175
181
|
```sh
|
|
176
182
|
npm install -g @hyperweb/telescope
|
|
177
183
|
```
|
|
178
|
-
The
|
|
184
|
+
The workflow consists of three steps: generate, download, and transpile.
|
|
179
185
|
|
|
180
|
-
1.Generate a package with the
|
|
186
|
+
#### 1. Generate a package with the Telescope CLI
|
|
181
187
|
|
|
182
|
-
Use
|
|
188
|
+
Use the interactive prompt:
|
|
183
189
|
```sh
|
|
184
190
|
telescope generate
|
|
185
191
|
```
|
|
186
192
|
|
|
187
|
-
Or
|
|
193
|
+
Or use command-line options for non-interactive setup:
|
|
188
194
|
```sh
|
|
189
195
|
telescope generate --access public --userfullname "Your Name" --useremail "your@email.com" --module-desc "Your module description" --username "your-username" --license MIT --module-name "your-module" --chain-name cosmos --use-npm-scoped
|
|
190
196
|
```
|
|
@@ -200,7 +206,7 @@ Available options:
|
|
|
200
206
|
- `--use-npm-scoped`: Use npm scoped package (only works with `--access public`)
|
|
201
207
|
- `--license`: License type
|
|
202
208
|
|
|
203
|
-
2.Download protocol buffer files
|
|
209
|
+
#### 2. Download protocol buffer files
|
|
204
210
|
```sh
|
|
205
211
|
telescope download
|
|
206
212
|
```
|
|
@@ -235,23 +241,24 @@ protod.config.json example:
|
|
|
235
241
|
}
|
|
236
242
|
```
|
|
237
243
|
|
|
238
|
-
Download from a specific
|
|
244
|
+
Download from a specific repository:
|
|
239
245
|
```sh
|
|
240
246
|
telescope download --git-repo owner/repository --targets cosmos/auth/v1beta1/auth.proto
|
|
241
247
|
```
|
|
242
248
|
|
|
243
|
-
3. Transpile (Generate TypeScript code from proto files)
|
|
244
|
-
|
|
249
|
+
#### 3. Transpile (Generate TypeScript code from proto files)
|
|
250
|
+
|
|
251
|
+
Use default Telescope options:
|
|
245
252
|
```sh
|
|
246
253
|
telescope transpile
|
|
247
254
|
```
|
|
248
255
|
|
|
249
|
-
Use
|
|
256
|
+
Use a custom configuration file:
|
|
250
257
|
```sh
|
|
251
258
|
telescope transpile --config telescope-config.json
|
|
252
259
|
```
|
|
253
260
|
|
|
254
|
-
telescope-config.json
|
|
261
|
+
Example `telescope-config.json`:
|
|
255
262
|
```json
|
|
256
263
|
{
|
|
257
264
|
"protoDirs": [
|
|
@@ -341,12 +348,14 @@ telescope-config.json exmaple:
|
|
|
341
348
|
}
|
|
342
349
|
```
|
|
343
350
|
|
|
344
|
-
### CIA
|
|
345
|
-
|
|
346
|
-
|
|
351
|
+
### Create Interchain App (CIA)
|
|
352
|
+
|
|
353
|
+
Please follow the video tutorial: https://youtu.be/iQf6p65fbdY
|
|
354
|
+
Or see the [Quickstart](#quickstart) section.
|
|
347
355
|
|
|
348
|
-
### CCA
|
|
349
|
-
|
|
356
|
+
### Create Cosmos App (CCA)
|
|
357
|
+
|
|
358
|
+
First, install `create-cosmos-app`:
|
|
350
359
|
|
|
351
360
|
```sh
|
|
352
361
|
npm install -g create-cosmos-app
|
|
@@ -358,35 +367,35 @@ Use the [`create-cosmos-app`](https://github.com/hyperweb-io/create-cosmos-app/)
|
|
|
358
367
|
cca --boilerplate telescope
|
|
359
368
|
```
|
|
360
369
|
|
|
361
|
-
|
|
370
|
+
Next, navigate to the `./your-project/packages/telescope` directory.
|
|
362
371
|
|
|
363
|
-
Install
|
|
372
|
+
Install dependencies and download the proto files you need:
|
|
364
373
|
```sh
|
|
365
374
|
yarn install
|
|
366
375
|
telescope download --config ./your.config.json
|
|
367
376
|
```
|
|
368
377
|
|
|
369
|
-
|
|
378
|
+
Generate TypeScript files for your chain:
|
|
370
379
|
|
|
371
380
|
```sh
|
|
372
381
|
yarn codegen
|
|
373
382
|
```
|
|
374
383
|
|
|
375
|
-
### Manual
|
|
376
|
-
If you want to use telescope in your own project.
|
|
384
|
+
### Manual Install
|
|
377
385
|
|
|
378
|
-
|
|
386
|
+
To use Telescope in an existing project, run the following command in your project directory:
|
|
379
387
|
```sh
|
|
380
388
|
yarn add --dev @hyperweb/telescope
|
|
381
389
|
```
|
|
382
|
-
|
|
390
|
+
Also install the required helpers and CosmJS [dependencies listed here](#dependencies).
|
|
383
391
|
|
|
384
|
-
We
|
|
392
|
+
We recommend using [Programmatic Usage](#programmatic-usage) for better integration.
|
|
385
393
|
|
|
386
|
-
You can also use [
|
|
387
|
-
|
|
394
|
+
You can also use the [Telescope CLI](#telescope-cli). When using CLI commands within your project, prefix them with `npx` or `yarn`. For example:
|
|
395
|
+
- `yarn telescope generate`
|
|
396
|
+
- `npx telescope download`
|
|
388
397
|
|
|
389
|
-
###
|
|
398
|
+
### Programmatic Usage
|
|
390
399
|
|
|
391
400
|
First add telescope to your `devDependencies`:
|
|
392
401
|
|
|
@@ -394,9 +403,9 @@ First add telescope to your `devDependencies`:
|
|
|
394
403
|
yarn add --dev @hyperweb/telescope
|
|
395
404
|
```
|
|
396
405
|
|
|
397
|
-
Install helpers and
|
|
406
|
+
Install the required helpers and CosmJS [dependencies listed here](#dependencies).
|
|
398
407
|
|
|
399
|
-
Download
|
|
408
|
+
#### Download Command Example
|
|
400
409
|
```js
|
|
401
410
|
import downloadProtos from '@hyperweb/telescope/main/commands/download'
|
|
402
411
|
|
|
@@ -428,7 +437,7 @@ downloadProtos(config)
|
|
|
428
437
|
});
|
|
429
438
|
```
|
|
430
439
|
|
|
431
|
-
Transpile
|
|
440
|
+
#### Transpile Command Example
|
|
432
441
|
```js
|
|
433
442
|
import { join } from 'path';
|
|
434
443
|
import telescope from '@hyperweb/telescope';
|
|
@@ -491,81 +500,81 @@ telescope({
|
|
|
491
500
|
|
|
492
501
|
| option | description | defaults |
|
|
493
502
|
| ------------------------------ | -------------------------------------------------------------- | ---------- |
|
|
494
|
-
| `aminoEncoding.enabled` |
|
|
495
|
-
| `aminoEncoding.omitEmptyTags`
|
|
496
|
-
| `aminoEncoding.disableMsgTypes` |
|
|
497
|
-
| `aminoEncoding.casingFn` |
|
|
498
|
-
| `aminoEncoding.exceptions` |
|
|
499
|
-
| `aminoEncoding.typeUrlToAmino` |
|
|
500
|
-
| `aminoEncoding.useLegacyInlineEncoding` | @deprecated.
|
|
501
|
-
| `aminoEncoding.useRecursiveV2encoding` |
|
|
502
|
-
| `aminoEncoding.legacy.useNullHandling` |
|
|
503
|
-
| `aminoEncoding.legacy.useOmitEmpty` |
|
|
503
|
+
| `aminoEncoding.enabled` | Generate amino types and amino converters | `true` |
|
|
504
|
+
| `aminoEncoding.omitEmptyTags` | Array of strings that determines whether a field should be omitted when serialized to JSON. If the array includes "omitempty", any field with the "omitempty" option in either gogoproto.jsontag or cosmos_proto.json_tag will be omitted. If the array includes "dont_omitempty", the field will be omitted or not based on the value of "(amino.dont_omitempty)": if it's null or false, the field will be omitted; if it's true, the field will not be omitted. | `["omitempty", "dont_omitempty"]` |
|
|
505
|
+
| `aminoEncoding.disableMsgTypes` | Disable generating AminoMsg types | `false` |
|
|
506
|
+
| `aminoEncoding.casingFn` | Set the amino-casing function for a project | `snake()` |
|
|
507
|
+
| `aminoEncoding.exceptions` | Set specific aminoType name exceptions | see code |
|
|
508
|
+
| `aminoEncoding.typeUrlToAmino` | Create functions for aminoType name exceptions | `undefined`|
|
|
509
|
+
| `aminoEncoding.useLegacyInlineEncoding` | @deprecated. Use legacy inline encoding instead of v2 recursive encoding | `false`|
|
|
510
|
+
| `aminoEncoding.useRecursiveV2encoding` | This option has been removed. See `useLegacyInlineEncoding` instead. | |
|
|
511
|
+
| `aminoEncoding.legacy.useNullHandling` | Handle null cases when generating legacy amino converters (those in tx.amino.ts) | |
|
|
512
|
+
| `aminoEncoding.legacy.useOmitEmpty` | Handle omit empty behavior when generating legacy amino converters (those in tx.amino.ts) | |
|
|
504
513
|
|
|
505
514
|
### Implemented Interface Options
|
|
506
515
|
|
|
507
516
|
| option | description | defaults |
|
|
508
517
|
| ----------------------------------------- | -------------------------------------------------------------- | ---------- |
|
|
509
|
-
| `interfaces.enabled` |
|
|
510
|
-
| `interfaces.useGlobalDecoderRegistry`
|
|
511
|
-
| `interfaces.useUseInterfacesParams`
|
|
512
|
-
| `interfaces.useByDefault` |
|
|
513
|
-
| `interfaces.useByDefaultRpc`
|
|
514
|
-
| `interfaces.useUnionTypes` | Generate Any type as union types(TextProposal \| RegisterIncentiveProposal) instead of intersection types(TextProposal & RegisterIncentiveProposal)
|
|
518
|
+
| `interfaces.enabled` | Enable converters between Any type and specific implemented interfaces | `true` |
|
|
519
|
+
| `interfaces.useGlobalDecoderRegistry` | Enable GlobalDecoderRegistry and related functions. Highly recommended when dealing with fields with 'accepted_interface' option. See 'packages/telescope/__tests__/impl-interfaces.test.ts' for usage. | `false` |
|
|
520
|
+
| `interfaces.useUseInterfacesParams` | Add `useInterfaces` argument to `decode` and `toAmino` functions | `false` |
|
|
521
|
+
| `interfaces.useByDefault` | Use interface decoders by default (default for `useInterfaces` argument to `decode` and `toAmino` functions) | `true` |
|
|
522
|
+
| `interfaces.useByDefaultRpc` | Use interface decoders by default in RPC clients | `true` |
|
|
523
|
+
| `interfaces.useUnionTypes` | Generate Any type as union types (TextProposal \| RegisterIncentiveProposal) instead of intersection types (TextProposal & RegisterIncentiveProposal) | `false` |
|
|
515
524
|
|
|
516
525
|
### Prototypes Options
|
|
517
526
|
|
|
518
527
|
| option | description | defaults |
|
|
519
528
|
| ----------------------------------------- |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------|
|
|
520
|
-
| `prototypes.enabled` |
|
|
521
|
-
| `prototypes.includePackageVar` |
|
|
522
|
-
| `prototypes.includes.packages` |
|
|
523
|
-
| `prototypes.includes.protos` |
|
|
524
|
-
| `prototypes.excluded.packages` |
|
|
525
|
-
| `prototypes.excluded.protos` |
|
|
526
|
-
| `prototypes.excluded.hardProtos`
|
|
527
|
-
| `prototypes.fieldDefaultIsOptional` |
|
|
528
|
-
| `prototypes.useOptionalNullable` |
|
|
529
|
-
| `prototypes.allowUndefinedTypes` |
|
|
530
|
-
| `prototypes.allowEncodeDefaultScalars`
|
|
531
|
-
| `prototypes.isScalarDefaultToNullable`
|
|
532
|
-
| `prototypes.enforceNullCheck`
|
|
533
|
-
| `prototypes.optionalQueryParams` |
|
|
534
|
-
| `prototypes.optionalPageRequests` |
|
|
535
|
-
| `prototypes.addTypeUrlToDecoders` |
|
|
536
|
-
| `prototypes.addAminoTypeToObjects`
|
|
537
|
-
| `prototypes.addTypeUrlToObjects`
|
|
538
|
-
| `prototypes.enableRegistryLoader` |
|
|
539
|
-
| `prototypes.enableMessageComposer`
|
|
540
|
-
| `prototypes.patch`
|
|
529
|
+
| `prototypes.enabled` | Enable generation of proto encoding methods | `true` |
|
|
530
|
+
| `prototypes.includePackageVar` | Export a `protoPackage` variable to indicate package name | `false` |
|
|
531
|
+
| `prototypes.includes.packages` | Include a set of packages during transpilation (if a package meets both include and exclude, it will be excluded) | `undefined` |
|
|
532
|
+
| `prototypes.includes.protos` | Include a set of proto files during transpilation (if a proto meets both include and exclude, it will be excluded) | `undefined` |
|
|
533
|
+
| `prototypes.excluded.packages` | Exclude a set of packages from transpilation | `undefined` |
|
|
534
|
+
| `prototypes.excluded.protos` | Try to exclude a set of proto files from transpilation. If files in the list are dependencies to other files, they will still be transpiled. | `undefined` |
|
|
535
|
+
| `prototypes.excluded.hardProtos` | Exclude a set of proto files from transpilation. Files in this list will be excluded regardless of dependencies. | `undefined` |
|
|
536
|
+
| `prototypes.fieldDefaultIsOptional` | Set default optionality of fields | `false` |
|
|
537
|
+
| `prototypes.useOptionalNullable` | Use `(gogoproto.nullable)` values in determining optionality | `true` |
|
|
538
|
+
| `prototypes.allowUndefinedTypes` | Allow `Type`s to be `undefined` | `false` |
|
|
539
|
+
| `prototypes.allowEncodeDefaultScalars` | Allow encoders to encode default values of scalar types (e.g., empty string, 0, or false) | `false` |
|
|
540
|
+
| `prototypes.isScalarDefaultToNullable` | Determine whether scalar types are nullable by default when gogoproto.nullable is not specified. If true, scalar types will be nullable; if false, they will be required | `false` |
|
|
541
|
+
| `prototypes.enforceNullCheck` | Enforce checking that required scalar fields are not null or undefined during encoding | `false` |
|
|
542
|
+
| `prototypes.optionalQueryParams` | Make queryParams optional | `false` |
|
|
543
|
+
| `prototypes.optionalPageRequests` | Make `PageRequest` fields optional | `false` |
|
|
544
|
+
| `prototypes.addTypeUrlToDecoders` | Add $typeUrl field to generated interfaces | `true` |
|
|
545
|
+
| `prototypes.addAminoTypeToObjects` | Add aminoType field to generated Decoders | `false` |
|
|
546
|
+
| `prototypes.addTypeUrlToObjects` | Add typeUrl field to generated Decoders | `true` |
|
|
547
|
+
| `prototypes.enableRegistryLoader` | Generate Registry loader in *.registry.ts files | `true` |
|
|
548
|
+
| `prototypes.enableMessageComposer` | Generate MessageComposer in *.registry.ts files | `true` |
|
|
549
|
+
| `prototypes.patch` | Object mapping filenames to an array of `Operation` to be applied as patches to proto files during generation. See [JSON Patch Protos](#json-patch-protos) | `undefined` |
|
|
541
550
|
|
|
542
551
|
### Prototypes Methods
|
|
543
552
|
|
|
544
553
|
| option | description | defaults|
|
|
545
554
|
| ---------------------------------- | ----------------------------------------------------------------- | ------- |
|
|
546
|
-
| `prototypes.methods.encode` |
|
|
547
|
-
| `prototypes.methods.decode` |
|
|
548
|
-
| `prototypes.methods.fromJSON` |
|
|
549
|
-
| `prototypes.methods.toJSON` |
|
|
550
|
-
| `prototypes.methods.fromPartial` |
|
|
551
|
-
| `prototypes.methods.fromSDK` |
|
|
552
|
-
| `prototypes.methods.toSDK` |
|
|
555
|
+
| `prototypes.methods.encode` | Enable `encode` method on proto objects | `true` |
|
|
556
|
+
| `prototypes.methods.decode` | Enable `decode` method on proto objects | `true` |
|
|
557
|
+
| `prototypes.methods.fromJSON` | Enable `fromJSON` method on proto objects | `true` |
|
|
558
|
+
| `prototypes.methods.toJSON` | Enable `toJSON` method on proto objects | `true` |
|
|
559
|
+
| `prototypes.methods.fromPartial` | Enable `fromPartial` method on proto objects | `true` |
|
|
560
|
+
| `prototypes.methods.fromSDK` | Enable `fromSDK` method on proto objects | `false` |
|
|
561
|
+
| `prototypes.methods.toSDK` | Enable `toSDK` method on proto objects | `false` |
|
|
553
562
|
|
|
554
563
|
### Enums Options
|
|
555
564
|
|
|
556
565
|
| option | description | defaults |
|
|
557
566
|
| ------------------------------------- | --------------------------------------------------------------- | ---------- |
|
|
558
|
-
| `enums.useCustomNames` |
|
|
567
|
+
| `enums.useCustomNames` | Enable usage of custom names for enums if specified through proto options or annotations, allowing for more descriptive or project-specific naming conventions | `false` |
|
|
559
568
|
|
|
560
569
|
|
|
561
570
|
### LCD Client Options
|
|
562
571
|
|
|
563
572
|
| option | description | defaults |
|
|
564
573
|
| ------------------------------ | -------------------------------------------------------------- | ---------- |
|
|
565
|
-
| `lcdClients.enabled` |
|
|
566
|
-
| `lcdClients.bundle` |
|
|
567
|
-
| `lcdClients.scoped` |
|
|
568
|
-
| `lcdClients.scopedIsExclusive` |
|
|
574
|
+
| `lcdClients.enabled` | Generate LCD clients that can query proto `Query` messages | `true` |
|
|
575
|
+
| `lcdClients.bundle` | Generate factory bundle aggregate of all LCD Clients | `true` |
|
|
576
|
+
| `lcdClients.scoped` | Generate factory of scoped LCD Clients | `undefined`|
|
|
577
|
+
| `lcdClients.scopedIsExclusive` | Allow both scoped bundles and all RPC Clients | `true` |
|
|
569
578
|
|
|
570
579
|
See [LCD Clients](#lcd-clients) for more info.
|
|
571
580
|
|
|
@@ -573,22 +582,22 @@ See [LCD Clients](#lcd-clients) for more info.
|
|
|
573
582
|
|
|
574
583
|
| option | description | defaults |
|
|
575
584
|
| ------------------------------ | ---------------------------------------------------------------------- | ----------------------------- |
|
|
576
|
-
| `rpcClients.type` |
|
|
577
|
-
| `rpcClients.enabled` |
|
|
578
|
-
| `rpcClients.bundle` |
|
|
579
|
-
| `rpcClients.camelCase` |
|
|
580
|
-
| `rpcClients.scoped` |
|
|
581
|
-
| `rpcClients.scopedIsExclusive` |
|
|
582
|
-
| `rpcClients.enabledServices` |
|
|
583
|
-
| `rpcClients.instantOps`
|
|
584
|
-
| `rpcClients.useConnectComet`
|
|
585
|
-
| `rpcClients.useMakeClient`
|
|
586
|
-
| `rpcClients.serviceImplement`
|
|
587
|
-
|
|
585
|
+
| `rpcClients.type` | Generate this type of RPC client (`tendermint`, `gRPC-web`, `gRPC`)| `tendermint` |
|
|
586
|
+
| `rpcClients.enabled` | Generate RPC clients that can interact with proto messages | `true` |
|
|
587
|
+
| `rpcClients.bundle` | Generate factory bundle aggregate of all RPC Clients | `true` |
|
|
588
|
+
| `rpcClients.camelCase` | Use camel-case for RPC methods when generating RPC clients | `true` |
|
|
589
|
+
| `rpcClients.scoped` | Generate factory of scoped RPC Clients | `undefined` |
|
|
590
|
+
| `rpcClients.scopedIsExclusive` | Allow both scoped bundles and all RPC Clients | `true` |
|
|
591
|
+
| `rpcClients.enabledServices` | Which services to enable | [`Msg`,`Query`,`Service`] |
|
|
592
|
+
| `rpcClients.instantOps` | Generate instant RPC operations in the file `service-ops.ts` under root folder, which contains customized classes having selected RPC methods | `undefined` |
|
|
593
|
+
| `rpcClients.useConnectComet` | Use connectComet function to get a tendermint client | `undefined` |
|
|
594
|
+
| `rpcClients.useMakeClient` | Allow user to pass a query client resolver to create query client in createRPCQueryClient function | `undefined` |
|
|
595
|
+
| `rpcClients.serviceImplement` | Assign implement type of RPC methods, `Query` or `Tx`, by setting patterns under service types | `undefined` |
|
|
596
|
+
| `rpcClients.clientStyle.useUpdatedClientStyle` | The default value is `false`, which sets the generated client to use the legacy style. Setting it to `true` applies the updated style and activates the remaining options in clientStyle. | `false`
|
|
588
597
|
| `rpcClients.clientStyle.type` | A string array containing possible values: `all-client`, `sdk-module-client`, and `custom-client`. The value `all-client` generates an all-module-client file. The value `sdk-module-client` generates a client for the module specified by the `sdkModuleClientOption`. The value `custom-client` generates a customized client as specified by `customClientOption` | `undefined`
|
|
589
|
-
`rpcClients.clientStyle.customClientOption.name` |
|
|
590
|
-
| `rpcClients.clientStyle.customClientOption.fileName` |
|
|
591
|
-
| `rpcClients.clientStyle.customClientOption.include.patterns` |
|
|
598
|
+
| `rpcClients.clientStyle.customClientOption.name` | Assign the client name like `{name}AminoConverters`, `get{name}SigningClient` etc | `undefined`
|
|
599
|
+
| `rpcClients.clientStyle.customClientOption.fileName` | Assign the file name of generated client in root directory | `undefined`
|
|
600
|
+
| `rpcClients.clientStyle.customClientOption.include.patterns` | Determine which proto files will be imported for the current client such as `cosmos.gov.v1beta1.**` | `undefined`
|
|
592
601
|
|
|
593
602
|
See [RPC Clients](#rpc-clients) for more info.
|
|
594
603
|
|
|
@@ -615,8 +624,8 @@ See [Helper Functions Configuration](#helper-functions-configuration) for more i
|
|
|
615
624
|
|
|
616
625
|
| option | description | defaults |
|
|
617
626
|
| -------------------------------------------- | -------------------------------------------------------------- | ---------|
|
|
618
|
-
| `stargateClients.includeCosmosDefaultTypes` |
|
|
619
|
-
| `stargateClients.addGetTxRpc` |
|
|
627
|
+
| `stargateClients.includeCosmosDefaultTypes` | Include the CosmJS defaults with stargate clients | `true` (except cosmos package) |
|
|
628
|
+
| `stargateClients.addGetTxRpc` | Add getSigningTxRpc to clients in namespaces | `false` |
|
|
620
629
|
|
|
621
630
|
### State Management
|
|
622
631
|
|
|
@@ -624,97 +633,111 @@ See [Helper Functions Configuration](#helper-functions-configuration) for more i
|
|
|
624
633
|
|
|
625
634
|
| option | description | defaults |
|
|
626
635
|
| -------------------------------- | ---------------------------------------------------------------------- | ---------|
|
|
627
|
-
| `reactQuery.enabled` |
|
|
628
|
-
| `reactQuery.needExtraQueryKey`
|
|
629
|
-
| `reactQuery.include.protos` |
|
|
630
|
-
| `reactQuery.include.packages` |
|
|
631
|
-
| `reactQuery.include.patterns` |
|
|
632
|
-
| `reactQuery.instantExport.include.patterns` |
|
|
633
|
-
| `reactQuery.instantExport.nameMapping` |
|
|
636
|
+
| `reactQuery.enabled` | Create React hooks that use `@tanstack/react-query` hooks | `false` |
|
|
637
|
+
| `reactQuery.needExtraQueryKey` | Allow users to input extra React Query key to customized hooks (e.g., ['rpcEndpoint', 'yourExtraKey']) | `false` |
|
|
638
|
+
| `reactQuery.include.protos` | Create hooks on matched proto filenames or patterns using minimatch | `[]` |
|
|
639
|
+
| `reactQuery.include.packages` | Create hooks on matched packages files using minimatch | `[]` |
|
|
640
|
+
| `reactQuery.include.patterns` | Create hooks on matched patterns of files using minimatch (deprecated in favor of packages and protos) | `[]` |
|
|
641
|
+
| `reactQuery.instantExport.include.patterns` | Expose instant hooks on matched patterns of packages + method (e.g., cosmos.bank.v1beta1.useBalance) using minimatch. If there are duplicated method names in multiple packages without setting `reactQuery.instantExport.nameMapping`, one duplicated name will be created like: useCosmosBankV1beta1Balance | `[]` |
|
|
642
|
+
| `reactQuery.instantExport.nameMapping` | Map an alias to a package + method for better naming of duplicated method names (e.g., useBankBalance: cosmos.bank.v1beta1.useBalance). Customized hook name is set in front of pkg+method to prevent duplicate aliases. | `{}` |
|
|
634
643
|
|
|
635
644
|
#### Mobx
|
|
636
645
|
|
|
637
646
|
| option | description | defaults |
|
|
638
647
|
| -------------------------------- | ---------------------------------------------------------------------- | ---------|
|
|
639
|
-
| `mobx.enabled` |
|
|
640
|
-
| `mobx.include.protos`
|
|
641
|
-
| `mobx.include.packages`
|
|
642
|
-
| `mobx.include.patterns`
|
|
648
|
+
| `mobx.enabled` | Create MobX stores that use `mobx` | `false` |
|
|
649
|
+
| `mobx.include.protos` | Create MobX stores on matched proto filenames or patterns using minimatch | `[]` |
|
|
650
|
+
| `mobx.include.packages` | Create MobX stores on matched packages files using minimatch | `[]` |
|
|
651
|
+
| `mobx.include.patterns` | Create MobX stores on matched patterns of proto files using minimatch (deprecated in favor of packages and protos) | `[]` |
|
|
643
652
|
|
|
644
653
|
#### Pinia
|
|
645
654
|
|
|
646
655
|
| option | description | defaults |
|
|
647
656
|
| -------------------------------- | ---------------------------------------------------------------------- | ---------|
|
|
648
|
-
| `pinia.enabled` |
|
|
649
|
-
| `
|
|
650
|
-
| `
|
|
651
|
-
| `
|
|
657
|
+
| `pinia.enabled` | Create Pinia stores that use `pinia` | `false` |
|
|
658
|
+
| `pinia.include.protos` | Create Pinia stores on matched proto filenames or patterns using minimatch | `[]` |
|
|
659
|
+
| `pinia.include.packages` | Create Pinia stores on matched packages files using minimatch | `[]` |
|
|
660
|
+
| `pinia.include.patterns` | Create Pinia stores on matched patterns of proto files using minimatch (deprecated in favor of packages and protos) | `[]` |
|
|
652
661
|
|
|
653
662
|
#### Vue Query
|
|
654
663
|
| option | description | defaults |
|
|
655
664
|
| -------------------------------- | ---------------------------------------------------------------------- | ---------|
|
|
656
|
-
| `vueQuery.enabled` |
|
|
657
|
-
| `vueQuery.include.protos` |
|
|
658
|
-
| `vueQuery.include.packages` |
|
|
665
|
+
| `vueQuery.enabled` | Create Vue composables that use `@tanstack/vue-query` composables | `false` |
|
|
666
|
+
| `vueQuery.include.protos` | Create composables on matched proto filenames or patterns using minimatch | `[]` |
|
|
667
|
+
| `vueQuery.include.packages` | Create composables on matched packages files using minimatch | `[]` |
|
|
659
668
|
|
|
660
|
-
### Typings and
|
|
669
|
+
### Typings and Formatting
|
|
661
670
|
|
|
662
671
|
| option | description | defaults |
|
|
663
672
|
| ----------------------------------------- | -------------------------------------------------------------- | --------- |
|
|
664
|
-
| `prototypes.typingsFormat.customTypes.useCosmosSDKDec` |
|
|
665
|
-
| `prototypes.typingsFormat.customTypes.useEnhancedDecimal` |
|
|
666
|
-
| `prototypes.typingsFormat.customTypes.base64Lib` |
|
|
667
|
-
| `prototypes.typingsFormat.num64` | 'long' or 'bigint', the way of generating int64 proto types
|
|
668
|
-
| `prototypes.typingsFormat.useTelescopeGeneratedType` |
|
|
669
|
-
| `prototypes.typingsFormat.useDeepPartial` |
|
|
670
|
-
| `prototypes.typingsFormat.useExact` |
|
|
671
|
-
| `prototypes.typingsFormat.toJsonUnknown` |
|
|
672
|
-
| `prototypes.typingsFormat.timestamp` |
|
|
673
|
-
| `prototypes.typingsFormat.duration` |
|
|
674
|
-
| `prototypes.typingsFormat.setDefaultEnumToUnrecognized` |
|
|
675
|
-
| `prototypes.typingsFormat.setDefaultCustomTypesToUndefined` |
|
|
676
|
-
| `prototypes.typingsFormat.autoFixUndefinedEnumDefault` |
|
|
673
|
+
| `prototypes.typingsFormat.customTypes.useCosmosSDKDec` | Enable handling of "cosmos.Dec" proto custom type. Used to show decimal fields with the custom type correctly. Highly recommended to set to true. | `true` |
|
|
674
|
+
| `prototypes.typingsFormat.customTypes.useEnhancedDecimal` | Use patched decimal instead of decimal from @cosmjs/math | `false` |
|
|
675
|
+
| `prototypes.typingsFormat.customTypes.base64Lib` | Use endo/base64 methods | `undefined` |
|
|
676
|
+
| `prototypes.typingsFormat.num64` | 'long' or 'bigint', the way of generating int64 proto types. Set to 'bigint' to use more stable built-in type | `bigint` |
|
|
677
|
+
| `prototypes.typingsFormat.useTelescopeGeneratedType` | Discard GeneratedType from CosmJS, use TelescopeGeneratedType instead inside *.registry.ts files | `false` |
|
|
678
|
+
| `prototypes.typingsFormat.useDeepPartial` | Use `DeepPartial` type instead of `Partial` TS type | `false` |
|
|
679
|
+
| `prototypes.typingsFormat.useExact` | Use the `Exact` TS type | `false` |
|
|
680
|
+
| `prototypes.typingsFormat.toJsonUnknown` | Use `any` for `toJSON` methods instead of `JsonSafe` | `true` |
|
|
681
|
+
| `prototypes.typingsFormat.timestamp` | Use either `date` or `timestamp` for `Timestamp` proto type | "date" |
|
|
682
|
+
| `prototypes.typingsFormat.duration` | Use either `duration` or `string` for `Duration` proto type | "duration"|
|
|
683
|
+
| `prototypes.typingsFormat.setDefaultEnumToUnrecognized` | false: enum empty value would be 0, true: -1 (value for enum unrecognized) |`true`|
|
|
684
|
+
| `prototypes.typingsFormat.setDefaultCustomTypesToUndefined` | true: Timestamp, Duration, Any, Coin empty value would be undefined. false: use fromPartial to get an empty object |`false`|
|
|
685
|
+
| `prototypes.typingsFormat.autoFixUndefinedEnumDefault` | The default value of an enum field would be: 1 (proto2); 0 (proto3). But in some rare cases, those default values don't exist. By enabling this, the default value will be automatically fixed with the smallest value inside the enum. |`false`|
|
|
677
686
|
|
|
678
687
|
### Protobuf parser
|
|
679
688
|
|
|
680
689
|
| option | description | defaults |
|
|
681
690
|
| ----------------------------------------- | -------------------------------------------------------------- | --------- |
|
|
682
|
-
| `prototypes.parser.keepCase` |
|
|
683
|
-
| `prototypes.parser.alternateCommentMode` |
|
|
684
|
-
| `prototypes.parser.preferTrailingComment` |
|
|
691
|
+
| `prototypes.parser.keepCase` | Pass `keepCase` to protobuf `parse()` to keep original casing | `true` |
|
|
692
|
+
| `prototypes.parser.alternateCommentMode` | Pass `alternateCommentMode` to protobuf `parse()` method | `true` |
|
|
693
|
+
| `prototypes.parser.preferTrailingComment` | Pass `preferTrailingComment` to protobuf `parse()` method | `false` |
|
|
685
694
|
|
|
686
695
|
### Typescript Disabling
|
|
687
696
|
|
|
688
697
|
| option | description | defaults |
|
|
689
698
|
| -------------------------------------------- | -------------------------------------------------------------- | ---------|
|
|
690
|
-
| `tsDisable.disableAll` |
|
|
691
|
-
| `tsDisable.patterns` |
|
|
692
|
-
| `tsDisable.files` |
|
|
699
|
+
| `tsDisable.disableAll` | Include `//@ts-nocheck` on every output file | `false` |
|
|
700
|
+
| `tsDisable.patterns` | Include `//@ts-nocheck` on matched patterns | `[]` |
|
|
701
|
+
| `tsDisable.files` | Include `//@ts-nocheck` on matched files | `[]` |
|
|
693
702
|
|
|
694
703
|
### ESLint Disabling
|
|
695
704
|
|
|
696
705
|
| option | description | defaults |
|
|
697
706
|
| -------------------------------------------- | ---------------------------------------------------------------- | ---------|
|
|
698
|
-
| `eslintDisable.disableAll` |
|
|
699
|
-
| `eslintDisable.patterns` |
|
|
700
|
-
| `eslintDisable.files` |
|
|
707
|
+
| `eslintDisable.disableAll` | Include `/* eslint-disable */` on every output file | `false` |
|
|
708
|
+
| `eslintDisable.patterns` | Include `/* eslint-disable */` on matched patterns | `[]` |
|
|
709
|
+
| `eslintDisable.files` | Include `/* eslint-disable */` on matched files | `[]` |
|
|
701
710
|
|
|
702
711
|
### Bundle
|
|
703
712
|
|
|
704
713
|
| option | description | defaults |
|
|
705
714
|
| ------------------------------ | -------------------------------------------------------------- | ---------- |
|
|
706
|
-
| `bundle.enabled` |
|
|
715
|
+
| `bundle.enabled` | Bundle all files into a scoped index file | `true` |
|
|
707
716
|
> **Warning:** This option is not recommended. It will generate a bundle file that exports all the types and functions under one namespace. This will make the bundle file very large and hard to maintain. e.g. using `cosmos.bank.v1beta1.MsgSend` might be intuitive, but it will also include `cosmos.gov.v1beta1.*` and other types in the final bundle file. So use this option with caution.
|
|
708
717
|
|
|
718
|
+
### MCP Server
|
|
719
|
+
|
|
720
|
+
| option | description | defaults |
|
|
721
|
+
| ------------------------------ | -------------------------------------------------------------- | ---------- |
|
|
722
|
+
| `mcpServer.enabled` | generate MCP (Model Context Protocol) servers alongside TypeScript clients for AI agent integration | `false` |
|
|
723
|
+
|
|
724
|
+
When enabled, Telescope generates a complete MCP server package (`{packageName}-mcp`) that includes:
|
|
725
|
+
- Mock blockchain tools for demonstration and development
|
|
726
|
+
- Complete telescope codebase reference for AI agents
|
|
727
|
+
- Self-contained package with all necessary telescope code
|
|
728
|
+
- Ready-to-extend structure for implementing real blockchain functionality
|
|
729
|
+
|
|
730
|
+
See [MCP Integration](https://docs.hyperweb.io/telescope/developing/mcp-integration) for detailed documentation.
|
|
731
|
+
|
|
709
732
|
### Output
|
|
710
733
|
|
|
711
734
|
| option | description | defaults |
|
|
712
735
|
| ------------------------------ | ----------------------------------------------------------------- | ---------- |
|
|
713
|
-
| `env` | 'default' or 'v-next', set to 'v-next' to enable yet
|
|
714
|
-
| `removeUnusedImports` |
|
|
715
|
-
| `classesUseArrowFunctions` |
|
|
716
|
-
| `includeExternalHelpers` |
|
|
717
|
-
| `restoreImportExtension` |
|
|
736
|
+
| `env` | 'default' or 'v-next', set to 'v-next' to enable yet-to-be-released features | `default` |
|
|
737
|
+
| `removeUnusedImports` | Remove unused imports | `true` |
|
|
738
|
+
| `classesUseArrowFunctions` | Classes use arrow functions instead of `bind()`ing in constructors | `false` |
|
|
739
|
+
| `includeExternalHelpers` | Export helper functions in `extern.ts` | `false` |
|
|
740
|
+
| `restoreImportExtension` | Restore extensions of imported paths (e.g., '.js'). null means no extension | `null` |
|
|
718
741
|
|
|
719
742
|
## Types
|
|
720
743
|
|
|
@@ -742,7 +765,7 @@ The representation of `google.protobuf.Duration` is configurable by the `prototy
|
|
|
742
765
|
|
|
743
766
|
This example shows messages from the `osmojs`, which was built with Telescope.
|
|
744
767
|
|
|
745
|
-
Import the `osmosis` object from `osmojs`. In this case, we're
|
|
768
|
+
Import the `osmosis` object from `osmojs`. In this case, we're showing the messages available from the `osmosis.gamm.v1beta1` module:
|
|
746
769
|
|
|
747
770
|
```js
|
|
748
771
|
import { osmosis } from 'osmojs';
|
|
@@ -759,7 +782,7 @@ const {
|
|
|
759
782
|
} = osmosis.gamm.v1beta1.MessageComposer.withTypeUrl;
|
|
760
783
|
```
|
|
761
784
|
|
|
762
|
-
Now you can construct messages. If you use
|
|
785
|
+
Now you can construct messages. If you use VS Code or another TypeScript-enabled IDE, you should also be able to use `Ctrl+Space` to see auto-completion of the fields required for the message.
|
|
763
786
|
|
|
764
787
|
```js
|
|
765
788
|
import { coin } from '@cosmjs/amino';
|
|
@@ -785,7 +808,7 @@ const fee = {
|
|
|
785
808
|
}
|
|
786
809
|
```
|
|
787
810
|
|
|
788
|
-
|
|
811
|
+
If you are broadcasting multiple messages in a batch, you should `simulate` your transaction and estimate the fee
|
|
789
812
|
|
|
790
813
|
```js
|
|
791
814
|
import { Dec, IntPretty } from '@keplr-wallet/unit';
|
|
@@ -817,7 +840,7 @@ const client = await getSigningOsmosisClient({
|
|
|
817
840
|
|
|
818
841
|
## Creating Signers
|
|
819
842
|
|
|
820
|
-
To broadcast messages, you'll want to use either [
|
|
843
|
+
To broadcast messages, you'll want to use either [Keplr](https://docs.keplr.app/api/cosmjs.html) or an `OfflineSigner` from `cosmjs` using mnemonics.
|
|
821
844
|
|
|
822
845
|
### Amino Signer
|
|
823
846
|
|
|
@@ -833,7 +856,7 @@ import { getOfflineSigner as getOfflineSignerAmino } from 'cosmjs-utils';
|
|
|
833
856
|
import { getOfflineSigner as getOfflineSignerProto } from 'cosmjs-utils';
|
|
834
857
|
```
|
|
835
858
|
|
|
836
|
-
WARNING
|
|
859
|
+
**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 12-factor applications.
|
|
837
860
|
|
|
838
861
|
```js
|
|
839
862
|
import { chains } from 'chain-registry';
|
|
@@ -1028,7 +1051,7 @@ const main = async () => {
|
|
|
1028
1051
|
|
|
1029
1052
|
### gRPC-gateway Client
|
|
1030
1053
|
|
|
1031
|
-
For querying data via gRPC-
|
|
1054
|
+
For querying data via gRPC-gateway endpoints, you can use gRPC-gateway Clients. For a better developer experience, you can generate a factory of scoped bundles of all gRPC-gateway Clients with the `rpcClients` option.
|
|
1032
1055
|
|
|
1033
1056
|
```ts
|
|
1034
1057
|
const options: TelescopeOptions = {
|
|
@@ -1055,7 +1078,7 @@ const main = async () => {
|
|
|
1055
1078
|
};
|
|
1056
1079
|
```
|
|
1057
1080
|
|
|
1058
|
-
Below
|
|
1081
|
+
Below is an example of scaffolding a `grant` Proto Msg for gRPC-web and gRPC-gateway and then broadcasting it.
|
|
1059
1082
|
|
|
1060
1083
|
```js
|
|
1061
1084
|
const { grant } = cosmos.authz.v1beta1.MessageComposer.withTypeUrl;
|
|
@@ -1122,7 +1145,7 @@ main().then(() => {
|
|
|
1122
1145
|
|
|
1123
1146
|
## Instant RPC Methods
|
|
1124
1147
|
|
|
1125
|
-
|
|
1148
|
+
Use the instantOps option to expose instant RPC methods.
|
|
1126
1149
|
|
|
1127
1150
|
For example, for this config:
|
|
1128
1151
|
```js
|
|
@@ -1162,7 +1185,7 @@ For example, for this config:
|
|
|
1162
1185
|
}
|
|
1163
1186
|
```
|
|
1164
1187
|
|
|
1165
|
-
There
|
|
1188
|
+
There will be an extra file generated in the root folder called service-ops.ts:
|
|
1166
1189
|
```js
|
|
1167
1190
|
export interface OsmosisClaim extends _OsmosisClaimV1beta1Queryrpc.OsmosisClaim {}
|
|
1168
1191
|
export class OsmosisClaim {
|
|
@@ -1200,7 +1223,7 @@ export class CosmosAuthAccount {
|
|
|
1200
1223
|
this.tallyResult = _CosmosGovV1beta1Queryrpc.createClientImpl(rpc).tallyResult;
|
|
1201
1224
|
this.submitProposal = _CosmosGovV1beta1Txrpc.createClientImpl(rpc).submitProposal;
|
|
1202
1225
|
|
|
1203
|
-
//same as
|
|
1226
|
+
// same as txDeposit for vote here.
|
|
1204
1227
|
this.txVote = _CosmosGovV1beta1Txrpc.createClientImpl(rpc).vote;
|
|
1205
1228
|
|
|
1206
1229
|
this.voteWeighted = _CosmosGovV1beta1Txrpc.createClientImpl(rpc).voteWeighted;
|
|
@@ -1241,11 +1264,15 @@ clientStyle: {
|
|
|
1241
1264
|
},
|
|
1242
1265
|
```
|
|
1243
1266
|
|
|
1244
|
-
There
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1267
|
+
There will be client files (`all-module-client.ts`, `akash-sdk-module-client.ts`, `osmosis-sdk-module-client.ts`, `cosmos-sdk-module-client.ts`, `custom-client.ts`) generated in the root directory according to the setting.
|
|
1268
|
+
|
|
1269
|
+
The `all-module-client.ts` file consolidates all proto imports into one file and exports them as a single client.
|
|
1270
|
+
|
|
1271
|
+
All SDK module client files will be identical to the legacy `client.ts` files generated in each module directory, except they will be located in the root directory.
|
|
1272
|
+
|
|
1273
|
+
The custom client imports proto files based on `include.patterns`, allowing protos to originate from different modules.
|
|
1274
|
+
|
|
1275
|
+
For example, the custom-client.ts will be like:
|
|
1249
1276
|
```ts
|
|
1250
1277
|
export const cosmosIbcAminoConverters = {
|
|
1251
1278
|
...cosmosGovV1TxAmino.AminoConverter,
|
|
@@ -1298,7 +1325,7 @@ export const getCustomSigningClient = async ({ rpcEndpoint, signer }: { rpcEndpo
|
|
|
1298
1325
|
...osmosis.superfluid.AminoConverter
|
|
1299
1326
|
});
|
|
1300
1327
|
|
|
1301
|
-
// load the
|
|
1328
|
+
// load the types
|
|
1302
1329
|
osmosis.gamm.v1beta1.load(registry);
|
|
1303
1330
|
osmosis.lockup.load(registry);
|
|
1304
1331
|
osmosis.superfluid.load(registry);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperweb/telescope",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.1",
|
|
4
4
|
"description": "A TypeScript Transpiler for Cosmos Protobufs",
|
|
5
5
|
"author": "Dan Lynch <pyramation@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/hyperweb-io/telescope/tree/master/packages/telescope#readme",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"@babel/parser": "^7.23.6",
|
|
91
91
|
"@babel/traverse": "7.23.6",
|
|
92
92
|
"@babel/types": "7.23.6",
|
|
93
|
-
"@cosmology/ast": "^1.11.
|
|
93
|
+
"@cosmology/ast": "^1.11.1",
|
|
94
94
|
"@cosmology/proto-parser": "^1.10.9",
|
|
95
95
|
"@cosmology/types": "^1.12.5",
|
|
96
96
|
"@cosmology/utils": "^1.10.7",
|
|
@@ -111,5 +111,5 @@
|
|
|
111
111
|
"rimraf": "5.0.0",
|
|
112
112
|
"yaml": "^2.3.4"
|
|
113
113
|
},
|
|
114
|
-
"gitHead": "
|
|
114
|
+
"gitHead": "475bc657513080635838a7f0a7d21b0cf412955b"
|
|
115
115
|
}
|