Trait abstract_cw_multi_test::Wasm
source · pub trait Wasm<ExecC, QueryC> {
Show 17 methods
// Required methods
fn execute(
&self,
api: &dyn Api,
storage: &mut dyn Storage,
router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>,
block: &BlockInfo,
sender: Addr,
msg: WasmMsg
) -> AnyResult<AppResponse>;
fn query(
&self,
api: &dyn Api,
storage: &dyn Storage,
querier: &dyn Querier,
block: &BlockInfo,
request: WasmQuery
) -> AnyResult<Binary>;
fn sudo(
&self,
api: &dyn Api,
storage: &mut dyn Storage,
router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>,
block: &BlockInfo,
msg: WasmSudo
) -> AnyResult<AppResponse>;
fn store_code(
&mut self,
creator: Addr,
code: Box<dyn Contract<ExecC, QueryC>>
) -> u64;
fn store_code_with_id(
&mut self,
creator: Addr,
code_id: u64,
code: Box<dyn Contract<ExecC, QueryC>>
) -> AnyResult<u64>;
fn duplicate_code(&mut self, code_id: u64) -> AnyResult<u64>;
fn contract_data(
&self,
storage: &dyn Storage,
address: &Addr
) -> AnyResult<ContractData>;
fn dump_wasm_raw(
&self,
storage: &dyn Storage,
address: &Addr
) -> Vec<Record>;
// Provided methods
fn contract_namespace(&self, contract: &Addr) -> Vec<u8> { ... }
fn contract_storage<'a>(
&self,
storage: &'a dyn Storage,
address: &Addr
) -> Box<dyn Storage + 'a> { ... }
fn contract_storage_mut<'a>(
&self,
storage: &'a mut dyn Storage,
address: &Addr
) -> Box<dyn Storage + 'a> { ... }
fn ibc_channel_open(
&self,
_api: &dyn Api,
_contract_addr: Addr,
_storage: &mut dyn Storage,
_router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>,
_block: &BlockInfo,
_request: IbcChannelOpenMsg
) -> AnyResult<IbcChannelOpenResponse> { ... }
fn ibc_channel_connect(
&self,
_api: &dyn Api,
_contract_addr: Addr,
_storage: &mut dyn Storage,
_router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>,
_block: &BlockInfo,
_request: IbcChannelConnectMsg
) -> AnyResult<AppIbcBasicResponse> { ... }
fn ibc_channel_close(
&self,
_api: &dyn Api,
_contract_addr: Addr,
_storage: &mut dyn Storage,
_router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>,
_block: &BlockInfo,
_request: IbcChannelCloseMsg
) -> AnyResult<AppIbcBasicResponse> { ... }
fn ibc_packet_receive(
&self,
_api: &dyn Api,
_contract_addr: Addr,
_storage: &mut dyn Storage,
_router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>,
_block: &BlockInfo,
_request: IbcPacketReceiveMsg
) -> AnyResult<AppIbcReceiveResponse> { ... }
fn ibc_packet_acknowledge(
&self,
_api: &dyn Api,
_contract_addr: Addr,
_storage: &mut dyn Storage,
_router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>,
_block: &BlockInfo,
_request: IbcPacketAckMsg
) -> AnyResult<AppIbcBasicResponse> { ... }
fn ibc_packet_timeout(
&self,
_api: &dyn Api,
_contract_addr: Addr,
_storage: &mut dyn Storage,
_router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>,
_block: &BlockInfo,
_request: IbcPacketTimeoutMsg
) -> AnyResult<AppIbcBasicResponse> { ... }
}
Expand description
Acts as the interface for interacting with WebAssembly (Wasm) modules. This trait is crucial for testing smart contracts written in languages that compile to WebAssembly, which is common in the Cosmos and CosmWasm ecosystems.
Required Methods§
sourcefn execute(
&self,
api: &dyn Api,
storage: &mut dyn Storage,
router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>,
block: &BlockInfo,
sender: Addr,
msg: WasmMsg
) -> AnyResult<AppResponse>
fn execute( &self, api: &dyn Api, storage: &mut dyn Storage, router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, block: &BlockInfo, sender: Addr, msg: WasmMsg ) -> AnyResult<AppResponse>
Handles all WasmMsg
messages.
sourcefn query(
&self,
api: &dyn Api,
storage: &dyn Storage,
querier: &dyn Querier,
block: &BlockInfo,
request: WasmQuery
) -> AnyResult<Binary>
fn query( &self, api: &dyn Api, storage: &dyn Storage, querier: &dyn Querier, block: &BlockInfo, request: WasmQuery ) -> AnyResult<Binary>
Handles all WasmQuery
requests.
sourcefn sudo(
&self,
api: &dyn Api,
storage: &mut dyn Storage,
router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>,
block: &BlockInfo,
msg: WasmSudo
) -> AnyResult<AppResponse>
fn sudo( &self, api: &dyn Api, storage: &mut dyn Storage, router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, block: &BlockInfo, msg: WasmSudo ) -> AnyResult<AppResponse>
Handles all sudo messages, this is an admin interface and can not be called via CosmosMsg
.
sourcefn store_code(
&mut self,
creator: Addr,
code: Box<dyn Contract<ExecC, QueryC>>
) -> u64
fn store_code( &mut self, creator: Addr, code: Box<dyn Contract<ExecC, QueryC>> ) -> u64
Stores the contract’s code and returns an identifier of the stored contract’s code.
sourcefn store_code_with_id(
&mut self,
creator: Addr,
code_id: u64,
code: Box<dyn Contract<ExecC, QueryC>>
) -> AnyResult<u64>
fn store_code_with_id( &mut self, creator: Addr, code_id: u64, code: Box<dyn Contract<ExecC, QueryC>> ) -> AnyResult<u64>
Stores the contract’s code under specified identifier, returns the same code identifier when successful.
sourcefn duplicate_code(&mut self, code_id: u64) -> AnyResult<u64>
fn duplicate_code(&mut self, code_id: u64) -> AnyResult<u64>
Duplicates the contract’s code with specified identifier and returns an identifier of the copy of the contract’s code.
sourcefn contract_data(
&self,
storage: &dyn Storage,
address: &Addr
) -> AnyResult<ContractData>
fn contract_data( &self, storage: &dyn Storage, address: &Addr ) -> AnyResult<ContractData>
Returns ContractData
for the contract with specified address.
Provided Methods§
sourcefn contract_namespace(&self, contract: &Addr) -> Vec<u8>
fn contract_namespace(&self, contract: &Addr) -> Vec<u8>
Returns the namespace of the contract storage.
sourcefn contract_storage<'a>(
&self,
storage: &'a dyn Storage,
address: &Addr
) -> Box<dyn Storage + 'a>
fn contract_storage<'a>( &self, storage: &'a dyn Storage, address: &Addr ) -> Box<dyn Storage + 'a>
Returns read-only (not mutable) contract storage.
sourcefn contract_storage_mut<'a>(
&self,
storage: &'a mut dyn Storage,
address: &Addr
) -> Box<dyn Storage + 'a>
fn contract_storage_mut<'a>( &self, storage: &'a mut dyn Storage, address: &Addr ) -> Box<dyn Storage + 'a>
Returns read-write (mutable) contract storage.
sourcefn ibc_channel_open(
&self,
_api: &dyn Api,
_contract_addr: Addr,
_storage: &mut dyn Storage,
_router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>,
_block: &BlockInfo,
_request: IbcChannelOpenMsg
) -> AnyResult<IbcChannelOpenResponse>
fn ibc_channel_open( &self, _api: &dyn Api, _contract_addr: Addr, _storage: &mut dyn Storage, _router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, _block: &BlockInfo, _request: IbcChannelOpenMsg ) -> AnyResult<IbcChannelOpenResponse>
Executes the contract ibc_channel_open endpoint
sourcefn ibc_channel_connect(
&self,
_api: &dyn Api,
_contract_addr: Addr,
_storage: &mut dyn Storage,
_router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>,
_block: &BlockInfo,
_request: IbcChannelConnectMsg
) -> AnyResult<AppIbcBasicResponse>
fn ibc_channel_connect( &self, _api: &dyn Api, _contract_addr: Addr, _storage: &mut dyn Storage, _router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, _block: &BlockInfo, _request: IbcChannelConnectMsg ) -> AnyResult<AppIbcBasicResponse>
Executes the contract ibc_channel_connect endpoint
sourcefn ibc_channel_close(
&self,
_api: &dyn Api,
_contract_addr: Addr,
_storage: &mut dyn Storage,
_router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>,
_block: &BlockInfo,
_request: IbcChannelCloseMsg
) -> AnyResult<AppIbcBasicResponse>
fn ibc_channel_close( &self, _api: &dyn Api, _contract_addr: Addr, _storage: &mut dyn Storage, _router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, _block: &BlockInfo, _request: IbcChannelCloseMsg ) -> AnyResult<AppIbcBasicResponse>
Executes the contract ibc_channel_close endpoint
sourcefn ibc_packet_receive(
&self,
_api: &dyn Api,
_contract_addr: Addr,
_storage: &mut dyn Storage,
_router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>,
_block: &BlockInfo,
_request: IbcPacketReceiveMsg
) -> AnyResult<AppIbcReceiveResponse>
fn ibc_packet_receive( &self, _api: &dyn Api, _contract_addr: Addr, _storage: &mut dyn Storage, _router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, _block: &BlockInfo, _request: IbcPacketReceiveMsg ) -> AnyResult<AppIbcReceiveResponse>
Executes the contract ibc_packet_receive endpoint
sourcefn ibc_packet_acknowledge(
&self,
_api: &dyn Api,
_contract_addr: Addr,
_storage: &mut dyn Storage,
_router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>,
_block: &BlockInfo,
_request: IbcPacketAckMsg
) -> AnyResult<AppIbcBasicResponse>
fn ibc_packet_acknowledge( &self, _api: &dyn Api, _contract_addr: Addr, _storage: &mut dyn Storage, _router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, _block: &BlockInfo, _request: IbcPacketAckMsg ) -> AnyResult<AppIbcBasicResponse>
Executes the contract ibc_packet_acknowledge endpoint
sourcefn ibc_packet_timeout(
&self,
_api: &dyn Api,
_contract_addr: Addr,
_storage: &mut dyn Storage,
_router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>,
_block: &BlockInfo,
_request: IbcPacketTimeoutMsg
) -> AnyResult<AppIbcBasicResponse>
fn ibc_packet_timeout( &self, _api: &dyn Api, _contract_addr: Addr, _storage: &mut dyn Storage, _router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, _block: &BlockInfo, _request: IbcPacketTimeoutMsg ) -> AnyResult<AppIbcBasicResponse>
Executes the contract ibc_packet_timeout endpoint