Skip to main content

blockfrost_openapi/models/
drep_votes_inner.rs

1use crate::models;
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
5pub struct DrepVotesInner {
6    /// Hash of the vote transaction.
7    #[serde(rename = "tx_hash")]
8    pub tx_hash: String,
9    /// Index of the certificate within the vote transaction.
10    #[serde(rename = "cert_index")]
11    pub cert_index: i32,
12    /// Governance Action Identifier (CIP-0129) of the proposal being voted on.
13    #[serde(rename = "proposal_id")]
14    pub proposal_id: String,
15    /// Hash of the proposal transaction.
16    #[serde(rename = "proposal_tx_hash")]
17    pub proposal_tx_hash: String,
18    /// Index of the certificate within the proposal transaction.
19    #[serde(rename = "proposal_cert_index")]
20    pub proposal_cert_index: i32,
21    /// The Vote. Can be one of yes, no, abstain.
22    #[serde(rename = "vote")]
23    pub vote: Vote,
24}
25
26impl DrepVotesInner {
27    pub fn new(tx_hash: String, cert_index: i32, proposal_id: String, proposal_tx_hash: String, proposal_cert_index: i32, vote: Vote) -> DrepVotesInner {
28        DrepVotesInner {
29            tx_hash,
30            cert_index,
31            proposal_id,
32            proposal_tx_hash,
33            proposal_cert_index,
34            vote,
35        }
36    }
37}
38/// The Vote. Can be one of yes, no, abstain.
39#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
40pub enum Vote {
41    #[serde(rename = "yes")]
42    Yes,
43    #[serde(rename = "no")]
44    No,
45    #[serde(rename = "abstain")]
46    Abstain,
47}
48
49impl Default for Vote {
50    fn default() -> Vote {
51        Self::Yes
52    }
53}
54