cat_gateway/service/common/objects/cardano/
network.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//! Defines API schemas of Cardano network types.

use poem_openapi::Enum;

/// Cardano network type.
#[derive(Clone, Enum, Debug)]
pub(crate) enum Network {
    /// Cardano mainnet.
    #[oai(rename = "mainnet")]
    Mainnet,
    /// Cardano preprod.
    #[oai(rename = "preprod")]
    Preprod,
    /// Cardano preview.
    #[oai(rename = "preview")]
    Preview,
}

impl From<Network> for cardano_chain_follower::Network {
    fn from(value: Network) -> Self {
        match value {
            Network::Mainnet => Self::Mainnet,
            Network::Preprod => Self::Preprod,
            Network::Preview => Self::Preview,
        }
    }
}