Trait cw_orch_core::environment::TxHandler

source ·
pub trait TxHandler: ChainState + Clone {
    type Response: IndexResponse + Debug + Send + Clone;
    type Error: Into<CwEnvError> + Debug + Error + Send + Sync + 'static;
    type ContractSource;
    type Sender: Clone;

    // Required methods
    fn sender(&self) -> Addr;
    fn set_sender(&mut self, sender: Self::Sender);
    fn upload<T: Uploadable>(
        &self,
        contract_source: &T
    ) -> Result<Self::Response, Self::Error>;
    fn instantiate<I: Serialize + Debug>(
        &self,
        code_id: u64,
        init_msg: &I,
        label: Option<&str>,
        admin: Option<&Addr>,
        coins: &[Coin]
    ) -> Result<Self::Response, Self::Error>;
    fn instantiate2<I: Serialize + Debug>(
        &self,
        code_id: u64,
        init_msg: &I,
        label: Option<&str>,
        admin: Option<&Addr>,
        coins: &[Coin],
        salt: Binary
    ) -> Result<Self::Response, Self::Error>;
    fn execute<E: Serialize + Debug>(
        &self,
        exec_msg: &E,
        coins: &[Coin],
        contract_address: &Addr
    ) -> Result<Self::Response, Self::Error>;
    fn migrate<M: Serialize + Debug>(
        &self,
        migrate_msg: &M,
        new_code_id: u64,
        contract_address: &Addr
    ) -> Result<Self::Response, Self::Error>;

    // Provided method
    fn call_as(&self, sender: &<Self as TxHandler>::Sender) -> Self { ... }
}
Expand description

Signer trait for chains. Accesses the sender information from the chain object to perform actions.

Required Associated Types§

source

type Response: IndexResponse + Debug + Send + Clone

Response type for transactions on an environment.

source

type Error: Into<CwEnvError> + Debug + Error + Send + Sync + 'static

Error type for transactions on an environment.

source

type ContractSource

Source type for uploading to the environment.

source

type Sender: Clone

Required Methods§

source

fn sender(&self) -> Addr

Gets the address of the current wallet used to sign transactions.

source

fn set_sender(&mut self, sender: Self::Sender)

Sets wallet to sign transactions.

source

fn upload<T: Uploadable>( &self, contract_source: &T ) -> Result<Self::Response, Self::Error>

Uploads a contract to the chain.

source

fn instantiate<I: Serialize + Debug>( &self, code_id: u64, init_msg: &I, label: Option<&str>, admin: Option<&Addr>, coins: &[Coin] ) -> Result<Self::Response, Self::Error>

Send a InstantiateMsg to a contract.

source

fn instantiate2<I: Serialize + Debug>( &self, code_id: u64, init_msg: &I, label: Option<&str>, admin: Option<&Addr>, coins: &[Coin], salt: Binary ) -> Result<Self::Response, Self::Error>

Send a Instantiate2Msg to a contract.

source

fn execute<E: Serialize + Debug>( &self, exec_msg: &E, coins: &[Coin], contract_address: &Addr ) -> Result<Self::Response, Self::Error>

Send a ExecMsg to a contract.

source

fn migrate<M: Serialize + Debug>( &self, migrate_msg: &M, new_code_id: u64, contract_address: &Addr ) -> Result<Self::Response, Self::Error>

Send a MigrateMsg to a contract.

Provided Methods§

source

fn call_as(&self, sender: &<Self as TxHandler>::Sender) -> Self

Clones the chain with a different sender. Usually used to call a contract as a different sender.

Object Safety§

This trait is not object safe.

Implementors§