Skip to main content

stellar_xdr/generated/
transaction_meta_v3.rs

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