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

Change the api to something that is more conducive to handling clients through dynamic dispatch #43

Open
0xForerunner opened this issue Mar 27, 2023 · 4 comments

Comments

@0xForerunner
Copy link
Contributor

Currently there is no easy way to build on top of cosm-tome and generically handle different clients. I think the current method of bundling ChainConfig and a generic client T together inside CosmTome is not the best api. If I don't know which client I want to use at compile time there is no easy way to build on top. My suggestion is to completely do away with the CosmTome type and instead simply use extension traits. For every client that is CosmosClient we get all of the nice cosm_tome methods.

Here is an example of the current api

let client = CosmosgRPC::new(chain_info.grpc_endpoint.clone().unwrap());
let cosm_tome = CosmTome::new(chain_info, client);
let response = cosm_tome.wasm_execute(req, &key, &tx_options).await?;

and here is what it could look like with my suggested change

let client = CosmosgRPC::new(chain_info.grpc_endpoint.clone().unwrap());
let response = client.wasm_execute(chain_info, req, &key, &tx_options).await?;
@0xForerunner
Copy link
Contributor Author

This is much more flexible since it allows users to utilize the CosmosClient trait much more easily. It would also make dynamic dispatch possible with clients that are unknown at compile time. If you're okay with this change I would love to submit a PR. This issue is currently blocking me in my development of wasm-deploy.

@0xForerunner 0xForerunner changed the title Change the api to something that is more conducive to handling clients generically Change the api to something that is more conducive to handling clients through dynamic dispatch Mar 27, 2023
@de-husk
Copy link
Owner

de-husk commented May 5, 2023

I like your suggestion! Much cleaner and extendable with the dyn dispatch. A PR would be excellent if you have the time.

@0xForerunner
Copy link
Contributor Author

So my current project has required me to have support for the latest version of tendermint_rpc. I am currently working on a very large overhaul with lots of rather sweeping changes (including the one referenced above). Will submit a draft PR when I'm a little closer to completion.

@de-husk
Copy link
Owner

de-husk commented May 5, 2023

Sounds amazing. Happy to see it!

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