By default, CosmJS builds, signs, and broadcasts a transactions in a single function call. Often, it's useful to separate these steps.
This gist explores a simple way of doing so in TypeScript, and may also be useful for those wanting to dive deeper into how Cosmos messages are composed and signed.
You will need a few dependencies:
- cosmwasm: which is a wrapper package for all of the CosmJS packages
- cosmjs-types: which contains helpers for encoding and decoding protobuf messages.
Recentely, I was trying to make sure our README.md
files for DAO DAO
were included in the documentation generated by cargo doc
or rustdoc
. Moreover, I wanted code examples in our README.md
files to be tested.
Here's a quick gist...
There is of course the doc attribute,
and the rust book contains the following example which you are meant to include in your lib.rs
or main.rs
: