Skip to main content

blockfrost_openapi/models/
epoch_content.rs

1use crate::models;
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
5pub struct EpochContent {
6    /// Epoch number
7    #[serde(rename = "epoch")]
8    pub epoch: i32,
9    /// Unix time of the start of the epoch
10    #[serde(rename = "start_time")]
11    pub start_time: i32,
12    /// Unix time of the end of the epoch
13    #[serde(rename = "end_time")]
14    pub end_time: i32,
15    /// Unix time of the first block of the epoch
16    #[serde(rename = "first_block_time")]
17    pub first_block_time: i32,
18    /// Unix time of the last block of the epoch
19    #[serde(rename = "last_block_time")]
20    pub last_block_time: i32,
21    /// Number of blocks within the epoch
22    #[serde(rename = "block_count")]
23    pub block_count: i32,
24    /// Number of transactions within the epoch
25    #[serde(rename = "tx_count")]
26    pub tx_count: i32,
27    /// Sum of all the transactions within the epoch in Lovelaces
28    #[serde(rename = "output")]
29    pub output: String,
30    /// Sum of all the fees within the epoch in Lovelaces
31    #[serde(rename = "fees")]
32    pub fees: String,
33    /// Sum of all the active stakes within the epoch in Lovelaces
34    #[serde(rename = "active_stake", deserialize_with = "Option::deserialize")]
35    pub active_stake: Option<String>,
36}
37
38impl EpochContent {
39    pub fn new(epoch: i32, start_time: i32, end_time: i32, first_block_time: i32, last_block_time: i32, block_count: i32, tx_count: i32, output: String, fees: String, active_stake: Option<String>) -> EpochContent {
40        EpochContent {
41            epoch,
42            start_time,
43            end_time,
44            first_block_time,
45            last_block_time,
46            block_count,
47            tx_count,
48            output,
49            fees,
50            active_stake,
51        }
52    }
53}
54