Skip to content

Commit 70bc89a

Browse files
authored
Merge pull request #345 from Zetazzz/complet-docs-and-comments
complete docs and comments
2 parents 5098d61 + 510e0bb commit 70bc89a

File tree

6 files changed

+59
-27
lines changed

6 files changed

+59
-27
lines changed

README.md

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ npm install -g @osmonauts/telescope
7373

7474
### Generate
7575

76-
Use the `generate` command to create a new package.
76+
Use the `generate` command to create a new package.
7777

7878
```sh
7979
telescope generate
8080
cd ./your-new-project
81-
yarn
81+
yarn
8282
```
8383
### Add Protobufs
8484

@@ -98,7 +98,7 @@ telescope install @protobufs/osmosis
9898

9999
### Transpile
100100

101-
To create the Typescript files, run the `transpile` command.
101+
To create the Typescript files, run the `transpile` command.
102102

103103
```sh
104104
telescope transpile
@@ -224,7 +224,7 @@ telescope({
224224
### LCD Client Options
225225

226226
| option | description | defaults |
227-
| ------------------------------ | -------------------------------------------------------------- | ---------- |
227+
| ------------------------------ | -------------------------------------------------------------- | ---------- |
228228
| `lcdClients.enabled` | generate LCD clients that can query proto `Query` messages | `true` |
229229
| `lcdClients.bundle` | will generate factory bundle aggregate of all LCD Clients | `true` |
230230
| `lcdClients.scoped` | will generate factory of scoped LCD Clients | `undefined`|
@@ -235,7 +235,7 @@ See [LCD Clients](#lcd-clients) for more info.
235235
### RPC Client Options
236236

237237
| option | description | defaults |
238-
| ------------------------------ | -------------------------------------------------------------- | ----------------------------- |
238+
| ------------------------------ | -------------------------------------------------------------- | ----------------------------- |
239239
| `rpcClients.enabled` | generate RPC clients that can interact with proto messages | `true` |
240240
| `rpcClients.bundle` | will generate factory bundle aggregate of all RPC Clients | `true` |
241241
| `rpcClients.camelCase` | use camel-case for RPC methods when generating RPC clients | `true` |
@@ -257,31 +257,44 @@ See [RPC Clients](#rpc-clients) for more info.
257257
| option | description | defaults |
258258
| -------------------------------- | ---------------------------------------------------------------------- | ---------|
259259
| `reactQuery.enabled` | if true, will create react hooks that use `@tanstack/react-query` hooks | `false` |
260+
| `reactQuery.include.protos` | if set, will create the hooks on matched proto filenames or patterns using minimatch | `[]` |
261+
| `reactQuery.include.packages` | if set, will create the hooks on matched packages files using minimatch | `[]` |
262+
| `reactQuery.include.patterns` | if set, will create the hooks on matched patterns of files using minimatch(deprecated in favor of packages and protos have been supported minimatch) | `[]` |
260263

261264
#### Mobx
262265

263266
| option | description | defaults |
264267
| -------------------------------- | ---------------------------------------------------------------------- | ---------|
265268
| `mobx.enabled` | if true, will create mobx stores that use `mobx` | `false` |
269+
| `mobx.include.protos` | if set, will create the mobx stores on matched proto filenames or patterns using minimatch | `[]` |
270+
| `mobx.include.packages` | if set, will create the mobx stores on matched packages files using minimatch | `[]` |
271+
| `mobx.include.patterns` | if set, will create the mobx stores on matched patterns of proto files using minimatch(deprecated in favor of packages and protos have been supported minimatch) | `[]` |
272+
266273

267274
#### Pinia
268275

269276
| option | description | defaults |
270277
| -------------------------------- | ---------------------------------------------------------------------- | ---------|
271278
| `pinia.enabled` | if true, will create pinia stores that use `pinia` | `false` |
279+
| `mobx.include.protos` | if set, will create the pinia stores on matched proto filenames or patterns using minimatch | `[]` |
280+
| `mobx.include.packages` | if set, will create the pinia stores on matched packages files using minimatch | `[]` |
281+
| `mobx.include.patterns` | if set, will create the pinia stores on matched patterns of proto files using minimatch(deprecated in favor of packages and protos have been supported minimatch) | `[]` |
282+
272283

273284
### Typings and Formating
274285

275-
| option | description | defaults |
286+
| option | description | defaults |
276287
| ----------------------------------------- | -------------------------------------------------------------- | --------- |
288+
| `prototypes.typingsFormat.customTypes.useCosmosSDKDec` | enable handling "prototypes.typingsFormat.customTypes.useCosmosSDKDec" proto custom type. Used to show decimal fields with the custom type correctly. Highly recommend set to true. | `false` |
289+
| `prototypes.typingsFormat.longLibrary` | 'long' or 'bigint', the way of generating int64 proto types, set to 'bigint' to enable using more stable built-in type | `long` |
277290
| `prototypes.typingsFormat.useDeepPartial` | defaults to true, but if disabled uses the `Partial` TS type | `true` |
278291
| `prototypes.typingsFormat.useExact` | defaults to false, but if enabled uses the `Exact` TS type | `false` |
279292
| `prototypes.typingsFormat.timestamp` | use either `date` or `timestamp` for `Timestamp` proto type | "date" |
280293
| `prototypes.typingsFormat.duration` | use either `duration` or `string` for `Duration` proto type | "duration"|
281294

282295
### Protobuf parser
283296

284-
| option | description | defaults |
297+
| option | description | defaults |
285298
| ----------------------------------------- | -------------------------------------------------------------- | --------- |
286299
| `prototypes.parser.keepCase` | passes `keepCase` to protobuf `parse()` to keep original casing | `true` |
287300
| `prototypes.parser.alternateCommentMode` | passes `alternateCommentMode` to protobuf `parse()` method | `true` |
@@ -313,6 +326,7 @@ See [RPC Clients](#rpc-clients) for more info.
313326

314327
| option | description | defaults |
315328
| ------------------------------ | ----------------------------------------------------------------- | ---------- |
329+
| `env` | 'default' or 'v-next', set to 'v-next' to enable yet to release features | `default` |
316330
| `removeUnusedImports` | removes unused imports | `true` |
317331
| `classesUseArrowFunctions` | classes use arrow functions instead of `bind()`ing in constructors | `false` |
318332
| `includeExternalHelpers` | exports a few helpers functions in `extern.ts` | `false` |
@@ -462,7 +476,7 @@ const res = await signAndBroadcast({
462476

463477
## LCD Clients
464478

465-
For querying data via REST endpoints, you can use LCD Clients. For a better developer experience, you can generate a factory of scoped bundles of all LCD Clients with the `lcdClients` option.
479+
For querying data via REST endpoints, you can use LCD Clients. For a better developer experience, you can generate a factory of scoped bundles of all LCD Clients with the `lcdClients` option.
466480

467481
```ts
468482
const options: TelescopeOptions = {
@@ -540,7 +554,7 @@ main().then(() => {
540554
```
541555
## RPC Clients
542556

543-
For querying data via RPC endpoints, you can use RPC Clients. For a better developer experience, you can generate a factory of scoped bundles of all RPC Clients with the `rpcClients` option.
557+
For querying data via RPC endpoints, you can use RPC Clients. For a better developer experience, you can generate a factory of scoped bundles of all RPC Clients with the `rpcClients` option.
544558

545559
```ts
546560
const options: TelescopeOptions = {
@@ -593,7 +607,7 @@ const main = async () => {
593607

594608
If you want to instantiate a single client, you can generate RPC classes with the `rpcClients` option;
595609

596-
For any module that has a `Msg`, `Query` or `Service` type, a
610+
For any module that has a `Msg`, `Query` or `Service` type, a
597611

598612
```js
599613
import { osmosis, cosmos } from 'osmojs';
@@ -651,7 +665,7 @@ export const getCustomSigningClient = async ({ rpcEndpoint, signer }: { rpcEndpo
651665
...osmosis.superfluid.AminoConverter
652666
});
653667

654-
// load the
668+
// load the
655669
osmosis.gamm.v1beta1.load(registry);
656670
osmosis.lockup.load(registry);
657671
osmosis.superfluid.load(registry);
@@ -673,7 +687,7 @@ Generate TypeScript SDKs for your CosmWasm smart contracts by using the `cosmwas
673687
```ts
674688
import { TSBuilderInput } from '@cosmwasm/ts-codegen';
675689
const options: TelescopeOptions = {
676-
cosmwasm: {
690+
cosmwasm: {
677691
contracts: [
678692
{
679693
name: 'SG721',
@@ -722,7 +736,7 @@ Here is an example of a `config-overrides.js`:
722736

723737
https://github.com/pyramation/osmosis-ui/blob/main/config-overrides.js
724738

725-
### Babel
739+
### Babel
726740

727741
This should not be an issue, but if you experience problems with syntax or are not using `preset-env`, you may need these babel plugins:
728742

packages/parser/src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ const globPattern = /\*+([^+@!?\*\[\(]*)/;
8888
/**
8989
* test if a proto ref is included by the operation.
9090
* @param ref a ProtoRef with proto file info and package.
91-
* @param exclude patterns(will be deprecated soon), packages, proto files to include
91+
* @param include patterns(will be deprecated soon), packages, proto files to include
9292
* @returns
9393
*/
9494
export const isRefIncluded = (

packages/telescope/types/cmds.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ export namespace Commands {
44
export { _commands_transpile as transpile };
55
}
66
export const Contracts: typeof Contracts;
7-
import _commands_generate from "./commands/generate";
8-
import _commands_install from "./commands/install";
9-
import _commands_transpile from "./commands/transpile";
7+
import _commands_generate from './commands/generate';
8+
import _commands_install from './commands/install';
9+
import _commands_transpile from './commands/transpile';

packages/types/src/telescope.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ interface TelescopeOpts {
161161
reactQuery?: {
162162
enabled: boolean;
163163
include?: {
164+
/**
165+
* @deprecated in favor of packages and protos supporting minimatch
166+
*/
164167
patterns?: string[];
165168
packages?: string[];
166169
protos?: string[];
@@ -169,6 +172,9 @@ interface TelescopeOpts {
169172
mobx?: {
170173
enabled: boolean;
171174
include?: {
175+
/**
176+
* @deprecated in favor of packages and protos supporting minimatch
177+
*/
172178
patterns?: string[];
173179
packages?: string[];
174180
protos?: string[];
@@ -177,6 +183,9 @@ interface TelescopeOpts {
177183
pinia?: {
178184
enabled: boolean;
179185
include?: {
186+
/**
187+
* @deprecated in favor of packages and protos supporting minimatch
188+
*/
180189
patterns?: string[];
181190
packages?: string[];
182191
protos?: string[];

packages/types/types/base.d.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,11 @@ export interface TraverseLocalSymbol {
130130
source: string;
131131
implementsType?: string;
132132
}
133-
export declare type TraverseImportNames = Record<string, Record<string, string>>;
134-
export declare type TraverseImport = Record<string, string[]>;
135-
export declare type TraverseAccept = Record<string, string[]>;
136-
export declare type TraverseImplement = Record<string, string[]>;
137-
export declare type TraverseExport = Record<string, boolean>;
133+
export type TraverseImportNames = Record<string, Record<string, string>>;
134+
export type TraverseImport = Record<string, string[]>;
135+
export type TraverseAccept = Record<string, string[]>;
136+
export type TraverseImplement = Record<string, string[]>;
137+
export type TraverseExport = Record<string, boolean>;
138138
export interface TypeUrlRef {
139139
typeUrl: string;
140140
aminoType: string;
@@ -146,15 +146,15 @@ export interface TraverseTypeUrlRef {
146146
pkg: string;
147147
types: TypeUrlRef[];
148148
}
149-
export declare type TraversedProtoRoot = ProtoRoot & {
149+
export type TraversedProtoRoot = ProtoRoot & {
150150
parsedImports: TraverseImport;
151151
parsedExports: TraverseExport;
152152
acceptsInterface: TraverseAccept;
153153
implementsInterface: TraverseImplement;
154154
importNames: TraverseImportNames | null;
155155
symbols: TraverseLocalSymbol | null;
156156
};
157-
export declare type InterfaceTypeUrlMap = Record<string, TraverseTypeUrlRef[]>;
158-
export declare type TraversalSymbol = TraverseLocalSymbol & {
157+
export type InterfaceTypeUrlMap = Record<string, TraverseTypeUrlRef[]>;
158+
export type TraversalSymbol = TraverseLocalSymbol & {
159159
ref: string;
160160
};

packages/types/types/telescope.d.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ interface TelescopeOpts {
132132
reactQuery?: {
133133
enabled: boolean;
134134
include?: {
135+
/**
136+
* @deprecated in favor of packages and protos supporting minimatch
137+
*/
135138
patterns?: string[];
136139
packages?: string[];
137140
protos?: string[];
@@ -140,6 +143,9 @@ interface TelescopeOpts {
140143
mobx?: {
141144
enabled: boolean;
142145
include?: {
146+
/**
147+
* @deprecated in favor of packages and protos supporting minimatch
148+
*/
143149
patterns?: string[];
144150
packages?: string[];
145151
protos?: string[];
@@ -148,6 +154,9 @@ interface TelescopeOpts {
148154
pinia?: {
149155
enabled: boolean;
150156
include?: {
157+
/**
158+
* @deprecated in favor of packages and protos supporting minimatch
159+
*/
151160
patterns?: string[];
152161
packages?: string[];
153162
protos?: string[];
@@ -157,7 +166,7 @@ interface TelescopeOpts {
157166
interface TelescopePackageOpts {
158167
packages?: Record<string, any>;
159168
}
160-
export declare type TelescopeOptions = TelescopeOpts & TelescopePackageOpts;
161-
export declare type TelescopeOption = keyof TelescopeOpts;
169+
export type TelescopeOptions = TelescopeOpts & TelescopePackageOpts;
170+
export type TelescopeOption = keyof TelescopeOpts;
162171
export declare const defaultTelescopeOptions: TelescopeOptions;
163172
export {};

0 commit comments

Comments
 (0)