Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplication code #1524

Open
happylolonly opened this issue Dec 12, 2023 · 3 comments
Open

Duplication code #1524

happylolonly opened this issue Dec 12, 2023 · 3 comments

Comments

@happylolonly
Copy link

Hi, why need such funcs?
https://github.com/cosmos/cosmjs/blob/v0.32.0/packages/stargate/src/stargateclient.ts#L333

It is not possible to just use them from inherited modules, than make public?

In our project our devs made same, and code looks duplicated https://github.com/cybercongress/soft3.js/blob/main/src/cyberclient.ts#L430

Or you can do:
public getAllBalances = this.forceGetQueryClient().bank.allBalances;
it will be shorter, and keep types correct.

What do you think?

@happylolonly
Copy link
Author

happylolonly commented Dec 12, 2023

Ideally I would want something like this.
(or better inherit from that module's extension such https://github.com/cybercongress/soft3.js/blob/main/src/queries/bandwidth.ts#L26 )

image

@happylolonly
Copy link
Author

happylolonly commented Dec 12, 2023

What if make queryClient public, than private?
It will alow to use all methods from extensions

https://github.com/cosmos/cosmjs/blob/v0.32.0/packages/stargate/src/stargateclient.ts#L200

@webmaster128
Copy link
Member

webmaster128 commented Dec 12, 2023

The whole idea of those wrapper functions does not scale and needs to be abandoned at some point, for both queries and messages/transactions. This was already touched briefly in #1440. There is an experimental generic Client class that comes without them shown in #1486. So yeah, it was a good idea when this API was originally designed but we can't keep up with the amount of functionality and at the same time using the protobuf API directly got more convenient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants