Skip to main content

blockfrost_openapi/models/
tx_content.rs

1use crate::models;
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
5pub struct TxContent {
6    /// Transaction hash
7    #[serde(rename = "hash")]
8    pub hash: String,
9    /// Block hash
10    #[serde(rename = "block")]
11    pub block: String,
12    /// Block number
13    #[serde(rename = "block_height")]
14    pub block_height: i32,
15    /// Block creation time in UNIX time
16    #[serde(rename = "block_time")]
17    pub block_time: i32,
18    /// Slot number
19    #[serde(rename = "slot")]
20    pub slot: i32,
21    /// Transaction index within the block
22    #[serde(rename = "index")]
23    pub index: i32,
24    #[serde(rename = "output_amount")]
25    pub output_amount: Vec<models::TxContentOutputAmountInner>,
26    /// Fees of the transaction in Lovelaces
27    #[serde(rename = "fees")]
28    pub fees: String,
29    /// Deposit within the transaction in Lovelaces
30    #[serde(rename = "deposit")]
31    pub deposit: String,
32    /// Size of the transaction in Bytes
33    #[serde(rename = "size")]
34    pub size: i32,
35    /// Left (included) endpoint of the timelock validity intervals
36    #[serde(rename = "invalid_before", deserialize_with = "Option::deserialize")]
37    pub invalid_before: Option<String>,
38    /// Right (excluded) endpoint of the timelock validity intervals
39    #[serde(rename = "invalid_hereafter", deserialize_with = "Option::deserialize")]
40    pub invalid_hereafter: Option<String>,
41    /// Count of UTXOs within the transaction
42    #[serde(rename = "utxo_count")]
43    pub utxo_count: i32,
44    /// Count of the withdrawals within the transaction
45    #[serde(rename = "withdrawal_count")]
46    pub withdrawal_count: i32,
47    /// Count of the MIR certificates within the transaction
48    #[serde(rename = "mir_cert_count")]
49    pub mir_cert_count: i32,
50    /// Count of the delegations within the transaction
51    #[serde(rename = "delegation_count")]
52    pub delegation_count: i32,
53    /// Count of the stake keys (de)registration within the transaction
54    #[serde(rename = "stake_cert_count")]
55    pub stake_cert_count: i32,
56    /// Count of the stake pool registration and update certificates within the transaction
57    #[serde(rename = "pool_update_count")]
58    pub pool_update_count: i32,
59    /// Count of the stake pool retirement certificates within the transaction
60    #[serde(rename = "pool_retire_count")]
61    pub pool_retire_count: i32,
62    /// Count of asset mints and burns within the transaction
63    #[serde(rename = "asset_mint_or_burn_count")]
64    pub asset_mint_or_burn_count: i32,
65    /// Count of redeemers within the transaction
66    #[serde(rename = "redeemer_count")]
67    pub redeemer_count: i32,
68    /// True if contract script passed validation
69    #[serde(rename = "valid_contract")]
70    pub valid_contract: bool,
71    /// Treasury donation in Lovelaces
72    #[serde(rename = "treasury_donation")]
73    pub treasury_donation: String,
74}
75
76impl TxContent {
77    pub fn new(hash: String, block: String, block_height: i32, block_time: i32, slot: i32, index: i32, output_amount: Vec<models::TxContentOutputAmountInner>, fees: String, deposit: String, size: i32, invalid_before: Option<String>, invalid_hereafter: Option<String>, utxo_count: i32, withdrawal_count: i32, mir_cert_count: i32, delegation_count: i32, stake_cert_count: i32, pool_update_count: i32, pool_retire_count: i32, asset_mint_or_burn_count: i32, redeemer_count: i32, valid_contract: bool, treasury_donation: String) -> TxContent {
78        TxContent {
79            hash,
80            block,
81            block_height,
82            block_time,
83            slot,
84            index,
85            output_amount,
86            fees,
87            deposit,
88            size,
89            invalid_before,
90            invalid_hereafter,
91            utxo_count,
92            withdrawal_count,
93            mir_cert_count,
94            delegation_count,
95            stake_cert_count,
96            pool_update_count,
97            pool_retire_count,
98            asset_mint_or_burn_count,
99            redeemer_count,
100            valid_contract,
101            treasury_donation,
102        }
103    }
104}
105