abstract_ica/
chain_type.rsuse std::fmt::Display;
use abstract_sdk::std::constants::*;
use abstract_sdk::std::objects::TruncatedChainId;
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum ChainType {
Evm,
Cosmos,
}
impl Display for ChainType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
ChainType::Evm => write!(f, "EVM"),
ChainType::Cosmos => write!(f, "Cosmos"),
}
}
}
pub trait CastChainType {
fn chain_type(&self) -> Option<ChainType>;
}
impl CastChainType for TruncatedChainId {
fn chain_type(&self) -> Option<ChainType> {
let chains = map_macro::hash_map! {
ARCHWAY[0] => ChainType::Cosmos,
ARCHWAY[1] => ChainType::Cosmos,
NEUTRON[0] => ChainType::Cosmos,
NEUTRON[1] => ChainType::Cosmos,
KUJIRA[0] => ChainType::Cosmos,
KUJIRA[1] => ChainType::Cosmos,
TERRA[0] => ChainType::Cosmos,
TERRA[1] => ChainType::Cosmos,
OSMOSIS[0] => ChainType::Cosmos,
OSMOSIS[1] => ChainType::Cosmos,
JUNO[0] => ChainType::Cosmos,
JUNO[1] => ChainType::Cosmos,
UNION[0] => ChainType::Cosmos,
XION[0] => ChainType::Cosmos,
BERACHAIN[0] => ChainType::Evm,
ETHEREUM[0] => ChainType::Evm,
ETHEREUM[1] => ChainType::Evm,
};
chains.get(self.as_str()).copied()
}
}