fireblocks-sdk 2026.3.27

Rust implementation of the Fireblocks SDK
Documentation
// Fireblocks API
//
// Fireblocks provides a suite of applications to manage digital asset operations and a complete development platform to build your business on the blockchain.  - Visit our website for more information: [Fireblocks Website](https://fireblocks.com) - Visit our developer docs: [Fireblocks DevPortal](https://developers.fireblocks.com)
//
// The version of the OpenAPI document: 1.8.0
// Contact: developers@fireblocks.com
// Generated by: https://openapi-generator.tech

use {
    crate::models,
    serde::{Deserialize, Deserializer, Serialize, Serializer},
};

#[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum ChainDescriptor {
    Eth,
    Sol,
    Matic,
    EthTest6,
    SolTest,
    Other(String),
}

impl<'de> Deserialize<'de> for ChainDescriptor {
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: Deserializer<'de>,
    {
        let s = String::deserialize(deserializer)?;
        match s.as_str() {
            "ETH" => Ok(ChainDescriptor::Eth),
            "SOL" => Ok(ChainDescriptor::Sol),
            "MATIC" => Ok(ChainDescriptor::Matic),
            "ETH_TEST6" => Ok(ChainDescriptor::EthTest6),
            "SOL_TEST" => Ok(ChainDescriptor::SolTest),
            _ => Ok(ChainDescriptor::Other(s)),
        }
    }
}

impl Serialize for ChainDescriptor {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        let s = match self {
            ChainDescriptor::Eth => "ETH",
            ChainDescriptor::Sol => "SOL",
            ChainDescriptor::Matic => "MATIC",
            ChainDescriptor::EthTest6 => "ETH_TEST6",
            ChainDescriptor::SolTest => "SOL_TEST",
            ChainDescriptor::Other(s) => s,
        };
        serializer.serialize_str(s)
    }
}

impl std::fmt::Display for ChainDescriptor {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        match self {
            Self::Eth => write!(f, "ETH"),
            Self::Sol => write!(f, "SOL"),
            Self::Matic => write!(f, "MATIC"),
            Self::EthTest6 => write!(f, "ETH_TEST6"),
            Self::SolTest => write!(f, "SOL_TEST"),
            Self::Other(s) => write!(f, "{}", s),
        }
    }
}

impl Default for ChainDescriptor {
    fn default() -> ChainDescriptor {
        Self::Eth
    }
}