Struct cw_multi_test::App
source · [−]pub struct App<Bank = BankKeeper, Api = MockApi, Storage = MockStorage, Custom = FailingModule<Empty, Empty, Empty>, Wasm = WasmKeeper<Empty, Empty>, Staking = FailingStaking, Distr = FailingDistribution> { /* private fields */ }
Expand description
Router is a persisted state. You can query this. Execution generally happens on the RouterCache, which then can be atomically committed or rolled back. We offer .execute() as a wrapper around cache, execute, commit/rollback process.
Implementations
sourceimpl App<BankKeeper, MockApi, MemoryStorage, FailingModule<ExecC, QueryC, Empty>, WasmKeeper<ExecC, QueryC>, FailingModule<StakingMsg, StakingQuery, StakingSudo>, FailingModule<DistributionMsg, Empty, Empty>>
impl App<BankKeeper, MockApi, MemoryStorage, FailingModule<ExecC, QueryC, Empty>, WasmKeeper<ExecC, QueryC>, FailingModule<StakingMsg, StakingQuery, StakingSudo>, FailingModule<DistributionMsg, Empty, Empty>>
sourcepub fn new<F>(init_fn: F) -> Self where
F: FnOnce(&mut Router<BankKeeper, FailingModule<Empty, Empty, Empty>, WasmKeeper<Empty, Empty>, FailingStaking, FailingDistribution>, &dyn Api, &mut dyn Storage),
pub fn new<F>(init_fn: F) -> Self where
F: FnOnce(&mut Router<BankKeeper, FailingModule<Empty, Empty, Empty>, WasmKeeper<Empty, Empty>, FailingStaking, FailingDistribution>, &dyn Api, &mut dyn Storage),
Creates new default App
implementation working with Empty custom messages.
sourceimpl<BankT, ApiT, StorageT, CustomT, WasmT, StakingT, DistrT> App<BankT, ApiT, StorageT, CustomT, WasmT, StakingT, DistrT> where
WasmT: Wasm<CustomT::ExecT, CustomT::QueryT>,
BankT: Bank,
ApiT: Api,
StorageT: Storage,
CustomT: Module,
StakingT: Staking,
DistrT: Distribution,
impl<BankT, ApiT, StorageT, CustomT, WasmT, StakingT, DistrT> App<BankT, ApiT, StorageT, CustomT, WasmT, StakingT, DistrT> where
WasmT: Wasm<CustomT::ExecT, CustomT::QueryT>,
BankT: Bank,
ApiT: Api,
StorageT: Storage,
CustomT: Module,
StakingT: Staking,
DistrT: Distribution,
pub fn init_modules<F, T>(&mut self, init_fn: F) -> T where
F: FnOnce(&mut Router<BankT, CustomT, WasmT, StakingT, DistrT>, &dyn Api, &mut dyn Storage) -> T,
pub fn read_module<F, T>(&self, query_fn: F) -> T where
F: FnOnce(&Router<BankT, CustomT, WasmT, StakingT, DistrT>, &dyn Api, &dyn Storage) -> T,
sourceimpl<BankT, ApiT, StorageT, CustomT, StakingT, DistrT> App<BankT, ApiT, StorageT, CustomT, WasmKeeper<CustomT::ExecT, CustomT::QueryT>, StakingT, DistrT> where
BankT: Bank,
ApiT: Api,
StorageT: Storage,
CustomT: Module,
StakingT: Staking,
DistrT: Distribution,
CustomT::ExecT: Clone + Debug + PartialEq + JsonSchema + DeserializeOwned + 'static,
CustomT::QueryT: CustomQuery + DeserializeOwned + 'static,
impl<BankT, ApiT, StorageT, CustomT, StakingT, DistrT> App<BankT, ApiT, StorageT, CustomT, WasmKeeper<CustomT::ExecT, CustomT::QueryT>, StakingT, DistrT> where
BankT: Bank,
ApiT: Api,
StorageT: Storage,
CustomT: Module,
StakingT: Staking,
DistrT: Distribution,
CustomT::ExecT: Clone + Debug + PartialEq + JsonSchema + DeserializeOwned + 'static,
CustomT::QueryT: CustomQuery + DeserializeOwned + 'static,
sourcepub fn store_code(
&mut self,
code: Box<dyn Contract<CustomT::ExecT, CustomT::QueryT>>
) -> u64
pub fn store_code(
&mut self,
code: Box<dyn Contract<CustomT::ExecT, CustomT::QueryT>>
) -> u64
This registers contract code (like uploading wasm bytecode on a chain), so it can later be used to instantiate a contract.
sourcepub fn contract_data(&self, address: &Addr) -> AnyResult<ContractData>
pub fn contract_data(&self, address: &Addr) -> AnyResult<ContractData>
This allows to get ContractData
for specific contract
sourcepub fn dump_wasm_raw(&self, address: &Addr) -> Vec<Record>
pub fn dump_wasm_raw(&self, address: &Addr) -> Vec<Record>
This gets a raw state dump of all key-values held by a given contract
sourceimpl<BankT, ApiT, StorageT, CustomT, WasmT, StakingT, DistrT> App<BankT, ApiT, StorageT, CustomT, WasmT, StakingT, DistrT> where
CustomT::ExecT: Debug + PartialEq + Clone + JsonSchema + DeserializeOwned + 'static,
CustomT::QueryT: CustomQuery + DeserializeOwned + 'static,
WasmT: Wasm<CustomT::ExecT, CustomT::QueryT>,
BankT: Bank,
ApiT: Api,
StorageT: Storage,
CustomT: Module,
StakingT: Staking,
DistrT: Distribution,
impl<BankT, ApiT, StorageT, CustomT, WasmT, StakingT, DistrT> App<BankT, ApiT, StorageT, CustomT, WasmT, StakingT, DistrT> where
CustomT::ExecT: Debug + PartialEq + Clone + JsonSchema + DeserializeOwned + 'static,
CustomT::QueryT: CustomQuery + DeserializeOwned + 'static,
WasmT: Wasm<CustomT::ExecT, CustomT::QueryT>,
BankT: Bank,
ApiT: Api,
StorageT: Storage,
CustomT: Module,
StakingT: Staking,
DistrT: Distribution,
pub fn set_block(&mut self, block: BlockInfo)
pub fn update_block<F: Fn(&mut BlockInfo)>(&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::QueryT>
pub fn wrap(&self) -> QuerierWrapper<'_, CustomT::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::ExecT>>
) -> AnyResult<Vec<AppResponse>>
pub fn execute_multi(
&mut self,
sender: Addr,
msgs: Vec<CosmosMsg<CustomT::ExecT>>
) -> AnyResult<Vec<AppResponse>>
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.
sourcepub fn wasm_sudo<T: Serialize, U: Into<Addr>>(
&mut self,
contract_addr: U,
msg: &T
) -> AnyResult<AppResponse>
pub fn wasm_sudo<T: Serialize, U: Into<Addr>>(
&mut self,
contract_addr: U,
msg: &T
) -> AnyResult<AppResponse>
Call a smart contract in “sudo” mode. This will create a cache before the execution, so no state changes are persisted if this returns an error, but all are persisted on success.
sourcepub fn sudo(&mut self, msg: SudoMsg) -> AnyResult<AppResponse>
pub fn sudo(&mut self, msg: SudoMsg) -> AnyResult<AppResponse>
Runs arbitrary SudoMsg. This will create a cache before the execution, so no state changes are persisted if this returns an error, but all are persisted on success.
Trait Implementations
sourceimpl<BankT, ApiT, StorageT, CustomT, WasmT, StakingT, DistrT> Executor<<CustomT as Module>::ExecT> for App<BankT, ApiT, StorageT, CustomT, WasmT, StakingT, DistrT> where
CustomT::ExecT: Clone + Debug + PartialEq + JsonSchema + DeserializeOwned + 'static,
CustomT::QueryT: CustomQuery + DeserializeOwned + 'static,
WasmT: Wasm<CustomT::ExecT, CustomT::QueryT>,
BankT: Bank,
ApiT: Api,
StorageT: Storage,
CustomT: Module,
StakingT: Staking,
DistrT: Distribution,
impl<BankT, ApiT, StorageT, CustomT, WasmT, StakingT, DistrT> Executor<<CustomT as Module>::ExecT> for App<BankT, ApiT, StorageT, CustomT, WasmT, StakingT, DistrT> where
CustomT::ExecT: Clone + Debug + PartialEq + JsonSchema + DeserializeOwned + 'static,
CustomT::QueryT: CustomQuery + DeserializeOwned + 'static,
WasmT: Wasm<CustomT::ExecT, CustomT::QueryT>,
BankT: Bank,
ApiT: Api,
StorageT: Storage,
CustomT: Module,
StakingT: Staking,
DistrT: Distribution,
sourcefn execute(
&mut self,
sender: Addr,
msg: CosmosMsg<CustomT::ExecT>
) -> AnyResult<AppResponse>
fn execute(
&mut self,
sender: Addr,
msg: CosmosMsg<CustomT::ExecT>
) -> AnyResult<AppResponse>
Runs arbitrary CosmosMsg. This will create a cache before the execution, so no state changes are persisted if this returns an error, but all are persisted on success. Read more
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() Read more
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 around execute(), but we parse out the data field to that what is returned by the contract (not the protobuf wrapper) Read more
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>
Migrate a contract. Sender must be registered admin. This is just a helper around execute() Read more
fn send_tokens(
&mut self,
sender: Addr,
recipient: Addr,
amount: &[Coin]
) -> AnyResult<AppResponse>
sourceimpl<BankT, ApiT, StorageT, CustomT, WasmT, StakingT, DistrT> Querier for App<BankT, ApiT, StorageT, CustomT, WasmT, StakingT, DistrT> where
CustomT::ExecT: Clone + Debug + PartialEq + JsonSchema + DeserializeOwned + 'static,
CustomT::QueryT: CustomQuery + DeserializeOwned + 'static,
WasmT: Wasm<CustomT::ExecT, CustomT::QueryT>,
BankT: Bank,
ApiT: Api,
StorageT: Storage,
CustomT: Module,
StakingT: Staking,
DistrT: Distribution,
impl<BankT, ApiT, StorageT, CustomT, WasmT, StakingT, DistrT> Querier for App<BankT, ApiT, StorageT, CustomT, WasmT, StakingT, DistrT> where
CustomT::ExecT: Clone + Debug + PartialEq + JsonSchema + DeserializeOwned + 'static,
CustomT::QueryT: CustomQuery + DeserializeOwned + 'static,
WasmT: Wasm<CustomT::ExecT, CustomT::QueryT>,
BankT: Bank,
ApiT: Api,
StorageT: Storage,
CustomT: Module,
StakingT: Staking,
DistrT: Distribution,
sourcefn raw_query(&self, bin_request: &[u8]) -> QuerierResult
fn raw_query(&self, bin_request: &[u8]) -> QuerierResult
raw_query is all that must be implemented for the Querier. This allows us to pass through binary queries from one level to another without knowing the custom format, or we can decode it, with the knowledge of the allowed types. People using the querier probably want one of the simpler auto-generated helper methods Read more
Auto Trait Implementations
impl<Bank, Api, Storage, Custom, Wasm, Staking, Distr> RefUnwindSafe for App<Bank, Api, Storage, Custom, Wasm, Staking, Distr> where
Api: RefUnwindSafe,
Bank: RefUnwindSafe,
Custom: RefUnwindSafe,
Distr: RefUnwindSafe,
Staking: RefUnwindSafe,
Storage: RefUnwindSafe,
Wasm: RefUnwindSafe,
impl<Bank, Api, Storage, Custom, Wasm, Staking, Distr> Send for App<Bank, Api, Storage, Custom, Wasm, Staking, Distr> where
Api: Send,
Bank: Send,
Custom: Send,
Distr: Send,
Staking: Send,
Storage: Send,
Wasm: Send,
impl<Bank, Api, Storage, Custom, Wasm, Staking, Distr> Sync for App<Bank, Api, Storage, Custom, Wasm, Staking, Distr> where
Api: Sync,
Bank: Sync,
Custom: Sync,
Distr: Sync,
Staking: Sync,
Storage: Sync,
Wasm: Sync,
impl<Bank, Api, Storage, Custom, Wasm, Staking, Distr> Unpin for App<Bank, Api, Storage, Custom, Wasm, Staking, Distr> where
Api: Unpin,
Bank: Unpin,
Custom: Unpin,
Distr: Unpin,
Staking: Unpin,
Storage: Unpin,
Wasm: Unpin,
impl<Bank, Api, Storage, Custom, Wasm, Staking, Distr> UnwindSafe for App<Bank, Api, Storage, Custom, Wasm, Staking, Distr> where
Api: UnwindSafe,
Bank: UnwindSafe,
Custom: UnwindSafe,
Distr: UnwindSafe,
Staking: UnwindSafe,
Storage: UnwindSafe,
Wasm: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more