Rust library for interacting with osmosis. CosmWasm compatible.
You can find all types and querier generated from osmosis's protobuf in their respective module in osmosis_std
.
Full working example contract can be found here.
```rs use osmosis_std::types::osmosis::tokenfactory::v1beta1::MsgCreateDenom;
// ..
pub fn trycreatedenom(env: Env, subdenom: String) -> Result
// construct message and convet them into cosmos message
// (notice `CosmosMsg` type and `.into()`)
let msg_create_denom: CosmosMsg = MsgCreateDenom { sender, subdenom }.into();
Ok(Response::new()
.add_message(msg_create_denom)
.add_attribute("method", "try_create_denom"))
}
```
This will not currently work on mainnet until osmosis v12.. But meanwhile, if you want to test this out, you can by using osmosis hackatom-seoul branch which we enabled all stargate query for hacking purpose!
```sh git clone git@github.com:osmosis-labs/osmosis.git cd osmosis git checkout remotes/origin/hackatom-seoul
make localnet-build && make localnet-start ```
```rs use osmosis_std::types::osmosis::tokenfactory::v1beta1::TokenfactoryQuerier;
// ..
fn querycreatordenoms(deps: Deps, env: Env) -> StdResultTokenfactoryQuerier
let tokenfactory = TokenfactoryQuerier::new(deps.querier);
// `TokenfactoryQuerier` has all the fns for querying the module
let res = tokenfactory.denoms_from_creator(env.contract.address.into())?;
Ok(QueryCreatorDenomsResponse { denoms: res.denoms })
} ```
(WIP)