Skip to main content

blockfrost_openapi/models/
proposals_inner.rs

1use crate::models;
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
5pub struct ProposalsInner {
6    /// Governance Action Identifier (CIP-0129)
7    #[serde(rename = "id")]
8    pub id: String,
9    /// Hash of the proposal transaction.
10    #[serde(rename = "tx_hash")]
11    pub tx_hash: String,
12    /// Index of the certificate within the proposal transaction.
13    #[serde(rename = "cert_index")]
14    pub cert_index: i32,
15    /// Type of proposal.
16    #[serde(rename = "governance_type")]
17    pub governance_type: GovernanceType,
18}
19
20impl ProposalsInner {
21    pub fn new(id: String, tx_hash: String, cert_index: i32, governance_type: GovernanceType) -> ProposalsInner {
22        ProposalsInner {
23            id,
24            tx_hash,
25            cert_index,
26            governance_type,
27        }
28    }
29}
30/// Type of proposal.
31#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
32pub enum GovernanceType {
33    #[serde(rename = "hard_fork_initiation")]
34    HardForkInitiation,
35    #[serde(rename = "new_committee")]
36    NewCommittee,
37    #[serde(rename = "new_constitution")]
38    NewConstitution,
39    #[serde(rename = "info_action")]
40    InfoAction,
41    #[serde(rename = "no_confidence")]
42    NoConfidence,
43    #[serde(rename = "parameter_change")]
44    ParameterChange,
45    #[serde(rename = "treasury_withdrawals")]
46    TreasuryWithdrawals,
47}
48
49impl Default for GovernanceType {
50    fn default() -> GovernanceType {
51        Self::HardForkInitiation
52    }
53}
54