Skip to main content

blockfrost_openapi/models/
certificate_message.rs

1use crate::models;
2use serde::{Deserialize, Serialize};
3
4/// CertificateMessage : Certificate represents a Mithril certificate embedding a Mithril STM multi signature
5#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
6pub struct CertificateMessage {
7    /// Hash of the current certificate
8    #[serde(rename = "hash")]
9    pub hash: String,
10    /// Hash of the previous certificate
11    #[serde(rename = "previous_hash")]
12    pub previous_hash: String,
13    /// Cardano chain epoch number
14    #[serde(rename = "epoch")]
15    pub epoch: i64,
16    #[serde(rename = "beacon", skip_serializing_if = "Option::is_none")]
17    pub beacon: Option<models::CardanoDbBeacon>,
18    /// Entity type of the message that is signed
19    #[serde(rename = "signed_entity_type")]
20    pub signed_entity_type: std::collections::HashMap<String, serde_json::Value>,
21    #[serde(rename = "metadata")]
22    pub metadata: Box<models::CertificateMetadata>,
23    #[serde(rename = "protocol_message")]
24    pub protocol_message: Box<models::ProtocolMessage>,
25    /// Hash of the protocol message that is signed by the signer participants
26    #[serde(rename = "signed_message")]
27    pub signed_message: String,
28    /// Aggregate verification key used to verify the multi signature
29    #[serde(rename = "aggregate_verification_key")]
30    pub aggregate_verification_key: String,
31    /// STM multi signature created from a quorum of single signatures from the signers
32    #[serde(rename = "multi_signature")]
33    pub multi_signature: String,
34    /// Genesis signature created to bootstrap the certificate chain with the Cardano Genesis Keys
35    #[serde(rename = "genesis_signature")]
36    pub genesis_signature: String,
37}
38
39impl CertificateMessage {
40    /// Certificate represents a Mithril certificate embedding a Mithril STM multi signature
41    pub fn new(hash: String, previous_hash: String, epoch: i64, signed_entity_type: std::collections::HashMap<String, serde_json::Value>, metadata: models::CertificateMetadata, protocol_message: models::ProtocolMessage, signed_message: String, aggregate_verification_key: String, multi_signature: String, genesis_signature: String) -> CertificateMessage {
42        CertificateMessage {
43            hash,
44            previous_hash,
45            epoch,
46            beacon: None,
47            signed_entity_type,
48            metadata: Box::new(metadata),
49            protocol_message: Box::new(protocol_message),
50            signed_message,
51            aggregate_verification_key,
52            multi_signature,
53            genesis_signature,
54        }
55    }
56}
57