stellar_xdr/generated/
payment_op.rs1#[allow(unused_imports, clippy::wildcard_imports)]
2use super::*;
3
4#[cfg_attr(feature = "alloc", derive(Default))]
16#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
17#[cfg_attr(feature = "serde", cfg_eval::cfg_eval)]
18#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
19#[cfg_attr(
20 all(feature = "serde", feature = "alloc"),
21 serde_with::serde_as,
22 derive(serde::Serialize, serde::Deserialize),
23 serde(rename_all = "snake_case")
24)]
25#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
26pub struct PaymentOp {
27 pub destination: MuxedAccount,
28 pub asset: Asset,
29 #[cfg_attr(
30 all(feature = "serde", feature = "alloc"),
31 serde_as(as = "NumberOrString")
32 )]
33 pub amount: i64,
34}
35
36impl ReadXdr for PaymentOp {
37 #[cfg(feature = "std")]
38 fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self, Error> {
39 r.with_limited_depth(|r| {
40 Ok(Self {
41 destination: MuxedAccount::read_xdr(r)?,
42 asset: Asset::read_xdr(r)?,
43 amount: i64::read_xdr(r)?,
44 })
45 })
46 }
47}
48
49impl WriteXdr for PaymentOp {
50 #[cfg(feature = "std")]
51 fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<(), Error> {
52 w.with_limited_depth(|w| {
53 self.destination.write_xdr(w)?;
54 self.asset.write_xdr(w)?;
55 self.amount.write_xdr(w)?;
56 Ok(())
57 })
58 }
59}