osmosis-labs / beaker

Beaker helps streamlining CosmWasm development workflow.
Apache License 2.0
106 stars 30 forks source link

Add support for querying contract state and executing arbitrary contract messages #102

Closed vernonjohnson closed 2 years ago

vernonjohnson commented 2 years ago

Are there plans to support querying contract state and executing arbitrary contract messages? This could be a wrapper around wasmd commands query wasm smart and tx wasm execute. I'm imaging commands like:

beaker wasm query mycontract --raw '{ "config":  {}}'
beaker wasm query mycontract --signer-account test1 --raw '{ "increment_count":  {}}'
iboss-ptk commented 2 years ago

Hi @vernonjohnson ! Could you provide more context on the use case? I intended to not provide that option in favor of beaker console, let me know if there is any reason against doing that through the console :)

vernonjohnson commented 2 years ago

Hi @iboss-ptk, appreciate the response. The problem with beaker console is that I can't effectively use it in a bash script. I want to deploy my contract via beaker CLI, then add execute messages to load some initial contract state; then finally output the results by querying my contract. And this should be doable in a single bash script. Since queries and arbitrary message execution is missing, I deploy with beaker then resort back to wasm query and execute commands to do the rest. And execute doesn't support dynamic encoding of submessages, which makes executing certain messages a pain. Ideally beaker could be use e2e.

There are several examples where both deployment and initialization are done via bash (e.g., DAODAO, WasmSwap). Would be a very useful to many devs IMO and would make beaker more feature complete.

vernonjohnson commented 2 years ago

@iboss-ptk Happy to help on the dev side with this if given some initial guidance

iboss-ptk commented 2 years ago

@vernonjohnson that was fast! This should make it works for now and this use case is related to #37.

Happy to hear more feedback on this, I'm considering making task script written in either rust, rhai or js. So multistage deployment or any type of automation related to the smart contract is at hand. Pretty much lean towards rust at the moment and having tasks as a cargo project inside beaker workspace since it's easy to just call the existing operations, and can just import contract msgs as dependencies. But that might require some refactoring.

Please let me know your thoughts

iboss-ptk commented 2 years ago

@vernonjohnson merged #103 and prettify json response, now available in v0.0.8! please update