Skip to content

Commit

Permalink
Merge branch 'main' into update/vue-query-tree-shaking-use-query
Browse files Browse the repository at this point in the history
  • Loading branch information
Zetazzz authored Jan 26, 2025
2 parents fb66d25 + 4f61eb6 commit 155e2fb
Show file tree
Hide file tree
Showing 75 changed files with 817 additions and 616 deletions.
2 changes: 1 addition & 1 deletion LICENSE-Apache
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ APPENDIX: How to apply the Apache License to your work.
identification within third-party archives.

Copyright 2024 The Telescope AUTHORS
Copyright 2024 Interweb, Inc. <developers@cosmology.zone>
Copyright 2024 Interweb, Inc. <developers@hyperweb.io>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
MIT License

Copyright (c) 2024 The Telescope AUTHORS
Copyright (c) 2024 Interweb, Inc. <developers@cosmology.zone>
Copyright (c) 2024 Interweb, Inc. <developers@hyperweb.io>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
46 changes: 24 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
</p>

<p align="center" width="100%">
<a href="https://github.com/cosmology-tech/telescope/actions/workflows/run-tests.yaml">
<img height="20" src="https://github.com/cosmology-tech/telescope/actions/workflows/run-tests.yaml/badge.svg" />
<a href="https://github.com/hyperweb-io/telescope/actions/workflows/run-tests.yaml">
<img height="20" src="https://github.com/hyperweb-io/telescope/actions/workflows/run-tests.yaml/badge.svg" />
</a>
<a href="https://github.com/cosmology-tech/lib-count">
<img height="20" src="https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fcosmology-tech%2Flib-count%2Fmain%2Foutput%2Fbadges%2Fproducts%2Ftelescope%2Ftotal.json"/>
<a href="https://github.com/hyperweb-io/lib-count">
<img height="20" src="https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fhyperweb-io%2Flib-count%2Fmain%2Foutput%2Fbadges%2Fproducts%2Ftelescope%2Ftotal.json"/>
</a>
<a href="https://github.com/cosmology-tech/lib-count">
<img height="20" src="https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fcosmology-tech%2Flib-count%2Fmain%2Foutput%2Fbadges%2Fproducts%2Ftelescope%2Fmonthly.json"/>
<a href="https://github.com/hyperweb-io/lib-count">
<img height="20" src="https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fhyperweb-io%2Flib-count%2Fmain%2Foutput%2Fbadges%2Fproducts%2Ftelescope%2Fmonthly.json"/>
</a>
<br />
<a href="https://github.com/cosmology-tech/telescope/blob/main/LICENSE-MIT"><img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"/></a>
<a href="https://github.com/cosmology-tech/telescope/blob/main/LICENSE-Apache"><img height="20" src="https://img.shields.io/badge/license-Apache-blue.svg"/></a>
<a href="https://www.npmjs.com/package/@cosmology/telescope"><img height="20" src="https://img.shields.io/github/package-json/v/cosmology-tech/telescope?filename=packages%2Ftelescope%2Fpackage.json"/></a>
<a href="https://github.com/hyperweb-io/telescope/blob/main/LICENSE-MIT"><img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"/></a>
<a href="https://github.com/hyperweb-io/telescope/blob/main/LICENSE-Apache"><img height="20" src="https://img.shields.io/badge/license-Apache-blue.svg"/></a>
<a href="https://www.npmjs.com/package/@cosmology/telescope"><img height="20" src="https://img.shields.io/github/package-json/v/hyperweb-io/telescope?filename=packages%2Ftelescope%2Fpackage.json"/></a>
</p>

<p align="center">
Expand Down Expand Up @@ -119,7 +119,7 @@ npm install -g @cosmology/telescope create-cosmos-app

### Generate

