pub struct CyberApp(/* private fields */);Implementations§
Source§impl CyberApp
impl CyberApp
pub fn new() -> Self
pub fn block_info(&self) -> BlockInfo
pub fn advance_blocks(&mut self, blocks: u64)
pub fn advance_seconds(&mut self, seconds: u64)
pub fn next_block(&mut self)
Methods from Deref<Target = CyberAppWrapped>§
Sourcepub fn router(
&self,
) -> &Router<BankT, CustomT, WasmT, StakingT, DistrT, IbcT, GovT, StargateT>
pub fn router( &self, ) -> &Router<BankT, CustomT, WasmT, StakingT, DistrT, IbcT, GovT, StargateT>
Returns a shared reference to application’s router.
Sourcepub fn storage_mut(&mut self) -> &mut StorageT
pub fn storage_mut(&mut self) -> &mut StorageT
Returns a mutable reference to application’s storage.
pub fn init_modules<F, T>(&mut self, init_fn: F) -> T
pub fn read_module<F, T>(&self, query_fn: F) -> T
Sourcepub fn store_code(
&mut self,
code: Box<dyn Contract<<CustomT as Module>::ExecT, <CustomT as Module>::QueryT>>,
) -> u64
pub fn store_code( &mut self, code: Box<dyn Contract<<CustomT as Module>::ExecT, <CustomT as Module>::QueryT>>, ) -> u64
Registers contract code (like uploading wasm bytecode on a chain), so it can later be used to instantiate a contract.
Sourcepub fn store_code_with_creator(
&mut self,
creator: Addr,
code: Box<dyn Contract<<CustomT as Module>::ExecT, <CustomT as Module>::QueryT>>,
) -> u64
pub fn store_code_with_creator( &mut self, creator: Addr, code: Box<dyn Contract<<CustomT as Module>::ExecT, <CustomT as Module>::QueryT>>, ) -> u64
Registers contract code (like store_code), but takes the address of the code creator as an additional argument.
Sourcepub fn duplicate_code(&mut self, code_id: u64) -> Result<u64, Error>
pub fn duplicate_code(&mut self, code_id: u64) -> Result<u64, Error>
Duplicates the contract code identified by code_id and returns
the identifier of the newly created copy of the contract code.
§Examples
use cosmwasm_std::Addr;
use cw_multi_test::App;
// contract implementation
mod echo {
// contract entry points not shown here
pub fn contract() -> Box<dyn Contract<Empty>> {
// should return the contract
}
}
let mut app = App::default();
// store a new contract, save the code id
let code_id = app.store_code(echo::contract());
// duplicate the existing contract, duplicated contract has different code id
assert_ne!(code_id, app.duplicate_code(code_id).unwrap());
// zero is an invalid identifier for contract code, returns an error
assert_eq!("code id: invalid", app.duplicate_code(0).unwrap_err().to_string());
// there is no contract code with identifier 100 stored yet, returns an error
assert_eq!("code id 100: no such code", app.duplicate_code(100).unwrap_err().to_string());Sourcepub fn contract_data(&self, address: &Addr) -> Result<ContractData, Error>
pub fn contract_data(&self, address: &Addr) -> Result<ContractData, Error>
Returns ContractData for the contract with specified address.
Sourcepub fn dump_wasm_raw(&self, address: &Addr) -> Vec<(Vec<u8>, Vec<u8>)>
pub fn dump_wasm_raw(&self, address: &Addr) -> Vec<(Vec<u8>, Vec<u8>)>
Returns a raw state dump of all key-values held by a contract with specified address.
pub fn set_block(&mut self, block: BlockInfo)
pub fn update_block<F>(&mut self, action: F)
Sourcepub fn block_info(&self) -> BlockInfo
pub fn block_info(&self) -> BlockInfo
Returns a copy of the current block_info
Sourcepub fn wrap(&self) -> QuerierWrapper<'_, <CustomT as Module>::QueryT>
pub fn wrap(&self) -> QuerierWrapper<'_, <CustomT as Module>::QueryT>
Simple helper so we get access to all the QuerierWrapper helpers, eg. wrap().query_wasm_smart, query_all_balances, …
Sourcepub fn execute_multi(
&mut self,
sender: Addr,
msgs: Vec<CosmosMsg<<CustomT as Module>::ExecT>>,
) -> Result<Vec<AppResponse>, Error>
pub fn execute_multi( &mut self, sender: Addr, msgs: Vec<CosmosMsg<<CustomT as Module>::ExecT>>, ) -> Result<Vec<AppResponse>, Error>
Runs multiple CosmosMsg in one atomic operation. This will create a cache before the execution, so no state changes are persisted if any of them return an error. But all writes are persisted on success.
Trait Implementations§
Source§impl Deref for CyberApp
impl Deref for CyberApp
Source§type Target = App<BankKeeper, MockApi, MemoryStorage, CyberModule, WasmKeeper<CyberMsg, CyberQuery>>
type Target = App<BankKeeper, MockApi, MemoryStorage, CyberModule, WasmKeeper<CyberMsg, CyberQuery>>
Source§impl Querier for CyberApp
impl Querier for CyberApp
Source§fn raw_query(&self, bin_request: &[u8]) -> QuerierResult
fn raw_query(&self, bin_request: &[u8]) -> QuerierResult
Auto Trait Implementations§
impl Freeze for CyberApp
impl !RefUnwindSafe for CyberApp
impl !Send for CyberApp
impl !Sync for CyberApp
impl Unpin for CyberApp
impl !UnwindSafe for CyberApp
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more