Skip to content

Commit

Permalink
Merge pull request #457 from cosmology-tech/update-readme
Browse files Browse the repository at this point in the history
update readme
  • Loading branch information
Zetazzz authored Aug 24, 2023
2 parents 7bd088d + 92a4fbb commit e191903
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 2 deletions.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,41 @@ telescope transpile

You should now seem some `.ts` files generated in `./src`. These are the real source files used in your application.

Examples:

```sh
# Telescope takes chain1 folder as input,
# and generate files in 'gen/src' folder.
telescope transpile --protoDirs ../../__fixtures__/chain1 --outPath gen/src
```

```sh
# Telescope takes chain1 folder as input,
# and generate files in 'gen/src' folder using default telescope options.
telescope transpile --protoDirs ../../__fixtures__/chain1 --outPath gen/src --useDefaults
```

```sh
# Telescope takes chain1 folder(from args) and chain2 folder(from config) as input,
# and generate files in 'gen/src'(defined in the config file, will override outPath in args) folder using a config file.
# Note: --config will override --useDefaults.
telescope transpile --protoDirs ../../__fixtures__/chain1 --config .telescope.json
```

```json
//.telescope.json
{
"protoDirs": [
"../../fixtures/chain2"
],
"outPath": "gen/src",
"options": {
// telescope options
...
}
}
```

### Build

Finally, run `install` and `buidl` to generate the JS and types for publishing your module to npm.
Expand Down Expand Up @@ -224,6 +259,13 @@ telescope({
| `aminoEncoding.exceptions` | set specific aminoType name exceptions | see code |
| `aminoEncoding.typeUrlToAmino` | create functions for aminoType name exceptions | `undefined`|

### Implemented Interface Options

| option | description | defaults |
| ----------------------------------------- | -------------------------------------------------------------- | ---------- |
| `interfaces.enabled` | enables converters convert between Any type and specific implemented interfaces. | `false` |
| `interfaces.useUnionTypes` | Generate Any type as union types(TextProposal \| RegisterIncentiveProposal) instead of intersection types(TextProposal & RegisterIncentiveProposal). | `false` |

### Prototypes Options

| option | description | defaults |
Expand Down
14 changes: 12 additions & 2 deletions packages/telescope/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ telescope transpile --protoDirs ../../__fixtures__/chain1 --config .telescope.js
}
```


### Build

Finally, run `install` and `buidl` to generate the JS and types for publishing your module to npm.
Expand Down Expand Up @@ -260,6 +259,13 @@ telescope({
| `aminoEncoding.exceptions` | set specific aminoType name exceptions | see code |
| `aminoEncoding.typeUrlToAmino` | create functions for aminoType name exceptions | `undefined`|

### Implemented Interface Options

| option | description | defaults |
| ----------------------------------------- | -------------------------------------------------------------- | ---------- |
| `interfaces.enabled` | enables converters convert between Any type and specific implemented interfaces. | `false` |
| `interfaces.useUnionTypes` | Generate Any type as union types(TextProposal \| RegisterIncentiveProposal) instead of intersection types(TextProposal & RegisterIncentiveProposal). | `false` |

### Prototypes Options

| option | description | defaults |
Expand Down Expand Up @@ -324,9 +330,12 @@ See [RPC Clients](#rpc-clients) for more info.
| option | description | defaults |
| -------------------------------- | ---------------------------------------------------------------------- | ---------|
| `reactQuery.enabled` | if true, will create react hooks that use `@tanstack/react-query` hooks | `false` |
| `reactQuery.needExtraQueryKey` | if true, users can input extra react query key to some customized hooks. e.g.['rpcEndpoint', 'yourExtraKey'] | `false` |
| `reactQuery.include.protos` | if set, will create the hooks on matched proto filenames or patterns using minimatch | `[]` |
| `reactQuery.include.packages` | if set, will create the hooks on matched packages files using minimatch | `[]` |
| `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) | `[]` |
| `reactQuery.instantExport.include.patterns` | if set, will expose instant hooks on matched patterns of packages + method(e.g. cosmos.bank.v1beta1.useBalance) using minimatch. If there're duplicated method names in multiple packages without setting `reactQuery.instantExport.nameMapping`, one duplicated name will created like: useCosmosBankV1beta1Balance | `[]` |
| `reactQuery.instantExport.nameMapping` | map an alias to a package + method in case of better naming of duplicated method names. (e.g. useBankBalance: cosmos.bank.v1beta1.useBalance) Customized hook name is set in front of pkg+method, by doing this we can prevent duplicate alias. | `{}` |

#### Mobx

Expand Down Expand Up @@ -356,6 +365,8 @@ See [RPC Clients](#rpc-clients) for more info.
| `prototypes.typingsFormat.useExact` | defaults to false, but if enabled uses the `Exact` TS type | `false` |
| `prototypes.typingsFormat.timestamp` | use either `date` or `timestamp` for `Timestamp` proto type | "date" |
| `prototypes.typingsFormat.duration` | use either `duration` or `string` for `Duration` proto type | "duration"|
| `prototypes.typingsFormat.setDefaultEnumToUnrecognized` | false: enum empty value would be 0, true: -1(value for enum unrecognized) |true|
| `prototypes.typingsFormat.setDefaultCustomTypesToUndefined` | true: Timestamp,Duration,Any,Coin empty value would be undefined., false: using fromPartial to get an empty obj |false|

### Protobuf parser

Expand Down Expand Up @@ -947,4 +958,3 @@ Thanks to these engineers, teams and projects for inspiring Telescope:
AS DESCRIBED IN THE TELESCOPE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.

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 comments on commit e191903

Please sign in to comment.