Skip to main content

blockfrost_openapi/models/
proposal_metadata.rs

1use crate::models;
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
5pub struct ProposalMetadata {
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")]
26    pub bytes: String,
27}
28
29impl ProposalMetadata {
30    pub fn new(id: String, tx_hash: String, cert_index: i32, url: String, hash: String, json_metadata: Option<serde_json::Value>, bytes: String) -> ProposalMetadata {
31        ProposalMetadata {
32            id,
33            tx_hash,
34            cert_index,
35            url,
36            hash,
37            json_metadata,
38            bytes,
39        }
40    }
41}
42