Skip to main content

stellar_xdr/generated/
transaction_signature_payload.rs

1#[allow(unused_imports, clippy::wildcard_imports)]
2use super::*;
3
4/// TransactionSignaturePayload is an XDR Struct defined as:
5///
6/// ```text
7/// struct TransactionSignaturePayload
8/// {
9///     Hash networkId;
10///     union switch (EnvelopeType type)
11///     {
12///     // Backwards Compatibility: Use ENVELOPE_TYPE_TX to sign ENVELOPE_TYPE_TX_V0
13///     case ENVELOPE_TYPE_TX:
14///         Transaction tx;
15///     case ENVELOPE_TYPE_TX_FEE_BUMP:
16///         FeeBumpTransaction feeBump;
17///     }
18///     taggedTransaction;
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 TransactionSignaturePayload {
34    pub network_id: Hash,
35    pub tagged_transaction: TransactionSignaturePayloadTaggedTransaction,
36}
37
38impl ReadXdr for TransactionSignaturePayload {
39    #[cfg(feature = "std")]
40    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self, Error> {
41        r.with_limited_depth(|r| {
42            Ok(Self {
43                network_id: Hash::read_xdr(r)?,
44                tagged_transaction: TransactionSignaturePayloadTaggedTransaction::read_xdr(r)?,
45            })
46        })
47    }
48}
49
50impl WriteXdr for TransactionSignaturePayload {
51    #[cfg(feature = "std")]
52    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<(), Error> {
53        w.with_limited_depth(|w| {
54            self.network_id.write_xdr(w)?;
55            self.tagged_transaction.write_xdr(w)?;
56            Ok(())
57        })
58    }
59}