Skip to main content

stellar_xdr/generated/
fee_bump_transaction.rs

1#[allow(unused_imports, clippy::wildcard_imports)]
2use super::*;
3
4/// FeeBumpTransaction is an XDR Struct defined as:
5///
6/// ```text
7/// struct FeeBumpTransaction
8/// {
9///     MuxedAccount feeSource;
10///     int64 fee;
11///     union switch (EnvelopeType type)
12///     {
13///     case ENVELOPE_TYPE_TX:
14///         TransactionV1Envelope v1;
15///     }
16///     innerTx;
17///     union switch (int v)
18///     {
19///     case 0:
20///         void;
21///     }
22///     ext;
23/// };
24/// ```
25///
26#[cfg_attr(feature = "alloc", derive(Default))]
27#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28#[cfg_attr(feature = "serde", cfg_eval::cfg_eval)]
29#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
30#[cfg_attr(
31    all(feature = "serde", feature = "alloc"),
32    serde_with::serde_as,
33    derive(serde::Serialize, serde::Deserialize),
34    serde(rename_all = "snake_case")
35)]
36#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
37pub struct FeeBumpTransaction {
38    pub fee_source: MuxedAccount,
39    #[cfg_attr(
40        all(feature = "serde", feature = "alloc"),
41        serde_as(as = "NumberOrString")
42    )]
43    pub fee: i64,
44    pub inner_tx: FeeBumpTransactionInnerTx,
45    pub ext: FeeBumpTransactionExt,
46}
47
48impl ReadXdr for FeeBumpTransaction {
49    #[cfg(feature = "std")]
50    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self, Error> {
51        r.with_limited_depth(|r| {
52            Ok(Self {
53                fee_source: MuxedAccount::read_xdr(r)?,
54                fee: i64::read_xdr(r)?,
55                inner_tx: FeeBumpTransactionInnerTx::read_xdr(r)?,
56                ext: FeeBumpTransactionExt::read_xdr(r)?,
57            })
58        })
59    }
60}
61
62impl WriteXdr for FeeBumpTransaction {
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.fee_source.write_xdr(w)?;
67            self.fee.write_xdr(w)?;
68            self.inner_tx.write_xdr(w)?;
69            self.ext.write_xdr(w)?;
70            Ok(())
71        })
72    }
73}