abstract_sdk/base/features/
executor.rs

1use abstract_std::account;
2use cosmwasm_std::{wasm_execute, Coin, CosmosMsg, Deps};
3
4use crate::AbstractSdkResult;
5
6use super::AccountIdentification;
7
8/// Trait for modules that are allowed to execute on the account.
9pub trait AccountExecutor: AccountIdentification {
10    /// Execute method on account contract
11    fn execute_on_account(
12        &self,
13        deps: Deps,
14        msg: &account::ExecuteMsg,
15        funds: Vec<Coin>,
16    ) -> AbstractSdkResult<CosmosMsg> {
17        let account_address = self.account(deps)?;
18        wasm_execute(account_address.into_addr(), msg, funds)
19            .map(Into::into)
20            .map_err(Into::into)
21    }
22}
23
24impl<T> AccountExecutor for T where T: AccountIdentification {}