Skip to main content

blockfrost_openapi/models/
dreps_inner.rs

1use crate::models;
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
5pub struct DrepsInner {
6    /// The Bech32 encoded DRep address
7    #[serde(rename = "drep_id")]
8    pub drep_id: String,
9    /// The raw bytes of the DRep
10    #[serde(rename = "hex")]
11    pub hex: String,
12    /// The total amount of voting power this DRep is delegated.
13    #[serde(rename = "amount")]
14    pub amount: String,
15    /// Flag indicating whether this DRep's credential is a script hash
16    #[serde(rename = "has_script")]
17    pub has_script: bool,
18    /// Registration state of the DRep. Set to `true` if the DRep has been deregistered; otherwise, `false`.
19    #[serde(rename = "retired")]
20    pub retired: bool,
21    /// Whether the DRep has been inactive for a consecutive number of epochs (determined by an epoch parameter `drep_activity`)
22    #[serde(rename = "expired")]
23    pub expired: bool,
24    /// Epoch of the most recent action - registration, update, deregistration or voting
25    #[serde(rename = "last_active_epoch", deserialize_with = "Option::deserialize")]
26    pub last_active_epoch: Option<i32>,
27    #[serde(rename = "metadata", deserialize_with = "Option::deserialize")]
28    pub metadata: Option<Box<models::DrepsInnerMetadata>>,
29}
30
31impl DrepsInner {
32    pub fn new(drep_id: String, hex: String, amount: String, has_script: bool, retired: bool, expired: bool, last_active_epoch: Option<i32>, metadata: Option<models::DrepsInnerMetadata>) -> DrepsInner {
33        DrepsInner {
34            drep_id,
35            hex,
36            amount,
37            has_script,
38            retired,
39            expired,
40            last_active_epoch,
41            metadata: if let Some(x) = metadata {Some(Box::new(x))} else {None},
42        }
43    }
44}
45