use cosmwasm_std::CosmosMsg;
#[derive(Debug, PartialEq, Clone, Default)]
#[must_use = "Pass AccountAction to the Executor, see the docs"]
pub struct AccountAction(Vec<CosmosMsg>);
impl AccountAction {
pub fn new() -> Self {
Self(vec![])
}
pub fn messages(&self) -> Vec<CosmosMsg> {
self.0.clone()
}
pub fn merge(&mut self, other: AccountAction) {
self.0.extend(other.0)
}
pub fn from_vec<T>(msgs: Vec<T>) -> Self
where
T: Into<CosmosMsg>,
{
Self(msgs.into_iter().map(Into::into).collect())
}
}
impl<T> From<T> for AccountAction
where
T: Into<CosmosMsg>,
{
fn from(m: T) -> Self {
Self(vec![m.into()])
}
}