Skip to main content

blockfrost_openapi/models/
drep_updates_inner.rs

1use crate::models;
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
5pub struct DrepUpdatesInner {
6    /// Transaction ID
7    #[serde(rename = "tx_hash")]
8    pub tx_hash: String,
9    /// Index of the certificate within the update transaction.
10    #[serde(rename = "cert_index")]
11    pub cert_index: i32,
12    /// Action in the certificate
13    #[serde(rename = "action")]
14    pub action: Action,
15    /// Deposit in Lovelaces paid at this registration. `null` on `deregistered` and `updated` rows.
16    #[serde(rename = "deposit", deserialize_with = "Option::deserialize")]
17    pub deposit: Option<String>,
18}
19
20impl DrepUpdatesInner {
21    pub fn new(tx_hash: String, cert_index: i32, action: Action, deposit: Option<String>) -> DrepUpdatesInner {
22        DrepUpdatesInner {
23            tx_hash,
24            cert_index,
25            action,
26            deposit,
27        }
28    }
29}
30/// Action in the certificate
31#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
32pub enum Action {
33    #[serde(rename = "registered")]
34    Registered,
35    #[serde(rename = "deregistered")]
36    Deregistered,
37    #[serde(rename = "updated")]
38    Updated,
39}
40
41impl Default for Action {
42    fn default() -> Action {
43        Self::Registered
44    }
45}
46