Skip to main content

stellar_xdr/generated/
ledger_close_meta_v1.rs

1#[allow(unused_imports, clippy::wildcard_imports)]
2use super::*;
3
4/// LedgerCloseMetaV1 is an XDR Struct defined as:
5///
6/// ```text
7/// struct LedgerCloseMetaV1
8/// {
9///     LedgerCloseMetaExt ext;
10///
11///     LedgerHeaderHistoryEntry ledgerHeader;
12///
13///     GeneralizedTransactionSet txSet;
14///
15///     // NB: transactions are sorted in apply order here
16///     // fees for all transactions are processed first
17///     // followed by applying transactions
18///     TransactionResultMeta txProcessing<>;
19///
20///     // upgrades are applied last
21///     UpgradeEntryMeta upgradesProcessing<>;
22///
23///     // other misc information attached to the ledger close
24///     SCPHistoryEntry scpInfo<>;
25///
26///     // Size in bytes of live Soroban state, to support downstream
27///     // systems calculating storage fees correctly.
28///     uint64 totalByteSizeOfLiveSorobanState;
29///
30///     // TTL and data/code keys that have been evicted at this ledger.
31///     LedgerKey evictedKeys<>;
32///
33///     // Maintained for backwards compatibility, should never be populated.
34///     LedgerEntry unused<>;
35/// };
36/// ```
37///
38#[cfg_attr(feature = "alloc", derive(Default))]
39#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
40#[cfg_attr(feature = "serde", cfg_eval::cfg_eval)]
41#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
42#[cfg_attr(
43    all(feature = "serde", feature = "alloc"),
44    serde_with::serde_as,
45    derive(serde::Serialize, serde::Deserialize),
46    serde(rename_all = "snake_case")
47)]
48#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
49pub struct LedgerCloseMetaV1 {
50    pub ext: LedgerCloseMetaExt,
51    pub ledger_header: LedgerHeaderHistoryEntry,
52    pub tx_set: GeneralizedTransactionSet,
53    pub tx_processing: VecM<TransactionResultMeta>,
54    pub upgrades_processing: VecM<UpgradeEntryMeta>,
55    pub scp_info: VecM<ScpHistoryEntry>,
56    #[cfg_attr(
57        all(feature = "serde", feature = "alloc"),
58        serde_as(as = "NumberOrString")
59    )]
60    pub total_byte_size_of_live_soroban_state: u64,
61    pub evicted_keys: VecM<LedgerKey>,
62    pub unused: VecM<LedgerEntry>,
63}
64
65impl ReadXdr for LedgerCloseMetaV1 {
66    #[cfg(feature = "std")]
67    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self, Error> {
68        r.with_limited_depth(|r| {
69            Ok(Self {
70                ext: LedgerCloseMetaExt::read_xdr(r)?,
71                ledger_header: LedgerHeaderHistoryEntry::read_xdr(r)?,
72                tx_set: GeneralizedTransactionSet::read_xdr(r)?,
73                tx_processing: VecM::<TransactionResultMeta>::read_xdr(r)?,
74                upgrades_processing: VecM::<UpgradeEntryMeta>::read_xdr(r)?,
75                scp_info: VecM::<ScpHistoryEntry>::read_xdr(r)?,
76                total_byte_size_of_live_soroban_state: u64::read_xdr(r)?,
77                evicted_keys: VecM::<LedgerKey>::read_xdr(r)?,
78                unused: VecM::<LedgerEntry>::read_xdr(r)?,
79            })
80        })
81    }
82}
83
84impl WriteXdr for LedgerCloseMetaV1 {
85    #[cfg(feature = "std")]
86    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<(), Error> {
87        w.with_limited_depth(|w| {
88            self.ext.write_xdr(w)?;
89            self.ledger_header.write_xdr(w)?;
90            self.tx_set.write_xdr(w)?;
91            self.tx_processing.write_xdr(w)?;
92            self.upgrades_processing.write_xdr(w)?;
93            self.scp_info.write_xdr(w)?;
94            self.total_byte_size_of_live_soroban_state.write_xdr(w)?;
95            self.evicted_keys.write_xdr(w)?;
96            self.unused.write_xdr(w)?;
97            Ok(())
98        })
99    }
100}