Skip to main content

stellar_xdr/generated/
soroban_transaction_meta.rs

1#[allow(unused_imports, clippy::wildcard_imports)]
2use super::*;
3
4/// SorobanTransactionMeta is an XDR Struct defined as:
5///
6/// ```text
7/// struct SorobanTransactionMeta
8/// {
9///     SorobanTransactionMetaExt ext;
10///
11///     ContractEvent events<>;             // custom events populated by the
12///                                         // contracts themselves.
13///     SCVal returnValue;                  // return value of the host fn invocation
14///
15///     // Diagnostics events that are not hashed.
16///     // This will contain all contract and diagnostic events. Even ones
17///     // that were emitted in a failed contract call.
18///     DiagnosticEvent diagnosticEvents<>;
19/// };
20/// ```
21///
22#[cfg_attr(feature = "alloc", derive(Default))]
23#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
24#[cfg_attr(feature = "serde", cfg_eval::cfg_eval)]
25#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
26#[cfg_attr(
27    all(feature = "serde", feature = "alloc"),
28    serde_with::serde_as,
29    derive(serde::Serialize, serde::Deserialize),
30    serde(rename_all = "snake_case")
31)]
32#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
33pub struct SorobanTransactionMeta {
34    pub ext: SorobanTransactionMetaExt,
35    pub events: VecM<ContractEvent>,
36    pub return_value: ScVal,
37    pub diagnostic_events: VecM<DiagnosticEvent>,
38}
39
40impl ReadXdr for SorobanTransactionMeta {
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: SorobanTransactionMetaExt::read_xdr(r)?,
46                events: VecM::<ContractEvent>::read_xdr(r)?,
47                return_value: ScVal::read_xdr(r)?,
48                diagnostic_events: VecM::<DiagnosticEvent>::read_xdr(r)?,
49            })
50        })
51    }
52}
53
54impl WriteXdr for SorobanTransactionMeta {
55    #[cfg(feature = "std")]
56    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<(), Error> {
57        w.with_limited_depth(|w| {
58            self.ext.write_xdr(w)?;
59            self.events.write_xdr(w)?;
60            self.return_value.write_xdr(w)?;
61            self.diagnostic_events.write_xdr(w)?;
62            Ok(())
63        })
64    }
65}