Trait cw_multi_test::Executor
source · pub trait Executor<C>where
C: CustomMsg + 'static,{
// Required method
fn execute(
&mut self,
sender: Addr,
msg: CosmosMsg<C>,
) -> AnyResult<AppResponse>;
// Provided methods
fn instantiate_contract<T: Serialize, U: Into<String>>(
&mut self,
code_id: u64,
sender: Addr,
init_msg: &T,
send_funds: &[Coin],
label: U,
admin: Option<String>,
) -> AnyResult<Addr> { ... }
fn instantiate2_contract<M, L, A, S>(
&mut self,
code_id: u64,
sender: Addr,
init_msg: &M,
funds: &[Coin],
label: L,
admin: A,
salt: S,
) -> AnyResult<Addr>
where M: Serialize,
L: Into<String>,
A: Into<Option<String>>,
S: Into<Binary> { ... }
fn execute_contract<T: Serialize + Debug>(
&mut self,
sender: Addr,
contract_addr: Addr,
msg: &T,
send_funds: &[Coin],
) -> AnyResult<AppResponse> { ... }
fn migrate_contract<T: Serialize>(
&mut self,
sender: Addr,
contract_addr: Addr,
msg: &T,
new_code_id: u64,
) -> AnyResult<AppResponse> { ... }
fn send_tokens(
&mut self,
sender: Addr,
recipient: Addr,
amount: &[Coin],
) -> AnyResult<AppResponse> { ... }
}
Expand description
A trait defining a default behavior of the message executor.
Defines the interface for executing transactions and contract interactions. It is a central component in the testing framework, managing the operational flow and ensuring that contract calls are processed correctly.
Required Methods§
Provided Methods§
sourcefn instantiate_contract<T: Serialize, U: Into<String>>(
&mut self,
code_id: u64,
sender: Addr,
init_msg: &T,
send_funds: &[Coin],
label: U,
admin: Option<String>,
) -> AnyResult<Addr>
fn instantiate_contract<T: Serialize, U: Into<String>>( &mut self, code_id: u64, sender: Addr, init_msg: &T, send_funds: &[Coin], label: U, admin: Option<String>, ) -> AnyResult<Addr>
Create a contract and get the new address. This is just a helper around execute()
sourcefn instantiate2_contract<M, L, A, S>(
&mut self,
code_id: u64,
sender: Addr,
init_msg: &M,
funds: &[Coin],
label: L,
admin: A,
salt: S,
) -> AnyResult<Addr>
fn instantiate2_contract<M, L, A, S>( &mut self, code_id: u64, sender: Addr, init_msg: &M, funds: &[Coin], label: L, admin: A, salt: S, ) -> AnyResult<Addr>
Instantiates a new contract and returns its predictable address.
This is a helper function around execute function
with WasmMsg::Instantiate2
message.
sourcefn execute_contract<T: Serialize + Debug>(
&mut self,
sender: Addr,
contract_addr: Addr,
msg: &T,
send_funds: &[Coin],
) -> AnyResult<AppResponse>
fn execute_contract<T: Serialize + Debug>( &mut self, sender: Addr, contract_addr: Addr, msg: &T, send_funds: &[Coin], ) -> AnyResult<AppResponse>
Execute a contract and process all returned messages.
This is just a helper function around execute()
with WasmMsg::Execute
message, but in this case we parse out the data field
to that what is returned by the contract (not the protobuf wrapper).
sourcefn migrate_contract<T: Serialize>(
&mut self,
sender: Addr,
contract_addr: Addr,
msg: &T,
new_code_id: u64,
) -> AnyResult<AppResponse>
fn migrate_contract<T: Serialize>( &mut self, sender: Addr, contract_addr: Addr, msg: &T, new_code_id: u64, ) -> AnyResult<AppResponse>
Migrates a contract.
Sender must be registered admin.
This is just a helper function around execute()
with WasmMsg::Migrate
message.
sourcefn send_tokens(
&mut self,
sender: Addr,
recipient: Addr,
amount: &[Coin],
) -> AnyResult<AppResponse>
fn send_tokens( &mut self, sender: Addr, recipient: Addr, amount: &[Coin], ) -> AnyResult<AppResponse>
Sends tokens to specified recipient.
This is just a helper function around execute()
with BankMsg::Send
message.