use crate::AddressError;
use crate::errors::Bech32Error;
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
#[repr(u8)]
#[non_exhaustive]
pub enum AddressType {
AccountId = Self::ACCOUNT_ID,
}
impl AddressType {
const ACCOUNT_ID: u8 = 232;
}
impl TryFrom<u8> for AddressType {
type Error = AddressError;
fn try_from(byte: u8) -> Result<Self, Self::Error> {
match byte {
Self::ACCOUNT_ID => Ok(Self::AccountId),
other => Err(AddressError::Bech32DecodeError(Bech32Error::UnknownAddressType(other))),
}
}
}