osmosis-std

Rust library for interacting with osmosis. CosmWasm compatible.

CosmWasm stargate message and stargate query

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.

Publishing Osmosis' message from CosmWasm Contract

```rs use osmosis_std::types::osmosis::tokenfactory::v1beta1::MsgCreateDenom;

// ..

pub fn trycreatedenom(env: Env, subdenom: String) -> Result { let sender = env.contract.address.into();

// 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"))

}

```

Querying Osmosis' module

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

build and run localosmosis with hackatom-seoul branch (docker required)

make localnet-build && make localnet-start ```

```rs use osmosis_std::types::osmosis::tokenfactory::v1beta1::TokenfactoryQuerier;

// ..

fn querycreatordenoms(deps: Deps, env: Env) -> StdResult { // create TokenfactoryQuerier 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 })

} ```

Non-CosmWasm Client

(WIP)