ve3_shared/extensions/
cosmosmsg_ext.rs1use cosmwasm_std::{CosmosMsg, StdError, StdResult};
2
3pub trait CosmosMsgExt {
4 fn to_specific<T>(self) -> StdResult<cosmwasm_std::CosmosMsg<T>>;
5}
6
7impl CosmosMsgExt for cosmwasm_std::CosmosMsg {
8 fn to_specific<T>(self) -> StdResult<cosmwasm_std::CosmosMsg<T>> {
9 match self {
10 cosmwasm_std::CosmosMsg::Bank(msg) => Ok(cosmwasm_std::CosmosMsg::Bank(msg)),
11 cosmwasm_std::CosmosMsg::Wasm(msg) => Ok(cosmwasm_std::CosmosMsg::Wasm(msg)),
12 cosmwasm_std::CosmosMsg::Ibc(msg) => Ok(cosmwasm_std::CosmosMsg::Ibc(msg)),
17 cosmwasm_std::CosmosMsg::Gov(msg) => Ok(cosmwasm_std::CosmosMsg::Gov(msg)),
18 Self::Stargate {
19 type_url,
20 value,
21 } => Ok(CosmosMsg::<T>::Stargate {
22 type_url,
23 value,
24 }),
25 _ => Err(StdError::generic_err("not supported")),
26 }
27 }
28}