This crate provides Sei specific bindings for cosmwasm contract to be able to interact with the Sei blockchain by exposing custom messages, queries, and structs that correspond to custom module functionality in the Sei chain.
Add the sei-cosmwasm dependency to your smart contract's Cargo.toml
file:
toml
[dependencies]
sei-cosmwasm = { version = "0.4.2" }
Currently, Sei Bindings support query and message support for the sei custom modules Oracle, Dex, Epoch and TokenFactory. The supported functionality includes the following:
factory/{creator address}/{subdenom}
given a subdenom
.To use these custom queries with the sei chain, you can create an instance of SeiQuerier
and call the query helper functions with the appropriate parameters.
rust
let querier = SeiQuerier::new(&deps.querier);
let res: ExchangeRatesResponse = querier.query_exchange_rates()?;
To use the custom messages, the messages need to be returned in the contract response to be executed by the sei chain.
rust
let test_order = sei_cosmwasm::SeiMsg::PlaceOrders {
contract_address: env.contract.address,
funds: vec![some_funds],
orders: vec![some_order],
};
Ok(Response::new().add_message(test_order))