use super::*; #[derive(Debug, PartialEq, Clone)] pub enum Object { Address(Address), Hash([u8; 32]), InscriptionId(InscriptionId), Integer(u128), OutPoint(OutPoint), Sat(Sat), SatPoint(SatPoint), } impl FromStr for Object { type Err = Error; fn from_str(s: &str) -> Result { use Representation::*; match Representation::from_str(s)? { Address => Ok(Self::Address(s.parse()?)), Decimal | Degree | Percentile | Name => Ok(Self::Sat(s.parse()?)), Hash => Ok(Self::Hash( bitcoin::hashes::sha256::Hash::from_str(s)?.to_byte_array(), )), InscriptionId => Ok(Self::InscriptionId(s.parse()?)), Integer => Ok(Self::Integer(s.parse()?)), OutPoint => Ok(Self::OutPoint(s.parse()?)), SatPoint => Ok(Self::SatPoint(s.parse()?)), } } } impl Display for Object { fn fmt(&self, f: &mut Formatter) -> fmt::Result { match self { Self::Address(address) => write!(f, "{}", address.clone().assume_checked()), Self::Hash(hash) => {