Use the [`create-cosmos-app`](https://github.com/cosmology-tech/create-cosmos-app/) command to create a new package from the `telescope` boilerplate.
Use the [`create-cosmos-app`](https://github.com/hyperweb-io/create-cosmos-app/) command to create a new package from the `telescope` boilerplate.

```sh
cca --boilerplate telescope
Expand Down Expand Up @@ -153,15 +153,15 @@ Examples:

```sh
# Telescope will do the download according to .json file of --config
# Telescope will put proto into location specified by --out
# Telescope will put proto into location specified by --out
telescope download --config ./protod.config.json --out ./git-modules
```

```sh
# Telescope download from target repo according to --git-repo
# in format of (i.e. <owner>/<repository> or <owner>/<repository>/<branch>)
# <branch> can be empty, it will use main as default
# Also --targets is required to specify the targets to download
# Also --targets is required to specify the targets to download
# in format like cosmos/auth/v1beta1/auth.proto
telescope download --git-repo target-repo --targets target-proto
```
Expand All @@ -185,7 +185,7 @@ telescope download --config ./protod.config.json --out ./git-modules --ssh true
//
// `outDir` is where the output proto will be put
//
// `targets` are the target proto to download
// `targets` are the target proto to download
// `targets` can be patterns like:
// "cosmos/bank/v1beta1/tx.proto",
// "cosmos/gov/**/*.proto",
Expand Down Expand Up @@ -443,6 +443,8 @@ See [LCD Clients](#lcd-clients) for more info.
| `rpcClients.scopedIsExclusive` | will allow both scoped bundles and all RPC Clients | `true` |
| `rpcClients.enabledServices` | which services to enable | [`Msg`,`Query`,`Service`] |
| `rpcClients.instantOps` | will generate instant rpc operations in the file `service-ops.ts` under root folder, which contains customized classes having selected rpc methods | `undefined` |
| `rpcClients.useConnectComet` | will use connectComet function to get a tendermint client | `undefined` |
| `rpcClients.useMakeClient` | allow user to pass a query client resolver to create query client in createRPCQueryClient function | `undefined` |
| `rpcClients.serviceImplement` | assign implement type of rpc methods, `Query` or `Tx`, by setting patterns under service types. | `undefined` |
`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`
| `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`
Expand Down Expand Up @@ -1107,7 +1109,7 @@ There'll be client files (`all-module-client.ts`, `akash-sdk-module-client.ts`,
The `all-module-client.ts` file consolidates all proto imports into one file and exports them as a single client.<br>
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. <br>
The custom client imports proto files based on `include.patterns`, allowing protos to originate from different modules.<br>
For example the custom-client.ts will be like:
For example the custom-client.ts will be like:
```ts
export const cosmosIbcAminoConverters = {
...cosmosGovV1TxAmino.AminoConverter,
Expand Down Expand Up @@ -1350,7 +1352,7 @@ This should not be an issue, but if you experience problems with syntax or are n
## Developing
See our [documentation](https://github.com/cosmology-tech/telescope/blob/main/docs/README.md) for how to contribute and develop Telescope.
See our [documentation](https://github.com/hyperweb-io/telescope/blob/main/docs/README.md) for how to contribute and develop Telescope.
## Sponsors
Expand All @@ -1362,17 +1364,17 @@ Kudos to our sponsors:
Checkout these related projects:
* [@cosmology/telescope](https://github.com/cosmology-tech/telescope) Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules.
* [telescope](https://github.com/hyperweb-io/telescope) Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules.
* [@cosmwasm/ts-codegen](https://github.com/CosmWasm/ts-codegen) Convert your CosmWasm smart contracts into dev-friendly TypeScript classes.
* [chain-registry](https://github.com/cosmology-tech/chain-registry) Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application.
* [cosmos-kit](https://github.com/cosmology-tech/cosmos-kit) Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface.
* [create-cosmos-app](https://github.com/cosmology-tech/create-cosmos-app) Set up a modern Cosmos app by running one command.
* [interchain-ui](https://github.com/cosmology-tech/interchain-ui) The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit.
* [starship](https://github.com/cosmology-tech/starship) Unified Testing and Development for the Interchain.
* [chain-registry](https://github.com/hyperweb-io/chain-registry) Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application.
* [cosmos-kit](https://github.com/hyperweb-io/cosmos-kit) Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface.
* [create-cosmos-app](https://github.com/hyperweb-io/create-cosmos-app) Set up a modern Cosmos app by running one command.
* [interchain-ui](https://github.com/hyperweb-io/interchain-ui) The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit.
* [starship](https://github.com/hyperweb-io/starship) Unified Testing and Development for the Interchain.
## Credits
🛠 Built by Cosmologyif you like our tools, please consider delegating to [our validator ⚛️](https://cosmology.zone/validator)
🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io)
Thanks to these engineers, teams and projects for inspiring Telescope:
Expand Down
4 changes: 2 additions & 2 deletions __fixtures__/v-next/outputhelperfunc/helper-func-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function buildQuery<TReq, TRes>(opts: QueryBuilderOptions<TReq, TRes>) {

export interface ITxArgs<TMsg> {
signerAddress: string;
message: TMsg;
message: TMsg | TMsg[];
fee: StdFee | 'auto';
memo: string;
}
Expand Down Expand Up @@ -86,7 +86,7 @@ export function buildTx<TMsg>(opts: TxBuilderOptions) {

return async (
signerAddress: string,
message: TMsg,
message: TMsg | TMsg[],
fee: StdFee | 'auto',
memo: string
): Promise<DeliverTxResponse> => {
Expand Down
2 changes: 1 addition & 1 deletion __fixtures__/v-next/outputhelperfunc/react-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export interface ReactMutationParams<TData, TError, TVariables, TContext = unkno
export interface UseMutationBuilderOptions<TMsg> {
builderMutationFn: (clientResolver?: SigningClientResolver) => (
signerAddress: string,
message: TMsg,
message: TMsg | TMsg[],
fee: StdFee | 'auto',
memo: string
) => Promise<DeliverTxResponse>,
Expand Down
4 changes: 2 additions & 2 deletions __fixtures__/v-next/outputicjs/helper-func-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function buildQuery<TReq, TRes>(opts: QueryBuilderOptions<TReq, TRes>) {

export interface ITxArgs<TMsg> {
signerAddress: string;
message: TMsg;
message: TMsg | TMsg[];
fee: StdFee | 'auto';
memo: string;
}
Expand Down Expand Up @@ -78,7 +78,7 @@ export interface TxBuilderOptions {
export function buildTx<TMsg>(opts: TxBuilderOptions) {
return async (
signerAddress: string,
message: TMsg,
message: TMsg | TMsg[],
fee: StdFee | 'auto',
memo: string
): Promise<DeliverTxResponse> => {
Expand Down
2 changes: 1 addition & 1 deletion __fixtures__/v-next/outputicjs/react-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export interface ReactMutationParams<TData, TError, TVariables, TContext = unkno
export interface UseMutationBuilderOptions<TMsg> {
builderMutationFn: (clientResolver?: SigningClientResolver) => (
signerAddress: string,
message: TMsg,
message: TMsg | TMsg[],
fee: StdFee | 'auto',
memo: string
) => Promise<DeliverTxResponse>,
Expand Down
14 changes: 13 additions & 1 deletion __fixtures__/v-next/outputinstantrpc/extern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from '@cosmjs/stargate'
import { connectComet, HttpEndpoint } from "@cosmjs/tendermint-rpc";
import { connectComet, Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc";

const _rpcClients: Record<string, ProtobufRpcClient> = {};

Expand Down Expand Up @@ -40,3 +40,15 @@ export const createRpcClient = async (rpcEndpoint: string | HttpEndpoint) => {

return rpc;
}

export const createTm34QueryClient = async (rpcEndpoint: string | HttpEndpoint) => {
const tmClient = await Tendermint34Client.connect(rpcEndpoint);
//@ts-ignore
return new QueryClient(tmClient);
}

export const createConnectCometQueryClient = async (rpcEndpoint: string | HttpEndpoint) => {
const cometClient = await connectComet(rpcEndpoint);
//@ts-ignore
return new QueryClient(cometClient);
}
9 changes: 6 additions & 3 deletions __fixtures__/v-next/outputv4/akash/rpc.query.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { Rpc } from "../helpers.js";
import { connectComet, HttpEndpoint } from "@cosmjs/tendermint-rpc";
import { QueryClient } from "@cosmjs/stargate";
import { createConnectCometQueryClient } from "../extern.js";
export const createRPCQueryClient = async ({
rpcEndpoint
rpcEndpoint,
makeClient
}: {
rpcEndpoint: string | HttpEndpoint;
makeClient?: (rpcEndpoint: string | HttpEndpoint) => Promise<QueryClient>;
}) => {
const tmClient = await connectComet(rpcEndpoint);
const client = new QueryClient(tmClient);
const make = makeClient || createConnectCometQueryClient;
const client = await make(rpcEndpoint);
return {
akash: {
audit: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { Rpc } from "../helpers.js";
import { connectComet, HttpEndpoint } from "@cosmjs/tendermint-rpc";
import { QueryClient } from "@cosmjs/stargate";
import { createConnectCometQueryClient } from "../extern.js";
export const createCosmicRPCQueryClient = async ({
rpcEndpoint
rpcEndpoint,
makeClient
}: {
rpcEndpoint: string | HttpEndpoint;
makeClient?: (rpcEndpoint: string | HttpEndpoint) => Promise<QueryClient>;
}) => {
const tmClient = await connectComet(rpcEndpoint);
const client = new QueryClient(tmClient);
const make = makeClient || createConnectCometQueryClient;
const client = await make(rpcEndpoint);
return {
cosmos: {
bank: {
Expand Down
9 changes: 6 additions & 3 deletions __fixtures__/v-next/outputv4/cosmos/rpc.query.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { Rpc } from "../helpers.js";
import { connectComet, HttpEndpoint } from "@cosmjs/tendermint-rpc";
import { QueryClient } from "@cosmjs/stargate";
import { createConnectCometQueryClient } from "../extern.js";
export const createRPCQueryClient = async ({
rpcEndpoint
rpcEndpoint,
makeClient
}: {
rpcEndpoint: string | HttpEndpoint;
makeClient?: (rpcEndpoint: string | HttpEndpoint) => Promise<QueryClient>;
}) => {
const tmClient = await connectComet(rpcEndpoint);
const client = new QueryClient(tmClient);
const make = makeClient || createConnectCometQueryClient;
const client = await make(rpcEndpoint);
return {
cosmos: {
app: {
Expand Down
9 changes: 6 additions & 3 deletions __fixtures__/v-next/outputv4/cosmwasm/rpc.query.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { Rpc } from "../helpers.js";
import { connectComet, HttpEndpoint } from "@cosmjs/tendermint-rpc";
import { QueryClient } from "@cosmjs/stargate";
import { createConnectCometQueryClient } from "../extern.js";
export const createRPCQueryClient = async ({
rpcEndpoint
rpcEndpoint,
makeClient
}: {
rpcEndpoint: string | HttpEndpoint;
makeClient?: (rpcEndpoint: string | HttpEndpoint) => Promise<QueryClient>;
}) => {
const tmClient = await connectComet(rpcEndpoint);
const client = new QueryClient(tmClient);
const make = makeClient || createConnectCometQueryClient;
const client = await make(rpcEndpoint);
return {
cosmos: {
app: {
Expand Down
9 changes: 6 additions & 3 deletions __fixtures__/v-next/outputv4/evmos/evmos-rpc-client.query.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { Rpc } from "../helpers.js";
import { connectComet, HttpEndpoint } from "@cosmjs/tendermint-rpc";
import { QueryClient } from "@cosmjs/stargate";
import { createConnectCometQueryClient } from "../extern.js";
export const createEvmosRPCQueryClient = async ({
rpcEndpoint
rpcEndpoint,
makeClient
}: {
rpcEndpoint: string | HttpEndpoint;
makeClient?: (rpcEndpoint: string | HttpEndpoint) => Promise<QueryClient>;
}) => {
const tmClient = await connectComet(rpcEndpoint);
const client = new QueryClient(tmClient);
const make = makeClient || createConnectCometQueryClient;
const client = await make(rpcEndpoint);
return {
cosmos: {
bank: {
Expand Down
9 changes: 6 additions & 3 deletions __fixtures__/v-next/outputv4/evmos/rpc.query.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { Rpc } from "../helpers.js";
import { connectComet, HttpEndpoint } from "@cosmjs/tendermint-rpc";
import { QueryClient } from "@cosmjs/stargate";
import { createConnectCometQueryClient } from "../extern.js";
export const createRPCQueryClient = async ({
rpcEndpoint
rpcEndpoint,
makeClient
}: {
rpcEndpoint: string | HttpEndpoint;
makeClient?: (rpcEndpoint: string | HttpEndpoint) => Promise<QueryClient>;
}) => {
const tmClient = await connectComet(rpcEndpoint);
const client = new QueryClient(tmClient);
const make = makeClient || createConnectCometQueryClient;
const client = await make(rpcEndpoint);
return {
cosmos: {
app: {
Expand Down
14 changes: 13 additions & 1 deletion __fixtures__/v-next/outputv4/extern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from '@cosmjs/stargate'
import { connectComet, HttpEndpoint } from "@cosmjs/tendermint-rpc";
import { connectComet, Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc";

const _rpcClients: Record<string, ProtobufRpcClient> = {};

Expand Down Expand Up @@ -40,3 +40,15 @@ export const createRpcClient = async (rpcEndpoint: string | HttpEndpoint) => {

return rpc;
}

export const createTm34QueryClient = async (rpcEndpoint: string | HttpEndpoint) => {
const tmClient = await Tendermint34Client.connect(rpcEndpoint);
//@ts-ignore
return new QueryClient(tmClient);
}

export const createConnectCometQueryClient = async (rpcEndpoint: string | HttpEndpoint) => {
const cometClient = await connectComet(rpcEndpoint);
//@ts-ignore
return new QueryClient(cometClient);
}
9 changes: 6 additions & 3 deletions __fixtures__/v-next/outputv4/ibc/rpc.query.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { Rpc } from "../helpers.js";
import { connectComet, HttpEndpoint } from "@cosmjs/tendermint-rpc";
import { QueryClient } from "@cosmjs/stargate";
import { createConnectCometQueryClient } from "../extern.js";
export const createRPCQueryClient = async ({
rpcEndpoint
rpcEndpoint,
makeClient
}: {
rpcEndpoint: string | HttpEndpoint;
makeClient?: (rpcEndpoint: string | HttpEndpoint) => Promise<QueryClient>;
}) => {
const tmClient = await connectComet(rpcEndpoint);
const client = new QueryClient(tmClient);
const make = makeClient || createConnectCometQueryClient;
const client = await make(rpcEndpoint);
return {
cosmos: {
app: {
Expand Down
9 changes: 6 additions & 3 deletions __fixtures__/v-next/outputv4/osmosis/rpc.query.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { Rpc } from "../helpers.js";
import { connectComet, HttpEndpoint } from "@cosmjs/tendermint-rpc";
import { QueryClient } from "@cosmjs/stargate";
import { createConnectCometQueryClient } from "../extern.js";
export const createRPCQueryClient = async ({
rpcEndpoint
rpcEndpoint,
makeClient
}: {
rpcEndpoint: string | HttpEndpoint;
makeClient?: (rpcEndpoint: string | HttpEndpoint) => Promise<QueryClient>;
}) => {
const tmClient = await connectComet(rpcEndpoint);
const client = new QueryClient(tmClient);
const make = makeClient || createConnectCometQueryClient;
const client = await make(rpcEndpoint);
return {
cosmos: {
app: {
Expand Down
Loading

0 comments on commit 155e2fb

Please sign in to comment.