Skip to main content

stellar_xdr/generated/
transaction_meta_v4.rs

1#[allow(unused_imports, clippy::wildcard_imports)]
2use super::*;
3
4/// TransactionMetaV4 is an XDR Struct defined as:
5///
6/// ```text
7/// struct TransactionMetaV4
8/// {
9///     ExtensionPoint ext;
10///
11///     LedgerEntryChanges txChangesBefore;  // tx level changes before operations
12///                                          // are applied if any
13///     OperationMetaV2 operations<>;        // meta for each operation
14///     LedgerEntryChanges txChangesAfter;   // tx level changes after operations are
15///                                          // applied if any
16///     SorobanTransactionMetaV2* sorobanMeta; // Soroban-specific meta (only for
17///                                            // Soroban transactions).
18///
19///     TransactionEvent events<>; // Used for transaction-level events (like fee payment)
20///     DiagnosticEvent diagnosticEvents<>; // Used for all diagnostic information
21/// };
22/// ```
23///
24#[cfg_attr(feature = "alloc", derive(Default))]
25#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
26#[cfg_attr(feature = "serde", cfg_eval::cfg_eval)]
27#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28#[cfg_attr(
29    all(feature = "serde", feature = "alloc"),
30    serde_with::serde_as,
31    derive(serde::Serialize, serde::Deserialize),
32    serde(rename_all = "snake_case")
33)]
34#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
35pub struct TransactionMetaV4 {
36    pub ext: ExtensionPoint,
37    pub tx_changes_before: LedgerEntryChanges,
38    pub operations: VecM<OperationMetaV2>,
39    pub tx_changes_after: LedgerEntryChanges,
40    pub soroban_meta: Option<SorobanTransactionMetaV2>,
41    pub events: VecM<TransactionEvent>,
42    pub diagnostic_events: VecM<DiagnosticEvent>,
43}
44
45impl ReadXdr for TransactionMetaV4 {
46    #[cfg(feature = "std")]
47    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self, Error> {
48        r.with_limited_depth(|r| {
49            Ok(Self {
50                ext: ExtensionPoint::read_xdr(r)?,
51                tx_changes_before: LedgerEntryChanges::read_xdr(r)?,
52                operations: VecM::<OperationMetaV2>::read_xdr(r)?,
53                tx_changes_after: LedgerEntryChanges::read_xdr(r)?,
54                soroban_meta: Option::<SorobanTransactionMetaV2>::read_xdr(r)?,
55                events: VecM::<TransactionEvent>::read_xdr(r)?,
56                diagnostic_events: VecM::<DiagnosticEvent>::read_xdr(r)?,
57            })
58        })
59    }
60}
61
62impl WriteXdr for TransactionMetaV4 {
63    #[cfg(feature = "std")]
64    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<(), Error> {
65        w.with_limited_depth(|w| {
66            self.ext.write_xdr(w)?;
67            self.tx_changes_before.write_xdr(w)?;
68            self.operations.write_xdr(w)?;
69            self.tx_changes_after.write_xdr(w)?;
70            self.soroban_meta.write_xdr(w)?;
71            self.events.write_xdr(w)?;
72            self.diagnostic_events.write_xdr(w)?;
73            Ok(())
74        })
75    }
76}