Skip to main content

stellar_xdr/generated/
transaction_v0_envelope.rs

1#[allow(unused_imports, clippy::wildcard_imports)]
2use super::*;
3
4/// TransactionV0Envelope is an XDR Struct defined as:
5///
6/// ```text
7/// struct TransactionV0Envelope
8/// {
9///     TransactionV0 tx;
10///     /* Each decorated signature is a signature over the SHA256 hash of
11///      * a TransactionSignaturePayload */
12///     DecoratedSignature signatures<20>;
13/// };
14/// ```
15///
16#[cfg_attr(feature = "alloc", derive(Default))]
17#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
18#[cfg_attr(feature = "serde", cfg_eval::cfg_eval)]
19#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
20#[cfg_attr(
21    all(feature = "serde", feature = "alloc"),
22    serde_with::serde_as,
23    derive(serde::Serialize, serde::Deserialize),
24    serde(rename_all = "snake_case")
25)]
26#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
27pub struct TransactionV0Envelope {
28    pub tx: TransactionV0,
29    pub signatures: VecM<DecoratedSignature, 20>,
30}
31
32impl ReadXdr for TransactionV0Envelope {
33    #[cfg(feature = "std")]
34    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self, Error> {
35        r.with_limited_depth(|r| {
36            Ok(Self {
37                tx: TransactionV0::read_xdr(r)?,
38                signatures: VecM::<DecoratedSignature, 20>::read_xdr(r)?,
39            })
40        })
41    }
42}
43
44impl WriteXdr for TransactionV0Envelope {
45    #[cfg(feature = "std")]
46    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<(), Error> {
47        w.with_limited_depth(|w| {
48            self.tx.write_xdr(w)?;
49            self.signatures.write_xdr(w)?;
50            Ok(())
51        })
52    }
53}