Skip to main content

blockfrost_openapi/models/
proposal_metadata_v2.rs

1use crate::models;
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
5pub struct ProposalMetadataV2 {
6    /// Governance Action Identifier (CIP-0129)
7    #[serde(rename = "id")]
8    pub id: String,
9    /// Off-chain metadata of a proposal with a specific transaction hash
10    #[serde(rename = "tx_hash")]
11    pub tx_hash: String,
12    /// Off-chain metadata of a proposal with a specific transaction cert_index
13    #[serde(rename = "cert_index")]
14    pub cert_index: i32,
15    /// URL to the proposal metadata
16    #[serde(rename = "url")]
17    pub url: String,
18    /// Hash of the metadata file
19    #[serde(rename = "hash")]
20    pub hash: String,
21    /// Content of the JSON metadata (validated CIP-108)
22    #[serde(rename = "json_metadata", deserialize_with = "Option::deserialize")]
23    pub json_metadata: Option<serde_json::Value>,
24    /// Content of the metadata (raw)
25    #[serde(rename = "bytes", deserialize_with = "Option::deserialize")]
26    pub bytes: Option<String>,
27    #[serde(rename = "error", skip_serializing_if = "Option::is_none")]
28    pub error: Option<Box<models::DrepMetadataError>>,
29}
30
31impl ProposalMetadataV2 {
32    pub fn new(id: String, tx_hash: String, cert_index: i32, url: String, hash: String, json_metadata: Option<serde_json::Value>, bytes: Option<String>) -> ProposalMetadataV2 {
33        ProposalMetadataV2 {
34            id,
35            tx_hash,
36            cert_index,
37            url,
38            hash,
39            json_metadata,
40            bytes,
41            error: None,
42        }
43    }
44}
45