Available on crate feature
mt
only.Expand description
This module provides utilities to work with cw_multi_test
crate.
§Example usage:
pub struct SvContract;
#[sylvia::contract]
impl SvContract {
#[sv::msg(instantiate)]
pub fn instantiate(&self, ctx: InstantiateCtx) -> StdResult<Response> {
}
#[sv::msg(exec)]
pub fn execute(&self, ctx: ExecCtx, param: u32) -> StdResult<Response> {
}
#[sv::msg(query)]
pub fn query(&self, ctx: QueryCtx) -> StdResult<Response> {
}
}
#[cfg(test)]
mod tests {
#[test]
fn example_test() {
let app = sylvia::multitest::App::default();
let code_id = sv::mt::CodeId::store_code(&app);
let owner = "owner";
let contract = code_id
.instantiate()
.with_label("MyContract") // optional
.with_admin(owner) // optional
.call(owner)
.unwrap();
contract.execute(42).call(owner).unwrap();
contract.query().unwrap();
}
}
Structs§
- Wrapper around
cw_multi_test::App
to provide additional functionalities. - Intermiediate proxy to set additional information before sending an execute message.
- Intermiediate proxy to set additional information before sending an migrate message.
- Proxy to interact with a smart contract initialized on the App.