stellar_xdr/curr/
generated.rs

1// Module  is generated from:
2//  xdr/curr/Stellar-SCP.x
3//  xdr/curr/Stellar-contract-config-setting.x
4//  xdr/curr/Stellar-contract-env-meta.x
5//  xdr/curr/Stellar-contract-meta.x
6//  xdr/curr/Stellar-contract-spec.x
7//  xdr/curr/Stellar-contract.x
8//  xdr/curr/Stellar-internal.x
9//  xdr/curr/Stellar-ledger-entries.x
10//  xdr/curr/Stellar-ledger.x
11//  xdr/curr/Stellar-overlay.x
12//  xdr/curr/Stellar-transaction.x
13//  xdr/curr/Stellar-types.x
14
15#![allow(clippy::missing_errors_doc, clippy::unreadable_literal)]
16
17/// `XDR_FILES_SHA256` is a list of pairs of source files and their SHA256 hashes.
18pub const XDR_FILES_SHA256: [(&str, &str); 12] = [
19    (
20        "xdr/curr/Stellar-SCP.x",
21        "8f32b04d008f8bc33b8843d075e69837231a673691ee41d8b821ca229a6e802a",
22    ),
23    (
24        "xdr/curr/Stellar-contract-config-setting.x",
25        "f5487397dda4c27135f0f9e930042a186d1abdc9698163ca6a30efe1a03ee495",
26    ),
27    (
28        "xdr/curr/Stellar-contract-env-meta.x",
29        "75a271414d852096fea3283c63b7f2a702f2905f78fc28eb60ec7d7bd366a780",
30    ),
31    (
32        "xdr/curr/Stellar-contract-meta.x",
33        "f01532c11ca044e19d9f9f16fe373e9af64835da473be556b9a807ee3319ae0d",
34    ),
35    (
36        "xdr/curr/Stellar-contract-spec.x",
37        "c7ffa21d2e91afb8e666b33524d307955426ff553a486d670c29217ed9888d49",
38    ),
39    (
40        "xdr/curr/Stellar-contract.x",
41        "7f665e4103e146a88fcdabce879aaaacd3bf9283feb194cc47ff986264c1e315",
42    ),
43    (
44        "xdr/curr/Stellar-internal.x",
45        "227835866c1b2122d1eaf28839ba85ea7289d1cb681dda4ca619c2da3d71fe00",
46    ),
47    (
48        "xdr/curr/Stellar-ledger-entries.x",
49        "03e8be938bace784410b0e837ed6496ff66dc0d1e70fc6e4f0d006566a344879",
50    ),
51    (
52        "xdr/curr/Stellar-ledger.x",
53        "c2ac5bde5da28d4d02e2ea455f3bc5d5133adf271d374010cebe4e314c8504e8",
54    ),
55    (
56        "xdr/curr/Stellar-overlay.x",
57        "8c73b7c3ad974e7fc4aa4fdf34f7ad50053406254efbd7406c96657cf41691d3",
58    ),
59    (
60        "xdr/curr/Stellar-transaction.x",
61        "fdd854ea6ce450500c331a6613d714d9b2f00d2adc86210a8f709e8a9ef4c641",
62    ),
63    (
64        "xdr/curr/Stellar-types.x",
65        "253f515fc5e06bc938105e92a4c7f562251d4ebc178d39d6e6751e6b85fe1064",
66    ),
67];
68
69use core::{array::TryFromSliceError, fmt, fmt::Debug, marker::Sized, ops::Deref, slice};
70
71#[cfg(feature = "std")]
72use core::marker::PhantomData;
73
74// When feature alloc is turned off use static lifetime Box and Vec types.
75#[cfg(not(feature = "alloc"))]
76mod noalloc {
77    pub mod boxed {
78        pub type Box<T> = &'static T;
79    }
80    pub mod vec {
81        pub type Vec<T> = &'static [T];
82    }
83}
84#[cfg(not(feature = "alloc"))]
85use noalloc::{boxed::Box, vec::Vec};
86
87// When feature std is turned off, but feature alloc is turned on import the
88// alloc crate and use its Box and Vec types.
89#[cfg(all(not(feature = "std"), feature = "alloc"))]
90extern crate alloc;
91#[cfg(all(not(feature = "std"), feature = "alloc"))]
92use alloc::{
93    borrow::ToOwned,
94    boxed::Box,
95    string::{FromUtf8Error, String},
96    vec::Vec,
97};
98#[cfg(feature = "std")]
99use std::string::FromUtf8Error;
100
101#[cfg(feature = "arbitrary")]
102use arbitrary::Arbitrary;
103
104// TODO: Add support for read/write xdr fns when std not available.
105
106#[cfg(feature = "std")]
107use std::{
108    error, io,
109    io::{BufRead, BufReader, Cursor, Read, Write},
110};
111
112/// Error contains all errors returned by functions in this crate. It can be
113/// compared via `PartialEq`, however any contained IO errors will only be
114/// compared on their `ErrorKind`.
115#[derive(Debug)]
116pub enum Error {
117    Invalid,
118    Unsupported,
119    LengthExceedsMax,
120    LengthMismatch,
121    NonZeroPadding,
122    Utf8Error(core::str::Utf8Error),
123    #[cfg(feature = "alloc")]
124    InvalidHex,
125    #[cfg(feature = "std")]
126    Io(io::Error),
127    DepthLimitExceeded,
128    #[cfg(feature = "serde_json")]
129    Json(serde_json::Error),
130    LengthLimitExceeded,
131}
132
133impl PartialEq for Error {
134    fn eq(&self, other: &Self) -> bool {
135        match (self, other) {
136            (Self::Utf8Error(l), Self::Utf8Error(r)) => l == r,
137            // IO errors cannot be compared, but in the absence of any more
138            // meaningful way to compare the errors we compare the kind of error
139            // and ignore the embedded source error or OS error. The main use
140            // case for comparing errors outputted by the XDR library is for
141            // error case testing, and a lack of the ability to compare has a
142            // detrimental affect on failure testing, so this is a tradeoff.
143            #[cfg(feature = "std")]
144            (Self::Io(l), Self::Io(r)) => l.kind() == r.kind(),
145            _ => core::mem::discriminant(self) == core::mem::discriminant(other),
146        }
147    }
148}
149
150#[cfg(feature = "std")]
151impl error::Error for Error {
152    #[must_use]
153    fn source(&self) -> Option<&(dyn error::Error + 'static)> {
154        match self {
155            Self::Io(e) => Some(e),
156            #[cfg(feature = "serde_json")]
157            Self::Json(e) => Some(e),
158            _ => None,
159        }
160    }
161}
162
163impl fmt::Display for Error {
164    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
165        match self {
166            Error::Invalid => write!(f, "xdr value invalid"),
167            Error::Unsupported => write!(f, "xdr value unsupported"),
168            Error::LengthExceedsMax => write!(f, "xdr value max length exceeded"),
169            Error::LengthMismatch => write!(f, "xdr value length does not match"),
170            Error::NonZeroPadding => write!(f, "xdr padding contains non-zero bytes"),
171            Error::Utf8Error(e) => write!(f, "{e}"),
172            #[cfg(feature = "alloc")]
173            Error::InvalidHex => write!(f, "hex invalid"),
174            #[cfg(feature = "std")]
175            Error::Io(e) => write!(f, "{e}"),
176            Error::DepthLimitExceeded => write!(f, "depth limit exceeded"),
177            #[cfg(feature = "serde_json")]
178            Error::Json(e) => write!(f, "{e}"),
179            Error::LengthLimitExceeded => write!(f, "length limit exceeded"),
180        }
181    }
182}
183
184impl From<TryFromSliceError> for Error {
185    fn from(_: TryFromSliceError) -> Error {
186        Error::LengthMismatch
187    }
188}
189
190impl From<core::str::Utf8Error> for Error {
191    #[must_use]
192    fn from(e: core::str::Utf8Error) -> Self {
193        Error::Utf8Error(e)
194    }
195}
196
197#[cfg(feature = "alloc")]
198impl From<FromUtf8Error> for Error {
199    #[must_use]
200    fn from(e: FromUtf8Error) -> Self {
201        Error::Utf8Error(e.utf8_error())
202    }
203}
204
205#[cfg(feature = "std")]
206impl From<io::Error> for Error {
207    #[must_use]
208    fn from(e: io::Error) -> Self {
209        Error::Io(e)
210    }
211}
212
213#[cfg(feature = "serde_json")]
214impl From<serde_json::Error> for Error {
215    #[must_use]
216    fn from(e: serde_json::Error) -> Self {
217        Error::Json(e)
218    }
219}
220
221impl From<Error> for () {
222    fn from(_: Error) {}
223}
224
225#[allow(dead_code)]
226type Result<T> = core::result::Result<T, Error>;
227
228/// Name defines types that assign a static name to their value, such as the
229/// name given to an identifier in an XDR enum, or the name given to the case in
230/// a union.
231pub trait Name {
232    fn name(&self) -> &'static str;
233}
234
235/// Discriminant defines types that may contain a one-of value determined
236/// according to the discriminant, and exposes the value of the discriminant for
237/// that type, such as in an XDR union.
238pub trait Discriminant<D> {
239    fn discriminant(&self) -> D;
240}
241
242/// Iter defines types that have variants that can be iterated.
243pub trait Variants<V> {
244    fn variants() -> slice::Iter<'static, V>
245    where
246        V: Sized;
247}
248
249// Enum defines a type that is represented as an XDR enumeration when encoded.
250pub trait Enum: Name + Variants<Self> + Sized {}
251
252// Union defines a type that is represented as an XDR union when encoded.
253pub trait Union<D>: Name + Discriminant<D> + Variants<D>
254where
255    D: Sized,
256{
257}
258
259/// `Limits` contains the limits that a limited reader or writer will be
260/// constrained to.
261#[cfg(feature = "std")]
262#[derive(Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
263pub struct Limits {
264    /// Defines the maximum depth for recursive calls in `Read/WriteXdr` to
265    /// prevent stack overflow.
266    ///
267    /// The depth limit is akin to limiting stack depth. Its purpose is to
268    /// prevent the program from hitting the maximum stack size allowed by Rust,
269    /// which would result in an unrecoverable `SIGABRT`.  For more information
270    /// about Rust's stack size limit, refer to the [Rust
271    /// documentation](https://doc.rust-lang.org/std/thread/#stack-size).
272    pub depth: u32,
273
274    /// Defines the maximum number of bytes that will be read or written.
275    pub len: usize,
276}
277
278#[cfg(feature = "std")]
279impl Limits {
280    #[must_use]
281    pub fn none() -> Self {
282        Self {
283            depth: u32::MAX,
284            len: usize::MAX,
285        }
286    }
287
288    #[must_use]
289    pub fn depth(depth: u32) -> Self {
290        Limits {
291            depth,
292            ..Limits::none()
293        }
294    }
295
296    #[must_use]
297    pub fn len(len: usize) -> Self {
298        Limits {
299            len,
300            ..Limits::none()
301        }
302    }
303}
304
305/// `Limited` wraps an object and provides functions for enforcing limits.
306///
307/// Intended for use with readers and writers and limiting their reads and
308/// writes.
309#[cfg(feature = "std")]
310pub struct Limited<L> {
311    pub inner: L,
312    pub(crate) limits: Limits,
313}
314
315#[cfg(feature = "std")]
316impl<L> Limited<L> {
317    /// Constructs a new `Limited`.
318    ///
319    /// - `inner`: The value being limited.
320    /// - `limits`: The limits to enforce.
321    pub fn new(inner: L, limits: Limits) -> Self {
322        Limited { inner, limits }
323    }
324
325    /// Consume the given length from the internal remaining length limit.
326    ///
327    /// ### Errors
328    ///
329    /// If the length would consume more length than the remaining length limit
330    /// allows.
331    pub(crate) fn consume_len(&mut self, len: usize) -> Result<()> {
332        if let Some(len) = self.limits.len.checked_sub(len) {
333            self.limits.len = len;
334            Ok(())
335        } else {
336            Err(Error::LengthLimitExceeded)
337        }
338    }
339
340    /// Consumes a single depth for the duration of the given function.
341    ///
342    /// ### Errors
343    ///
344    /// If the depth limit is already exhausted.
345    pub(crate) fn with_limited_depth<T, F>(&mut self, f: F) -> Result<T>
346    where
347        F: FnOnce(&mut Self) -> Result<T>,
348    {
349        if let Some(depth) = self.limits.depth.checked_sub(1) {
350            self.limits.depth = depth;
351            let res = f(self);
352            self.limits.depth = self.limits.depth.saturating_add(1);
353            res
354        } else {
355            Err(Error::DepthLimitExceeded)
356        }
357    }
358}
359
360#[cfg(feature = "std")]
361impl<R: Read> Read for Limited<R> {
362    /// Forwards the read operation to the wrapped object.
363    fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
364        self.inner.read(buf)
365    }
366}
367
368#[cfg(feature = "std")]
369impl<R: BufRead> BufRead for Limited<R> {
370    /// Forwards the read operation to the wrapped object.
371    fn fill_buf(&mut self) -> std::io::Result<&[u8]> {
372        self.inner.fill_buf()
373    }
374
375    /// Forwards the read operation to the wrapped object.
376    fn consume(&mut self, amt: usize) {
377        self.inner.consume(amt);
378    }
379}
380
381#[cfg(feature = "std")]
382impl<W: Write> Write for Limited<W> {
383    /// Forwards the write operation to the wrapped object.
384    fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
385        self.inner.write(buf)
386    }
387
388    /// Forwards the flush operation to the wrapped object.
389    fn flush(&mut self) -> std::io::Result<()> {
390        self.inner.flush()
391    }
392}
393
394#[cfg(feature = "std")]
395pub struct ReadXdrIter<R: Read, S: ReadXdr> {
396    reader: Limited<BufReader<R>>,
397    _s: PhantomData<S>,
398}
399
400#[cfg(feature = "std")]
401impl<R: Read, S: ReadXdr> ReadXdrIter<R, S> {
402    fn new(r: R, limits: Limits) -> Self {
403        Self {
404            reader: Limited {
405                inner: BufReader::new(r),
406                limits,
407            },
408            _s: PhantomData,
409        }
410    }
411}
412
413#[cfg(feature = "std")]
414impl<R: Read, S: ReadXdr> Iterator for ReadXdrIter<R, S> {
415    type Item = Result<S>;
416
417    // Next reads the internal reader and XDR decodes it into the Self type. If
418    // the EOF is reached without reading any new bytes `None` is returned. If
419    // EOF is reached after reading some bytes a truncated entry is assumed an
420    // an `Error::Io` containing an `UnexpectedEof`. If any other IO error
421    // occurs it is returned. Iteration of this iterator stops naturally when
422    // `None` is returned, but not when a `Some(Err(...))` is returned. The
423    // caller is responsible for checking each Result.
424    fn next(&mut self) -> Option<Self::Item> {
425        // Try to fill the buffer to see if the EOF has been reached or not.
426        // This happens to effectively peek to see if the stream has finished
427        // and there are no more items.  It is necessary to do this because the
428        // xdr types in this crate heavily use the `std::io::Read::read_exact`
429        // method that doesn't distinguish between an EOF at the beginning of a
430        // read and an EOF after a partial fill of a read_exact.
431        match self.reader.fill_buf() {
432            // If the reader has no more data and is unable to fill any new data
433            // into its internal buf, then the EOF has been reached.
434            Ok([]) => return None,
435            // If an error occurs filling the buffer, treat that as an error and stop.
436            Err(e) => return Some(Err(Error::Io(e))),
437            // If there is data in the buf available for reading, continue.
438            Ok([..]) => (),
439        };
440        // Read the buf into the type.
441        let r = self.reader.with_limited_depth(|dlr| S::read_xdr(dlr));
442        match r {
443            Ok(s) => Some(Ok(s)),
444            Err(e) => Some(Err(e)),
445        }
446    }
447}
448
449pub trait ReadXdr
450where
451    Self: Sized,
452{
453    /// Read the XDR and construct the type.
454    ///
455    /// Read bytes from the given read implementation, decoding the bytes as
456    /// XDR, and construct the type implementing this interface from those
457    /// bytes.
458    ///
459    /// Just enough bytes are read from the read implementation to construct the
460    /// type. Any residual bytes remain in the read implementation.
461    ///
462    /// All implementations should continue if the read implementation returns
463    /// [`ErrorKind::Interrupted`](std::io::ErrorKind::Interrupted).
464    ///
465    /// Use [`ReadXdR: Read_xdr_to_end`] when the intent is for all bytes in the
466    /// read implementation to be consumed by the read.
467    #[cfg(feature = "std")]
468    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self>;
469
470    /// Construct the type from the XDR bytes base64 encoded.
471    ///
472    /// An error is returned if the bytes are not completely consumed by the
473    /// deserialization.
474    #[cfg(feature = "base64")]
475    fn read_xdr_base64<R: Read>(r: &mut Limited<R>) -> Result<Self> {
476        let mut dec = Limited::new(
477            base64::read::DecoderReader::new(&mut r.inner, base64::STANDARD),
478            r.limits.clone(),
479        );
480        let t = Self::read_xdr(&mut dec)?;
481        Ok(t)
482    }
483
484    /// Read the XDR and construct the type, and consider it an error if the
485    /// read does not completely consume the read implementation.
486    ///
487    /// Read bytes from the given read implementation, decoding the bytes as
488    /// XDR, and construct the type implementing this interface from those
489    /// bytes.
490    ///
491    /// Just enough bytes are read from the read implementation to construct the
492    /// type, and then confirm that no further bytes remain. To confirm no
493    /// further bytes remain additional bytes are attempted to be read from the
494    /// read implementation. If it is possible to read any residual bytes from
495    /// the read implementation an error is returned. The read implementation
496    /// may not be exhaustively read if there are residual bytes, and it is
497    /// considered undefined how many residual bytes or how much of the residual
498    /// buffer are consumed in this case.
499    ///
500    /// All implementations should continue if the read implementation returns
501    /// [`ErrorKind::Interrupted`](std::io::ErrorKind::Interrupted).
502    #[cfg(feature = "std")]
503    fn read_xdr_to_end<R: Read>(r: &mut Limited<R>) -> Result<Self> {
504        let s = Self::read_xdr(r)?;
505        // Check that any further reads, such as this read of one byte, read no
506        // data, indicating EOF. If a byte is read the data is invalid.
507        if r.read(&mut [0u8; 1])? == 0 {
508            Ok(s)
509        } else {
510            Err(Error::Invalid)
511        }
512    }
513
514    /// Construct the type from the XDR bytes base64 encoded.
515    ///
516    /// An error is returned if the bytes are not completely consumed by the
517    /// deserialization.
518    #[cfg(feature = "base64")]
519    fn read_xdr_base64_to_end<R: Read>(r: &mut Limited<R>) -> Result<Self> {
520        let mut dec = Limited::new(
521            base64::read::DecoderReader::new(&mut r.inner, base64::STANDARD),
522            r.limits.clone(),
523        );
524        let t = Self::read_xdr_to_end(&mut dec)?;
525        Ok(t)
526    }
527
528    /// Read the XDR and construct the type.
529    ///
530    /// Read bytes from the given read implementation, decoding the bytes as
531    /// XDR, and construct the type implementing this interface from those
532    /// bytes.
533    ///
534    /// Just enough bytes are read from the read implementation to construct the
535    /// type. Any residual bytes remain in the read implementation.
536    ///
537    /// All implementations should continue if the read implementation returns
538    /// [`ErrorKind::Interrupted`](std::io::ErrorKind::Interrupted).
539    ///
540    /// Use [`ReadXdR: Read_xdr_into_to_end`] when the intent is for all bytes
541    /// in the read implementation to be consumed by the read.
542    #[cfg(feature = "std")]
543    fn read_xdr_into<R: Read>(&mut self, r: &mut Limited<R>) -> Result<()> {
544        *self = Self::read_xdr(r)?;
545        Ok(())
546    }
547
548    /// Read the XDR into the existing value, and consider it an error if the
549    /// read does not completely consume the read implementation.
550    ///
551    /// Read bytes from the given read implementation, decoding the bytes as
552    /// XDR, and construct the type implementing this interface from those
553    /// bytes.
554    ///
555    /// Just enough bytes are read from the read implementation to construct the
556    /// type, and then confirm that no further bytes remain. To confirm no
557    /// further bytes remain additional bytes are attempted to be read from the
558    /// read implementation. If it is possible to read any residual bytes from
559    /// the read implementation an error is returned. The read implementation
560    /// may not be exhaustively read if there are residual bytes, and it is
561    /// considered undefined how many residual bytes or how much of the residual
562    /// buffer are consumed in this case.
563    ///
564    /// All implementations should continue if the read implementation returns
565    /// [`ErrorKind::Interrupted`](std::io::ErrorKind::Interrupted).
566    #[cfg(feature = "std")]
567    fn read_xdr_into_to_end<R: Read>(&mut self, r: &mut Limited<R>) -> Result<()> {
568        Self::read_xdr_into(self, r)?;
569        // Check that any further reads, such as this read of one byte, read no
570        // data, indicating EOF. If a byte is read the data is invalid.
571        if r.read(&mut [0u8; 1])? == 0 {
572            Ok(())
573        } else {
574            Err(Error::Invalid)
575        }
576    }
577
578    /// Create an iterator that reads the read implementation as a stream of
579    /// values that are read into the implementing type.
580    ///
581    /// Read bytes from the given read implementation, decoding the bytes as
582    /// XDR, and construct the type implementing this interface from those
583    /// bytes.
584    ///
585    /// Just enough bytes are read from the read implementation to construct the
586    /// type, and then confirm that no further bytes remain. To confirm no
587    /// further bytes remain additional bytes are attempted to be read from the
588    /// read implementation. If it is possible to read any residual bytes from
589    /// the read implementation an error is returned. The read implementation
590    /// may not be exhaustively read if there are residual bytes, and it is
591    /// considered undefined how many residual bytes or how much of the residual
592    /// buffer are consumed in this case.
593    ///
594    /// All implementations should continue if the read implementation returns
595    /// [`ErrorKind::Interrupted`](std::io::ErrorKind::Interrupted).
596    #[cfg(feature = "std")]
597    fn read_xdr_iter<R: Read>(r: &mut Limited<R>) -> ReadXdrIter<&mut R, Self> {
598        ReadXdrIter::new(&mut r.inner, r.limits.clone())
599    }
600
601    /// Create an iterator that reads the read implementation as a stream of
602    /// values that are read into the implementing type.
603    #[cfg(feature = "base64")]
604    fn read_xdr_base64_iter<R: Read>(
605        r: &mut Limited<R>,
606    ) -> ReadXdrIter<base64::read::DecoderReader<R>, Self> {
607        let dec = base64::read::DecoderReader::new(&mut r.inner, base64::STANDARD);
608        ReadXdrIter::new(dec, r.limits.clone())
609    }
610
611    /// Construct the type from the XDR bytes.
612    ///
613    /// An error is returned if the bytes are not completely consumed by the
614    /// deserialization.
615    #[cfg(feature = "std")]
616    fn from_xdr(bytes: impl AsRef<[u8]>, limits: Limits) -> Result<Self> {
617        let mut cursor = Limited::new(Cursor::new(bytes.as_ref()), limits);
618        let t = Self::read_xdr_to_end(&mut cursor)?;
619        Ok(t)
620    }
621
622    /// Construct the type from the XDR bytes base64 encoded.
623    ///
624    /// An error is returned if the bytes are not completely consumed by the
625    /// deserialization.
626    #[cfg(feature = "base64")]
627    fn from_xdr_base64(b64: impl AsRef<[u8]>, limits: Limits) -> Result<Self> {
628        let mut b64_reader = Cursor::new(b64);
629        let mut dec = Limited::new(
630            base64::read::DecoderReader::new(&mut b64_reader, base64::STANDARD),
631            limits,
632        );
633        let t = Self::read_xdr_to_end(&mut dec)?;
634        Ok(t)
635    }
636}
637
638pub trait WriteXdr {
639    #[cfg(feature = "std")]
640    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()>;
641
642    #[cfg(feature = "std")]
643    fn to_xdr(&self, limits: Limits) -> Result<Vec<u8>> {
644        let mut cursor = Limited::new(Cursor::new(vec![]), limits);
645        self.write_xdr(&mut cursor)?;
646        let bytes = cursor.inner.into_inner();
647        Ok(bytes)
648    }
649
650    #[cfg(feature = "base64")]
651    fn to_xdr_base64(&self, limits: Limits) -> Result<String> {
652        let mut enc = Limited::new(
653            base64::write::EncoderStringWriter::new(base64::STANDARD),
654            limits,
655        );
656        self.write_xdr(&mut enc)?;
657        let b64 = enc.inner.into_inner();
658        Ok(b64)
659    }
660}
661
662/// `Pad_len` returns the number of bytes to pad an XDR value of the given
663/// length to make the final serialized size a multiple of 4.
664#[cfg(feature = "std")]
665fn pad_len(len: usize) -> usize {
666    (4 - (len % 4)) % 4
667}
668
669impl ReadXdr for i32 {
670    #[cfg(feature = "std")]
671    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
672        let mut b = [0u8; 4];
673        r.with_limited_depth(|r| {
674            r.consume_len(b.len())?;
675            r.read_exact(&mut b)?;
676            Ok(i32::from_be_bytes(b))
677        })
678    }
679}
680
681impl WriteXdr for i32 {
682    #[cfg(feature = "std")]
683    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
684        let b: [u8; 4] = self.to_be_bytes();
685        w.with_limited_depth(|w| {
686            w.consume_len(b.len())?;
687            Ok(w.write_all(&b)?)
688        })
689    }
690}
691
692impl ReadXdr for u32 {
693    #[cfg(feature = "std")]
694    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
695        let mut b = [0u8; 4];
696        r.with_limited_depth(|r| {
697            r.consume_len(b.len())?;
698            r.read_exact(&mut b)?;
699            Ok(u32::from_be_bytes(b))
700        })
701    }
702}
703
704impl WriteXdr for u32 {
705    #[cfg(feature = "std")]
706    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
707        let b: [u8; 4] = self.to_be_bytes();
708        w.with_limited_depth(|w| {
709            w.consume_len(b.len())?;
710            Ok(w.write_all(&b)?)
711        })
712    }
713}
714
715impl ReadXdr for i64 {
716    #[cfg(feature = "std")]
717    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
718        let mut b = [0u8; 8];
719        r.with_limited_depth(|r| {
720            r.consume_len(b.len())?;
721            r.read_exact(&mut b)?;
722            Ok(i64::from_be_bytes(b))
723        })
724    }
725}
726
727impl WriteXdr for i64 {
728    #[cfg(feature = "std")]
729    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
730        let b: [u8; 8] = self.to_be_bytes();
731        w.with_limited_depth(|w| {
732            w.consume_len(b.len())?;
733            Ok(w.write_all(&b)?)
734        })
735    }
736}
737
738impl ReadXdr for u64 {
739    #[cfg(feature = "std")]
740    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
741        let mut b = [0u8; 8];
742        r.with_limited_depth(|r| {
743            r.consume_len(b.len())?;
744            r.read_exact(&mut b)?;
745            Ok(u64::from_be_bytes(b))
746        })
747    }
748}
749
750impl WriteXdr for u64 {
751    #[cfg(feature = "std")]
752    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
753        let b: [u8; 8] = self.to_be_bytes();
754        w.with_limited_depth(|w| {
755            w.consume_len(b.len())?;
756            Ok(w.write_all(&b)?)
757        })
758    }
759}
760
761impl ReadXdr for f32 {
762    #[cfg(feature = "std")]
763    fn read_xdr<R: Read>(_r: &mut Limited<R>) -> Result<Self> {
764        todo!()
765    }
766}
767
768impl WriteXdr for f32 {
769    #[cfg(feature = "std")]
770    fn write_xdr<W: Write>(&self, _w: &mut Limited<W>) -> Result<()> {
771        todo!()
772    }
773}
774
775impl ReadXdr for f64 {
776    #[cfg(feature = "std")]
777    fn read_xdr<R: Read>(_r: &mut Limited<R>) -> Result<Self> {
778        todo!()
779    }
780}
781
782impl WriteXdr for f64 {
783    #[cfg(feature = "std")]
784    fn write_xdr<W: Write>(&self, _w: &mut Limited<W>) -> Result<()> {
785        todo!()
786    }
787}
788
789impl ReadXdr for bool {
790    #[cfg(feature = "std")]
791    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
792        r.with_limited_depth(|r| {
793            let i = u32::read_xdr(r)?;
794            let b = i == 1;
795            Ok(b)
796        })
797    }
798}
799
800impl WriteXdr for bool {
801    #[cfg(feature = "std")]
802    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
803        w.with_limited_depth(|w| {
804            let i = u32::from(*self); // true = 1, false = 0
805            i.write_xdr(w)
806        })
807    }
808}
809
810impl<T: ReadXdr> ReadXdr for Option<T> {
811    #[cfg(feature = "std")]
812    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
813        r.with_limited_depth(|r| {
814            let i = u32::read_xdr(r)?;
815            match i {
816                0 => Ok(None),
817                1 => {
818                    let t = T::read_xdr(r)?;
819                    Ok(Some(t))
820                }
821                _ => Err(Error::Invalid),
822            }
823        })
824    }
825}
826
827impl<T: WriteXdr> WriteXdr for Option<T> {
828    #[cfg(feature = "std")]
829    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
830        w.with_limited_depth(|w| {
831            if let Some(t) = self {
832                1u32.write_xdr(w)?;
833                t.write_xdr(w)?;
834            } else {
835                0u32.write_xdr(w)?;
836            }
837            Ok(())
838        })
839    }
840}
841
842impl<T: ReadXdr> ReadXdr for Box<T> {
843    #[cfg(feature = "std")]
844    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
845        r.with_limited_depth(|r| Ok(Box::new(T::read_xdr(r)?)))
846    }
847}
848
849impl<T: WriteXdr> WriteXdr for Box<T> {
850    #[cfg(feature = "std")]
851    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
852        w.with_limited_depth(|w| T::write_xdr(self, w))
853    }
854}
855
856impl ReadXdr for () {
857    #[cfg(feature = "std")]
858    fn read_xdr<R: Read>(_r: &mut Limited<R>) -> Result<Self> {
859        Ok(())
860    }
861}
862
863impl WriteXdr for () {
864    #[cfg(feature = "std")]
865    fn write_xdr<W: Write>(&self, _w: &mut Limited<W>) -> Result<()> {
866        Ok(())
867    }
868}
869
870impl<const N: usize> ReadXdr for [u8; N] {
871    #[cfg(feature = "std")]
872    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
873        r.with_limited_depth(|r| {
874            r.consume_len(N)?;
875            let padding = pad_len(N);
876            r.consume_len(padding)?;
877            let mut arr = [0u8; N];
878            r.read_exact(&mut arr)?;
879            let pad = &mut [0u8; 3][..padding];
880            r.read_exact(pad)?;
881            if pad.iter().any(|b| *b != 0) {
882                return Err(Error::NonZeroPadding);
883            }
884            Ok(arr)
885        })
886    }
887}
888
889impl<const N: usize> WriteXdr for [u8; N] {
890    #[cfg(feature = "std")]
891    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
892        w.with_limited_depth(|w| {
893            w.consume_len(N)?;
894            let padding = pad_len(N);
895            w.consume_len(padding)?;
896            w.write_all(self)?;
897            w.write_all(&[0u8; 3][..padding])?;
898            Ok(())
899        })
900    }
901}
902
903impl<T: ReadXdr, const N: usize> ReadXdr for [T; N] {
904    #[cfg(feature = "std")]
905    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
906        r.with_limited_depth(|r| {
907            let mut vec = Vec::with_capacity(N);
908            for _ in 0..N {
909                let t = T::read_xdr(r)?;
910                vec.push(t);
911            }
912            let arr: [T; N] = vec.try_into().unwrap_or_else(|_: Vec<T>| unreachable!());
913            Ok(arr)
914        })
915    }
916}
917
918impl<T: WriteXdr, const N: usize> WriteXdr for [T; N] {
919    #[cfg(feature = "std")]
920    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
921        w.with_limited_depth(|w| {
922            for t in self {
923                t.write_xdr(w)?;
924            }
925            Ok(())
926        })
927    }
928}
929
930// VecM ------------------------------------------------------------------------
931
932#[cfg(feature = "alloc")]
933#[derive(Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
934#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
935#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
936pub struct VecM<T, const MAX: u32 = { u32::MAX }>(Vec<T>);
937
938#[cfg(not(feature = "alloc"))]
939#[derive(Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
940#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
941pub struct VecM<T, const MAX: u32 = { u32::MAX }>(Vec<T>)
942where
943    T: 'static;
944
945impl<T, const MAX: u32> Deref for VecM<T, MAX> {
946    type Target = Vec<T>;
947
948    fn deref(&self) -> &Self::Target {
949        &self.0
950    }
951}
952
953impl<T, const MAX: u32> Default for VecM<T, MAX> {
954    fn default() -> Self {
955        Self(Vec::default())
956    }
957}
958
959#[cfg(feature = "schemars")]
960impl<T: schemars::JsonSchema, const MAX: u32> schemars::JsonSchema for VecM<T, MAX> {
961    fn schema_name() -> String {
962        format!("VecM<{}, {}>", T::schema_name(), MAX)
963    }
964
965    fn is_referenceable() -> bool {
966        false
967    }
968
969    fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
970        let schema = Vec::<T>::json_schema(gen);
971        if let schemars::schema::Schema::Object(mut schema) = schema {
972            if let Some(array) = schema.array.clone() {
973                schema.array = Some(Box::new(schemars::schema::ArrayValidation {
974                    max_items: Some(MAX),
975                    ..*array
976                }));
977            }
978            schema.into()
979        } else {
980            schema
981        }
982    }
983}
984
985impl<T, const MAX: u32> VecM<T, MAX> {
986    pub const MAX_LEN: usize = { MAX as usize };
987
988    #[must_use]
989    #[allow(clippy::unused_self)]
990    pub fn max_len(&self) -> usize {
991        Self::MAX_LEN
992    }
993
994    #[must_use]
995    pub fn as_vec(&self) -> &Vec<T> {
996        self.as_ref()
997    }
998}
999
1000impl<T: Clone, const MAX: u32> VecM<T, MAX> {
1001    #[must_use]
1002    #[cfg(feature = "alloc")]
1003    pub fn to_vec(&self) -> Vec<T> {
1004        self.into()
1005    }
1006
1007    #[must_use]
1008    pub fn into_vec(self) -> Vec<T> {
1009        self.into()
1010    }
1011}
1012
1013impl<const MAX: u32> VecM<u8, MAX> {
1014    #[cfg(feature = "alloc")]
1015    pub fn to_string(&self) -> Result<String> {
1016        self.try_into()
1017    }
1018
1019    #[cfg(feature = "alloc")]
1020    pub fn into_string(self) -> Result<String> {
1021        self.try_into()
1022    }
1023
1024    #[cfg(feature = "alloc")]
1025    #[must_use]
1026    pub fn to_string_lossy(&self) -> String {
1027        String::from_utf8_lossy(&self.0).into_owned()
1028    }
1029
1030    #[cfg(feature = "alloc")]
1031    #[must_use]
1032    pub fn into_string_lossy(self) -> String {
1033        String::from_utf8_lossy(&self.0).into_owned()
1034    }
1035}
1036
1037impl<T: Clone> VecM<T, 1> {
1038    #[must_use]
1039    pub fn to_option(&self) -> Option<T> {
1040        if self.len() > 0 {
1041            Some(self.0[0].clone())
1042        } else {
1043            None
1044        }
1045    }
1046}
1047
1048#[cfg(not(feature = "alloc"))]
1049impl<T: Clone> From<VecM<T, 1>> for Option<T> {
1050    #[must_use]
1051    fn from(v: VecM<T, 1>) -> Self {
1052        v.to_option()
1053    }
1054}
1055
1056#[cfg(feature = "alloc")]
1057impl<T> VecM<T, 1> {
1058    #[must_use]
1059    pub fn into_option(mut self) -> Option<T> {
1060        self.0.drain(..).next()
1061    }
1062}
1063
1064#[cfg(feature = "alloc")]
1065impl<T> From<VecM<T, 1>> for Option<T> {
1066    #[must_use]
1067    fn from(v: VecM<T, 1>) -> Self {
1068        v.into_option()
1069    }
1070}
1071
1072impl<T, const MAX: u32> TryFrom<Vec<T>> for VecM<T, MAX> {
1073    type Error = Error;
1074
1075    fn try_from(v: Vec<T>) -> Result<Self> {
1076        let len: u32 = v.len().try_into().map_err(|_| Error::LengthExceedsMax)?;
1077        if len <= MAX {
1078            Ok(VecM(v))
1079        } else {
1080            Err(Error::LengthExceedsMax)
1081        }
1082    }
1083}
1084
1085impl<T, const MAX: u32> From<VecM<T, MAX>> for Vec<T> {
1086    #[must_use]
1087    fn from(v: VecM<T, MAX>) -> Self {
1088        v.0
1089    }
1090}
1091
1092#[cfg(feature = "alloc")]
1093impl<T: Clone, const MAX: u32> From<&VecM<T, MAX>> for Vec<T> {
1094    #[must_use]
1095    fn from(v: &VecM<T, MAX>) -> Self {
1096        v.0.clone()
1097    }
1098}
1099
1100impl<T, const MAX: u32> AsRef<Vec<T>> for VecM<T, MAX> {
1101    #[must_use]
1102    fn as_ref(&self) -> &Vec<T> {
1103        &self.0
1104    }
1105}
1106
1107#[cfg(feature = "alloc")]
1108impl<T: Clone, const MAX: u32> TryFrom<&Vec<T>> for VecM<T, MAX> {
1109    type Error = Error;
1110
1111    fn try_from(v: &Vec<T>) -> Result<Self> {
1112        v.as_slice().try_into()
1113    }
1114}
1115
1116#[cfg(feature = "alloc")]
1117impl<T: Clone, const MAX: u32> TryFrom<&[T]> for VecM<T, MAX> {
1118    type Error = Error;
1119
1120    fn try_from(v: &[T]) -> Result<Self> {
1121        let len: u32 = v.len().try_into().map_err(|_| Error::LengthExceedsMax)?;
1122        if len <= MAX {
1123            Ok(VecM(v.to_vec()))
1124        } else {
1125            Err(Error::LengthExceedsMax)
1126        }
1127    }
1128}
1129
1130impl<T, const MAX: u32> AsRef<[T]> for VecM<T, MAX> {
1131    #[cfg(feature = "alloc")]
1132    #[must_use]
1133    fn as_ref(&self) -> &[T] {
1134        self.0.as_ref()
1135    }
1136    #[cfg(not(feature = "alloc"))]
1137    #[must_use]
1138    fn as_ref(&self) -> &[T] {
1139        self.0
1140    }
1141}
1142
1143#[cfg(feature = "alloc")]
1144impl<T: Clone, const N: usize, const MAX: u32> TryFrom<[T; N]> for VecM<T, MAX> {
1145    type Error = Error;
1146
1147    fn try_from(v: [T; N]) -> Result<Self> {
1148        let len: u32 = v.len().try_into().map_err(|_| Error::LengthExceedsMax)?;
1149        if len <= MAX {
1150            Ok(VecM(v.to_vec()))
1151        } else {
1152            Err(Error::LengthExceedsMax)
1153        }
1154    }
1155}
1156
1157#[cfg(feature = "alloc")]
1158impl<T: Clone, const N: usize, const MAX: u32> TryFrom<VecM<T, MAX>> for [T; N] {
1159    type Error = VecM<T, MAX>;
1160
1161    fn try_from(v: VecM<T, MAX>) -> core::result::Result<Self, Self::Error> {
1162        let s: [T; N] = v.0.try_into().map_err(|v: Vec<T>| VecM::<T, MAX>(v))?;
1163        Ok(s)
1164    }
1165}
1166
1167#[cfg(feature = "alloc")]
1168impl<T: Clone, const N: usize, const MAX: u32> TryFrom<&[T; N]> for VecM<T, MAX> {
1169    type Error = Error;
1170
1171    fn try_from(v: &[T; N]) -> Result<Self> {
1172        let len: u32 = v.len().try_into().map_err(|_| Error::LengthExceedsMax)?;
1173        if len <= MAX {
1174            Ok(VecM(v.to_vec()))
1175        } else {
1176            Err(Error::LengthExceedsMax)
1177        }
1178    }
1179}
1180
1181#[cfg(not(feature = "alloc"))]
1182impl<T: Clone, const N: usize, const MAX: u32> TryFrom<&'static [T; N]> for VecM<T, MAX> {
1183    type Error = Error;
1184
1185    fn try_from(v: &'static [T; N]) -> Result<Self> {
1186        let len: u32 = v.len().try_into().map_err(|_| Error::LengthExceedsMax)?;
1187        if len <= MAX {
1188            Ok(VecM(v))
1189        } else {
1190            Err(Error::LengthExceedsMax)
1191        }
1192    }
1193}
1194
1195#[cfg(feature = "alloc")]
1196impl<const MAX: u32> TryFrom<&String> for VecM<u8, MAX> {
1197    type Error = Error;
1198
1199    fn try_from(v: &String) -> Result<Self> {
1200        let len: u32 = v.len().try_into().map_err(|_| Error::LengthExceedsMax)?;
1201        if len <= MAX {
1202            Ok(VecM(v.as_bytes().to_vec()))
1203        } else {
1204            Err(Error::LengthExceedsMax)
1205        }
1206    }
1207}
1208
1209#[cfg(feature = "alloc")]
1210impl<const MAX: u32> TryFrom<String> for VecM<u8, MAX> {
1211    type Error = Error;
1212
1213    fn try_from(v: String) -> Result<Self> {
1214        let len: u32 = v.len().try_into().map_err(|_| Error::LengthExceedsMax)?;
1215        if len <= MAX {
1216            Ok(VecM(v.into()))
1217        } else {
1218            Err(Error::LengthExceedsMax)
1219        }
1220    }
1221}
1222
1223#[cfg(feature = "alloc")]
1224impl<const MAX: u32> TryFrom<VecM<u8, MAX>> for String {
1225    type Error = Error;
1226
1227    fn try_from(v: VecM<u8, MAX>) -> Result<Self> {
1228        Ok(String::from_utf8(v.0)?)
1229    }
1230}
1231
1232#[cfg(feature = "alloc")]
1233impl<const MAX: u32> TryFrom<&VecM<u8, MAX>> for String {
1234    type Error = Error;
1235
1236    fn try_from(v: &VecM<u8, MAX>) -> Result<Self> {
1237        Ok(core::str::from_utf8(v.as_ref())?.to_owned())
1238    }
1239}
1240
1241#[cfg(feature = "alloc")]
1242impl<const MAX: u32> TryFrom<&str> for VecM<u8, MAX> {
1243    type Error = Error;
1244
1245    fn try_from(v: &str) -> Result<Self> {
1246        let len: u32 = v.len().try_into().map_err(|_| Error::LengthExceedsMax)?;
1247        if len <= MAX {
1248            Ok(VecM(v.into()))
1249        } else {
1250            Err(Error::LengthExceedsMax)
1251        }
1252    }
1253}
1254
1255#[cfg(not(feature = "alloc"))]
1256impl<const MAX: u32> TryFrom<&'static str> for VecM<u8, MAX> {
1257    type Error = Error;
1258
1259    fn try_from(v: &'static str) -> Result<Self> {
1260        let len: u32 = v.len().try_into().map_err(|_| Error::LengthExceedsMax)?;
1261        if len <= MAX {
1262            Ok(VecM(v.as_bytes()))
1263        } else {
1264            Err(Error::LengthExceedsMax)
1265        }
1266    }
1267}
1268
1269impl<'a, const MAX: u32> TryFrom<&'a VecM<u8, MAX>> for &'a str {
1270    type Error = Error;
1271
1272    fn try_from(v: &'a VecM<u8, MAX>) -> Result<Self> {
1273        Ok(core::str::from_utf8(v.as_ref())?)
1274    }
1275}
1276
1277impl<const MAX: u32> ReadXdr for VecM<u8, MAX> {
1278    #[cfg(feature = "std")]
1279    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
1280        r.with_limited_depth(|r| {
1281            let len: u32 = u32::read_xdr(r)?;
1282            if len > MAX {
1283                return Err(Error::LengthExceedsMax);
1284            }
1285
1286            r.consume_len(len as usize)?;
1287            let padding = pad_len(len as usize);
1288            r.consume_len(padding)?;
1289
1290            let mut vec = vec![0u8; len as usize];
1291            r.read_exact(&mut vec)?;
1292
1293            let pad = &mut [0u8; 3][..padding];
1294            r.read_exact(pad)?;
1295            if pad.iter().any(|b| *b != 0) {
1296                return Err(Error::NonZeroPadding);
1297            }
1298
1299            Ok(VecM(vec))
1300        })
1301    }
1302}
1303
1304impl<const MAX: u32> WriteXdr for VecM<u8, MAX> {
1305    #[cfg(feature = "std")]
1306    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
1307        w.with_limited_depth(|w| {
1308            let len: u32 = self.len().try_into().map_err(|_| Error::LengthExceedsMax)?;
1309            len.write_xdr(w)?;
1310
1311            w.consume_len(self.len())?;
1312            let padding = pad_len(self.len());
1313            w.consume_len(padding)?;
1314
1315            w.write_all(&self.0)?;
1316
1317            w.write_all(&[0u8; 3][..padding])?;
1318
1319            Ok(())
1320        })
1321    }
1322}
1323
1324impl<T: ReadXdr, const MAX: u32> ReadXdr for VecM<T, MAX> {
1325    #[cfg(feature = "std")]
1326    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
1327        r.with_limited_depth(|r| {
1328            let len = u32::read_xdr(r)?;
1329            if len > MAX {
1330                return Err(Error::LengthExceedsMax);
1331            }
1332
1333            let mut vec = Vec::new();
1334            for _ in 0..len {
1335                let t = T::read_xdr(r)?;
1336                vec.push(t);
1337            }
1338
1339            Ok(VecM(vec))
1340        })
1341    }
1342}
1343
1344impl<T: WriteXdr, const MAX: u32> WriteXdr for VecM<T, MAX> {
1345    #[cfg(feature = "std")]
1346    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
1347        w.with_limited_depth(|w| {
1348            let len: u32 = self.len().try_into().map_err(|_| Error::LengthExceedsMax)?;
1349            len.write_xdr(w)?;
1350
1351            for t in &self.0 {
1352                t.write_xdr(w)?;
1353            }
1354
1355            Ok(())
1356        })
1357    }
1358}
1359
1360// BytesM ------------------------------------------------------------------------
1361
1362#[cfg(feature = "alloc")]
1363#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
1364#[cfg_attr(
1365    feature = "serde",
1366    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
1367)]
1368#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
1369pub struct BytesM<const MAX: u32 = { u32::MAX }>(Vec<u8>);
1370
1371#[cfg(not(feature = "alloc"))]
1372#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
1373#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
1374pub struct BytesM<const MAX: u32 = { u32::MAX }>(Vec<u8>);
1375
1376impl<const MAX: u32> core::fmt::Display for BytesM<MAX> {
1377    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
1378        #[cfg(feature = "alloc")]
1379        let v = &self.0;
1380        #[cfg(not(feature = "alloc"))]
1381        let v = self.0;
1382        for b in v {
1383            write!(f, "{b:02x}")?;
1384        }
1385        Ok(())
1386    }
1387}
1388
1389impl<const MAX: u32> core::fmt::Debug for BytesM<MAX> {
1390    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
1391        #[cfg(feature = "alloc")]
1392        let v = &self.0;
1393        #[cfg(not(feature = "alloc"))]
1394        let v = self.0;
1395        write!(f, "BytesM(")?;
1396        for b in v {
1397            write!(f, "{b:02x}")?;
1398        }
1399        write!(f, ")")?;
1400        Ok(())
1401    }
1402}
1403
1404#[cfg(feature = "alloc")]
1405impl<const MAX: u32> core::str::FromStr for BytesM<MAX> {
1406    type Err = Error;
1407    fn from_str(s: &str) -> core::result::Result<Self, Self::Err> {
1408        hex::decode(s).map_err(|_| Error::InvalidHex)?.try_into()
1409    }
1410}
1411
1412impl<const MAX: u32> Deref for BytesM<MAX> {
1413    type Target = Vec<u8>;
1414
1415    fn deref(&self) -> &Self::Target {
1416        &self.0
1417    }
1418}
1419
1420#[cfg(feature = "schemars")]
1421impl<const MAX: u32> schemars::JsonSchema for BytesM<MAX> {
1422    fn schema_name() -> String {
1423        format!("BytesM<{MAX}>")
1424    }
1425
1426    fn is_referenceable() -> bool {
1427        false
1428    }
1429
1430    fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
1431        let schema = String::json_schema(gen);
1432        if let schemars::schema::Schema::Object(mut schema) = schema {
1433            schema.extensions.insert(
1434                "contentEncoding".to_owned(),
1435                serde_json::Value::String("hex".to_string()),
1436            );
1437            schema.extensions.insert(
1438                "contentMediaType".to_owned(),
1439                serde_json::Value::String("application/binary".to_string()),
1440            );
1441            let string = *schema.string.unwrap_or_default().clone();
1442            schema.string = Some(Box::new(schemars::schema::StringValidation {
1443                max_length: MAX.checked_mul(2).map(Some).unwrap_or_default(),
1444                min_length: None,
1445                ..string
1446            }));
1447            schema.into()
1448        } else {
1449            schema
1450        }
1451    }
1452}
1453
1454impl<const MAX: u32> Default for BytesM<MAX> {
1455    fn default() -> Self {
1456        Self(Vec::default())
1457    }
1458}
1459
1460impl<const MAX: u32> BytesM<MAX> {
1461    pub const MAX_LEN: usize = { MAX as usize };
1462
1463    #[must_use]
1464    #[allow(clippy::unused_self)]
1465    pub fn max_len(&self) -> usize {
1466        Self::MAX_LEN
1467    }
1468
1469    #[must_use]
1470    pub fn as_vec(&self) -> &Vec<u8> {
1471        self.as_ref()
1472    }
1473}
1474
1475impl<const MAX: u32> BytesM<MAX> {
1476    #[must_use]
1477    #[cfg(feature = "alloc")]
1478    pub fn to_vec(&self) -> Vec<u8> {
1479        self.into()
1480    }
1481
1482    #[must_use]
1483    pub fn into_vec(self) -> Vec<u8> {
1484        self.into()
1485    }
1486}
1487
1488impl<const MAX: u32> BytesM<MAX> {
1489    #[cfg(feature = "alloc")]
1490    pub fn to_string(&self) -> Result<String> {
1491        self.try_into()
1492    }
1493
1494    #[cfg(feature = "alloc")]
1495    pub fn into_string(self) -> Result<String> {
1496        self.try_into()
1497    }
1498
1499    #[cfg(feature = "alloc")]
1500    #[must_use]
1501    pub fn to_string_lossy(&self) -> String {
1502        String::from_utf8_lossy(&self.0).into_owned()
1503    }
1504
1505    #[cfg(feature = "alloc")]
1506    #[must_use]
1507    pub fn into_string_lossy(self) -> String {
1508        String::from_utf8_lossy(&self.0).into_owned()
1509    }
1510}
1511
1512impl<const MAX: u32> TryFrom<Vec<u8>> for BytesM<MAX> {
1513    type Error = Error;
1514
1515    fn try_from(v: Vec<u8>) -> Result<Self> {
1516        let len: u32 = v.len().try_into().map_err(|_| Error::LengthExceedsMax)?;
1517        if len <= MAX {
1518            Ok(BytesM(v))
1519        } else {
1520            Err(Error::LengthExceedsMax)
1521        }
1522    }
1523}
1524
1525impl<const MAX: u32> From<BytesM<MAX>> for Vec<u8> {
1526    #[must_use]
1527    fn from(v: BytesM<MAX>) -> Self {
1528        v.0
1529    }
1530}
1531
1532#[cfg(feature = "alloc")]
1533impl<const MAX: u32> From<&BytesM<MAX>> for Vec<u8> {
1534    #[must_use]
1535    fn from(v: &BytesM<MAX>) -> Self {
1536        v.0.clone()
1537    }
1538}
1539
1540impl<const MAX: u32> AsRef<Vec<u8>> for BytesM<MAX> {
1541    #[must_use]
1542    fn as_ref(&self) -> &Vec<u8> {
1543        &self.0
1544    }
1545}
1546
1547#[cfg(feature = "alloc")]
1548impl<const MAX: u32> TryFrom<&Vec<u8>> for BytesM<MAX> {
1549    type Error = Error;
1550
1551    fn try_from(v: &Vec<u8>) -> Result<Self> {
1552        v.as_slice().try_into()
1553    }
1554}
1555
1556#[cfg(feature = "alloc")]
1557impl<const MAX: u32> TryFrom<&[u8]> for BytesM<MAX> {
1558    type Error = Error;
1559
1560    fn try_from(v: &[u8]) -> Result<Self> {
1561        let len: u32 = v.len().try_into().map_err(|_| Error::LengthExceedsMax)?;
1562        if len <= MAX {
1563            Ok(BytesM(v.to_vec()))
1564        } else {
1565            Err(Error::LengthExceedsMax)
1566        }
1567    }
1568}
1569
1570impl<const MAX: u32> AsRef<[u8]> for BytesM<MAX> {
1571    #[cfg(feature = "alloc")]
1572    #[must_use]
1573    fn as_ref(&self) -> &[u8] {
1574        self.0.as_ref()
1575    }
1576    #[cfg(not(feature = "alloc"))]
1577    #[must_use]
1578    fn as_ref(&self) -> &[u8] {
1579        self.0
1580    }
1581}
1582
1583#[cfg(feature = "alloc")]
1584impl<const N: usize, const MAX: u32> TryFrom<[u8; N]> for BytesM<MAX> {
1585    type Error = Error;
1586
1587    fn try_from(v: [u8; N]) -> Result<Self> {
1588        let len: u32 = v.len().try_into().map_err(|_| Error::LengthExceedsMax)?;
1589        if len <= MAX {
1590            Ok(BytesM(v.to_vec()))
1591        } else {
1592            Err(Error::LengthExceedsMax)
1593        }
1594    }
1595}
1596
1597#[cfg(feature = "alloc")]
1598impl<const N: usize, const MAX: u32> TryFrom<BytesM<MAX>> for [u8; N] {
1599    type Error = BytesM<MAX>;
1600
1601    fn try_from(v: BytesM<MAX>) -> core::result::Result<Self, Self::Error> {
1602        let s: [u8; N] = v.0.try_into().map_err(BytesM::<MAX>)?;
1603        Ok(s)
1604    }
1605}
1606
1607#[cfg(feature = "alloc")]
1608impl<const N: usize, const MAX: u32> TryFrom<&[u8; N]> for BytesM<MAX> {
1609    type Error = Error;
1610
1611    fn try_from(v: &[u8; N]) -> Result<Self> {
1612        let len: u32 = v.len().try_into().map_err(|_| Error::LengthExceedsMax)?;
1613        if len <= MAX {
1614            Ok(BytesM(v.to_vec()))
1615        } else {
1616            Err(Error::LengthExceedsMax)
1617        }
1618    }
1619}
1620
1621#[cfg(not(feature = "alloc"))]
1622impl<const N: usize, const MAX: u32> TryFrom<&'static [u8; N]> for BytesM<MAX> {
1623    type Error = Error;
1624
1625    fn try_from(v: &'static [u8; N]) -> Result<Self> {
1626        let len: u32 = v.len().try_into().map_err(|_| Error::LengthExceedsMax)?;
1627        if len <= MAX {
1628            Ok(BytesM(v))
1629        } else {
1630            Err(Error::LengthExceedsMax)
1631        }
1632    }
1633}
1634
1635#[cfg(feature = "alloc")]
1636impl<const MAX: u32> TryFrom<&String> for BytesM<MAX> {
1637    type Error = Error;
1638
1639    fn try_from(v: &String) -> Result<Self> {
1640        let len: u32 = v.len().try_into().map_err(|_| Error::LengthExceedsMax)?;
1641        if len <= MAX {
1642            Ok(BytesM(v.as_bytes().to_vec()))
1643        } else {
1644            Err(Error::LengthExceedsMax)
1645        }
1646    }
1647}
1648
1649#[cfg(feature = "alloc")]
1650impl<const MAX: u32> TryFrom<String> for BytesM<MAX> {
1651    type Error = Error;
1652
1653    fn try_from(v: String) -> Result<Self> {
1654        let len: u32 = v.len().try_into().map_err(|_| Error::LengthExceedsMax)?;
1655        if len <= MAX {
1656            Ok(BytesM(v.into()))
1657        } else {
1658            Err(Error::LengthExceedsMax)
1659        }
1660    }
1661}
1662
1663#[cfg(feature = "alloc")]
1664impl<const MAX: u32> TryFrom<BytesM<MAX>> for String {
1665    type Error = Error;
1666
1667    fn try_from(v: BytesM<MAX>) -> Result<Self> {
1668        Ok(String::from_utf8(v.0)?)
1669    }
1670}
1671
1672#[cfg(feature = "alloc")]
1673impl<const MAX: u32> TryFrom<&BytesM<MAX>> for String {
1674    type Error = Error;
1675
1676    fn try_from(v: &BytesM<MAX>) -> Result<Self> {
1677        Ok(core::str::from_utf8(v.as_ref())?.to_owned())
1678    }
1679}
1680
1681#[cfg(feature = "alloc")]
1682impl<const MAX: u32> TryFrom<&str> for BytesM<MAX> {
1683    type Error = Error;
1684
1685    fn try_from(v: &str) -> Result<Self> {
1686        let len: u32 = v.len().try_into().map_err(|_| Error::LengthExceedsMax)?;
1687        if len <= MAX {
1688            Ok(BytesM(v.into()))
1689        } else {
1690            Err(Error::LengthExceedsMax)
1691        }
1692    }
1693}
1694
1695#[cfg(not(feature = "alloc"))]
1696impl<const MAX: u32> TryFrom<&'static str> for BytesM<MAX> {
1697    type Error = Error;
1698
1699    fn try_from(v: &'static str) -> Result<Self> {
1700        let len: u32 = v.len().try_into().map_err(|_| Error::LengthExceedsMax)?;
1701        if len <= MAX {
1702            Ok(BytesM(v.as_bytes()))
1703        } else {
1704            Err(Error::LengthExceedsMax)
1705        }
1706    }
1707}
1708
1709impl<'a, const MAX: u32> TryFrom<&'a BytesM<MAX>> for &'a str {
1710    type Error = Error;
1711
1712    fn try_from(v: &'a BytesM<MAX>) -> Result<Self> {
1713        Ok(core::str::from_utf8(v.as_ref())?)
1714    }
1715}
1716
1717impl<const MAX: u32> ReadXdr for BytesM<MAX> {
1718    #[cfg(feature = "std")]
1719    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
1720        r.with_limited_depth(|r| {
1721            let len: u32 = u32::read_xdr(r)?;
1722            if len > MAX {
1723                return Err(Error::LengthExceedsMax);
1724            }
1725
1726            r.consume_len(len as usize)?;
1727            let padding = pad_len(len as usize);
1728            r.consume_len(padding)?;
1729
1730            let mut vec = vec![0u8; len as usize];
1731            r.read_exact(&mut vec)?;
1732
1733            let pad = &mut [0u8; 3][..padding];
1734            r.read_exact(pad)?;
1735            if pad.iter().any(|b| *b != 0) {
1736                return Err(Error::NonZeroPadding);
1737            }
1738
1739            Ok(BytesM(vec))
1740        })
1741    }
1742}
1743
1744impl<const MAX: u32> WriteXdr for BytesM<MAX> {
1745    #[cfg(feature = "std")]
1746    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
1747        w.with_limited_depth(|w| {
1748            let len: u32 = self.len().try_into().map_err(|_| Error::LengthExceedsMax)?;
1749            len.write_xdr(w)?;
1750
1751            w.consume_len(self.len())?;
1752            let padding = pad_len(self.len());
1753            w.consume_len(padding)?;
1754
1755            w.write_all(&self.0)?;
1756
1757            w.write_all(&[0u8; 3][..pad_len(len as usize)])?;
1758
1759            Ok(())
1760        })
1761    }
1762}
1763
1764// StringM ------------------------------------------------------------------------
1765
1766/// A string type that contains arbitrary bytes.
1767///
1768/// Convertible, fallibly, to/from a Rust UTF-8 String using
1769/// [`TryFrom`]/[`TryInto`]/[`StringM::to_utf8_string`].
1770///
1771/// Convertible, lossyly, to a Rust UTF-8 String using
1772/// [`StringM::to_utf8_string_lossy`].
1773///
1774/// Convertible to/from escaped printable-ASCII using
1775/// [`Display`]/[`ToString`]/[`FromStr`].
1776
1777#[cfg(feature = "alloc")]
1778#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
1779#[cfg_attr(
1780    feature = "serde",
1781    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
1782)]
1783#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
1784pub struct StringM<const MAX: u32 = { u32::MAX }>(Vec<u8>);
1785
1786#[cfg(not(feature = "alloc"))]
1787#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
1788#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
1789pub struct StringM<const MAX: u32 = { u32::MAX }>(Vec<u8>);
1790
1791impl<const MAX: u32> core::fmt::Display for StringM<MAX> {
1792    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
1793        #[cfg(feature = "alloc")]
1794        let v = &self.0;
1795        #[cfg(not(feature = "alloc"))]
1796        let v = self.0;
1797        for b in escape_bytes::Escape::new(v) {
1798            write!(f, "{}", b as char)?;
1799        }
1800        Ok(())
1801    }
1802}
1803
1804impl<const MAX: u32> core::fmt::Debug for StringM<MAX> {
1805    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
1806        #[cfg(feature = "alloc")]
1807        let v = &self.0;
1808        #[cfg(not(feature = "alloc"))]
1809        let v = self.0;
1810        write!(f, "StringM(")?;
1811        for b in escape_bytes::Escape::new(v) {
1812            write!(f, "{}", b as char)?;
1813        }
1814        write!(f, ")")?;
1815        Ok(())
1816    }
1817}
1818
1819#[cfg(feature = "alloc")]
1820impl<const MAX: u32> core::str::FromStr for StringM<MAX> {
1821    type Err = Error;
1822    fn from_str(s: &str) -> core::result::Result<Self, Self::Err> {
1823        let b = escape_bytes::unescape(s.as_bytes()).map_err(|_| Error::Invalid)?;
1824        Ok(Self(b))
1825    }
1826}
1827
1828impl<const MAX: u32> Deref for StringM<MAX> {
1829    type Target = Vec<u8>;
1830
1831    fn deref(&self) -> &Self::Target {
1832        &self.0
1833    }
1834}
1835
1836impl<const MAX: u32> Default for StringM<MAX> {
1837    fn default() -> Self {
1838        Self(Vec::default())
1839    }
1840}
1841
1842#[cfg(feature = "schemars")]
1843impl<const MAX: u32> schemars::JsonSchema for StringM<MAX> {
1844    fn schema_name() -> String {
1845        format!("StringM<{MAX}>")
1846    }
1847
1848    fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
1849        let schema = String::json_schema(gen);
1850        if let schemars::schema::Schema::Object(mut schema) = schema {
1851            let string = *schema.string.unwrap_or_default().clone();
1852            schema.string = Some(Box::new(schemars::schema::StringValidation {
1853                max_length: Some(MAX),
1854                ..string
1855            }));
1856            schema.into()
1857        } else {
1858            schema
1859        }
1860    }
1861}
1862
1863impl<const MAX: u32> StringM<MAX> {
1864    pub const MAX_LEN: usize = { MAX as usize };
1865
1866    #[must_use]
1867    #[allow(clippy::unused_self)]
1868    pub fn max_len(&self) -> usize {
1869        Self::MAX_LEN
1870    }
1871
1872    #[must_use]
1873    pub fn as_vec(&self) -> &Vec<u8> {
1874        self.as_ref()
1875    }
1876}
1877
1878impl<const MAX: u32> StringM<MAX> {
1879    #[must_use]
1880    #[cfg(feature = "alloc")]
1881    pub fn to_vec(&self) -> Vec<u8> {
1882        self.into()
1883    }
1884
1885    #[must_use]
1886    pub fn into_vec(self) -> Vec<u8> {
1887        self.into()
1888    }
1889}
1890
1891impl<const MAX: u32> StringM<MAX> {
1892    #[cfg(feature = "alloc")]
1893    pub fn to_utf8_string(&self) -> Result<String> {
1894        self.try_into()
1895    }
1896
1897    #[cfg(feature = "alloc")]
1898    pub fn into_utf8_string(self) -> Result<String> {
1899        self.try_into()
1900    }
1901
1902    #[cfg(feature = "alloc")]
1903    #[must_use]
1904    pub fn to_utf8_string_lossy(&self) -> String {
1905        String::from_utf8_lossy(&self.0).into_owned()
1906    }
1907
1908    #[cfg(feature = "alloc")]
1909    #[must_use]
1910    pub fn into_utf8_string_lossy(self) -> String {
1911        String::from_utf8_lossy(&self.0).into_owned()
1912    }
1913}
1914
1915impl<const MAX: u32> TryFrom<Vec<u8>> for StringM<MAX> {
1916    type Error = Error;
1917
1918    fn try_from(v: Vec<u8>) -> Result<Self> {
1919        let len: u32 = v.len().try_into().map_err(|_| Error::LengthExceedsMax)?;
1920        if len <= MAX {
1921            Ok(StringM(v))
1922        } else {
1923            Err(Error::LengthExceedsMax)
1924        }
1925    }
1926}
1927
1928impl<const MAX: u32> From<StringM<MAX>> for Vec<u8> {
1929    #[must_use]
1930    fn from(v: StringM<MAX>) -> Self {
1931        v.0
1932    }
1933}
1934
1935#[cfg(feature = "alloc")]
1936impl<const MAX: u32> From<&StringM<MAX>> for Vec<u8> {
1937    #[must_use]
1938    fn from(v: &StringM<MAX>) -> Self {
1939        v.0.clone()
1940    }
1941}
1942
1943impl<const MAX: u32> AsRef<Vec<u8>> for StringM<MAX> {
1944    #[must_use]
1945    fn as_ref(&self) -> &Vec<u8> {
1946        &self.0
1947    }
1948}
1949
1950#[cfg(feature = "alloc")]
1951impl<const MAX: u32> TryFrom<&Vec<u8>> for StringM<MAX> {
1952    type Error = Error;
1953
1954    fn try_from(v: &Vec<u8>) -> Result<Self> {
1955        v.as_slice().try_into()
1956    }
1957}
1958
1959#[cfg(feature = "alloc")]
1960impl<const MAX: u32> TryFrom<&[u8]> for StringM<MAX> {
1961    type Error = Error;
1962
1963    fn try_from(v: &[u8]) -> Result<Self> {
1964        let len: u32 = v.len().try_into().map_err(|_| Error::LengthExceedsMax)?;
1965        if len <= MAX {
1966            Ok(StringM(v.to_vec()))
1967        } else {
1968            Err(Error::LengthExceedsMax)
1969        }
1970    }
1971}
1972
1973impl<const MAX: u32> AsRef<[u8]> for StringM<MAX> {
1974    #[cfg(feature = "alloc")]
1975    #[must_use]
1976    fn as_ref(&self) -> &[u8] {
1977        self.0.as_ref()
1978    }
1979    #[cfg(not(feature = "alloc"))]
1980    #[must_use]
1981    fn as_ref(&self) -> &[u8] {
1982        self.0
1983    }
1984}
1985
1986#[cfg(feature = "alloc")]
1987impl<const N: usize, const MAX: u32> TryFrom<[u8; N]> for StringM<MAX> {
1988    type Error = Error;
1989
1990    fn try_from(v: [u8; N]) -> Result<Self> {
1991        let len: u32 = v.len().try_into().map_err(|_| Error::LengthExceedsMax)?;
1992        if len <= MAX {
1993            Ok(StringM(v.to_vec()))
1994        } else {
1995            Err(Error::LengthExceedsMax)
1996        }
1997    }
1998}
1999
2000#[cfg(feature = "alloc")]
2001impl<const N: usize, const MAX: u32> TryFrom<StringM<MAX>> for [u8; N] {
2002    type Error = StringM<MAX>;
2003
2004    fn try_from(v: StringM<MAX>) -> core::result::Result<Self, Self::Error> {
2005        let s: [u8; N] = v.0.try_into().map_err(StringM::<MAX>)?;
2006        Ok(s)
2007    }
2008}
2009
2010#[cfg(feature = "alloc")]
2011impl<const N: usize, const MAX: u32> TryFrom<&[u8; N]> for StringM<MAX> {
2012    type Error = Error;
2013
2014    fn try_from(v: &[u8; N]) -> Result<Self> {
2015        let len: u32 = v.len().try_into().map_err(|_| Error::LengthExceedsMax)?;
2016        if len <= MAX {
2017            Ok(StringM(v.to_vec()))
2018        } else {
2019            Err(Error::LengthExceedsMax)
2020        }
2021    }
2022}
2023
2024#[cfg(not(feature = "alloc"))]
2025impl<const N: usize, const MAX: u32> TryFrom<&'static [u8; N]> for StringM<MAX> {
2026    type Error = Error;
2027
2028    fn try_from(v: &'static [u8; N]) -> Result<Self> {
2029        let len: u32 = v.len().try_into().map_err(|_| Error::LengthExceedsMax)?;
2030        if len <= MAX {
2031            Ok(StringM(v))
2032        } else {
2033            Err(Error::LengthExceedsMax)
2034        }
2035    }
2036}
2037
2038#[cfg(feature = "alloc")]
2039impl<const MAX: u32> TryFrom<&String> for StringM<MAX> {
2040    type Error = Error;
2041
2042    fn try_from(v: &String) -> Result<Self> {
2043        let len: u32 = v.len().try_into().map_err(|_| Error::LengthExceedsMax)?;
2044        if len <= MAX {
2045            Ok(StringM(v.as_bytes().to_vec()))
2046        } else {
2047            Err(Error::LengthExceedsMax)
2048        }
2049    }
2050}
2051
2052#[cfg(feature = "alloc")]
2053impl<const MAX: u32> TryFrom<String> for StringM<MAX> {
2054    type Error = Error;
2055
2056    fn try_from(v: String) -> Result<Self> {
2057        let len: u32 = v.len().try_into().map_err(|_| Error::LengthExceedsMax)?;
2058        if len <= MAX {
2059            Ok(StringM(v.into()))
2060        } else {
2061            Err(Error::LengthExceedsMax)
2062        }
2063    }
2064}
2065
2066#[cfg(feature = "alloc")]
2067impl<const MAX: u32> TryFrom<StringM<MAX>> for String {
2068    type Error = Error;
2069
2070    fn try_from(v: StringM<MAX>) -> Result<Self> {
2071        Ok(String::from_utf8(v.0)?)
2072    }
2073}
2074
2075#[cfg(feature = "alloc")]
2076impl<const MAX: u32> TryFrom<&StringM<MAX>> for String {
2077    type Error = Error;
2078
2079    fn try_from(v: &StringM<MAX>) -> Result<Self> {
2080        Ok(core::str::from_utf8(v.as_ref())?.to_owned())
2081    }
2082}
2083
2084#[cfg(feature = "alloc")]
2085impl<const MAX: u32> TryFrom<&str> for StringM<MAX> {
2086    type Error = Error;
2087
2088    fn try_from(v: &str) -> Result<Self> {
2089        let len: u32 = v.len().try_into().map_err(|_| Error::LengthExceedsMax)?;
2090        if len <= MAX {
2091            Ok(StringM(v.into()))
2092        } else {
2093            Err(Error::LengthExceedsMax)
2094        }
2095    }
2096}
2097
2098#[cfg(not(feature = "alloc"))]
2099impl<const MAX: u32> TryFrom<&'static str> for StringM<MAX> {
2100    type Error = Error;
2101
2102    fn try_from(v: &'static str) -> Result<Self> {
2103        let len: u32 = v.len().try_into().map_err(|_| Error::LengthExceedsMax)?;
2104        if len <= MAX {
2105            Ok(StringM(v.as_bytes()))
2106        } else {
2107            Err(Error::LengthExceedsMax)
2108        }
2109    }
2110}
2111
2112impl<'a, const MAX: u32> TryFrom<&'a StringM<MAX>> for &'a str {
2113    type Error = Error;
2114
2115    fn try_from(v: &'a StringM<MAX>) -> Result<Self> {
2116        Ok(core::str::from_utf8(v.as_ref())?)
2117    }
2118}
2119
2120impl<const MAX: u32> ReadXdr for StringM<MAX> {
2121    #[cfg(feature = "std")]
2122    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
2123        r.with_limited_depth(|r| {
2124            let len: u32 = u32::read_xdr(r)?;
2125            if len > MAX {
2126                return Err(Error::LengthExceedsMax);
2127            }
2128
2129            r.consume_len(len as usize)?;
2130            let padding = pad_len(len as usize);
2131            r.consume_len(padding)?;
2132
2133            let mut vec = vec![0u8; len as usize];
2134            r.read_exact(&mut vec)?;
2135
2136            let pad = &mut [0u8; 3][..padding];
2137            r.read_exact(pad)?;
2138            if pad.iter().any(|b| *b != 0) {
2139                return Err(Error::NonZeroPadding);
2140            }
2141
2142            Ok(StringM(vec))
2143        })
2144    }
2145}
2146
2147impl<const MAX: u32> WriteXdr for StringM<MAX> {
2148    #[cfg(feature = "std")]
2149    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
2150        w.with_limited_depth(|w| {
2151            let len: u32 = self.len().try_into().map_err(|_| Error::LengthExceedsMax)?;
2152            len.write_xdr(w)?;
2153
2154            w.consume_len(self.len())?;
2155            let padding = pad_len(self.len());
2156            w.consume_len(padding)?;
2157
2158            w.write_all(&self.0)?;
2159
2160            w.write_all(&[0u8; 3][..padding])?;
2161
2162            Ok(())
2163        })
2164    }
2165}
2166
2167// Frame ------------------------------------------------------------------------
2168
2169#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
2170#[cfg_attr(
2171    all(feature = "serde", feature = "alloc"),
2172    derive(serde::Serialize, serde::Deserialize),
2173    serde(rename_all = "snake_case")
2174)]
2175pub struct Frame<T>(pub T)
2176where
2177    T: ReadXdr;
2178
2179#[cfg(feature = "schemars")]
2180impl<T: schemars::JsonSchema + ReadXdr> schemars::JsonSchema for Frame<T> {
2181    fn schema_name() -> String {
2182        format!("Frame<{}>", T::schema_name())
2183    }
2184
2185    fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
2186        T::json_schema(gen)
2187    }
2188}
2189
2190impl<T> ReadXdr for Frame<T>
2191where
2192    T: ReadXdr,
2193{
2194    #[cfg(feature = "std")]
2195    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
2196        // Read the frame header value that contains 1 flag-bit and a 33-bit length.
2197        //  - The 1 flag bit is 0 when there are more frames for the same record.
2198        //  - The 31-bit length is the length of the bytes within the frame that
2199        //  follow the frame header.
2200        let header = u32::read_xdr(r)?;
2201        // TODO: Use the length and cap the length we'll read from `r`.
2202        let last_record = header >> 31 == 1;
2203        if last_record {
2204            // Read the record in the frame.
2205            Ok(Self(T::read_xdr(r)?))
2206        } else {
2207            // TODO: Support reading those additional frames for the same
2208            // record.
2209            Err(Error::Unsupported)
2210        }
2211    }
2212}
2213
2214#[cfg(all(test, feature = "std"))]
2215mod tests {
2216    use std::io::Cursor;
2217
2218    use super::*;
2219
2220    #[test]
2221    pub fn vec_u8_read_without_padding() {
2222        let buf = Cursor::new(vec![0, 0, 0, 4, 2, 2, 2, 2]);
2223        let v = VecM::<u8, 8>::read_xdr(&mut Limited::new(buf, Limits::none())).unwrap();
2224        assert_eq!(v.to_vec(), vec![2, 2, 2, 2]);
2225    }
2226
2227    #[test]
2228    pub fn vec_u8_read_with_padding() {
2229        let buf = Cursor::new(vec![0, 0, 0, 1, 2, 0, 0, 0]);
2230        let v = VecM::<u8, 8>::read_xdr(&mut Limited::new(buf, Limits::none())).unwrap();
2231        assert_eq!(v.to_vec(), vec![2]);
2232    }
2233
2234    #[test]
2235    pub fn vec_u8_read_with_insufficient_padding() {
2236        let buf = Cursor::new(vec![0, 0, 0, 1, 2, 0, 0]);
2237        let res = VecM::<u8, 8>::read_xdr(&mut Limited::new(buf, Limits::none()));
2238        match res {
2239            Err(Error::Io(_)) => (),
2240            _ => panic!("expected IO error got {res:?}"),
2241        }
2242    }
2243
2244    #[test]
2245    pub fn vec_u8_read_with_non_zero_padding() {
2246        let buf = Cursor::new(vec![0, 0, 0, 1, 2, 3, 0, 0]);
2247        let res = VecM::<u8, 8>::read_xdr(&mut Limited::new(buf, Limits::none()));
2248        match res {
2249            Err(Error::NonZeroPadding) => (),
2250            _ => panic!("expected NonZeroPadding got {res:?}"),
2251        }
2252    }
2253
2254    #[test]
2255    pub fn vec_u8_write_without_padding() {
2256        let mut buf = vec![];
2257        let v: VecM<u8, 8> = vec![2, 2, 2, 2].try_into().unwrap();
2258
2259        v.write_xdr(&mut Limited::new(Cursor::new(&mut buf), Limits::none()))
2260            .unwrap();
2261        assert_eq!(buf, vec![0, 0, 0, 4, 2, 2, 2, 2]);
2262    }
2263
2264    #[test]
2265    pub fn vec_u8_write_with_padding() {
2266        let mut buf = vec![];
2267        let v: VecM<u8, 8> = vec![2].try_into().unwrap();
2268        v.write_xdr(&mut Limited::new(Cursor::new(&mut buf), Limits::none()))
2269            .unwrap();
2270        assert_eq!(buf, vec![0, 0, 0, 1, 2, 0, 0, 0]);
2271    }
2272
2273    #[test]
2274    pub fn arr_u8_read_without_padding() {
2275        let buf = Cursor::new(vec![2, 2, 2, 2]);
2276        let v = <[u8; 4]>::read_xdr(&mut Limited::new(buf, Limits::none())).unwrap();
2277        assert_eq!(v, [2, 2, 2, 2]);
2278    }
2279
2280    #[test]
2281    pub fn arr_u8_read_with_padding() {
2282        let buf = Cursor::new(vec![2, 0, 0, 0]);
2283        let v = <[u8; 1]>::read_xdr(&mut Limited::new(buf, Limits::none())).unwrap();
2284        assert_eq!(v, [2]);
2285    }
2286
2287    #[test]
2288    pub fn arr_u8_read_with_insufficient_padding() {
2289        let buf = Cursor::new(vec![2, 0, 0]);
2290        let res = <[u8; 1]>::read_xdr(&mut Limited::new(buf, Limits::none()));
2291        match res {
2292            Err(Error::Io(_)) => (),
2293            _ => panic!("expected IO error got {res:?}"),
2294        }
2295    }
2296
2297    #[test]
2298    pub fn arr_u8_read_with_non_zero_padding() {
2299        let buf = Cursor::new(vec![2, 3, 0, 0]);
2300        let res = <[u8; 1]>::read_xdr(&mut Limited::new(buf, Limits::none()));
2301        match res {
2302            Err(Error::NonZeroPadding) => (),
2303            _ => panic!("expected NonZeroPadding got {res:?}"),
2304        }
2305    }
2306
2307    #[test]
2308    pub fn arr_u8_write_without_padding() {
2309        let mut buf = vec![];
2310        [2u8, 2, 2, 2]
2311            .write_xdr(&mut Limited::new(Cursor::new(&mut buf), Limits::none()))
2312            .unwrap();
2313        assert_eq!(buf, vec![2, 2, 2, 2]);
2314    }
2315
2316    #[test]
2317    pub fn arr_u8_write_with_padding() {
2318        let mut buf = vec![];
2319        [2u8]
2320            .write_xdr(&mut Limited::new(Cursor::new(&mut buf), Limits::none()))
2321            .unwrap();
2322        assert_eq!(buf, vec![2, 0, 0, 0]);
2323    }
2324}
2325
2326#[cfg(all(test, feature = "std"))]
2327mod test {
2328    use super::*;
2329
2330    #[test]
2331    fn into_option_none() {
2332        let v: VecM<u32, 1> = vec![].try_into().unwrap();
2333        assert_eq!(v.into_option(), None);
2334    }
2335
2336    #[test]
2337    fn into_option_some() {
2338        let v: VecM<_, 1> = vec![1].try_into().unwrap();
2339        assert_eq!(v.into_option(), Some(1));
2340    }
2341
2342    #[test]
2343    fn to_option_none() {
2344        let v: VecM<u32, 1> = vec![].try_into().unwrap();
2345        assert_eq!(v.to_option(), None);
2346    }
2347
2348    #[test]
2349    fn to_option_some() {
2350        let v: VecM<_, 1> = vec![1].try_into().unwrap();
2351        assert_eq!(v.to_option(), Some(1));
2352    }
2353
2354    #[test]
2355    fn depth_limited_read_write_under_the_limit_success() {
2356        let a: Option<Option<Option<u32>>> = Some(Some(Some(5)));
2357        let mut buf = Limited::new(Vec::new(), Limits::depth(4));
2358        a.write_xdr(&mut buf).unwrap();
2359
2360        let mut dlr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::depth(4));
2361        let a_back: Option<Option<Option<u32>>> = ReadXdr::read_xdr(&mut dlr).unwrap();
2362        assert_eq!(a, a_back);
2363    }
2364
2365    #[test]
2366    fn write_over_depth_limit_fail() {
2367        let a: Option<Option<Option<u32>>> = Some(Some(Some(5)));
2368        let mut buf = Limited::new(Vec::new(), Limits::depth(3));
2369        let res = a.write_xdr(&mut buf);
2370        match res {
2371            Err(Error::DepthLimitExceeded) => (),
2372            _ => panic!("expected DepthLimitExceeded got {res:?}"),
2373        }
2374    }
2375
2376    #[test]
2377    fn read_over_depth_limit_fail() {
2378        let read_limits = Limits::depth(3);
2379        let write_limits = Limits::depth(5);
2380        let a: Option<Option<Option<u32>>> = Some(Some(Some(5)));
2381        let mut buf = Limited::new(Vec::new(), write_limits);
2382        a.write_xdr(&mut buf).unwrap();
2383
2384        let mut dlr = Limited::new(Cursor::new(buf.inner.as_slice()), read_limits);
2385        let res: Result<Option<Option<Option<u32>>>> = ReadXdr::read_xdr(&mut dlr);
2386        match res {
2387            Err(Error::DepthLimitExceeded) => (),
2388            _ => panic!("expected DepthLimitExceeded got {res:?}"),
2389        }
2390    }
2391
2392    #[test]
2393    fn length_limited_read_write_i32() {
2394        // Exact limit, success
2395        let v = 123i32;
2396        let mut buf = Limited::new(Vec::new(), Limits::len(4));
2397        v.write_xdr(&mut buf).unwrap();
2398        assert_eq!(buf.limits.len, 0);
2399        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(4));
2400        let v_back: i32 = ReadXdr::read_xdr(&mut lr).unwrap();
2401        assert_eq!(buf.limits.len, 0);
2402        assert_eq!(v, v_back);
2403
2404        // Over limit, success
2405        let v = 123i32;
2406        let mut buf = Limited::new(Vec::new(), Limits::len(5));
2407        v.write_xdr(&mut buf).unwrap();
2408        assert_eq!(buf.limits.len, 1);
2409        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(5));
2410        let v_back: i32 = ReadXdr::read_xdr(&mut lr).unwrap();
2411        assert_eq!(buf.limits.len, 1);
2412        assert_eq!(v, v_back);
2413
2414        // Write under limit, failure
2415        let v = 123i32;
2416        let mut buf = Limited::new(Vec::new(), Limits::len(3));
2417        assert_eq!(v.write_xdr(&mut buf), Err(Error::LengthLimitExceeded));
2418
2419        // Read under limit, failure
2420        let v = 123i32;
2421        let mut buf = Limited::new(Vec::new(), Limits::len(4));
2422        v.write_xdr(&mut buf).unwrap();
2423        assert_eq!(buf.limits.len, 0);
2424        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(3));
2425        assert_eq!(
2426            <i32 as ReadXdr>::read_xdr(&mut lr),
2427            Err(Error::LengthLimitExceeded)
2428        );
2429    }
2430
2431    #[test]
2432    fn length_limited_read_write_u32() {
2433        // Exact limit, success
2434        let v = 123u32;
2435        let mut buf = Limited::new(Vec::new(), Limits::len(4));
2436        v.write_xdr(&mut buf).unwrap();
2437        assert_eq!(buf.limits.len, 0);
2438        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(4));
2439        let v_back: u32 = ReadXdr::read_xdr(&mut lr).unwrap();
2440        assert_eq!(buf.limits.len, 0);
2441        assert_eq!(v, v_back);
2442
2443        // Over limit, success
2444        let v = 123u32;
2445        let mut buf = Limited::new(Vec::new(), Limits::len(5));
2446        v.write_xdr(&mut buf).unwrap();
2447        assert_eq!(buf.limits.len, 1);
2448        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(5));
2449        let v_back: u32 = ReadXdr::read_xdr(&mut lr).unwrap();
2450        assert_eq!(buf.limits.len, 1);
2451        assert_eq!(v, v_back);
2452
2453        // Write under limit, failure
2454        let v = 123u32;
2455        let mut buf = Limited::new(Vec::new(), Limits::len(3));
2456        assert_eq!(v.write_xdr(&mut buf), Err(Error::LengthLimitExceeded));
2457
2458        // Read under limit, failure
2459        let v = 123u32;
2460        let mut buf = Limited::new(Vec::new(), Limits::len(4));
2461        v.write_xdr(&mut buf).unwrap();
2462        assert_eq!(buf.limits.len, 0);
2463        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(3));
2464        assert_eq!(
2465            <u32 as ReadXdr>::read_xdr(&mut lr),
2466            Err(Error::LengthLimitExceeded)
2467        );
2468    }
2469
2470    #[test]
2471    fn length_limited_read_write_i64() {
2472        // Exact limit, success
2473        let v = 123i64;
2474        let mut buf = Limited::new(Vec::new(), Limits::len(8));
2475        v.write_xdr(&mut buf).unwrap();
2476        assert_eq!(buf.limits.len, 0);
2477        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(8));
2478        let v_back: i64 = ReadXdr::read_xdr(&mut lr).unwrap();
2479        assert_eq!(buf.limits.len, 0);
2480        assert_eq!(v, v_back);
2481
2482        // Over limit, success
2483        let v = 123i64;
2484        let mut buf = Limited::new(Vec::new(), Limits::len(9));
2485        v.write_xdr(&mut buf).unwrap();
2486        assert_eq!(buf.limits.len, 1);
2487        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(9));
2488        let v_back: i64 = ReadXdr::read_xdr(&mut lr).unwrap();
2489        assert_eq!(buf.limits.len, 1);
2490        assert_eq!(v, v_back);
2491
2492        // Write under limit, failure
2493        let v = 123i64;
2494        let mut buf = Limited::new(Vec::new(), Limits::len(7));
2495        assert_eq!(v.write_xdr(&mut buf), Err(Error::LengthLimitExceeded));
2496
2497        // Read under limit, failure
2498        let v = 123i64;
2499        let mut buf = Limited::new(Vec::new(), Limits::len(8));
2500        v.write_xdr(&mut buf).unwrap();
2501        assert_eq!(buf.limits.len, 0);
2502        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(7));
2503        assert_eq!(
2504            <i64 as ReadXdr>::read_xdr(&mut lr),
2505            Err(Error::LengthLimitExceeded)
2506        );
2507    }
2508
2509    #[test]
2510    fn length_limited_read_write_u64() {
2511        // Exact limit, success
2512        let v = 123u64;
2513        let mut buf = Limited::new(Vec::new(), Limits::len(8));
2514        v.write_xdr(&mut buf).unwrap();
2515        assert_eq!(buf.limits.len, 0);
2516        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(8));
2517        let v_back: u64 = ReadXdr::read_xdr(&mut lr).unwrap();
2518        assert_eq!(buf.limits.len, 0);
2519        assert_eq!(v, v_back);
2520
2521        // Over limit, success
2522        let v = 123u64;
2523        let mut buf = Limited::new(Vec::new(), Limits::len(9));
2524        v.write_xdr(&mut buf).unwrap();
2525        assert_eq!(buf.limits.len, 1);
2526        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(9));
2527        let v_back: u64 = ReadXdr::read_xdr(&mut lr).unwrap();
2528        assert_eq!(buf.limits.len, 1);
2529        assert_eq!(v, v_back);
2530
2531        // Write under limit, failure
2532        let v = 123u64;
2533        let mut buf = Limited::new(Vec::new(), Limits::len(7));
2534        assert_eq!(v.write_xdr(&mut buf), Err(Error::LengthLimitExceeded));
2535
2536        // Read under limit, failure
2537        let v = 123u64;
2538        let mut buf = Limited::new(Vec::new(), Limits::len(8));
2539        v.write_xdr(&mut buf).unwrap();
2540        assert_eq!(buf.limits.len, 0);
2541        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(7));
2542        assert_eq!(
2543            <u64 as ReadXdr>::read_xdr(&mut lr),
2544            Err(Error::LengthLimitExceeded)
2545        );
2546    }
2547
2548    #[test]
2549    fn length_limited_read_write_bool() {
2550        // Exact limit, success
2551        let v = true;
2552        let mut buf = Limited::new(Vec::new(), Limits::len(4));
2553        v.write_xdr(&mut buf).unwrap();
2554        assert_eq!(buf.limits.len, 0);
2555        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(4));
2556        let v_back: bool = ReadXdr::read_xdr(&mut lr).unwrap();
2557        assert_eq!(buf.limits.len, 0);
2558        assert_eq!(v, v_back);
2559
2560        // Over limit, success
2561        let v = true;
2562        let mut buf = Limited::new(Vec::new(), Limits::len(5));
2563        v.write_xdr(&mut buf).unwrap();
2564        assert_eq!(buf.limits.len, 1);
2565        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(5));
2566        let v_back: bool = ReadXdr::read_xdr(&mut lr).unwrap();
2567        assert_eq!(buf.limits.len, 1);
2568        assert_eq!(v, v_back);
2569
2570        // Write under limit, failure
2571        let v = true;
2572        let mut buf = Limited::new(Vec::new(), Limits::len(3));
2573        assert_eq!(v.write_xdr(&mut buf), Err(Error::LengthLimitExceeded));
2574
2575        // Read under limit, failure
2576        let v = true;
2577        let mut buf = Limited::new(Vec::new(), Limits::len(4));
2578        v.write_xdr(&mut buf).unwrap();
2579        assert_eq!(buf.limits.len, 0);
2580        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(3));
2581        assert_eq!(
2582            <bool as ReadXdr>::read_xdr(&mut lr),
2583            Err(Error::LengthLimitExceeded)
2584        );
2585    }
2586
2587    #[test]
2588    fn length_limited_read_write_option() {
2589        // Exact limit, success
2590        let v = Some(true);
2591        let mut buf = Limited::new(Vec::new(), Limits::len(8));
2592        v.write_xdr(&mut buf).unwrap();
2593        assert_eq!(buf.limits.len, 0);
2594        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(8));
2595        let v_back: Option<bool> = ReadXdr::read_xdr(&mut lr).unwrap();
2596        assert_eq!(buf.limits.len, 0);
2597        assert_eq!(v, v_back);
2598
2599        // Over limit, success
2600        let v = Some(true);
2601        let mut buf = Limited::new(Vec::new(), Limits::len(9));
2602        v.write_xdr(&mut buf).unwrap();
2603        assert_eq!(buf.limits.len, 1);
2604        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(9));
2605        let v_back: Option<bool> = ReadXdr::read_xdr(&mut lr).unwrap();
2606        assert_eq!(buf.limits.len, 1);
2607        assert_eq!(v, v_back);
2608
2609        // Write under limit, failure
2610        let v = Some(true);
2611        let mut buf = Limited::new(Vec::new(), Limits::len(7));
2612        assert_eq!(v.write_xdr(&mut buf), Err(Error::LengthLimitExceeded));
2613
2614        // Read under limit, failure
2615        let v = Some(true);
2616        let mut buf = Limited::new(Vec::new(), Limits::len(8));
2617        v.write_xdr(&mut buf).unwrap();
2618        assert_eq!(buf.limits.len, 0);
2619        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(7));
2620        assert_eq!(
2621            <Option<bool> as ReadXdr>::read_xdr(&mut lr),
2622            Err(Error::LengthLimitExceeded)
2623        );
2624    }
2625
2626    #[test]
2627    fn length_limited_read_write_array_u8() {
2628        // Exact limit, success
2629        let v = [1u8, 2, 3];
2630        let mut buf = Limited::new(Vec::new(), Limits::len(4));
2631        v.write_xdr(&mut buf).unwrap();
2632        assert_eq!(buf.limits.len, 0);
2633        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(4));
2634        let v_back: [u8; 3] = ReadXdr::read_xdr(&mut lr).unwrap();
2635        assert_eq!(buf.limits.len, 0);
2636        assert_eq!(v, v_back);
2637
2638        // Over limit, success
2639        let v = [1u8, 2, 3];
2640        let mut buf = Limited::new(Vec::new(), Limits::len(5));
2641        v.write_xdr(&mut buf).unwrap();
2642        assert_eq!(buf.limits.len, 1);
2643        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(5));
2644        let v_back: [u8; 3] = ReadXdr::read_xdr(&mut lr).unwrap();
2645        assert_eq!(buf.limits.len, 1);
2646        assert_eq!(v, v_back);
2647
2648        // Write under limit, failure
2649        let v = [1u8, 2, 3];
2650        let mut buf = Limited::new(Vec::new(), Limits::len(3));
2651        assert_eq!(v.write_xdr(&mut buf), Err(Error::LengthLimitExceeded));
2652
2653        // Read under limit, failure
2654        let v = [1u8, 2, 3];
2655        let mut buf = Limited::new(Vec::new(), Limits::len(4));
2656        v.write_xdr(&mut buf).unwrap();
2657        assert_eq!(buf.limits.len, 0);
2658        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(3));
2659        assert_eq!(
2660            <[u8; 3] as ReadXdr>::read_xdr(&mut lr),
2661            Err(Error::LengthLimitExceeded)
2662        );
2663    }
2664
2665    #[test]
2666    fn length_limited_read_write_array_type() {
2667        // Exact limit, success
2668        let v = [true, false, true];
2669        let mut buf = Limited::new(Vec::new(), Limits::len(12));
2670        v.write_xdr(&mut buf).unwrap();
2671        assert_eq!(buf.limits.len, 0);
2672        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(12));
2673        let v_back: [bool; 3] = ReadXdr::read_xdr(&mut lr).unwrap();
2674        assert_eq!(buf.limits.len, 0);
2675        assert_eq!(v, v_back);
2676
2677        // Over limit, success
2678        let v = [true, false, true];
2679        let mut buf = Limited::new(Vec::new(), Limits::len(13));
2680        v.write_xdr(&mut buf).unwrap();
2681        assert_eq!(buf.limits.len, 1);
2682        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(13));
2683        let v_back: [bool; 3] = ReadXdr::read_xdr(&mut lr).unwrap();
2684        assert_eq!(buf.limits.len, 1);
2685        assert_eq!(v, v_back);
2686
2687        // Write under limit, failure
2688        let v = [true, false, true];
2689        let mut buf = Limited::new(Vec::new(), Limits::len(11));
2690        assert_eq!(v.write_xdr(&mut buf), Err(Error::LengthLimitExceeded));
2691
2692        // Read under limit, failure
2693        let v = [true, false, true];
2694        let mut buf = Limited::new(Vec::new(), Limits::len(12));
2695        v.write_xdr(&mut buf).unwrap();
2696        assert_eq!(buf.limits.len, 0);
2697        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(11));
2698        assert_eq!(
2699            <[bool; 3] as ReadXdr>::read_xdr(&mut lr),
2700            Err(Error::LengthLimitExceeded)
2701        );
2702    }
2703
2704    #[test]
2705    fn length_limited_read_write_vec() {
2706        // Exact limit, success
2707        let v = VecM::<i32, 3>::try_from([1i32, 2, 3]).unwrap();
2708        let mut buf = Limited::new(Vec::new(), Limits::len(16));
2709        v.write_xdr(&mut buf).unwrap();
2710        assert_eq!(buf.limits.len, 0);
2711        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(16));
2712        let v_back: VecM<i32, 3> = ReadXdr::read_xdr(&mut lr).unwrap();
2713        assert_eq!(buf.limits.len, 0);
2714        assert_eq!(v, v_back);
2715
2716        // Over limit, success
2717        let v = VecM::<i32, 3>::try_from([1i32, 2, 3]).unwrap();
2718        let mut buf = Limited::new(Vec::new(), Limits::len(17));
2719        v.write_xdr(&mut buf).unwrap();
2720        assert_eq!(buf.limits.len, 1);
2721        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(17));
2722        let v_back: VecM<i32, 3> = ReadXdr::read_xdr(&mut lr).unwrap();
2723        assert_eq!(buf.limits.len, 1);
2724        assert_eq!(v, v_back);
2725
2726        // Write under limit, failure
2727        let v = VecM::<i32, 3>::try_from([1i32, 2, 3]).unwrap();
2728        let mut buf = Limited::new(Vec::new(), Limits::len(15));
2729        assert_eq!(v.write_xdr(&mut buf), Err(Error::LengthLimitExceeded));
2730
2731        // Read under limit, failure
2732        let v = VecM::<i32, 3>::try_from([1i32, 2, 3]).unwrap();
2733        let mut buf = Limited::new(Vec::new(), Limits::len(16));
2734        v.write_xdr(&mut buf).unwrap();
2735        assert_eq!(buf.limits.len, 0);
2736        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(15));
2737        assert_eq!(
2738            <VecM<i32, 3> as ReadXdr>::read_xdr(&mut lr),
2739            Err(Error::LengthLimitExceeded)
2740        );
2741    }
2742
2743    #[test]
2744    fn length_limited_read_write_bytes() {
2745        // Exact limit, success
2746        let v = BytesM::<3>::try_from([1u8, 2, 3]).unwrap();
2747        let mut buf = Limited::new(Vec::new(), Limits::len(8));
2748        v.write_xdr(&mut buf).unwrap();
2749        assert_eq!(buf.limits.len, 0);
2750        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(8));
2751        let v_back: BytesM<3> = ReadXdr::read_xdr(&mut lr).unwrap();
2752        assert_eq!(buf.limits.len, 0);
2753        assert_eq!(v, v_back);
2754
2755        // Over limit, success
2756        let v = BytesM::<3>::try_from([1u8, 2, 3]).unwrap();
2757        let mut buf = Limited::new(Vec::new(), Limits::len(9));
2758        v.write_xdr(&mut buf).unwrap();
2759        assert_eq!(buf.limits.len, 1);
2760        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(9));
2761        let v_back: BytesM<3> = ReadXdr::read_xdr(&mut lr).unwrap();
2762        assert_eq!(buf.limits.len, 1);
2763        assert_eq!(v, v_back);
2764
2765        // Write under limit, failure
2766        let v = BytesM::<3>::try_from([1u8, 2, 3]).unwrap();
2767        let mut buf = Limited::new(Vec::new(), Limits::len(7));
2768        assert_eq!(v.write_xdr(&mut buf), Err(Error::LengthLimitExceeded));
2769
2770        // Read under limit, failure
2771        let v = BytesM::<3>::try_from([1u8, 2, 3]).unwrap();
2772        let mut buf = Limited::new(Vec::new(), Limits::len(8));
2773        v.write_xdr(&mut buf).unwrap();
2774        assert_eq!(buf.limits.len, 0);
2775        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(7));
2776        assert_eq!(
2777            <BytesM<3> as ReadXdr>::read_xdr(&mut lr),
2778            Err(Error::LengthLimitExceeded)
2779        );
2780    }
2781
2782    #[test]
2783    fn length_limited_read_write_string() {
2784        // Exact limit, success
2785        let v = StringM::<3>::try_from("123").unwrap();
2786        let mut buf = Limited::new(Vec::new(), Limits::len(8));
2787        v.write_xdr(&mut buf).unwrap();
2788        assert_eq!(buf.limits.len, 0);
2789        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(8));
2790        let v_back: StringM<3> = ReadXdr::read_xdr(&mut lr).unwrap();
2791        assert_eq!(buf.limits.len, 0);
2792        assert_eq!(v, v_back);
2793
2794        // Over limit, success
2795        let v = StringM::<3>::try_from("123").unwrap();
2796        let mut buf = Limited::new(Vec::new(), Limits::len(9));
2797        v.write_xdr(&mut buf).unwrap();
2798        assert_eq!(buf.limits.len, 1);
2799        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(9));
2800        let v_back: StringM<3> = ReadXdr::read_xdr(&mut lr).unwrap();
2801        assert_eq!(buf.limits.len, 1);
2802        assert_eq!(v, v_back);
2803
2804        // Write under limit, failure
2805        let v = StringM::<3>::try_from("123").unwrap();
2806        let mut buf = Limited::new(Vec::new(), Limits::len(7));
2807        assert_eq!(v.write_xdr(&mut buf), Err(Error::LengthLimitExceeded));
2808
2809        // Read under limit, failure
2810        let v = StringM::<3>::try_from("123").unwrap();
2811        let mut buf = Limited::new(Vec::new(), Limits::len(8));
2812        v.write_xdr(&mut buf).unwrap();
2813        assert_eq!(buf.limits.len, 0);
2814        let mut lr = Limited::new(Cursor::new(buf.inner.as_slice()), Limits::len(7));
2815        assert_eq!(
2816            <StringM<3> as ReadXdr>::read_xdr(&mut lr),
2817            Err(Error::LengthLimitExceeded)
2818        );
2819    }
2820}
2821
2822#[cfg(all(test, not(feature = "alloc")))]
2823mod test {
2824    use super::VecM;
2825
2826    #[test]
2827    fn to_option_none() {
2828        let v: VecM<u32, 1> = (&[]).try_into().unwrap();
2829        assert_eq!(v.to_option(), None);
2830    }
2831
2832    #[test]
2833    fn to_option_some() {
2834        let v: VecM<_, 1> = (&[1]).try_into().unwrap();
2835        assert_eq!(v.to_option(), Some(1));
2836    }
2837}
2838
2839/// Value is an XDR Typedef defines as:
2840///
2841/// ```text
2842/// typedef opaque Value<>;
2843/// ```
2844///
2845#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
2846#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
2847#[derive(Default)]
2848#[cfg_attr(
2849    all(feature = "serde", feature = "alloc"),
2850    derive(serde::Serialize, serde::Deserialize),
2851    serde(rename_all = "snake_case")
2852)]
2853#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
2854#[derive(Debug)]
2855pub struct Value(pub BytesM);
2856
2857impl From<Value> for BytesM {
2858    #[must_use]
2859    fn from(x: Value) -> Self {
2860        x.0
2861    }
2862}
2863
2864impl From<BytesM> for Value {
2865    #[must_use]
2866    fn from(x: BytesM) -> Self {
2867        Value(x)
2868    }
2869}
2870
2871impl AsRef<BytesM> for Value {
2872    #[must_use]
2873    fn as_ref(&self) -> &BytesM {
2874        &self.0
2875    }
2876}
2877
2878impl ReadXdr for Value {
2879    #[cfg(feature = "std")]
2880    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
2881        r.with_limited_depth(|r| {
2882            let i = BytesM::read_xdr(r)?;
2883            let v = Value(i);
2884            Ok(v)
2885        })
2886    }
2887}
2888
2889impl WriteXdr for Value {
2890    #[cfg(feature = "std")]
2891    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
2892        w.with_limited_depth(|w| self.0.write_xdr(w))
2893    }
2894}
2895
2896impl Deref for Value {
2897    type Target = BytesM;
2898    fn deref(&self) -> &Self::Target {
2899        &self.0
2900    }
2901}
2902
2903impl From<Value> for Vec<u8> {
2904    #[must_use]
2905    fn from(x: Value) -> Self {
2906        x.0 .0
2907    }
2908}
2909
2910impl TryFrom<Vec<u8>> for Value {
2911    type Error = Error;
2912    fn try_from(x: Vec<u8>) -> Result<Self> {
2913        Ok(Value(x.try_into()?))
2914    }
2915}
2916
2917#[cfg(feature = "alloc")]
2918impl TryFrom<&Vec<u8>> for Value {
2919    type Error = Error;
2920    fn try_from(x: &Vec<u8>) -> Result<Self> {
2921        Ok(Value(x.try_into()?))
2922    }
2923}
2924
2925impl AsRef<Vec<u8>> for Value {
2926    #[must_use]
2927    fn as_ref(&self) -> &Vec<u8> {
2928        &self.0 .0
2929    }
2930}
2931
2932impl AsRef<[u8]> for Value {
2933    #[cfg(feature = "alloc")]
2934    #[must_use]
2935    fn as_ref(&self) -> &[u8] {
2936        &self.0 .0
2937    }
2938    #[cfg(not(feature = "alloc"))]
2939    #[must_use]
2940    fn as_ref(&self) -> &[u8] {
2941        self.0 .0
2942    }
2943}
2944
2945/// ScpBallot is an XDR Struct defines as:
2946///
2947/// ```text
2948/// struct SCPBallot
2949/// {
2950///     uint32 counter; // n
2951///     Value value;    // x
2952/// };
2953/// ```
2954///
2955#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
2956#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
2957#[cfg_attr(
2958    all(feature = "serde", feature = "alloc"),
2959    derive(serde::Serialize, serde::Deserialize),
2960    serde(rename_all = "snake_case")
2961)]
2962#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
2963pub struct ScpBallot {
2964    pub counter: u32,
2965    pub value: Value,
2966}
2967
2968impl ReadXdr for ScpBallot {
2969    #[cfg(feature = "std")]
2970    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
2971        r.with_limited_depth(|r| {
2972            Ok(Self {
2973                counter: u32::read_xdr(r)?,
2974                value: Value::read_xdr(r)?,
2975            })
2976        })
2977    }
2978}
2979
2980impl WriteXdr for ScpBallot {
2981    #[cfg(feature = "std")]
2982    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
2983        w.with_limited_depth(|w| {
2984            self.counter.write_xdr(w)?;
2985            self.value.write_xdr(w)?;
2986            Ok(())
2987        })
2988    }
2989}
2990
2991/// ScpStatementType is an XDR Enum defines as:
2992///
2993/// ```text
2994/// enum SCPStatementType
2995/// {
2996///     SCP_ST_PREPARE = 0,
2997///     SCP_ST_CONFIRM = 1,
2998///     SCP_ST_EXTERNALIZE = 2,
2999///     SCP_ST_NOMINATE = 3
3000/// };
3001/// ```
3002///
3003// enum
3004#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
3005#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
3006#[cfg_attr(
3007    all(feature = "serde", feature = "alloc"),
3008    derive(serde::Serialize, serde::Deserialize),
3009    serde(rename_all = "snake_case")
3010)]
3011#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
3012#[repr(i32)]
3013pub enum ScpStatementType {
3014    Prepare = 0,
3015    Confirm = 1,
3016    Externalize = 2,
3017    Nominate = 3,
3018}
3019
3020impl ScpStatementType {
3021    pub const VARIANTS: [ScpStatementType; 4] = [
3022        ScpStatementType::Prepare,
3023        ScpStatementType::Confirm,
3024        ScpStatementType::Externalize,
3025        ScpStatementType::Nominate,
3026    ];
3027    pub const VARIANTS_STR: [&'static str; 4] = ["Prepare", "Confirm", "Externalize", "Nominate"];
3028
3029    #[must_use]
3030    pub const fn name(&self) -> &'static str {
3031        match self {
3032            Self::Prepare => "Prepare",
3033            Self::Confirm => "Confirm",
3034            Self::Externalize => "Externalize",
3035            Self::Nominate => "Nominate",
3036        }
3037    }
3038
3039    #[must_use]
3040    pub const fn variants() -> [ScpStatementType; 4] {
3041        Self::VARIANTS
3042    }
3043}
3044
3045impl Name for ScpStatementType {
3046    #[must_use]
3047    fn name(&self) -> &'static str {
3048        Self::name(self)
3049    }
3050}
3051
3052impl Variants<ScpStatementType> for ScpStatementType {
3053    fn variants() -> slice::Iter<'static, ScpStatementType> {
3054        Self::VARIANTS.iter()
3055    }
3056}
3057
3058impl Enum for ScpStatementType {}
3059
3060impl fmt::Display for ScpStatementType {
3061    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3062        f.write_str(self.name())
3063    }
3064}
3065
3066impl TryFrom<i32> for ScpStatementType {
3067    type Error = Error;
3068
3069    fn try_from(i: i32) -> Result<Self> {
3070        let e = match i {
3071            0 => ScpStatementType::Prepare,
3072            1 => ScpStatementType::Confirm,
3073            2 => ScpStatementType::Externalize,
3074            3 => ScpStatementType::Nominate,
3075            #[allow(unreachable_patterns)]
3076            _ => return Err(Error::Invalid),
3077        };
3078        Ok(e)
3079    }
3080}
3081
3082impl From<ScpStatementType> for i32 {
3083    #[must_use]
3084    fn from(e: ScpStatementType) -> Self {
3085        e as Self
3086    }
3087}
3088
3089impl ReadXdr for ScpStatementType {
3090    #[cfg(feature = "std")]
3091    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
3092        r.with_limited_depth(|r| {
3093            let e = i32::read_xdr(r)?;
3094            let v: Self = e.try_into()?;
3095            Ok(v)
3096        })
3097    }
3098}
3099
3100impl WriteXdr for ScpStatementType {
3101    #[cfg(feature = "std")]
3102    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
3103        w.with_limited_depth(|w| {
3104            let i: i32 = (*self).into();
3105            i.write_xdr(w)
3106        })
3107    }
3108}
3109
3110/// ScpNomination is an XDR Struct defines as:
3111///
3112/// ```text
3113/// struct SCPNomination
3114/// {
3115///     Hash quorumSetHash; // D
3116///     Value votes<>;      // X
3117///     Value accepted<>;   // Y
3118/// };
3119/// ```
3120///
3121#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
3122#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
3123#[cfg_attr(
3124    all(feature = "serde", feature = "alloc"),
3125    derive(serde::Serialize, serde::Deserialize),
3126    serde(rename_all = "snake_case")
3127)]
3128#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
3129pub struct ScpNomination {
3130    pub quorum_set_hash: Hash,
3131    pub votes: VecM<Value>,
3132    pub accepted: VecM<Value>,
3133}
3134
3135impl ReadXdr for ScpNomination {
3136    #[cfg(feature = "std")]
3137    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
3138        r.with_limited_depth(|r| {
3139            Ok(Self {
3140                quorum_set_hash: Hash::read_xdr(r)?,
3141                votes: VecM::<Value>::read_xdr(r)?,
3142                accepted: VecM::<Value>::read_xdr(r)?,
3143            })
3144        })
3145    }
3146}
3147
3148impl WriteXdr for ScpNomination {
3149    #[cfg(feature = "std")]
3150    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
3151        w.with_limited_depth(|w| {
3152            self.quorum_set_hash.write_xdr(w)?;
3153            self.votes.write_xdr(w)?;
3154            self.accepted.write_xdr(w)?;
3155            Ok(())
3156        })
3157    }
3158}
3159
3160/// ScpStatementPrepare is an XDR NestedStruct defines as:
3161///
3162/// ```text
3163/// struct
3164///         {
3165///             Hash quorumSetHash;       // D
3166///             SCPBallot ballot;         // b
3167///             SCPBallot* prepared;      // p
3168///             SCPBallot* preparedPrime; // p'
3169///             uint32 nC;                // c.n
3170///             uint32 nH;                // h.n
3171///         }
3172/// ```
3173///
3174#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
3175#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
3176#[cfg_attr(
3177    all(feature = "serde", feature = "alloc"),
3178    derive(serde::Serialize, serde::Deserialize),
3179    serde(rename_all = "snake_case")
3180)]
3181#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
3182pub struct ScpStatementPrepare {
3183    pub quorum_set_hash: Hash,
3184    pub ballot: ScpBallot,
3185    pub prepared: Option<ScpBallot>,
3186    pub prepared_prime: Option<ScpBallot>,
3187    pub n_c: u32,
3188    pub n_h: u32,
3189}
3190
3191impl ReadXdr for ScpStatementPrepare {
3192    #[cfg(feature = "std")]
3193    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
3194        r.with_limited_depth(|r| {
3195            Ok(Self {
3196                quorum_set_hash: Hash::read_xdr(r)?,
3197                ballot: ScpBallot::read_xdr(r)?,
3198                prepared: Option::<ScpBallot>::read_xdr(r)?,
3199                prepared_prime: Option::<ScpBallot>::read_xdr(r)?,
3200                n_c: u32::read_xdr(r)?,
3201                n_h: u32::read_xdr(r)?,
3202            })
3203        })
3204    }
3205}
3206
3207impl WriteXdr for ScpStatementPrepare {
3208    #[cfg(feature = "std")]
3209    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
3210        w.with_limited_depth(|w| {
3211            self.quorum_set_hash.write_xdr(w)?;
3212            self.ballot.write_xdr(w)?;
3213            self.prepared.write_xdr(w)?;
3214            self.prepared_prime.write_xdr(w)?;
3215            self.n_c.write_xdr(w)?;
3216            self.n_h.write_xdr(w)?;
3217            Ok(())
3218        })
3219    }
3220}
3221
3222/// ScpStatementConfirm is an XDR NestedStruct defines as:
3223///
3224/// ```text
3225/// struct
3226///         {
3227///             SCPBallot ballot;   // b
3228///             uint32 nPrepared;   // p.n
3229///             uint32 nCommit;     // c.n
3230///             uint32 nH;          // h.n
3231///             Hash quorumSetHash; // D
3232///         }
3233/// ```
3234///
3235#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
3236#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
3237#[cfg_attr(
3238    all(feature = "serde", feature = "alloc"),
3239    derive(serde::Serialize, serde::Deserialize),
3240    serde(rename_all = "snake_case")
3241)]
3242#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
3243pub struct ScpStatementConfirm {
3244    pub ballot: ScpBallot,
3245    pub n_prepared: u32,
3246    pub n_commit: u32,
3247    pub n_h: u32,
3248    pub quorum_set_hash: Hash,
3249}
3250
3251impl ReadXdr for ScpStatementConfirm {
3252    #[cfg(feature = "std")]
3253    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
3254        r.with_limited_depth(|r| {
3255            Ok(Self {
3256                ballot: ScpBallot::read_xdr(r)?,
3257                n_prepared: u32::read_xdr(r)?,
3258                n_commit: u32::read_xdr(r)?,
3259                n_h: u32::read_xdr(r)?,
3260                quorum_set_hash: Hash::read_xdr(r)?,
3261            })
3262        })
3263    }
3264}
3265
3266impl WriteXdr for ScpStatementConfirm {
3267    #[cfg(feature = "std")]
3268    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
3269        w.with_limited_depth(|w| {
3270            self.ballot.write_xdr(w)?;
3271            self.n_prepared.write_xdr(w)?;
3272            self.n_commit.write_xdr(w)?;
3273            self.n_h.write_xdr(w)?;
3274            self.quorum_set_hash.write_xdr(w)?;
3275            Ok(())
3276        })
3277    }
3278}
3279
3280/// ScpStatementExternalize is an XDR NestedStruct defines as:
3281///
3282/// ```text
3283/// struct
3284///         {
3285///             SCPBallot commit;         // c
3286///             uint32 nH;                // h.n
3287///             Hash commitQuorumSetHash; // D used before EXTERNALIZE
3288///         }
3289/// ```
3290///
3291#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
3292#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
3293#[cfg_attr(
3294    all(feature = "serde", feature = "alloc"),
3295    derive(serde::Serialize, serde::Deserialize),
3296    serde(rename_all = "snake_case")
3297)]
3298#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
3299pub struct ScpStatementExternalize {
3300    pub commit: ScpBallot,
3301    pub n_h: u32,
3302    pub commit_quorum_set_hash: Hash,
3303}
3304
3305impl ReadXdr for ScpStatementExternalize {
3306    #[cfg(feature = "std")]
3307    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
3308        r.with_limited_depth(|r| {
3309            Ok(Self {
3310                commit: ScpBallot::read_xdr(r)?,
3311                n_h: u32::read_xdr(r)?,
3312                commit_quorum_set_hash: Hash::read_xdr(r)?,
3313            })
3314        })
3315    }
3316}
3317
3318impl WriteXdr for ScpStatementExternalize {
3319    #[cfg(feature = "std")]
3320    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
3321        w.with_limited_depth(|w| {
3322            self.commit.write_xdr(w)?;
3323            self.n_h.write_xdr(w)?;
3324            self.commit_quorum_set_hash.write_xdr(w)?;
3325            Ok(())
3326        })
3327    }
3328}
3329
3330/// ScpStatementPledges is an XDR NestedUnion defines as:
3331///
3332/// ```text
3333/// union switch (SCPStatementType type)
3334///     {
3335///     case SCP_ST_PREPARE:
3336///         struct
3337///         {
3338///             Hash quorumSetHash;       // D
3339///             SCPBallot ballot;         // b
3340///             SCPBallot* prepared;      // p
3341///             SCPBallot* preparedPrime; // p'
3342///             uint32 nC;                // c.n
3343///             uint32 nH;                // h.n
3344///         } prepare;
3345///     case SCP_ST_CONFIRM:
3346///         struct
3347///         {
3348///             SCPBallot ballot;   // b
3349///             uint32 nPrepared;   // p.n
3350///             uint32 nCommit;     // c.n
3351///             uint32 nH;          // h.n
3352///             Hash quorumSetHash; // D
3353///         } confirm;
3354///     case SCP_ST_EXTERNALIZE:
3355///         struct
3356///         {
3357///             SCPBallot commit;         // c
3358///             uint32 nH;                // h.n
3359///             Hash commitQuorumSetHash; // D used before EXTERNALIZE
3360///         } externalize;
3361///     case SCP_ST_NOMINATE:
3362///         SCPNomination nominate;
3363///     }
3364/// ```
3365///
3366// union with discriminant ScpStatementType
3367#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
3368#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
3369#[cfg_attr(
3370    all(feature = "serde", feature = "alloc"),
3371    derive(serde::Serialize, serde::Deserialize),
3372    serde(rename_all = "snake_case")
3373)]
3374#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
3375#[allow(clippy::large_enum_variant)]
3376pub enum ScpStatementPledges {
3377    Prepare(ScpStatementPrepare),
3378    Confirm(ScpStatementConfirm),
3379    Externalize(ScpStatementExternalize),
3380    Nominate(ScpNomination),
3381}
3382
3383impl ScpStatementPledges {
3384    pub const VARIANTS: [ScpStatementType; 4] = [
3385        ScpStatementType::Prepare,
3386        ScpStatementType::Confirm,
3387        ScpStatementType::Externalize,
3388        ScpStatementType::Nominate,
3389    ];
3390    pub const VARIANTS_STR: [&'static str; 4] = ["Prepare", "Confirm", "Externalize", "Nominate"];
3391
3392    #[must_use]
3393    pub const fn name(&self) -> &'static str {
3394        match self {
3395            Self::Prepare(_) => "Prepare",
3396            Self::Confirm(_) => "Confirm",
3397            Self::Externalize(_) => "Externalize",
3398            Self::Nominate(_) => "Nominate",
3399        }
3400    }
3401
3402    #[must_use]
3403    pub const fn discriminant(&self) -> ScpStatementType {
3404        #[allow(clippy::match_same_arms)]
3405        match self {
3406            Self::Prepare(_) => ScpStatementType::Prepare,
3407            Self::Confirm(_) => ScpStatementType::Confirm,
3408            Self::Externalize(_) => ScpStatementType::Externalize,
3409            Self::Nominate(_) => ScpStatementType::Nominate,
3410        }
3411    }
3412
3413    #[must_use]
3414    pub const fn variants() -> [ScpStatementType; 4] {
3415        Self::VARIANTS
3416    }
3417}
3418
3419impl Name for ScpStatementPledges {
3420    #[must_use]
3421    fn name(&self) -> &'static str {
3422        Self::name(self)
3423    }
3424}
3425
3426impl Discriminant<ScpStatementType> for ScpStatementPledges {
3427    #[must_use]
3428    fn discriminant(&self) -> ScpStatementType {
3429        Self::discriminant(self)
3430    }
3431}
3432
3433impl Variants<ScpStatementType> for ScpStatementPledges {
3434    fn variants() -> slice::Iter<'static, ScpStatementType> {
3435        Self::VARIANTS.iter()
3436    }
3437}
3438
3439impl Union<ScpStatementType> for ScpStatementPledges {}
3440
3441impl ReadXdr for ScpStatementPledges {
3442    #[cfg(feature = "std")]
3443    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
3444        r.with_limited_depth(|r| {
3445            let dv: ScpStatementType = <ScpStatementType as ReadXdr>::read_xdr(r)?;
3446            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
3447            let v = match dv {
3448                ScpStatementType::Prepare => Self::Prepare(ScpStatementPrepare::read_xdr(r)?),
3449                ScpStatementType::Confirm => Self::Confirm(ScpStatementConfirm::read_xdr(r)?),
3450                ScpStatementType::Externalize => {
3451                    Self::Externalize(ScpStatementExternalize::read_xdr(r)?)
3452                }
3453                ScpStatementType::Nominate => Self::Nominate(ScpNomination::read_xdr(r)?),
3454                #[allow(unreachable_patterns)]
3455                _ => return Err(Error::Invalid),
3456            };
3457            Ok(v)
3458        })
3459    }
3460}
3461
3462impl WriteXdr for ScpStatementPledges {
3463    #[cfg(feature = "std")]
3464    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
3465        w.with_limited_depth(|w| {
3466            self.discriminant().write_xdr(w)?;
3467            #[allow(clippy::match_same_arms)]
3468            match self {
3469                Self::Prepare(v) => v.write_xdr(w)?,
3470                Self::Confirm(v) => v.write_xdr(w)?,
3471                Self::Externalize(v) => v.write_xdr(w)?,
3472                Self::Nominate(v) => v.write_xdr(w)?,
3473            };
3474            Ok(())
3475        })
3476    }
3477}
3478
3479/// ScpStatement is an XDR Struct defines as:
3480///
3481/// ```text
3482/// struct SCPStatement
3483/// {
3484///     NodeID nodeID;    // v
3485///     uint64 slotIndex; // i
3486///
3487///     union switch (SCPStatementType type)
3488///     {
3489///     case SCP_ST_PREPARE:
3490///         struct
3491///         {
3492///             Hash quorumSetHash;       // D
3493///             SCPBallot ballot;         // b
3494///             SCPBallot* prepared;      // p
3495///             SCPBallot* preparedPrime; // p'
3496///             uint32 nC;                // c.n
3497///             uint32 nH;                // h.n
3498///         } prepare;
3499///     case SCP_ST_CONFIRM:
3500///         struct
3501///         {
3502///             SCPBallot ballot;   // b
3503///             uint32 nPrepared;   // p.n
3504///             uint32 nCommit;     // c.n
3505///             uint32 nH;          // h.n
3506///             Hash quorumSetHash; // D
3507///         } confirm;
3508///     case SCP_ST_EXTERNALIZE:
3509///         struct
3510///         {
3511///             SCPBallot commit;         // c
3512///             uint32 nH;                // h.n
3513///             Hash commitQuorumSetHash; // D used before EXTERNALIZE
3514///         } externalize;
3515///     case SCP_ST_NOMINATE:
3516///         SCPNomination nominate;
3517///     }
3518///     pledges;
3519/// };
3520/// ```
3521///
3522#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
3523#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
3524#[cfg_attr(
3525    all(feature = "serde", feature = "alloc"),
3526    derive(serde::Serialize, serde::Deserialize),
3527    serde(rename_all = "snake_case")
3528)]
3529#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
3530pub struct ScpStatement {
3531    pub node_id: NodeId,
3532    pub slot_index: u64,
3533    pub pledges: ScpStatementPledges,
3534}
3535
3536impl ReadXdr for ScpStatement {
3537    #[cfg(feature = "std")]
3538    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
3539        r.with_limited_depth(|r| {
3540            Ok(Self {
3541                node_id: NodeId::read_xdr(r)?,
3542                slot_index: u64::read_xdr(r)?,
3543                pledges: ScpStatementPledges::read_xdr(r)?,
3544            })
3545        })
3546    }
3547}
3548
3549impl WriteXdr for ScpStatement {
3550    #[cfg(feature = "std")]
3551    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
3552        w.with_limited_depth(|w| {
3553            self.node_id.write_xdr(w)?;
3554            self.slot_index.write_xdr(w)?;
3555            self.pledges.write_xdr(w)?;
3556            Ok(())
3557        })
3558    }
3559}
3560
3561/// ScpEnvelope is an XDR Struct defines as:
3562///
3563/// ```text
3564/// struct SCPEnvelope
3565/// {
3566///     SCPStatement statement;
3567///     Signature signature;
3568/// };
3569/// ```
3570///
3571#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
3572#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
3573#[cfg_attr(
3574    all(feature = "serde", feature = "alloc"),
3575    derive(serde::Serialize, serde::Deserialize),
3576    serde(rename_all = "snake_case")
3577)]
3578#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
3579pub struct ScpEnvelope {
3580    pub statement: ScpStatement,
3581    pub signature: Signature,
3582}
3583
3584impl ReadXdr for ScpEnvelope {
3585    #[cfg(feature = "std")]
3586    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
3587        r.with_limited_depth(|r| {
3588            Ok(Self {
3589                statement: ScpStatement::read_xdr(r)?,
3590                signature: Signature::read_xdr(r)?,
3591            })
3592        })
3593    }
3594}
3595
3596impl WriteXdr for ScpEnvelope {
3597    #[cfg(feature = "std")]
3598    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
3599        w.with_limited_depth(|w| {
3600            self.statement.write_xdr(w)?;
3601            self.signature.write_xdr(w)?;
3602            Ok(())
3603        })
3604    }
3605}
3606
3607/// ScpQuorumSet is an XDR Struct defines as:
3608///
3609/// ```text
3610/// struct SCPQuorumSet
3611/// {
3612///     uint32 threshold;
3613///     NodeID validators<>;
3614///     SCPQuorumSet innerSets<>;
3615/// };
3616/// ```
3617///
3618#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
3619#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
3620#[cfg_attr(
3621    all(feature = "serde", feature = "alloc"),
3622    derive(serde::Serialize, serde::Deserialize),
3623    serde(rename_all = "snake_case")
3624)]
3625#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
3626pub struct ScpQuorumSet {
3627    pub threshold: u32,
3628    pub validators: VecM<NodeId>,
3629    pub inner_sets: VecM<ScpQuorumSet>,
3630}
3631
3632impl ReadXdr for ScpQuorumSet {
3633    #[cfg(feature = "std")]
3634    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
3635        r.with_limited_depth(|r| {
3636            Ok(Self {
3637                threshold: u32::read_xdr(r)?,
3638                validators: VecM::<NodeId>::read_xdr(r)?,
3639                inner_sets: VecM::<ScpQuorumSet>::read_xdr(r)?,
3640            })
3641        })
3642    }
3643}
3644
3645impl WriteXdr for ScpQuorumSet {
3646    #[cfg(feature = "std")]
3647    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
3648        w.with_limited_depth(|w| {
3649            self.threshold.write_xdr(w)?;
3650            self.validators.write_xdr(w)?;
3651            self.inner_sets.write_xdr(w)?;
3652            Ok(())
3653        })
3654    }
3655}
3656
3657/// ConfigSettingContractExecutionLanesV0 is an XDR Struct defines as:
3658///
3659/// ```text
3660/// struct ConfigSettingContractExecutionLanesV0
3661/// {
3662///     // maximum number of Soroban transactions per ledger
3663///     uint32 ledgerMaxTxCount;
3664/// };
3665/// ```
3666///
3667#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
3668#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
3669#[cfg_attr(
3670    all(feature = "serde", feature = "alloc"),
3671    derive(serde::Serialize, serde::Deserialize),
3672    serde(rename_all = "snake_case")
3673)]
3674#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
3675pub struct ConfigSettingContractExecutionLanesV0 {
3676    pub ledger_max_tx_count: u32,
3677}
3678
3679impl ReadXdr for ConfigSettingContractExecutionLanesV0 {
3680    #[cfg(feature = "std")]
3681    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
3682        r.with_limited_depth(|r| {
3683            Ok(Self {
3684                ledger_max_tx_count: u32::read_xdr(r)?,
3685            })
3686        })
3687    }
3688}
3689
3690impl WriteXdr for ConfigSettingContractExecutionLanesV0 {
3691    #[cfg(feature = "std")]
3692    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
3693        w.with_limited_depth(|w| {
3694            self.ledger_max_tx_count.write_xdr(w)?;
3695            Ok(())
3696        })
3697    }
3698}
3699
3700/// ConfigSettingContractComputeV0 is an XDR Struct defines as:
3701///
3702/// ```text
3703/// struct ConfigSettingContractComputeV0
3704/// {
3705///     // Maximum instructions per ledger
3706///     int64 ledgerMaxInstructions;
3707///     // Maximum instructions per transaction
3708///     int64 txMaxInstructions;
3709///     // Cost of 10000 instructions
3710///     int64 feeRatePerInstructionsIncrement;
3711///
3712///     // Memory limit per transaction. Unlike instructions, there is no fee
3713///     // for memory, just the limit.
3714///     uint32 txMemoryLimit;
3715/// };
3716/// ```
3717///
3718#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
3719#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
3720#[cfg_attr(
3721    all(feature = "serde", feature = "alloc"),
3722    derive(serde::Serialize, serde::Deserialize),
3723    serde(rename_all = "snake_case")
3724)]
3725#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
3726pub struct ConfigSettingContractComputeV0 {
3727    pub ledger_max_instructions: i64,
3728    pub tx_max_instructions: i64,
3729    pub fee_rate_per_instructions_increment: i64,
3730    pub tx_memory_limit: u32,
3731}
3732
3733impl ReadXdr for ConfigSettingContractComputeV0 {
3734    #[cfg(feature = "std")]
3735    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
3736        r.with_limited_depth(|r| {
3737            Ok(Self {
3738                ledger_max_instructions: i64::read_xdr(r)?,
3739                tx_max_instructions: i64::read_xdr(r)?,
3740                fee_rate_per_instructions_increment: i64::read_xdr(r)?,
3741                tx_memory_limit: u32::read_xdr(r)?,
3742            })
3743        })
3744    }
3745}
3746
3747impl WriteXdr for ConfigSettingContractComputeV0 {
3748    #[cfg(feature = "std")]
3749    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
3750        w.with_limited_depth(|w| {
3751            self.ledger_max_instructions.write_xdr(w)?;
3752            self.tx_max_instructions.write_xdr(w)?;
3753            self.fee_rate_per_instructions_increment.write_xdr(w)?;
3754            self.tx_memory_limit.write_xdr(w)?;
3755            Ok(())
3756        })
3757    }
3758}
3759
3760/// ConfigSettingContractLedgerCostV0 is an XDR Struct defines as:
3761///
3762/// ```text
3763/// struct ConfigSettingContractLedgerCostV0
3764/// {
3765///     // Maximum number of ledger entry read operations per ledger
3766///     uint32 ledgerMaxReadLedgerEntries;
3767///     // Maximum number of bytes that can be read per ledger
3768///     uint32 ledgerMaxReadBytes;
3769///     // Maximum number of ledger entry write operations per ledger
3770///     uint32 ledgerMaxWriteLedgerEntries;
3771///     // Maximum number of bytes that can be written per ledger
3772///     uint32 ledgerMaxWriteBytes;
3773///
3774///     // Maximum number of ledger entry read operations per transaction
3775///     uint32 txMaxReadLedgerEntries;
3776///     // Maximum number of bytes that can be read per transaction
3777///     uint32 txMaxReadBytes;
3778///     // Maximum number of ledger entry write operations per transaction
3779///     uint32 txMaxWriteLedgerEntries;
3780///     // Maximum number of bytes that can be written per transaction
3781///     uint32 txMaxWriteBytes;
3782///
3783///     int64 feeReadLedgerEntry;  // Fee per ledger entry read
3784///     int64 feeWriteLedgerEntry; // Fee per ledger entry write
3785///
3786///     int64 feeRead1KB;  // Fee for reading 1KB
3787///
3788///     // The following parameters determine the write fee per 1KB.
3789///     // Write fee grows linearly until bucket list reaches this size
3790///     int64 bucketListTargetSizeBytes;
3791///     // Fee per 1KB write when the bucket list is empty
3792///     int64 writeFee1KBBucketListLow;
3793///     // Fee per 1KB write when the bucket list has reached `bucketListTargetSizeBytes`
3794///     int64 writeFee1KBBucketListHigh;
3795///     // Write fee multiplier for any additional data past the first `bucketListTargetSizeBytes`
3796///     uint32 bucketListWriteFeeGrowthFactor;
3797/// };
3798/// ```
3799///
3800#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
3801#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
3802#[cfg_attr(
3803    all(feature = "serde", feature = "alloc"),
3804    derive(serde::Serialize, serde::Deserialize),
3805    serde(rename_all = "snake_case")
3806)]
3807#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
3808pub struct ConfigSettingContractLedgerCostV0 {
3809    pub ledger_max_read_ledger_entries: u32,
3810    pub ledger_max_read_bytes: u32,
3811    pub ledger_max_write_ledger_entries: u32,
3812    pub ledger_max_write_bytes: u32,
3813    pub tx_max_read_ledger_entries: u32,
3814    pub tx_max_read_bytes: u32,
3815    pub tx_max_write_ledger_entries: u32,
3816    pub tx_max_write_bytes: u32,
3817    pub fee_read_ledger_entry: i64,
3818    pub fee_write_ledger_entry: i64,
3819    pub fee_read1_kb: i64,
3820    pub bucket_list_target_size_bytes: i64,
3821    pub write_fee1_kb_bucket_list_low: i64,
3822    pub write_fee1_kb_bucket_list_high: i64,
3823    pub bucket_list_write_fee_growth_factor: u32,
3824}
3825
3826impl ReadXdr for ConfigSettingContractLedgerCostV0 {
3827    #[cfg(feature = "std")]
3828    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
3829        r.with_limited_depth(|r| {
3830            Ok(Self {
3831                ledger_max_read_ledger_entries: u32::read_xdr(r)?,
3832                ledger_max_read_bytes: u32::read_xdr(r)?,
3833                ledger_max_write_ledger_entries: u32::read_xdr(r)?,
3834                ledger_max_write_bytes: u32::read_xdr(r)?,
3835                tx_max_read_ledger_entries: u32::read_xdr(r)?,
3836                tx_max_read_bytes: u32::read_xdr(r)?,
3837                tx_max_write_ledger_entries: u32::read_xdr(r)?,
3838                tx_max_write_bytes: u32::read_xdr(r)?,
3839                fee_read_ledger_entry: i64::read_xdr(r)?,
3840                fee_write_ledger_entry: i64::read_xdr(r)?,
3841                fee_read1_kb: i64::read_xdr(r)?,
3842                bucket_list_target_size_bytes: i64::read_xdr(r)?,
3843                write_fee1_kb_bucket_list_low: i64::read_xdr(r)?,
3844                write_fee1_kb_bucket_list_high: i64::read_xdr(r)?,
3845                bucket_list_write_fee_growth_factor: u32::read_xdr(r)?,
3846            })
3847        })
3848    }
3849}
3850
3851impl WriteXdr for ConfigSettingContractLedgerCostV0 {
3852    #[cfg(feature = "std")]
3853    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
3854        w.with_limited_depth(|w| {
3855            self.ledger_max_read_ledger_entries.write_xdr(w)?;
3856            self.ledger_max_read_bytes.write_xdr(w)?;
3857            self.ledger_max_write_ledger_entries.write_xdr(w)?;
3858            self.ledger_max_write_bytes.write_xdr(w)?;
3859            self.tx_max_read_ledger_entries.write_xdr(w)?;
3860            self.tx_max_read_bytes.write_xdr(w)?;
3861            self.tx_max_write_ledger_entries.write_xdr(w)?;
3862            self.tx_max_write_bytes.write_xdr(w)?;
3863            self.fee_read_ledger_entry.write_xdr(w)?;
3864            self.fee_write_ledger_entry.write_xdr(w)?;
3865            self.fee_read1_kb.write_xdr(w)?;
3866            self.bucket_list_target_size_bytes.write_xdr(w)?;
3867            self.write_fee1_kb_bucket_list_low.write_xdr(w)?;
3868            self.write_fee1_kb_bucket_list_high.write_xdr(w)?;
3869            self.bucket_list_write_fee_growth_factor.write_xdr(w)?;
3870            Ok(())
3871        })
3872    }
3873}
3874
3875/// ConfigSettingContractHistoricalDataV0 is an XDR Struct defines as:
3876///
3877/// ```text
3878/// struct ConfigSettingContractHistoricalDataV0
3879/// {
3880///     int64 feeHistorical1KB; // Fee for storing 1KB in archives
3881/// };
3882/// ```
3883///
3884#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
3885#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
3886#[cfg_attr(
3887    all(feature = "serde", feature = "alloc"),
3888    derive(serde::Serialize, serde::Deserialize),
3889    serde(rename_all = "snake_case")
3890)]
3891#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
3892pub struct ConfigSettingContractHistoricalDataV0 {
3893    pub fee_historical1_kb: i64,
3894}
3895
3896impl ReadXdr for ConfigSettingContractHistoricalDataV0 {
3897    #[cfg(feature = "std")]
3898    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
3899        r.with_limited_depth(|r| {
3900            Ok(Self {
3901                fee_historical1_kb: i64::read_xdr(r)?,
3902            })
3903        })
3904    }
3905}
3906
3907impl WriteXdr for ConfigSettingContractHistoricalDataV0 {
3908    #[cfg(feature = "std")]
3909    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
3910        w.with_limited_depth(|w| {
3911            self.fee_historical1_kb.write_xdr(w)?;
3912            Ok(())
3913        })
3914    }
3915}
3916
3917/// ConfigSettingContractEventsV0 is an XDR Struct defines as:
3918///
3919/// ```text
3920/// struct ConfigSettingContractEventsV0
3921/// {
3922///     // Maximum size of events that a contract call can emit.
3923///     uint32 txMaxContractEventsSizeBytes;
3924///     // Fee for generating 1KB of contract events.
3925///     int64 feeContractEvents1KB;
3926/// };
3927/// ```
3928///
3929#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
3930#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
3931#[cfg_attr(
3932    all(feature = "serde", feature = "alloc"),
3933    derive(serde::Serialize, serde::Deserialize),
3934    serde(rename_all = "snake_case")
3935)]
3936#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
3937pub struct ConfigSettingContractEventsV0 {
3938    pub tx_max_contract_events_size_bytes: u32,
3939    pub fee_contract_events1_kb: i64,
3940}
3941
3942impl ReadXdr for ConfigSettingContractEventsV0 {
3943    #[cfg(feature = "std")]
3944    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
3945        r.with_limited_depth(|r| {
3946            Ok(Self {
3947                tx_max_contract_events_size_bytes: u32::read_xdr(r)?,
3948                fee_contract_events1_kb: i64::read_xdr(r)?,
3949            })
3950        })
3951    }
3952}
3953
3954impl WriteXdr for ConfigSettingContractEventsV0 {
3955    #[cfg(feature = "std")]
3956    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
3957        w.with_limited_depth(|w| {
3958            self.tx_max_contract_events_size_bytes.write_xdr(w)?;
3959            self.fee_contract_events1_kb.write_xdr(w)?;
3960            Ok(())
3961        })
3962    }
3963}
3964
3965/// ConfigSettingContractBandwidthV0 is an XDR Struct defines as:
3966///
3967/// ```text
3968/// struct ConfigSettingContractBandwidthV0
3969/// {
3970///     // Maximum sum of all transaction sizes in the ledger in bytes
3971///     uint32 ledgerMaxTxsSizeBytes;
3972///     // Maximum size in bytes for a transaction
3973///     uint32 txMaxSizeBytes;
3974///
3975///     // Fee for 1 KB of transaction size
3976///     int64 feeTxSize1KB;
3977/// };
3978/// ```
3979///
3980#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
3981#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
3982#[cfg_attr(
3983    all(feature = "serde", feature = "alloc"),
3984    derive(serde::Serialize, serde::Deserialize),
3985    serde(rename_all = "snake_case")
3986)]
3987#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
3988pub struct ConfigSettingContractBandwidthV0 {
3989    pub ledger_max_txs_size_bytes: u32,
3990    pub tx_max_size_bytes: u32,
3991    pub fee_tx_size1_kb: i64,
3992}
3993
3994impl ReadXdr for ConfigSettingContractBandwidthV0 {
3995    #[cfg(feature = "std")]
3996    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
3997        r.with_limited_depth(|r| {
3998            Ok(Self {
3999                ledger_max_txs_size_bytes: u32::read_xdr(r)?,
4000                tx_max_size_bytes: u32::read_xdr(r)?,
4001                fee_tx_size1_kb: i64::read_xdr(r)?,
4002            })
4003        })
4004    }
4005}
4006
4007impl WriteXdr for ConfigSettingContractBandwidthV0 {
4008    #[cfg(feature = "std")]
4009    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
4010        w.with_limited_depth(|w| {
4011            self.ledger_max_txs_size_bytes.write_xdr(w)?;
4012            self.tx_max_size_bytes.write_xdr(w)?;
4013            self.fee_tx_size1_kb.write_xdr(w)?;
4014            Ok(())
4015        })
4016    }
4017}
4018
4019/// ContractCostType is an XDR Enum defines as:
4020///
4021/// ```text
4022/// enum ContractCostType {
4023///     // Cost of running 1 wasm instruction
4024///     WasmInsnExec = 0,
4025///     // Cost of allocating a slice of memory (in bytes)
4026///     MemAlloc = 1,
4027///     // Cost of copying a slice of bytes into a pre-allocated memory
4028///     MemCpy = 2,
4029///     // Cost of comparing two slices of memory
4030///     MemCmp = 3,
4031///     // Cost of a host function dispatch, not including the actual work done by
4032///     // the function nor the cost of VM invocation machinary
4033///     DispatchHostFunction = 4,
4034///     // Cost of visiting a host object from the host object storage. Exists to
4035///     // make sure some baseline cost coverage, i.e. repeatly visiting objects
4036///     // by the guest will always incur some charges.
4037///     VisitObject = 5,
4038///     // Cost of serializing an xdr object to bytes
4039///     ValSer = 6,
4040///     // Cost of deserializing an xdr object from bytes
4041///     ValDeser = 7,
4042///     // Cost of computing the sha256 hash from bytes
4043///     ComputeSha256Hash = 8,
4044///     // Cost of computing the ed25519 pubkey from bytes
4045///     ComputeEd25519PubKey = 9,
4046///     // Cost of verifying ed25519 signature of a payload.
4047///     VerifyEd25519Sig = 10,
4048///     // Cost of instantiation a VM from wasm bytes code.
4049///     VmInstantiation = 11,
4050///     // Cost of instantiation a VM from a cached state.
4051///     VmCachedInstantiation = 12,
4052///     // Cost of invoking a function on the VM. If the function is a host function,
4053///     // additional cost will be covered by `DispatchHostFunction`.
4054///     InvokeVmFunction = 13,
4055///     // Cost of computing a keccak256 hash from bytes.
4056///     ComputeKeccak256Hash = 14,
4057///     // Cost of decoding an ECDSA signature computed from a 256-bit prime modulus
4058///     // curve (e.g. secp256k1 and secp256r1)
4059///     DecodeEcdsaCurve256Sig = 15,
4060///     // Cost of recovering an ECDSA secp256k1 key from a signature.
4061///     RecoverEcdsaSecp256k1Key = 16,
4062///     // Cost of int256 addition (`+`) and subtraction (`-`) operations
4063///     Int256AddSub = 17,
4064///     // Cost of int256 multiplication (`*`) operation
4065///     Int256Mul = 18,
4066///     // Cost of int256 division (`/`) operation
4067///     Int256Div = 19,
4068///     // Cost of int256 power (`exp`) operation
4069///     Int256Pow = 20,
4070///     // Cost of int256 shift (`shl`, `shr`) operation
4071///     Int256Shift = 21,
4072///     // Cost of drawing random bytes using a ChaCha20 PRNG
4073///     ChaCha20DrawBytes = 22,
4074///
4075///     // Cost of parsing wasm bytes that only encode instructions.
4076///     ParseWasmInstructions = 23,
4077///     // Cost of parsing a known number of wasm functions.
4078///     ParseWasmFunctions = 24,
4079///     // Cost of parsing a known number of wasm globals.
4080///     ParseWasmGlobals = 25,
4081///     // Cost of parsing a known number of wasm table entries.
4082///     ParseWasmTableEntries = 26,
4083///     // Cost of parsing a known number of wasm types.
4084///     ParseWasmTypes = 27,
4085///     // Cost of parsing a known number of wasm data segments.
4086///     ParseWasmDataSegments = 28,
4087///     // Cost of parsing a known number of wasm element segments.
4088///     ParseWasmElemSegments = 29,
4089///     // Cost of parsing a known number of wasm imports.
4090///     ParseWasmImports = 30,
4091///     // Cost of parsing a known number of wasm exports.
4092///     ParseWasmExports = 31,
4093///     // Cost of parsing a known number of data segment bytes.
4094///     ParseWasmDataSegmentBytes = 32,
4095///
4096///     // Cost of instantiating wasm bytes that only encode instructions.
4097///     InstantiateWasmInstructions = 33,
4098///     // Cost of instantiating a known number of wasm functions.
4099///     InstantiateWasmFunctions = 34,
4100///     // Cost of instantiating a known number of wasm globals.
4101///     InstantiateWasmGlobals = 35,
4102///     // Cost of instantiating a known number of wasm table entries.
4103///     InstantiateWasmTableEntries = 36,
4104///     // Cost of instantiating a known number of wasm types.
4105///     InstantiateWasmTypes = 37,
4106///     // Cost of instantiating a known number of wasm data segments.
4107///     InstantiateWasmDataSegments = 38,
4108///     // Cost of instantiating a known number of wasm element segments.
4109///     InstantiateWasmElemSegments = 39,
4110///     // Cost of instantiating a known number of wasm imports.
4111///     InstantiateWasmImports = 40,
4112///     // Cost of instantiating a known number of wasm exports.
4113///     InstantiateWasmExports = 41,
4114///     // Cost of instantiating a known number of data segment bytes.
4115///     InstantiateWasmDataSegmentBytes = 42,
4116///
4117///     // Cost of decoding a bytes array representing an uncompressed SEC-1 encoded
4118///     // point on a 256-bit elliptic curve
4119///     Sec1DecodePointUncompressed = 43,
4120///     // Cost of verifying an ECDSA Secp256r1 signature
4121///     VerifyEcdsaSecp256r1Sig = 44,
4122///
4123///     // Cost of encoding a BLS12-381 Fp (base field element)
4124///     Bls12381EncodeFp = 45,
4125///     // Cost of decoding a BLS12-381 Fp (base field element)
4126///     Bls12381DecodeFp = 46,
4127///     // Cost of checking a G1 point lies on the curve
4128///     Bls12381G1CheckPointOnCurve = 47,
4129///     // Cost of checking a G1 point belongs to the correct subgroup
4130///     Bls12381G1CheckPointInSubgroup = 48,
4131///     // Cost of checking a G2 point lies on the curve
4132///     Bls12381G2CheckPointOnCurve = 49,
4133///     // Cost of checking a G2 point belongs to the correct subgroup
4134///     Bls12381G2CheckPointInSubgroup = 50,
4135///     // Cost of converting a BLS12-381 G1 point from projective to affine coordinates
4136///     Bls12381G1ProjectiveToAffine = 51,
4137///     // Cost of converting a BLS12-381 G2 point from projective to affine coordinates
4138///     Bls12381G2ProjectiveToAffine = 52,
4139///     // Cost of performing BLS12-381 G1 point addition
4140///     Bls12381G1Add = 53,
4141///     // Cost of performing BLS12-381 G1 scalar multiplication
4142///     Bls12381G1Mul = 54,
4143///     // Cost of performing BLS12-381 G1 multi-scalar multiplication (MSM)
4144///     Bls12381G1Msm = 55,
4145///     // Cost of mapping a BLS12-381 Fp field element to a G1 point
4146///     Bls12381MapFpToG1 = 56,
4147///     // Cost of hashing to a BLS12-381 G1 point
4148///     Bls12381HashToG1 = 57,
4149///     // Cost of performing BLS12-381 G2 point addition
4150///     Bls12381G2Add = 58,
4151///     // Cost of performing BLS12-381 G2 scalar multiplication
4152///     Bls12381G2Mul = 59,
4153///     // Cost of performing BLS12-381 G2 multi-scalar multiplication (MSM)
4154///     Bls12381G2Msm = 60,
4155///     // Cost of mapping a BLS12-381 Fp2 field element to a G2 point
4156///     Bls12381MapFp2ToG2 = 61,
4157///     // Cost of hashing to a BLS12-381 G2 point
4158///     Bls12381HashToG2 = 62,
4159///     // Cost of performing BLS12-381 pairing operation
4160///     Bls12381Pairing = 63,
4161///     // Cost of converting a BLS12-381 scalar element from U256
4162///     Bls12381FrFromU256 = 64,
4163///     // Cost of converting a BLS12-381 scalar element to U256
4164///     Bls12381FrToU256 = 65,
4165///     // Cost of performing BLS12-381 scalar element addition/subtraction
4166///     Bls12381FrAddSub = 66,
4167///     // Cost of performing BLS12-381 scalar element multiplication
4168///     Bls12381FrMul = 67,
4169///     // Cost of performing BLS12-381 scalar element exponentiation
4170///     Bls12381FrPow = 68,
4171///     // Cost of performing BLS12-381 scalar element inversion
4172///     Bls12381FrInv = 69
4173/// };
4174/// ```
4175///
4176// enum
4177#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
4178#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
4179#[cfg_attr(
4180    all(feature = "serde", feature = "alloc"),
4181    derive(serde::Serialize, serde::Deserialize),
4182    serde(rename_all = "snake_case")
4183)]
4184#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
4185#[repr(i32)]
4186pub enum ContractCostType {
4187    WasmInsnExec = 0,
4188    MemAlloc = 1,
4189    MemCpy = 2,
4190    MemCmp = 3,
4191    DispatchHostFunction = 4,
4192    VisitObject = 5,
4193    ValSer = 6,
4194    ValDeser = 7,
4195    ComputeSha256Hash = 8,
4196    ComputeEd25519PubKey = 9,
4197    VerifyEd25519Sig = 10,
4198    VmInstantiation = 11,
4199    VmCachedInstantiation = 12,
4200    InvokeVmFunction = 13,
4201    ComputeKeccak256Hash = 14,
4202    DecodeEcdsaCurve256Sig = 15,
4203    RecoverEcdsaSecp256k1Key = 16,
4204    Int256AddSub = 17,
4205    Int256Mul = 18,
4206    Int256Div = 19,
4207    Int256Pow = 20,
4208    Int256Shift = 21,
4209    ChaCha20DrawBytes = 22,
4210    ParseWasmInstructions = 23,
4211    ParseWasmFunctions = 24,
4212    ParseWasmGlobals = 25,
4213    ParseWasmTableEntries = 26,
4214    ParseWasmTypes = 27,
4215    ParseWasmDataSegments = 28,
4216    ParseWasmElemSegments = 29,
4217    ParseWasmImports = 30,
4218    ParseWasmExports = 31,
4219    ParseWasmDataSegmentBytes = 32,
4220    InstantiateWasmInstructions = 33,
4221    InstantiateWasmFunctions = 34,
4222    InstantiateWasmGlobals = 35,
4223    InstantiateWasmTableEntries = 36,
4224    InstantiateWasmTypes = 37,
4225    InstantiateWasmDataSegments = 38,
4226    InstantiateWasmElemSegments = 39,
4227    InstantiateWasmImports = 40,
4228    InstantiateWasmExports = 41,
4229    InstantiateWasmDataSegmentBytes = 42,
4230    Sec1DecodePointUncompressed = 43,
4231    VerifyEcdsaSecp256r1Sig = 44,
4232    Bls12381EncodeFp = 45,
4233    Bls12381DecodeFp = 46,
4234    Bls12381G1CheckPointOnCurve = 47,
4235    Bls12381G1CheckPointInSubgroup = 48,
4236    Bls12381G2CheckPointOnCurve = 49,
4237    Bls12381G2CheckPointInSubgroup = 50,
4238    Bls12381G1ProjectiveToAffine = 51,
4239    Bls12381G2ProjectiveToAffine = 52,
4240    Bls12381G1Add = 53,
4241    Bls12381G1Mul = 54,
4242    Bls12381G1Msm = 55,
4243    Bls12381MapFpToG1 = 56,
4244    Bls12381HashToG1 = 57,
4245    Bls12381G2Add = 58,
4246    Bls12381G2Mul = 59,
4247    Bls12381G2Msm = 60,
4248    Bls12381MapFp2ToG2 = 61,
4249    Bls12381HashToG2 = 62,
4250    Bls12381Pairing = 63,
4251    Bls12381FrFromU256 = 64,
4252    Bls12381FrToU256 = 65,
4253    Bls12381FrAddSub = 66,
4254    Bls12381FrMul = 67,
4255    Bls12381FrPow = 68,
4256    Bls12381FrInv = 69,
4257}
4258
4259impl ContractCostType {
4260    pub const VARIANTS: [ContractCostType; 70] = [
4261        ContractCostType::WasmInsnExec,
4262        ContractCostType::MemAlloc,
4263        ContractCostType::MemCpy,
4264        ContractCostType::MemCmp,
4265        ContractCostType::DispatchHostFunction,
4266        ContractCostType::VisitObject,
4267        ContractCostType::ValSer,
4268        ContractCostType::ValDeser,
4269        ContractCostType::ComputeSha256Hash,
4270        ContractCostType::ComputeEd25519PubKey,
4271        ContractCostType::VerifyEd25519Sig,
4272        ContractCostType::VmInstantiation,
4273        ContractCostType::VmCachedInstantiation,
4274        ContractCostType::InvokeVmFunction,
4275        ContractCostType::ComputeKeccak256Hash,
4276        ContractCostType::DecodeEcdsaCurve256Sig,
4277        ContractCostType::RecoverEcdsaSecp256k1Key,
4278        ContractCostType::Int256AddSub,
4279        ContractCostType::Int256Mul,
4280        ContractCostType::Int256Div,
4281        ContractCostType::Int256Pow,
4282        ContractCostType::Int256Shift,
4283        ContractCostType::ChaCha20DrawBytes,
4284        ContractCostType::ParseWasmInstructions,
4285        ContractCostType::ParseWasmFunctions,
4286        ContractCostType::ParseWasmGlobals,
4287        ContractCostType::ParseWasmTableEntries,
4288        ContractCostType::ParseWasmTypes,
4289        ContractCostType::ParseWasmDataSegments,
4290        ContractCostType::ParseWasmElemSegments,
4291        ContractCostType::ParseWasmImports,
4292        ContractCostType::ParseWasmExports,
4293        ContractCostType::ParseWasmDataSegmentBytes,
4294        ContractCostType::InstantiateWasmInstructions,
4295        ContractCostType::InstantiateWasmFunctions,
4296        ContractCostType::InstantiateWasmGlobals,
4297        ContractCostType::InstantiateWasmTableEntries,
4298        ContractCostType::InstantiateWasmTypes,
4299        ContractCostType::InstantiateWasmDataSegments,
4300        ContractCostType::InstantiateWasmElemSegments,
4301        ContractCostType::InstantiateWasmImports,
4302        ContractCostType::InstantiateWasmExports,
4303        ContractCostType::InstantiateWasmDataSegmentBytes,
4304        ContractCostType::Sec1DecodePointUncompressed,
4305        ContractCostType::VerifyEcdsaSecp256r1Sig,
4306        ContractCostType::Bls12381EncodeFp,
4307        ContractCostType::Bls12381DecodeFp,
4308        ContractCostType::Bls12381G1CheckPointOnCurve,
4309        ContractCostType::Bls12381G1CheckPointInSubgroup,
4310        ContractCostType::Bls12381G2CheckPointOnCurve,
4311        ContractCostType::Bls12381G2CheckPointInSubgroup,
4312        ContractCostType::Bls12381G1ProjectiveToAffine,
4313        ContractCostType::Bls12381G2ProjectiveToAffine,
4314        ContractCostType::Bls12381G1Add,
4315        ContractCostType::Bls12381G1Mul,
4316        ContractCostType::Bls12381G1Msm,
4317        ContractCostType::Bls12381MapFpToG1,
4318        ContractCostType::Bls12381HashToG1,
4319        ContractCostType::Bls12381G2Add,
4320        ContractCostType::Bls12381G2Mul,
4321        ContractCostType::Bls12381G2Msm,
4322        ContractCostType::Bls12381MapFp2ToG2,
4323        ContractCostType::Bls12381HashToG2,
4324        ContractCostType::Bls12381Pairing,
4325        ContractCostType::Bls12381FrFromU256,
4326        ContractCostType::Bls12381FrToU256,
4327        ContractCostType::Bls12381FrAddSub,
4328        ContractCostType::Bls12381FrMul,
4329        ContractCostType::Bls12381FrPow,
4330        ContractCostType::Bls12381FrInv,
4331    ];
4332    pub const VARIANTS_STR: [&'static str; 70] = [
4333        "WasmInsnExec",
4334        "MemAlloc",
4335        "MemCpy",
4336        "MemCmp",
4337        "DispatchHostFunction",
4338        "VisitObject",
4339        "ValSer",
4340        "ValDeser",
4341        "ComputeSha256Hash",
4342        "ComputeEd25519PubKey",
4343        "VerifyEd25519Sig",
4344        "VmInstantiation",
4345        "VmCachedInstantiation",
4346        "InvokeVmFunction",
4347        "ComputeKeccak256Hash",
4348        "DecodeEcdsaCurve256Sig",
4349        "RecoverEcdsaSecp256k1Key",
4350        "Int256AddSub",
4351        "Int256Mul",
4352        "Int256Div",
4353        "Int256Pow",
4354        "Int256Shift",
4355        "ChaCha20DrawBytes",
4356        "ParseWasmInstructions",
4357        "ParseWasmFunctions",
4358        "ParseWasmGlobals",
4359        "ParseWasmTableEntries",
4360        "ParseWasmTypes",
4361        "ParseWasmDataSegments",
4362        "ParseWasmElemSegments",
4363        "ParseWasmImports",
4364        "ParseWasmExports",
4365        "ParseWasmDataSegmentBytes",
4366        "InstantiateWasmInstructions",
4367        "InstantiateWasmFunctions",
4368        "InstantiateWasmGlobals",
4369        "InstantiateWasmTableEntries",
4370        "InstantiateWasmTypes",
4371        "InstantiateWasmDataSegments",
4372        "InstantiateWasmElemSegments",
4373        "InstantiateWasmImports",
4374        "InstantiateWasmExports",
4375        "InstantiateWasmDataSegmentBytes",
4376        "Sec1DecodePointUncompressed",
4377        "VerifyEcdsaSecp256r1Sig",
4378        "Bls12381EncodeFp",
4379        "Bls12381DecodeFp",
4380        "Bls12381G1CheckPointOnCurve",
4381        "Bls12381G1CheckPointInSubgroup",
4382        "Bls12381G2CheckPointOnCurve",
4383        "Bls12381G2CheckPointInSubgroup",
4384        "Bls12381G1ProjectiveToAffine",
4385        "Bls12381G2ProjectiveToAffine",
4386        "Bls12381G1Add",
4387        "Bls12381G1Mul",
4388        "Bls12381G1Msm",
4389        "Bls12381MapFpToG1",
4390        "Bls12381HashToG1",
4391        "Bls12381G2Add",
4392        "Bls12381G2Mul",
4393        "Bls12381G2Msm",
4394        "Bls12381MapFp2ToG2",
4395        "Bls12381HashToG2",
4396        "Bls12381Pairing",
4397        "Bls12381FrFromU256",
4398        "Bls12381FrToU256",
4399        "Bls12381FrAddSub",
4400        "Bls12381FrMul",
4401        "Bls12381FrPow",
4402        "Bls12381FrInv",
4403    ];
4404
4405    #[must_use]
4406    pub const fn name(&self) -> &'static str {
4407        match self {
4408            Self::WasmInsnExec => "WasmInsnExec",
4409            Self::MemAlloc => "MemAlloc",
4410            Self::MemCpy => "MemCpy",
4411            Self::MemCmp => "MemCmp",
4412            Self::DispatchHostFunction => "DispatchHostFunction",
4413            Self::VisitObject => "VisitObject",
4414            Self::ValSer => "ValSer",
4415            Self::ValDeser => "ValDeser",
4416            Self::ComputeSha256Hash => "ComputeSha256Hash",
4417            Self::ComputeEd25519PubKey => "ComputeEd25519PubKey",
4418            Self::VerifyEd25519Sig => "VerifyEd25519Sig",
4419            Self::VmInstantiation => "VmInstantiation",
4420            Self::VmCachedInstantiation => "VmCachedInstantiation",
4421            Self::InvokeVmFunction => "InvokeVmFunction",
4422            Self::ComputeKeccak256Hash => "ComputeKeccak256Hash",
4423            Self::DecodeEcdsaCurve256Sig => "DecodeEcdsaCurve256Sig",
4424            Self::RecoverEcdsaSecp256k1Key => "RecoverEcdsaSecp256k1Key",
4425            Self::Int256AddSub => "Int256AddSub",
4426            Self::Int256Mul => "Int256Mul",
4427            Self::Int256Div => "Int256Div",
4428            Self::Int256Pow => "Int256Pow",
4429            Self::Int256Shift => "Int256Shift",
4430            Self::ChaCha20DrawBytes => "ChaCha20DrawBytes",
4431            Self::ParseWasmInstructions => "ParseWasmInstructions",
4432            Self::ParseWasmFunctions => "ParseWasmFunctions",
4433            Self::ParseWasmGlobals => "ParseWasmGlobals",
4434            Self::ParseWasmTableEntries => "ParseWasmTableEntries",
4435            Self::ParseWasmTypes => "ParseWasmTypes",
4436            Self::ParseWasmDataSegments => "ParseWasmDataSegments",
4437            Self::ParseWasmElemSegments => "ParseWasmElemSegments",
4438            Self::ParseWasmImports => "ParseWasmImports",
4439            Self::ParseWasmExports => "ParseWasmExports",
4440            Self::ParseWasmDataSegmentBytes => "ParseWasmDataSegmentBytes",
4441            Self::InstantiateWasmInstructions => "InstantiateWasmInstructions",
4442            Self::InstantiateWasmFunctions => "InstantiateWasmFunctions",
4443            Self::InstantiateWasmGlobals => "InstantiateWasmGlobals",
4444            Self::InstantiateWasmTableEntries => "InstantiateWasmTableEntries",
4445            Self::InstantiateWasmTypes => "InstantiateWasmTypes",
4446            Self::InstantiateWasmDataSegments => "InstantiateWasmDataSegments",
4447            Self::InstantiateWasmElemSegments => "InstantiateWasmElemSegments",
4448            Self::InstantiateWasmImports => "InstantiateWasmImports",
4449            Self::InstantiateWasmExports => "InstantiateWasmExports",
4450            Self::InstantiateWasmDataSegmentBytes => "InstantiateWasmDataSegmentBytes",
4451            Self::Sec1DecodePointUncompressed => "Sec1DecodePointUncompressed",
4452            Self::VerifyEcdsaSecp256r1Sig => "VerifyEcdsaSecp256r1Sig",
4453            Self::Bls12381EncodeFp => "Bls12381EncodeFp",
4454            Self::Bls12381DecodeFp => "Bls12381DecodeFp",
4455            Self::Bls12381G1CheckPointOnCurve => "Bls12381G1CheckPointOnCurve",
4456            Self::Bls12381G1CheckPointInSubgroup => "Bls12381G1CheckPointInSubgroup",
4457            Self::Bls12381G2CheckPointOnCurve => "Bls12381G2CheckPointOnCurve",
4458            Self::Bls12381G2CheckPointInSubgroup => "Bls12381G2CheckPointInSubgroup",
4459            Self::Bls12381G1ProjectiveToAffine => "Bls12381G1ProjectiveToAffine",
4460            Self::Bls12381G2ProjectiveToAffine => "Bls12381G2ProjectiveToAffine",
4461            Self::Bls12381G1Add => "Bls12381G1Add",
4462            Self::Bls12381G1Mul => "Bls12381G1Mul",
4463            Self::Bls12381G1Msm => "Bls12381G1Msm",
4464            Self::Bls12381MapFpToG1 => "Bls12381MapFpToG1",
4465            Self::Bls12381HashToG1 => "Bls12381HashToG1",
4466            Self::Bls12381G2Add => "Bls12381G2Add",
4467            Self::Bls12381G2Mul => "Bls12381G2Mul",
4468            Self::Bls12381G2Msm => "Bls12381G2Msm",
4469            Self::Bls12381MapFp2ToG2 => "Bls12381MapFp2ToG2",
4470            Self::Bls12381HashToG2 => "Bls12381HashToG2",
4471            Self::Bls12381Pairing => "Bls12381Pairing",
4472            Self::Bls12381FrFromU256 => "Bls12381FrFromU256",
4473            Self::Bls12381FrToU256 => "Bls12381FrToU256",
4474            Self::Bls12381FrAddSub => "Bls12381FrAddSub",
4475            Self::Bls12381FrMul => "Bls12381FrMul",
4476            Self::Bls12381FrPow => "Bls12381FrPow",
4477            Self::Bls12381FrInv => "Bls12381FrInv",
4478        }
4479    }
4480
4481    #[must_use]
4482    pub const fn variants() -> [ContractCostType; 70] {
4483        Self::VARIANTS
4484    }
4485}
4486
4487impl Name for ContractCostType {
4488    #[must_use]
4489    fn name(&self) -> &'static str {
4490        Self::name(self)
4491    }
4492}
4493
4494impl Variants<ContractCostType> for ContractCostType {
4495    fn variants() -> slice::Iter<'static, ContractCostType> {
4496        Self::VARIANTS.iter()
4497    }
4498}
4499
4500impl Enum for ContractCostType {}
4501
4502impl fmt::Display for ContractCostType {
4503    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
4504        f.write_str(self.name())
4505    }
4506}
4507
4508impl TryFrom<i32> for ContractCostType {
4509    type Error = Error;
4510
4511    fn try_from(i: i32) -> Result<Self> {
4512        let e = match i {
4513            0 => ContractCostType::WasmInsnExec,
4514            1 => ContractCostType::MemAlloc,
4515            2 => ContractCostType::MemCpy,
4516            3 => ContractCostType::MemCmp,
4517            4 => ContractCostType::DispatchHostFunction,
4518            5 => ContractCostType::VisitObject,
4519            6 => ContractCostType::ValSer,
4520            7 => ContractCostType::ValDeser,
4521            8 => ContractCostType::ComputeSha256Hash,
4522            9 => ContractCostType::ComputeEd25519PubKey,
4523            10 => ContractCostType::VerifyEd25519Sig,
4524            11 => ContractCostType::VmInstantiation,
4525            12 => ContractCostType::VmCachedInstantiation,
4526            13 => ContractCostType::InvokeVmFunction,
4527            14 => ContractCostType::ComputeKeccak256Hash,
4528            15 => ContractCostType::DecodeEcdsaCurve256Sig,
4529            16 => ContractCostType::RecoverEcdsaSecp256k1Key,
4530            17 => ContractCostType::Int256AddSub,
4531            18 => ContractCostType::Int256Mul,
4532            19 => ContractCostType::Int256Div,
4533            20 => ContractCostType::Int256Pow,
4534            21 => ContractCostType::Int256Shift,
4535            22 => ContractCostType::ChaCha20DrawBytes,
4536            23 => ContractCostType::ParseWasmInstructions,
4537            24 => ContractCostType::ParseWasmFunctions,
4538            25 => ContractCostType::ParseWasmGlobals,
4539            26 => ContractCostType::ParseWasmTableEntries,
4540            27 => ContractCostType::ParseWasmTypes,
4541            28 => ContractCostType::ParseWasmDataSegments,
4542            29 => ContractCostType::ParseWasmElemSegments,
4543            30 => ContractCostType::ParseWasmImports,
4544            31 => ContractCostType::ParseWasmExports,
4545            32 => ContractCostType::ParseWasmDataSegmentBytes,
4546            33 => ContractCostType::InstantiateWasmInstructions,
4547            34 => ContractCostType::InstantiateWasmFunctions,
4548            35 => ContractCostType::InstantiateWasmGlobals,
4549            36 => ContractCostType::InstantiateWasmTableEntries,
4550            37 => ContractCostType::InstantiateWasmTypes,
4551            38 => ContractCostType::InstantiateWasmDataSegments,
4552            39 => ContractCostType::InstantiateWasmElemSegments,
4553            40 => ContractCostType::InstantiateWasmImports,
4554            41 => ContractCostType::InstantiateWasmExports,
4555            42 => ContractCostType::InstantiateWasmDataSegmentBytes,
4556            43 => ContractCostType::Sec1DecodePointUncompressed,
4557            44 => ContractCostType::VerifyEcdsaSecp256r1Sig,
4558            45 => ContractCostType::Bls12381EncodeFp,
4559            46 => ContractCostType::Bls12381DecodeFp,
4560            47 => ContractCostType::Bls12381G1CheckPointOnCurve,
4561            48 => ContractCostType::Bls12381G1CheckPointInSubgroup,
4562            49 => ContractCostType::Bls12381G2CheckPointOnCurve,
4563            50 => ContractCostType::Bls12381G2CheckPointInSubgroup,
4564            51 => ContractCostType::Bls12381G1ProjectiveToAffine,
4565            52 => ContractCostType::Bls12381G2ProjectiveToAffine,
4566            53 => ContractCostType::Bls12381G1Add,
4567            54 => ContractCostType::Bls12381G1Mul,
4568            55 => ContractCostType::Bls12381G1Msm,
4569            56 => ContractCostType::Bls12381MapFpToG1,
4570            57 => ContractCostType::Bls12381HashToG1,
4571            58 => ContractCostType::Bls12381G2Add,
4572            59 => ContractCostType::Bls12381G2Mul,
4573            60 => ContractCostType::Bls12381G2Msm,
4574            61 => ContractCostType::Bls12381MapFp2ToG2,
4575            62 => ContractCostType::Bls12381HashToG2,
4576            63 => ContractCostType::Bls12381Pairing,
4577            64 => ContractCostType::Bls12381FrFromU256,
4578            65 => ContractCostType::Bls12381FrToU256,
4579            66 => ContractCostType::Bls12381FrAddSub,
4580            67 => ContractCostType::Bls12381FrMul,
4581            68 => ContractCostType::Bls12381FrPow,
4582            69 => ContractCostType::Bls12381FrInv,
4583            #[allow(unreachable_patterns)]
4584            _ => return Err(Error::Invalid),
4585        };
4586        Ok(e)
4587    }
4588}
4589
4590impl From<ContractCostType> for i32 {
4591    #[must_use]
4592    fn from(e: ContractCostType) -> Self {
4593        e as Self
4594    }
4595}
4596
4597impl ReadXdr for ContractCostType {
4598    #[cfg(feature = "std")]
4599    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
4600        r.with_limited_depth(|r| {
4601            let e = i32::read_xdr(r)?;
4602            let v: Self = e.try_into()?;
4603            Ok(v)
4604        })
4605    }
4606}
4607
4608impl WriteXdr for ContractCostType {
4609    #[cfg(feature = "std")]
4610    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
4611        w.with_limited_depth(|w| {
4612            let i: i32 = (*self).into();
4613            i.write_xdr(w)
4614        })
4615    }
4616}
4617
4618/// ContractCostParamEntry is an XDR Struct defines as:
4619///
4620/// ```text
4621/// struct ContractCostParamEntry {
4622///     // use `ext` to add more terms (e.g. higher order polynomials) in the future
4623///     ExtensionPoint ext;
4624///
4625///     int64 constTerm;
4626///     int64 linearTerm;
4627/// };
4628/// ```
4629///
4630#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
4631#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
4632#[cfg_attr(
4633    all(feature = "serde", feature = "alloc"),
4634    derive(serde::Serialize, serde::Deserialize),
4635    serde(rename_all = "snake_case")
4636)]
4637#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
4638pub struct ContractCostParamEntry {
4639    pub ext: ExtensionPoint,
4640    pub const_term: i64,
4641    pub linear_term: i64,
4642}
4643
4644impl ReadXdr for ContractCostParamEntry {
4645    #[cfg(feature = "std")]
4646    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
4647        r.with_limited_depth(|r| {
4648            Ok(Self {
4649                ext: ExtensionPoint::read_xdr(r)?,
4650                const_term: i64::read_xdr(r)?,
4651                linear_term: i64::read_xdr(r)?,
4652            })
4653        })
4654    }
4655}
4656
4657impl WriteXdr for ContractCostParamEntry {
4658    #[cfg(feature = "std")]
4659    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
4660        w.with_limited_depth(|w| {
4661            self.ext.write_xdr(w)?;
4662            self.const_term.write_xdr(w)?;
4663            self.linear_term.write_xdr(w)?;
4664            Ok(())
4665        })
4666    }
4667}
4668
4669/// StateArchivalSettings is an XDR Struct defines as:
4670///
4671/// ```text
4672/// struct StateArchivalSettings {
4673///     uint32 maxEntryTTL;
4674///     uint32 minTemporaryTTL;
4675///     uint32 minPersistentTTL;
4676///
4677///     // rent_fee = wfee_rate_average / rent_rate_denominator_for_type
4678///     int64 persistentRentRateDenominator;
4679///     int64 tempRentRateDenominator;
4680///
4681///     // max number of entries that emit archival meta in a single ledger
4682///     uint32 maxEntriesToArchive;
4683///
4684///     // Number of snapshots to use when calculating average BucketList size
4685///     uint32 bucketListSizeWindowSampleSize;
4686///
4687///     // How often to sample the BucketList size for the average, in ledgers
4688///     uint32 bucketListWindowSamplePeriod;
4689///
4690///     // Maximum number of bytes that we scan for eviction per ledger
4691///     uint32 evictionScanSize;
4692///
4693///     // Lowest BucketList level to be scanned to evict entries
4694///     uint32 startingEvictionScanLevel;
4695/// };
4696/// ```
4697///
4698#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
4699#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
4700#[cfg_attr(
4701    all(feature = "serde", feature = "alloc"),
4702    derive(serde::Serialize, serde::Deserialize),
4703    serde(rename_all = "snake_case")
4704)]
4705#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
4706pub struct StateArchivalSettings {
4707    pub max_entry_ttl: u32,
4708    pub min_temporary_ttl: u32,
4709    pub min_persistent_ttl: u32,
4710    pub persistent_rent_rate_denominator: i64,
4711    pub temp_rent_rate_denominator: i64,
4712    pub max_entries_to_archive: u32,
4713    pub bucket_list_size_window_sample_size: u32,
4714    pub bucket_list_window_sample_period: u32,
4715    pub eviction_scan_size: u32,
4716    pub starting_eviction_scan_level: u32,
4717}
4718
4719impl ReadXdr for StateArchivalSettings {
4720    #[cfg(feature = "std")]
4721    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
4722        r.with_limited_depth(|r| {
4723            Ok(Self {
4724                max_entry_ttl: u32::read_xdr(r)?,
4725                min_temporary_ttl: u32::read_xdr(r)?,
4726                min_persistent_ttl: u32::read_xdr(r)?,
4727                persistent_rent_rate_denominator: i64::read_xdr(r)?,
4728                temp_rent_rate_denominator: i64::read_xdr(r)?,
4729                max_entries_to_archive: u32::read_xdr(r)?,
4730                bucket_list_size_window_sample_size: u32::read_xdr(r)?,
4731                bucket_list_window_sample_period: u32::read_xdr(r)?,
4732                eviction_scan_size: u32::read_xdr(r)?,
4733                starting_eviction_scan_level: u32::read_xdr(r)?,
4734            })
4735        })
4736    }
4737}
4738
4739impl WriteXdr for StateArchivalSettings {
4740    #[cfg(feature = "std")]
4741    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
4742        w.with_limited_depth(|w| {
4743            self.max_entry_ttl.write_xdr(w)?;
4744            self.min_temporary_ttl.write_xdr(w)?;
4745            self.min_persistent_ttl.write_xdr(w)?;
4746            self.persistent_rent_rate_denominator.write_xdr(w)?;
4747            self.temp_rent_rate_denominator.write_xdr(w)?;
4748            self.max_entries_to_archive.write_xdr(w)?;
4749            self.bucket_list_size_window_sample_size.write_xdr(w)?;
4750            self.bucket_list_window_sample_period.write_xdr(w)?;
4751            self.eviction_scan_size.write_xdr(w)?;
4752            self.starting_eviction_scan_level.write_xdr(w)?;
4753            Ok(())
4754        })
4755    }
4756}
4757
4758/// EvictionIterator is an XDR Struct defines as:
4759///
4760/// ```text
4761/// struct EvictionIterator {
4762///     uint32 bucketListLevel;
4763///     bool isCurrBucket;
4764///     uint64 bucketFileOffset;
4765/// };
4766/// ```
4767///
4768#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
4769#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
4770#[cfg_attr(
4771    all(feature = "serde", feature = "alloc"),
4772    derive(serde::Serialize, serde::Deserialize),
4773    serde(rename_all = "snake_case")
4774)]
4775#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
4776pub struct EvictionIterator {
4777    pub bucket_list_level: u32,
4778    pub is_curr_bucket: bool,
4779    pub bucket_file_offset: u64,
4780}
4781
4782impl ReadXdr for EvictionIterator {
4783    #[cfg(feature = "std")]
4784    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
4785        r.with_limited_depth(|r| {
4786            Ok(Self {
4787                bucket_list_level: u32::read_xdr(r)?,
4788                is_curr_bucket: bool::read_xdr(r)?,
4789                bucket_file_offset: u64::read_xdr(r)?,
4790            })
4791        })
4792    }
4793}
4794
4795impl WriteXdr for EvictionIterator {
4796    #[cfg(feature = "std")]
4797    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
4798        w.with_limited_depth(|w| {
4799            self.bucket_list_level.write_xdr(w)?;
4800            self.is_curr_bucket.write_xdr(w)?;
4801            self.bucket_file_offset.write_xdr(w)?;
4802            Ok(())
4803        })
4804    }
4805}
4806
4807/// ContractCostCountLimit is an XDR Const defines as:
4808///
4809/// ```text
4810/// const CONTRACT_COST_COUNT_LIMIT = 1024;
4811/// ```
4812///
4813pub const CONTRACT_COST_COUNT_LIMIT: u64 = 1024;
4814
4815/// ContractCostParams is an XDR Typedef defines as:
4816///
4817/// ```text
4818/// typedef ContractCostParamEntry ContractCostParams<CONTRACT_COST_COUNT_LIMIT>;
4819/// ```
4820///
4821#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
4822#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
4823#[derive(Default)]
4824#[cfg_attr(
4825    all(feature = "serde", feature = "alloc"),
4826    derive(serde::Serialize, serde::Deserialize),
4827    serde(rename_all = "snake_case")
4828)]
4829#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
4830#[derive(Debug)]
4831pub struct ContractCostParams(pub VecM<ContractCostParamEntry, 1024>);
4832
4833impl From<ContractCostParams> for VecM<ContractCostParamEntry, 1024> {
4834    #[must_use]
4835    fn from(x: ContractCostParams) -> Self {
4836        x.0
4837    }
4838}
4839
4840impl From<VecM<ContractCostParamEntry, 1024>> for ContractCostParams {
4841    #[must_use]
4842    fn from(x: VecM<ContractCostParamEntry, 1024>) -> Self {
4843        ContractCostParams(x)
4844    }
4845}
4846
4847impl AsRef<VecM<ContractCostParamEntry, 1024>> for ContractCostParams {
4848    #[must_use]
4849    fn as_ref(&self) -> &VecM<ContractCostParamEntry, 1024> {
4850        &self.0
4851    }
4852}
4853
4854impl ReadXdr for ContractCostParams {
4855    #[cfg(feature = "std")]
4856    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
4857        r.with_limited_depth(|r| {
4858            let i = VecM::<ContractCostParamEntry, 1024>::read_xdr(r)?;
4859            let v = ContractCostParams(i);
4860            Ok(v)
4861        })
4862    }
4863}
4864
4865impl WriteXdr for ContractCostParams {
4866    #[cfg(feature = "std")]
4867    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
4868        w.with_limited_depth(|w| self.0.write_xdr(w))
4869    }
4870}
4871
4872impl Deref for ContractCostParams {
4873    type Target = VecM<ContractCostParamEntry, 1024>;
4874    fn deref(&self) -> &Self::Target {
4875        &self.0
4876    }
4877}
4878
4879impl From<ContractCostParams> for Vec<ContractCostParamEntry> {
4880    #[must_use]
4881    fn from(x: ContractCostParams) -> Self {
4882        x.0 .0
4883    }
4884}
4885
4886impl TryFrom<Vec<ContractCostParamEntry>> for ContractCostParams {
4887    type Error = Error;
4888    fn try_from(x: Vec<ContractCostParamEntry>) -> Result<Self> {
4889        Ok(ContractCostParams(x.try_into()?))
4890    }
4891}
4892
4893#[cfg(feature = "alloc")]
4894impl TryFrom<&Vec<ContractCostParamEntry>> for ContractCostParams {
4895    type Error = Error;
4896    fn try_from(x: &Vec<ContractCostParamEntry>) -> Result<Self> {
4897        Ok(ContractCostParams(x.try_into()?))
4898    }
4899}
4900
4901impl AsRef<Vec<ContractCostParamEntry>> for ContractCostParams {
4902    #[must_use]
4903    fn as_ref(&self) -> &Vec<ContractCostParamEntry> {
4904        &self.0 .0
4905    }
4906}
4907
4908impl AsRef<[ContractCostParamEntry]> for ContractCostParams {
4909    #[cfg(feature = "alloc")]
4910    #[must_use]
4911    fn as_ref(&self) -> &[ContractCostParamEntry] {
4912        &self.0 .0
4913    }
4914    #[cfg(not(feature = "alloc"))]
4915    #[must_use]
4916    fn as_ref(&self) -> &[ContractCostParamEntry] {
4917        self.0 .0
4918    }
4919}
4920
4921/// ConfigSettingId is an XDR Enum defines as:
4922///
4923/// ```text
4924/// enum ConfigSettingID
4925/// {
4926///     CONFIG_SETTING_CONTRACT_MAX_SIZE_BYTES = 0,
4927///     CONFIG_SETTING_CONTRACT_COMPUTE_V0 = 1,
4928///     CONFIG_SETTING_CONTRACT_LEDGER_COST_V0 = 2,
4929///     CONFIG_SETTING_CONTRACT_HISTORICAL_DATA_V0 = 3,
4930///     CONFIG_SETTING_CONTRACT_EVENTS_V0 = 4,
4931///     CONFIG_SETTING_CONTRACT_BANDWIDTH_V0 = 5,
4932///     CONFIG_SETTING_CONTRACT_COST_PARAMS_CPU_INSTRUCTIONS = 6,
4933///     CONFIG_SETTING_CONTRACT_COST_PARAMS_MEMORY_BYTES = 7,
4934///     CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES = 8,
4935///     CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES = 9,
4936///     CONFIG_SETTING_STATE_ARCHIVAL = 10,
4937///     CONFIG_SETTING_CONTRACT_EXECUTION_LANES = 11,
4938///     CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW = 12,
4939///     CONFIG_SETTING_EVICTION_ITERATOR = 13
4940/// };
4941/// ```
4942///
4943// enum
4944#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
4945#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
4946#[cfg_attr(
4947    all(feature = "serde", feature = "alloc"),
4948    derive(serde::Serialize, serde::Deserialize),
4949    serde(rename_all = "snake_case")
4950)]
4951#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
4952#[repr(i32)]
4953pub enum ConfigSettingId {
4954    ContractMaxSizeBytes = 0,
4955    ContractComputeV0 = 1,
4956    ContractLedgerCostV0 = 2,
4957    ContractHistoricalDataV0 = 3,
4958    ContractEventsV0 = 4,
4959    ContractBandwidthV0 = 5,
4960    ContractCostParamsCpuInstructions = 6,
4961    ContractCostParamsMemoryBytes = 7,
4962    ContractDataKeySizeBytes = 8,
4963    ContractDataEntrySizeBytes = 9,
4964    StateArchival = 10,
4965    ContractExecutionLanes = 11,
4966    BucketlistSizeWindow = 12,
4967    EvictionIterator = 13,
4968}
4969
4970impl ConfigSettingId {
4971    pub const VARIANTS: [ConfigSettingId; 14] = [
4972        ConfigSettingId::ContractMaxSizeBytes,
4973        ConfigSettingId::ContractComputeV0,
4974        ConfigSettingId::ContractLedgerCostV0,
4975        ConfigSettingId::ContractHistoricalDataV0,
4976        ConfigSettingId::ContractEventsV0,
4977        ConfigSettingId::ContractBandwidthV0,
4978        ConfigSettingId::ContractCostParamsCpuInstructions,
4979        ConfigSettingId::ContractCostParamsMemoryBytes,
4980        ConfigSettingId::ContractDataKeySizeBytes,
4981        ConfigSettingId::ContractDataEntrySizeBytes,
4982        ConfigSettingId::StateArchival,
4983        ConfigSettingId::ContractExecutionLanes,
4984        ConfigSettingId::BucketlistSizeWindow,
4985        ConfigSettingId::EvictionIterator,
4986    ];
4987    pub const VARIANTS_STR: [&'static str; 14] = [
4988        "ContractMaxSizeBytes",
4989        "ContractComputeV0",
4990        "ContractLedgerCostV0",
4991        "ContractHistoricalDataV0",
4992        "ContractEventsV0",
4993        "ContractBandwidthV0",
4994        "ContractCostParamsCpuInstructions",
4995        "ContractCostParamsMemoryBytes",
4996        "ContractDataKeySizeBytes",
4997        "ContractDataEntrySizeBytes",
4998        "StateArchival",
4999        "ContractExecutionLanes",
5000        "BucketlistSizeWindow",
5001        "EvictionIterator",
5002    ];
5003
5004    #[must_use]
5005    pub const fn name(&self) -> &'static str {
5006        match self {
5007            Self::ContractMaxSizeBytes => "ContractMaxSizeBytes",
5008            Self::ContractComputeV0 => "ContractComputeV0",
5009            Self::ContractLedgerCostV0 => "ContractLedgerCostV0",
5010            Self::ContractHistoricalDataV0 => "ContractHistoricalDataV0",
5011            Self::ContractEventsV0 => "ContractEventsV0",
5012            Self::ContractBandwidthV0 => "ContractBandwidthV0",
5013            Self::ContractCostParamsCpuInstructions => "ContractCostParamsCpuInstructions",
5014            Self::ContractCostParamsMemoryBytes => "ContractCostParamsMemoryBytes",
5015            Self::ContractDataKeySizeBytes => "ContractDataKeySizeBytes",
5016            Self::ContractDataEntrySizeBytes => "ContractDataEntrySizeBytes",
5017            Self::StateArchival => "StateArchival",
5018            Self::ContractExecutionLanes => "ContractExecutionLanes",
5019            Self::BucketlistSizeWindow => "BucketlistSizeWindow",
5020            Self::EvictionIterator => "EvictionIterator",
5021        }
5022    }
5023
5024    #[must_use]
5025    pub const fn variants() -> [ConfigSettingId; 14] {
5026        Self::VARIANTS
5027    }
5028}
5029
5030impl Name for ConfigSettingId {
5031    #[must_use]
5032    fn name(&self) -> &'static str {
5033        Self::name(self)
5034    }
5035}
5036
5037impl Variants<ConfigSettingId> for ConfigSettingId {
5038    fn variants() -> slice::Iter<'static, ConfigSettingId> {
5039        Self::VARIANTS.iter()
5040    }
5041}
5042
5043impl Enum for ConfigSettingId {}
5044
5045impl fmt::Display for ConfigSettingId {
5046    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
5047        f.write_str(self.name())
5048    }
5049}
5050
5051impl TryFrom<i32> for ConfigSettingId {
5052    type Error = Error;
5053
5054    fn try_from(i: i32) -> Result<Self> {
5055        let e = match i {
5056            0 => ConfigSettingId::ContractMaxSizeBytes,
5057            1 => ConfigSettingId::ContractComputeV0,
5058            2 => ConfigSettingId::ContractLedgerCostV0,
5059            3 => ConfigSettingId::ContractHistoricalDataV0,
5060            4 => ConfigSettingId::ContractEventsV0,
5061            5 => ConfigSettingId::ContractBandwidthV0,
5062            6 => ConfigSettingId::ContractCostParamsCpuInstructions,
5063            7 => ConfigSettingId::ContractCostParamsMemoryBytes,
5064            8 => ConfigSettingId::ContractDataKeySizeBytes,
5065            9 => ConfigSettingId::ContractDataEntrySizeBytes,
5066            10 => ConfigSettingId::StateArchival,
5067            11 => ConfigSettingId::ContractExecutionLanes,
5068            12 => ConfigSettingId::BucketlistSizeWindow,
5069            13 => ConfigSettingId::EvictionIterator,
5070            #[allow(unreachable_patterns)]
5071            _ => return Err(Error::Invalid),
5072        };
5073        Ok(e)
5074    }
5075}
5076
5077impl From<ConfigSettingId> for i32 {
5078    #[must_use]
5079    fn from(e: ConfigSettingId) -> Self {
5080        e as Self
5081    }
5082}
5083
5084impl ReadXdr for ConfigSettingId {
5085    #[cfg(feature = "std")]
5086    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
5087        r.with_limited_depth(|r| {
5088            let e = i32::read_xdr(r)?;
5089            let v: Self = e.try_into()?;
5090            Ok(v)
5091        })
5092    }
5093}
5094
5095impl WriteXdr for ConfigSettingId {
5096    #[cfg(feature = "std")]
5097    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
5098        w.with_limited_depth(|w| {
5099            let i: i32 = (*self).into();
5100            i.write_xdr(w)
5101        })
5102    }
5103}
5104
5105/// ConfigSettingEntry is an XDR Union defines as:
5106///
5107/// ```text
5108/// union ConfigSettingEntry switch (ConfigSettingID configSettingID)
5109/// {
5110/// case CONFIG_SETTING_CONTRACT_MAX_SIZE_BYTES:
5111///     uint32 contractMaxSizeBytes;
5112/// case CONFIG_SETTING_CONTRACT_COMPUTE_V0:
5113///     ConfigSettingContractComputeV0 contractCompute;
5114/// case CONFIG_SETTING_CONTRACT_LEDGER_COST_V0:
5115///     ConfigSettingContractLedgerCostV0 contractLedgerCost;
5116/// case CONFIG_SETTING_CONTRACT_HISTORICAL_DATA_V0:
5117///     ConfigSettingContractHistoricalDataV0 contractHistoricalData;
5118/// case CONFIG_SETTING_CONTRACT_EVENTS_V0:
5119///     ConfigSettingContractEventsV0 contractEvents;
5120/// case CONFIG_SETTING_CONTRACT_BANDWIDTH_V0:
5121///     ConfigSettingContractBandwidthV0 contractBandwidth;
5122/// case CONFIG_SETTING_CONTRACT_COST_PARAMS_CPU_INSTRUCTIONS:
5123///     ContractCostParams contractCostParamsCpuInsns;
5124/// case CONFIG_SETTING_CONTRACT_COST_PARAMS_MEMORY_BYTES:
5125///     ContractCostParams contractCostParamsMemBytes;
5126/// case CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES:
5127///     uint32 contractDataKeySizeBytes;
5128/// case CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES:
5129///     uint32 contractDataEntrySizeBytes;
5130/// case CONFIG_SETTING_STATE_ARCHIVAL:
5131///     StateArchivalSettings stateArchivalSettings;
5132/// case CONFIG_SETTING_CONTRACT_EXECUTION_LANES:
5133///     ConfigSettingContractExecutionLanesV0 contractExecutionLanes;
5134/// case CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW:
5135///     uint64 bucketListSizeWindow<>;
5136/// case CONFIG_SETTING_EVICTION_ITERATOR:
5137///     EvictionIterator evictionIterator;
5138/// };
5139/// ```
5140///
5141// union with discriminant ConfigSettingId
5142#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
5143#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
5144#[cfg_attr(
5145    all(feature = "serde", feature = "alloc"),
5146    derive(serde::Serialize, serde::Deserialize),
5147    serde(rename_all = "snake_case")
5148)]
5149#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
5150#[allow(clippy::large_enum_variant)]
5151pub enum ConfigSettingEntry {
5152    ContractMaxSizeBytes(u32),
5153    ContractComputeV0(ConfigSettingContractComputeV0),
5154    ContractLedgerCostV0(ConfigSettingContractLedgerCostV0),
5155    ContractHistoricalDataV0(ConfigSettingContractHistoricalDataV0),
5156    ContractEventsV0(ConfigSettingContractEventsV0),
5157    ContractBandwidthV0(ConfigSettingContractBandwidthV0),
5158    ContractCostParamsCpuInstructions(ContractCostParams),
5159    ContractCostParamsMemoryBytes(ContractCostParams),
5160    ContractDataKeySizeBytes(u32),
5161    ContractDataEntrySizeBytes(u32),
5162    StateArchival(StateArchivalSettings),
5163    ContractExecutionLanes(ConfigSettingContractExecutionLanesV0),
5164    BucketlistSizeWindow(VecM<u64>),
5165    EvictionIterator(EvictionIterator),
5166}
5167
5168impl ConfigSettingEntry {
5169    pub const VARIANTS: [ConfigSettingId; 14] = [
5170        ConfigSettingId::ContractMaxSizeBytes,
5171        ConfigSettingId::ContractComputeV0,
5172        ConfigSettingId::ContractLedgerCostV0,
5173        ConfigSettingId::ContractHistoricalDataV0,
5174        ConfigSettingId::ContractEventsV0,
5175        ConfigSettingId::ContractBandwidthV0,
5176        ConfigSettingId::ContractCostParamsCpuInstructions,
5177        ConfigSettingId::ContractCostParamsMemoryBytes,
5178        ConfigSettingId::ContractDataKeySizeBytes,
5179        ConfigSettingId::ContractDataEntrySizeBytes,
5180        ConfigSettingId::StateArchival,
5181        ConfigSettingId::ContractExecutionLanes,
5182        ConfigSettingId::BucketlistSizeWindow,
5183        ConfigSettingId::EvictionIterator,
5184    ];
5185    pub const VARIANTS_STR: [&'static str; 14] = [
5186        "ContractMaxSizeBytes",
5187        "ContractComputeV0",
5188        "ContractLedgerCostV0",
5189        "ContractHistoricalDataV0",
5190        "ContractEventsV0",
5191        "ContractBandwidthV0",
5192        "ContractCostParamsCpuInstructions",
5193        "ContractCostParamsMemoryBytes",
5194        "ContractDataKeySizeBytes",
5195        "ContractDataEntrySizeBytes",
5196        "StateArchival",
5197        "ContractExecutionLanes",
5198        "BucketlistSizeWindow",
5199        "EvictionIterator",
5200    ];
5201
5202    #[must_use]
5203    pub const fn name(&self) -> &'static str {
5204        match self {
5205            Self::ContractMaxSizeBytes(_) => "ContractMaxSizeBytes",
5206            Self::ContractComputeV0(_) => "ContractComputeV0",
5207            Self::ContractLedgerCostV0(_) => "ContractLedgerCostV0",
5208            Self::ContractHistoricalDataV0(_) => "ContractHistoricalDataV0",
5209            Self::ContractEventsV0(_) => "ContractEventsV0",
5210            Self::ContractBandwidthV0(_) => "ContractBandwidthV0",
5211            Self::ContractCostParamsCpuInstructions(_) => "ContractCostParamsCpuInstructions",
5212            Self::ContractCostParamsMemoryBytes(_) => "ContractCostParamsMemoryBytes",
5213            Self::ContractDataKeySizeBytes(_) => "ContractDataKeySizeBytes",
5214            Self::ContractDataEntrySizeBytes(_) => "ContractDataEntrySizeBytes",
5215            Self::StateArchival(_) => "StateArchival",
5216            Self::ContractExecutionLanes(_) => "ContractExecutionLanes",
5217            Self::BucketlistSizeWindow(_) => "BucketlistSizeWindow",
5218            Self::EvictionIterator(_) => "EvictionIterator",
5219        }
5220    }
5221
5222    #[must_use]
5223    pub const fn discriminant(&self) -> ConfigSettingId {
5224        #[allow(clippy::match_same_arms)]
5225        match self {
5226            Self::ContractMaxSizeBytes(_) => ConfigSettingId::ContractMaxSizeBytes,
5227            Self::ContractComputeV0(_) => ConfigSettingId::ContractComputeV0,
5228            Self::ContractLedgerCostV0(_) => ConfigSettingId::ContractLedgerCostV0,
5229            Self::ContractHistoricalDataV0(_) => ConfigSettingId::ContractHistoricalDataV0,
5230            Self::ContractEventsV0(_) => ConfigSettingId::ContractEventsV0,
5231            Self::ContractBandwidthV0(_) => ConfigSettingId::ContractBandwidthV0,
5232            Self::ContractCostParamsCpuInstructions(_) => {
5233                ConfigSettingId::ContractCostParamsCpuInstructions
5234            }
5235            Self::ContractCostParamsMemoryBytes(_) => {
5236                ConfigSettingId::ContractCostParamsMemoryBytes
5237            }
5238            Self::ContractDataKeySizeBytes(_) => ConfigSettingId::ContractDataKeySizeBytes,
5239            Self::ContractDataEntrySizeBytes(_) => ConfigSettingId::ContractDataEntrySizeBytes,
5240            Self::StateArchival(_) => ConfigSettingId::StateArchival,
5241            Self::ContractExecutionLanes(_) => ConfigSettingId::ContractExecutionLanes,
5242            Self::BucketlistSizeWindow(_) => ConfigSettingId::BucketlistSizeWindow,
5243            Self::EvictionIterator(_) => ConfigSettingId::EvictionIterator,
5244        }
5245    }
5246
5247    #[must_use]
5248    pub const fn variants() -> [ConfigSettingId; 14] {
5249        Self::VARIANTS
5250    }
5251}
5252
5253impl Name for ConfigSettingEntry {
5254    #[must_use]
5255    fn name(&self) -> &'static str {
5256        Self::name(self)
5257    }
5258}
5259
5260impl Discriminant<ConfigSettingId> for ConfigSettingEntry {
5261    #[must_use]
5262    fn discriminant(&self) -> ConfigSettingId {
5263        Self::discriminant(self)
5264    }
5265}
5266
5267impl Variants<ConfigSettingId> for ConfigSettingEntry {
5268    fn variants() -> slice::Iter<'static, ConfigSettingId> {
5269        Self::VARIANTS.iter()
5270    }
5271}
5272
5273impl Union<ConfigSettingId> for ConfigSettingEntry {}
5274
5275impl ReadXdr for ConfigSettingEntry {
5276    #[cfg(feature = "std")]
5277    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
5278        r.with_limited_depth(|r| {
5279            let dv: ConfigSettingId = <ConfigSettingId as ReadXdr>::read_xdr(r)?;
5280            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
5281            let v = match dv {
5282                ConfigSettingId::ContractMaxSizeBytes => {
5283                    Self::ContractMaxSizeBytes(u32::read_xdr(r)?)
5284                }
5285                ConfigSettingId::ContractComputeV0 => {
5286                    Self::ContractComputeV0(ConfigSettingContractComputeV0::read_xdr(r)?)
5287                }
5288                ConfigSettingId::ContractLedgerCostV0 => {
5289                    Self::ContractLedgerCostV0(ConfigSettingContractLedgerCostV0::read_xdr(r)?)
5290                }
5291                ConfigSettingId::ContractHistoricalDataV0 => Self::ContractHistoricalDataV0(
5292                    ConfigSettingContractHistoricalDataV0::read_xdr(r)?,
5293                ),
5294                ConfigSettingId::ContractEventsV0 => {
5295                    Self::ContractEventsV0(ConfigSettingContractEventsV0::read_xdr(r)?)
5296                }
5297                ConfigSettingId::ContractBandwidthV0 => {
5298                    Self::ContractBandwidthV0(ConfigSettingContractBandwidthV0::read_xdr(r)?)
5299                }
5300                ConfigSettingId::ContractCostParamsCpuInstructions => {
5301                    Self::ContractCostParamsCpuInstructions(ContractCostParams::read_xdr(r)?)
5302                }
5303                ConfigSettingId::ContractCostParamsMemoryBytes => {
5304                    Self::ContractCostParamsMemoryBytes(ContractCostParams::read_xdr(r)?)
5305                }
5306                ConfigSettingId::ContractDataKeySizeBytes => {
5307                    Self::ContractDataKeySizeBytes(u32::read_xdr(r)?)
5308                }
5309                ConfigSettingId::ContractDataEntrySizeBytes => {
5310                    Self::ContractDataEntrySizeBytes(u32::read_xdr(r)?)
5311                }
5312                ConfigSettingId::StateArchival => {
5313                    Self::StateArchival(StateArchivalSettings::read_xdr(r)?)
5314                }
5315                ConfigSettingId::ContractExecutionLanes => Self::ContractExecutionLanes(
5316                    ConfigSettingContractExecutionLanesV0::read_xdr(r)?,
5317                ),
5318                ConfigSettingId::BucketlistSizeWindow => {
5319                    Self::BucketlistSizeWindow(VecM::<u64>::read_xdr(r)?)
5320                }
5321                ConfigSettingId::EvictionIterator => {
5322                    Self::EvictionIterator(EvictionIterator::read_xdr(r)?)
5323                }
5324                #[allow(unreachable_patterns)]
5325                _ => return Err(Error::Invalid),
5326            };
5327            Ok(v)
5328        })
5329    }
5330}
5331
5332impl WriteXdr for ConfigSettingEntry {
5333    #[cfg(feature = "std")]
5334    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
5335        w.with_limited_depth(|w| {
5336            self.discriminant().write_xdr(w)?;
5337            #[allow(clippy::match_same_arms)]
5338            match self {
5339                Self::ContractMaxSizeBytes(v) => v.write_xdr(w)?,
5340                Self::ContractComputeV0(v) => v.write_xdr(w)?,
5341                Self::ContractLedgerCostV0(v) => v.write_xdr(w)?,
5342                Self::ContractHistoricalDataV0(v) => v.write_xdr(w)?,
5343                Self::ContractEventsV0(v) => v.write_xdr(w)?,
5344                Self::ContractBandwidthV0(v) => v.write_xdr(w)?,
5345                Self::ContractCostParamsCpuInstructions(v) => v.write_xdr(w)?,
5346                Self::ContractCostParamsMemoryBytes(v) => v.write_xdr(w)?,
5347                Self::ContractDataKeySizeBytes(v) => v.write_xdr(w)?,
5348                Self::ContractDataEntrySizeBytes(v) => v.write_xdr(w)?,
5349                Self::StateArchival(v) => v.write_xdr(w)?,
5350                Self::ContractExecutionLanes(v) => v.write_xdr(w)?,
5351                Self::BucketlistSizeWindow(v) => v.write_xdr(w)?,
5352                Self::EvictionIterator(v) => v.write_xdr(w)?,
5353            };
5354            Ok(())
5355        })
5356    }
5357}
5358
5359/// ScEnvMetaKind is an XDR Enum defines as:
5360///
5361/// ```text
5362/// enum SCEnvMetaKind
5363/// {
5364///     SC_ENV_META_KIND_INTERFACE_VERSION = 0
5365/// };
5366/// ```
5367///
5368// enum
5369#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
5370#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
5371#[cfg_attr(
5372    all(feature = "serde", feature = "alloc"),
5373    derive(serde::Serialize, serde::Deserialize),
5374    serde(rename_all = "snake_case")
5375)]
5376#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
5377#[repr(i32)]
5378pub enum ScEnvMetaKind {
5379    ScEnvMetaKindInterfaceVersion = 0,
5380}
5381
5382impl ScEnvMetaKind {
5383    pub const VARIANTS: [ScEnvMetaKind; 1] = [ScEnvMetaKind::ScEnvMetaKindInterfaceVersion];
5384    pub const VARIANTS_STR: [&'static str; 1] = ["ScEnvMetaKindInterfaceVersion"];
5385
5386    #[must_use]
5387    pub const fn name(&self) -> &'static str {
5388        match self {
5389            Self::ScEnvMetaKindInterfaceVersion => "ScEnvMetaKindInterfaceVersion",
5390        }
5391    }
5392
5393    #[must_use]
5394    pub const fn variants() -> [ScEnvMetaKind; 1] {
5395        Self::VARIANTS
5396    }
5397}
5398
5399impl Name for ScEnvMetaKind {
5400    #[must_use]
5401    fn name(&self) -> &'static str {
5402        Self::name(self)
5403    }
5404}
5405
5406impl Variants<ScEnvMetaKind> for ScEnvMetaKind {
5407    fn variants() -> slice::Iter<'static, ScEnvMetaKind> {
5408        Self::VARIANTS.iter()
5409    }
5410}
5411
5412impl Enum for ScEnvMetaKind {}
5413
5414impl fmt::Display for ScEnvMetaKind {
5415    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
5416        f.write_str(self.name())
5417    }
5418}
5419
5420impl TryFrom<i32> for ScEnvMetaKind {
5421    type Error = Error;
5422
5423    fn try_from(i: i32) -> Result<Self> {
5424        let e = match i {
5425            0 => ScEnvMetaKind::ScEnvMetaKindInterfaceVersion,
5426            #[allow(unreachable_patterns)]
5427            _ => return Err(Error::Invalid),
5428        };
5429        Ok(e)
5430    }
5431}
5432
5433impl From<ScEnvMetaKind> for i32 {
5434    #[must_use]
5435    fn from(e: ScEnvMetaKind) -> Self {
5436        e as Self
5437    }
5438}
5439
5440impl ReadXdr for ScEnvMetaKind {
5441    #[cfg(feature = "std")]
5442    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
5443        r.with_limited_depth(|r| {
5444            let e = i32::read_xdr(r)?;
5445            let v: Self = e.try_into()?;
5446            Ok(v)
5447        })
5448    }
5449}
5450
5451impl WriteXdr for ScEnvMetaKind {
5452    #[cfg(feature = "std")]
5453    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
5454        w.with_limited_depth(|w| {
5455            let i: i32 = (*self).into();
5456            i.write_xdr(w)
5457        })
5458    }
5459}
5460
5461/// ScEnvMetaEntryInterfaceVersion is an XDR NestedStruct defines as:
5462///
5463/// ```text
5464/// struct {
5465///         uint32 protocol;
5466///         uint32 preRelease;
5467///     }
5468/// ```
5469///
5470#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
5471#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
5472#[cfg_attr(
5473    all(feature = "serde", feature = "alloc"),
5474    derive(serde::Serialize, serde::Deserialize),
5475    serde(rename_all = "snake_case")
5476)]
5477#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
5478pub struct ScEnvMetaEntryInterfaceVersion {
5479    pub protocol: u32,
5480    pub pre_release: u32,
5481}
5482
5483impl ReadXdr for ScEnvMetaEntryInterfaceVersion {
5484    #[cfg(feature = "std")]
5485    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
5486        r.with_limited_depth(|r| {
5487            Ok(Self {
5488                protocol: u32::read_xdr(r)?,
5489                pre_release: u32::read_xdr(r)?,
5490            })
5491        })
5492    }
5493}
5494
5495impl WriteXdr for ScEnvMetaEntryInterfaceVersion {
5496    #[cfg(feature = "std")]
5497    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
5498        w.with_limited_depth(|w| {
5499            self.protocol.write_xdr(w)?;
5500            self.pre_release.write_xdr(w)?;
5501            Ok(())
5502        })
5503    }
5504}
5505
5506/// ScEnvMetaEntry is an XDR Union defines as:
5507///
5508/// ```text
5509/// union SCEnvMetaEntry switch (SCEnvMetaKind kind)
5510/// {
5511/// case SC_ENV_META_KIND_INTERFACE_VERSION:
5512///     struct {
5513///         uint32 protocol;
5514///         uint32 preRelease;
5515///     } interfaceVersion;
5516/// };
5517/// ```
5518///
5519// union with discriminant ScEnvMetaKind
5520#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
5521#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
5522#[cfg_attr(
5523    all(feature = "serde", feature = "alloc"),
5524    derive(serde::Serialize, serde::Deserialize),
5525    serde(rename_all = "snake_case")
5526)]
5527#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
5528#[allow(clippy::large_enum_variant)]
5529pub enum ScEnvMetaEntry {
5530    ScEnvMetaKindInterfaceVersion(ScEnvMetaEntryInterfaceVersion),
5531}
5532
5533impl ScEnvMetaEntry {
5534    pub const VARIANTS: [ScEnvMetaKind; 1] = [ScEnvMetaKind::ScEnvMetaKindInterfaceVersion];
5535    pub const VARIANTS_STR: [&'static str; 1] = ["ScEnvMetaKindInterfaceVersion"];
5536
5537    #[must_use]
5538    pub const fn name(&self) -> &'static str {
5539        match self {
5540            Self::ScEnvMetaKindInterfaceVersion(_) => "ScEnvMetaKindInterfaceVersion",
5541        }
5542    }
5543
5544    #[must_use]
5545    pub const fn discriminant(&self) -> ScEnvMetaKind {
5546        #[allow(clippy::match_same_arms)]
5547        match self {
5548            Self::ScEnvMetaKindInterfaceVersion(_) => ScEnvMetaKind::ScEnvMetaKindInterfaceVersion,
5549        }
5550    }
5551
5552    #[must_use]
5553    pub const fn variants() -> [ScEnvMetaKind; 1] {
5554        Self::VARIANTS
5555    }
5556}
5557
5558impl Name for ScEnvMetaEntry {
5559    #[must_use]
5560    fn name(&self) -> &'static str {
5561        Self::name(self)
5562    }
5563}
5564
5565impl Discriminant<ScEnvMetaKind> for ScEnvMetaEntry {
5566    #[must_use]
5567    fn discriminant(&self) -> ScEnvMetaKind {
5568        Self::discriminant(self)
5569    }
5570}
5571
5572impl Variants<ScEnvMetaKind> for ScEnvMetaEntry {
5573    fn variants() -> slice::Iter<'static, ScEnvMetaKind> {
5574        Self::VARIANTS.iter()
5575    }
5576}
5577
5578impl Union<ScEnvMetaKind> for ScEnvMetaEntry {}
5579
5580impl ReadXdr for ScEnvMetaEntry {
5581    #[cfg(feature = "std")]
5582    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
5583        r.with_limited_depth(|r| {
5584            let dv: ScEnvMetaKind = <ScEnvMetaKind as ReadXdr>::read_xdr(r)?;
5585            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
5586            let v = match dv {
5587                ScEnvMetaKind::ScEnvMetaKindInterfaceVersion => {
5588                    Self::ScEnvMetaKindInterfaceVersion(ScEnvMetaEntryInterfaceVersion::read_xdr(
5589                        r,
5590                    )?)
5591                }
5592                #[allow(unreachable_patterns)]
5593                _ => return Err(Error::Invalid),
5594            };
5595            Ok(v)
5596        })
5597    }
5598}
5599
5600impl WriteXdr for ScEnvMetaEntry {
5601    #[cfg(feature = "std")]
5602    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
5603        w.with_limited_depth(|w| {
5604            self.discriminant().write_xdr(w)?;
5605            #[allow(clippy::match_same_arms)]
5606            match self {
5607                Self::ScEnvMetaKindInterfaceVersion(v) => v.write_xdr(w)?,
5608            };
5609            Ok(())
5610        })
5611    }
5612}
5613
5614/// ScMetaV0 is an XDR Struct defines as:
5615///
5616/// ```text
5617/// struct SCMetaV0
5618/// {
5619///     string key<>;
5620///     string val<>;
5621/// };
5622/// ```
5623///
5624#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
5625#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
5626#[cfg_attr(
5627    all(feature = "serde", feature = "alloc"),
5628    derive(serde::Serialize, serde::Deserialize),
5629    serde(rename_all = "snake_case")
5630)]
5631#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
5632pub struct ScMetaV0 {
5633    pub key: StringM,
5634    pub val: StringM,
5635}
5636
5637impl ReadXdr for ScMetaV0 {
5638    #[cfg(feature = "std")]
5639    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
5640        r.with_limited_depth(|r| {
5641            Ok(Self {
5642                key: StringM::read_xdr(r)?,
5643                val: StringM::read_xdr(r)?,
5644            })
5645        })
5646    }
5647}
5648
5649impl WriteXdr for ScMetaV0 {
5650    #[cfg(feature = "std")]
5651    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
5652        w.with_limited_depth(|w| {
5653            self.key.write_xdr(w)?;
5654            self.val.write_xdr(w)?;
5655            Ok(())
5656        })
5657    }
5658}
5659
5660/// ScMetaKind is an XDR Enum defines as:
5661///
5662/// ```text
5663/// enum SCMetaKind
5664/// {
5665///     SC_META_V0 = 0
5666/// };
5667/// ```
5668///
5669// enum
5670#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
5671#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
5672#[cfg_attr(
5673    all(feature = "serde", feature = "alloc"),
5674    derive(serde::Serialize, serde::Deserialize),
5675    serde(rename_all = "snake_case")
5676)]
5677#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
5678#[repr(i32)]
5679pub enum ScMetaKind {
5680    ScMetaV0 = 0,
5681}
5682
5683impl ScMetaKind {
5684    pub const VARIANTS: [ScMetaKind; 1] = [ScMetaKind::ScMetaV0];
5685    pub const VARIANTS_STR: [&'static str; 1] = ["ScMetaV0"];
5686
5687    #[must_use]
5688    pub const fn name(&self) -> &'static str {
5689        match self {
5690            Self::ScMetaV0 => "ScMetaV0",
5691        }
5692    }
5693
5694    #[must_use]
5695    pub const fn variants() -> [ScMetaKind; 1] {
5696        Self::VARIANTS
5697    }
5698}
5699
5700impl Name for ScMetaKind {
5701    #[must_use]
5702    fn name(&self) -> &'static str {
5703        Self::name(self)
5704    }
5705}
5706
5707impl Variants<ScMetaKind> for ScMetaKind {
5708    fn variants() -> slice::Iter<'static, ScMetaKind> {
5709        Self::VARIANTS.iter()
5710    }
5711}
5712
5713impl Enum for ScMetaKind {}
5714
5715impl fmt::Display for ScMetaKind {
5716    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
5717        f.write_str(self.name())
5718    }
5719}
5720
5721impl TryFrom<i32> for ScMetaKind {
5722    type Error = Error;
5723
5724    fn try_from(i: i32) -> Result<Self> {
5725        let e = match i {
5726            0 => ScMetaKind::ScMetaV0,
5727            #[allow(unreachable_patterns)]
5728            _ => return Err(Error::Invalid),
5729        };
5730        Ok(e)
5731    }
5732}
5733
5734impl From<ScMetaKind> for i32 {
5735    #[must_use]
5736    fn from(e: ScMetaKind) -> Self {
5737        e as Self
5738    }
5739}
5740
5741impl ReadXdr for ScMetaKind {
5742    #[cfg(feature = "std")]
5743    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
5744        r.with_limited_depth(|r| {
5745            let e = i32::read_xdr(r)?;
5746            let v: Self = e.try_into()?;
5747            Ok(v)
5748        })
5749    }
5750}
5751
5752impl WriteXdr for ScMetaKind {
5753    #[cfg(feature = "std")]
5754    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
5755        w.with_limited_depth(|w| {
5756            let i: i32 = (*self).into();
5757            i.write_xdr(w)
5758        })
5759    }
5760}
5761
5762/// ScMetaEntry is an XDR Union defines as:
5763///
5764/// ```text
5765/// union SCMetaEntry switch (SCMetaKind kind)
5766/// {
5767/// case SC_META_V0:
5768///     SCMetaV0 v0;
5769/// };
5770/// ```
5771///
5772// union with discriminant ScMetaKind
5773#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
5774#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
5775#[cfg_attr(
5776    all(feature = "serde", feature = "alloc"),
5777    derive(serde::Serialize, serde::Deserialize),
5778    serde(rename_all = "snake_case")
5779)]
5780#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
5781#[allow(clippy::large_enum_variant)]
5782pub enum ScMetaEntry {
5783    ScMetaV0(ScMetaV0),
5784}
5785
5786impl ScMetaEntry {
5787    pub const VARIANTS: [ScMetaKind; 1] = [ScMetaKind::ScMetaV0];
5788    pub const VARIANTS_STR: [&'static str; 1] = ["ScMetaV0"];
5789
5790    #[must_use]
5791    pub const fn name(&self) -> &'static str {
5792        match self {
5793            Self::ScMetaV0(_) => "ScMetaV0",
5794        }
5795    }
5796
5797    #[must_use]
5798    pub const fn discriminant(&self) -> ScMetaKind {
5799        #[allow(clippy::match_same_arms)]
5800        match self {
5801            Self::ScMetaV0(_) => ScMetaKind::ScMetaV0,
5802        }
5803    }
5804
5805    #[must_use]
5806    pub const fn variants() -> [ScMetaKind; 1] {
5807        Self::VARIANTS
5808    }
5809}
5810
5811impl Name for ScMetaEntry {
5812    #[must_use]
5813    fn name(&self) -> &'static str {
5814        Self::name(self)
5815    }
5816}
5817
5818impl Discriminant<ScMetaKind> for ScMetaEntry {
5819    #[must_use]
5820    fn discriminant(&self) -> ScMetaKind {
5821        Self::discriminant(self)
5822    }
5823}
5824
5825impl Variants<ScMetaKind> for ScMetaEntry {
5826    fn variants() -> slice::Iter<'static, ScMetaKind> {
5827        Self::VARIANTS.iter()
5828    }
5829}
5830
5831impl Union<ScMetaKind> for ScMetaEntry {}
5832
5833impl ReadXdr for ScMetaEntry {
5834    #[cfg(feature = "std")]
5835    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
5836        r.with_limited_depth(|r| {
5837            let dv: ScMetaKind = <ScMetaKind as ReadXdr>::read_xdr(r)?;
5838            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
5839            let v = match dv {
5840                ScMetaKind::ScMetaV0 => Self::ScMetaV0(ScMetaV0::read_xdr(r)?),
5841                #[allow(unreachable_patterns)]
5842                _ => return Err(Error::Invalid),
5843            };
5844            Ok(v)
5845        })
5846    }
5847}
5848
5849impl WriteXdr for ScMetaEntry {
5850    #[cfg(feature = "std")]
5851    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
5852        w.with_limited_depth(|w| {
5853            self.discriminant().write_xdr(w)?;
5854            #[allow(clippy::match_same_arms)]
5855            match self {
5856                Self::ScMetaV0(v) => v.write_xdr(w)?,
5857            };
5858            Ok(())
5859        })
5860    }
5861}
5862
5863/// ScSpecDocLimit is an XDR Const defines as:
5864///
5865/// ```text
5866/// const SC_SPEC_DOC_LIMIT = 1024;
5867/// ```
5868///
5869pub const SC_SPEC_DOC_LIMIT: u64 = 1024;
5870
5871/// ScSpecType is an XDR Enum defines as:
5872///
5873/// ```text
5874/// enum SCSpecType
5875/// {
5876///     SC_SPEC_TYPE_VAL = 0,
5877///
5878///     // Types with no parameters.
5879///     SC_SPEC_TYPE_BOOL = 1,
5880///     SC_SPEC_TYPE_VOID = 2,
5881///     SC_SPEC_TYPE_ERROR = 3,
5882///     SC_SPEC_TYPE_U32 = 4,
5883///     SC_SPEC_TYPE_I32 = 5,
5884///     SC_SPEC_TYPE_U64 = 6,
5885///     SC_SPEC_TYPE_I64 = 7,
5886///     SC_SPEC_TYPE_TIMEPOINT = 8,
5887///     SC_SPEC_TYPE_DURATION = 9,
5888///     SC_SPEC_TYPE_U128 = 10,
5889///     SC_SPEC_TYPE_I128 = 11,
5890///     SC_SPEC_TYPE_U256 = 12,
5891///     SC_SPEC_TYPE_I256 = 13,
5892///     SC_SPEC_TYPE_BYTES = 14,
5893///     SC_SPEC_TYPE_STRING = 16,
5894///     SC_SPEC_TYPE_SYMBOL = 17,
5895///     SC_SPEC_TYPE_ADDRESS = 19,
5896///
5897///     // Types with parameters.
5898///     SC_SPEC_TYPE_OPTION = 1000,
5899///     SC_SPEC_TYPE_RESULT = 1001,
5900///     SC_SPEC_TYPE_VEC = 1002,
5901///     SC_SPEC_TYPE_MAP = 1004,
5902///     SC_SPEC_TYPE_TUPLE = 1005,
5903///     SC_SPEC_TYPE_BYTES_N = 1006,
5904///
5905///     // User defined types.
5906///     SC_SPEC_TYPE_UDT = 2000
5907/// };
5908/// ```
5909///
5910// enum
5911#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
5912#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
5913#[cfg_attr(
5914    all(feature = "serde", feature = "alloc"),
5915    derive(serde::Serialize, serde::Deserialize),
5916    serde(rename_all = "snake_case")
5917)]
5918#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
5919#[repr(i32)]
5920pub enum ScSpecType {
5921    Val = 0,
5922    Bool = 1,
5923    Void = 2,
5924    Error = 3,
5925    U32 = 4,
5926    I32 = 5,
5927    U64 = 6,
5928    I64 = 7,
5929    Timepoint = 8,
5930    Duration = 9,
5931    U128 = 10,
5932    I128 = 11,
5933    U256 = 12,
5934    I256 = 13,
5935    Bytes = 14,
5936    String = 16,
5937    Symbol = 17,
5938    Address = 19,
5939    Option = 1000,
5940    Result = 1001,
5941    Vec = 1002,
5942    Map = 1004,
5943    Tuple = 1005,
5944    BytesN = 1006,
5945    Udt = 2000,
5946}
5947
5948impl ScSpecType {
5949    pub const VARIANTS: [ScSpecType; 25] = [
5950        ScSpecType::Val,
5951        ScSpecType::Bool,
5952        ScSpecType::Void,
5953        ScSpecType::Error,
5954        ScSpecType::U32,
5955        ScSpecType::I32,
5956        ScSpecType::U64,
5957        ScSpecType::I64,
5958        ScSpecType::Timepoint,
5959        ScSpecType::Duration,
5960        ScSpecType::U128,
5961        ScSpecType::I128,
5962        ScSpecType::U256,
5963        ScSpecType::I256,
5964        ScSpecType::Bytes,
5965        ScSpecType::String,
5966        ScSpecType::Symbol,
5967        ScSpecType::Address,
5968        ScSpecType::Option,
5969        ScSpecType::Result,
5970        ScSpecType::Vec,
5971        ScSpecType::Map,
5972        ScSpecType::Tuple,
5973        ScSpecType::BytesN,
5974        ScSpecType::Udt,
5975    ];
5976    pub const VARIANTS_STR: [&'static str; 25] = [
5977        "Val",
5978        "Bool",
5979        "Void",
5980        "Error",
5981        "U32",
5982        "I32",
5983        "U64",
5984        "I64",
5985        "Timepoint",
5986        "Duration",
5987        "U128",
5988        "I128",
5989        "U256",
5990        "I256",
5991        "Bytes",
5992        "String",
5993        "Symbol",
5994        "Address",
5995        "Option",
5996        "Result",
5997        "Vec",
5998        "Map",
5999        "Tuple",
6000        "BytesN",
6001        "Udt",
6002    ];
6003
6004    #[must_use]
6005    pub const fn name(&self) -> &'static str {
6006        match self {
6007            Self::Val => "Val",
6008            Self::Bool => "Bool",
6009            Self::Void => "Void",
6010            Self::Error => "Error",
6011            Self::U32 => "U32",
6012            Self::I32 => "I32",
6013            Self::U64 => "U64",
6014            Self::I64 => "I64",
6015            Self::Timepoint => "Timepoint",
6016            Self::Duration => "Duration",
6017            Self::U128 => "U128",
6018            Self::I128 => "I128",
6019            Self::U256 => "U256",
6020            Self::I256 => "I256",
6021            Self::Bytes => "Bytes",
6022            Self::String => "String",
6023            Self::Symbol => "Symbol",
6024            Self::Address => "Address",
6025            Self::Option => "Option",
6026            Self::Result => "Result",
6027            Self::Vec => "Vec",
6028            Self::Map => "Map",
6029            Self::Tuple => "Tuple",
6030            Self::BytesN => "BytesN",
6031            Self::Udt => "Udt",
6032        }
6033    }
6034
6035    #[must_use]
6036    pub const fn variants() -> [ScSpecType; 25] {
6037        Self::VARIANTS
6038    }
6039}
6040
6041impl Name for ScSpecType {
6042    #[must_use]
6043    fn name(&self) -> &'static str {
6044        Self::name(self)
6045    }
6046}
6047
6048impl Variants<ScSpecType> for ScSpecType {
6049    fn variants() -> slice::Iter<'static, ScSpecType> {
6050        Self::VARIANTS.iter()
6051    }
6052}
6053
6054impl Enum for ScSpecType {}
6055
6056impl fmt::Display for ScSpecType {
6057    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
6058        f.write_str(self.name())
6059    }
6060}
6061
6062impl TryFrom<i32> for ScSpecType {
6063    type Error = Error;
6064
6065    fn try_from(i: i32) -> Result<Self> {
6066        let e = match i {
6067            0 => ScSpecType::Val,
6068            1 => ScSpecType::Bool,
6069            2 => ScSpecType::Void,
6070            3 => ScSpecType::Error,
6071            4 => ScSpecType::U32,
6072            5 => ScSpecType::I32,
6073            6 => ScSpecType::U64,
6074            7 => ScSpecType::I64,
6075            8 => ScSpecType::Timepoint,
6076            9 => ScSpecType::Duration,
6077            10 => ScSpecType::U128,
6078            11 => ScSpecType::I128,
6079            12 => ScSpecType::U256,
6080            13 => ScSpecType::I256,
6081            14 => ScSpecType::Bytes,
6082            16 => ScSpecType::String,
6083            17 => ScSpecType::Symbol,
6084            19 => ScSpecType::Address,
6085            1000 => ScSpecType::Option,
6086            1001 => ScSpecType::Result,
6087            1002 => ScSpecType::Vec,
6088            1004 => ScSpecType::Map,
6089            1005 => ScSpecType::Tuple,
6090            1006 => ScSpecType::BytesN,
6091            2000 => ScSpecType::Udt,
6092            #[allow(unreachable_patterns)]
6093            _ => return Err(Error::Invalid),
6094        };
6095        Ok(e)
6096    }
6097}
6098
6099impl From<ScSpecType> for i32 {
6100    #[must_use]
6101    fn from(e: ScSpecType) -> Self {
6102        e as Self
6103    }
6104}
6105
6106impl ReadXdr for ScSpecType {
6107    #[cfg(feature = "std")]
6108    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
6109        r.with_limited_depth(|r| {
6110            let e = i32::read_xdr(r)?;
6111            let v: Self = e.try_into()?;
6112            Ok(v)
6113        })
6114    }
6115}
6116
6117impl WriteXdr for ScSpecType {
6118    #[cfg(feature = "std")]
6119    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
6120        w.with_limited_depth(|w| {
6121            let i: i32 = (*self).into();
6122            i.write_xdr(w)
6123        })
6124    }
6125}
6126
6127/// ScSpecTypeOption is an XDR Struct defines as:
6128///
6129/// ```text
6130/// struct SCSpecTypeOption
6131/// {
6132///     SCSpecTypeDef valueType;
6133/// };
6134/// ```
6135///
6136#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
6137#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
6138#[cfg_attr(
6139    all(feature = "serde", feature = "alloc"),
6140    derive(serde::Serialize, serde::Deserialize),
6141    serde(rename_all = "snake_case")
6142)]
6143#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
6144pub struct ScSpecTypeOption {
6145    pub value_type: Box<ScSpecTypeDef>,
6146}
6147
6148impl ReadXdr for ScSpecTypeOption {
6149    #[cfg(feature = "std")]
6150    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
6151        r.with_limited_depth(|r| {
6152            Ok(Self {
6153                value_type: Box::<ScSpecTypeDef>::read_xdr(r)?,
6154            })
6155        })
6156    }
6157}
6158
6159impl WriteXdr for ScSpecTypeOption {
6160    #[cfg(feature = "std")]
6161    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
6162        w.with_limited_depth(|w| {
6163            self.value_type.write_xdr(w)?;
6164            Ok(())
6165        })
6166    }
6167}
6168
6169/// ScSpecTypeResult is an XDR Struct defines as:
6170///
6171/// ```text
6172/// struct SCSpecTypeResult
6173/// {
6174///     SCSpecTypeDef okType;
6175///     SCSpecTypeDef errorType;
6176/// };
6177/// ```
6178///
6179#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
6180#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
6181#[cfg_attr(
6182    all(feature = "serde", feature = "alloc"),
6183    derive(serde::Serialize, serde::Deserialize),
6184    serde(rename_all = "snake_case")
6185)]
6186#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
6187pub struct ScSpecTypeResult {
6188    pub ok_type: Box<ScSpecTypeDef>,
6189    pub error_type: Box<ScSpecTypeDef>,
6190}
6191
6192impl ReadXdr for ScSpecTypeResult {
6193    #[cfg(feature = "std")]
6194    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
6195        r.with_limited_depth(|r| {
6196            Ok(Self {
6197                ok_type: Box::<ScSpecTypeDef>::read_xdr(r)?,
6198                error_type: Box::<ScSpecTypeDef>::read_xdr(r)?,
6199            })
6200        })
6201    }
6202}
6203
6204impl WriteXdr for ScSpecTypeResult {
6205    #[cfg(feature = "std")]
6206    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
6207        w.with_limited_depth(|w| {
6208            self.ok_type.write_xdr(w)?;
6209            self.error_type.write_xdr(w)?;
6210            Ok(())
6211        })
6212    }
6213}
6214
6215/// ScSpecTypeVec is an XDR Struct defines as:
6216///
6217/// ```text
6218/// struct SCSpecTypeVec
6219/// {
6220///     SCSpecTypeDef elementType;
6221/// };
6222/// ```
6223///
6224#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
6225#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
6226#[cfg_attr(
6227    all(feature = "serde", feature = "alloc"),
6228    derive(serde::Serialize, serde::Deserialize),
6229    serde(rename_all = "snake_case")
6230)]
6231#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
6232pub struct ScSpecTypeVec {
6233    pub element_type: Box<ScSpecTypeDef>,
6234}
6235
6236impl ReadXdr for ScSpecTypeVec {
6237    #[cfg(feature = "std")]
6238    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
6239        r.with_limited_depth(|r| {
6240            Ok(Self {
6241                element_type: Box::<ScSpecTypeDef>::read_xdr(r)?,
6242            })
6243        })
6244    }
6245}
6246
6247impl WriteXdr for ScSpecTypeVec {
6248    #[cfg(feature = "std")]
6249    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
6250        w.with_limited_depth(|w| {
6251            self.element_type.write_xdr(w)?;
6252            Ok(())
6253        })
6254    }
6255}
6256
6257/// ScSpecTypeMap is an XDR Struct defines as:
6258///
6259/// ```text
6260/// struct SCSpecTypeMap
6261/// {
6262///     SCSpecTypeDef keyType;
6263///     SCSpecTypeDef valueType;
6264/// };
6265/// ```
6266///
6267#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
6268#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
6269#[cfg_attr(
6270    all(feature = "serde", feature = "alloc"),
6271    derive(serde::Serialize, serde::Deserialize),
6272    serde(rename_all = "snake_case")
6273)]
6274#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
6275pub struct ScSpecTypeMap {
6276    pub key_type: Box<ScSpecTypeDef>,
6277    pub value_type: Box<ScSpecTypeDef>,
6278}
6279
6280impl ReadXdr for ScSpecTypeMap {
6281    #[cfg(feature = "std")]
6282    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
6283        r.with_limited_depth(|r| {
6284            Ok(Self {
6285                key_type: Box::<ScSpecTypeDef>::read_xdr(r)?,
6286                value_type: Box::<ScSpecTypeDef>::read_xdr(r)?,
6287            })
6288        })
6289    }
6290}
6291
6292impl WriteXdr for ScSpecTypeMap {
6293    #[cfg(feature = "std")]
6294    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
6295        w.with_limited_depth(|w| {
6296            self.key_type.write_xdr(w)?;
6297            self.value_type.write_xdr(w)?;
6298            Ok(())
6299        })
6300    }
6301}
6302
6303/// ScSpecTypeTuple is an XDR Struct defines as:
6304///
6305/// ```text
6306/// struct SCSpecTypeTuple
6307/// {
6308///     SCSpecTypeDef valueTypes<12>;
6309/// };
6310/// ```
6311///
6312#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
6313#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
6314#[cfg_attr(
6315    all(feature = "serde", feature = "alloc"),
6316    derive(serde::Serialize, serde::Deserialize),
6317    serde(rename_all = "snake_case")
6318)]
6319#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
6320pub struct ScSpecTypeTuple {
6321    pub value_types: VecM<ScSpecTypeDef, 12>,
6322}
6323
6324impl ReadXdr for ScSpecTypeTuple {
6325    #[cfg(feature = "std")]
6326    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
6327        r.with_limited_depth(|r| {
6328            Ok(Self {
6329                value_types: VecM::<ScSpecTypeDef, 12>::read_xdr(r)?,
6330            })
6331        })
6332    }
6333}
6334
6335impl WriteXdr for ScSpecTypeTuple {
6336    #[cfg(feature = "std")]
6337    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
6338        w.with_limited_depth(|w| {
6339            self.value_types.write_xdr(w)?;
6340            Ok(())
6341        })
6342    }
6343}
6344
6345/// ScSpecTypeBytesN is an XDR Struct defines as:
6346///
6347/// ```text
6348/// struct SCSpecTypeBytesN
6349/// {
6350///     uint32 n;
6351/// };
6352/// ```
6353///
6354#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
6355#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
6356#[cfg_attr(
6357    all(feature = "serde", feature = "alloc"),
6358    derive(serde::Serialize, serde::Deserialize),
6359    serde(rename_all = "snake_case")
6360)]
6361#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
6362pub struct ScSpecTypeBytesN {
6363    pub n: u32,
6364}
6365
6366impl ReadXdr for ScSpecTypeBytesN {
6367    #[cfg(feature = "std")]
6368    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
6369        r.with_limited_depth(|r| {
6370            Ok(Self {
6371                n: u32::read_xdr(r)?,
6372            })
6373        })
6374    }
6375}
6376
6377impl WriteXdr for ScSpecTypeBytesN {
6378    #[cfg(feature = "std")]
6379    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
6380        w.with_limited_depth(|w| {
6381            self.n.write_xdr(w)?;
6382            Ok(())
6383        })
6384    }
6385}
6386
6387/// ScSpecTypeUdt is an XDR Struct defines as:
6388///
6389/// ```text
6390/// struct SCSpecTypeUDT
6391/// {
6392///     string name<60>;
6393/// };
6394/// ```
6395///
6396#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
6397#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
6398#[cfg_attr(
6399    all(feature = "serde", feature = "alloc"),
6400    derive(serde::Serialize, serde::Deserialize),
6401    serde(rename_all = "snake_case")
6402)]
6403#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
6404pub struct ScSpecTypeUdt {
6405    pub name: StringM<60>,
6406}
6407
6408impl ReadXdr for ScSpecTypeUdt {
6409    #[cfg(feature = "std")]
6410    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
6411        r.with_limited_depth(|r| {
6412            Ok(Self {
6413                name: StringM::<60>::read_xdr(r)?,
6414            })
6415        })
6416    }
6417}
6418
6419impl WriteXdr for ScSpecTypeUdt {
6420    #[cfg(feature = "std")]
6421    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
6422        w.with_limited_depth(|w| {
6423            self.name.write_xdr(w)?;
6424            Ok(())
6425        })
6426    }
6427}
6428
6429/// ScSpecTypeDef is an XDR Union defines as:
6430///
6431/// ```text
6432/// union SCSpecTypeDef switch (SCSpecType type)
6433/// {
6434/// case SC_SPEC_TYPE_VAL:
6435/// case SC_SPEC_TYPE_BOOL:
6436/// case SC_SPEC_TYPE_VOID:
6437/// case SC_SPEC_TYPE_ERROR:
6438/// case SC_SPEC_TYPE_U32:
6439/// case SC_SPEC_TYPE_I32:
6440/// case SC_SPEC_TYPE_U64:
6441/// case SC_SPEC_TYPE_I64:
6442/// case SC_SPEC_TYPE_TIMEPOINT:
6443/// case SC_SPEC_TYPE_DURATION:
6444/// case SC_SPEC_TYPE_U128:
6445/// case SC_SPEC_TYPE_I128:
6446/// case SC_SPEC_TYPE_U256:
6447/// case SC_SPEC_TYPE_I256:
6448/// case SC_SPEC_TYPE_BYTES:
6449/// case SC_SPEC_TYPE_STRING:
6450/// case SC_SPEC_TYPE_SYMBOL:
6451/// case SC_SPEC_TYPE_ADDRESS:
6452///     void;
6453/// case SC_SPEC_TYPE_OPTION:
6454///     SCSpecTypeOption option;
6455/// case SC_SPEC_TYPE_RESULT:
6456///     SCSpecTypeResult result;
6457/// case SC_SPEC_TYPE_VEC:
6458///     SCSpecTypeVec vec;
6459/// case SC_SPEC_TYPE_MAP:
6460///     SCSpecTypeMap map;
6461/// case SC_SPEC_TYPE_TUPLE:
6462///     SCSpecTypeTuple tuple;
6463/// case SC_SPEC_TYPE_BYTES_N:
6464///     SCSpecTypeBytesN bytesN;
6465/// case SC_SPEC_TYPE_UDT:
6466///     SCSpecTypeUDT udt;
6467/// };
6468/// ```
6469///
6470// union with discriminant ScSpecType
6471#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
6472#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
6473#[cfg_attr(
6474    all(feature = "serde", feature = "alloc"),
6475    derive(serde::Serialize, serde::Deserialize),
6476    serde(rename_all = "snake_case")
6477)]
6478#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
6479#[allow(clippy::large_enum_variant)]
6480pub enum ScSpecTypeDef {
6481    Val,
6482    Bool,
6483    Void,
6484    Error,
6485    U32,
6486    I32,
6487    U64,
6488    I64,
6489    Timepoint,
6490    Duration,
6491    U128,
6492    I128,
6493    U256,
6494    I256,
6495    Bytes,
6496    String,
6497    Symbol,
6498    Address,
6499    Option(Box<ScSpecTypeOption>),
6500    Result(Box<ScSpecTypeResult>),
6501    Vec(Box<ScSpecTypeVec>),
6502    Map(Box<ScSpecTypeMap>),
6503    Tuple(Box<ScSpecTypeTuple>),
6504    BytesN(ScSpecTypeBytesN),
6505    Udt(ScSpecTypeUdt),
6506}
6507
6508impl ScSpecTypeDef {
6509    pub const VARIANTS: [ScSpecType; 25] = [
6510        ScSpecType::Val,
6511        ScSpecType::Bool,
6512        ScSpecType::Void,
6513        ScSpecType::Error,
6514        ScSpecType::U32,
6515        ScSpecType::I32,
6516        ScSpecType::U64,
6517        ScSpecType::I64,
6518        ScSpecType::Timepoint,
6519        ScSpecType::Duration,
6520        ScSpecType::U128,
6521        ScSpecType::I128,
6522        ScSpecType::U256,
6523        ScSpecType::I256,
6524        ScSpecType::Bytes,
6525        ScSpecType::String,
6526        ScSpecType::Symbol,
6527        ScSpecType::Address,
6528        ScSpecType::Option,
6529        ScSpecType::Result,
6530        ScSpecType::Vec,
6531        ScSpecType::Map,
6532        ScSpecType::Tuple,
6533        ScSpecType::BytesN,
6534        ScSpecType::Udt,
6535    ];
6536    pub const VARIANTS_STR: [&'static str; 25] = [
6537        "Val",
6538        "Bool",
6539        "Void",
6540        "Error",
6541        "U32",
6542        "I32",
6543        "U64",
6544        "I64",
6545        "Timepoint",
6546        "Duration",
6547        "U128",
6548        "I128",
6549        "U256",
6550        "I256",
6551        "Bytes",
6552        "String",
6553        "Symbol",
6554        "Address",
6555        "Option",
6556        "Result",
6557        "Vec",
6558        "Map",
6559        "Tuple",
6560        "BytesN",
6561        "Udt",
6562    ];
6563
6564    #[must_use]
6565    pub const fn name(&self) -> &'static str {
6566        match self {
6567            Self::Val => "Val",
6568            Self::Bool => "Bool",
6569            Self::Void => "Void",
6570            Self::Error => "Error",
6571            Self::U32 => "U32",
6572            Self::I32 => "I32",
6573            Self::U64 => "U64",
6574            Self::I64 => "I64",
6575            Self::Timepoint => "Timepoint",
6576            Self::Duration => "Duration",
6577            Self::U128 => "U128",
6578            Self::I128 => "I128",
6579            Self::U256 => "U256",
6580            Self::I256 => "I256",
6581            Self::Bytes => "Bytes",
6582            Self::String => "String",
6583            Self::Symbol => "Symbol",
6584            Self::Address => "Address",
6585            Self::Option(_) => "Option",
6586            Self::Result(_) => "Result",
6587            Self::Vec(_) => "Vec",
6588            Self::Map(_) => "Map",
6589            Self::Tuple(_) => "Tuple",
6590            Self::BytesN(_) => "BytesN",
6591            Self::Udt(_) => "Udt",
6592        }
6593    }
6594
6595    #[must_use]
6596    pub const fn discriminant(&self) -> ScSpecType {
6597        #[allow(clippy::match_same_arms)]
6598        match self {
6599            Self::Val => ScSpecType::Val,
6600            Self::Bool => ScSpecType::Bool,
6601            Self::Void => ScSpecType::Void,
6602            Self::Error => ScSpecType::Error,
6603            Self::U32 => ScSpecType::U32,
6604            Self::I32 => ScSpecType::I32,
6605            Self::U64 => ScSpecType::U64,
6606            Self::I64 => ScSpecType::I64,
6607            Self::Timepoint => ScSpecType::Timepoint,
6608            Self::Duration => ScSpecType::Duration,
6609            Self::U128 => ScSpecType::U128,
6610            Self::I128 => ScSpecType::I128,
6611            Self::U256 => ScSpecType::U256,
6612            Self::I256 => ScSpecType::I256,
6613            Self::Bytes => ScSpecType::Bytes,
6614            Self::String => ScSpecType::String,
6615            Self::Symbol => ScSpecType::Symbol,
6616            Self::Address => ScSpecType::Address,
6617            Self::Option(_) => ScSpecType::Option,
6618            Self::Result(_) => ScSpecType::Result,
6619            Self::Vec(_) => ScSpecType::Vec,
6620            Self::Map(_) => ScSpecType::Map,
6621            Self::Tuple(_) => ScSpecType::Tuple,
6622            Self::BytesN(_) => ScSpecType::BytesN,
6623            Self::Udt(_) => ScSpecType::Udt,
6624        }
6625    }
6626
6627    #[must_use]
6628    pub const fn variants() -> [ScSpecType; 25] {
6629        Self::VARIANTS
6630    }
6631}
6632
6633impl Name for ScSpecTypeDef {
6634    #[must_use]
6635    fn name(&self) -> &'static str {
6636        Self::name(self)
6637    }
6638}
6639
6640impl Discriminant<ScSpecType> for ScSpecTypeDef {
6641    #[must_use]
6642    fn discriminant(&self) -> ScSpecType {
6643        Self::discriminant(self)
6644    }
6645}
6646
6647impl Variants<ScSpecType> for ScSpecTypeDef {
6648    fn variants() -> slice::Iter<'static, ScSpecType> {
6649        Self::VARIANTS.iter()
6650    }
6651}
6652
6653impl Union<ScSpecType> for ScSpecTypeDef {}
6654
6655impl ReadXdr for ScSpecTypeDef {
6656    #[cfg(feature = "std")]
6657    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
6658        r.with_limited_depth(|r| {
6659            let dv: ScSpecType = <ScSpecType as ReadXdr>::read_xdr(r)?;
6660            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
6661            let v = match dv {
6662                ScSpecType::Val => Self::Val,
6663                ScSpecType::Bool => Self::Bool,
6664                ScSpecType::Void => Self::Void,
6665                ScSpecType::Error => Self::Error,
6666                ScSpecType::U32 => Self::U32,
6667                ScSpecType::I32 => Self::I32,
6668                ScSpecType::U64 => Self::U64,
6669                ScSpecType::I64 => Self::I64,
6670                ScSpecType::Timepoint => Self::Timepoint,
6671                ScSpecType::Duration => Self::Duration,
6672                ScSpecType::U128 => Self::U128,
6673                ScSpecType::I128 => Self::I128,
6674                ScSpecType::U256 => Self::U256,
6675                ScSpecType::I256 => Self::I256,
6676                ScSpecType::Bytes => Self::Bytes,
6677                ScSpecType::String => Self::String,
6678                ScSpecType::Symbol => Self::Symbol,
6679                ScSpecType::Address => Self::Address,
6680                ScSpecType::Option => Self::Option(Box::<ScSpecTypeOption>::read_xdr(r)?),
6681                ScSpecType::Result => Self::Result(Box::<ScSpecTypeResult>::read_xdr(r)?),
6682                ScSpecType::Vec => Self::Vec(Box::<ScSpecTypeVec>::read_xdr(r)?),
6683                ScSpecType::Map => Self::Map(Box::<ScSpecTypeMap>::read_xdr(r)?),
6684                ScSpecType::Tuple => Self::Tuple(Box::<ScSpecTypeTuple>::read_xdr(r)?),
6685                ScSpecType::BytesN => Self::BytesN(ScSpecTypeBytesN::read_xdr(r)?),
6686                ScSpecType::Udt => Self::Udt(ScSpecTypeUdt::read_xdr(r)?),
6687                #[allow(unreachable_patterns)]
6688                _ => return Err(Error::Invalid),
6689            };
6690            Ok(v)
6691        })
6692    }
6693}
6694
6695impl WriteXdr for ScSpecTypeDef {
6696    #[cfg(feature = "std")]
6697    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
6698        w.with_limited_depth(|w| {
6699            self.discriminant().write_xdr(w)?;
6700            #[allow(clippy::match_same_arms)]
6701            match self {
6702                Self::Val => ().write_xdr(w)?,
6703                Self::Bool => ().write_xdr(w)?,
6704                Self::Void => ().write_xdr(w)?,
6705                Self::Error => ().write_xdr(w)?,
6706                Self::U32 => ().write_xdr(w)?,
6707                Self::I32 => ().write_xdr(w)?,
6708                Self::U64 => ().write_xdr(w)?,
6709                Self::I64 => ().write_xdr(w)?,
6710                Self::Timepoint => ().write_xdr(w)?,
6711                Self::Duration => ().write_xdr(w)?,
6712                Self::U128 => ().write_xdr(w)?,
6713                Self::I128 => ().write_xdr(w)?,
6714                Self::U256 => ().write_xdr(w)?,
6715                Self::I256 => ().write_xdr(w)?,
6716                Self::Bytes => ().write_xdr(w)?,
6717                Self::String => ().write_xdr(w)?,
6718                Self::Symbol => ().write_xdr(w)?,
6719                Self::Address => ().write_xdr(w)?,
6720                Self::Option(v) => v.write_xdr(w)?,
6721                Self::Result(v) => v.write_xdr(w)?,
6722                Self::Vec(v) => v.write_xdr(w)?,
6723                Self::Map(v) => v.write_xdr(w)?,
6724                Self::Tuple(v) => v.write_xdr(w)?,
6725                Self::BytesN(v) => v.write_xdr(w)?,
6726                Self::Udt(v) => v.write_xdr(w)?,
6727            };
6728            Ok(())
6729        })
6730    }
6731}
6732
6733/// ScSpecUdtStructFieldV0 is an XDR Struct defines as:
6734///
6735/// ```text
6736/// struct SCSpecUDTStructFieldV0
6737/// {
6738///     string doc<SC_SPEC_DOC_LIMIT>;
6739///     string name<30>;
6740///     SCSpecTypeDef type;
6741/// };
6742/// ```
6743///
6744#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
6745#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
6746#[cfg_attr(
6747    all(feature = "serde", feature = "alloc"),
6748    derive(serde::Serialize, serde::Deserialize),
6749    serde(rename_all = "snake_case")
6750)]
6751#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
6752pub struct ScSpecUdtStructFieldV0 {
6753    pub doc: StringM<1024>,
6754    pub name: StringM<30>,
6755    pub type_: ScSpecTypeDef,
6756}
6757
6758impl ReadXdr for ScSpecUdtStructFieldV0 {
6759    #[cfg(feature = "std")]
6760    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
6761        r.with_limited_depth(|r| {
6762            Ok(Self {
6763                doc: StringM::<1024>::read_xdr(r)?,
6764                name: StringM::<30>::read_xdr(r)?,
6765                type_: ScSpecTypeDef::read_xdr(r)?,
6766            })
6767        })
6768    }
6769}
6770
6771impl WriteXdr for ScSpecUdtStructFieldV0 {
6772    #[cfg(feature = "std")]
6773    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
6774        w.with_limited_depth(|w| {
6775            self.doc.write_xdr(w)?;
6776            self.name.write_xdr(w)?;
6777            self.type_.write_xdr(w)?;
6778            Ok(())
6779        })
6780    }
6781}
6782
6783/// ScSpecUdtStructV0 is an XDR Struct defines as:
6784///
6785/// ```text
6786/// struct SCSpecUDTStructV0
6787/// {
6788///     string doc<SC_SPEC_DOC_LIMIT>;
6789///     string lib<80>;
6790///     string name<60>;
6791///     SCSpecUDTStructFieldV0 fields<40>;
6792/// };
6793/// ```
6794///
6795#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
6796#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
6797#[cfg_attr(
6798    all(feature = "serde", feature = "alloc"),
6799    derive(serde::Serialize, serde::Deserialize),
6800    serde(rename_all = "snake_case")
6801)]
6802#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
6803pub struct ScSpecUdtStructV0 {
6804    pub doc: StringM<1024>,
6805    pub lib: StringM<80>,
6806    pub name: StringM<60>,
6807    pub fields: VecM<ScSpecUdtStructFieldV0, 40>,
6808}
6809
6810impl ReadXdr for ScSpecUdtStructV0 {
6811    #[cfg(feature = "std")]
6812    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
6813        r.with_limited_depth(|r| {
6814            Ok(Self {
6815                doc: StringM::<1024>::read_xdr(r)?,
6816                lib: StringM::<80>::read_xdr(r)?,
6817                name: StringM::<60>::read_xdr(r)?,
6818                fields: VecM::<ScSpecUdtStructFieldV0, 40>::read_xdr(r)?,
6819            })
6820        })
6821    }
6822}
6823
6824impl WriteXdr for ScSpecUdtStructV0 {
6825    #[cfg(feature = "std")]
6826    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
6827        w.with_limited_depth(|w| {
6828            self.doc.write_xdr(w)?;
6829            self.lib.write_xdr(w)?;
6830            self.name.write_xdr(w)?;
6831            self.fields.write_xdr(w)?;
6832            Ok(())
6833        })
6834    }
6835}
6836
6837/// ScSpecUdtUnionCaseVoidV0 is an XDR Struct defines as:
6838///
6839/// ```text
6840/// struct SCSpecUDTUnionCaseVoidV0
6841/// {
6842///     string doc<SC_SPEC_DOC_LIMIT>;
6843///     string name<60>;
6844/// };
6845/// ```
6846///
6847#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
6848#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
6849#[cfg_attr(
6850    all(feature = "serde", feature = "alloc"),
6851    derive(serde::Serialize, serde::Deserialize),
6852    serde(rename_all = "snake_case")
6853)]
6854#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
6855pub struct ScSpecUdtUnionCaseVoidV0 {
6856    pub doc: StringM<1024>,
6857    pub name: StringM<60>,
6858}
6859
6860impl ReadXdr for ScSpecUdtUnionCaseVoidV0 {
6861    #[cfg(feature = "std")]
6862    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
6863        r.with_limited_depth(|r| {
6864            Ok(Self {
6865                doc: StringM::<1024>::read_xdr(r)?,
6866                name: StringM::<60>::read_xdr(r)?,
6867            })
6868        })
6869    }
6870}
6871
6872impl WriteXdr for ScSpecUdtUnionCaseVoidV0 {
6873    #[cfg(feature = "std")]
6874    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
6875        w.with_limited_depth(|w| {
6876            self.doc.write_xdr(w)?;
6877            self.name.write_xdr(w)?;
6878            Ok(())
6879        })
6880    }
6881}
6882
6883/// ScSpecUdtUnionCaseTupleV0 is an XDR Struct defines as:
6884///
6885/// ```text
6886/// struct SCSpecUDTUnionCaseTupleV0
6887/// {
6888///     string doc<SC_SPEC_DOC_LIMIT>;
6889///     string name<60>;
6890///     SCSpecTypeDef type<12>;
6891/// };
6892/// ```
6893///
6894#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
6895#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
6896#[cfg_attr(
6897    all(feature = "serde", feature = "alloc"),
6898    derive(serde::Serialize, serde::Deserialize),
6899    serde(rename_all = "snake_case")
6900)]
6901#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
6902pub struct ScSpecUdtUnionCaseTupleV0 {
6903    pub doc: StringM<1024>,
6904    pub name: StringM<60>,
6905    pub type_: VecM<ScSpecTypeDef, 12>,
6906}
6907
6908impl ReadXdr for ScSpecUdtUnionCaseTupleV0 {
6909    #[cfg(feature = "std")]
6910    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
6911        r.with_limited_depth(|r| {
6912            Ok(Self {
6913                doc: StringM::<1024>::read_xdr(r)?,
6914                name: StringM::<60>::read_xdr(r)?,
6915                type_: VecM::<ScSpecTypeDef, 12>::read_xdr(r)?,
6916            })
6917        })
6918    }
6919}
6920
6921impl WriteXdr for ScSpecUdtUnionCaseTupleV0 {
6922    #[cfg(feature = "std")]
6923    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
6924        w.with_limited_depth(|w| {
6925            self.doc.write_xdr(w)?;
6926            self.name.write_xdr(w)?;
6927            self.type_.write_xdr(w)?;
6928            Ok(())
6929        })
6930    }
6931}
6932
6933/// ScSpecUdtUnionCaseV0Kind is an XDR Enum defines as:
6934///
6935/// ```text
6936/// enum SCSpecUDTUnionCaseV0Kind
6937/// {
6938///     SC_SPEC_UDT_UNION_CASE_VOID_V0 = 0,
6939///     SC_SPEC_UDT_UNION_CASE_TUPLE_V0 = 1
6940/// };
6941/// ```
6942///
6943// enum
6944#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
6945#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
6946#[cfg_attr(
6947    all(feature = "serde", feature = "alloc"),
6948    derive(serde::Serialize, serde::Deserialize),
6949    serde(rename_all = "snake_case")
6950)]
6951#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
6952#[repr(i32)]
6953pub enum ScSpecUdtUnionCaseV0Kind {
6954    VoidV0 = 0,
6955    TupleV0 = 1,
6956}
6957
6958impl ScSpecUdtUnionCaseV0Kind {
6959    pub const VARIANTS: [ScSpecUdtUnionCaseV0Kind; 2] = [
6960        ScSpecUdtUnionCaseV0Kind::VoidV0,
6961        ScSpecUdtUnionCaseV0Kind::TupleV0,
6962    ];
6963    pub const VARIANTS_STR: [&'static str; 2] = ["VoidV0", "TupleV0"];
6964
6965    #[must_use]
6966    pub const fn name(&self) -> &'static str {
6967        match self {
6968            Self::VoidV0 => "VoidV0",
6969            Self::TupleV0 => "TupleV0",
6970        }
6971    }
6972
6973    #[must_use]
6974    pub const fn variants() -> [ScSpecUdtUnionCaseV0Kind; 2] {
6975        Self::VARIANTS
6976    }
6977}
6978
6979impl Name for ScSpecUdtUnionCaseV0Kind {
6980    #[must_use]
6981    fn name(&self) -> &'static str {
6982        Self::name(self)
6983    }
6984}
6985
6986impl Variants<ScSpecUdtUnionCaseV0Kind> for ScSpecUdtUnionCaseV0Kind {
6987    fn variants() -> slice::Iter<'static, ScSpecUdtUnionCaseV0Kind> {
6988        Self::VARIANTS.iter()
6989    }
6990}
6991
6992impl Enum for ScSpecUdtUnionCaseV0Kind {}
6993
6994impl fmt::Display for ScSpecUdtUnionCaseV0Kind {
6995    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
6996        f.write_str(self.name())
6997    }
6998}
6999
7000impl TryFrom<i32> for ScSpecUdtUnionCaseV0Kind {
7001    type Error = Error;
7002
7003    fn try_from(i: i32) -> Result<Self> {
7004        let e = match i {
7005            0 => ScSpecUdtUnionCaseV0Kind::VoidV0,
7006            1 => ScSpecUdtUnionCaseV0Kind::TupleV0,
7007            #[allow(unreachable_patterns)]
7008            _ => return Err(Error::Invalid),
7009        };
7010        Ok(e)
7011    }
7012}
7013
7014impl From<ScSpecUdtUnionCaseV0Kind> for i32 {
7015    #[must_use]
7016    fn from(e: ScSpecUdtUnionCaseV0Kind) -> Self {
7017        e as Self
7018    }
7019}
7020
7021impl ReadXdr for ScSpecUdtUnionCaseV0Kind {
7022    #[cfg(feature = "std")]
7023    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
7024        r.with_limited_depth(|r| {
7025            let e = i32::read_xdr(r)?;
7026            let v: Self = e.try_into()?;
7027            Ok(v)
7028        })
7029    }
7030}
7031
7032impl WriteXdr for ScSpecUdtUnionCaseV0Kind {
7033    #[cfg(feature = "std")]
7034    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
7035        w.with_limited_depth(|w| {
7036            let i: i32 = (*self).into();
7037            i.write_xdr(w)
7038        })
7039    }
7040}
7041
7042/// ScSpecUdtUnionCaseV0 is an XDR Union defines as:
7043///
7044/// ```text
7045/// union SCSpecUDTUnionCaseV0 switch (SCSpecUDTUnionCaseV0Kind kind)
7046/// {
7047/// case SC_SPEC_UDT_UNION_CASE_VOID_V0:
7048///     SCSpecUDTUnionCaseVoidV0 voidCase;
7049/// case SC_SPEC_UDT_UNION_CASE_TUPLE_V0:
7050///     SCSpecUDTUnionCaseTupleV0 tupleCase;
7051/// };
7052/// ```
7053///
7054// union with discriminant ScSpecUdtUnionCaseV0Kind
7055#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
7056#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
7057#[cfg_attr(
7058    all(feature = "serde", feature = "alloc"),
7059    derive(serde::Serialize, serde::Deserialize),
7060    serde(rename_all = "snake_case")
7061)]
7062#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
7063#[allow(clippy::large_enum_variant)]
7064pub enum ScSpecUdtUnionCaseV0 {
7065    VoidV0(ScSpecUdtUnionCaseVoidV0),
7066    TupleV0(ScSpecUdtUnionCaseTupleV0),
7067}
7068
7069impl ScSpecUdtUnionCaseV0 {
7070    pub const VARIANTS: [ScSpecUdtUnionCaseV0Kind; 2] = [
7071        ScSpecUdtUnionCaseV0Kind::VoidV0,
7072        ScSpecUdtUnionCaseV0Kind::TupleV0,
7073    ];
7074    pub const VARIANTS_STR: [&'static str; 2] = ["VoidV0", "TupleV0"];
7075
7076    #[must_use]
7077    pub const fn name(&self) -> &'static str {
7078        match self {
7079            Self::VoidV0(_) => "VoidV0",
7080            Self::TupleV0(_) => "TupleV0",
7081        }
7082    }
7083
7084    #[must_use]
7085    pub const fn discriminant(&self) -> ScSpecUdtUnionCaseV0Kind {
7086        #[allow(clippy::match_same_arms)]
7087        match self {
7088            Self::VoidV0(_) => ScSpecUdtUnionCaseV0Kind::VoidV0,
7089            Self::TupleV0(_) => ScSpecUdtUnionCaseV0Kind::TupleV0,
7090        }
7091    }
7092
7093    #[must_use]
7094    pub const fn variants() -> [ScSpecUdtUnionCaseV0Kind; 2] {
7095        Self::VARIANTS
7096    }
7097}
7098
7099impl Name for ScSpecUdtUnionCaseV0 {
7100    #[must_use]
7101    fn name(&self) -> &'static str {
7102        Self::name(self)
7103    }
7104}
7105
7106impl Discriminant<ScSpecUdtUnionCaseV0Kind> for ScSpecUdtUnionCaseV0 {
7107    #[must_use]
7108    fn discriminant(&self) -> ScSpecUdtUnionCaseV0Kind {
7109        Self::discriminant(self)
7110    }
7111}
7112
7113impl Variants<ScSpecUdtUnionCaseV0Kind> for ScSpecUdtUnionCaseV0 {
7114    fn variants() -> slice::Iter<'static, ScSpecUdtUnionCaseV0Kind> {
7115        Self::VARIANTS.iter()
7116    }
7117}
7118
7119impl Union<ScSpecUdtUnionCaseV0Kind> for ScSpecUdtUnionCaseV0 {}
7120
7121impl ReadXdr for ScSpecUdtUnionCaseV0 {
7122    #[cfg(feature = "std")]
7123    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
7124        r.with_limited_depth(|r| {
7125            let dv: ScSpecUdtUnionCaseV0Kind = <ScSpecUdtUnionCaseV0Kind as ReadXdr>::read_xdr(r)?;
7126            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
7127            let v = match dv {
7128                ScSpecUdtUnionCaseV0Kind::VoidV0 => {
7129                    Self::VoidV0(ScSpecUdtUnionCaseVoidV0::read_xdr(r)?)
7130                }
7131                ScSpecUdtUnionCaseV0Kind::TupleV0 => {
7132                    Self::TupleV0(ScSpecUdtUnionCaseTupleV0::read_xdr(r)?)
7133                }
7134                #[allow(unreachable_patterns)]
7135                _ => return Err(Error::Invalid),
7136            };
7137            Ok(v)
7138        })
7139    }
7140}
7141
7142impl WriteXdr for ScSpecUdtUnionCaseV0 {
7143    #[cfg(feature = "std")]
7144    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
7145        w.with_limited_depth(|w| {
7146            self.discriminant().write_xdr(w)?;
7147            #[allow(clippy::match_same_arms)]
7148            match self {
7149                Self::VoidV0(v) => v.write_xdr(w)?,
7150                Self::TupleV0(v) => v.write_xdr(w)?,
7151            };
7152            Ok(())
7153        })
7154    }
7155}
7156
7157/// ScSpecUdtUnionV0 is an XDR Struct defines as:
7158///
7159/// ```text
7160/// struct SCSpecUDTUnionV0
7161/// {
7162///     string doc<SC_SPEC_DOC_LIMIT>;
7163///     string lib<80>;
7164///     string name<60>;
7165///     SCSpecUDTUnionCaseV0 cases<50>;
7166/// };
7167/// ```
7168///
7169#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
7170#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
7171#[cfg_attr(
7172    all(feature = "serde", feature = "alloc"),
7173    derive(serde::Serialize, serde::Deserialize),
7174    serde(rename_all = "snake_case")
7175)]
7176#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
7177pub struct ScSpecUdtUnionV0 {
7178    pub doc: StringM<1024>,
7179    pub lib: StringM<80>,
7180    pub name: StringM<60>,
7181    pub cases: VecM<ScSpecUdtUnionCaseV0, 50>,
7182}
7183
7184impl ReadXdr for ScSpecUdtUnionV0 {
7185    #[cfg(feature = "std")]
7186    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
7187        r.with_limited_depth(|r| {
7188            Ok(Self {
7189                doc: StringM::<1024>::read_xdr(r)?,
7190                lib: StringM::<80>::read_xdr(r)?,
7191                name: StringM::<60>::read_xdr(r)?,
7192                cases: VecM::<ScSpecUdtUnionCaseV0, 50>::read_xdr(r)?,
7193            })
7194        })
7195    }
7196}
7197
7198impl WriteXdr for ScSpecUdtUnionV0 {
7199    #[cfg(feature = "std")]
7200    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
7201        w.with_limited_depth(|w| {
7202            self.doc.write_xdr(w)?;
7203            self.lib.write_xdr(w)?;
7204            self.name.write_xdr(w)?;
7205            self.cases.write_xdr(w)?;
7206            Ok(())
7207        })
7208    }
7209}
7210
7211/// ScSpecUdtEnumCaseV0 is an XDR Struct defines as:
7212///
7213/// ```text
7214/// struct SCSpecUDTEnumCaseV0
7215/// {
7216///     string doc<SC_SPEC_DOC_LIMIT>;
7217///     string name<60>;
7218///     uint32 value;
7219/// };
7220/// ```
7221///
7222#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
7223#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
7224#[cfg_attr(
7225    all(feature = "serde", feature = "alloc"),
7226    derive(serde::Serialize, serde::Deserialize),
7227    serde(rename_all = "snake_case")
7228)]
7229#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
7230pub struct ScSpecUdtEnumCaseV0 {
7231    pub doc: StringM<1024>,
7232    pub name: StringM<60>,
7233    pub value: u32,
7234}
7235
7236impl ReadXdr for ScSpecUdtEnumCaseV0 {
7237    #[cfg(feature = "std")]
7238    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
7239        r.with_limited_depth(|r| {
7240            Ok(Self {
7241                doc: StringM::<1024>::read_xdr(r)?,
7242                name: StringM::<60>::read_xdr(r)?,
7243                value: u32::read_xdr(r)?,
7244            })
7245        })
7246    }
7247}
7248
7249impl WriteXdr for ScSpecUdtEnumCaseV0 {
7250    #[cfg(feature = "std")]
7251    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
7252        w.with_limited_depth(|w| {
7253            self.doc.write_xdr(w)?;
7254            self.name.write_xdr(w)?;
7255            self.value.write_xdr(w)?;
7256            Ok(())
7257        })
7258    }
7259}
7260
7261/// ScSpecUdtEnumV0 is an XDR Struct defines as:
7262///
7263/// ```text
7264/// struct SCSpecUDTEnumV0
7265/// {
7266///     string doc<SC_SPEC_DOC_LIMIT>;
7267///     string lib<80>;
7268///     string name<60>;
7269///     SCSpecUDTEnumCaseV0 cases<50>;
7270/// };
7271/// ```
7272///
7273#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
7274#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
7275#[cfg_attr(
7276    all(feature = "serde", feature = "alloc"),
7277    derive(serde::Serialize, serde::Deserialize),
7278    serde(rename_all = "snake_case")
7279)]
7280#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
7281pub struct ScSpecUdtEnumV0 {
7282    pub doc: StringM<1024>,
7283    pub lib: StringM<80>,
7284    pub name: StringM<60>,
7285    pub cases: VecM<ScSpecUdtEnumCaseV0, 50>,
7286}
7287
7288impl ReadXdr for ScSpecUdtEnumV0 {
7289    #[cfg(feature = "std")]
7290    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
7291        r.with_limited_depth(|r| {
7292            Ok(Self {
7293                doc: StringM::<1024>::read_xdr(r)?,
7294                lib: StringM::<80>::read_xdr(r)?,
7295                name: StringM::<60>::read_xdr(r)?,
7296                cases: VecM::<ScSpecUdtEnumCaseV0, 50>::read_xdr(r)?,
7297            })
7298        })
7299    }
7300}
7301
7302impl WriteXdr for ScSpecUdtEnumV0 {
7303    #[cfg(feature = "std")]
7304    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
7305        w.with_limited_depth(|w| {
7306            self.doc.write_xdr(w)?;
7307            self.lib.write_xdr(w)?;
7308            self.name.write_xdr(w)?;
7309            self.cases.write_xdr(w)?;
7310            Ok(())
7311        })
7312    }
7313}
7314
7315/// ScSpecUdtErrorEnumCaseV0 is an XDR Struct defines as:
7316///
7317/// ```text
7318/// struct SCSpecUDTErrorEnumCaseV0
7319/// {
7320///     string doc<SC_SPEC_DOC_LIMIT>;
7321///     string name<60>;
7322///     uint32 value;
7323/// };
7324/// ```
7325///
7326#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
7327#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
7328#[cfg_attr(
7329    all(feature = "serde", feature = "alloc"),
7330    derive(serde::Serialize, serde::Deserialize),
7331    serde(rename_all = "snake_case")
7332)]
7333#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
7334pub struct ScSpecUdtErrorEnumCaseV0 {
7335    pub doc: StringM<1024>,
7336    pub name: StringM<60>,
7337    pub value: u32,
7338}
7339
7340impl ReadXdr for ScSpecUdtErrorEnumCaseV0 {
7341    #[cfg(feature = "std")]
7342    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
7343        r.with_limited_depth(|r| {
7344            Ok(Self {
7345                doc: StringM::<1024>::read_xdr(r)?,
7346                name: StringM::<60>::read_xdr(r)?,
7347                value: u32::read_xdr(r)?,
7348            })
7349        })
7350    }
7351}
7352
7353impl WriteXdr for ScSpecUdtErrorEnumCaseV0 {
7354    #[cfg(feature = "std")]
7355    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
7356        w.with_limited_depth(|w| {
7357            self.doc.write_xdr(w)?;
7358            self.name.write_xdr(w)?;
7359            self.value.write_xdr(w)?;
7360            Ok(())
7361        })
7362    }
7363}
7364
7365/// ScSpecUdtErrorEnumV0 is an XDR Struct defines as:
7366///
7367/// ```text
7368/// struct SCSpecUDTErrorEnumV0
7369/// {
7370///     string doc<SC_SPEC_DOC_LIMIT>;
7371///     string lib<80>;
7372///     string name<60>;
7373///     SCSpecUDTErrorEnumCaseV0 cases<50>;
7374/// };
7375/// ```
7376///
7377#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
7378#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
7379#[cfg_attr(
7380    all(feature = "serde", feature = "alloc"),
7381    derive(serde::Serialize, serde::Deserialize),
7382    serde(rename_all = "snake_case")
7383)]
7384#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
7385pub struct ScSpecUdtErrorEnumV0 {
7386    pub doc: StringM<1024>,
7387    pub lib: StringM<80>,
7388    pub name: StringM<60>,
7389    pub cases: VecM<ScSpecUdtErrorEnumCaseV0, 50>,
7390}
7391
7392impl ReadXdr for ScSpecUdtErrorEnumV0 {
7393    #[cfg(feature = "std")]
7394    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
7395        r.with_limited_depth(|r| {
7396            Ok(Self {
7397                doc: StringM::<1024>::read_xdr(r)?,
7398                lib: StringM::<80>::read_xdr(r)?,
7399                name: StringM::<60>::read_xdr(r)?,
7400                cases: VecM::<ScSpecUdtErrorEnumCaseV0, 50>::read_xdr(r)?,
7401            })
7402        })
7403    }
7404}
7405
7406impl WriteXdr for ScSpecUdtErrorEnumV0 {
7407    #[cfg(feature = "std")]
7408    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
7409        w.with_limited_depth(|w| {
7410            self.doc.write_xdr(w)?;
7411            self.lib.write_xdr(w)?;
7412            self.name.write_xdr(w)?;
7413            self.cases.write_xdr(w)?;
7414            Ok(())
7415        })
7416    }
7417}
7418
7419/// ScSpecFunctionInputV0 is an XDR Struct defines as:
7420///
7421/// ```text
7422/// struct SCSpecFunctionInputV0
7423/// {
7424///     string doc<SC_SPEC_DOC_LIMIT>;
7425///     string name<30>;
7426///     SCSpecTypeDef type;
7427/// };
7428/// ```
7429///
7430#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
7431#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
7432#[cfg_attr(
7433    all(feature = "serde", feature = "alloc"),
7434    derive(serde::Serialize, serde::Deserialize),
7435    serde(rename_all = "snake_case")
7436)]
7437#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
7438pub struct ScSpecFunctionInputV0 {
7439    pub doc: StringM<1024>,
7440    pub name: StringM<30>,
7441    pub type_: ScSpecTypeDef,
7442}
7443
7444impl ReadXdr for ScSpecFunctionInputV0 {
7445    #[cfg(feature = "std")]
7446    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
7447        r.with_limited_depth(|r| {
7448            Ok(Self {
7449                doc: StringM::<1024>::read_xdr(r)?,
7450                name: StringM::<30>::read_xdr(r)?,
7451                type_: ScSpecTypeDef::read_xdr(r)?,
7452            })
7453        })
7454    }
7455}
7456
7457impl WriteXdr for ScSpecFunctionInputV0 {
7458    #[cfg(feature = "std")]
7459    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
7460        w.with_limited_depth(|w| {
7461            self.doc.write_xdr(w)?;
7462            self.name.write_xdr(w)?;
7463            self.type_.write_xdr(w)?;
7464            Ok(())
7465        })
7466    }
7467}
7468
7469/// ScSpecFunctionV0 is an XDR Struct defines as:
7470///
7471/// ```text
7472/// struct SCSpecFunctionV0
7473/// {
7474///     string doc<SC_SPEC_DOC_LIMIT>;
7475///     SCSymbol name;
7476///     SCSpecFunctionInputV0 inputs<10>;
7477///     SCSpecTypeDef outputs<1>;
7478/// };
7479/// ```
7480///
7481#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
7482#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
7483#[cfg_attr(
7484    all(feature = "serde", feature = "alloc"),
7485    derive(serde::Serialize, serde::Deserialize),
7486    serde(rename_all = "snake_case")
7487)]
7488#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
7489pub struct ScSpecFunctionV0 {
7490    pub doc: StringM<1024>,
7491    pub name: ScSymbol,
7492    pub inputs: VecM<ScSpecFunctionInputV0, 10>,
7493    pub outputs: VecM<ScSpecTypeDef, 1>,
7494}
7495
7496impl ReadXdr for ScSpecFunctionV0 {
7497    #[cfg(feature = "std")]
7498    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
7499        r.with_limited_depth(|r| {
7500            Ok(Self {
7501                doc: StringM::<1024>::read_xdr(r)?,
7502                name: ScSymbol::read_xdr(r)?,
7503                inputs: VecM::<ScSpecFunctionInputV0, 10>::read_xdr(r)?,
7504                outputs: VecM::<ScSpecTypeDef, 1>::read_xdr(r)?,
7505            })
7506        })
7507    }
7508}
7509
7510impl WriteXdr for ScSpecFunctionV0 {
7511    #[cfg(feature = "std")]
7512    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
7513        w.with_limited_depth(|w| {
7514            self.doc.write_xdr(w)?;
7515            self.name.write_xdr(w)?;
7516            self.inputs.write_xdr(w)?;
7517            self.outputs.write_xdr(w)?;
7518            Ok(())
7519        })
7520    }
7521}
7522
7523/// ScSpecEntryKind is an XDR Enum defines as:
7524///
7525/// ```text
7526/// enum SCSpecEntryKind
7527/// {
7528///     SC_SPEC_ENTRY_FUNCTION_V0 = 0,
7529///     SC_SPEC_ENTRY_UDT_STRUCT_V0 = 1,
7530///     SC_SPEC_ENTRY_UDT_UNION_V0 = 2,
7531///     SC_SPEC_ENTRY_UDT_ENUM_V0 = 3,
7532///     SC_SPEC_ENTRY_UDT_ERROR_ENUM_V0 = 4
7533/// };
7534/// ```
7535///
7536// enum
7537#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
7538#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
7539#[cfg_attr(
7540    all(feature = "serde", feature = "alloc"),
7541    derive(serde::Serialize, serde::Deserialize),
7542    serde(rename_all = "snake_case")
7543)]
7544#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
7545#[repr(i32)]
7546pub enum ScSpecEntryKind {
7547    FunctionV0 = 0,
7548    UdtStructV0 = 1,
7549    UdtUnionV0 = 2,
7550    UdtEnumV0 = 3,
7551    UdtErrorEnumV0 = 4,
7552}
7553
7554impl ScSpecEntryKind {
7555    pub const VARIANTS: [ScSpecEntryKind; 5] = [
7556        ScSpecEntryKind::FunctionV0,
7557        ScSpecEntryKind::UdtStructV0,
7558        ScSpecEntryKind::UdtUnionV0,
7559        ScSpecEntryKind::UdtEnumV0,
7560        ScSpecEntryKind::UdtErrorEnumV0,
7561    ];
7562    pub const VARIANTS_STR: [&'static str; 5] = [
7563        "FunctionV0",
7564        "UdtStructV0",
7565        "UdtUnionV0",
7566        "UdtEnumV0",
7567        "UdtErrorEnumV0",
7568    ];
7569
7570    #[must_use]
7571    pub const fn name(&self) -> &'static str {
7572        match self {
7573            Self::FunctionV0 => "FunctionV0",
7574            Self::UdtStructV0 => "UdtStructV0",
7575            Self::UdtUnionV0 => "UdtUnionV0",
7576            Self::UdtEnumV0 => "UdtEnumV0",
7577            Self::UdtErrorEnumV0 => "UdtErrorEnumV0",
7578        }
7579    }
7580
7581    #[must_use]
7582    pub const fn variants() -> [ScSpecEntryKind; 5] {
7583        Self::VARIANTS
7584    }
7585}
7586
7587impl Name for ScSpecEntryKind {
7588    #[must_use]
7589    fn name(&self) -> &'static str {
7590        Self::name(self)
7591    }
7592}
7593
7594impl Variants<ScSpecEntryKind> for ScSpecEntryKind {
7595    fn variants() -> slice::Iter<'static, ScSpecEntryKind> {
7596        Self::VARIANTS.iter()
7597    }
7598}
7599
7600impl Enum for ScSpecEntryKind {}
7601
7602impl fmt::Display for ScSpecEntryKind {
7603    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
7604        f.write_str(self.name())
7605    }
7606}
7607
7608impl TryFrom<i32> for ScSpecEntryKind {
7609    type Error = Error;
7610
7611    fn try_from(i: i32) -> Result<Self> {
7612        let e = match i {
7613            0 => ScSpecEntryKind::FunctionV0,
7614            1 => ScSpecEntryKind::UdtStructV0,
7615            2 => ScSpecEntryKind::UdtUnionV0,
7616            3 => ScSpecEntryKind::UdtEnumV0,
7617            4 => ScSpecEntryKind::UdtErrorEnumV0,
7618            #[allow(unreachable_patterns)]
7619            _ => return Err(Error::Invalid),
7620        };
7621        Ok(e)
7622    }
7623}
7624
7625impl From<ScSpecEntryKind> for i32 {
7626    #[must_use]
7627    fn from(e: ScSpecEntryKind) -> Self {
7628        e as Self
7629    }
7630}
7631
7632impl ReadXdr for ScSpecEntryKind {
7633    #[cfg(feature = "std")]
7634    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
7635        r.with_limited_depth(|r| {
7636            let e = i32::read_xdr(r)?;
7637            let v: Self = e.try_into()?;
7638            Ok(v)
7639        })
7640    }
7641}
7642
7643impl WriteXdr for ScSpecEntryKind {
7644    #[cfg(feature = "std")]
7645    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
7646        w.with_limited_depth(|w| {
7647            let i: i32 = (*self).into();
7648            i.write_xdr(w)
7649        })
7650    }
7651}
7652
7653/// ScSpecEntry is an XDR Union defines as:
7654///
7655/// ```text
7656/// union SCSpecEntry switch (SCSpecEntryKind kind)
7657/// {
7658/// case SC_SPEC_ENTRY_FUNCTION_V0:
7659///     SCSpecFunctionV0 functionV0;
7660/// case SC_SPEC_ENTRY_UDT_STRUCT_V0:
7661///     SCSpecUDTStructV0 udtStructV0;
7662/// case SC_SPEC_ENTRY_UDT_UNION_V0:
7663///     SCSpecUDTUnionV0 udtUnionV0;
7664/// case SC_SPEC_ENTRY_UDT_ENUM_V0:
7665///     SCSpecUDTEnumV0 udtEnumV0;
7666/// case SC_SPEC_ENTRY_UDT_ERROR_ENUM_V0:
7667///     SCSpecUDTErrorEnumV0 udtErrorEnumV0;
7668/// };
7669/// ```
7670///
7671// union with discriminant ScSpecEntryKind
7672#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
7673#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
7674#[cfg_attr(
7675    all(feature = "serde", feature = "alloc"),
7676    derive(serde::Serialize, serde::Deserialize),
7677    serde(rename_all = "snake_case")
7678)]
7679#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
7680#[allow(clippy::large_enum_variant)]
7681pub enum ScSpecEntry {
7682    FunctionV0(ScSpecFunctionV0),
7683    UdtStructV0(ScSpecUdtStructV0),
7684    UdtUnionV0(ScSpecUdtUnionV0),
7685    UdtEnumV0(ScSpecUdtEnumV0),
7686    UdtErrorEnumV0(ScSpecUdtErrorEnumV0),
7687}
7688
7689impl ScSpecEntry {
7690    pub const VARIANTS: [ScSpecEntryKind; 5] = [
7691        ScSpecEntryKind::FunctionV0,
7692        ScSpecEntryKind::UdtStructV0,
7693        ScSpecEntryKind::UdtUnionV0,
7694        ScSpecEntryKind::UdtEnumV0,
7695        ScSpecEntryKind::UdtErrorEnumV0,
7696    ];
7697    pub const VARIANTS_STR: [&'static str; 5] = [
7698        "FunctionV0",
7699        "UdtStructV0",
7700        "UdtUnionV0",
7701        "UdtEnumV0",
7702        "UdtErrorEnumV0",
7703    ];
7704
7705    #[must_use]
7706    pub const fn name(&self) -> &'static str {
7707        match self {
7708            Self::FunctionV0(_) => "FunctionV0",
7709            Self::UdtStructV0(_) => "UdtStructV0",
7710            Self::UdtUnionV0(_) => "UdtUnionV0",
7711            Self::UdtEnumV0(_) => "UdtEnumV0",
7712            Self::UdtErrorEnumV0(_) => "UdtErrorEnumV0",
7713        }
7714    }
7715
7716    #[must_use]
7717    pub const fn discriminant(&self) -> ScSpecEntryKind {
7718        #[allow(clippy::match_same_arms)]
7719        match self {
7720            Self::FunctionV0(_) => ScSpecEntryKind::FunctionV0,
7721            Self::UdtStructV0(_) => ScSpecEntryKind::UdtStructV0,
7722            Self::UdtUnionV0(_) => ScSpecEntryKind::UdtUnionV0,
7723            Self::UdtEnumV0(_) => ScSpecEntryKind::UdtEnumV0,
7724            Self::UdtErrorEnumV0(_) => ScSpecEntryKind::UdtErrorEnumV0,
7725        }
7726    }
7727
7728    #[must_use]
7729    pub const fn variants() -> [ScSpecEntryKind; 5] {
7730        Self::VARIANTS
7731    }
7732}
7733
7734impl Name for ScSpecEntry {
7735    #[must_use]
7736    fn name(&self) -> &'static str {
7737        Self::name(self)
7738    }
7739}
7740
7741impl Discriminant<ScSpecEntryKind> for ScSpecEntry {
7742    #[must_use]
7743    fn discriminant(&self) -> ScSpecEntryKind {
7744        Self::discriminant(self)
7745    }
7746}
7747
7748impl Variants<ScSpecEntryKind> for ScSpecEntry {
7749    fn variants() -> slice::Iter<'static, ScSpecEntryKind> {
7750        Self::VARIANTS.iter()
7751    }
7752}
7753
7754impl Union<ScSpecEntryKind> for ScSpecEntry {}
7755
7756impl ReadXdr for ScSpecEntry {
7757    #[cfg(feature = "std")]
7758    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
7759        r.with_limited_depth(|r| {
7760            let dv: ScSpecEntryKind = <ScSpecEntryKind as ReadXdr>::read_xdr(r)?;
7761            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
7762            let v = match dv {
7763                ScSpecEntryKind::FunctionV0 => Self::FunctionV0(ScSpecFunctionV0::read_xdr(r)?),
7764                ScSpecEntryKind::UdtStructV0 => Self::UdtStructV0(ScSpecUdtStructV0::read_xdr(r)?),
7765                ScSpecEntryKind::UdtUnionV0 => Self::UdtUnionV0(ScSpecUdtUnionV0::read_xdr(r)?),
7766                ScSpecEntryKind::UdtEnumV0 => Self::UdtEnumV0(ScSpecUdtEnumV0::read_xdr(r)?),
7767                ScSpecEntryKind::UdtErrorEnumV0 => {
7768                    Self::UdtErrorEnumV0(ScSpecUdtErrorEnumV0::read_xdr(r)?)
7769                }
7770                #[allow(unreachable_patterns)]
7771                _ => return Err(Error::Invalid),
7772            };
7773            Ok(v)
7774        })
7775    }
7776}
7777
7778impl WriteXdr for ScSpecEntry {
7779    #[cfg(feature = "std")]
7780    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
7781        w.with_limited_depth(|w| {
7782            self.discriminant().write_xdr(w)?;
7783            #[allow(clippy::match_same_arms)]
7784            match self {
7785                Self::FunctionV0(v) => v.write_xdr(w)?,
7786                Self::UdtStructV0(v) => v.write_xdr(w)?,
7787                Self::UdtUnionV0(v) => v.write_xdr(w)?,
7788                Self::UdtEnumV0(v) => v.write_xdr(w)?,
7789                Self::UdtErrorEnumV0(v) => v.write_xdr(w)?,
7790            };
7791            Ok(())
7792        })
7793    }
7794}
7795
7796/// ScValType is an XDR Enum defines as:
7797///
7798/// ```text
7799/// enum SCValType
7800/// {
7801///     SCV_BOOL = 0,
7802///     SCV_VOID = 1,
7803///     SCV_ERROR = 2,
7804///
7805///     // 32 bits is the smallest type in WASM or XDR; no need for u8/u16.
7806///     SCV_U32 = 3,
7807///     SCV_I32 = 4,
7808///
7809///     // 64 bits is naturally supported by both WASM and XDR also.
7810///     SCV_U64 = 5,
7811///     SCV_I64 = 6,
7812///
7813///     // Time-related u64 subtypes with their own functions and formatting.
7814///     SCV_TIMEPOINT = 7,
7815///     SCV_DURATION = 8,
7816///
7817///     // 128 bits is naturally supported by Rust and we use it for Soroban
7818///     // fixed-point arithmetic prices / balances / similar "quantities". These
7819///     // are represented in XDR as a pair of 2 u64s.
7820///     SCV_U128 = 9,
7821///     SCV_I128 = 10,
7822///
7823///     // 256 bits is the size of sha256 output, ed25519 keys, and the EVM machine
7824///     // word, so for interop use we include this even though it requires a small
7825///     // amount of Rust guest and/or host library code.
7826///     SCV_U256 = 11,
7827///     SCV_I256 = 12,
7828///
7829///     // Bytes come in 3 flavors, 2 of which have meaningfully different
7830///     // formatting and validity-checking / domain-restriction.
7831///     SCV_BYTES = 13,
7832///     SCV_STRING = 14,
7833///     SCV_SYMBOL = 15,
7834///
7835///     // Vecs and maps are just polymorphic containers of other ScVals.
7836///     SCV_VEC = 16,
7837///     SCV_MAP = 17,
7838///
7839///     // Address is the universal identifier for contracts and classic
7840///     // accounts.
7841///     SCV_ADDRESS = 18,
7842///
7843///     // The following are the internal SCVal variants that are not
7844///     // exposed to the contracts.
7845///     SCV_CONTRACT_INSTANCE = 19,
7846///
7847///     // SCV_LEDGER_KEY_CONTRACT_INSTANCE and SCV_LEDGER_KEY_NONCE are unique
7848///     // symbolic SCVals used as the key for ledger entries for a contract's
7849///     // instance and an address' nonce, respectively.
7850///     SCV_LEDGER_KEY_CONTRACT_INSTANCE = 20,
7851///     SCV_LEDGER_KEY_NONCE = 21
7852/// };
7853/// ```
7854///
7855// enum
7856#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
7857#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
7858#[cfg_attr(
7859    all(feature = "serde", feature = "alloc"),
7860    derive(serde::Serialize, serde::Deserialize),
7861    serde(rename_all = "snake_case")
7862)]
7863#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
7864#[repr(i32)]
7865pub enum ScValType {
7866    Bool = 0,
7867    Void = 1,
7868    Error = 2,
7869    U32 = 3,
7870    I32 = 4,
7871    U64 = 5,
7872    I64 = 6,
7873    Timepoint = 7,
7874    Duration = 8,
7875    U128 = 9,
7876    I128 = 10,
7877    U256 = 11,
7878    I256 = 12,
7879    Bytes = 13,
7880    String = 14,
7881    Symbol = 15,
7882    Vec = 16,
7883    Map = 17,
7884    Address = 18,
7885    ContractInstance = 19,
7886    LedgerKeyContractInstance = 20,
7887    LedgerKeyNonce = 21,
7888}
7889
7890impl ScValType {
7891    pub const VARIANTS: [ScValType; 22] = [
7892        ScValType::Bool,
7893        ScValType::Void,
7894        ScValType::Error,
7895        ScValType::U32,
7896        ScValType::I32,
7897        ScValType::U64,
7898        ScValType::I64,
7899        ScValType::Timepoint,
7900        ScValType::Duration,
7901        ScValType::U128,
7902        ScValType::I128,
7903        ScValType::U256,
7904        ScValType::I256,
7905        ScValType::Bytes,
7906        ScValType::String,
7907        ScValType::Symbol,
7908        ScValType::Vec,
7909        ScValType::Map,
7910        ScValType::Address,
7911        ScValType::ContractInstance,
7912        ScValType::LedgerKeyContractInstance,
7913        ScValType::LedgerKeyNonce,
7914    ];
7915    pub const VARIANTS_STR: [&'static str; 22] = [
7916        "Bool",
7917        "Void",
7918        "Error",
7919        "U32",
7920        "I32",
7921        "U64",
7922        "I64",
7923        "Timepoint",
7924        "Duration",
7925        "U128",
7926        "I128",
7927        "U256",
7928        "I256",
7929        "Bytes",
7930        "String",
7931        "Symbol",
7932        "Vec",
7933        "Map",
7934        "Address",
7935        "ContractInstance",
7936        "LedgerKeyContractInstance",
7937        "LedgerKeyNonce",
7938    ];
7939
7940    #[must_use]
7941    pub const fn name(&self) -> &'static str {
7942        match self {
7943            Self::Bool => "Bool",
7944            Self::Void => "Void",
7945            Self::Error => "Error",
7946            Self::U32 => "U32",
7947            Self::I32 => "I32",
7948            Self::U64 => "U64",
7949            Self::I64 => "I64",
7950            Self::Timepoint => "Timepoint",
7951            Self::Duration => "Duration",
7952            Self::U128 => "U128",
7953            Self::I128 => "I128",
7954            Self::U256 => "U256",
7955            Self::I256 => "I256",
7956            Self::Bytes => "Bytes",
7957            Self::String => "String",
7958            Self::Symbol => "Symbol",
7959            Self::Vec => "Vec",
7960            Self::Map => "Map",
7961            Self::Address => "Address",
7962            Self::ContractInstance => "ContractInstance",
7963            Self::LedgerKeyContractInstance => "LedgerKeyContractInstance",
7964            Self::LedgerKeyNonce => "LedgerKeyNonce",
7965        }
7966    }
7967
7968    #[must_use]
7969    pub const fn variants() -> [ScValType; 22] {
7970        Self::VARIANTS
7971    }
7972}
7973
7974impl Name for ScValType {
7975    #[must_use]
7976    fn name(&self) -> &'static str {
7977        Self::name(self)
7978    }
7979}
7980
7981impl Variants<ScValType> for ScValType {
7982    fn variants() -> slice::Iter<'static, ScValType> {
7983        Self::VARIANTS.iter()
7984    }
7985}
7986
7987impl Enum for ScValType {}
7988
7989impl fmt::Display for ScValType {
7990    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
7991        f.write_str(self.name())
7992    }
7993}
7994
7995impl TryFrom<i32> for ScValType {
7996    type Error = Error;
7997
7998    fn try_from(i: i32) -> Result<Self> {
7999        let e = match i {
8000            0 => ScValType::Bool,
8001            1 => ScValType::Void,
8002            2 => ScValType::Error,
8003            3 => ScValType::U32,
8004            4 => ScValType::I32,
8005            5 => ScValType::U64,
8006            6 => ScValType::I64,
8007            7 => ScValType::Timepoint,
8008            8 => ScValType::Duration,
8009            9 => ScValType::U128,
8010            10 => ScValType::I128,
8011            11 => ScValType::U256,
8012            12 => ScValType::I256,
8013            13 => ScValType::Bytes,
8014            14 => ScValType::String,
8015            15 => ScValType::Symbol,
8016            16 => ScValType::Vec,
8017            17 => ScValType::Map,
8018            18 => ScValType::Address,
8019            19 => ScValType::ContractInstance,
8020            20 => ScValType::LedgerKeyContractInstance,
8021            21 => ScValType::LedgerKeyNonce,
8022            #[allow(unreachable_patterns)]
8023            _ => return Err(Error::Invalid),
8024        };
8025        Ok(e)
8026    }
8027}
8028
8029impl From<ScValType> for i32 {
8030    #[must_use]
8031    fn from(e: ScValType) -> Self {
8032        e as Self
8033    }
8034}
8035
8036impl ReadXdr for ScValType {
8037    #[cfg(feature = "std")]
8038    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
8039        r.with_limited_depth(|r| {
8040            let e = i32::read_xdr(r)?;
8041            let v: Self = e.try_into()?;
8042            Ok(v)
8043        })
8044    }
8045}
8046
8047impl WriteXdr for ScValType {
8048    #[cfg(feature = "std")]
8049    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
8050        w.with_limited_depth(|w| {
8051            let i: i32 = (*self).into();
8052            i.write_xdr(w)
8053        })
8054    }
8055}
8056
8057/// ScErrorType is an XDR Enum defines as:
8058///
8059/// ```text
8060/// enum SCErrorType
8061/// {
8062///     SCE_CONTRACT = 0,          // Contract-specific, user-defined codes.
8063///     SCE_WASM_VM = 1,           // Errors while interpreting WASM bytecode.
8064///     SCE_CONTEXT = 2,           // Errors in the contract's host context.
8065///     SCE_STORAGE = 3,           // Errors accessing host storage.
8066///     SCE_OBJECT = 4,            // Errors working with host objects.
8067///     SCE_CRYPTO = 5,            // Errors in cryptographic operations.
8068///     SCE_EVENTS = 6,            // Errors while emitting events.
8069///     SCE_BUDGET = 7,            // Errors relating to budget limits.
8070///     SCE_VALUE = 8,             // Errors working with host values or SCVals.
8071///     SCE_AUTH = 9               // Errors from the authentication subsystem.
8072/// };
8073/// ```
8074///
8075// enum
8076#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
8077#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
8078#[cfg_attr(
8079    all(feature = "serde", feature = "alloc"),
8080    derive(serde::Serialize, serde::Deserialize),
8081    serde(rename_all = "snake_case")
8082)]
8083#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
8084#[repr(i32)]
8085pub enum ScErrorType {
8086    Contract = 0,
8087    WasmVm = 1,
8088    Context = 2,
8089    Storage = 3,
8090    Object = 4,
8091    Crypto = 5,
8092    Events = 6,
8093    Budget = 7,
8094    Value = 8,
8095    Auth = 9,
8096}
8097
8098impl ScErrorType {
8099    pub const VARIANTS: [ScErrorType; 10] = [
8100        ScErrorType::Contract,
8101        ScErrorType::WasmVm,
8102        ScErrorType::Context,
8103        ScErrorType::Storage,
8104        ScErrorType::Object,
8105        ScErrorType::Crypto,
8106        ScErrorType::Events,
8107        ScErrorType::Budget,
8108        ScErrorType::Value,
8109        ScErrorType::Auth,
8110    ];
8111    pub const VARIANTS_STR: [&'static str; 10] = [
8112        "Contract", "WasmVm", "Context", "Storage", "Object", "Crypto", "Events", "Budget",
8113        "Value", "Auth",
8114    ];
8115
8116    #[must_use]
8117    pub const fn name(&self) -> &'static str {
8118        match self {
8119            Self::Contract => "Contract",
8120            Self::WasmVm => "WasmVm",
8121            Self::Context => "Context",
8122            Self::Storage => "Storage",
8123            Self::Object => "Object",
8124            Self::Crypto => "Crypto",
8125            Self::Events => "Events",
8126            Self::Budget => "Budget",
8127            Self::Value => "Value",
8128            Self::Auth => "Auth",
8129        }
8130    }
8131
8132    #[must_use]
8133    pub const fn variants() -> [ScErrorType; 10] {
8134        Self::VARIANTS
8135    }
8136}
8137
8138impl Name for ScErrorType {
8139    #[must_use]
8140    fn name(&self) -> &'static str {
8141        Self::name(self)
8142    }
8143}
8144
8145impl Variants<ScErrorType> for ScErrorType {
8146    fn variants() -> slice::Iter<'static, ScErrorType> {
8147        Self::VARIANTS.iter()
8148    }
8149}
8150
8151impl Enum for ScErrorType {}
8152
8153impl fmt::Display for ScErrorType {
8154    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
8155        f.write_str(self.name())
8156    }
8157}
8158
8159impl TryFrom<i32> for ScErrorType {
8160    type Error = Error;
8161
8162    fn try_from(i: i32) -> Result<Self> {
8163        let e = match i {
8164            0 => ScErrorType::Contract,
8165            1 => ScErrorType::WasmVm,
8166            2 => ScErrorType::Context,
8167            3 => ScErrorType::Storage,
8168            4 => ScErrorType::Object,
8169            5 => ScErrorType::Crypto,
8170            6 => ScErrorType::Events,
8171            7 => ScErrorType::Budget,
8172            8 => ScErrorType::Value,
8173            9 => ScErrorType::Auth,
8174            #[allow(unreachable_patterns)]
8175            _ => return Err(Error::Invalid),
8176        };
8177        Ok(e)
8178    }
8179}
8180
8181impl From<ScErrorType> for i32 {
8182    #[must_use]
8183    fn from(e: ScErrorType) -> Self {
8184        e as Self
8185    }
8186}
8187
8188impl ReadXdr for ScErrorType {
8189    #[cfg(feature = "std")]
8190    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
8191        r.with_limited_depth(|r| {
8192            let e = i32::read_xdr(r)?;
8193            let v: Self = e.try_into()?;
8194            Ok(v)
8195        })
8196    }
8197}
8198
8199impl WriteXdr for ScErrorType {
8200    #[cfg(feature = "std")]
8201    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
8202        w.with_limited_depth(|w| {
8203            let i: i32 = (*self).into();
8204            i.write_xdr(w)
8205        })
8206    }
8207}
8208
8209/// ScErrorCode is an XDR Enum defines as:
8210///
8211/// ```text
8212/// enum SCErrorCode
8213/// {
8214///     SCEC_ARITH_DOMAIN = 0,      // Some arithmetic was undefined (overflow, divide-by-zero).
8215///     SCEC_INDEX_BOUNDS = 1,      // Something was indexed beyond its bounds.
8216///     SCEC_INVALID_INPUT = 2,     // User provided some otherwise-bad data.
8217///     SCEC_MISSING_VALUE = 3,     // Some value was required but not provided.
8218///     SCEC_EXISTING_VALUE = 4,    // Some value was provided where not allowed.
8219///     SCEC_EXCEEDED_LIMIT = 5,    // Some arbitrary limit -- gas or otherwise -- was hit.
8220///     SCEC_INVALID_ACTION = 6,    // Data was valid but action requested was not.
8221///     SCEC_INTERNAL_ERROR = 7,    // The host detected an error in its own logic.
8222///     SCEC_UNEXPECTED_TYPE = 8,   // Some type wasn't as expected.
8223///     SCEC_UNEXPECTED_SIZE = 9    // Something's size wasn't as expected.
8224/// };
8225/// ```
8226///
8227// enum
8228#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
8229#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
8230#[cfg_attr(
8231    all(feature = "serde", feature = "alloc"),
8232    derive(serde::Serialize, serde::Deserialize),
8233    serde(rename_all = "snake_case")
8234)]
8235#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
8236#[repr(i32)]
8237pub enum ScErrorCode {
8238    ArithDomain = 0,
8239    IndexBounds = 1,
8240    InvalidInput = 2,
8241    MissingValue = 3,
8242    ExistingValue = 4,
8243    ExceededLimit = 5,
8244    InvalidAction = 6,
8245    InternalError = 7,
8246    UnexpectedType = 8,
8247    UnexpectedSize = 9,
8248}
8249
8250impl ScErrorCode {
8251    pub const VARIANTS: [ScErrorCode; 10] = [
8252        ScErrorCode::ArithDomain,
8253        ScErrorCode::IndexBounds,
8254        ScErrorCode::InvalidInput,
8255        ScErrorCode::MissingValue,
8256        ScErrorCode::ExistingValue,
8257        ScErrorCode::ExceededLimit,
8258        ScErrorCode::InvalidAction,
8259        ScErrorCode::InternalError,
8260        ScErrorCode::UnexpectedType,
8261        ScErrorCode::UnexpectedSize,
8262    ];
8263    pub const VARIANTS_STR: [&'static str; 10] = [
8264        "ArithDomain",
8265        "IndexBounds",
8266        "InvalidInput",
8267        "MissingValue",
8268        "ExistingValue",
8269        "ExceededLimit",
8270        "InvalidAction",
8271        "InternalError",
8272        "UnexpectedType",
8273        "UnexpectedSize",
8274    ];
8275
8276    #[must_use]
8277    pub const fn name(&self) -> &'static str {
8278        match self {
8279            Self::ArithDomain => "ArithDomain",
8280            Self::IndexBounds => "IndexBounds",
8281            Self::InvalidInput => "InvalidInput",
8282            Self::MissingValue => "MissingValue",
8283            Self::ExistingValue => "ExistingValue",
8284            Self::ExceededLimit => "ExceededLimit",
8285            Self::InvalidAction => "InvalidAction",
8286            Self::InternalError => "InternalError",
8287            Self::UnexpectedType => "UnexpectedType",
8288            Self::UnexpectedSize => "UnexpectedSize",
8289        }
8290    }
8291
8292    #[must_use]
8293    pub const fn variants() -> [ScErrorCode; 10] {
8294        Self::VARIANTS
8295    }
8296}
8297
8298impl Name for ScErrorCode {
8299    #[must_use]
8300    fn name(&self) -> &'static str {
8301        Self::name(self)
8302    }
8303}
8304
8305impl Variants<ScErrorCode> for ScErrorCode {
8306    fn variants() -> slice::Iter<'static, ScErrorCode> {
8307        Self::VARIANTS.iter()
8308    }
8309}
8310
8311impl Enum for ScErrorCode {}
8312
8313impl fmt::Display for ScErrorCode {
8314    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
8315        f.write_str(self.name())
8316    }
8317}
8318
8319impl TryFrom<i32> for ScErrorCode {
8320    type Error = Error;
8321
8322    fn try_from(i: i32) -> Result<Self> {
8323        let e = match i {
8324            0 => ScErrorCode::ArithDomain,
8325            1 => ScErrorCode::IndexBounds,
8326            2 => ScErrorCode::InvalidInput,
8327            3 => ScErrorCode::MissingValue,
8328            4 => ScErrorCode::ExistingValue,
8329            5 => ScErrorCode::ExceededLimit,
8330            6 => ScErrorCode::InvalidAction,
8331            7 => ScErrorCode::InternalError,
8332            8 => ScErrorCode::UnexpectedType,
8333            9 => ScErrorCode::UnexpectedSize,
8334            #[allow(unreachable_patterns)]
8335            _ => return Err(Error::Invalid),
8336        };
8337        Ok(e)
8338    }
8339}
8340
8341impl From<ScErrorCode> for i32 {
8342    #[must_use]
8343    fn from(e: ScErrorCode) -> Self {
8344        e as Self
8345    }
8346}
8347
8348impl ReadXdr for ScErrorCode {
8349    #[cfg(feature = "std")]
8350    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
8351        r.with_limited_depth(|r| {
8352            let e = i32::read_xdr(r)?;
8353            let v: Self = e.try_into()?;
8354            Ok(v)
8355        })
8356    }
8357}
8358
8359impl WriteXdr for ScErrorCode {
8360    #[cfg(feature = "std")]
8361    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
8362        w.with_limited_depth(|w| {
8363            let i: i32 = (*self).into();
8364            i.write_xdr(w)
8365        })
8366    }
8367}
8368
8369/// ScError is an XDR Union defines as:
8370///
8371/// ```text
8372/// union SCError switch (SCErrorType type)
8373/// {
8374/// case SCE_CONTRACT:
8375///     uint32 contractCode;
8376/// case SCE_WASM_VM:
8377/// case SCE_CONTEXT:
8378/// case SCE_STORAGE:
8379/// case SCE_OBJECT:
8380/// case SCE_CRYPTO:
8381/// case SCE_EVENTS:
8382/// case SCE_BUDGET:
8383/// case SCE_VALUE:
8384/// case SCE_AUTH:
8385///     SCErrorCode code;
8386/// };
8387/// ```
8388///
8389// union with discriminant ScErrorType
8390#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
8391#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
8392#[cfg_attr(
8393    all(feature = "serde", feature = "alloc"),
8394    derive(serde::Serialize, serde::Deserialize),
8395    serde(rename_all = "snake_case")
8396)]
8397#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
8398#[allow(clippy::large_enum_variant)]
8399pub enum ScError {
8400    Contract(u32),
8401    WasmVm(ScErrorCode),
8402    Context(ScErrorCode),
8403    Storage(ScErrorCode),
8404    Object(ScErrorCode),
8405    Crypto(ScErrorCode),
8406    Events(ScErrorCode),
8407    Budget(ScErrorCode),
8408    Value(ScErrorCode),
8409    Auth(ScErrorCode),
8410}
8411
8412impl ScError {
8413    pub const VARIANTS: [ScErrorType; 10] = [
8414        ScErrorType::Contract,
8415        ScErrorType::WasmVm,
8416        ScErrorType::Context,
8417        ScErrorType::Storage,
8418        ScErrorType::Object,
8419        ScErrorType::Crypto,
8420        ScErrorType::Events,
8421        ScErrorType::Budget,
8422        ScErrorType::Value,
8423        ScErrorType::Auth,
8424    ];
8425    pub const VARIANTS_STR: [&'static str; 10] = [
8426        "Contract", "WasmVm", "Context", "Storage", "Object", "Crypto", "Events", "Budget",
8427        "Value", "Auth",
8428    ];
8429
8430    #[must_use]
8431    pub const fn name(&self) -> &'static str {
8432        match self {
8433            Self::Contract(_) => "Contract",
8434            Self::WasmVm(_) => "WasmVm",
8435            Self::Context(_) => "Context",
8436            Self::Storage(_) => "Storage",
8437            Self::Object(_) => "Object",
8438            Self::Crypto(_) => "Crypto",
8439            Self::Events(_) => "Events",
8440            Self::Budget(_) => "Budget",
8441            Self::Value(_) => "Value",
8442            Self::Auth(_) => "Auth",
8443        }
8444    }
8445
8446    #[must_use]
8447    pub const fn discriminant(&self) -> ScErrorType {
8448        #[allow(clippy::match_same_arms)]
8449        match self {
8450            Self::Contract(_) => ScErrorType::Contract,
8451            Self::WasmVm(_) => ScErrorType::WasmVm,
8452            Self::Context(_) => ScErrorType::Context,
8453            Self::Storage(_) => ScErrorType::Storage,
8454            Self::Object(_) => ScErrorType::Object,
8455            Self::Crypto(_) => ScErrorType::Crypto,
8456            Self::Events(_) => ScErrorType::Events,
8457            Self::Budget(_) => ScErrorType::Budget,
8458            Self::Value(_) => ScErrorType::Value,
8459            Self::Auth(_) => ScErrorType::Auth,
8460        }
8461    }
8462
8463    #[must_use]
8464    pub const fn variants() -> [ScErrorType; 10] {
8465        Self::VARIANTS
8466    }
8467}
8468
8469impl Name for ScError {
8470    #[must_use]
8471    fn name(&self) -> &'static str {
8472        Self::name(self)
8473    }
8474}
8475
8476impl Discriminant<ScErrorType> for ScError {
8477    #[must_use]
8478    fn discriminant(&self) -> ScErrorType {
8479        Self::discriminant(self)
8480    }
8481}
8482
8483impl Variants<ScErrorType> for ScError {
8484    fn variants() -> slice::Iter<'static, ScErrorType> {
8485        Self::VARIANTS.iter()
8486    }
8487}
8488
8489impl Union<ScErrorType> for ScError {}
8490
8491impl ReadXdr for ScError {
8492    #[cfg(feature = "std")]
8493    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
8494        r.with_limited_depth(|r| {
8495            let dv: ScErrorType = <ScErrorType as ReadXdr>::read_xdr(r)?;
8496            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
8497            let v = match dv {
8498                ScErrorType::Contract => Self::Contract(u32::read_xdr(r)?),
8499                ScErrorType::WasmVm => Self::WasmVm(ScErrorCode::read_xdr(r)?),
8500                ScErrorType::Context => Self::Context(ScErrorCode::read_xdr(r)?),
8501                ScErrorType::Storage => Self::Storage(ScErrorCode::read_xdr(r)?),
8502                ScErrorType::Object => Self::Object(ScErrorCode::read_xdr(r)?),
8503                ScErrorType::Crypto => Self::Crypto(ScErrorCode::read_xdr(r)?),
8504                ScErrorType::Events => Self::Events(ScErrorCode::read_xdr(r)?),
8505                ScErrorType::Budget => Self::Budget(ScErrorCode::read_xdr(r)?),
8506                ScErrorType::Value => Self::Value(ScErrorCode::read_xdr(r)?),
8507                ScErrorType::Auth => Self::Auth(ScErrorCode::read_xdr(r)?),
8508                #[allow(unreachable_patterns)]
8509                _ => return Err(Error::Invalid),
8510            };
8511            Ok(v)
8512        })
8513    }
8514}
8515
8516impl WriteXdr for ScError {
8517    #[cfg(feature = "std")]
8518    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
8519        w.with_limited_depth(|w| {
8520            self.discriminant().write_xdr(w)?;
8521            #[allow(clippy::match_same_arms)]
8522            match self {
8523                Self::Contract(v) => v.write_xdr(w)?,
8524                Self::WasmVm(v) => v.write_xdr(w)?,
8525                Self::Context(v) => v.write_xdr(w)?,
8526                Self::Storage(v) => v.write_xdr(w)?,
8527                Self::Object(v) => v.write_xdr(w)?,
8528                Self::Crypto(v) => v.write_xdr(w)?,
8529                Self::Events(v) => v.write_xdr(w)?,
8530                Self::Budget(v) => v.write_xdr(w)?,
8531                Self::Value(v) => v.write_xdr(w)?,
8532                Self::Auth(v) => v.write_xdr(w)?,
8533            };
8534            Ok(())
8535        })
8536    }
8537}
8538
8539/// UInt128Parts is an XDR Struct defines as:
8540///
8541/// ```text
8542/// struct UInt128Parts {
8543///     uint64 hi;
8544///     uint64 lo;
8545/// };
8546/// ```
8547///
8548#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
8549#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
8550#[cfg_attr(
8551    all(feature = "serde", feature = "alloc"),
8552    derive(serde::Serialize, serde::Deserialize),
8553    serde(rename_all = "snake_case")
8554)]
8555#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
8556pub struct UInt128Parts {
8557    pub hi: u64,
8558    pub lo: u64,
8559}
8560
8561impl ReadXdr for UInt128Parts {
8562    #[cfg(feature = "std")]
8563    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
8564        r.with_limited_depth(|r| {
8565            Ok(Self {
8566                hi: u64::read_xdr(r)?,
8567                lo: u64::read_xdr(r)?,
8568            })
8569        })
8570    }
8571}
8572
8573impl WriteXdr for UInt128Parts {
8574    #[cfg(feature = "std")]
8575    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
8576        w.with_limited_depth(|w| {
8577            self.hi.write_xdr(w)?;
8578            self.lo.write_xdr(w)?;
8579            Ok(())
8580        })
8581    }
8582}
8583
8584/// Int128Parts is an XDR Struct defines as:
8585///
8586/// ```text
8587/// struct Int128Parts {
8588///     int64 hi;
8589///     uint64 lo;
8590/// };
8591/// ```
8592///
8593#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
8594#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
8595#[cfg_attr(
8596    all(feature = "serde", feature = "alloc"),
8597    derive(serde::Serialize, serde::Deserialize),
8598    serde(rename_all = "snake_case")
8599)]
8600#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
8601pub struct Int128Parts {
8602    pub hi: i64,
8603    pub lo: u64,
8604}
8605
8606impl ReadXdr for Int128Parts {
8607    #[cfg(feature = "std")]
8608    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
8609        r.with_limited_depth(|r| {
8610            Ok(Self {
8611                hi: i64::read_xdr(r)?,
8612                lo: u64::read_xdr(r)?,
8613            })
8614        })
8615    }
8616}
8617
8618impl WriteXdr for Int128Parts {
8619    #[cfg(feature = "std")]
8620    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
8621        w.with_limited_depth(|w| {
8622            self.hi.write_xdr(w)?;
8623            self.lo.write_xdr(w)?;
8624            Ok(())
8625        })
8626    }
8627}
8628
8629/// UInt256Parts is an XDR Struct defines as:
8630///
8631/// ```text
8632/// struct UInt256Parts {
8633///     uint64 hi_hi;
8634///     uint64 hi_lo;
8635///     uint64 lo_hi;
8636///     uint64 lo_lo;
8637/// };
8638/// ```
8639///
8640#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
8641#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
8642#[cfg_attr(
8643    all(feature = "serde", feature = "alloc"),
8644    derive(serde::Serialize, serde::Deserialize),
8645    serde(rename_all = "snake_case")
8646)]
8647#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
8648pub struct UInt256Parts {
8649    pub hi_hi: u64,
8650    pub hi_lo: u64,
8651    pub lo_hi: u64,
8652    pub lo_lo: u64,
8653}
8654
8655impl ReadXdr for UInt256Parts {
8656    #[cfg(feature = "std")]
8657    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
8658        r.with_limited_depth(|r| {
8659            Ok(Self {
8660                hi_hi: u64::read_xdr(r)?,
8661                hi_lo: u64::read_xdr(r)?,
8662                lo_hi: u64::read_xdr(r)?,
8663                lo_lo: u64::read_xdr(r)?,
8664            })
8665        })
8666    }
8667}
8668
8669impl WriteXdr for UInt256Parts {
8670    #[cfg(feature = "std")]
8671    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
8672        w.with_limited_depth(|w| {
8673            self.hi_hi.write_xdr(w)?;
8674            self.hi_lo.write_xdr(w)?;
8675            self.lo_hi.write_xdr(w)?;
8676            self.lo_lo.write_xdr(w)?;
8677            Ok(())
8678        })
8679    }
8680}
8681
8682/// Int256Parts is an XDR Struct defines as:
8683///
8684/// ```text
8685/// struct Int256Parts {
8686///     int64 hi_hi;
8687///     uint64 hi_lo;
8688///     uint64 lo_hi;
8689///     uint64 lo_lo;
8690/// };
8691/// ```
8692///
8693#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
8694#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
8695#[cfg_attr(
8696    all(feature = "serde", feature = "alloc"),
8697    derive(serde::Serialize, serde::Deserialize),
8698    serde(rename_all = "snake_case")
8699)]
8700#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
8701pub struct Int256Parts {
8702    pub hi_hi: i64,
8703    pub hi_lo: u64,
8704    pub lo_hi: u64,
8705    pub lo_lo: u64,
8706}
8707
8708impl ReadXdr for Int256Parts {
8709    #[cfg(feature = "std")]
8710    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
8711        r.with_limited_depth(|r| {
8712            Ok(Self {
8713                hi_hi: i64::read_xdr(r)?,
8714                hi_lo: u64::read_xdr(r)?,
8715                lo_hi: u64::read_xdr(r)?,
8716                lo_lo: u64::read_xdr(r)?,
8717            })
8718        })
8719    }
8720}
8721
8722impl WriteXdr for Int256Parts {
8723    #[cfg(feature = "std")]
8724    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
8725        w.with_limited_depth(|w| {
8726            self.hi_hi.write_xdr(w)?;
8727            self.hi_lo.write_xdr(w)?;
8728            self.lo_hi.write_xdr(w)?;
8729            self.lo_lo.write_xdr(w)?;
8730            Ok(())
8731        })
8732    }
8733}
8734
8735/// ContractExecutableType is an XDR Enum defines as:
8736///
8737/// ```text
8738/// enum ContractExecutableType
8739/// {
8740///     CONTRACT_EXECUTABLE_WASM = 0,
8741///     CONTRACT_EXECUTABLE_STELLAR_ASSET = 1
8742/// };
8743/// ```
8744///
8745// enum
8746#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
8747#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
8748#[cfg_attr(
8749    all(feature = "serde", feature = "alloc"),
8750    derive(serde::Serialize, serde::Deserialize),
8751    serde(rename_all = "snake_case")
8752)]
8753#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
8754#[repr(i32)]
8755pub enum ContractExecutableType {
8756    Wasm = 0,
8757    StellarAsset = 1,
8758}
8759
8760impl ContractExecutableType {
8761    pub const VARIANTS: [ContractExecutableType; 2] = [
8762        ContractExecutableType::Wasm,
8763        ContractExecutableType::StellarAsset,
8764    ];
8765    pub const VARIANTS_STR: [&'static str; 2] = ["Wasm", "StellarAsset"];
8766
8767    #[must_use]
8768    pub const fn name(&self) -> &'static str {
8769        match self {
8770            Self::Wasm => "Wasm",
8771            Self::StellarAsset => "StellarAsset",
8772        }
8773    }
8774
8775    #[must_use]
8776    pub const fn variants() -> [ContractExecutableType; 2] {
8777        Self::VARIANTS
8778    }
8779}
8780
8781impl Name for ContractExecutableType {
8782    #[must_use]
8783    fn name(&self) -> &'static str {
8784        Self::name(self)
8785    }
8786}
8787
8788impl Variants<ContractExecutableType> for ContractExecutableType {
8789    fn variants() -> slice::Iter<'static, ContractExecutableType> {
8790        Self::VARIANTS.iter()
8791    }
8792}
8793
8794impl Enum for ContractExecutableType {}
8795
8796impl fmt::Display for ContractExecutableType {
8797    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
8798        f.write_str(self.name())
8799    }
8800}
8801
8802impl TryFrom<i32> for ContractExecutableType {
8803    type Error = Error;
8804
8805    fn try_from(i: i32) -> Result<Self> {
8806        let e = match i {
8807            0 => ContractExecutableType::Wasm,
8808            1 => ContractExecutableType::StellarAsset,
8809            #[allow(unreachable_patterns)]
8810            _ => return Err(Error::Invalid),
8811        };
8812        Ok(e)
8813    }
8814}
8815
8816impl From<ContractExecutableType> for i32 {
8817    #[must_use]
8818    fn from(e: ContractExecutableType) -> Self {
8819        e as Self
8820    }
8821}
8822
8823impl ReadXdr for ContractExecutableType {
8824    #[cfg(feature = "std")]
8825    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
8826        r.with_limited_depth(|r| {
8827            let e = i32::read_xdr(r)?;
8828            let v: Self = e.try_into()?;
8829            Ok(v)
8830        })
8831    }
8832}
8833
8834impl WriteXdr for ContractExecutableType {
8835    #[cfg(feature = "std")]
8836    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
8837        w.with_limited_depth(|w| {
8838            let i: i32 = (*self).into();
8839            i.write_xdr(w)
8840        })
8841    }
8842}
8843
8844/// ContractExecutable is an XDR Union defines as:
8845///
8846/// ```text
8847/// union ContractExecutable switch (ContractExecutableType type)
8848/// {
8849/// case CONTRACT_EXECUTABLE_WASM:
8850///     Hash wasm_hash;
8851/// case CONTRACT_EXECUTABLE_STELLAR_ASSET:
8852///     void;
8853/// };
8854/// ```
8855///
8856// union with discriminant ContractExecutableType
8857#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
8858#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
8859#[cfg_attr(
8860    all(feature = "serde", feature = "alloc"),
8861    derive(serde::Serialize, serde::Deserialize),
8862    serde(rename_all = "snake_case")
8863)]
8864#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
8865#[allow(clippy::large_enum_variant)]
8866pub enum ContractExecutable {
8867    Wasm(Hash),
8868    StellarAsset,
8869}
8870
8871impl ContractExecutable {
8872    pub const VARIANTS: [ContractExecutableType; 2] = [
8873        ContractExecutableType::Wasm,
8874        ContractExecutableType::StellarAsset,
8875    ];
8876    pub const VARIANTS_STR: [&'static str; 2] = ["Wasm", "StellarAsset"];
8877
8878    #[must_use]
8879    pub const fn name(&self) -> &'static str {
8880        match self {
8881            Self::Wasm(_) => "Wasm",
8882            Self::StellarAsset => "StellarAsset",
8883        }
8884    }
8885
8886    #[must_use]
8887    pub const fn discriminant(&self) -> ContractExecutableType {
8888        #[allow(clippy::match_same_arms)]
8889        match self {
8890            Self::Wasm(_) => ContractExecutableType::Wasm,
8891            Self::StellarAsset => ContractExecutableType::StellarAsset,
8892        }
8893    }
8894
8895    #[must_use]
8896    pub const fn variants() -> [ContractExecutableType; 2] {
8897        Self::VARIANTS
8898    }
8899}
8900
8901impl Name for ContractExecutable {
8902    #[must_use]
8903    fn name(&self) -> &'static str {
8904        Self::name(self)
8905    }
8906}
8907
8908impl Discriminant<ContractExecutableType> for ContractExecutable {
8909    #[must_use]
8910    fn discriminant(&self) -> ContractExecutableType {
8911        Self::discriminant(self)
8912    }
8913}
8914
8915impl Variants<ContractExecutableType> for ContractExecutable {
8916    fn variants() -> slice::Iter<'static, ContractExecutableType> {
8917        Self::VARIANTS.iter()
8918    }
8919}
8920
8921impl Union<ContractExecutableType> for ContractExecutable {}
8922
8923impl ReadXdr for ContractExecutable {
8924    #[cfg(feature = "std")]
8925    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
8926        r.with_limited_depth(|r| {
8927            let dv: ContractExecutableType = <ContractExecutableType as ReadXdr>::read_xdr(r)?;
8928            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
8929            let v = match dv {
8930                ContractExecutableType::Wasm => Self::Wasm(Hash::read_xdr(r)?),
8931                ContractExecutableType::StellarAsset => Self::StellarAsset,
8932                #[allow(unreachable_patterns)]
8933                _ => return Err(Error::Invalid),
8934            };
8935            Ok(v)
8936        })
8937    }
8938}
8939
8940impl WriteXdr for ContractExecutable {
8941    #[cfg(feature = "std")]
8942    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
8943        w.with_limited_depth(|w| {
8944            self.discriminant().write_xdr(w)?;
8945            #[allow(clippy::match_same_arms)]
8946            match self {
8947                Self::Wasm(v) => v.write_xdr(w)?,
8948                Self::StellarAsset => ().write_xdr(w)?,
8949            };
8950            Ok(())
8951        })
8952    }
8953}
8954
8955/// ScAddressType is an XDR Enum defines as:
8956///
8957/// ```text
8958/// enum SCAddressType
8959/// {
8960///     SC_ADDRESS_TYPE_ACCOUNT = 0,
8961///     SC_ADDRESS_TYPE_CONTRACT = 1
8962/// };
8963/// ```
8964///
8965// enum
8966#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
8967#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
8968#[cfg_attr(
8969    all(feature = "serde", feature = "alloc"),
8970    derive(serde::Serialize, serde::Deserialize),
8971    serde(rename_all = "snake_case")
8972)]
8973#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
8974#[repr(i32)]
8975pub enum ScAddressType {
8976    Account = 0,
8977    Contract = 1,
8978}
8979
8980impl ScAddressType {
8981    pub const VARIANTS: [ScAddressType; 2] = [ScAddressType::Account, ScAddressType::Contract];
8982    pub const VARIANTS_STR: [&'static str; 2] = ["Account", "Contract"];
8983
8984    #[must_use]
8985    pub const fn name(&self) -> &'static str {
8986        match self {
8987            Self::Account => "Account",
8988            Self::Contract => "Contract",
8989        }
8990    }
8991
8992    #[must_use]
8993    pub const fn variants() -> [ScAddressType; 2] {
8994        Self::VARIANTS
8995    }
8996}
8997
8998impl Name for ScAddressType {
8999    #[must_use]
9000    fn name(&self) -> &'static str {
9001        Self::name(self)
9002    }
9003}
9004
9005impl Variants<ScAddressType> for ScAddressType {
9006    fn variants() -> slice::Iter<'static, ScAddressType> {
9007        Self::VARIANTS.iter()
9008    }
9009}
9010
9011impl Enum for ScAddressType {}
9012
9013impl fmt::Display for ScAddressType {
9014    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
9015        f.write_str(self.name())
9016    }
9017}
9018
9019impl TryFrom<i32> for ScAddressType {
9020    type Error = Error;
9021
9022    fn try_from(i: i32) -> Result<Self> {
9023        let e = match i {
9024            0 => ScAddressType::Account,
9025            1 => ScAddressType::Contract,
9026            #[allow(unreachable_patterns)]
9027            _ => return Err(Error::Invalid),
9028        };
9029        Ok(e)
9030    }
9031}
9032
9033impl From<ScAddressType> for i32 {
9034    #[must_use]
9035    fn from(e: ScAddressType) -> Self {
9036        e as Self
9037    }
9038}
9039
9040impl ReadXdr for ScAddressType {
9041    #[cfg(feature = "std")]
9042    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
9043        r.with_limited_depth(|r| {
9044            let e = i32::read_xdr(r)?;
9045            let v: Self = e.try_into()?;
9046            Ok(v)
9047        })
9048    }
9049}
9050
9051impl WriteXdr for ScAddressType {
9052    #[cfg(feature = "std")]
9053    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
9054        w.with_limited_depth(|w| {
9055            let i: i32 = (*self).into();
9056            i.write_xdr(w)
9057        })
9058    }
9059}
9060
9061/// ScAddress is an XDR Union defines as:
9062///
9063/// ```text
9064/// union SCAddress switch (SCAddressType type)
9065/// {
9066/// case SC_ADDRESS_TYPE_ACCOUNT:
9067///     AccountID accountId;
9068/// case SC_ADDRESS_TYPE_CONTRACT:
9069///     Hash contractId;
9070/// };
9071/// ```
9072///
9073// union with discriminant ScAddressType
9074#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
9075#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
9076#[cfg_attr(
9077    all(feature = "serde", feature = "alloc"),
9078    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
9079)]
9080#[allow(clippy::large_enum_variant)]
9081pub enum ScAddress {
9082    Account(AccountId),
9083    Contract(Hash),
9084}
9085
9086impl ScAddress {
9087    pub const VARIANTS: [ScAddressType; 2] = [ScAddressType::Account, ScAddressType::Contract];
9088    pub const VARIANTS_STR: [&'static str; 2] = ["Account", "Contract"];
9089
9090    #[must_use]
9091    pub const fn name(&self) -> &'static str {
9092        match self {
9093            Self::Account(_) => "Account",
9094            Self::Contract(_) => "Contract",
9095        }
9096    }
9097
9098    #[must_use]
9099    pub const fn discriminant(&self) -> ScAddressType {
9100        #[allow(clippy::match_same_arms)]
9101        match self {
9102            Self::Account(_) => ScAddressType::Account,
9103            Self::Contract(_) => ScAddressType::Contract,
9104        }
9105    }
9106
9107    #[must_use]
9108    pub const fn variants() -> [ScAddressType; 2] {
9109        Self::VARIANTS
9110    }
9111}
9112
9113impl Name for ScAddress {
9114    #[must_use]
9115    fn name(&self) -> &'static str {
9116        Self::name(self)
9117    }
9118}
9119
9120impl Discriminant<ScAddressType> for ScAddress {
9121    #[must_use]
9122    fn discriminant(&self) -> ScAddressType {
9123        Self::discriminant(self)
9124    }
9125}
9126
9127impl Variants<ScAddressType> for ScAddress {
9128    fn variants() -> slice::Iter<'static, ScAddressType> {
9129        Self::VARIANTS.iter()
9130    }
9131}
9132
9133impl Union<ScAddressType> for ScAddress {}
9134
9135impl ReadXdr for ScAddress {
9136    #[cfg(feature = "std")]
9137    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
9138        r.with_limited_depth(|r| {
9139            let dv: ScAddressType = <ScAddressType as ReadXdr>::read_xdr(r)?;
9140            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
9141            let v = match dv {
9142                ScAddressType::Account => Self::Account(AccountId::read_xdr(r)?),
9143                ScAddressType::Contract => Self::Contract(Hash::read_xdr(r)?),
9144                #[allow(unreachable_patterns)]
9145                _ => return Err(Error::Invalid),
9146            };
9147            Ok(v)
9148        })
9149    }
9150}
9151
9152impl WriteXdr for ScAddress {
9153    #[cfg(feature = "std")]
9154    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
9155        w.with_limited_depth(|w| {
9156            self.discriminant().write_xdr(w)?;
9157            #[allow(clippy::match_same_arms)]
9158            match self {
9159                Self::Account(v) => v.write_xdr(w)?,
9160                Self::Contract(v) => v.write_xdr(w)?,
9161            };
9162            Ok(())
9163        })
9164    }
9165}
9166
9167/// ScsymbolLimit is an XDR Const defines as:
9168///
9169/// ```text
9170/// const SCSYMBOL_LIMIT = 32;
9171/// ```
9172///
9173pub const SCSYMBOL_LIMIT: u64 = 32;
9174
9175/// ScVec is an XDR Typedef defines as:
9176///
9177/// ```text
9178/// typedef SCVal SCVec<>;
9179/// ```
9180///
9181#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
9182#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
9183#[derive(Default)]
9184#[cfg_attr(
9185    all(feature = "serde", feature = "alloc"),
9186    derive(serde::Serialize, serde::Deserialize),
9187    serde(rename_all = "snake_case")
9188)]
9189#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
9190#[derive(Debug)]
9191pub struct ScVec(pub VecM<ScVal>);
9192
9193impl From<ScVec> for VecM<ScVal> {
9194    #[must_use]
9195    fn from(x: ScVec) -> Self {
9196        x.0
9197    }
9198}
9199
9200impl From<VecM<ScVal>> for ScVec {
9201    #[must_use]
9202    fn from(x: VecM<ScVal>) -> Self {
9203        ScVec(x)
9204    }
9205}
9206
9207impl AsRef<VecM<ScVal>> for ScVec {
9208    #[must_use]
9209    fn as_ref(&self) -> &VecM<ScVal> {
9210        &self.0
9211    }
9212}
9213
9214impl ReadXdr for ScVec {
9215    #[cfg(feature = "std")]
9216    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
9217        r.with_limited_depth(|r| {
9218            let i = VecM::<ScVal>::read_xdr(r)?;
9219            let v = ScVec(i);
9220            Ok(v)
9221        })
9222    }
9223}
9224
9225impl WriteXdr for ScVec {
9226    #[cfg(feature = "std")]
9227    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
9228        w.with_limited_depth(|w| self.0.write_xdr(w))
9229    }
9230}
9231
9232impl Deref for ScVec {
9233    type Target = VecM<ScVal>;
9234    fn deref(&self) -> &Self::Target {
9235        &self.0
9236    }
9237}
9238
9239impl From<ScVec> for Vec<ScVal> {
9240    #[must_use]
9241    fn from(x: ScVec) -> Self {
9242        x.0 .0
9243    }
9244}
9245
9246impl TryFrom<Vec<ScVal>> for ScVec {
9247    type Error = Error;
9248    fn try_from(x: Vec<ScVal>) -> Result<Self> {
9249        Ok(ScVec(x.try_into()?))
9250    }
9251}
9252
9253#[cfg(feature = "alloc")]
9254impl TryFrom<&Vec<ScVal>> for ScVec {
9255    type Error = Error;
9256    fn try_from(x: &Vec<ScVal>) -> Result<Self> {
9257        Ok(ScVec(x.try_into()?))
9258    }
9259}
9260
9261impl AsRef<Vec<ScVal>> for ScVec {
9262    #[must_use]
9263    fn as_ref(&self) -> &Vec<ScVal> {
9264        &self.0 .0
9265    }
9266}
9267
9268impl AsRef<[ScVal]> for ScVec {
9269    #[cfg(feature = "alloc")]
9270    #[must_use]
9271    fn as_ref(&self) -> &[ScVal] {
9272        &self.0 .0
9273    }
9274    #[cfg(not(feature = "alloc"))]
9275    #[must_use]
9276    fn as_ref(&self) -> &[ScVal] {
9277        self.0 .0
9278    }
9279}
9280
9281/// ScMap is an XDR Typedef defines as:
9282///
9283/// ```text
9284/// typedef SCMapEntry SCMap<>;
9285/// ```
9286///
9287#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
9288#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
9289#[derive(Default)]
9290#[cfg_attr(
9291    all(feature = "serde", feature = "alloc"),
9292    derive(serde::Serialize, serde::Deserialize),
9293    serde(rename_all = "snake_case")
9294)]
9295#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
9296#[derive(Debug)]
9297pub struct ScMap(pub VecM<ScMapEntry>);
9298
9299impl From<ScMap> for VecM<ScMapEntry> {
9300    #[must_use]
9301    fn from(x: ScMap) -> Self {
9302        x.0
9303    }
9304}
9305
9306impl From<VecM<ScMapEntry>> for ScMap {
9307    #[must_use]
9308    fn from(x: VecM<ScMapEntry>) -> Self {
9309        ScMap(x)
9310    }
9311}
9312
9313impl AsRef<VecM<ScMapEntry>> for ScMap {
9314    #[must_use]
9315    fn as_ref(&self) -> &VecM<ScMapEntry> {
9316        &self.0
9317    }
9318}
9319
9320impl ReadXdr for ScMap {
9321    #[cfg(feature = "std")]
9322    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
9323        r.with_limited_depth(|r| {
9324            let i = VecM::<ScMapEntry>::read_xdr(r)?;
9325            let v = ScMap(i);
9326            Ok(v)
9327        })
9328    }
9329}
9330
9331impl WriteXdr for ScMap {
9332    #[cfg(feature = "std")]
9333    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
9334        w.with_limited_depth(|w| self.0.write_xdr(w))
9335    }
9336}
9337
9338impl Deref for ScMap {
9339    type Target = VecM<ScMapEntry>;
9340    fn deref(&self) -> &Self::Target {
9341        &self.0
9342    }
9343}
9344
9345impl From<ScMap> for Vec<ScMapEntry> {
9346    #[must_use]
9347    fn from(x: ScMap) -> Self {
9348        x.0 .0
9349    }
9350}
9351
9352impl TryFrom<Vec<ScMapEntry>> for ScMap {
9353    type Error = Error;
9354    fn try_from(x: Vec<ScMapEntry>) -> Result<Self> {
9355        Ok(ScMap(x.try_into()?))
9356    }
9357}
9358
9359#[cfg(feature = "alloc")]
9360impl TryFrom<&Vec<ScMapEntry>> for ScMap {
9361    type Error = Error;
9362    fn try_from(x: &Vec<ScMapEntry>) -> Result<Self> {
9363        Ok(ScMap(x.try_into()?))
9364    }
9365}
9366
9367impl AsRef<Vec<ScMapEntry>> for ScMap {
9368    #[must_use]
9369    fn as_ref(&self) -> &Vec<ScMapEntry> {
9370        &self.0 .0
9371    }
9372}
9373
9374impl AsRef<[ScMapEntry]> for ScMap {
9375    #[cfg(feature = "alloc")]
9376    #[must_use]
9377    fn as_ref(&self) -> &[ScMapEntry] {
9378        &self.0 .0
9379    }
9380    #[cfg(not(feature = "alloc"))]
9381    #[must_use]
9382    fn as_ref(&self) -> &[ScMapEntry] {
9383        self.0 .0
9384    }
9385}
9386
9387/// ScBytes is an XDR Typedef defines as:
9388///
9389/// ```text
9390/// typedef opaque SCBytes<>;
9391/// ```
9392///
9393#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
9394#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
9395#[derive(Default)]
9396#[cfg_attr(
9397    all(feature = "serde", feature = "alloc"),
9398    derive(serde::Serialize, serde::Deserialize),
9399    serde(rename_all = "snake_case")
9400)]
9401#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
9402#[derive(Debug)]
9403pub struct ScBytes(pub BytesM);
9404
9405impl From<ScBytes> for BytesM {
9406    #[must_use]
9407    fn from(x: ScBytes) -> Self {
9408        x.0
9409    }
9410}
9411
9412impl From<BytesM> for ScBytes {
9413    #[must_use]
9414    fn from(x: BytesM) -> Self {
9415        ScBytes(x)
9416    }
9417}
9418
9419impl AsRef<BytesM> for ScBytes {
9420    #[must_use]
9421    fn as_ref(&self) -> &BytesM {
9422        &self.0
9423    }
9424}
9425
9426impl ReadXdr for ScBytes {
9427    #[cfg(feature = "std")]
9428    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
9429        r.with_limited_depth(|r| {
9430            let i = BytesM::read_xdr(r)?;
9431            let v = ScBytes(i);
9432            Ok(v)
9433        })
9434    }
9435}
9436
9437impl WriteXdr for ScBytes {
9438    #[cfg(feature = "std")]
9439    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
9440        w.with_limited_depth(|w| self.0.write_xdr(w))
9441    }
9442}
9443
9444impl Deref for ScBytes {
9445    type Target = BytesM;
9446    fn deref(&self) -> &Self::Target {
9447        &self.0
9448    }
9449}
9450
9451impl From<ScBytes> for Vec<u8> {
9452    #[must_use]
9453    fn from(x: ScBytes) -> Self {
9454        x.0 .0
9455    }
9456}
9457
9458impl TryFrom<Vec<u8>> for ScBytes {
9459    type Error = Error;
9460    fn try_from(x: Vec<u8>) -> Result<Self> {
9461        Ok(ScBytes(x.try_into()?))
9462    }
9463}
9464
9465#[cfg(feature = "alloc")]
9466impl TryFrom<&Vec<u8>> for ScBytes {
9467    type Error = Error;
9468    fn try_from(x: &Vec<u8>) -> Result<Self> {
9469        Ok(ScBytes(x.try_into()?))
9470    }
9471}
9472
9473impl AsRef<Vec<u8>> for ScBytes {
9474    #[must_use]
9475    fn as_ref(&self) -> &Vec<u8> {
9476        &self.0 .0
9477    }
9478}
9479
9480impl AsRef<[u8]> for ScBytes {
9481    #[cfg(feature = "alloc")]
9482    #[must_use]
9483    fn as_ref(&self) -> &[u8] {
9484        &self.0 .0
9485    }
9486    #[cfg(not(feature = "alloc"))]
9487    #[must_use]
9488    fn as_ref(&self) -> &[u8] {
9489        self.0 .0
9490    }
9491}
9492
9493/// ScString is an XDR Typedef defines as:
9494///
9495/// ```text
9496/// typedef string SCString<>;
9497/// ```
9498///
9499#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
9500#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
9501#[derive(Default)]
9502#[cfg_attr(
9503    all(feature = "serde", feature = "alloc"),
9504    derive(serde::Serialize, serde::Deserialize),
9505    serde(rename_all = "snake_case")
9506)]
9507#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
9508#[derive(Debug)]
9509pub struct ScString(pub StringM);
9510
9511impl From<ScString> for StringM {
9512    #[must_use]
9513    fn from(x: ScString) -> Self {
9514        x.0
9515    }
9516}
9517
9518impl From<StringM> for ScString {
9519    #[must_use]
9520    fn from(x: StringM) -> Self {
9521        ScString(x)
9522    }
9523}
9524
9525impl AsRef<StringM> for ScString {
9526    #[must_use]
9527    fn as_ref(&self) -> &StringM {
9528        &self.0
9529    }
9530}
9531
9532impl ReadXdr for ScString {
9533    #[cfg(feature = "std")]
9534    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
9535        r.with_limited_depth(|r| {
9536            let i = StringM::read_xdr(r)?;
9537            let v = ScString(i);
9538            Ok(v)
9539        })
9540    }
9541}
9542
9543impl WriteXdr for ScString {
9544    #[cfg(feature = "std")]
9545    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
9546        w.with_limited_depth(|w| self.0.write_xdr(w))
9547    }
9548}
9549
9550impl Deref for ScString {
9551    type Target = StringM;
9552    fn deref(&self) -> &Self::Target {
9553        &self.0
9554    }
9555}
9556
9557impl From<ScString> for Vec<u8> {
9558    #[must_use]
9559    fn from(x: ScString) -> Self {
9560        x.0 .0
9561    }
9562}
9563
9564impl TryFrom<Vec<u8>> for ScString {
9565    type Error = Error;
9566    fn try_from(x: Vec<u8>) -> Result<Self> {
9567        Ok(ScString(x.try_into()?))
9568    }
9569}
9570
9571#[cfg(feature = "alloc")]
9572impl TryFrom<&Vec<u8>> for ScString {
9573    type Error = Error;
9574    fn try_from(x: &Vec<u8>) -> Result<Self> {
9575        Ok(ScString(x.try_into()?))
9576    }
9577}
9578
9579impl AsRef<Vec<u8>> for ScString {
9580    #[must_use]
9581    fn as_ref(&self) -> &Vec<u8> {
9582        &self.0 .0
9583    }
9584}
9585
9586impl AsRef<[u8]> for ScString {
9587    #[cfg(feature = "alloc")]
9588    #[must_use]
9589    fn as_ref(&self) -> &[u8] {
9590        &self.0 .0
9591    }
9592    #[cfg(not(feature = "alloc"))]
9593    #[must_use]
9594    fn as_ref(&self) -> &[u8] {
9595        self.0 .0
9596    }
9597}
9598
9599/// ScSymbol is an XDR Typedef defines as:
9600///
9601/// ```text
9602/// typedef string SCSymbol<SCSYMBOL_LIMIT>;
9603/// ```
9604///
9605#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
9606#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
9607#[derive(Default)]
9608#[cfg_attr(
9609    all(feature = "serde", feature = "alloc"),
9610    derive(serde::Serialize, serde::Deserialize),
9611    serde(rename_all = "snake_case")
9612)]
9613#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
9614#[derive(Debug)]
9615pub struct ScSymbol(pub StringM<32>);
9616
9617impl From<ScSymbol> for StringM<32> {
9618    #[must_use]
9619    fn from(x: ScSymbol) -> Self {
9620        x.0
9621    }
9622}
9623
9624impl From<StringM<32>> for ScSymbol {
9625    #[must_use]
9626    fn from(x: StringM<32>) -> Self {
9627        ScSymbol(x)
9628    }
9629}
9630
9631impl AsRef<StringM<32>> for ScSymbol {
9632    #[must_use]
9633    fn as_ref(&self) -> &StringM<32> {
9634        &self.0
9635    }
9636}
9637
9638impl ReadXdr for ScSymbol {
9639    #[cfg(feature = "std")]
9640    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
9641        r.with_limited_depth(|r| {
9642            let i = StringM::<32>::read_xdr(r)?;
9643            let v = ScSymbol(i);
9644            Ok(v)
9645        })
9646    }
9647}
9648
9649impl WriteXdr for ScSymbol {
9650    #[cfg(feature = "std")]
9651    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
9652        w.with_limited_depth(|w| self.0.write_xdr(w))
9653    }
9654}
9655
9656impl Deref for ScSymbol {
9657    type Target = StringM<32>;
9658    fn deref(&self) -> &Self::Target {
9659        &self.0
9660    }
9661}
9662
9663impl From<ScSymbol> for Vec<u8> {
9664    #[must_use]
9665    fn from(x: ScSymbol) -> Self {
9666        x.0 .0
9667    }
9668}
9669
9670impl TryFrom<Vec<u8>> for ScSymbol {
9671    type Error = Error;
9672    fn try_from(x: Vec<u8>) -> Result<Self> {
9673        Ok(ScSymbol(x.try_into()?))
9674    }
9675}
9676
9677#[cfg(feature = "alloc")]
9678impl TryFrom<&Vec<u8>> for ScSymbol {
9679    type Error = Error;
9680    fn try_from(x: &Vec<u8>) -> Result<Self> {
9681        Ok(ScSymbol(x.try_into()?))
9682    }
9683}
9684
9685impl AsRef<Vec<u8>> for ScSymbol {
9686    #[must_use]
9687    fn as_ref(&self) -> &Vec<u8> {
9688        &self.0 .0
9689    }
9690}
9691
9692impl AsRef<[u8]> for ScSymbol {
9693    #[cfg(feature = "alloc")]
9694    #[must_use]
9695    fn as_ref(&self) -> &[u8] {
9696        &self.0 .0
9697    }
9698    #[cfg(not(feature = "alloc"))]
9699    #[must_use]
9700    fn as_ref(&self) -> &[u8] {
9701        self.0 .0
9702    }
9703}
9704
9705/// ScNonceKey is an XDR Struct defines as:
9706///
9707/// ```text
9708/// struct SCNonceKey {
9709///     int64 nonce;
9710/// };
9711/// ```
9712///
9713#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
9714#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
9715#[cfg_attr(
9716    all(feature = "serde", feature = "alloc"),
9717    derive(serde::Serialize, serde::Deserialize),
9718    serde(rename_all = "snake_case")
9719)]
9720#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
9721pub struct ScNonceKey {
9722    pub nonce: i64,
9723}
9724
9725impl ReadXdr for ScNonceKey {
9726    #[cfg(feature = "std")]
9727    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
9728        r.with_limited_depth(|r| {
9729            Ok(Self {
9730                nonce: i64::read_xdr(r)?,
9731            })
9732        })
9733    }
9734}
9735
9736impl WriteXdr for ScNonceKey {
9737    #[cfg(feature = "std")]
9738    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
9739        w.with_limited_depth(|w| {
9740            self.nonce.write_xdr(w)?;
9741            Ok(())
9742        })
9743    }
9744}
9745
9746/// ScContractInstance is an XDR Struct defines as:
9747///
9748/// ```text
9749/// struct SCContractInstance {
9750///     ContractExecutable executable;
9751///     SCMap* storage;
9752/// };
9753/// ```
9754///
9755#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
9756#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
9757#[cfg_attr(
9758    all(feature = "serde", feature = "alloc"),
9759    derive(serde::Serialize, serde::Deserialize),
9760    serde(rename_all = "snake_case")
9761)]
9762#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
9763pub struct ScContractInstance {
9764    pub executable: ContractExecutable,
9765    pub storage: Option<ScMap>,
9766}
9767
9768impl ReadXdr for ScContractInstance {
9769    #[cfg(feature = "std")]
9770    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
9771        r.with_limited_depth(|r| {
9772            Ok(Self {
9773                executable: ContractExecutable::read_xdr(r)?,
9774                storage: Option::<ScMap>::read_xdr(r)?,
9775            })
9776        })
9777    }
9778}
9779
9780impl WriteXdr for ScContractInstance {
9781    #[cfg(feature = "std")]
9782    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
9783        w.with_limited_depth(|w| {
9784            self.executable.write_xdr(w)?;
9785            self.storage.write_xdr(w)?;
9786            Ok(())
9787        })
9788    }
9789}
9790
9791/// ScVal is an XDR Union defines as:
9792///
9793/// ```text
9794/// union SCVal switch (SCValType type)
9795/// {
9796///
9797/// case SCV_BOOL:
9798///     bool b;
9799/// case SCV_VOID:
9800///     void;
9801/// case SCV_ERROR:
9802///     SCError error;
9803///
9804/// case SCV_U32:
9805///     uint32 u32;
9806/// case SCV_I32:
9807///     int32 i32;
9808///
9809/// case SCV_U64:
9810///     uint64 u64;
9811/// case SCV_I64:
9812///     int64 i64;
9813/// case SCV_TIMEPOINT:
9814///     TimePoint timepoint;
9815/// case SCV_DURATION:
9816///     Duration duration;
9817///
9818/// case SCV_U128:
9819///     UInt128Parts u128;
9820/// case SCV_I128:
9821///     Int128Parts i128;
9822///
9823/// case SCV_U256:
9824///     UInt256Parts u256;
9825/// case SCV_I256:
9826///     Int256Parts i256;
9827///
9828/// case SCV_BYTES:
9829///     SCBytes bytes;
9830/// case SCV_STRING:
9831///     SCString str;
9832/// case SCV_SYMBOL:
9833///     SCSymbol sym;
9834///
9835/// // Vec and Map are recursive so need to live
9836/// // behind an option, due to xdrpp limitations.
9837/// case SCV_VEC:
9838///     SCVec *vec;
9839/// case SCV_MAP:
9840///     SCMap *map;
9841///
9842/// case SCV_ADDRESS:
9843///     SCAddress address;
9844///
9845/// // Special SCVals reserved for system-constructed contract-data
9846/// // ledger keys, not generally usable elsewhere.
9847/// case SCV_LEDGER_KEY_CONTRACT_INSTANCE:
9848///     void;
9849/// case SCV_LEDGER_KEY_NONCE:
9850///     SCNonceKey nonce_key;
9851///
9852/// case SCV_CONTRACT_INSTANCE:
9853///     SCContractInstance instance;
9854/// };
9855/// ```
9856///
9857// union with discriminant ScValType
9858#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
9859#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
9860#[cfg_attr(
9861    all(feature = "serde", feature = "alloc"),
9862    derive(serde::Serialize, serde::Deserialize),
9863    serde(rename_all = "snake_case")
9864)]
9865#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
9866#[allow(clippy::large_enum_variant)]
9867pub enum ScVal {
9868    Bool(bool),
9869    Void,
9870    Error(ScError),
9871    U32(u32),
9872    I32(i32),
9873    U64(u64),
9874    I64(i64),
9875    Timepoint(TimePoint),
9876    Duration(Duration),
9877    U128(UInt128Parts),
9878    I128(Int128Parts),
9879    U256(UInt256Parts),
9880    I256(Int256Parts),
9881    Bytes(ScBytes),
9882    String(ScString),
9883    Symbol(ScSymbol),
9884    Vec(Option<ScVec>),
9885    Map(Option<ScMap>),
9886    Address(ScAddress),
9887    LedgerKeyContractInstance,
9888    LedgerKeyNonce(ScNonceKey),
9889    ContractInstance(ScContractInstance),
9890}
9891
9892impl ScVal {
9893    pub const VARIANTS: [ScValType; 22] = [
9894        ScValType::Bool,
9895        ScValType::Void,
9896        ScValType::Error,
9897        ScValType::U32,
9898        ScValType::I32,
9899        ScValType::U64,
9900        ScValType::I64,
9901        ScValType::Timepoint,
9902        ScValType::Duration,
9903        ScValType::U128,
9904        ScValType::I128,
9905        ScValType::U256,
9906        ScValType::I256,
9907        ScValType::Bytes,
9908        ScValType::String,
9909        ScValType::Symbol,
9910        ScValType::Vec,
9911        ScValType::Map,
9912        ScValType::Address,
9913        ScValType::LedgerKeyContractInstance,
9914        ScValType::LedgerKeyNonce,
9915        ScValType::ContractInstance,
9916    ];
9917    pub const VARIANTS_STR: [&'static str; 22] = [
9918        "Bool",
9919        "Void",
9920        "Error",
9921        "U32",
9922        "I32",
9923        "U64",
9924        "I64",
9925        "Timepoint",
9926        "Duration",
9927        "U128",
9928        "I128",
9929        "U256",
9930        "I256",
9931        "Bytes",
9932        "String",
9933        "Symbol",
9934        "Vec",
9935        "Map",
9936        "Address",
9937        "LedgerKeyContractInstance",
9938        "LedgerKeyNonce",
9939        "ContractInstance",
9940    ];
9941
9942    #[must_use]
9943    pub const fn name(&self) -> &'static str {
9944        match self {
9945            Self::Bool(_) => "Bool",
9946            Self::Void => "Void",
9947            Self::Error(_) => "Error",
9948            Self::U32(_) => "U32",
9949            Self::I32(_) => "I32",
9950            Self::U64(_) => "U64",
9951            Self::I64(_) => "I64",
9952            Self::Timepoint(_) => "Timepoint",
9953            Self::Duration(_) => "Duration",
9954            Self::U128(_) => "U128",
9955            Self::I128(_) => "I128",
9956            Self::U256(_) => "U256",
9957            Self::I256(_) => "I256",
9958            Self::Bytes(_) => "Bytes",
9959            Self::String(_) => "String",
9960            Self::Symbol(_) => "Symbol",
9961            Self::Vec(_) => "Vec",
9962            Self::Map(_) => "Map",
9963            Self::Address(_) => "Address",
9964            Self::LedgerKeyContractInstance => "LedgerKeyContractInstance",
9965            Self::LedgerKeyNonce(_) => "LedgerKeyNonce",
9966            Self::ContractInstance(_) => "ContractInstance",
9967        }
9968    }
9969
9970    #[must_use]
9971    pub const fn discriminant(&self) -> ScValType {
9972        #[allow(clippy::match_same_arms)]
9973        match self {
9974            Self::Bool(_) => ScValType::Bool,
9975            Self::Void => ScValType::Void,
9976            Self::Error(_) => ScValType::Error,
9977            Self::U32(_) => ScValType::U32,
9978            Self::I32(_) => ScValType::I32,
9979            Self::U64(_) => ScValType::U64,
9980            Self::I64(_) => ScValType::I64,
9981            Self::Timepoint(_) => ScValType::Timepoint,
9982            Self::Duration(_) => ScValType::Duration,
9983            Self::U128(_) => ScValType::U128,
9984            Self::I128(_) => ScValType::I128,
9985            Self::U256(_) => ScValType::U256,
9986            Self::I256(_) => ScValType::I256,
9987            Self::Bytes(_) => ScValType::Bytes,
9988            Self::String(_) => ScValType::String,
9989            Self::Symbol(_) => ScValType::Symbol,
9990            Self::Vec(_) => ScValType::Vec,
9991            Self::Map(_) => ScValType::Map,
9992            Self::Address(_) => ScValType::Address,
9993            Self::LedgerKeyContractInstance => ScValType::LedgerKeyContractInstance,
9994            Self::LedgerKeyNonce(_) => ScValType::LedgerKeyNonce,
9995            Self::ContractInstance(_) => ScValType::ContractInstance,
9996        }
9997    }
9998
9999    #[must_use]
10000    pub const fn variants() -> [ScValType; 22] {
10001        Self::VARIANTS
10002    }
10003}
10004
10005impl Name for ScVal {
10006    #[must_use]
10007    fn name(&self) -> &'static str {
10008        Self::name(self)
10009    }
10010}
10011
10012impl Discriminant<ScValType> for ScVal {
10013    #[must_use]
10014    fn discriminant(&self) -> ScValType {
10015        Self::discriminant(self)
10016    }
10017}
10018
10019impl Variants<ScValType> for ScVal {
10020    fn variants() -> slice::Iter<'static, ScValType> {
10021        Self::VARIANTS.iter()
10022    }
10023}
10024
10025impl Union<ScValType> for ScVal {}
10026
10027impl ReadXdr for ScVal {
10028    #[cfg(feature = "std")]
10029    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
10030        r.with_limited_depth(|r| {
10031            let dv: ScValType = <ScValType as ReadXdr>::read_xdr(r)?;
10032            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
10033            let v = match dv {
10034                ScValType::Bool => Self::Bool(bool::read_xdr(r)?),
10035                ScValType::Void => Self::Void,
10036                ScValType::Error => Self::Error(ScError::read_xdr(r)?),
10037                ScValType::U32 => Self::U32(u32::read_xdr(r)?),
10038                ScValType::I32 => Self::I32(i32::read_xdr(r)?),
10039                ScValType::U64 => Self::U64(u64::read_xdr(r)?),
10040                ScValType::I64 => Self::I64(i64::read_xdr(r)?),
10041                ScValType::Timepoint => Self::Timepoint(TimePoint::read_xdr(r)?),
10042                ScValType::Duration => Self::Duration(Duration::read_xdr(r)?),
10043                ScValType::U128 => Self::U128(UInt128Parts::read_xdr(r)?),
10044                ScValType::I128 => Self::I128(Int128Parts::read_xdr(r)?),
10045                ScValType::U256 => Self::U256(UInt256Parts::read_xdr(r)?),
10046                ScValType::I256 => Self::I256(Int256Parts::read_xdr(r)?),
10047                ScValType::Bytes => Self::Bytes(ScBytes::read_xdr(r)?),
10048                ScValType::String => Self::String(ScString::read_xdr(r)?),
10049                ScValType::Symbol => Self::Symbol(ScSymbol::read_xdr(r)?),
10050                ScValType::Vec => Self::Vec(Option::<ScVec>::read_xdr(r)?),
10051                ScValType::Map => Self::Map(Option::<ScMap>::read_xdr(r)?),
10052                ScValType::Address => Self::Address(ScAddress::read_xdr(r)?),
10053                ScValType::LedgerKeyContractInstance => Self::LedgerKeyContractInstance,
10054                ScValType::LedgerKeyNonce => Self::LedgerKeyNonce(ScNonceKey::read_xdr(r)?),
10055                ScValType::ContractInstance => {
10056                    Self::ContractInstance(ScContractInstance::read_xdr(r)?)
10057                }
10058                #[allow(unreachable_patterns)]
10059                _ => return Err(Error::Invalid),
10060            };
10061            Ok(v)
10062        })
10063    }
10064}
10065
10066impl WriteXdr for ScVal {
10067    #[cfg(feature = "std")]
10068    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
10069        w.with_limited_depth(|w| {
10070            self.discriminant().write_xdr(w)?;
10071            #[allow(clippy::match_same_arms)]
10072            match self {
10073                Self::Bool(v) => v.write_xdr(w)?,
10074                Self::Void => ().write_xdr(w)?,
10075                Self::Error(v) => v.write_xdr(w)?,
10076                Self::U32(v) => v.write_xdr(w)?,
10077                Self::I32(v) => v.write_xdr(w)?,
10078                Self::U64(v) => v.write_xdr(w)?,
10079                Self::I64(v) => v.write_xdr(w)?,
10080                Self::Timepoint(v) => v.write_xdr(w)?,
10081                Self::Duration(v) => v.write_xdr(w)?,
10082                Self::U128(v) => v.write_xdr(w)?,
10083                Self::I128(v) => v.write_xdr(w)?,
10084                Self::U256(v) => v.write_xdr(w)?,
10085                Self::I256(v) => v.write_xdr(w)?,
10086                Self::Bytes(v) => v.write_xdr(w)?,
10087                Self::String(v) => v.write_xdr(w)?,
10088                Self::Symbol(v) => v.write_xdr(w)?,
10089                Self::Vec(v) => v.write_xdr(w)?,
10090                Self::Map(v) => v.write_xdr(w)?,
10091                Self::Address(v) => v.write_xdr(w)?,
10092                Self::LedgerKeyContractInstance => ().write_xdr(w)?,
10093                Self::LedgerKeyNonce(v) => v.write_xdr(w)?,
10094                Self::ContractInstance(v) => v.write_xdr(w)?,
10095            };
10096            Ok(())
10097        })
10098    }
10099}
10100
10101/// ScMapEntry is an XDR Struct defines as:
10102///
10103/// ```text
10104/// struct SCMapEntry
10105/// {
10106///     SCVal key;
10107///     SCVal val;
10108/// };
10109/// ```
10110///
10111#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
10112#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
10113#[cfg_attr(
10114    all(feature = "serde", feature = "alloc"),
10115    derive(serde::Serialize, serde::Deserialize),
10116    serde(rename_all = "snake_case")
10117)]
10118#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
10119pub struct ScMapEntry {
10120    pub key: ScVal,
10121    pub val: ScVal,
10122}
10123
10124impl ReadXdr for ScMapEntry {
10125    #[cfg(feature = "std")]
10126    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
10127        r.with_limited_depth(|r| {
10128            Ok(Self {
10129                key: ScVal::read_xdr(r)?,
10130                val: ScVal::read_xdr(r)?,
10131            })
10132        })
10133    }
10134}
10135
10136impl WriteXdr for ScMapEntry {
10137    #[cfg(feature = "std")]
10138    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
10139        w.with_limited_depth(|w| {
10140            self.key.write_xdr(w)?;
10141            self.val.write_xdr(w)?;
10142            Ok(())
10143        })
10144    }
10145}
10146
10147/// StoredTransactionSet is an XDR Union defines as:
10148///
10149/// ```text
10150/// union StoredTransactionSet switch (int v)
10151/// {
10152/// case 0:
10153/// 	TransactionSet txSet;
10154/// case 1:
10155/// 	GeneralizedTransactionSet generalizedTxSet;
10156/// };
10157/// ```
10158///
10159// union with discriminant i32
10160#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
10161#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
10162#[cfg_attr(
10163    all(feature = "serde", feature = "alloc"),
10164    derive(serde::Serialize, serde::Deserialize),
10165    serde(rename_all = "snake_case")
10166)]
10167#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
10168#[allow(clippy::large_enum_variant)]
10169pub enum StoredTransactionSet {
10170    V0(TransactionSet),
10171    V1(GeneralizedTransactionSet),
10172}
10173
10174impl StoredTransactionSet {
10175    pub const VARIANTS: [i32; 2] = [0, 1];
10176    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"];
10177
10178    #[must_use]
10179    pub const fn name(&self) -> &'static str {
10180        match self {
10181            Self::V0(_) => "V0",
10182            Self::V1(_) => "V1",
10183        }
10184    }
10185
10186    #[must_use]
10187    pub const fn discriminant(&self) -> i32 {
10188        #[allow(clippy::match_same_arms)]
10189        match self {
10190            Self::V0(_) => 0,
10191            Self::V1(_) => 1,
10192        }
10193    }
10194
10195    #[must_use]
10196    pub const fn variants() -> [i32; 2] {
10197        Self::VARIANTS
10198    }
10199}
10200
10201impl Name for StoredTransactionSet {
10202    #[must_use]
10203    fn name(&self) -> &'static str {
10204        Self::name(self)
10205    }
10206}
10207
10208impl Discriminant<i32> for StoredTransactionSet {
10209    #[must_use]
10210    fn discriminant(&self) -> i32 {
10211        Self::discriminant(self)
10212    }
10213}
10214
10215impl Variants<i32> for StoredTransactionSet {
10216    fn variants() -> slice::Iter<'static, i32> {
10217        Self::VARIANTS.iter()
10218    }
10219}
10220
10221impl Union<i32> for StoredTransactionSet {}
10222
10223impl ReadXdr for StoredTransactionSet {
10224    #[cfg(feature = "std")]
10225    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
10226        r.with_limited_depth(|r| {
10227            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
10228            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
10229            let v = match dv {
10230                0 => Self::V0(TransactionSet::read_xdr(r)?),
10231                1 => Self::V1(GeneralizedTransactionSet::read_xdr(r)?),
10232                #[allow(unreachable_patterns)]
10233                _ => return Err(Error::Invalid),
10234            };
10235            Ok(v)
10236        })
10237    }
10238}
10239
10240impl WriteXdr for StoredTransactionSet {
10241    #[cfg(feature = "std")]
10242    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
10243        w.with_limited_depth(|w| {
10244            self.discriminant().write_xdr(w)?;
10245            #[allow(clippy::match_same_arms)]
10246            match self {
10247                Self::V0(v) => v.write_xdr(w)?,
10248                Self::V1(v) => v.write_xdr(w)?,
10249            };
10250            Ok(())
10251        })
10252    }
10253}
10254
10255/// StoredDebugTransactionSet is an XDR Struct defines as:
10256///
10257/// ```text
10258/// struct StoredDebugTransactionSet
10259/// {
10260/// 	StoredTransactionSet txSet;
10261/// 	uint32 ledgerSeq;
10262/// 	StellarValue scpValue;
10263/// };
10264/// ```
10265///
10266#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
10267#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
10268#[cfg_attr(
10269    all(feature = "serde", feature = "alloc"),
10270    derive(serde::Serialize, serde::Deserialize),
10271    serde(rename_all = "snake_case")
10272)]
10273#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
10274pub struct StoredDebugTransactionSet {
10275    pub tx_set: StoredTransactionSet,
10276    pub ledger_seq: u32,
10277    pub scp_value: StellarValue,
10278}
10279
10280impl ReadXdr for StoredDebugTransactionSet {
10281    #[cfg(feature = "std")]
10282    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
10283        r.with_limited_depth(|r| {
10284            Ok(Self {
10285                tx_set: StoredTransactionSet::read_xdr(r)?,
10286                ledger_seq: u32::read_xdr(r)?,
10287                scp_value: StellarValue::read_xdr(r)?,
10288            })
10289        })
10290    }
10291}
10292
10293impl WriteXdr for StoredDebugTransactionSet {
10294    #[cfg(feature = "std")]
10295    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
10296        w.with_limited_depth(|w| {
10297            self.tx_set.write_xdr(w)?;
10298            self.ledger_seq.write_xdr(w)?;
10299            self.scp_value.write_xdr(w)?;
10300            Ok(())
10301        })
10302    }
10303}
10304
10305/// PersistedScpStateV0 is an XDR Struct defines as:
10306///
10307/// ```text
10308/// struct PersistedSCPStateV0
10309/// {
10310/// 	SCPEnvelope scpEnvelopes<>;
10311/// 	SCPQuorumSet quorumSets<>;
10312/// 	StoredTransactionSet txSets<>;
10313/// };
10314/// ```
10315///
10316#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
10317#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
10318#[cfg_attr(
10319    all(feature = "serde", feature = "alloc"),
10320    derive(serde::Serialize, serde::Deserialize),
10321    serde(rename_all = "snake_case")
10322)]
10323#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
10324pub struct PersistedScpStateV0 {
10325    pub scp_envelopes: VecM<ScpEnvelope>,
10326    pub quorum_sets: VecM<ScpQuorumSet>,
10327    pub tx_sets: VecM<StoredTransactionSet>,
10328}
10329
10330impl ReadXdr for PersistedScpStateV0 {
10331    #[cfg(feature = "std")]
10332    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
10333        r.with_limited_depth(|r| {
10334            Ok(Self {
10335                scp_envelopes: VecM::<ScpEnvelope>::read_xdr(r)?,
10336                quorum_sets: VecM::<ScpQuorumSet>::read_xdr(r)?,
10337                tx_sets: VecM::<StoredTransactionSet>::read_xdr(r)?,
10338            })
10339        })
10340    }
10341}
10342
10343impl WriteXdr for PersistedScpStateV0 {
10344    #[cfg(feature = "std")]
10345    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
10346        w.with_limited_depth(|w| {
10347            self.scp_envelopes.write_xdr(w)?;
10348            self.quorum_sets.write_xdr(w)?;
10349            self.tx_sets.write_xdr(w)?;
10350            Ok(())
10351        })
10352    }
10353}
10354
10355/// PersistedScpStateV1 is an XDR Struct defines as:
10356///
10357/// ```text
10358/// struct PersistedSCPStateV1
10359/// {
10360/// 	// Tx sets are saved separately
10361/// 	SCPEnvelope scpEnvelopes<>;
10362/// 	SCPQuorumSet quorumSets<>;
10363/// };
10364/// ```
10365///
10366#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
10367#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
10368#[cfg_attr(
10369    all(feature = "serde", feature = "alloc"),
10370    derive(serde::Serialize, serde::Deserialize),
10371    serde(rename_all = "snake_case")
10372)]
10373#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
10374pub struct PersistedScpStateV1 {
10375    pub scp_envelopes: VecM<ScpEnvelope>,
10376    pub quorum_sets: VecM<ScpQuorumSet>,
10377}
10378
10379impl ReadXdr for PersistedScpStateV1 {
10380    #[cfg(feature = "std")]
10381    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
10382        r.with_limited_depth(|r| {
10383            Ok(Self {
10384                scp_envelopes: VecM::<ScpEnvelope>::read_xdr(r)?,
10385                quorum_sets: VecM::<ScpQuorumSet>::read_xdr(r)?,
10386            })
10387        })
10388    }
10389}
10390
10391impl WriteXdr for PersistedScpStateV1 {
10392    #[cfg(feature = "std")]
10393    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
10394        w.with_limited_depth(|w| {
10395            self.scp_envelopes.write_xdr(w)?;
10396            self.quorum_sets.write_xdr(w)?;
10397            Ok(())
10398        })
10399    }
10400}
10401
10402/// PersistedScpState is an XDR Union defines as:
10403///
10404/// ```text
10405/// union PersistedSCPState switch (int v)
10406/// {
10407/// case 0:
10408/// 	PersistedSCPStateV0 v0;
10409/// case 1:
10410/// 	PersistedSCPStateV1 v1;
10411/// };
10412/// ```
10413///
10414// union with discriminant i32
10415#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
10416#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
10417#[cfg_attr(
10418    all(feature = "serde", feature = "alloc"),
10419    derive(serde::Serialize, serde::Deserialize),
10420    serde(rename_all = "snake_case")
10421)]
10422#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
10423#[allow(clippy::large_enum_variant)]
10424pub enum PersistedScpState {
10425    V0(PersistedScpStateV0),
10426    V1(PersistedScpStateV1),
10427}
10428
10429impl PersistedScpState {
10430    pub const VARIANTS: [i32; 2] = [0, 1];
10431    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"];
10432
10433    #[must_use]
10434    pub const fn name(&self) -> &'static str {
10435        match self {
10436            Self::V0(_) => "V0",
10437            Self::V1(_) => "V1",
10438        }
10439    }
10440
10441    #[must_use]
10442    pub const fn discriminant(&self) -> i32 {
10443        #[allow(clippy::match_same_arms)]
10444        match self {
10445            Self::V0(_) => 0,
10446            Self::V1(_) => 1,
10447        }
10448    }
10449
10450    #[must_use]
10451    pub const fn variants() -> [i32; 2] {
10452        Self::VARIANTS
10453    }
10454}
10455
10456impl Name for PersistedScpState {
10457    #[must_use]
10458    fn name(&self) -> &'static str {
10459        Self::name(self)
10460    }
10461}
10462
10463impl Discriminant<i32> for PersistedScpState {
10464    #[must_use]
10465    fn discriminant(&self) -> i32 {
10466        Self::discriminant(self)
10467    }
10468}
10469
10470impl Variants<i32> for PersistedScpState {
10471    fn variants() -> slice::Iter<'static, i32> {
10472        Self::VARIANTS.iter()
10473    }
10474}
10475
10476impl Union<i32> for PersistedScpState {}
10477
10478impl ReadXdr for PersistedScpState {
10479    #[cfg(feature = "std")]
10480    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
10481        r.with_limited_depth(|r| {
10482            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
10483            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
10484            let v = match dv {
10485                0 => Self::V0(PersistedScpStateV0::read_xdr(r)?),
10486                1 => Self::V1(PersistedScpStateV1::read_xdr(r)?),
10487                #[allow(unreachable_patterns)]
10488                _ => return Err(Error::Invalid),
10489            };
10490            Ok(v)
10491        })
10492    }
10493}
10494
10495impl WriteXdr for PersistedScpState {
10496    #[cfg(feature = "std")]
10497    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
10498        w.with_limited_depth(|w| {
10499            self.discriminant().write_xdr(w)?;
10500            #[allow(clippy::match_same_arms)]
10501            match self {
10502                Self::V0(v) => v.write_xdr(w)?,
10503                Self::V1(v) => v.write_xdr(w)?,
10504            };
10505            Ok(())
10506        })
10507    }
10508}
10509
10510/// Thresholds is an XDR Typedef defines as:
10511///
10512/// ```text
10513/// typedef opaque Thresholds[4];
10514/// ```
10515///
10516#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
10517#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
10518#[cfg_attr(
10519    all(feature = "serde", feature = "alloc"),
10520    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
10521)]
10522pub struct Thresholds(pub [u8; 4]);
10523
10524impl core::fmt::Debug for Thresholds {
10525    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
10526        let v = &self.0;
10527        write!(f, "Thresholds(")?;
10528        for b in v {
10529            write!(f, "{b:02x}")?;
10530        }
10531        write!(f, ")")?;
10532        Ok(())
10533    }
10534}
10535impl core::fmt::Display for Thresholds {
10536    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
10537        let v = &self.0;
10538        for b in v {
10539            write!(f, "{b:02x}")?;
10540        }
10541        Ok(())
10542    }
10543}
10544
10545#[cfg(feature = "alloc")]
10546impl core::str::FromStr for Thresholds {
10547    type Err = Error;
10548    fn from_str(s: &str) -> core::result::Result<Self, Self::Err> {
10549        hex::decode(s).map_err(|_| Error::InvalidHex)?.try_into()
10550    }
10551}
10552#[cfg(feature = "schemars")]
10553impl schemars::JsonSchema for Thresholds {
10554    fn schema_name() -> String {
10555        "Thresholds".to_string()
10556    }
10557
10558    fn is_referenceable() -> bool {
10559        false
10560    }
10561
10562    fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
10563        let schema = String::json_schema(gen);
10564        if let schemars::schema::Schema::Object(mut schema) = schema {
10565            schema.extensions.insert(
10566                "contentEncoding".to_owned(),
10567                serde_json::Value::String("hex".to_string()),
10568            );
10569            schema.extensions.insert(
10570                "contentMediaType".to_owned(),
10571                serde_json::Value::String("application/binary".to_string()),
10572            );
10573            let string = *schema.string.unwrap_or_default().clone();
10574            schema.string = Some(Box::new(schemars::schema::StringValidation {
10575                max_length: 4_u32.checked_mul(2).map(Some).unwrap_or_default(),
10576                min_length: 4_u32.checked_mul(2).map(Some).unwrap_or_default(),
10577                ..string
10578            }));
10579            schema.into()
10580        } else {
10581            schema
10582        }
10583    }
10584}
10585impl From<Thresholds> for [u8; 4] {
10586    #[must_use]
10587    fn from(x: Thresholds) -> Self {
10588        x.0
10589    }
10590}
10591
10592impl From<[u8; 4]> for Thresholds {
10593    #[must_use]
10594    fn from(x: [u8; 4]) -> Self {
10595        Thresholds(x)
10596    }
10597}
10598
10599impl AsRef<[u8; 4]> for Thresholds {
10600    #[must_use]
10601    fn as_ref(&self) -> &[u8; 4] {
10602        &self.0
10603    }
10604}
10605
10606impl ReadXdr for Thresholds {
10607    #[cfg(feature = "std")]
10608    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
10609        r.with_limited_depth(|r| {
10610            let i = <[u8; 4]>::read_xdr(r)?;
10611            let v = Thresholds(i);
10612            Ok(v)
10613        })
10614    }
10615}
10616
10617impl WriteXdr for Thresholds {
10618    #[cfg(feature = "std")]
10619    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
10620        w.with_limited_depth(|w| self.0.write_xdr(w))
10621    }
10622}
10623
10624impl Thresholds {
10625    #[must_use]
10626    pub fn as_slice(&self) -> &[u8] {
10627        &self.0
10628    }
10629}
10630
10631#[cfg(feature = "alloc")]
10632impl TryFrom<Vec<u8>> for Thresholds {
10633    type Error = Error;
10634    fn try_from(x: Vec<u8>) -> Result<Self> {
10635        x.as_slice().try_into()
10636    }
10637}
10638
10639#[cfg(feature = "alloc")]
10640impl TryFrom<&Vec<u8>> for Thresholds {
10641    type Error = Error;
10642    fn try_from(x: &Vec<u8>) -> Result<Self> {
10643        x.as_slice().try_into()
10644    }
10645}
10646
10647impl TryFrom<&[u8]> for Thresholds {
10648    type Error = Error;
10649    fn try_from(x: &[u8]) -> Result<Self> {
10650        Ok(Thresholds(x.try_into()?))
10651    }
10652}
10653
10654impl AsRef<[u8]> for Thresholds {
10655    #[must_use]
10656    fn as_ref(&self) -> &[u8] {
10657        &self.0
10658    }
10659}
10660
10661/// String32 is an XDR Typedef defines as:
10662///
10663/// ```text
10664/// typedef string string32<32>;
10665/// ```
10666///
10667#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
10668#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
10669#[derive(Default)]
10670#[cfg_attr(
10671    all(feature = "serde", feature = "alloc"),
10672    derive(serde::Serialize, serde::Deserialize),
10673    serde(rename_all = "snake_case")
10674)]
10675#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
10676#[derive(Debug)]
10677pub struct String32(pub StringM<32>);
10678
10679impl From<String32> for StringM<32> {
10680    #[must_use]
10681    fn from(x: String32) -> Self {
10682        x.0
10683    }
10684}
10685
10686impl From<StringM<32>> for String32 {
10687    #[must_use]
10688    fn from(x: StringM<32>) -> Self {
10689        String32(x)
10690    }
10691}
10692
10693impl AsRef<StringM<32>> for String32 {
10694    #[must_use]
10695    fn as_ref(&self) -> &StringM<32> {
10696        &self.0
10697    }
10698}
10699
10700impl ReadXdr for String32 {
10701    #[cfg(feature = "std")]
10702    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
10703        r.with_limited_depth(|r| {
10704            let i = StringM::<32>::read_xdr(r)?;
10705            let v = String32(i);
10706            Ok(v)
10707        })
10708    }
10709}
10710
10711impl WriteXdr for String32 {
10712    #[cfg(feature = "std")]
10713    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
10714        w.with_limited_depth(|w| self.0.write_xdr(w))
10715    }
10716}
10717
10718impl Deref for String32 {
10719    type Target = StringM<32>;
10720    fn deref(&self) -> &Self::Target {
10721        &self.0
10722    }
10723}
10724
10725impl From<String32> for Vec<u8> {
10726    #[must_use]
10727    fn from(x: String32) -> Self {
10728        x.0 .0
10729    }
10730}
10731
10732impl TryFrom<Vec<u8>> for String32 {
10733    type Error = Error;
10734    fn try_from(x: Vec<u8>) -> Result<Self> {
10735        Ok(String32(x.try_into()?))
10736    }
10737}
10738
10739#[cfg(feature = "alloc")]
10740impl TryFrom<&Vec<u8>> for String32 {
10741    type Error = Error;
10742    fn try_from(x: &Vec<u8>) -> Result<Self> {
10743        Ok(String32(x.try_into()?))
10744    }
10745}
10746
10747impl AsRef<Vec<u8>> for String32 {
10748    #[must_use]
10749    fn as_ref(&self) -> &Vec<u8> {
10750        &self.0 .0
10751    }
10752}
10753
10754impl AsRef<[u8]> for String32 {
10755    #[cfg(feature = "alloc")]
10756    #[must_use]
10757    fn as_ref(&self) -> &[u8] {
10758        &self.0 .0
10759    }
10760    #[cfg(not(feature = "alloc"))]
10761    #[must_use]
10762    fn as_ref(&self) -> &[u8] {
10763        self.0 .0
10764    }
10765}
10766
10767/// String64 is an XDR Typedef defines as:
10768///
10769/// ```text
10770/// typedef string string64<64>;
10771/// ```
10772///
10773#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
10774#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
10775#[derive(Default)]
10776#[cfg_attr(
10777    all(feature = "serde", feature = "alloc"),
10778    derive(serde::Serialize, serde::Deserialize),
10779    serde(rename_all = "snake_case")
10780)]
10781#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
10782#[derive(Debug)]
10783pub struct String64(pub StringM<64>);
10784
10785impl From<String64> for StringM<64> {
10786    #[must_use]
10787    fn from(x: String64) -> Self {
10788        x.0
10789    }
10790}
10791
10792impl From<StringM<64>> for String64 {
10793    #[must_use]
10794    fn from(x: StringM<64>) -> Self {
10795        String64(x)
10796    }
10797}
10798
10799impl AsRef<StringM<64>> for String64 {
10800    #[must_use]
10801    fn as_ref(&self) -> &StringM<64> {
10802        &self.0
10803    }
10804}
10805
10806impl ReadXdr for String64 {
10807    #[cfg(feature = "std")]
10808    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
10809        r.with_limited_depth(|r| {
10810            let i = StringM::<64>::read_xdr(r)?;
10811            let v = String64(i);
10812            Ok(v)
10813        })
10814    }
10815}
10816
10817impl WriteXdr for String64 {
10818    #[cfg(feature = "std")]
10819    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
10820        w.with_limited_depth(|w| self.0.write_xdr(w))
10821    }
10822}
10823
10824impl Deref for String64 {
10825    type Target = StringM<64>;
10826    fn deref(&self) -> &Self::Target {
10827        &self.0
10828    }
10829}
10830
10831impl From<String64> for Vec<u8> {
10832    #[must_use]
10833    fn from(x: String64) -> Self {
10834        x.0 .0
10835    }
10836}
10837
10838impl TryFrom<Vec<u8>> for String64 {
10839    type Error = Error;
10840    fn try_from(x: Vec<u8>) -> Result<Self> {
10841        Ok(String64(x.try_into()?))
10842    }
10843}
10844
10845#[cfg(feature = "alloc")]
10846impl TryFrom<&Vec<u8>> for String64 {
10847    type Error = Error;
10848    fn try_from(x: &Vec<u8>) -> Result<Self> {
10849        Ok(String64(x.try_into()?))
10850    }
10851}
10852
10853impl AsRef<Vec<u8>> for String64 {
10854    #[must_use]
10855    fn as_ref(&self) -> &Vec<u8> {
10856        &self.0 .0
10857    }
10858}
10859
10860impl AsRef<[u8]> for String64 {
10861    #[cfg(feature = "alloc")]
10862    #[must_use]
10863    fn as_ref(&self) -> &[u8] {
10864        &self.0 .0
10865    }
10866    #[cfg(not(feature = "alloc"))]
10867    #[must_use]
10868    fn as_ref(&self) -> &[u8] {
10869        self.0 .0
10870    }
10871}
10872
10873/// SequenceNumber is an XDR Typedef defines as:
10874///
10875/// ```text
10876/// typedef int64 SequenceNumber;
10877/// ```
10878///
10879#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
10880#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
10881#[cfg_attr(
10882    all(feature = "serde", feature = "alloc"),
10883    derive(serde::Serialize, serde::Deserialize),
10884    serde(rename_all = "snake_case")
10885)]
10886#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
10887#[derive(Debug)]
10888pub struct SequenceNumber(pub i64);
10889
10890impl From<SequenceNumber> for i64 {
10891    #[must_use]
10892    fn from(x: SequenceNumber) -> Self {
10893        x.0
10894    }
10895}
10896
10897impl From<i64> for SequenceNumber {
10898    #[must_use]
10899    fn from(x: i64) -> Self {
10900        SequenceNumber(x)
10901    }
10902}
10903
10904impl AsRef<i64> for SequenceNumber {
10905    #[must_use]
10906    fn as_ref(&self) -> &i64 {
10907        &self.0
10908    }
10909}
10910
10911impl ReadXdr for SequenceNumber {
10912    #[cfg(feature = "std")]
10913    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
10914        r.with_limited_depth(|r| {
10915            let i = i64::read_xdr(r)?;
10916            let v = SequenceNumber(i);
10917            Ok(v)
10918        })
10919    }
10920}
10921
10922impl WriteXdr for SequenceNumber {
10923    #[cfg(feature = "std")]
10924    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
10925        w.with_limited_depth(|w| self.0.write_xdr(w))
10926    }
10927}
10928
10929/// DataValue is an XDR Typedef defines as:
10930///
10931/// ```text
10932/// typedef opaque DataValue<64>;
10933/// ```
10934///
10935#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
10936#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
10937#[derive(Default)]
10938#[cfg_attr(
10939    all(feature = "serde", feature = "alloc"),
10940    derive(serde::Serialize, serde::Deserialize),
10941    serde(rename_all = "snake_case")
10942)]
10943#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
10944#[derive(Debug)]
10945pub struct DataValue(pub BytesM<64>);
10946
10947impl From<DataValue> for BytesM<64> {
10948    #[must_use]
10949    fn from(x: DataValue) -> Self {
10950        x.0
10951    }
10952}
10953
10954impl From<BytesM<64>> for DataValue {
10955    #[must_use]
10956    fn from(x: BytesM<64>) -> Self {
10957        DataValue(x)
10958    }
10959}
10960
10961impl AsRef<BytesM<64>> for DataValue {
10962    #[must_use]
10963    fn as_ref(&self) -> &BytesM<64> {
10964        &self.0
10965    }
10966}
10967
10968impl ReadXdr for DataValue {
10969    #[cfg(feature = "std")]
10970    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
10971        r.with_limited_depth(|r| {
10972            let i = BytesM::<64>::read_xdr(r)?;
10973            let v = DataValue(i);
10974            Ok(v)
10975        })
10976    }
10977}
10978
10979impl WriteXdr for DataValue {
10980    #[cfg(feature = "std")]
10981    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
10982        w.with_limited_depth(|w| self.0.write_xdr(w))
10983    }
10984}
10985
10986impl Deref for DataValue {
10987    type Target = BytesM<64>;
10988    fn deref(&self) -> &Self::Target {
10989        &self.0
10990    }
10991}
10992
10993impl From<DataValue> for Vec<u8> {
10994    #[must_use]
10995    fn from(x: DataValue) -> Self {
10996        x.0 .0
10997    }
10998}
10999
11000impl TryFrom<Vec<u8>> for DataValue {
11001    type Error = Error;
11002    fn try_from(x: Vec<u8>) -> Result<Self> {
11003        Ok(DataValue(x.try_into()?))
11004    }
11005}
11006
11007#[cfg(feature = "alloc")]
11008impl TryFrom<&Vec<u8>> for DataValue {
11009    type Error = Error;
11010    fn try_from(x: &Vec<u8>) -> Result<Self> {
11011        Ok(DataValue(x.try_into()?))
11012    }
11013}
11014
11015impl AsRef<Vec<u8>> for DataValue {
11016    #[must_use]
11017    fn as_ref(&self) -> &Vec<u8> {
11018        &self.0 .0
11019    }
11020}
11021
11022impl AsRef<[u8]> for DataValue {
11023    #[cfg(feature = "alloc")]
11024    #[must_use]
11025    fn as_ref(&self) -> &[u8] {
11026        &self.0 .0
11027    }
11028    #[cfg(not(feature = "alloc"))]
11029    #[must_use]
11030    fn as_ref(&self) -> &[u8] {
11031        self.0 .0
11032    }
11033}
11034
11035/// PoolId is an XDR Typedef defines as:
11036///
11037/// ```text
11038/// typedef Hash PoolID;
11039/// ```
11040///
11041#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
11042#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
11043#[cfg_attr(
11044    all(feature = "serde", feature = "alloc"),
11045    derive(serde::Serialize, serde::Deserialize),
11046    serde(rename_all = "snake_case")
11047)]
11048#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
11049#[derive(Debug)]
11050pub struct PoolId(pub Hash);
11051
11052impl From<PoolId> for Hash {
11053    #[must_use]
11054    fn from(x: PoolId) -> Self {
11055        x.0
11056    }
11057}
11058
11059impl From<Hash> for PoolId {
11060    #[must_use]
11061    fn from(x: Hash) -> Self {
11062        PoolId(x)
11063    }
11064}
11065
11066impl AsRef<Hash> for PoolId {
11067    #[must_use]
11068    fn as_ref(&self) -> &Hash {
11069        &self.0
11070    }
11071}
11072
11073impl ReadXdr for PoolId {
11074    #[cfg(feature = "std")]
11075    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
11076        r.with_limited_depth(|r| {
11077            let i = Hash::read_xdr(r)?;
11078            let v = PoolId(i);
11079            Ok(v)
11080        })
11081    }
11082}
11083
11084impl WriteXdr for PoolId {
11085    #[cfg(feature = "std")]
11086    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
11087        w.with_limited_depth(|w| self.0.write_xdr(w))
11088    }
11089}
11090
11091/// AssetCode4 is an XDR Typedef defines as:
11092///
11093/// ```text
11094/// typedef opaque AssetCode4[4];
11095/// ```
11096///
11097#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
11098#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
11099#[cfg_attr(
11100    all(feature = "serde", feature = "alloc"),
11101    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
11102)]
11103pub struct AssetCode4(pub [u8; 4]);
11104
11105impl core::fmt::Debug for AssetCode4 {
11106    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
11107        let v = &self.0;
11108        write!(f, "AssetCode4(")?;
11109        for b in v {
11110            write!(f, "{b:02x}")?;
11111        }
11112        write!(f, ")")?;
11113        Ok(())
11114    }
11115}
11116impl From<AssetCode4> for [u8; 4] {
11117    #[must_use]
11118    fn from(x: AssetCode4) -> Self {
11119        x.0
11120    }
11121}
11122
11123impl From<[u8; 4]> for AssetCode4 {
11124    #[must_use]
11125    fn from(x: [u8; 4]) -> Self {
11126        AssetCode4(x)
11127    }
11128}
11129
11130impl AsRef<[u8; 4]> for AssetCode4 {
11131    #[must_use]
11132    fn as_ref(&self) -> &[u8; 4] {
11133        &self.0
11134    }
11135}
11136
11137impl ReadXdr for AssetCode4 {
11138    #[cfg(feature = "std")]
11139    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
11140        r.with_limited_depth(|r| {
11141            let i = <[u8; 4]>::read_xdr(r)?;
11142            let v = AssetCode4(i);
11143            Ok(v)
11144        })
11145    }
11146}
11147
11148impl WriteXdr for AssetCode4 {
11149    #[cfg(feature = "std")]
11150    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
11151        w.with_limited_depth(|w| self.0.write_xdr(w))
11152    }
11153}
11154
11155impl AssetCode4 {
11156    #[must_use]
11157    pub fn as_slice(&self) -> &[u8] {
11158        &self.0
11159    }
11160}
11161
11162#[cfg(feature = "alloc")]
11163impl TryFrom<Vec<u8>> for AssetCode4 {
11164    type Error = Error;
11165    fn try_from(x: Vec<u8>) -> Result<Self> {
11166        x.as_slice().try_into()
11167    }
11168}
11169
11170#[cfg(feature = "alloc")]
11171impl TryFrom<&Vec<u8>> for AssetCode4 {
11172    type Error = Error;
11173    fn try_from(x: &Vec<u8>) -> Result<Self> {
11174        x.as_slice().try_into()
11175    }
11176}
11177
11178impl TryFrom<&[u8]> for AssetCode4 {
11179    type Error = Error;
11180    fn try_from(x: &[u8]) -> Result<Self> {
11181        Ok(AssetCode4(x.try_into()?))
11182    }
11183}
11184
11185impl AsRef<[u8]> for AssetCode4 {
11186    #[must_use]
11187    fn as_ref(&self) -> &[u8] {
11188        &self.0
11189    }
11190}
11191
11192/// AssetCode12 is an XDR Typedef defines as:
11193///
11194/// ```text
11195/// typedef opaque AssetCode12[12];
11196/// ```
11197///
11198#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
11199#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
11200#[cfg_attr(
11201    all(feature = "serde", feature = "alloc"),
11202    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
11203)]
11204pub struct AssetCode12(pub [u8; 12]);
11205
11206impl core::fmt::Debug for AssetCode12 {
11207    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
11208        let v = &self.0;
11209        write!(f, "AssetCode12(")?;
11210        for b in v {
11211            write!(f, "{b:02x}")?;
11212        }
11213        write!(f, ")")?;
11214        Ok(())
11215    }
11216}
11217impl From<AssetCode12> for [u8; 12] {
11218    #[must_use]
11219    fn from(x: AssetCode12) -> Self {
11220        x.0
11221    }
11222}
11223
11224impl From<[u8; 12]> for AssetCode12 {
11225    #[must_use]
11226    fn from(x: [u8; 12]) -> Self {
11227        AssetCode12(x)
11228    }
11229}
11230
11231impl AsRef<[u8; 12]> for AssetCode12 {
11232    #[must_use]
11233    fn as_ref(&self) -> &[u8; 12] {
11234        &self.0
11235    }
11236}
11237
11238impl ReadXdr for AssetCode12 {
11239    #[cfg(feature = "std")]
11240    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
11241        r.with_limited_depth(|r| {
11242            let i = <[u8; 12]>::read_xdr(r)?;
11243            let v = AssetCode12(i);
11244            Ok(v)
11245        })
11246    }
11247}
11248
11249impl WriteXdr for AssetCode12 {
11250    #[cfg(feature = "std")]
11251    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
11252        w.with_limited_depth(|w| self.0.write_xdr(w))
11253    }
11254}
11255
11256impl AssetCode12 {
11257    #[must_use]
11258    pub fn as_slice(&self) -> &[u8] {
11259        &self.0
11260    }
11261}
11262
11263#[cfg(feature = "alloc")]
11264impl TryFrom<Vec<u8>> for AssetCode12 {
11265    type Error = Error;
11266    fn try_from(x: Vec<u8>) -> Result<Self> {
11267        x.as_slice().try_into()
11268    }
11269}
11270
11271#[cfg(feature = "alloc")]
11272impl TryFrom<&Vec<u8>> for AssetCode12 {
11273    type Error = Error;
11274    fn try_from(x: &Vec<u8>) -> Result<Self> {
11275        x.as_slice().try_into()
11276    }
11277}
11278
11279impl TryFrom<&[u8]> for AssetCode12 {
11280    type Error = Error;
11281    fn try_from(x: &[u8]) -> Result<Self> {
11282        Ok(AssetCode12(x.try_into()?))
11283    }
11284}
11285
11286impl AsRef<[u8]> for AssetCode12 {
11287    #[must_use]
11288    fn as_ref(&self) -> &[u8] {
11289        &self.0
11290    }
11291}
11292
11293/// AssetType is an XDR Enum defines as:
11294///
11295/// ```text
11296/// enum AssetType
11297/// {
11298///     ASSET_TYPE_NATIVE = 0,
11299///     ASSET_TYPE_CREDIT_ALPHANUM4 = 1,
11300///     ASSET_TYPE_CREDIT_ALPHANUM12 = 2,
11301///     ASSET_TYPE_POOL_SHARE = 3
11302/// };
11303/// ```
11304///
11305// enum
11306#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
11307#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
11308#[cfg_attr(
11309    all(feature = "serde", feature = "alloc"),
11310    derive(serde::Serialize, serde::Deserialize),
11311    serde(rename_all = "snake_case")
11312)]
11313#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
11314#[repr(i32)]
11315pub enum AssetType {
11316    Native = 0,
11317    CreditAlphanum4 = 1,
11318    CreditAlphanum12 = 2,
11319    PoolShare = 3,
11320}
11321
11322impl AssetType {
11323    pub const VARIANTS: [AssetType; 4] = [
11324        AssetType::Native,
11325        AssetType::CreditAlphanum4,
11326        AssetType::CreditAlphanum12,
11327        AssetType::PoolShare,
11328    ];
11329    pub const VARIANTS_STR: [&'static str; 4] =
11330        ["Native", "CreditAlphanum4", "CreditAlphanum12", "PoolShare"];
11331
11332    #[must_use]
11333    pub const fn name(&self) -> &'static str {
11334        match self {
11335            Self::Native => "Native",
11336            Self::CreditAlphanum4 => "CreditAlphanum4",
11337            Self::CreditAlphanum12 => "CreditAlphanum12",
11338            Self::PoolShare => "PoolShare",
11339        }
11340    }
11341
11342    #[must_use]
11343    pub const fn variants() -> [AssetType; 4] {
11344        Self::VARIANTS
11345    }
11346}
11347
11348impl Name for AssetType {
11349    #[must_use]
11350    fn name(&self) -> &'static str {
11351        Self::name(self)
11352    }
11353}
11354
11355impl Variants<AssetType> for AssetType {
11356    fn variants() -> slice::Iter<'static, AssetType> {
11357        Self::VARIANTS.iter()
11358    }
11359}
11360
11361impl Enum for AssetType {}
11362
11363impl fmt::Display for AssetType {
11364    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
11365        f.write_str(self.name())
11366    }
11367}
11368
11369impl TryFrom<i32> for AssetType {
11370    type Error = Error;
11371
11372    fn try_from(i: i32) -> Result<Self> {
11373        let e = match i {
11374            0 => AssetType::Native,
11375            1 => AssetType::CreditAlphanum4,
11376            2 => AssetType::CreditAlphanum12,
11377            3 => AssetType::PoolShare,
11378            #[allow(unreachable_patterns)]
11379            _ => return Err(Error::Invalid),
11380        };
11381        Ok(e)
11382    }
11383}
11384
11385impl From<AssetType> for i32 {
11386    #[must_use]
11387    fn from(e: AssetType) -> Self {
11388        e as Self
11389    }
11390}
11391
11392impl ReadXdr for AssetType {
11393    #[cfg(feature = "std")]
11394    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
11395        r.with_limited_depth(|r| {
11396            let e = i32::read_xdr(r)?;
11397            let v: Self = e.try_into()?;
11398            Ok(v)
11399        })
11400    }
11401}
11402
11403impl WriteXdr for AssetType {
11404    #[cfg(feature = "std")]
11405    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
11406        w.with_limited_depth(|w| {
11407            let i: i32 = (*self).into();
11408            i.write_xdr(w)
11409        })
11410    }
11411}
11412
11413/// AssetCode is an XDR Union defines as:
11414///
11415/// ```text
11416/// union AssetCode switch (AssetType type)
11417/// {
11418/// case ASSET_TYPE_CREDIT_ALPHANUM4:
11419///     AssetCode4 assetCode4;
11420///
11421/// case ASSET_TYPE_CREDIT_ALPHANUM12:
11422///     AssetCode12 assetCode12;
11423///
11424///     // add other asset types here in the future
11425/// };
11426/// ```
11427///
11428// union with discriminant AssetType
11429#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
11430#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
11431#[cfg_attr(
11432    all(feature = "serde", feature = "alloc"),
11433    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
11434)]
11435#[allow(clippy::large_enum_variant)]
11436pub enum AssetCode {
11437    CreditAlphanum4(AssetCode4),
11438    CreditAlphanum12(AssetCode12),
11439}
11440
11441impl AssetCode {
11442    pub const VARIANTS: [AssetType; 2] = [AssetType::CreditAlphanum4, AssetType::CreditAlphanum12];
11443    pub const VARIANTS_STR: [&'static str; 2] = ["CreditAlphanum4", "CreditAlphanum12"];
11444
11445    #[must_use]
11446    pub const fn name(&self) -> &'static str {
11447        match self {
11448            Self::CreditAlphanum4(_) => "CreditAlphanum4",
11449            Self::CreditAlphanum12(_) => "CreditAlphanum12",
11450        }
11451    }
11452
11453    #[must_use]
11454    pub const fn discriminant(&self) -> AssetType {
11455        #[allow(clippy::match_same_arms)]
11456        match self {
11457            Self::CreditAlphanum4(_) => AssetType::CreditAlphanum4,
11458            Self::CreditAlphanum12(_) => AssetType::CreditAlphanum12,
11459        }
11460    }
11461
11462    #[must_use]
11463    pub const fn variants() -> [AssetType; 2] {
11464        Self::VARIANTS
11465    }
11466}
11467
11468impl Name for AssetCode {
11469    #[must_use]
11470    fn name(&self) -> &'static str {
11471        Self::name(self)
11472    }
11473}
11474
11475impl Discriminant<AssetType> for AssetCode {
11476    #[must_use]
11477    fn discriminant(&self) -> AssetType {
11478        Self::discriminant(self)
11479    }
11480}
11481
11482impl Variants<AssetType> for AssetCode {
11483    fn variants() -> slice::Iter<'static, AssetType> {
11484        Self::VARIANTS.iter()
11485    }
11486}
11487
11488impl Union<AssetType> for AssetCode {}
11489
11490impl ReadXdr for AssetCode {
11491    #[cfg(feature = "std")]
11492    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
11493        r.with_limited_depth(|r| {
11494            let dv: AssetType = <AssetType as ReadXdr>::read_xdr(r)?;
11495            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
11496            let v = match dv {
11497                AssetType::CreditAlphanum4 => Self::CreditAlphanum4(AssetCode4::read_xdr(r)?),
11498                AssetType::CreditAlphanum12 => Self::CreditAlphanum12(AssetCode12::read_xdr(r)?),
11499                #[allow(unreachable_patterns)]
11500                _ => return Err(Error::Invalid),
11501            };
11502            Ok(v)
11503        })
11504    }
11505}
11506
11507impl WriteXdr for AssetCode {
11508    #[cfg(feature = "std")]
11509    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
11510        w.with_limited_depth(|w| {
11511            self.discriminant().write_xdr(w)?;
11512            #[allow(clippy::match_same_arms)]
11513            match self {
11514                Self::CreditAlphanum4(v) => v.write_xdr(w)?,
11515                Self::CreditAlphanum12(v) => v.write_xdr(w)?,
11516            };
11517            Ok(())
11518        })
11519    }
11520}
11521
11522/// AlphaNum4 is an XDR Struct defines as:
11523///
11524/// ```text
11525/// struct AlphaNum4
11526/// {
11527///     AssetCode4 assetCode;
11528///     AccountID issuer;
11529/// };
11530/// ```
11531///
11532#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
11533#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
11534#[cfg_attr(
11535    all(feature = "serde", feature = "alloc"),
11536    derive(serde::Serialize, serde::Deserialize),
11537    serde(rename_all = "snake_case")
11538)]
11539#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
11540pub struct AlphaNum4 {
11541    pub asset_code: AssetCode4,
11542    pub issuer: AccountId,
11543}
11544
11545impl ReadXdr for AlphaNum4 {
11546    #[cfg(feature = "std")]
11547    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
11548        r.with_limited_depth(|r| {
11549            Ok(Self {
11550                asset_code: AssetCode4::read_xdr(r)?,
11551                issuer: AccountId::read_xdr(r)?,
11552            })
11553        })
11554    }
11555}
11556
11557impl WriteXdr for AlphaNum4 {
11558    #[cfg(feature = "std")]
11559    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
11560        w.with_limited_depth(|w| {
11561            self.asset_code.write_xdr(w)?;
11562            self.issuer.write_xdr(w)?;
11563            Ok(())
11564        })
11565    }
11566}
11567
11568/// AlphaNum12 is an XDR Struct defines as:
11569///
11570/// ```text
11571/// struct AlphaNum12
11572/// {
11573///     AssetCode12 assetCode;
11574///     AccountID issuer;
11575/// };
11576/// ```
11577///
11578#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
11579#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
11580#[cfg_attr(
11581    all(feature = "serde", feature = "alloc"),
11582    derive(serde::Serialize, serde::Deserialize),
11583    serde(rename_all = "snake_case")
11584)]
11585#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
11586pub struct AlphaNum12 {
11587    pub asset_code: AssetCode12,
11588    pub issuer: AccountId,
11589}
11590
11591impl ReadXdr for AlphaNum12 {
11592    #[cfg(feature = "std")]
11593    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
11594        r.with_limited_depth(|r| {
11595            Ok(Self {
11596                asset_code: AssetCode12::read_xdr(r)?,
11597                issuer: AccountId::read_xdr(r)?,
11598            })
11599        })
11600    }
11601}
11602
11603impl WriteXdr for AlphaNum12 {
11604    #[cfg(feature = "std")]
11605    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
11606        w.with_limited_depth(|w| {
11607            self.asset_code.write_xdr(w)?;
11608            self.issuer.write_xdr(w)?;
11609            Ok(())
11610        })
11611    }
11612}
11613
11614/// Asset is an XDR Union defines as:
11615///
11616/// ```text
11617/// union Asset switch (AssetType type)
11618/// {
11619/// case ASSET_TYPE_NATIVE: // Not credit
11620///     void;
11621///
11622/// case ASSET_TYPE_CREDIT_ALPHANUM4:
11623///     AlphaNum4 alphaNum4;
11624///
11625/// case ASSET_TYPE_CREDIT_ALPHANUM12:
11626///     AlphaNum12 alphaNum12;
11627///
11628///     // add other asset types here in the future
11629/// };
11630/// ```
11631///
11632// union with discriminant AssetType
11633#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
11634#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
11635#[cfg_attr(
11636    all(feature = "serde", feature = "alloc"),
11637    derive(serde::Serialize, serde::Deserialize),
11638    serde(rename_all = "snake_case")
11639)]
11640#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
11641#[allow(clippy::large_enum_variant)]
11642pub enum Asset {
11643    Native,
11644    CreditAlphanum4(AlphaNum4),
11645    CreditAlphanum12(AlphaNum12),
11646}
11647
11648impl Asset {
11649    pub const VARIANTS: [AssetType; 3] = [
11650        AssetType::Native,
11651        AssetType::CreditAlphanum4,
11652        AssetType::CreditAlphanum12,
11653    ];
11654    pub const VARIANTS_STR: [&'static str; 3] = ["Native", "CreditAlphanum4", "CreditAlphanum12"];
11655
11656    #[must_use]
11657    pub const fn name(&self) -> &'static str {
11658        match self {
11659            Self::Native => "Native",
11660            Self::CreditAlphanum4(_) => "CreditAlphanum4",
11661            Self::CreditAlphanum12(_) => "CreditAlphanum12",
11662        }
11663    }
11664
11665    #[must_use]
11666    pub const fn discriminant(&self) -> AssetType {
11667        #[allow(clippy::match_same_arms)]
11668        match self {
11669            Self::Native => AssetType::Native,
11670            Self::CreditAlphanum4(_) => AssetType::CreditAlphanum4,
11671            Self::CreditAlphanum12(_) => AssetType::CreditAlphanum12,
11672        }
11673    }
11674
11675    #[must_use]
11676    pub const fn variants() -> [AssetType; 3] {
11677        Self::VARIANTS
11678    }
11679}
11680
11681impl Name for Asset {
11682    #[must_use]
11683    fn name(&self) -> &'static str {
11684        Self::name(self)
11685    }
11686}
11687
11688impl Discriminant<AssetType> for Asset {
11689    #[must_use]
11690    fn discriminant(&self) -> AssetType {
11691        Self::discriminant(self)
11692    }
11693}
11694
11695impl Variants<AssetType> for Asset {
11696    fn variants() -> slice::Iter<'static, AssetType> {
11697        Self::VARIANTS.iter()
11698    }
11699}
11700
11701impl Union<AssetType> for Asset {}
11702
11703impl ReadXdr for Asset {
11704    #[cfg(feature = "std")]
11705    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
11706        r.with_limited_depth(|r| {
11707            let dv: AssetType = <AssetType as ReadXdr>::read_xdr(r)?;
11708            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
11709            let v = match dv {
11710                AssetType::Native => Self::Native,
11711                AssetType::CreditAlphanum4 => Self::CreditAlphanum4(AlphaNum4::read_xdr(r)?),
11712                AssetType::CreditAlphanum12 => Self::CreditAlphanum12(AlphaNum12::read_xdr(r)?),
11713                #[allow(unreachable_patterns)]
11714                _ => return Err(Error::Invalid),
11715            };
11716            Ok(v)
11717        })
11718    }
11719}
11720
11721impl WriteXdr for Asset {
11722    #[cfg(feature = "std")]
11723    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
11724        w.with_limited_depth(|w| {
11725            self.discriminant().write_xdr(w)?;
11726            #[allow(clippy::match_same_arms)]
11727            match self {
11728                Self::Native => ().write_xdr(w)?,
11729                Self::CreditAlphanum4(v) => v.write_xdr(w)?,
11730                Self::CreditAlphanum12(v) => v.write_xdr(w)?,
11731            };
11732            Ok(())
11733        })
11734    }
11735}
11736
11737/// Price is an XDR Struct defines as:
11738///
11739/// ```text
11740/// struct Price
11741/// {
11742///     int32 n; // numerator
11743///     int32 d; // denominator
11744/// };
11745/// ```
11746///
11747#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
11748#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
11749#[cfg_attr(
11750    all(feature = "serde", feature = "alloc"),
11751    derive(serde::Serialize, serde::Deserialize),
11752    serde(rename_all = "snake_case")
11753)]
11754#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
11755pub struct Price {
11756    pub n: i32,
11757    pub d: i32,
11758}
11759
11760impl ReadXdr for Price {
11761    #[cfg(feature = "std")]
11762    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
11763        r.with_limited_depth(|r| {
11764            Ok(Self {
11765                n: i32::read_xdr(r)?,
11766                d: i32::read_xdr(r)?,
11767            })
11768        })
11769    }
11770}
11771
11772impl WriteXdr for Price {
11773    #[cfg(feature = "std")]
11774    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
11775        w.with_limited_depth(|w| {
11776            self.n.write_xdr(w)?;
11777            self.d.write_xdr(w)?;
11778            Ok(())
11779        })
11780    }
11781}
11782
11783/// Liabilities is an XDR Struct defines as:
11784///
11785/// ```text
11786/// struct Liabilities
11787/// {
11788///     int64 buying;
11789///     int64 selling;
11790/// };
11791/// ```
11792///
11793#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
11794#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
11795#[cfg_attr(
11796    all(feature = "serde", feature = "alloc"),
11797    derive(serde::Serialize, serde::Deserialize),
11798    serde(rename_all = "snake_case")
11799)]
11800#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
11801pub struct Liabilities {
11802    pub buying: i64,
11803    pub selling: i64,
11804}
11805
11806impl ReadXdr for Liabilities {
11807    #[cfg(feature = "std")]
11808    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
11809        r.with_limited_depth(|r| {
11810            Ok(Self {
11811                buying: i64::read_xdr(r)?,
11812                selling: i64::read_xdr(r)?,
11813            })
11814        })
11815    }
11816}
11817
11818impl WriteXdr for Liabilities {
11819    #[cfg(feature = "std")]
11820    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
11821        w.with_limited_depth(|w| {
11822            self.buying.write_xdr(w)?;
11823            self.selling.write_xdr(w)?;
11824            Ok(())
11825        })
11826    }
11827}
11828
11829/// ThresholdIndexes is an XDR Enum defines as:
11830///
11831/// ```text
11832/// enum ThresholdIndexes
11833/// {
11834///     THRESHOLD_MASTER_WEIGHT = 0,
11835///     THRESHOLD_LOW = 1,
11836///     THRESHOLD_MED = 2,
11837///     THRESHOLD_HIGH = 3
11838/// };
11839/// ```
11840///
11841// enum
11842#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
11843#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
11844#[cfg_attr(
11845    all(feature = "serde", feature = "alloc"),
11846    derive(serde::Serialize, serde::Deserialize),
11847    serde(rename_all = "snake_case")
11848)]
11849#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
11850#[repr(i32)]
11851pub enum ThresholdIndexes {
11852    MasterWeight = 0,
11853    Low = 1,
11854    Med = 2,
11855    High = 3,
11856}
11857
11858impl ThresholdIndexes {
11859    pub const VARIANTS: [ThresholdIndexes; 4] = [
11860        ThresholdIndexes::MasterWeight,
11861        ThresholdIndexes::Low,
11862        ThresholdIndexes::Med,
11863        ThresholdIndexes::High,
11864    ];
11865    pub const VARIANTS_STR: [&'static str; 4] = ["MasterWeight", "Low", "Med", "High"];
11866
11867    #[must_use]
11868    pub const fn name(&self) -> &'static str {
11869        match self {
11870            Self::MasterWeight => "MasterWeight",
11871            Self::Low => "Low",
11872            Self::Med => "Med",
11873            Self::High => "High",
11874        }
11875    }
11876
11877    #[must_use]
11878    pub const fn variants() -> [ThresholdIndexes; 4] {
11879        Self::VARIANTS
11880    }
11881}
11882
11883impl Name for ThresholdIndexes {
11884    #[must_use]
11885    fn name(&self) -> &'static str {
11886        Self::name(self)
11887    }
11888}
11889
11890impl Variants<ThresholdIndexes> for ThresholdIndexes {
11891    fn variants() -> slice::Iter<'static, ThresholdIndexes> {
11892        Self::VARIANTS.iter()
11893    }
11894}
11895
11896impl Enum for ThresholdIndexes {}
11897
11898impl fmt::Display for ThresholdIndexes {
11899    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
11900        f.write_str(self.name())
11901    }
11902}
11903
11904impl TryFrom<i32> for ThresholdIndexes {
11905    type Error = Error;
11906
11907    fn try_from(i: i32) -> Result<Self> {
11908        let e = match i {
11909            0 => ThresholdIndexes::MasterWeight,
11910            1 => ThresholdIndexes::Low,
11911            2 => ThresholdIndexes::Med,
11912            3 => ThresholdIndexes::High,
11913            #[allow(unreachable_patterns)]
11914            _ => return Err(Error::Invalid),
11915        };
11916        Ok(e)
11917    }
11918}
11919
11920impl From<ThresholdIndexes> for i32 {
11921    #[must_use]
11922    fn from(e: ThresholdIndexes) -> Self {
11923        e as Self
11924    }
11925}
11926
11927impl ReadXdr for ThresholdIndexes {
11928    #[cfg(feature = "std")]
11929    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
11930        r.with_limited_depth(|r| {
11931            let e = i32::read_xdr(r)?;
11932            let v: Self = e.try_into()?;
11933            Ok(v)
11934        })
11935    }
11936}
11937
11938impl WriteXdr for ThresholdIndexes {
11939    #[cfg(feature = "std")]
11940    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
11941        w.with_limited_depth(|w| {
11942            let i: i32 = (*self).into();
11943            i.write_xdr(w)
11944        })
11945    }
11946}
11947
11948/// LedgerEntryType is an XDR Enum defines as:
11949///
11950/// ```text
11951/// enum LedgerEntryType
11952/// {
11953///     ACCOUNT = 0,
11954///     TRUSTLINE = 1,
11955///     OFFER = 2,
11956///     DATA = 3,
11957///     CLAIMABLE_BALANCE = 4,
11958///     LIQUIDITY_POOL = 5,
11959///     CONTRACT_DATA = 6,
11960///     CONTRACT_CODE = 7,
11961///     CONFIG_SETTING = 8,
11962///     TTL = 9
11963/// };
11964/// ```
11965///
11966// enum
11967#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
11968#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
11969#[cfg_attr(
11970    all(feature = "serde", feature = "alloc"),
11971    derive(serde::Serialize, serde::Deserialize),
11972    serde(rename_all = "snake_case")
11973)]
11974#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
11975#[repr(i32)]
11976pub enum LedgerEntryType {
11977    Account = 0,
11978    Trustline = 1,
11979    Offer = 2,
11980    Data = 3,
11981    ClaimableBalance = 4,
11982    LiquidityPool = 5,
11983    ContractData = 6,
11984    ContractCode = 7,
11985    ConfigSetting = 8,
11986    Ttl = 9,
11987}
11988
11989impl LedgerEntryType {
11990    pub const VARIANTS: [LedgerEntryType; 10] = [
11991        LedgerEntryType::Account,
11992        LedgerEntryType::Trustline,
11993        LedgerEntryType::Offer,
11994        LedgerEntryType::Data,
11995        LedgerEntryType::ClaimableBalance,
11996        LedgerEntryType::LiquidityPool,
11997        LedgerEntryType::ContractData,
11998        LedgerEntryType::ContractCode,
11999        LedgerEntryType::ConfigSetting,
12000        LedgerEntryType::Ttl,
12001    ];
12002    pub const VARIANTS_STR: [&'static str; 10] = [
12003        "Account",
12004        "Trustline",
12005        "Offer",
12006        "Data",
12007        "ClaimableBalance",
12008        "LiquidityPool",
12009        "ContractData",
12010        "ContractCode",
12011        "ConfigSetting",
12012        "Ttl",
12013    ];
12014
12015    #[must_use]
12016    pub const fn name(&self) -> &'static str {
12017        match self {
12018            Self::Account => "Account",
12019            Self::Trustline => "Trustline",
12020            Self::Offer => "Offer",
12021            Self::Data => "Data",
12022            Self::ClaimableBalance => "ClaimableBalance",
12023            Self::LiquidityPool => "LiquidityPool",
12024            Self::ContractData => "ContractData",
12025            Self::ContractCode => "ContractCode",
12026            Self::ConfigSetting => "ConfigSetting",
12027            Self::Ttl => "Ttl",
12028        }
12029    }
12030
12031    #[must_use]
12032    pub const fn variants() -> [LedgerEntryType; 10] {
12033        Self::VARIANTS
12034    }
12035}
12036
12037impl Name for LedgerEntryType {
12038    #[must_use]
12039    fn name(&self) -> &'static str {
12040        Self::name(self)
12041    }
12042}
12043
12044impl Variants<LedgerEntryType> for LedgerEntryType {
12045    fn variants() -> slice::Iter<'static, LedgerEntryType> {
12046        Self::VARIANTS.iter()
12047    }
12048}
12049
12050impl Enum for LedgerEntryType {}
12051
12052impl fmt::Display for LedgerEntryType {
12053    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
12054        f.write_str(self.name())
12055    }
12056}
12057
12058impl TryFrom<i32> for LedgerEntryType {
12059    type Error = Error;
12060
12061    fn try_from(i: i32) -> Result<Self> {
12062        let e = match i {
12063            0 => LedgerEntryType::Account,
12064            1 => LedgerEntryType::Trustline,
12065            2 => LedgerEntryType::Offer,
12066            3 => LedgerEntryType::Data,
12067            4 => LedgerEntryType::ClaimableBalance,
12068            5 => LedgerEntryType::LiquidityPool,
12069            6 => LedgerEntryType::ContractData,
12070            7 => LedgerEntryType::ContractCode,
12071            8 => LedgerEntryType::ConfigSetting,
12072            9 => LedgerEntryType::Ttl,
12073            #[allow(unreachable_patterns)]
12074            _ => return Err(Error::Invalid),
12075        };
12076        Ok(e)
12077    }
12078}
12079
12080impl From<LedgerEntryType> for i32 {
12081    #[must_use]
12082    fn from(e: LedgerEntryType) -> Self {
12083        e as Self
12084    }
12085}
12086
12087impl ReadXdr for LedgerEntryType {
12088    #[cfg(feature = "std")]
12089    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
12090        r.with_limited_depth(|r| {
12091            let e = i32::read_xdr(r)?;
12092            let v: Self = e.try_into()?;
12093            Ok(v)
12094        })
12095    }
12096}
12097
12098impl WriteXdr for LedgerEntryType {
12099    #[cfg(feature = "std")]
12100    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
12101        w.with_limited_depth(|w| {
12102            let i: i32 = (*self).into();
12103            i.write_xdr(w)
12104        })
12105    }
12106}
12107
12108/// Signer is an XDR Struct defines as:
12109///
12110/// ```text
12111/// struct Signer
12112/// {
12113///     SignerKey key;
12114///     uint32 weight; // really only need 1 byte
12115/// };
12116/// ```
12117///
12118#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
12119#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
12120#[cfg_attr(
12121    all(feature = "serde", feature = "alloc"),
12122    derive(serde::Serialize, serde::Deserialize),
12123    serde(rename_all = "snake_case")
12124)]
12125#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
12126pub struct Signer {
12127    pub key: SignerKey,
12128    pub weight: u32,
12129}
12130
12131impl ReadXdr for Signer {
12132    #[cfg(feature = "std")]
12133    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
12134        r.with_limited_depth(|r| {
12135            Ok(Self {
12136                key: SignerKey::read_xdr(r)?,
12137                weight: u32::read_xdr(r)?,
12138            })
12139        })
12140    }
12141}
12142
12143impl WriteXdr for Signer {
12144    #[cfg(feature = "std")]
12145    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
12146        w.with_limited_depth(|w| {
12147            self.key.write_xdr(w)?;
12148            self.weight.write_xdr(w)?;
12149            Ok(())
12150        })
12151    }
12152}
12153
12154/// AccountFlags is an XDR Enum defines as:
12155///
12156/// ```text
12157/// enum AccountFlags
12158/// { // masks for each flag
12159///
12160///     // Flags set on issuer accounts
12161///     // TrustLines are created with authorized set to "false" requiring
12162///     // the issuer to set it for each TrustLine
12163///     AUTH_REQUIRED_FLAG = 0x1,
12164///     // If set, the authorized flag in TrustLines can be cleared
12165///     // otherwise, authorization cannot be revoked
12166///     AUTH_REVOCABLE_FLAG = 0x2,
12167///     // Once set, causes all AUTH_* flags to be read-only
12168///     AUTH_IMMUTABLE_FLAG = 0x4,
12169///     // Trustlines are created with clawback enabled set to "true",
12170///     // and claimable balances created from those trustlines are created
12171///     // with clawback enabled set to "true"
12172///     AUTH_CLAWBACK_ENABLED_FLAG = 0x8
12173/// };
12174/// ```
12175///
12176// enum
12177#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
12178#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
12179#[cfg_attr(
12180    all(feature = "serde", feature = "alloc"),
12181    derive(serde::Serialize, serde::Deserialize),
12182    serde(rename_all = "snake_case")
12183)]
12184#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
12185#[repr(i32)]
12186pub enum AccountFlags {
12187    RequiredFlag = 1,
12188    RevocableFlag = 2,
12189    ImmutableFlag = 4,
12190    ClawbackEnabledFlag = 8,
12191}
12192
12193impl AccountFlags {
12194    pub const VARIANTS: [AccountFlags; 4] = [
12195        AccountFlags::RequiredFlag,
12196        AccountFlags::RevocableFlag,
12197        AccountFlags::ImmutableFlag,
12198        AccountFlags::ClawbackEnabledFlag,
12199    ];
12200    pub const VARIANTS_STR: [&'static str; 4] = [
12201        "RequiredFlag",
12202        "RevocableFlag",
12203        "ImmutableFlag",
12204        "ClawbackEnabledFlag",
12205    ];
12206
12207    #[must_use]
12208    pub const fn name(&self) -> &'static str {
12209        match self {
12210            Self::RequiredFlag => "RequiredFlag",
12211            Self::RevocableFlag => "RevocableFlag",
12212            Self::ImmutableFlag => "ImmutableFlag",
12213            Self::ClawbackEnabledFlag => "ClawbackEnabledFlag",
12214        }
12215    }
12216
12217    #[must_use]
12218    pub const fn variants() -> [AccountFlags; 4] {
12219        Self::VARIANTS
12220    }
12221}
12222
12223impl Name for AccountFlags {
12224    #[must_use]
12225    fn name(&self) -> &'static str {
12226        Self::name(self)
12227    }
12228}
12229
12230impl Variants<AccountFlags> for AccountFlags {
12231    fn variants() -> slice::Iter<'static, AccountFlags> {
12232        Self::VARIANTS.iter()
12233    }
12234}
12235
12236impl Enum for AccountFlags {}
12237
12238impl fmt::Display for AccountFlags {
12239    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
12240        f.write_str(self.name())
12241    }
12242}
12243
12244impl TryFrom<i32> for AccountFlags {
12245    type Error = Error;
12246
12247    fn try_from(i: i32) -> Result<Self> {
12248        let e = match i {
12249            1 => AccountFlags::RequiredFlag,
12250            2 => AccountFlags::RevocableFlag,
12251            4 => AccountFlags::ImmutableFlag,
12252            8 => AccountFlags::ClawbackEnabledFlag,
12253            #[allow(unreachable_patterns)]
12254            _ => return Err(Error::Invalid),
12255        };
12256        Ok(e)
12257    }
12258}
12259
12260impl From<AccountFlags> for i32 {
12261    #[must_use]
12262    fn from(e: AccountFlags) -> Self {
12263        e as Self
12264    }
12265}
12266
12267impl ReadXdr for AccountFlags {
12268    #[cfg(feature = "std")]
12269    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
12270        r.with_limited_depth(|r| {
12271            let e = i32::read_xdr(r)?;
12272            let v: Self = e.try_into()?;
12273            Ok(v)
12274        })
12275    }
12276}
12277
12278impl WriteXdr for AccountFlags {
12279    #[cfg(feature = "std")]
12280    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
12281        w.with_limited_depth(|w| {
12282            let i: i32 = (*self).into();
12283            i.write_xdr(w)
12284        })
12285    }
12286}
12287
12288/// MaskAccountFlags is an XDR Const defines as:
12289///
12290/// ```text
12291/// const MASK_ACCOUNT_FLAGS = 0x7;
12292/// ```
12293///
12294pub const MASK_ACCOUNT_FLAGS: u64 = 0x7;
12295
12296/// MaskAccountFlagsV17 is an XDR Const defines as:
12297///
12298/// ```text
12299/// const MASK_ACCOUNT_FLAGS_V17 = 0xF;
12300/// ```
12301///
12302pub const MASK_ACCOUNT_FLAGS_V17: u64 = 0xF;
12303
12304/// MaxSigners is an XDR Const defines as:
12305///
12306/// ```text
12307/// const MAX_SIGNERS = 20;
12308/// ```
12309///
12310pub const MAX_SIGNERS: u64 = 20;
12311
12312/// SponsorshipDescriptor is an XDR Typedef defines as:
12313///
12314/// ```text
12315/// typedef AccountID* SponsorshipDescriptor;
12316/// ```
12317///
12318#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
12319#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
12320#[cfg_attr(
12321    all(feature = "serde", feature = "alloc"),
12322    derive(serde::Serialize, serde::Deserialize),
12323    serde(rename_all = "snake_case")
12324)]
12325#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
12326#[derive(Debug)]
12327pub struct SponsorshipDescriptor(pub Option<AccountId>);
12328
12329impl From<SponsorshipDescriptor> for Option<AccountId> {
12330    #[must_use]
12331    fn from(x: SponsorshipDescriptor) -> Self {
12332        x.0
12333    }
12334}
12335
12336impl From<Option<AccountId>> for SponsorshipDescriptor {
12337    #[must_use]
12338    fn from(x: Option<AccountId>) -> Self {
12339        SponsorshipDescriptor(x)
12340    }
12341}
12342
12343impl AsRef<Option<AccountId>> for SponsorshipDescriptor {
12344    #[must_use]
12345    fn as_ref(&self) -> &Option<AccountId> {
12346        &self.0
12347    }
12348}
12349
12350impl ReadXdr for SponsorshipDescriptor {
12351    #[cfg(feature = "std")]
12352    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
12353        r.with_limited_depth(|r| {
12354            let i = Option::<AccountId>::read_xdr(r)?;
12355            let v = SponsorshipDescriptor(i);
12356            Ok(v)
12357        })
12358    }
12359}
12360
12361impl WriteXdr for SponsorshipDescriptor {
12362    #[cfg(feature = "std")]
12363    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
12364        w.with_limited_depth(|w| self.0.write_xdr(w))
12365    }
12366}
12367
12368/// AccountEntryExtensionV3 is an XDR Struct defines as:
12369///
12370/// ```text
12371/// struct AccountEntryExtensionV3
12372/// {
12373///     // We can use this to add more fields, or because it is first, to
12374///     // change AccountEntryExtensionV3 into a union.
12375///     ExtensionPoint ext;
12376///
12377///     // Ledger number at which `seqNum` took on its present value.
12378///     uint32 seqLedger;
12379///
12380///     // Time at which `seqNum` took on its present value.
12381///     TimePoint seqTime;
12382/// };
12383/// ```
12384///
12385#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
12386#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
12387#[cfg_attr(
12388    all(feature = "serde", feature = "alloc"),
12389    derive(serde::Serialize, serde::Deserialize),
12390    serde(rename_all = "snake_case")
12391)]
12392#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
12393pub struct AccountEntryExtensionV3 {
12394    pub ext: ExtensionPoint,
12395    pub seq_ledger: u32,
12396    pub seq_time: TimePoint,
12397}
12398
12399impl ReadXdr for AccountEntryExtensionV3 {
12400    #[cfg(feature = "std")]
12401    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
12402        r.with_limited_depth(|r| {
12403            Ok(Self {
12404                ext: ExtensionPoint::read_xdr(r)?,
12405                seq_ledger: u32::read_xdr(r)?,
12406                seq_time: TimePoint::read_xdr(r)?,
12407            })
12408        })
12409    }
12410}
12411
12412impl WriteXdr for AccountEntryExtensionV3 {
12413    #[cfg(feature = "std")]
12414    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
12415        w.with_limited_depth(|w| {
12416            self.ext.write_xdr(w)?;
12417            self.seq_ledger.write_xdr(w)?;
12418            self.seq_time.write_xdr(w)?;
12419            Ok(())
12420        })
12421    }
12422}
12423
12424/// AccountEntryExtensionV2Ext is an XDR NestedUnion defines as:
12425///
12426/// ```text
12427/// union switch (int v)
12428///     {
12429///     case 0:
12430///         void;
12431///     case 3:
12432///         AccountEntryExtensionV3 v3;
12433///     }
12434/// ```
12435///
12436// union with discriminant i32
12437#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
12438#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
12439#[cfg_attr(
12440    all(feature = "serde", feature = "alloc"),
12441    derive(serde::Serialize, serde::Deserialize),
12442    serde(rename_all = "snake_case")
12443)]
12444#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
12445#[allow(clippy::large_enum_variant)]
12446pub enum AccountEntryExtensionV2Ext {
12447    V0,
12448    V3(AccountEntryExtensionV3),
12449}
12450
12451impl AccountEntryExtensionV2Ext {
12452    pub const VARIANTS: [i32; 2] = [0, 3];
12453    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V3"];
12454
12455    #[must_use]
12456    pub const fn name(&self) -> &'static str {
12457        match self {
12458            Self::V0 => "V0",
12459            Self::V3(_) => "V3",
12460        }
12461    }
12462
12463    #[must_use]
12464    pub const fn discriminant(&self) -> i32 {
12465        #[allow(clippy::match_same_arms)]
12466        match self {
12467            Self::V0 => 0,
12468            Self::V3(_) => 3,
12469        }
12470    }
12471
12472    #[must_use]
12473    pub const fn variants() -> [i32; 2] {
12474        Self::VARIANTS
12475    }
12476}
12477
12478impl Name for AccountEntryExtensionV2Ext {
12479    #[must_use]
12480    fn name(&self) -> &'static str {
12481        Self::name(self)
12482    }
12483}
12484
12485impl Discriminant<i32> for AccountEntryExtensionV2Ext {
12486    #[must_use]
12487    fn discriminant(&self) -> i32 {
12488        Self::discriminant(self)
12489    }
12490}
12491
12492impl Variants<i32> for AccountEntryExtensionV2Ext {
12493    fn variants() -> slice::Iter<'static, i32> {
12494        Self::VARIANTS.iter()
12495    }
12496}
12497
12498impl Union<i32> for AccountEntryExtensionV2Ext {}
12499
12500impl ReadXdr for AccountEntryExtensionV2Ext {
12501    #[cfg(feature = "std")]
12502    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
12503        r.with_limited_depth(|r| {
12504            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
12505            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
12506            let v = match dv {
12507                0 => Self::V0,
12508                3 => Self::V3(AccountEntryExtensionV3::read_xdr(r)?),
12509                #[allow(unreachable_patterns)]
12510                _ => return Err(Error::Invalid),
12511            };
12512            Ok(v)
12513        })
12514    }
12515}
12516
12517impl WriteXdr for AccountEntryExtensionV2Ext {
12518    #[cfg(feature = "std")]
12519    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
12520        w.with_limited_depth(|w| {
12521            self.discriminant().write_xdr(w)?;
12522            #[allow(clippy::match_same_arms)]
12523            match self {
12524                Self::V0 => ().write_xdr(w)?,
12525                Self::V3(v) => v.write_xdr(w)?,
12526            };
12527            Ok(())
12528        })
12529    }
12530}
12531
12532/// AccountEntryExtensionV2 is an XDR Struct defines as:
12533///
12534/// ```text
12535/// struct AccountEntryExtensionV2
12536/// {
12537///     uint32 numSponsored;
12538///     uint32 numSponsoring;
12539///     SponsorshipDescriptor signerSponsoringIDs<MAX_SIGNERS>;
12540///
12541///     union switch (int v)
12542///     {
12543///     case 0:
12544///         void;
12545///     case 3:
12546///         AccountEntryExtensionV3 v3;
12547///     }
12548///     ext;
12549/// };
12550/// ```
12551///
12552#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
12553#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
12554#[cfg_attr(
12555    all(feature = "serde", feature = "alloc"),
12556    derive(serde::Serialize, serde::Deserialize),
12557    serde(rename_all = "snake_case")
12558)]
12559#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
12560pub struct AccountEntryExtensionV2 {
12561    pub num_sponsored: u32,
12562    pub num_sponsoring: u32,
12563    pub signer_sponsoring_i_ds: VecM<SponsorshipDescriptor, 20>,
12564    pub ext: AccountEntryExtensionV2Ext,
12565}
12566
12567impl ReadXdr for AccountEntryExtensionV2 {
12568    #[cfg(feature = "std")]
12569    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
12570        r.with_limited_depth(|r| {
12571            Ok(Self {
12572                num_sponsored: u32::read_xdr(r)?,
12573                num_sponsoring: u32::read_xdr(r)?,
12574                signer_sponsoring_i_ds: VecM::<SponsorshipDescriptor, 20>::read_xdr(r)?,
12575                ext: AccountEntryExtensionV2Ext::read_xdr(r)?,
12576            })
12577        })
12578    }
12579}
12580
12581impl WriteXdr for AccountEntryExtensionV2 {
12582    #[cfg(feature = "std")]
12583    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
12584        w.with_limited_depth(|w| {
12585            self.num_sponsored.write_xdr(w)?;
12586            self.num_sponsoring.write_xdr(w)?;
12587            self.signer_sponsoring_i_ds.write_xdr(w)?;
12588            self.ext.write_xdr(w)?;
12589            Ok(())
12590        })
12591    }
12592}
12593
12594/// AccountEntryExtensionV1Ext is an XDR NestedUnion defines as:
12595///
12596/// ```text
12597/// union switch (int v)
12598///     {
12599///     case 0:
12600///         void;
12601///     case 2:
12602///         AccountEntryExtensionV2 v2;
12603///     }
12604/// ```
12605///
12606// union with discriminant i32
12607#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
12608#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
12609#[cfg_attr(
12610    all(feature = "serde", feature = "alloc"),
12611    derive(serde::Serialize, serde::Deserialize),
12612    serde(rename_all = "snake_case")
12613)]
12614#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
12615#[allow(clippy::large_enum_variant)]
12616pub enum AccountEntryExtensionV1Ext {
12617    V0,
12618    V2(AccountEntryExtensionV2),
12619}
12620
12621impl AccountEntryExtensionV1Ext {
12622    pub const VARIANTS: [i32; 2] = [0, 2];
12623    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V2"];
12624
12625    #[must_use]
12626    pub const fn name(&self) -> &'static str {
12627        match self {
12628            Self::V0 => "V0",
12629            Self::V2(_) => "V2",
12630        }
12631    }
12632
12633    #[must_use]
12634    pub const fn discriminant(&self) -> i32 {
12635        #[allow(clippy::match_same_arms)]
12636        match self {
12637            Self::V0 => 0,
12638            Self::V2(_) => 2,
12639        }
12640    }
12641
12642    #[must_use]
12643    pub const fn variants() -> [i32; 2] {
12644        Self::VARIANTS
12645    }
12646}
12647
12648impl Name for AccountEntryExtensionV1Ext {
12649    #[must_use]
12650    fn name(&self) -> &'static str {
12651        Self::name(self)
12652    }
12653}
12654
12655impl Discriminant<i32> for AccountEntryExtensionV1Ext {
12656    #[must_use]
12657    fn discriminant(&self) -> i32 {
12658        Self::discriminant(self)
12659    }
12660}
12661
12662impl Variants<i32> for AccountEntryExtensionV1Ext {
12663    fn variants() -> slice::Iter<'static, i32> {
12664        Self::VARIANTS.iter()
12665    }
12666}
12667
12668impl Union<i32> for AccountEntryExtensionV1Ext {}
12669
12670impl ReadXdr for AccountEntryExtensionV1Ext {
12671    #[cfg(feature = "std")]
12672    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
12673        r.with_limited_depth(|r| {
12674            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
12675            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
12676            let v = match dv {
12677                0 => Self::V0,
12678                2 => Self::V2(AccountEntryExtensionV2::read_xdr(r)?),
12679                #[allow(unreachable_patterns)]
12680                _ => return Err(Error::Invalid),
12681            };
12682            Ok(v)
12683        })
12684    }
12685}
12686
12687impl WriteXdr for AccountEntryExtensionV1Ext {
12688    #[cfg(feature = "std")]
12689    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
12690        w.with_limited_depth(|w| {
12691            self.discriminant().write_xdr(w)?;
12692            #[allow(clippy::match_same_arms)]
12693            match self {
12694                Self::V0 => ().write_xdr(w)?,
12695                Self::V2(v) => v.write_xdr(w)?,
12696            };
12697            Ok(())
12698        })
12699    }
12700}
12701
12702/// AccountEntryExtensionV1 is an XDR Struct defines as:
12703///
12704/// ```text
12705/// struct AccountEntryExtensionV1
12706/// {
12707///     Liabilities liabilities;
12708///
12709///     union switch (int v)
12710///     {
12711///     case 0:
12712///         void;
12713///     case 2:
12714///         AccountEntryExtensionV2 v2;
12715///     }
12716///     ext;
12717/// };
12718/// ```
12719///
12720#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
12721#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
12722#[cfg_attr(
12723    all(feature = "serde", feature = "alloc"),
12724    derive(serde::Serialize, serde::Deserialize),
12725    serde(rename_all = "snake_case")
12726)]
12727#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
12728pub struct AccountEntryExtensionV1 {
12729    pub liabilities: Liabilities,
12730    pub ext: AccountEntryExtensionV1Ext,
12731}
12732
12733impl ReadXdr for AccountEntryExtensionV1 {
12734    #[cfg(feature = "std")]
12735    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
12736        r.with_limited_depth(|r| {
12737            Ok(Self {
12738                liabilities: Liabilities::read_xdr(r)?,
12739                ext: AccountEntryExtensionV1Ext::read_xdr(r)?,
12740            })
12741        })
12742    }
12743}
12744
12745impl WriteXdr for AccountEntryExtensionV1 {
12746    #[cfg(feature = "std")]
12747    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
12748        w.with_limited_depth(|w| {
12749            self.liabilities.write_xdr(w)?;
12750            self.ext.write_xdr(w)?;
12751            Ok(())
12752        })
12753    }
12754}
12755
12756/// AccountEntryExt is an XDR NestedUnion defines as:
12757///
12758/// ```text
12759/// union switch (int v)
12760///     {
12761///     case 0:
12762///         void;
12763///     case 1:
12764///         AccountEntryExtensionV1 v1;
12765///     }
12766/// ```
12767///
12768// union with discriminant i32
12769#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
12770#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
12771#[cfg_attr(
12772    all(feature = "serde", feature = "alloc"),
12773    derive(serde::Serialize, serde::Deserialize),
12774    serde(rename_all = "snake_case")
12775)]
12776#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
12777#[allow(clippy::large_enum_variant)]
12778pub enum AccountEntryExt {
12779    V0,
12780    V1(AccountEntryExtensionV1),
12781}
12782
12783impl AccountEntryExt {
12784    pub const VARIANTS: [i32; 2] = [0, 1];
12785    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"];
12786
12787    #[must_use]
12788    pub const fn name(&self) -> &'static str {
12789        match self {
12790            Self::V0 => "V0",
12791            Self::V1(_) => "V1",
12792        }
12793    }
12794
12795    #[must_use]
12796    pub const fn discriminant(&self) -> i32 {
12797        #[allow(clippy::match_same_arms)]
12798        match self {
12799            Self::V0 => 0,
12800            Self::V1(_) => 1,
12801        }
12802    }
12803
12804    #[must_use]
12805    pub const fn variants() -> [i32; 2] {
12806        Self::VARIANTS
12807    }
12808}
12809
12810impl Name for AccountEntryExt {
12811    #[must_use]
12812    fn name(&self) -> &'static str {
12813        Self::name(self)
12814    }
12815}
12816
12817impl Discriminant<i32> for AccountEntryExt {
12818    #[must_use]
12819    fn discriminant(&self) -> i32 {
12820        Self::discriminant(self)
12821    }
12822}
12823
12824impl Variants<i32> for AccountEntryExt {
12825    fn variants() -> slice::Iter<'static, i32> {
12826        Self::VARIANTS.iter()
12827    }
12828}
12829
12830impl Union<i32> for AccountEntryExt {}
12831
12832impl ReadXdr for AccountEntryExt {
12833    #[cfg(feature = "std")]
12834    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
12835        r.with_limited_depth(|r| {
12836            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
12837            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
12838            let v = match dv {
12839                0 => Self::V0,
12840                1 => Self::V1(AccountEntryExtensionV1::read_xdr(r)?),
12841                #[allow(unreachable_patterns)]
12842                _ => return Err(Error::Invalid),
12843            };
12844            Ok(v)
12845        })
12846    }
12847}
12848
12849impl WriteXdr for AccountEntryExt {
12850    #[cfg(feature = "std")]
12851    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
12852        w.with_limited_depth(|w| {
12853            self.discriminant().write_xdr(w)?;
12854            #[allow(clippy::match_same_arms)]
12855            match self {
12856                Self::V0 => ().write_xdr(w)?,
12857                Self::V1(v) => v.write_xdr(w)?,
12858            };
12859            Ok(())
12860        })
12861    }
12862}
12863
12864/// AccountEntry is an XDR Struct defines as:
12865///
12866/// ```text
12867/// struct AccountEntry
12868/// {
12869///     AccountID accountID;      // master public key for this account
12870///     int64 balance;            // in stroops
12871///     SequenceNumber seqNum;    // last sequence number used for this account
12872///     uint32 numSubEntries;     // number of sub-entries this account has
12873///                               // drives the reserve
12874///     AccountID* inflationDest; // Account to vote for during inflation
12875///     uint32 flags;             // see AccountFlags
12876///
12877///     string32 homeDomain; // can be used for reverse federation and memo lookup
12878///
12879///     // fields used for signatures
12880///     // thresholds stores unsigned bytes: [weight of master|low|medium|high]
12881///     Thresholds thresholds;
12882///
12883///     Signer signers<MAX_SIGNERS>; // possible signers for this account
12884///
12885///     // reserved for future use
12886///     union switch (int v)
12887///     {
12888///     case 0:
12889///         void;
12890///     case 1:
12891///         AccountEntryExtensionV1 v1;
12892///     }
12893///     ext;
12894/// };
12895/// ```
12896///
12897#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
12898#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
12899#[cfg_attr(
12900    all(feature = "serde", feature = "alloc"),
12901    derive(serde::Serialize, serde::Deserialize),
12902    serde(rename_all = "snake_case")
12903)]
12904#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
12905pub struct AccountEntry {
12906    pub account_id: AccountId,
12907    pub balance: i64,
12908    pub seq_num: SequenceNumber,
12909    pub num_sub_entries: u32,
12910    pub inflation_dest: Option<AccountId>,
12911    pub flags: u32,
12912    pub home_domain: String32,
12913    pub thresholds: Thresholds,
12914    pub signers: VecM<Signer, 20>,
12915    pub ext: AccountEntryExt,
12916}
12917
12918impl ReadXdr for AccountEntry {
12919    #[cfg(feature = "std")]
12920    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
12921        r.with_limited_depth(|r| {
12922            Ok(Self {
12923                account_id: AccountId::read_xdr(r)?,
12924                balance: i64::read_xdr(r)?,
12925                seq_num: SequenceNumber::read_xdr(r)?,
12926                num_sub_entries: u32::read_xdr(r)?,
12927                inflation_dest: Option::<AccountId>::read_xdr(r)?,
12928                flags: u32::read_xdr(r)?,
12929                home_domain: String32::read_xdr(r)?,
12930                thresholds: Thresholds::read_xdr(r)?,
12931                signers: VecM::<Signer, 20>::read_xdr(r)?,
12932                ext: AccountEntryExt::read_xdr(r)?,
12933            })
12934        })
12935    }
12936}
12937
12938impl WriteXdr for AccountEntry {
12939    #[cfg(feature = "std")]
12940    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
12941        w.with_limited_depth(|w| {
12942            self.account_id.write_xdr(w)?;
12943            self.balance.write_xdr(w)?;
12944            self.seq_num.write_xdr(w)?;
12945            self.num_sub_entries.write_xdr(w)?;
12946            self.inflation_dest.write_xdr(w)?;
12947            self.flags.write_xdr(w)?;
12948            self.home_domain.write_xdr(w)?;
12949            self.thresholds.write_xdr(w)?;
12950            self.signers.write_xdr(w)?;
12951            self.ext.write_xdr(w)?;
12952            Ok(())
12953        })
12954    }
12955}
12956
12957/// TrustLineFlags is an XDR Enum defines as:
12958///
12959/// ```text
12960/// enum TrustLineFlags
12961/// {
12962///     // issuer has authorized account to perform transactions with its credit
12963///     AUTHORIZED_FLAG = 1,
12964///     // issuer has authorized account to maintain and reduce liabilities for its
12965///     // credit
12966///     AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG = 2,
12967///     // issuer has specified that it may clawback its credit, and that claimable
12968///     // balances created with its credit may also be clawed back
12969///     TRUSTLINE_CLAWBACK_ENABLED_FLAG = 4
12970/// };
12971/// ```
12972///
12973// enum
12974#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
12975#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
12976#[cfg_attr(
12977    all(feature = "serde", feature = "alloc"),
12978    derive(serde::Serialize, serde::Deserialize),
12979    serde(rename_all = "snake_case")
12980)]
12981#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
12982#[repr(i32)]
12983pub enum TrustLineFlags {
12984    AuthorizedFlag = 1,
12985    AuthorizedToMaintainLiabilitiesFlag = 2,
12986    TrustlineClawbackEnabledFlag = 4,
12987}
12988
12989impl TrustLineFlags {
12990    pub const VARIANTS: [TrustLineFlags; 3] = [
12991        TrustLineFlags::AuthorizedFlag,
12992        TrustLineFlags::AuthorizedToMaintainLiabilitiesFlag,
12993        TrustLineFlags::TrustlineClawbackEnabledFlag,
12994    ];
12995    pub const VARIANTS_STR: [&'static str; 3] = [
12996        "AuthorizedFlag",
12997        "AuthorizedToMaintainLiabilitiesFlag",
12998        "TrustlineClawbackEnabledFlag",
12999    ];
13000
13001    #[must_use]
13002    pub const fn name(&self) -> &'static str {
13003        match self {
13004            Self::AuthorizedFlag => "AuthorizedFlag",
13005            Self::AuthorizedToMaintainLiabilitiesFlag => "AuthorizedToMaintainLiabilitiesFlag",
13006            Self::TrustlineClawbackEnabledFlag => "TrustlineClawbackEnabledFlag",
13007        }
13008    }
13009
13010    #[must_use]
13011    pub const fn variants() -> [TrustLineFlags; 3] {
13012        Self::VARIANTS
13013    }
13014}
13015
13016impl Name for TrustLineFlags {
13017    #[must_use]
13018    fn name(&self) -> &'static str {
13019        Self::name(self)
13020    }
13021}
13022
13023impl Variants<TrustLineFlags> for TrustLineFlags {
13024    fn variants() -> slice::Iter<'static, TrustLineFlags> {
13025        Self::VARIANTS.iter()
13026    }
13027}
13028
13029impl Enum for TrustLineFlags {}
13030
13031impl fmt::Display for TrustLineFlags {
13032    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
13033        f.write_str(self.name())
13034    }
13035}
13036
13037impl TryFrom<i32> for TrustLineFlags {
13038    type Error = Error;
13039
13040    fn try_from(i: i32) -> Result<Self> {
13041        let e = match i {
13042            1 => TrustLineFlags::AuthorizedFlag,
13043            2 => TrustLineFlags::AuthorizedToMaintainLiabilitiesFlag,
13044            4 => TrustLineFlags::TrustlineClawbackEnabledFlag,
13045            #[allow(unreachable_patterns)]
13046            _ => return Err(Error::Invalid),
13047        };
13048        Ok(e)
13049    }
13050}
13051
13052impl From<TrustLineFlags> for i32 {
13053    #[must_use]
13054    fn from(e: TrustLineFlags) -> Self {
13055        e as Self
13056    }
13057}
13058
13059impl ReadXdr for TrustLineFlags {
13060    #[cfg(feature = "std")]
13061    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
13062        r.with_limited_depth(|r| {
13063            let e = i32::read_xdr(r)?;
13064            let v: Self = e.try_into()?;
13065            Ok(v)
13066        })
13067    }
13068}
13069
13070impl WriteXdr for TrustLineFlags {
13071    #[cfg(feature = "std")]
13072    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
13073        w.with_limited_depth(|w| {
13074            let i: i32 = (*self).into();
13075            i.write_xdr(w)
13076        })
13077    }
13078}
13079
13080/// MaskTrustlineFlags is an XDR Const defines as:
13081///
13082/// ```text
13083/// const MASK_TRUSTLINE_FLAGS = 1;
13084/// ```
13085///
13086pub const MASK_TRUSTLINE_FLAGS: u64 = 1;
13087
13088/// MaskTrustlineFlagsV13 is an XDR Const defines as:
13089///
13090/// ```text
13091/// const MASK_TRUSTLINE_FLAGS_V13 = 3;
13092/// ```
13093///
13094pub const MASK_TRUSTLINE_FLAGS_V13: u64 = 3;
13095
13096/// MaskTrustlineFlagsV17 is an XDR Const defines as:
13097///
13098/// ```text
13099/// const MASK_TRUSTLINE_FLAGS_V17 = 7;
13100/// ```
13101///
13102pub const MASK_TRUSTLINE_FLAGS_V17: u64 = 7;
13103
13104/// LiquidityPoolType is an XDR Enum defines as:
13105///
13106/// ```text
13107/// enum LiquidityPoolType
13108/// {
13109///     LIQUIDITY_POOL_CONSTANT_PRODUCT = 0
13110/// };
13111/// ```
13112///
13113// enum
13114#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
13115#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
13116#[cfg_attr(
13117    all(feature = "serde", feature = "alloc"),
13118    derive(serde::Serialize, serde::Deserialize),
13119    serde(rename_all = "snake_case")
13120)]
13121#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
13122#[repr(i32)]
13123pub enum LiquidityPoolType {
13124    LiquidityPoolConstantProduct = 0,
13125}
13126
13127impl LiquidityPoolType {
13128    pub const VARIANTS: [LiquidityPoolType; 1] = [LiquidityPoolType::LiquidityPoolConstantProduct];
13129    pub const VARIANTS_STR: [&'static str; 1] = ["LiquidityPoolConstantProduct"];
13130
13131    #[must_use]
13132    pub const fn name(&self) -> &'static str {
13133        match self {
13134            Self::LiquidityPoolConstantProduct => "LiquidityPoolConstantProduct",
13135        }
13136    }
13137
13138    #[must_use]
13139    pub const fn variants() -> [LiquidityPoolType; 1] {
13140        Self::VARIANTS
13141    }
13142}
13143
13144impl Name for LiquidityPoolType {
13145    #[must_use]
13146    fn name(&self) -> &'static str {
13147        Self::name(self)
13148    }
13149}
13150
13151impl Variants<LiquidityPoolType> for LiquidityPoolType {
13152    fn variants() -> slice::Iter<'static, LiquidityPoolType> {
13153        Self::VARIANTS.iter()
13154    }
13155}
13156
13157impl Enum for LiquidityPoolType {}
13158
13159impl fmt::Display for LiquidityPoolType {
13160    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
13161        f.write_str(self.name())
13162    }
13163}
13164
13165impl TryFrom<i32> for LiquidityPoolType {
13166    type Error = Error;
13167
13168    fn try_from(i: i32) -> Result<Self> {
13169        let e = match i {
13170            0 => LiquidityPoolType::LiquidityPoolConstantProduct,
13171            #[allow(unreachable_patterns)]
13172            _ => return Err(Error::Invalid),
13173        };
13174        Ok(e)
13175    }
13176}
13177
13178impl From<LiquidityPoolType> for i32 {
13179    #[must_use]
13180    fn from(e: LiquidityPoolType) -> Self {
13181        e as Self
13182    }
13183}
13184
13185impl ReadXdr for LiquidityPoolType {
13186    #[cfg(feature = "std")]
13187    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
13188        r.with_limited_depth(|r| {
13189            let e = i32::read_xdr(r)?;
13190            let v: Self = e.try_into()?;
13191            Ok(v)
13192        })
13193    }
13194}
13195
13196impl WriteXdr for LiquidityPoolType {
13197    #[cfg(feature = "std")]
13198    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
13199        w.with_limited_depth(|w| {
13200            let i: i32 = (*self).into();
13201            i.write_xdr(w)
13202        })
13203    }
13204}
13205
13206/// TrustLineAsset is an XDR Union defines as:
13207///
13208/// ```text
13209/// union TrustLineAsset switch (AssetType type)
13210/// {
13211/// case ASSET_TYPE_NATIVE: // Not credit
13212///     void;
13213///
13214/// case ASSET_TYPE_CREDIT_ALPHANUM4:
13215///     AlphaNum4 alphaNum4;
13216///
13217/// case ASSET_TYPE_CREDIT_ALPHANUM12:
13218///     AlphaNum12 alphaNum12;
13219///
13220/// case ASSET_TYPE_POOL_SHARE:
13221///     PoolID liquidityPoolID;
13222///
13223///     // add other asset types here in the future
13224/// };
13225/// ```
13226///
13227// union with discriminant AssetType
13228#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
13229#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
13230#[cfg_attr(
13231    all(feature = "serde", feature = "alloc"),
13232    derive(serde::Serialize, serde::Deserialize),
13233    serde(rename_all = "snake_case")
13234)]
13235#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
13236#[allow(clippy::large_enum_variant)]
13237pub enum TrustLineAsset {
13238    Native,
13239    CreditAlphanum4(AlphaNum4),
13240    CreditAlphanum12(AlphaNum12),
13241    PoolShare(PoolId),
13242}
13243
13244impl TrustLineAsset {
13245    pub const VARIANTS: [AssetType; 4] = [
13246        AssetType::Native,
13247        AssetType::CreditAlphanum4,
13248        AssetType::CreditAlphanum12,
13249        AssetType::PoolShare,
13250    ];
13251    pub const VARIANTS_STR: [&'static str; 4] =
13252        ["Native", "CreditAlphanum4", "CreditAlphanum12", "PoolShare"];
13253
13254    #[must_use]
13255    pub const fn name(&self) -> &'static str {
13256        match self {
13257            Self::Native => "Native",
13258            Self::CreditAlphanum4(_) => "CreditAlphanum4",
13259            Self::CreditAlphanum12(_) => "CreditAlphanum12",
13260            Self::PoolShare(_) => "PoolShare",
13261        }
13262    }
13263
13264    #[must_use]
13265    pub const fn discriminant(&self) -> AssetType {
13266        #[allow(clippy::match_same_arms)]
13267        match self {
13268            Self::Native => AssetType::Native,
13269            Self::CreditAlphanum4(_) => AssetType::CreditAlphanum4,
13270            Self::CreditAlphanum12(_) => AssetType::CreditAlphanum12,
13271            Self::PoolShare(_) => AssetType::PoolShare,
13272        }
13273    }
13274
13275    #[must_use]
13276    pub const fn variants() -> [AssetType; 4] {
13277        Self::VARIANTS
13278    }
13279}
13280
13281impl Name for TrustLineAsset {
13282    #[must_use]
13283    fn name(&self) -> &'static str {
13284        Self::name(self)
13285    }
13286}
13287
13288impl Discriminant<AssetType> for TrustLineAsset {
13289    #[must_use]
13290    fn discriminant(&self) -> AssetType {
13291        Self::discriminant(self)
13292    }
13293}
13294
13295impl Variants<AssetType> for TrustLineAsset {
13296    fn variants() -> slice::Iter<'static, AssetType> {
13297        Self::VARIANTS.iter()
13298    }
13299}
13300
13301impl Union<AssetType> for TrustLineAsset {}
13302
13303impl ReadXdr for TrustLineAsset {
13304    #[cfg(feature = "std")]
13305    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
13306        r.with_limited_depth(|r| {
13307            let dv: AssetType = <AssetType as ReadXdr>::read_xdr(r)?;
13308            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
13309            let v = match dv {
13310                AssetType::Native => Self::Native,
13311                AssetType::CreditAlphanum4 => Self::CreditAlphanum4(AlphaNum4::read_xdr(r)?),
13312                AssetType::CreditAlphanum12 => Self::CreditAlphanum12(AlphaNum12::read_xdr(r)?),
13313                AssetType::PoolShare => Self::PoolShare(PoolId::read_xdr(r)?),
13314                #[allow(unreachable_patterns)]
13315                _ => return Err(Error::Invalid),
13316            };
13317            Ok(v)
13318        })
13319    }
13320}
13321
13322impl WriteXdr for TrustLineAsset {
13323    #[cfg(feature = "std")]
13324    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
13325        w.with_limited_depth(|w| {
13326            self.discriminant().write_xdr(w)?;
13327            #[allow(clippy::match_same_arms)]
13328            match self {
13329                Self::Native => ().write_xdr(w)?,
13330                Self::CreditAlphanum4(v) => v.write_xdr(w)?,
13331                Self::CreditAlphanum12(v) => v.write_xdr(w)?,
13332                Self::PoolShare(v) => v.write_xdr(w)?,
13333            };
13334            Ok(())
13335        })
13336    }
13337}
13338
13339/// TrustLineEntryExtensionV2Ext is an XDR NestedUnion defines as:
13340///
13341/// ```text
13342/// union switch (int v)
13343///     {
13344///     case 0:
13345///         void;
13346///     }
13347/// ```
13348///
13349// union with discriminant i32
13350#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
13351#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
13352#[cfg_attr(
13353    all(feature = "serde", feature = "alloc"),
13354    derive(serde::Serialize, serde::Deserialize),
13355    serde(rename_all = "snake_case")
13356)]
13357#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
13358#[allow(clippy::large_enum_variant)]
13359pub enum TrustLineEntryExtensionV2Ext {
13360    V0,
13361}
13362
13363impl TrustLineEntryExtensionV2Ext {
13364    pub const VARIANTS: [i32; 1] = [0];
13365    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
13366
13367    #[must_use]
13368    pub const fn name(&self) -> &'static str {
13369        match self {
13370            Self::V0 => "V0",
13371        }
13372    }
13373
13374    #[must_use]
13375    pub const fn discriminant(&self) -> i32 {
13376        #[allow(clippy::match_same_arms)]
13377        match self {
13378            Self::V0 => 0,
13379        }
13380    }
13381
13382    #[must_use]
13383    pub const fn variants() -> [i32; 1] {
13384        Self::VARIANTS
13385    }
13386}
13387
13388impl Name for TrustLineEntryExtensionV2Ext {
13389    #[must_use]
13390    fn name(&self) -> &'static str {
13391        Self::name(self)
13392    }
13393}
13394
13395impl Discriminant<i32> for TrustLineEntryExtensionV2Ext {
13396    #[must_use]
13397    fn discriminant(&self) -> i32 {
13398        Self::discriminant(self)
13399    }
13400}
13401
13402impl Variants<i32> for TrustLineEntryExtensionV2Ext {
13403    fn variants() -> slice::Iter<'static, i32> {
13404        Self::VARIANTS.iter()
13405    }
13406}
13407
13408impl Union<i32> for TrustLineEntryExtensionV2Ext {}
13409
13410impl ReadXdr for TrustLineEntryExtensionV2Ext {
13411    #[cfg(feature = "std")]
13412    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
13413        r.with_limited_depth(|r| {
13414            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
13415            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
13416            let v = match dv {
13417                0 => Self::V0,
13418                #[allow(unreachable_patterns)]
13419                _ => return Err(Error::Invalid),
13420            };
13421            Ok(v)
13422        })
13423    }
13424}
13425
13426impl WriteXdr for TrustLineEntryExtensionV2Ext {
13427    #[cfg(feature = "std")]
13428    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
13429        w.with_limited_depth(|w| {
13430            self.discriminant().write_xdr(w)?;
13431            #[allow(clippy::match_same_arms)]
13432            match self {
13433                Self::V0 => ().write_xdr(w)?,
13434            };
13435            Ok(())
13436        })
13437    }
13438}
13439
13440/// TrustLineEntryExtensionV2 is an XDR Struct defines as:
13441///
13442/// ```text
13443/// struct TrustLineEntryExtensionV2
13444/// {
13445///     int32 liquidityPoolUseCount;
13446///
13447///     union switch (int v)
13448///     {
13449///     case 0:
13450///         void;
13451///     }
13452///     ext;
13453/// };
13454/// ```
13455///
13456#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
13457#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
13458#[cfg_attr(
13459    all(feature = "serde", feature = "alloc"),
13460    derive(serde::Serialize, serde::Deserialize),
13461    serde(rename_all = "snake_case")
13462)]
13463#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
13464pub struct TrustLineEntryExtensionV2 {
13465    pub liquidity_pool_use_count: i32,
13466    pub ext: TrustLineEntryExtensionV2Ext,
13467}
13468
13469impl ReadXdr for TrustLineEntryExtensionV2 {
13470    #[cfg(feature = "std")]
13471    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
13472        r.with_limited_depth(|r| {
13473            Ok(Self {
13474                liquidity_pool_use_count: i32::read_xdr(r)?,
13475                ext: TrustLineEntryExtensionV2Ext::read_xdr(r)?,
13476            })
13477        })
13478    }
13479}
13480
13481impl WriteXdr for TrustLineEntryExtensionV2 {
13482    #[cfg(feature = "std")]
13483    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
13484        w.with_limited_depth(|w| {
13485            self.liquidity_pool_use_count.write_xdr(w)?;
13486            self.ext.write_xdr(w)?;
13487            Ok(())
13488        })
13489    }
13490}
13491
13492/// TrustLineEntryV1Ext is an XDR NestedUnion defines as:
13493///
13494/// ```text
13495/// union switch (int v)
13496///             {
13497///             case 0:
13498///                 void;
13499///             case 2:
13500///                 TrustLineEntryExtensionV2 v2;
13501///             }
13502/// ```
13503///
13504// union with discriminant i32
13505#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
13506#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
13507#[cfg_attr(
13508    all(feature = "serde", feature = "alloc"),
13509    derive(serde::Serialize, serde::Deserialize),
13510    serde(rename_all = "snake_case")
13511)]
13512#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
13513#[allow(clippy::large_enum_variant)]
13514pub enum TrustLineEntryV1Ext {
13515    V0,
13516    V2(TrustLineEntryExtensionV2),
13517}
13518
13519impl TrustLineEntryV1Ext {
13520    pub const VARIANTS: [i32; 2] = [0, 2];
13521    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V2"];
13522
13523    #[must_use]
13524    pub const fn name(&self) -> &'static str {
13525        match self {
13526            Self::V0 => "V0",
13527            Self::V2(_) => "V2",
13528        }
13529    }
13530
13531    #[must_use]
13532    pub const fn discriminant(&self) -> i32 {
13533        #[allow(clippy::match_same_arms)]
13534        match self {
13535            Self::V0 => 0,
13536            Self::V2(_) => 2,
13537        }
13538    }
13539
13540    #[must_use]
13541    pub const fn variants() -> [i32; 2] {
13542        Self::VARIANTS
13543    }
13544}
13545
13546impl Name for TrustLineEntryV1Ext {
13547    #[must_use]
13548    fn name(&self) -> &'static str {
13549        Self::name(self)
13550    }
13551}
13552
13553impl Discriminant<i32> for TrustLineEntryV1Ext {
13554    #[must_use]
13555    fn discriminant(&self) -> i32 {
13556        Self::discriminant(self)
13557    }
13558}
13559
13560impl Variants<i32> for TrustLineEntryV1Ext {
13561    fn variants() -> slice::Iter<'static, i32> {
13562        Self::VARIANTS.iter()
13563    }
13564}
13565
13566impl Union<i32> for TrustLineEntryV1Ext {}
13567
13568impl ReadXdr for TrustLineEntryV1Ext {
13569    #[cfg(feature = "std")]
13570    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
13571        r.with_limited_depth(|r| {
13572            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
13573            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
13574            let v = match dv {
13575                0 => Self::V0,
13576                2 => Self::V2(TrustLineEntryExtensionV2::read_xdr(r)?),
13577                #[allow(unreachable_patterns)]
13578                _ => return Err(Error::Invalid),
13579            };
13580            Ok(v)
13581        })
13582    }
13583}
13584
13585impl WriteXdr for TrustLineEntryV1Ext {
13586    #[cfg(feature = "std")]
13587    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
13588        w.with_limited_depth(|w| {
13589            self.discriminant().write_xdr(w)?;
13590            #[allow(clippy::match_same_arms)]
13591            match self {
13592                Self::V0 => ().write_xdr(w)?,
13593                Self::V2(v) => v.write_xdr(w)?,
13594            };
13595            Ok(())
13596        })
13597    }
13598}
13599
13600/// TrustLineEntryV1 is an XDR NestedStruct defines as:
13601///
13602/// ```text
13603/// struct
13604///         {
13605///             Liabilities liabilities;
13606///
13607///             union switch (int v)
13608///             {
13609///             case 0:
13610///                 void;
13611///             case 2:
13612///                 TrustLineEntryExtensionV2 v2;
13613///             }
13614///             ext;
13615///         }
13616/// ```
13617///
13618#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
13619#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
13620#[cfg_attr(
13621    all(feature = "serde", feature = "alloc"),
13622    derive(serde::Serialize, serde::Deserialize),
13623    serde(rename_all = "snake_case")
13624)]
13625#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
13626pub struct TrustLineEntryV1 {
13627    pub liabilities: Liabilities,
13628    pub ext: TrustLineEntryV1Ext,
13629}
13630
13631impl ReadXdr for TrustLineEntryV1 {
13632    #[cfg(feature = "std")]
13633    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
13634        r.with_limited_depth(|r| {
13635            Ok(Self {
13636                liabilities: Liabilities::read_xdr(r)?,
13637                ext: TrustLineEntryV1Ext::read_xdr(r)?,
13638            })
13639        })
13640    }
13641}
13642
13643impl WriteXdr for TrustLineEntryV1 {
13644    #[cfg(feature = "std")]
13645    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
13646        w.with_limited_depth(|w| {
13647            self.liabilities.write_xdr(w)?;
13648            self.ext.write_xdr(w)?;
13649            Ok(())
13650        })
13651    }
13652}
13653
13654/// TrustLineEntryExt is an XDR NestedUnion defines as:
13655///
13656/// ```text
13657/// union switch (int v)
13658///     {
13659///     case 0:
13660///         void;
13661///     case 1:
13662///         struct
13663///         {
13664///             Liabilities liabilities;
13665///
13666///             union switch (int v)
13667///             {
13668///             case 0:
13669///                 void;
13670///             case 2:
13671///                 TrustLineEntryExtensionV2 v2;
13672///             }
13673///             ext;
13674///         } v1;
13675///     }
13676/// ```
13677///
13678// union with discriminant i32
13679#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
13680#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
13681#[cfg_attr(
13682    all(feature = "serde", feature = "alloc"),
13683    derive(serde::Serialize, serde::Deserialize),
13684    serde(rename_all = "snake_case")
13685)]
13686#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
13687#[allow(clippy::large_enum_variant)]
13688pub enum TrustLineEntryExt {
13689    V0,
13690    V1(TrustLineEntryV1),
13691}
13692
13693impl TrustLineEntryExt {
13694    pub const VARIANTS: [i32; 2] = [0, 1];
13695    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"];
13696
13697    #[must_use]
13698    pub const fn name(&self) -> &'static str {
13699        match self {
13700            Self::V0 => "V0",
13701            Self::V1(_) => "V1",
13702        }
13703    }
13704
13705    #[must_use]
13706    pub const fn discriminant(&self) -> i32 {
13707        #[allow(clippy::match_same_arms)]
13708        match self {
13709            Self::V0 => 0,
13710            Self::V1(_) => 1,
13711        }
13712    }
13713
13714    #[must_use]
13715    pub const fn variants() -> [i32; 2] {
13716        Self::VARIANTS
13717    }
13718}
13719
13720impl Name for TrustLineEntryExt {
13721    #[must_use]
13722    fn name(&self) -> &'static str {
13723        Self::name(self)
13724    }
13725}
13726
13727impl Discriminant<i32> for TrustLineEntryExt {
13728    #[must_use]
13729    fn discriminant(&self) -> i32 {
13730        Self::discriminant(self)
13731    }
13732}
13733
13734impl Variants<i32> for TrustLineEntryExt {
13735    fn variants() -> slice::Iter<'static, i32> {
13736        Self::VARIANTS.iter()
13737    }
13738}
13739
13740impl Union<i32> for TrustLineEntryExt {}
13741
13742impl ReadXdr for TrustLineEntryExt {
13743    #[cfg(feature = "std")]
13744    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
13745        r.with_limited_depth(|r| {
13746            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
13747            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
13748            let v = match dv {
13749                0 => Self::V0,
13750                1 => Self::V1(TrustLineEntryV1::read_xdr(r)?),
13751                #[allow(unreachable_patterns)]
13752                _ => return Err(Error::Invalid),
13753            };
13754            Ok(v)
13755        })
13756    }
13757}
13758
13759impl WriteXdr for TrustLineEntryExt {
13760    #[cfg(feature = "std")]
13761    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
13762        w.with_limited_depth(|w| {
13763            self.discriminant().write_xdr(w)?;
13764            #[allow(clippy::match_same_arms)]
13765            match self {
13766                Self::V0 => ().write_xdr(w)?,
13767                Self::V1(v) => v.write_xdr(w)?,
13768            };
13769            Ok(())
13770        })
13771    }
13772}
13773
13774/// TrustLineEntry is an XDR Struct defines as:
13775///
13776/// ```text
13777/// struct TrustLineEntry
13778/// {
13779///     AccountID accountID;  // account this trustline belongs to
13780///     TrustLineAsset asset; // type of asset (with issuer)
13781///     int64 balance;        // how much of this asset the user has.
13782///                           // Asset defines the unit for this;
13783///
13784///     int64 limit;  // balance cannot be above this
13785///     uint32 flags; // see TrustLineFlags
13786///
13787///     // reserved for future use
13788///     union switch (int v)
13789///     {
13790///     case 0:
13791///         void;
13792///     case 1:
13793///         struct
13794///         {
13795///             Liabilities liabilities;
13796///
13797///             union switch (int v)
13798///             {
13799///             case 0:
13800///                 void;
13801///             case 2:
13802///                 TrustLineEntryExtensionV2 v2;
13803///             }
13804///             ext;
13805///         } v1;
13806///     }
13807///     ext;
13808/// };
13809/// ```
13810///
13811#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
13812#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
13813#[cfg_attr(
13814    all(feature = "serde", feature = "alloc"),
13815    derive(serde::Serialize, serde::Deserialize),
13816    serde(rename_all = "snake_case")
13817)]
13818#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
13819pub struct TrustLineEntry {
13820    pub account_id: AccountId,
13821    pub asset: TrustLineAsset,
13822    pub balance: i64,
13823    pub limit: i64,
13824    pub flags: u32,
13825    pub ext: TrustLineEntryExt,
13826}
13827
13828impl ReadXdr for TrustLineEntry {
13829    #[cfg(feature = "std")]
13830    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
13831        r.with_limited_depth(|r| {
13832            Ok(Self {
13833                account_id: AccountId::read_xdr(r)?,
13834                asset: TrustLineAsset::read_xdr(r)?,
13835                balance: i64::read_xdr(r)?,
13836                limit: i64::read_xdr(r)?,
13837                flags: u32::read_xdr(r)?,
13838                ext: TrustLineEntryExt::read_xdr(r)?,
13839            })
13840        })
13841    }
13842}
13843
13844impl WriteXdr for TrustLineEntry {
13845    #[cfg(feature = "std")]
13846    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
13847        w.with_limited_depth(|w| {
13848            self.account_id.write_xdr(w)?;
13849            self.asset.write_xdr(w)?;
13850            self.balance.write_xdr(w)?;
13851            self.limit.write_xdr(w)?;
13852            self.flags.write_xdr(w)?;
13853            self.ext.write_xdr(w)?;
13854            Ok(())
13855        })
13856    }
13857}
13858
13859/// OfferEntryFlags is an XDR Enum defines as:
13860///
13861/// ```text
13862/// enum OfferEntryFlags
13863/// {
13864///     // an offer with this flag will not act on and take a reverse offer of equal
13865///     // price
13866///     PASSIVE_FLAG = 1
13867/// };
13868/// ```
13869///
13870// enum
13871#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
13872#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
13873#[cfg_attr(
13874    all(feature = "serde", feature = "alloc"),
13875    derive(serde::Serialize, serde::Deserialize),
13876    serde(rename_all = "snake_case")
13877)]
13878#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
13879#[repr(i32)]
13880pub enum OfferEntryFlags {
13881    PassiveFlag = 1,
13882}
13883
13884impl OfferEntryFlags {
13885    pub const VARIANTS: [OfferEntryFlags; 1] = [OfferEntryFlags::PassiveFlag];
13886    pub const VARIANTS_STR: [&'static str; 1] = ["PassiveFlag"];
13887
13888    #[must_use]
13889    pub const fn name(&self) -> &'static str {
13890        match self {
13891            Self::PassiveFlag => "PassiveFlag",
13892        }
13893    }
13894
13895    #[must_use]
13896    pub const fn variants() -> [OfferEntryFlags; 1] {
13897        Self::VARIANTS
13898    }
13899}
13900
13901impl Name for OfferEntryFlags {
13902    #[must_use]
13903    fn name(&self) -> &'static str {
13904        Self::name(self)
13905    }
13906}
13907
13908impl Variants<OfferEntryFlags> for OfferEntryFlags {
13909    fn variants() -> slice::Iter<'static, OfferEntryFlags> {
13910        Self::VARIANTS.iter()
13911    }
13912}
13913
13914impl Enum for OfferEntryFlags {}
13915
13916impl fmt::Display for OfferEntryFlags {
13917    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
13918        f.write_str(self.name())
13919    }
13920}
13921
13922impl TryFrom<i32> for OfferEntryFlags {
13923    type Error = Error;
13924
13925    fn try_from(i: i32) -> Result<Self> {
13926        let e = match i {
13927            1 => OfferEntryFlags::PassiveFlag,
13928            #[allow(unreachable_patterns)]
13929            _ => return Err(Error::Invalid),
13930        };
13931        Ok(e)
13932    }
13933}
13934
13935impl From<OfferEntryFlags> for i32 {
13936    #[must_use]
13937    fn from(e: OfferEntryFlags) -> Self {
13938        e as Self
13939    }
13940}
13941
13942impl ReadXdr for OfferEntryFlags {
13943    #[cfg(feature = "std")]
13944    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
13945        r.with_limited_depth(|r| {
13946            let e = i32::read_xdr(r)?;
13947            let v: Self = e.try_into()?;
13948            Ok(v)
13949        })
13950    }
13951}
13952
13953impl WriteXdr for OfferEntryFlags {
13954    #[cfg(feature = "std")]
13955    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
13956        w.with_limited_depth(|w| {
13957            let i: i32 = (*self).into();
13958            i.write_xdr(w)
13959        })
13960    }
13961}
13962
13963/// MaskOfferentryFlags is an XDR Const defines as:
13964///
13965/// ```text
13966/// const MASK_OFFERENTRY_FLAGS = 1;
13967/// ```
13968///
13969pub const MASK_OFFERENTRY_FLAGS: u64 = 1;
13970
13971/// OfferEntryExt is an XDR NestedUnion defines as:
13972///
13973/// ```text
13974/// union switch (int v)
13975///     {
13976///     case 0:
13977///         void;
13978///     }
13979/// ```
13980///
13981// union with discriminant i32
13982#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
13983#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
13984#[cfg_attr(
13985    all(feature = "serde", feature = "alloc"),
13986    derive(serde::Serialize, serde::Deserialize),
13987    serde(rename_all = "snake_case")
13988)]
13989#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
13990#[allow(clippy::large_enum_variant)]
13991pub enum OfferEntryExt {
13992    V0,
13993}
13994
13995impl OfferEntryExt {
13996    pub const VARIANTS: [i32; 1] = [0];
13997    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
13998
13999    #[must_use]
14000    pub const fn name(&self) -> &'static str {
14001        match self {
14002            Self::V0 => "V0",
14003        }
14004    }
14005
14006    #[must_use]
14007    pub const fn discriminant(&self) -> i32 {
14008        #[allow(clippy::match_same_arms)]
14009        match self {
14010            Self::V0 => 0,
14011        }
14012    }
14013
14014    #[must_use]
14015    pub const fn variants() -> [i32; 1] {
14016        Self::VARIANTS
14017    }
14018}
14019
14020impl Name for OfferEntryExt {
14021    #[must_use]
14022    fn name(&self) -> &'static str {
14023        Self::name(self)
14024    }
14025}
14026
14027impl Discriminant<i32> for OfferEntryExt {
14028    #[must_use]
14029    fn discriminant(&self) -> i32 {
14030        Self::discriminant(self)
14031    }
14032}
14033
14034impl Variants<i32> for OfferEntryExt {
14035    fn variants() -> slice::Iter<'static, i32> {
14036        Self::VARIANTS.iter()
14037    }
14038}
14039
14040impl Union<i32> for OfferEntryExt {}
14041
14042impl ReadXdr for OfferEntryExt {
14043    #[cfg(feature = "std")]
14044    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
14045        r.with_limited_depth(|r| {
14046            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
14047            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
14048            let v = match dv {
14049                0 => Self::V0,
14050                #[allow(unreachable_patterns)]
14051                _ => return Err(Error::Invalid),
14052            };
14053            Ok(v)
14054        })
14055    }
14056}
14057
14058impl WriteXdr for OfferEntryExt {
14059    #[cfg(feature = "std")]
14060    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
14061        w.with_limited_depth(|w| {
14062            self.discriminant().write_xdr(w)?;
14063            #[allow(clippy::match_same_arms)]
14064            match self {
14065                Self::V0 => ().write_xdr(w)?,
14066            };
14067            Ok(())
14068        })
14069    }
14070}
14071
14072/// OfferEntry is an XDR Struct defines as:
14073///
14074/// ```text
14075/// struct OfferEntry
14076/// {
14077///     AccountID sellerID;
14078///     int64 offerID;
14079///     Asset selling; // A
14080///     Asset buying;  // B
14081///     int64 amount;  // amount of A
14082///
14083///     /* price for this offer:
14084///         price of A in terms of B
14085///         price=AmountB/AmountA=priceNumerator/priceDenominator
14086///         price is after fees
14087///     */
14088///     Price price;
14089///     uint32 flags; // see OfferEntryFlags
14090///
14091///     // reserved for future use
14092///     union switch (int v)
14093///     {
14094///     case 0:
14095///         void;
14096///     }
14097///     ext;
14098/// };
14099/// ```
14100///
14101#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
14102#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
14103#[cfg_attr(
14104    all(feature = "serde", feature = "alloc"),
14105    derive(serde::Serialize, serde::Deserialize),
14106    serde(rename_all = "snake_case")
14107)]
14108#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
14109pub struct OfferEntry {
14110    pub seller_id: AccountId,
14111    pub offer_id: i64,
14112    pub selling: Asset,
14113    pub buying: Asset,
14114    pub amount: i64,
14115    pub price: Price,
14116    pub flags: u32,
14117    pub ext: OfferEntryExt,
14118}
14119
14120impl ReadXdr for OfferEntry {
14121    #[cfg(feature = "std")]
14122    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
14123        r.with_limited_depth(|r| {
14124            Ok(Self {
14125                seller_id: AccountId::read_xdr(r)?,
14126                offer_id: i64::read_xdr(r)?,
14127                selling: Asset::read_xdr(r)?,
14128                buying: Asset::read_xdr(r)?,
14129                amount: i64::read_xdr(r)?,
14130                price: Price::read_xdr(r)?,
14131                flags: u32::read_xdr(r)?,
14132                ext: OfferEntryExt::read_xdr(r)?,
14133            })
14134        })
14135    }
14136}
14137
14138impl WriteXdr for OfferEntry {
14139    #[cfg(feature = "std")]
14140    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
14141        w.with_limited_depth(|w| {
14142            self.seller_id.write_xdr(w)?;
14143            self.offer_id.write_xdr(w)?;
14144            self.selling.write_xdr(w)?;
14145            self.buying.write_xdr(w)?;
14146            self.amount.write_xdr(w)?;
14147            self.price.write_xdr(w)?;
14148            self.flags.write_xdr(w)?;
14149            self.ext.write_xdr(w)?;
14150            Ok(())
14151        })
14152    }
14153}
14154
14155/// DataEntryExt is an XDR NestedUnion defines as:
14156///
14157/// ```text
14158/// union switch (int v)
14159///     {
14160///     case 0:
14161///         void;
14162///     }
14163/// ```
14164///
14165// union with discriminant i32
14166#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
14167#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
14168#[cfg_attr(
14169    all(feature = "serde", feature = "alloc"),
14170    derive(serde::Serialize, serde::Deserialize),
14171    serde(rename_all = "snake_case")
14172)]
14173#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
14174#[allow(clippy::large_enum_variant)]
14175pub enum DataEntryExt {
14176    V0,
14177}
14178
14179impl DataEntryExt {
14180    pub const VARIANTS: [i32; 1] = [0];
14181    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
14182
14183    #[must_use]
14184    pub const fn name(&self) -> &'static str {
14185        match self {
14186            Self::V0 => "V0",
14187        }
14188    }
14189
14190    #[must_use]
14191    pub const fn discriminant(&self) -> i32 {
14192        #[allow(clippy::match_same_arms)]
14193        match self {
14194            Self::V0 => 0,
14195        }
14196    }
14197
14198    #[must_use]
14199    pub const fn variants() -> [i32; 1] {
14200        Self::VARIANTS
14201    }
14202}
14203
14204impl Name for DataEntryExt {
14205    #[must_use]
14206    fn name(&self) -> &'static str {
14207        Self::name(self)
14208    }
14209}
14210
14211impl Discriminant<i32> for DataEntryExt {
14212    #[must_use]
14213    fn discriminant(&self) -> i32 {
14214        Self::discriminant(self)
14215    }
14216}
14217
14218impl Variants<i32> for DataEntryExt {
14219    fn variants() -> slice::Iter<'static, i32> {
14220        Self::VARIANTS.iter()
14221    }
14222}
14223
14224impl Union<i32> for DataEntryExt {}
14225
14226impl ReadXdr for DataEntryExt {
14227    #[cfg(feature = "std")]
14228    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
14229        r.with_limited_depth(|r| {
14230            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
14231            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
14232            let v = match dv {
14233                0 => Self::V0,
14234                #[allow(unreachable_patterns)]
14235                _ => return Err(Error::Invalid),
14236            };
14237            Ok(v)
14238        })
14239    }
14240}
14241
14242impl WriteXdr for DataEntryExt {
14243    #[cfg(feature = "std")]
14244    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
14245        w.with_limited_depth(|w| {
14246            self.discriminant().write_xdr(w)?;
14247            #[allow(clippy::match_same_arms)]
14248            match self {
14249                Self::V0 => ().write_xdr(w)?,
14250            };
14251            Ok(())
14252        })
14253    }
14254}
14255
14256/// DataEntry is an XDR Struct defines as:
14257///
14258/// ```text
14259/// struct DataEntry
14260/// {
14261///     AccountID accountID; // account this data belongs to
14262///     string64 dataName;
14263///     DataValue dataValue;
14264///
14265///     // reserved for future use
14266///     union switch (int v)
14267///     {
14268///     case 0:
14269///         void;
14270///     }
14271///     ext;
14272/// };
14273/// ```
14274///
14275#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
14276#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
14277#[cfg_attr(
14278    all(feature = "serde", feature = "alloc"),
14279    derive(serde::Serialize, serde::Deserialize),
14280    serde(rename_all = "snake_case")
14281)]
14282#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
14283pub struct DataEntry {
14284    pub account_id: AccountId,
14285    pub data_name: String64,
14286    pub data_value: DataValue,
14287    pub ext: DataEntryExt,
14288}
14289
14290impl ReadXdr for DataEntry {
14291    #[cfg(feature = "std")]
14292    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
14293        r.with_limited_depth(|r| {
14294            Ok(Self {
14295                account_id: AccountId::read_xdr(r)?,
14296                data_name: String64::read_xdr(r)?,
14297                data_value: DataValue::read_xdr(r)?,
14298                ext: DataEntryExt::read_xdr(r)?,
14299            })
14300        })
14301    }
14302}
14303
14304impl WriteXdr for DataEntry {
14305    #[cfg(feature = "std")]
14306    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
14307        w.with_limited_depth(|w| {
14308            self.account_id.write_xdr(w)?;
14309            self.data_name.write_xdr(w)?;
14310            self.data_value.write_xdr(w)?;
14311            self.ext.write_xdr(w)?;
14312            Ok(())
14313        })
14314    }
14315}
14316
14317/// ClaimPredicateType is an XDR Enum defines as:
14318///
14319/// ```text
14320/// enum ClaimPredicateType
14321/// {
14322///     CLAIM_PREDICATE_UNCONDITIONAL = 0,
14323///     CLAIM_PREDICATE_AND = 1,
14324///     CLAIM_PREDICATE_OR = 2,
14325///     CLAIM_PREDICATE_NOT = 3,
14326///     CLAIM_PREDICATE_BEFORE_ABSOLUTE_TIME = 4,
14327///     CLAIM_PREDICATE_BEFORE_RELATIVE_TIME = 5
14328/// };
14329/// ```
14330///
14331// enum
14332#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
14333#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
14334#[cfg_attr(
14335    all(feature = "serde", feature = "alloc"),
14336    derive(serde::Serialize, serde::Deserialize),
14337    serde(rename_all = "snake_case")
14338)]
14339#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
14340#[repr(i32)]
14341pub enum ClaimPredicateType {
14342    Unconditional = 0,
14343    And = 1,
14344    Or = 2,
14345    Not = 3,
14346    BeforeAbsoluteTime = 4,
14347    BeforeRelativeTime = 5,
14348}
14349
14350impl ClaimPredicateType {
14351    pub const VARIANTS: [ClaimPredicateType; 6] = [
14352        ClaimPredicateType::Unconditional,
14353        ClaimPredicateType::And,
14354        ClaimPredicateType::Or,
14355        ClaimPredicateType::Not,
14356        ClaimPredicateType::BeforeAbsoluteTime,
14357        ClaimPredicateType::BeforeRelativeTime,
14358    ];
14359    pub const VARIANTS_STR: [&'static str; 6] = [
14360        "Unconditional",
14361        "And",
14362        "Or",
14363        "Not",
14364        "BeforeAbsoluteTime",
14365        "BeforeRelativeTime",
14366    ];
14367
14368    #[must_use]
14369    pub const fn name(&self) -> &'static str {
14370        match self {
14371            Self::Unconditional => "Unconditional",
14372            Self::And => "And",
14373            Self::Or => "Or",
14374            Self::Not => "Not",
14375            Self::BeforeAbsoluteTime => "BeforeAbsoluteTime",
14376            Self::BeforeRelativeTime => "BeforeRelativeTime",
14377        }
14378    }
14379
14380    #[must_use]
14381    pub const fn variants() -> [ClaimPredicateType; 6] {
14382        Self::VARIANTS
14383    }
14384}
14385
14386impl Name for ClaimPredicateType {
14387    #[must_use]
14388    fn name(&self) -> &'static str {
14389        Self::name(self)
14390    }
14391}
14392
14393impl Variants<ClaimPredicateType> for ClaimPredicateType {
14394    fn variants() -> slice::Iter<'static, ClaimPredicateType> {
14395        Self::VARIANTS.iter()
14396    }
14397}
14398
14399impl Enum for ClaimPredicateType {}
14400
14401impl fmt::Display for ClaimPredicateType {
14402    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
14403        f.write_str(self.name())
14404    }
14405}
14406
14407impl TryFrom<i32> for ClaimPredicateType {
14408    type Error = Error;
14409
14410    fn try_from(i: i32) -> Result<Self> {
14411        let e = match i {
14412            0 => ClaimPredicateType::Unconditional,
14413            1 => ClaimPredicateType::And,
14414            2 => ClaimPredicateType::Or,
14415            3 => ClaimPredicateType::Not,
14416            4 => ClaimPredicateType::BeforeAbsoluteTime,
14417            5 => ClaimPredicateType::BeforeRelativeTime,
14418            #[allow(unreachable_patterns)]
14419            _ => return Err(Error::Invalid),
14420        };
14421        Ok(e)
14422    }
14423}
14424
14425impl From<ClaimPredicateType> for i32 {
14426    #[must_use]
14427    fn from(e: ClaimPredicateType) -> Self {
14428        e as Self
14429    }
14430}
14431
14432impl ReadXdr for ClaimPredicateType {
14433    #[cfg(feature = "std")]
14434    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
14435        r.with_limited_depth(|r| {
14436            let e = i32::read_xdr(r)?;
14437            let v: Self = e.try_into()?;
14438            Ok(v)
14439        })
14440    }
14441}
14442
14443impl WriteXdr for ClaimPredicateType {
14444    #[cfg(feature = "std")]
14445    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
14446        w.with_limited_depth(|w| {
14447            let i: i32 = (*self).into();
14448            i.write_xdr(w)
14449        })
14450    }
14451}
14452
14453/// ClaimPredicate is an XDR Union defines as:
14454///
14455/// ```text
14456/// union ClaimPredicate switch (ClaimPredicateType type)
14457/// {
14458/// case CLAIM_PREDICATE_UNCONDITIONAL:
14459///     void;
14460/// case CLAIM_PREDICATE_AND:
14461///     ClaimPredicate andPredicates<2>;
14462/// case CLAIM_PREDICATE_OR:
14463///     ClaimPredicate orPredicates<2>;
14464/// case CLAIM_PREDICATE_NOT:
14465///     ClaimPredicate* notPredicate;
14466/// case CLAIM_PREDICATE_BEFORE_ABSOLUTE_TIME:
14467///     int64 absBefore; // Predicate will be true if closeTime < absBefore
14468/// case CLAIM_PREDICATE_BEFORE_RELATIVE_TIME:
14469///     int64 relBefore; // Seconds since closeTime of the ledger in which the
14470///                      // ClaimableBalanceEntry was created
14471/// };
14472/// ```
14473///
14474// union with discriminant ClaimPredicateType
14475#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
14476#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
14477#[cfg_attr(
14478    all(feature = "serde", feature = "alloc"),
14479    derive(serde::Serialize, serde::Deserialize),
14480    serde(rename_all = "snake_case")
14481)]
14482#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
14483#[allow(clippy::large_enum_variant)]
14484pub enum ClaimPredicate {
14485    Unconditional,
14486    And(VecM<ClaimPredicate, 2>),
14487    Or(VecM<ClaimPredicate, 2>),
14488    Not(Option<Box<ClaimPredicate>>),
14489    BeforeAbsoluteTime(i64),
14490    BeforeRelativeTime(i64),
14491}
14492
14493impl ClaimPredicate {
14494    pub const VARIANTS: [ClaimPredicateType; 6] = [
14495        ClaimPredicateType::Unconditional,
14496        ClaimPredicateType::And,
14497        ClaimPredicateType::Or,
14498        ClaimPredicateType::Not,
14499        ClaimPredicateType::BeforeAbsoluteTime,
14500        ClaimPredicateType::BeforeRelativeTime,
14501    ];
14502    pub const VARIANTS_STR: [&'static str; 6] = [
14503        "Unconditional",
14504        "And",
14505        "Or",
14506        "Not",
14507        "BeforeAbsoluteTime",
14508        "BeforeRelativeTime",
14509    ];
14510
14511    #[must_use]
14512    pub const fn name(&self) -> &'static str {
14513        match self {
14514            Self::Unconditional => "Unconditional",
14515            Self::And(_) => "And",
14516            Self::Or(_) => "Or",
14517            Self::Not(_) => "Not",
14518            Self::BeforeAbsoluteTime(_) => "BeforeAbsoluteTime",
14519            Self::BeforeRelativeTime(_) => "BeforeRelativeTime",
14520        }
14521    }
14522
14523    #[must_use]
14524    pub const fn discriminant(&self) -> ClaimPredicateType {
14525        #[allow(clippy::match_same_arms)]
14526        match self {
14527            Self::Unconditional => ClaimPredicateType::Unconditional,
14528            Self::And(_) => ClaimPredicateType::And,
14529            Self::Or(_) => ClaimPredicateType::Or,
14530            Self::Not(_) => ClaimPredicateType::Not,
14531            Self::BeforeAbsoluteTime(_) => ClaimPredicateType::BeforeAbsoluteTime,
14532            Self::BeforeRelativeTime(_) => ClaimPredicateType::BeforeRelativeTime,
14533        }
14534    }
14535
14536    #[must_use]
14537    pub const fn variants() -> [ClaimPredicateType; 6] {
14538        Self::VARIANTS
14539    }
14540}
14541
14542impl Name for ClaimPredicate {
14543    #[must_use]
14544    fn name(&self) -> &'static str {
14545        Self::name(self)
14546    }
14547}
14548
14549impl Discriminant<ClaimPredicateType> for ClaimPredicate {
14550    #[must_use]
14551    fn discriminant(&self) -> ClaimPredicateType {
14552        Self::discriminant(self)
14553    }
14554}
14555
14556impl Variants<ClaimPredicateType> for ClaimPredicate {
14557    fn variants() -> slice::Iter<'static, ClaimPredicateType> {
14558        Self::VARIANTS.iter()
14559    }
14560}
14561
14562impl Union<ClaimPredicateType> for ClaimPredicate {}
14563
14564impl ReadXdr for ClaimPredicate {
14565    #[cfg(feature = "std")]
14566    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
14567        r.with_limited_depth(|r| {
14568            let dv: ClaimPredicateType = <ClaimPredicateType as ReadXdr>::read_xdr(r)?;
14569            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
14570            let v = match dv {
14571                ClaimPredicateType::Unconditional => Self::Unconditional,
14572                ClaimPredicateType::And => Self::And(VecM::<ClaimPredicate, 2>::read_xdr(r)?),
14573                ClaimPredicateType::Or => Self::Or(VecM::<ClaimPredicate, 2>::read_xdr(r)?),
14574                ClaimPredicateType::Not => Self::Not(Option::<Box<ClaimPredicate>>::read_xdr(r)?),
14575                ClaimPredicateType::BeforeAbsoluteTime => {
14576                    Self::BeforeAbsoluteTime(i64::read_xdr(r)?)
14577                }
14578                ClaimPredicateType::BeforeRelativeTime => {
14579                    Self::BeforeRelativeTime(i64::read_xdr(r)?)
14580                }
14581                #[allow(unreachable_patterns)]
14582                _ => return Err(Error::Invalid),
14583            };
14584            Ok(v)
14585        })
14586    }
14587}
14588
14589impl WriteXdr for ClaimPredicate {
14590    #[cfg(feature = "std")]
14591    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
14592        w.with_limited_depth(|w| {
14593            self.discriminant().write_xdr(w)?;
14594            #[allow(clippy::match_same_arms)]
14595            match self {
14596                Self::Unconditional => ().write_xdr(w)?,
14597                Self::And(v) => v.write_xdr(w)?,
14598                Self::Or(v) => v.write_xdr(w)?,
14599                Self::Not(v) => v.write_xdr(w)?,
14600                Self::BeforeAbsoluteTime(v) => v.write_xdr(w)?,
14601                Self::BeforeRelativeTime(v) => v.write_xdr(w)?,
14602            };
14603            Ok(())
14604        })
14605    }
14606}
14607
14608/// ClaimantType is an XDR Enum defines as:
14609///
14610/// ```text
14611/// enum ClaimantType
14612/// {
14613///     CLAIMANT_TYPE_V0 = 0
14614/// };
14615/// ```
14616///
14617// enum
14618#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
14619#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
14620#[cfg_attr(
14621    all(feature = "serde", feature = "alloc"),
14622    derive(serde::Serialize, serde::Deserialize),
14623    serde(rename_all = "snake_case")
14624)]
14625#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
14626#[repr(i32)]
14627pub enum ClaimantType {
14628    ClaimantTypeV0 = 0,
14629}
14630
14631impl ClaimantType {
14632    pub const VARIANTS: [ClaimantType; 1] = [ClaimantType::ClaimantTypeV0];
14633    pub const VARIANTS_STR: [&'static str; 1] = ["ClaimantTypeV0"];
14634
14635    #[must_use]
14636    pub const fn name(&self) -> &'static str {
14637        match self {
14638            Self::ClaimantTypeV0 => "ClaimantTypeV0",
14639        }
14640    }
14641
14642    #[must_use]
14643    pub const fn variants() -> [ClaimantType; 1] {
14644        Self::VARIANTS
14645    }
14646}
14647
14648impl Name for ClaimantType {
14649    #[must_use]
14650    fn name(&self) -> &'static str {
14651        Self::name(self)
14652    }
14653}
14654
14655impl Variants<ClaimantType> for ClaimantType {
14656    fn variants() -> slice::Iter<'static, ClaimantType> {
14657        Self::VARIANTS.iter()
14658    }
14659}
14660
14661impl Enum for ClaimantType {}
14662
14663impl fmt::Display for ClaimantType {
14664    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
14665        f.write_str(self.name())
14666    }
14667}
14668
14669impl TryFrom<i32> for ClaimantType {
14670    type Error = Error;
14671
14672    fn try_from(i: i32) -> Result<Self> {
14673        let e = match i {
14674            0 => ClaimantType::ClaimantTypeV0,
14675            #[allow(unreachable_patterns)]
14676            _ => return Err(Error::Invalid),
14677        };
14678        Ok(e)
14679    }
14680}
14681
14682impl From<ClaimantType> for i32 {
14683    #[must_use]
14684    fn from(e: ClaimantType) -> Self {
14685        e as Self
14686    }
14687}
14688
14689impl ReadXdr for ClaimantType {
14690    #[cfg(feature = "std")]
14691    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
14692        r.with_limited_depth(|r| {
14693            let e = i32::read_xdr(r)?;
14694            let v: Self = e.try_into()?;
14695            Ok(v)
14696        })
14697    }
14698}
14699
14700impl WriteXdr for ClaimantType {
14701    #[cfg(feature = "std")]
14702    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
14703        w.with_limited_depth(|w| {
14704            let i: i32 = (*self).into();
14705            i.write_xdr(w)
14706        })
14707    }
14708}
14709
14710/// ClaimantV0 is an XDR NestedStruct defines as:
14711///
14712/// ```text
14713/// struct
14714///     {
14715///         AccountID destination;    // The account that can use this condition
14716///         ClaimPredicate predicate; // Claimable if predicate is true
14717///     }
14718/// ```
14719///
14720#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
14721#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
14722#[cfg_attr(
14723    all(feature = "serde", feature = "alloc"),
14724    derive(serde::Serialize, serde::Deserialize),
14725    serde(rename_all = "snake_case")
14726)]
14727#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
14728pub struct ClaimantV0 {
14729    pub destination: AccountId,
14730    pub predicate: ClaimPredicate,
14731}
14732
14733impl ReadXdr for ClaimantV0 {
14734    #[cfg(feature = "std")]
14735    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
14736        r.with_limited_depth(|r| {
14737            Ok(Self {
14738                destination: AccountId::read_xdr(r)?,
14739                predicate: ClaimPredicate::read_xdr(r)?,
14740            })
14741        })
14742    }
14743}
14744
14745impl WriteXdr for ClaimantV0 {
14746    #[cfg(feature = "std")]
14747    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
14748        w.with_limited_depth(|w| {
14749            self.destination.write_xdr(w)?;
14750            self.predicate.write_xdr(w)?;
14751            Ok(())
14752        })
14753    }
14754}
14755
14756/// Claimant is an XDR Union defines as:
14757///
14758/// ```text
14759/// union Claimant switch (ClaimantType type)
14760/// {
14761/// case CLAIMANT_TYPE_V0:
14762///     struct
14763///     {
14764///         AccountID destination;    // The account that can use this condition
14765///         ClaimPredicate predicate; // Claimable if predicate is true
14766///     } v0;
14767/// };
14768/// ```
14769///
14770// union with discriminant ClaimantType
14771#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
14772#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
14773#[cfg_attr(
14774    all(feature = "serde", feature = "alloc"),
14775    derive(serde::Serialize, serde::Deserialize),
14776    serde(rename_all = "snake_case")
14777)]
14778#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
14779#[allow(clippy::large_enum_variant)]
14780pub enum Claimant {
14781    ClaimantTypeV0(ClaimantV0),
14782}
14783
14784impl Claimant {
14785    pub const VARIANTS: [ClaimantType; 1] = [ClaimantType::ClaimantTypeV0];
14786    pub const VARIANTS_STR: [&'static str; 1] = ["ClaimantTypeV0"];
14787
14788    #[must_use]
14789    pub const fn name(&self) -> &'static str {
14790        match self {
14791            Self::ClaimantTypeV0(_) => "ClaimantTypeV0",
14792        }
14793    }
14794
14795    #[must_use]
14796    pub const fn discriminant(&self) -> ClaimantType {
14797        #[allow(clippy::match_same_arms)]
14798        match self {
14799            Self::ClaimantTypeV0(_) => ClaimantType::ClaimantTypeV0,
14800        }
14801    }
14802
14803    #[must_use]
14804    pub const fn variants() -> [ClaimantType; 1] {
14805        Self::VARIANTS
14806    }
14807}
14808
14809impl Name for Claimant {
14810    #[must_use]
14811    fn name(&self) -> &'static str {
14812        Self::name(self)
14813    }
14814}
14815
14816impl Discriminant<ClaimantType> for Claimant {
14817    #[must_use]
14818    fn discriminant(&self) -> ClaimantType {
14819        Self::discriminant(self)
14820    }
14821}
14822
14823impl Variants<ClaimantType> for Claimant {
14824    fn variants() -> slice::Iter<'static, ClaimantType> {
14825        Self::VARIANTS.iter()
14826    }
14827}
14828
14829impl Union<ClaimantType> for Claimant {}
14830
14831impl ReadXdr for Claimant {
14832    #[cfg(feature = "std")]
14833    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
14834        r.with_limited_depth(|r| {
14835            let dv: ClaimantType = <ClaimantType as ReadXdr>::read_xdr(r)?;
14836            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
14837            let v = match dv {
14838                ClaimantType::ClaimantTypeV0 => Self::ClaimantTypeV0(ClaimantV0::read_xdr(r)?),
14839                #[allow(unreachable_patterns)]
14840                _ => return Err(Error::Invalid),
14841            };
14842            Ok(v)
14843        })
14844    }
14845}
14846
14847impl WriteXdr for Claimant {
14848    #[cfg(feature = "std")]
14849    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
14850        w.with_limited_depth(|w| {
14851            self.discriminant().write_xdr(w)?;
14852            #[allow(clippy::match_same_arms)]
14853            match self {
14854                Self::ClaimantTypeV0(v) => v.write_xdr(w)?,
14855            };
14856            Ok(())
14857        })
14858    }
14859}
14860
14861/// ClaimableBalanceIdType is an XDR Enum defines as:
14862///
14863/// ```text
14864/// enum ClaimableBalanceIDType
14865/// {
14866///     CLAIMABLE_BALANCE_ID_TYPE_V0 = 0
14867/// };
14868/// ```
14869///
14870// enum
14871#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
14872#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
14873#[cfg_attr(
14874    all(feature = "serde", feature = "alloc"),
14875    derive(serde::Serialize, serde::Deserialize),
14876    serde(rename_all = "snake_case")
14877)]
14878#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
14879#[repr(i32)]
14880pub enum ClaimableBalanceIdType {
14881    ClaimableBalanceIdTypeV0 = 0,
14882}
14883
14884impl ClaimableBalanceIdType {
14885    pub const VARIANTS: [ClaimableBalanceIdType; 1] =
14886        [ClaimableBalanceIdType::ClaimableBalanceIdTypeV0];
14887    pub const VARIANTS_STR: [&'static str; 1] = ["ClaimableBalanceIdTypeV0"];
14888
14889    #[must_use]
14890    pub const fn name(&self) -> &'static str {
14891        match self {
14892            Self::ClaimableBalanceIdTypeV0 => "ClaimableBalanceIdTypeV0",
14893        }
14894    }
14895
14896    #[must_use]
14897    pub const fn variants() -> [ClaimableBalanceIdType; 1] {
14898        Self::VARIANTS
14899    }
14900}
14901
14902impl Name for ClaimableBalanceIdType {
14903    #[must_use]
14904    fn name(&self) -> &'static str {
14905        Self::name(self)
14906    }
14907}
14908
14909impl Variants<ClaimableBalanceIdType> for ClaimableBalanceIdType {
14910    fn variants() -> slice::Iter<'static, ClaimableBalanceIdType> {
14911        Self::VARIANTS.iter()
14912    }
14913}
14914
14915impl Enum for ClaimableBalanceIdType {}
14916
14917impl fmt::Display for ClaimableBalanceIdType {
14918    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
14919        f.write_str(self.name())
14920    }
14921}
14922
14923impl TryFrom<i32> for ClaimableBalanceIdType {
14924    type Error = Error;
14925
14926    fn try_from(i: i32) -> Result<Self> {
14927        let e = match i {
14928            0 => ClaimableBalanceIdType::ClaimableBalanceIdTypeV0,
14929            #[allow(unreachable_patterns)]
14930            _ => return Err(Error::Invalid),
14931        };
14932        Ok(e)
14933    }
14934}
14935
14936impl From<ClaimableBalanceIdType> for i32 {
14937    #[must_use]
14938    fn from(e: ClaimableBalanceIdType) -> Self {
14939        e as Self
14940    }
14941}
14942
14943impl ReadXdr for ClaimableBalanceIdType {
14944    #[cfg(feature = "std")]
14945    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
14946        r.with_limited_depth(|r| {
14947            let e = i32::read_xdr(r)?;
14948            let v: Self = e.try_into()?;
14949            Ok(v)
14950        })
14951    }
14952}
14953
14954impl WriteXdr for ClaimableBalanceIdType {
14955    #[cfg(feature = "std")]
14956    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
14957        w.with_limited_depth(|w| {
14958            let i: i32 = (*self).into();
14959            i.write_xdr(w)
14960        })
14961    }
14962}
14963
14964/// ClaimableBalanceId is an XDR Union defines as:
14965///
14966/// ```text
14967/// union ClaimableBalanceID switch (ClaimableBalanceIDType type)
14968/// {
14969/// case CLAIMABLE_BALANCE_ID_TYPE_V0:
14970///     Hash v0;
14971/// };
14972/// ```
14973///
14974// union with discriminant ClaimableBalanceIdType
14975#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
14976#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
14977#[cfg_attr(
14978    all(feature = "serde", feature = "alloc"),
14979    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
14980)]
14981#[allow(clippy::large_enum_variant)]
14982pub enum ClaimableBalanceId {
14983    ClaimableBalanceIdTypeV0(Hash),
14984}
14985
14986impl ClaimableBalanceId {
14987    pub const VARIANTS: [ClaimableBalanceIdType; 1] =
14988        [ClaimableBalanceIdType::ClaimableBalanceIdTypeV0];
14989    pub const VARIANTS_STR: [&'static str; 1] = ["ClaimableBalanceIdTypeV0"];
14990
14991    #[must_use]
14992    pub const fn name(&self) -> &'static str {
14993        match self {
14994            Self::ClaimableBalanceIdTypeV0(_) => "ClaimableBalanceIdTypeV0",
14995        }
14996    }
14997
14998    #[must_use]
14999    pub const fn discriminant(&self) -> ClaimableBalanceIdType {
15000        #[allow(clippy::match_same_arms)]
15001        match self {
15002            Self::ClaimableBalanceIdTypeV0(_) => ClaimableBalanceIdType::ClaimableBalanceIdTypeV0,
15003        }
15004    }
15005
15006    #[must_use]
15007    pub const fn variants() -> [ClaimableBalanceIdType; 1] {
15008        Self::VARIANTS
15009    }
15010}
15011
15012impl Name for ClaimableBalanceId {
15013    #[must_use]
15014    fn name(&self) -> &'static str {
15015        Self::name(self)
15016    }
15017}
15018
15019impl Discriminant<ClaimableBalanceIdType> for ClaimableBalanceId {
15020    #[must_use]
15021    fn discriminant(&self) -> ClaimableBalanceIdType {
15022        Self::discriminant(self)
15023    }
15024}
15025
15026impl Variants<ClaimableBalanceIdType> for ClaimableBalanceId {
15027    fn variants() -> slice::Iter<'static, ClaimableBalanceIdType> {
15028        Self::VARIANTS.iter()
15029    }
15030}
15031
15032impl Union<ClaimableBalanceIdType> for ClaimableBalanceId {}
15033
15034impl ReadXdr for ClaimableBalanceId {
15035    #[cfg(feature = "std")]
15036    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
15037        r.with_limited_depth(|r| {
15038            let dv: ClaimableBalanceIdType = <ClaimableBalanceIdType as ReadXdr>::read_xdr(r)?;
15039            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
15040            let v = match dv {
15041                ClaimableBalanceIdType::ClaimableBalanceIdTypeV0 => {
15042                    Self::ClaimableBalanceIdTypeV0(Hash::read_xdr(r)?)
15043                }
15044                #[allow(unreachable_patterns)]
15045                _ => return Err(Error::Invalid),
15046            };
15047            Ok(v)
15048        })
15049    }
15050}
15051
15052impl WriteXdr for ClaimableBalanceId {
15053    #[cfg(feature = "std")]
15054    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
15055        w.with_limited_depth(|w| {
15056            self.discriminant().write_xdr(w)?;
15057            #[allow(clippy::match_same_arms)]
15058            match self {
15059                Self::ClaimableBalanceIdTypeV0(v) => v.write_xdr(w)?,
15060            };
15061            Ok(())
15062        })
15063    }
15064}
15065
15066/// ClaimableBalanceFlags is an XDR Enum defines as:
15067///
15068/// ```text
15069/// enum ClaimableBalanceFlags
15070/// {
15071///     // If set, the issuer account of the asset held by the claimable balance may
15072///     // clawback the claimable balance
15073///     CLAIMABLE_BALANCE_CLAWBACK_ENABLED_FLAG = 0x1
15074/// };
15075/// ```
15076///
15077// enum
15078#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
15079#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
15080#[cfg_attr(
15081    all(feature = "serde", feature = "alloc"),
15082    derive(serde::Serialize, serde::Deserialize),
15083    serde(rename_all = "snake_case")
15084)]
15085#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
15086#[repr(i32)]
15087pub enum ClaimableBalanceFlags {
15088    ClaimableBalanceClawbackEnabledFlag = 1,
15089}
15090
15091impl ClaimableBalanceFlags {
15092    pub const VARIANTS: [ClaimableBalanceFlags; 1] =
15093        [ClaimableBalanceFlags::ClaimableBalanceClawbackEnabledFlag];
15094    pub const VARIANTS_STR: [&'static str; 1] = ["ClaimableBalanceClawbackEnabledFlag"];
15095
15096    #[must_use]
15097    pub const fn name(&self) -> &'static str {
15098        match self {
15099            Self::ClaimableBalanceClawbackEnabledFlag => "ClaimableBalanceClawbackEnabledFlag",
15100        }
15101    }
15102
15103    #[must_use]
15104    pub const fn variants() -> [ClaimableBalanceFlags; 1] {
15105        Self::VARIANTS
15106    }
15107}
15108
15109impl Name for ClaimableBalanceFlags {
15110    #[must_use]
15111    fn name(&self) -> &'static str {
15112        Self::name(self)
15113    }
15114}
15115
15116impl Variants<ClaimableBalanceFlags> for ClaimableBalanceFlags {
15117    fn variants() -> slice::Iter<'static, ClaimableBalanceFlags> {
15118        Self::VARIANTS.iter()
15119    }
15120}
15121
15122impl Enum for ClaimableBalanceFlags {}
15123
15124impl fmt::Display for ClaimableBalanceFlags {
15125    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
15126        f.write_str(self.name())
15127    }
15128}
15129
15130impl TryFrom<i32> for ClaimableBalanceFlags {
15131    type Error = Error;
15132
15133    fn try_from(i: i32) -> Result<Self> {
15134        let e = match i {
15135            1 => ClaimableBalanceFlags::ClaimableBalanceClawbackEnabledFlag,
15136            #[allow(unreachable_patterns)]
15137            _ => return Err(Error::Invalid),
15138        };
15139        Ok(e)
15140    }
15141}
15142
15143impl From<ClaimableBalanceFlags> for i32 {
15144    #[must_use]
15145    fn from(e: ClaimableBalanceFlags) -> Self {
15146        e as Self
15147    }
15148}
15149
15150impl ReadXdr for ClaimableBalanceFlags {
15151    #[cfg(feature = "std")]
15152    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
15153        r.with_limited_depth(|r| {
15154            let e = i32::read_xdr(r)?;
15155            let v: Self = e.try_into()?;
15156            Ok(v)
15157        })
15158    }
15159}
15160
15161impl WriteXdr for ClaimableBalanceFlags {
15162    #[cfg(feature = "std")]
15163    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
15164        w.with_limited_depth(|w| {
15165            let i: i32 = (*self).into();
15166            i.write_xdr(w)
15167        })
15168    }
15169}
15170
15171/// MaskClaimableBalanceFlags is an XDR Const defines as:
15172///
15173/// ```text
15174/// const MASK_CLAIMABLE_BALANCE_FLAGS = 0x1;
15175/// ```
15176///
15177pub const MASK_CLAIMABLE_BALANCE_FLAGS: u64 = 0x1;
15178
15179/// ClaimableBalanceEntryExtensionV1Ext is an XDR NestedUnion defines as:
15180///
15181/// ```text
15182/// union switch (int v)
15183///     {
15184///     case 0:
15185///         void;
15186///     }
15187/// ```
15188///
15189// union with discriminant i32
15190#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
15191#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
15192#[cfg_attr(
15193    all(feature = "serde", feature = "alloc"),
15194    derive(serde::Serialize, serde::Deserialize),
15195    serde(rename_all = "snake_case")
15196)]
15197#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
15198#[allow(clippy::large_enum_variant)]
15199pub enum ClaimableBalanceEntryExtensionV1Ext {
15200    V0,
15201}
15202
15203impl ClaimableBalanceEntryExtensionV1Ext {
15204    pub const VARIANTS: [i32; 1] = [0];
15205    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
15206
15207    #[must_use]
15208    pub const fn name(&self) -> &'static str {
15209        match self {
15210            Self::V0 => "V0",
15211        }
15212    }
15213
15214    #[must_use]
15215    pub const fn discriminant(&self) -> i32 {
15216        #[allow(clippy::match_same_arms)]
15217        match self {
15218            Self::V0 => 0,
15219        }
15220    }
15221
15222    #[must_use]
15223    pub const fn variants() -> [i32; 1] {
15224        Self::VARIANTS
15225    }
15226}
15227
15228impl Name for ClaimableBalanceEntryExtensionV1Ext {
15229    #[must_use]
15230    fn name(&self) -> &'static str {
15231        Self::name(self)
15232    }
15233}
15234
15235impl Discriminant<i32> for ClaimableBalanceEntryExtensionV1Ext {
15236    #[must_use]
15237    fn discriminant(&self) -> i32 {
15238        Self::discriminant(self)
15239    }
15240}
15241
15242impl Variants<i32> for ClaimableBalanceEntryExtensionV1Ext {
15243    fn variants() -> slice::Iter<'static, i32> {
15244        Self::VARIANTS.iter()
15245    }
15246}
15247
15248impl Union<i32> for ClaimableBalanceEntryExtensionV1Ext {}
15249
15250impl ReadXdr for ClaimableBalanceEntryExtensionV1Ext {
15251    #[cfg(feature = "std")]
15252    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
15253        r.with_limited_depth(|r| {
15254            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
15255            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
15256            let v = match dv {
15257                0 => Self::V0,
15258                #[allow(unreachable_patterns)]
15259                _ => return Err(Error::Invalid),
15260            };
15261            Ok(v)
15262        })
15263    }
15264}
15265
15266impl WriteXdr for ClaimableBalanceEntryExtensionV1Ext {
15267    #[cfg(feature = "std")]
15268    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
15269        w.with_limited_depth(|w| {
15270            self.discriminant().write_xdr(w)?;
15271            #[allow(clippy::match_same_arms)]
15272            match self {
15273                Self::V0 => ().write_xdr(w)?,
15274            };
15275            Ok(())
15276        })
15277    }
15278}
15279
15280/// ClaimableBalanceEntryExtensionV1 is an XDR Struct defines as:
15281///
15282/// ```text
15283/// struct ClaimableBalanceEntryExtensionV1
15284/// {
15285///     union switch (int v)
15286///     {
15287///     case 0:
15288///         void;
15289///     }
15290///     ext;
15291///
15292///     uint32 flags; // see ClaimableBalanceFlags
15293/// };
15294/// ```
15295///
15296#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
15297#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
15298#[cfg_attr(
15299    all(feature = "serde", feature = "alloc"),
15300    derive(serde::Serialize, serde::Deserialize),
15301    serde(rename_all = "snake_case")
15302)]
15303#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
15304pub struct ClaimableBalanceEntryExtensionV1 {
15305    pub ext: ClaimableBalanceEntryExtensionV1Ext,
15306    pub flags: u32,
15307}
15308
15309impl ReadXdr for ClaimableBalanceEntryExtensionV1 {
15310    #[cfg(feature = "std")]
15311    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
15312        r.with_limited_depth(|r| {
15313            Ok(Self {
15314                ext: ClaimableBalanceEntryExtensionV1Ext::read_xdr(r)?,
15315                flags: u32::read_xdr(r)?,
15316            })
15317        })
15318    }
15319}
15320
15321impl WriteXdr for ClaimableBalanceEntryExtensionV1 {
15322    #[cfg(feature = "std")]
15323    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
15324        w.with_limited_depth(|w| {
15325            self.ext.write_xdr(w)?;
15326            self.flags.write_xdr(w)?;
15327            Ok(())
15328        })
15329    }
15330}
15331
15332/// ClaimableBalanceEntryExt is an XDR NestedUnion defines as:
15333///
15334/// ```text
15335/// union switch (int v)
15336///     {
15337///     case 0:
15338///         void;
15339///     case 1:
15340///         ClaimableBalanceEntryExtensionV1 v1;
15341///     }
15342/// ```
15343///
15344// union with discriminant i32
15345#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
15346#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
15347#[cfg_attr(
15348    all(feature = "serde", feature = "alloc"),
15349    derive(serde::Serialize, serde::Deserialize),
15350    serde(rename_all = "snake_case")
15351)]
15352#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
15353#[allow(clippy::large_enum_variant)]
15354pub enum ClaimableBalanceEntryExt {
15355    V0,
15356    V1(ClaimableBalanceEntryExtensionV1),
15357}
15358
15359impl ClaimableBalanceEntryExt {
15360    pub const VARIANTS: [i32; 2] = [0, 1];
15361    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"];
15362
15363    #[must_use]
15364    pub const fn name(&self) -> &'static str {
15365        match self {
15366            Self::V0 => "V0",
15367            Self::V1(_) => "V1",
15368        }
15369    }
15370
15371    #[must_use]
15372    pub const fn discriminant(&self) -> i32 {
15373        #[allow(clippy::match_same_arms)]
15374        match self {
15375            Self::V0 => 0,
15376            Self::V1(_) => 1,
15377        }
15378    }
15379
15380    #[must_use]
15381    pub const fn variants() -> [i32; 2] {
15382        Self::VARIANTS
15383    }
15384}
15385
15386impl Name for ClaimableBalanceEntryExt {
15387    #[must_use]
15388    fn name(&self) -> &'static str {
15389        Self::name(self)
15390    }
15391}
15392
15393impl Discriminant<i32> for ClaimableBalanceEntryExt {
15394    #[must_use]
15395    fn discriminant(&self) -> i32 {
15396        Self::discriminant(self)
15397    }
15398}
15399
15400impl Variants<i32> for ClaimableBalanceEntryExt {
15401    fn variants() -> slice::Iter<'static, i32> {
15402        Self::VARIANTS.iter()
15403    }
15404}
15405
15406impl Union<i32> for ClaimableBalanceEntryExt {}
15407
15408impl ReadXdr for ClaimableBalanceEntryExt {
15409    #[cfg(feature = "std")]
15410    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
15411        r.with_limited_depth(|r| {
15412            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
15413            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
15414            let v = match dv {
15415                0 => Self::V0,
15416                1 => Self::V1(ClaimableBalanceEntryExtensionV1::read_xdr(r)?),
15417                #[allow(unreachable_patterns)]
15418                _ => return Err(Error::Invalid),
15419            };
15420            Ok(v)
15421        })
15422    }
15423}
15424
15425impl WriteXdr for ClaimableBalanceEntryExt {
15426    #[cfg(feature = "std")]
15427    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
15428        w.with_limited_depth(|w| {
15429            self.discriminant().write_xdr(w)?;
15430            #[allow(clippy::match_same_arms)]
15431            match self {
15432                Self::V0 => ().write_xdr(w)?,
15433                Self::V1(v) => v.write_xdr(w)?,
15434            };
15435            Ok(())
15436        })
15437    }
15438}
15439
15440/// ClaimableBalanceEntry is an XDR Struct defines as:
15441///
15442/// ```text
15443/// struct ClaimableBalanceEntry
15444/// {
15445///     // Unique identifier for this ClaimableBalanceEntry
15446///     ClaimableBalanceID balanceID;
15447///
15448///     // List of claimants with associated predicate
15449///     Claimant claimants<10>;
15450///
15451///     // Any asset including native
15452///     Asset asset;
15453///
15454///     // Amount of asset
15455///     int64 amount;
15456///
15457///     // reserved for future use
15458///     union switch (int v)
15459///     {
15460///     case 0:
15461///         void;
15462///     case 1:
15463///         ClaimableBalanceEntryExtensionV1 v1;
15464///     }
15465///     ext;
15466/// };
15467/// ```
15468///
15469#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
15470#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
15471#[cfg_attr(
15472    all(feature = "serde", feature = "alloc"),
15473    derive(serde::Serialize, serde::Deserialize),
15474    serde(rename_all = "snake_case")
15475)]
15476#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
15477pub struct ClaimableBalanceEntry {
15478    pub balance_id: ClaimableBalanceId,
15479    pub claimants: VecM<Claimant, 10>,
15480    pub asset: Asset,
15481    pub amount: i64,
15482    pub ext: ClaimableBalanceEntryExt,
15483}
15484
15485impl ReadXdr for ClaimableBalanceEntry {
15486    #[cfg(feature = "std")]
15487    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
15488        r.with_limited_depth(|r| {
15489            Ok(Self {
15490                balance_id: ClaimableBalanceId::read_xdr(r)?,
15491                claimants: VecM::<Claimant, 10>::read_xdr(r)?,
15492                asset: Asset::read_xdr(r)?,
15493                amount: i64::read_xdr(r)?,
15494                ext: ClaimableBalanceEntryExt::read_xdr(r)?,
15495            })
15496        })
15497    }
15498}
15499
15500impl WriteXdr for ClaimableBalanceEntry {
15501    #[cfg(feature = "std")]
15502    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
15503        w.with_limited_depth(|w| {
15504            self.balance_id.write_xdr(w)?;
15505            self.claimants.write_xdr(w)?;
15506            self.asset.write_xdr(w)?;
15507            self.amount.write_xdr(w)?;
15508            self.ext.write_xdr(w)?;
15509            Ok(())
15510        })
15511    }
15512}
15513
15514/// LiquidityPoolConstantProductParameters is an XDR Struct defines as:
15515///
15516/// ```text
15517/// struct LiquidityPoolConstantProductParameters
15518/// {
15519///     Asset assetA; // assetA < assetB
15520///     Asset assetB;
15521///     int32 fee; // Fee is in basis points, so the actual rate is (fee/100)%
15522/// };
15523/// ```
15524///
15525#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
15526#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
15527#[cfg_attr(
15528    all(feature = "serde", feature = "alloc"),
15529    derive(serde::Serialize, serde::Deserialize),
15530    serde(rename_all = "snake_case")
15531)]
15532#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
15533pub struct LiquidityPoolConstantProductParameters {
15534    pub asset_a: Asset,
15535    pub asset_b: Asset,
15536    pub fee: i32,
15537}
15538
15539impl ReadXdr for LiquidityPoolConstantProductParameters {
15540    #[cfg(feature = "std")]
15541    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
15542        r.with_limited_depth(|r| {
15543            Ok(Self {
15544                asset_a: Asset::read_xdr(r)?,
15545                asset_b: Asset::read_xdr(r)?,
15546                fee: i32::read_xdr(r)?,
15547            })
15548        })
15549    }
15550}
15551
15552impl WriteXdr for LiquidityPoolConstantProductParameters {
15553    #[cfg(feature = "std")]
15554    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
15555        w.with_limited_depth(|w| {
15556            self.asset_a.write_xdr(w)?;
15557            self.asset_b.write_xdr(w)?;
15558            self.fee.write_xdr(w)?;
15559            Ok(())
15560        })
15561    }
15562}
15563
15564/// LiquidityPoolEntryConstantProduct is an XDR NestedStruct defines as:
15565///
15566/// ```text
15567/// struct
15568///         {
15569///             LiquidityPoolConstantProductParameters params;
15570///
15571///             int64 reserveA;        // amount of A in the pool
15572///             int64 reserveB;        // amount of B in the pool
15573///             int64 totalPoolShares; // total number of pool shares issued
15574///             int64 poolSharesTrustLineCount; // number of trust lines for the
15575///                                             // associated pool shares
15576///         }
15577/// ```
15578///
15579#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
15580#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
15581#[cfg_attr(
15582    all(feature = "serde", feature = "alloc"),
15583    derive(serde::Serialize, serde::Deserialize),
15584    serde(rename_all = "snake_case")
15585)]
15586#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
15587pub struct LiquidityPoolEntryConstantProduct {
15588    pub params: LiquidityPoolConstantProductParameters,
15589    pub reserve_a: i64,
15590    pub reserve_b: i64,
15591    pub total_pool_shares: i64,
15592    pub pool_shares_trust_line_count: i64,
15593}
15594
15595impl ReadXdr for LiquidityPoolEntryConstantProduct {
15596    #[cfg(feature = "std")]
15597    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
15598        r.with_limited_depth(|r| {
15599            Ok(Self {
15600                params: LiquidityPoolConstantProductParameters::read_xdr(r)?,
15601                reserve_a: i64::read_xdr(r)?,
15602                reserve_b: i64::read_xdr(r)?,
15603                total_pool_shares: i64::read_xdr(r)?,
15604                pool_shares_trust_line_count: i64::read_xdr(r)?,
15605            })
15606        })
15607    }
15608}
15609
15610impl WriteXdr for LiquidityPoolEntryConstantProduct {
15611    #[cfg(feature = "std")]
15612    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
15613        w.with_limited_depth(|w| {
15614            self.params.write_xdr(w)?;
15615            self.reserve_a.write_xdr(w)?;
15616            self.reserve_b.write_xdr(w)?;
15617            self.total_pool_shares.write_xdr(w)?;
15618            self.pool_shares_trust_line_count.write_xdr(w)?;
15619            Ok(())
15620        })
15621    }
15622}
15623
15624/// LiquidityPoolEntryBody is an XDR NestedUnion defines as:
15625///
15626/// ```text
15627/// union switch (LiquidityPoolType type)
15628///     {
15629///     case LIQUIDITY_POOL_CONSTANT_PRODUCT:
15630///         struct
15631///         {
15632///             LiquidityPoolConstantProductParameters params;
15633///
15634///             int64 reserveA;        // amount of A in the pool
15635///             int64 reserveB;        // amount of B in the pool
15636///             int64 totalPoolShares; // total number of pool shares issued
15637///             int64 poolSharesTrustLineCount; // number of trust lines for the
15638///                                             // associated pool shares
15639///         } constantProduct;
15640///     }
15641/// ```
15642///
15643// union with discriminant LiquidityPoolType
15644#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
15645#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
15646#[cfg_attr(
15647    all(feature = "serde", feature = "alloc"),
15648    derive(serde::Serialize, serde::Deserialize),
15649    serde(rename_all = "snake_case")
15650)]
15651#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
15652#[allow(clippy::large_enum_variant)]
15653pub enum LiquidityPoolEntryBody {
15654    LiquidityPoolConstantProduct(LiquidityPoolEntryConstantProduct),
15655}
15656
15657impl LiquidityPoolEntryBody {
15658    pub const VARIANTS: [LiquidityPoolType; 1] = [LiquidityPoolType::LiquidityPoolConstantProduct];
15659    pub const VARIANTS_STR: [&'static str; 1] = ["LiquidityPoolConstantProduct"];
15660
15661    #[must_use]
15662    pub const fn name(&self) -> &'static str {
15663        match self {
15664            Self::LiquidityPoolConstantProduct(_) => "LiquidityPoolConstantProduct",
15665        }
15666    }
15667
15668    #[must_use]
15669    pub const fn discriminant(&self) -> LiquidityPoolType {
15670        #[allow(clippy::match_same_arms)]
15671        match self {
15672            Self::LiquidityPoolConstantProduct(_) => {
15673                LiquidityPoolType::LiquidityPoolConstantProduct
15674            }
15675        }
15676    }
15677
15678    #[must_use]
15679    pub const fn variants() -> [LiquidityPoolType; 1] {
15680        Self::VARIANTS
15681    }
15682}
15683
15684impl Name for LiquidityPoolEntryBody {
15685    #[must_use]
15686    fn name(&self) -> &'static str {
15687        Self::name(self)
15688    }
15689}
15690
15691impl Discriminant<LiquidityPoolType> for LiquidityPoolEntryBody {
15692    #[must_use]
15693    fn discriminant(&self) -> LiquidityPoolType {
15694        Self::discriminant(self)
15695    }
15696}
15697
15698impl Variants<LiquidityPoolType> for LiquidityPoolEntryBody {
15699    fn variants() -> slice::Iter<'static, LiquidityPoolType> {
15700        Self::VARIANTS.iter()
15701    }
15702}
15703
15704impl Union<LiquidityPoolType> for LiquidityPoolEntryBody {}
15705
15706impl ReadXdr for LiquidityPoolEntryBody {
15707    #[cfg(feature = "std")]
15708    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
15709        r.with_limited_depth(|r| {
15710            let dv: LiquidityPoolType = <LiquidityPoolType as ReadXdr>::read_xdr(r)?;
15711            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
15712            let v = match dv {
15713                LiquidityPoolType::LiquidityPoolConstantProduct => {
15714                    Self::LiquidityPoolConstantProduct(LiquidityPoolEntryConstantProduct::read_xdr(
15715                        r,
15716                    )?)
15717                }
15718                #[allow(unreachable_patterns)]
15719                _ => return Err(Error::Invalid),
15720            };
15721            Ok(v)
15722        })
15723    }
15724}
15725
15726impl WriteXdr for LiquidityPoolEntryBody {
15727    #[cfg(feature = "std")]
15728    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
15729        w.with_limited_depth(|w| {
15730            self.discriminant().write_xdr(w)?;
15731            #[allow(clippy::match_same_arms)]
15732            match self {
15733                Self::LiquidityPoolConstantProduct(v) => v.write_xdr(w)?,
15734            };
15735            Ok(())
15736        })
15737    }
15738}
15739
15740/// LiquidityPoolEntry is an XDR Struct defines as:
15741///
15742/// ```text
15743/// struct LiquidityPoolEntry
15744/// {
15745///     PoolID liquidityPoolID;
15746///
15747///     union switch (LiquidityPoolType type)
15748///     {
15749///     case LIQUIDITY_POOL_CONSTANT_PRODUCT:
15750///         struct
15751///         {
15752///             LiquidityPoolConstantProductParameters params;
15753///
15754///             int64 reserveA;        // amount of A in the pool
15755///             int64 reserveB;        // amount of B in the pool
15756///             int64 totalPoolShares; // total number of pool shares issued
15757///             int64 poolSharesTrustLineCount; // number of trust lines for the
15758///                                             // associated pool shares
15759///         } constantProduct;
15760///     }
15761///     body;
15762/// };
15763/// ```
15764///
15765#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
15766#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
15767#[cfg_attr(
15768    all(feature = "serde", feature = "alloc"),
15769    derive(serde::Serialize, serde::Deserialize),
15770    serde(rename_all = "snake_case")
15771)]
15772#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
15773pub struct LiquidityPoolEntry {
15774    pub liquidity_pool_id: PoolId,
15775    pub body: LiquidityPoolEntryBody,
15776}
15777
15778impl ReadXdr for LiquidityPoolEntry {
15779    #[cfg(feature = "std")]
15780    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
15781        r.with_limited_depth(|r| {
15782            Ok(Self {
15783                liquidity_pool_id: PoolId::read_xdr(r)?,
15784                body: LiquidityPoolEntryBody::read_xdr(r)?,
15785            })
15786        })
15787    }
15788}
15789
15790impl WriteXdr for LiquidityPoolEntry {
15791    #[cfg(feature = "std")]
15792    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
15793        w.with_limited_depth(|w| {
15794            self.liquidity_pool_id.write_xdr(w)?;
15795            self.body.write_xdr(w)?;
15796            Ok(())
15797        })
15798    }
15799}
15800
15801/// ContractDataDurability is an XDR Enum defines as:
15802///
15803/// ```text
15804/// enum ContractDataDurability {
15805///     TEMPORARY = 0,
15806///     PERSISTENT = 1
15807/// };
15808/// ```
15809///
15810// enum
15811#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
15812#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
15813#[cfg_attr(
15814    all(feature = "serde", feature = "alloc"),
15815    derive(serde::Serialize, serde::Deserialize),
15816    serde(rename_all = "snake_case")
15817)]
15818#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
15819#[repr(i32)]
15820pub enum ContractDataDurability {
15821    Temporary = 0,
15822    Persistent = 1,
15823}
15824
15825impl ContractDataDurability {
15826    pub const VARIANTS: [ContractDataDurability; 2] = [
15827        ContractDataDurability::Temporary,
15828        ContractDataDurability::Persistent,
15829    ];
15830    pub const VARIANTS_STR: [&'static str; 2] = ["Temporary", "Persistent"];
15831
15832    #[must_use]
15833    pub const fn name(&self) -> &'static str {
15834        match self {
15835            Self::Temporary => "Temporary",
15836            Self::Persistent => "Persistent",
15837        }
15838    }
15839
15840    #[must_use]
15841    pub const fn variants() -> [ContractDataDurability; 2] {
15842        Self::VARIANTS
15843    }
15844}
15845
15846impl Name for ContractDataDurability {
15847    #[must_use]
15848    fn name(&self) -> &'static str {
15849        Self::name(self)
15850    }
15851}
15852
15853impl Variants<ContractDataDurability> for ContractDataDurability {
15854    fn variants() -> slice::Iter<'static, ContractDataDurability> {
15855        Self::VARIANTS.iter()
15856    }
15857}
15858
15859impl Enum for ContractDataDurability {}
15860
15861impl fmt::Display for ContractDataDurability {
15862    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
15863        f.write_str(self.name())
15864    }
15865}
15866
15867impl TryFrom<i32> for ContractDataDurability {
15868    type Error = Error;
15869
15870    fn try_from(i: i32) -> Result<Self> {
15871        let e = match i {
15872            0 => ContractDataDurability::Temporary,
15873            1 => ContractDataDurability::Persistent,
15874            #[allow(unreachable_patterns)]
15875            _ => return Err(Error::Invalid),
15876        };
15877        Ok(e)
15878    }
15879}
15880
15881impl From<ContractDataDurability> for i32 {
15882    #[must_use]
15883    fn from(e: ContractDataDurability) -> Self {
15884        e as Self
15885    }
15886}
15887
15888impl ReadXdr for ContractDataDurability {
15889    #[cfg(feature = "std")]
15890    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
15891        r.with_limited_depth(|r| {
15892            let e = i32::read_xdr(r)?;
15893            let v: Self = e.try_into()?;
15894            Ok(v)
15895        })
15896    }
15897}
15898
15899impl WriteXdr for ContractDataDurability {
15900    #[cfg(feature = "std")]
15901    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
15902        w.with_limited_depth(|w| {
15903            let i: i32 = (*self).into();
15904            i.write_xdr(w)
15905        })
15906    }
15907}
15908
15909/// ContractDataEntry is an XDR Struct defines as:
15910///
15911/// ```text
15912/// struct ContractDataEntry {
15913///     ExtensionPoint ext;
15914///
15915///     SCAddress contract;
15916///     SCVal key;
15917///     ContractDataDurability durability;
15918///     SCVal val;
15919/// };
15920/// ```
15921///
15922#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
15923#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
15924#[cfg_attr(
15925    all(feature = "serde", feature = "alloc"),
15926    derive(serde::Serialize, serde::Deserialize),
15927    serde(rename_all = "snake_case")
15928)]
15929#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
15930pub struct ContractDataEntry {
15931    pub ext: ExtensionPoint,
15932    pub contract: ScAddress,
15933    pub key: ScVal,
15934    pub durability: ContractDataDurability,
15935    pub val: ScVal,
15936}
15937
15938impl ReadXdr for ContractDataEntry {
15939    #[cfg(feature = "std")]
15940    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
15941        r.with_limited_depth(|r| {
15942            Ok(Self {
15943                ext: ExtensionPoint::read_xdr(r)?,
15944                contract: ScAddress::read_xdr(r)?,
15945                key: ScVal::read_xdr(r)?,
15946                durability: ContractDataDurability::read_xdr(r)?,
15947                val: ScVal::read_xdr(r)?,
15948            })
15949        })
15950    }
15951}
15952
15953impl WriteXdr for ContractDataEntry {
15954    #[cfg(feature = "std")]
15955    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
15956        w.with_limited_depth(|w| {
15957            self.ext.write_xdr(w)?;
15958            self.contract.write_xdr(w)?;
15959            self.key.write_xdr(w)?;
15960            self.durability.write_xdr(w)?;
15961            self.val.write_xdr(w)?;
15962            Ok(())
15963        })
15964    }
15965}
15966
15967/// ContractCodeCostInputs is an XDR Struct defines as:
15968///
15969/// ```text
15970/// struct ContractCodeCostInputs {
15971///     ExtensionPoint ext;
15972///     uint32 nInstructions;
15973///     uint32 nFunctions;
15974///     uint32 nGlobals;
15975///     uint32 nTableEntries;
15976///     uint32 nTypes;
15977///     uint32 nDataSegments;
15978///     uint32 nElemSegments;
15979///     uint32 nImports;
15980///     uint32 nExports;
15981///     uint32 nDataSegmentBytes;
15982/// };
15983/// ```
15984///
15985#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
15986#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
15987#[cfg_attr(
15988    all(feature = "serde", feature = "alloc"),
15989    derive(serde::Serialize, serde::Deserialize),
15990    serde(rename_all = "snake_case")
15991)]
15992#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
15993pub struct ContractCodeCostInputs {
15994    pub ext: ExtensionPoint,
15995    pub n_instructions: u32,
15996    pub n_functions: u32,
15997    pub n_globals: u32,
15998    pub n_table_entries: u32,
15999    pub n_types: u32,
16000    pub n_data_segments: u32,
16001    pub n_elem_segments: u32,
16002    pub n_imports: u32,
16003    pub n_exports: u32,
16004    pub n_data_segment_bytes: u32,
16005}
16006
16007impl ReadXdr for ContractCodeCostInputs {
16008    #[cfg(feature = "std")]
16009    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
16010        r.with_limited_depth(|r| {
16011            Ok(Self {
16012                ext: ExtensionPoint::read_xdr(r)?,
16013                n_instructions: u32::read_xdr(r)?,
16014                n_functions: u32::read_xdr(r)?,
16015                n_globals: u32::read_xdr(r)?,
16016                n_table_entries: u32::read_xdr(r)?,
16017                n_types: u32::read_xdr(r)?,
16018                n_data_segments: u32::read_xdr(r)?,
16019                n_elem_segments: u32::read_xdr(r)?,
16020                n_imports: u32::read_xdr(r)?,
16021                n_exports: u32::read_xdr(r)?,
16022                n_data_segment_bytes: u32::read_xdr(r)?,
16023            })
16024        })
16025    }
16026}
16027
16028impl WriteXdr for ContractCodeCostInputs {
16029    #[cfg(feature = "std")]
16030    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
16031        w.with_limited_depth(|w| {
16032            self.ext.write_xdr(w)?;
16033            self.n_instructions.write_xdr(w)?;
16034            self.n_functions.write_xdr(w)?;
16035            self.n_globals.write_xdr(w)?;
16036            self.n_table_entries.write_xdr(w)?;
16037            self.n_types.write_xdr(w)?;
16038            self.n_data_segments.write_xdr(w)?;
16039            self.n_elem_segments.write_xdr(w)?;
16040            self.n_imports.write_xdr(w)?;
16041            self.n_exports.write_xdr(w)?;
16042            self.n_data_segment_bytes.write_xdr(w)?;
16043            Ok(())
16044        })
16045    }
16046}
16047
16048/// ContractCodeEntryV1 is an XDR NestedStruct defines as:
16049///
16050/// ```text
16051/// struct
16052///             {
16053///                 ExtensionPoint ext;
16054///                 ContractCodeCostInputs costInputs;
16055///             }
16056/// ```
16057///
16058#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
16059#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
16060#[cfg_attr(
16061    all(feature = "serde", feature = "alloc"),
16062    derive(serde::Serialize, serde::Deserialize),
16063    serde(rename_all = "snake_case")
16064)]
16065#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
16066pub struct ContractCodeEntryV1 {
16067    pub ext: ExtensionPoint,
16068    pub cost_inputs: ContractCodeCostInputs,
16069}
16070
16071impl ReadXdr for ContractCodeEntryV1 {
16072    #[cfg(feature = "std")]
16073    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
16074        r.with_limited_depth(|r| {
16075            Ok(Self {
16076                ext: ExtensionPoint::read_xdr(r)?,
16077                cost_inputs: ContractCodeCostInputs::read_xdr(r)?,
16078            })
16079        })
16080    }
16081}
16082
16083impl WriteXdr for ContractCodeEntryV1 {
16084    #[cfg(feature = "std")]
16085    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
16086        w.with_limited_depth(|w| {
16087            self.ext.write_xdr(w)?;
16088            self.cost_inputs.write_xdr(w)?;
16089            Ok(())
16090        })
16091    }
16092}
16093
16094/// ContractCodeEntryExt is an XDR NestedUnion defines as:
16095///
16096/// ```text
16097/// union switch (int v)
16098///     {
16099///         case 0:
16100///             void;
16101///         case 1:
16102///             struct
16103///             {
16104///                 ExtensionPoint ext;
16105///                 ContractCodeCostInputs costInputs;
16106///             } v1;
16107///     }
16108/// ```
16109///
16110// union with discriminant i32
16111#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
16112#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
16113#[cfg_attr(
16114    all(feature = "serde", feature = "alloc"),
16115    derive(serde::Serialize, serde::Deserialize),
16116    serde(rename_all = "snake_case")
16117)]
16118#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
16119#[allow(clippy::large_enum_variant)]
16120pub enum ContractCodeEntryExt {
16121    V0,
16122    V1(ContractCodeEntryV1),
16123}
16124
16125impl ContractCodeEntryExt {
16126    pub const VARIANTS: [i32; 2] = [0, 1];
16127    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"];
16128
16129    #[must_use]
16130    pub const fn name(&self) -> &'static str {
16131        match self {
16132            Self::V0 => "V0",
16133            Self::V1(_) => "V1",
16134        }
16135    }
16136
16137    #[must_use]
16138    pub const fn discriminant(&self) -> i32 {
16139        #[allow(clippy::match_same_arms)]
16140        match self {
16141            Self::V0 => 0,
16142            Self::V1(_) => 1,
16143        }
16144    }
16145
16146    #[must_use]
16147    pub const fn variants() -> [i32; 2] {
16148        Self::VARIANTS
16149    }
16150}
16151
16152impl Name for ContractCodeEntryExt {
16153    #[must_use]
16154    fn name(&self) -> &'static str {
16155        Self::name(self)
16156    }
16157}
16158
16159impl Discriminant<i32> for ContractCodeEntryExt {
16160    #[must_use]
16161    fn discriminant(&self) -> i32 {
16162        Self::discriminant(self)
16163    }
16164}
16165
16166impl Variants<i32> for ContractCodeEntryExt {
16167    fn variants() -> slice::Iter<'static, i32> {
16168        Self::VARIANTS.iter()
16169    }
16170}
16171
16172impl Union<i32> for ContractCodeEntryExt {}
16173
16174impl ReadXdr for ContractCodeEntryExt {
16175    #[cfg(feature = "std")]
16176    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
16177        r.with_limited_depth(|r| {
16178            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
16179            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
16180            let v = match dv {
16181                0 => Self::V0,
16182                1 => Self::V1(ContractCodeEntryV1::read_xdr(r)?),
16183                #[allow(unreachable_patterns)]
16184                _ => return Err(Error::Invalid),
16185            };
16186            Ok(v)
16187        })
16188    }
16189}
16190
16191impl WriteXdr for ContractCodeEntryExt {
16192    #[cfg(feature = "std")]
16193    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
16194        w.with_limited_depth(|w| {
16195            self.discriminant().write_xdr(w)?;
16196            #[allow(clippy::match_same_arms)]
16197            match self {
16198                Self::V0 => ().write_xdr(w)?,
16199                Self::V1(v) => v.write_xdr(w)?,
16200            };
16201            Ok(())
16202        })
16203    }
16204}
16205
16206/// ContractCodeEntry is an XDR Struct defines as:
16207///
16208/// ```text
16209/// struct ContractCodeEntry {
16210///     union switch (int v)
16211///     {
16212///         case 0:
16213///             void;
16214///         case 1:
16215///             struct
16216///             {
16217///                 ExtensionPoint ext;
16218///                 ContractCodeCostInputs costInputs;
16219///             } v1;
16220///     } ext;
16221///
16222///     Hash hash;
16223///     opaque code<>;
16224/// };
16225/// ```
16226///
16227#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
16228#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
16229#[cfg_attr(
16230    all(feature = "serde", feature = "alloc"),
16231    derive(serde::Serialize, serde::Deserialize),
16232    serde(rename_all = "snake_case")
16233)]
16234#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
16235pub struct ContractCodeEntry {
16236    pub ext: ContractCodeEntryExt,
16237    pub hash: Hash,
16238    pub code: BytesM,
16239}
16240
16241impl ReadXdr for ContractCodeEntry {
16242    #[cfg(feature = "std")]
16243    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
16244        r.with_limited_depth(|r| {
16245            Ok(Self {
16246                ext: ContractCodeEntryExt::read_xdr(r)?,
16247                hash: Hash::read_xdr(r)?,
16248                code: BytesM::read_xdr(r)?,
16249            })
16250        })
16251    }
16252}
16253
16254impl WriteXdr for ContractCodeEntry {
16255    #[cfg(feature = "std")]
16256    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
16257        w.with_limited_depth(|w| {
16258            self.ext.write_xdr(w)?;
16259            self.hash.write_xdr(w)?;
16260            self.code.write_xdr(w)?;
16261            Ok(())
16262        })
16263    }
16264}
16265
16266/// TtlEntry is an XDR Struct defines as:
16267///
16268/// ```text
16269/// struct TTLEntry {
16270///     // Hash of the LedgerKey that is associated with this TTLEntry
16271///     Hash keyHash;
16272///     uint32 liveUntilLedgerSeq;
16273/// };
16274/// ```
16275///
16276#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
16277#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
16278#[cfg_attr(
16279    all(feature = "serde", feature = "alloc"),
16280    derive(serde::Serialize, serde::Deserialize),
16281    serde(rename_all = "snake_case")
16282)]
16283#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
16284pub struct TtlEntry {
16285    pub key_hash: Hash,
16286    pub live_until_ledger_seq: u32,
16287}
16288
16289impl ReadXdr for TtlEntry {
16290    #[cfg(feature = "std")]
16291    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
16292        r.with_limited_depth(|r| {
16293            Ok(Self {
16294                key_hash: Hash::read_xdr(r)?,
16295                live_until_ledger_seq: u32::read_xdr(r)?,
16296            })
16297        })
16298    }
16299}
16300
16301impl WriteXdr for TtlEntry {
16302    #[cfg(feature = "std")]
16303    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
16304        w.with_limited_depth(|w| {
16305            self.key_hash.write_xdr(w)?;
16306            self.live_until_ledger_seq.write_xdr(w)?;
16307            Ok(())
16308        })
16309    }
16310}
16311
16312/// LedgerEntryExtensionV1Ext is an XDR NestedUnion defines as:
16313///
16314/// ```text
16315/// union switch (int v)
16316///     {
16317///     case 0:
16318///         void;
16319///     }
16320/// ```
16321///
16322// union with discriminant i32
16323#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
16324#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
16325#[cfg_attr(
16326    all(feature = "serde", feature = "alloc"),
16327    derive(serde::Serialize, serde::Deserialize),
16328    serde(rename_all = "snake_case")
16329)]
16330#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
16331#[allow(clippy::large_enum_variant)]
16332pub enum LedgerEntryExtensionV1Ext {
16333    V0,
16334}
16335
16336impl LedgerEntryExtensionV1Ext {
16337    pub const VARIANTS: [i32; 1] = [0];
16338    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
16339
16340    #[must_use]
16341    pub const fn name(&self) -> &'static str {
16342        match self {
16343            Self::V0 => "V0",
16344        }
16345    }
16346
16347    #[must_use]
16348    pub const fn discriminant(&self) -> i32 {
16349        #[allow(clippy::match_same_arms)]
16350        match self {
16351            Self::V0 => 0,
16352        }
16353    }
16354
16355    #[must_use]
16356    pub const fn variants() -> [i32; 1] {
16357        Self::VARIANTS
16358    }
16359}
16360
16361impl Name for LedgerEntryExtensionV1Ext {
16362    #[must_use]
16363    fn name(&self) -> &'static str {
16364        Self::name(self)
16365    }
16366}
16367
16368impl Discriminant<i32> for LedgerEntryExtensionV1Ext {
16369    #[must_use]
16370    fn discriminant(&self) -> i32 {
16371        Self::discriminant(self)
16372    }
16373}
16374
16375impl Variants<i32> for LedgerEntryExtensionV1Ext {
16376    fn variants() -> slice::Iter<'static, i32> {
16377        Self::VARIANTS.iter()
16378    }
16379}
16380
16381impl Union<i32> for LedgerEntryExtensionV1Ext {}
16382
16383impl ReadXdr for LedgerEntryExtensionV1Ext {
16384    #[cfg(feature = "std")]
16385    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
16386        r.with_limited_depth(|r| {
16387            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
16388            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
16389            let v = match dv {
16390                0 => Self::V0,
16391                #[allow(unreachable_patterns)]
16392                _ => return Err(Error::Invalid),
16393            };
16394            Ok(v)
16395        })
16396    }
16397}
16398
16399impl WriteXdr for LedgerEntryExtensionV1Ext {
16400    #[cfg(feature = "std")]
16401    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
16402        w.with_limited_depth(|w| {
16403            self.discriminant().write_xdr(w)?;
16404            #[allow(clippy::match_same_arms)]
16405            match self {
16406                Self::V0 => ().write_xdr(w)?,
16407            };
16408            Ok(())
16409        })
16410    }
16411}
16412
16413/// LedgerEntryExtensionV1 is an XDR Struct defines as:
16414///
16415/// ```text
16416/// struct LedgerEntryExtensionV1
16417/// {
16418///     SponsorshipDescriptor sponsoringID;
16419///
16420///     union switch (int v)
16421///     {
16422///     case 0:
16423///         void;
16424///     }
16425///     ext;
16426/// };
16427/// ```
16428///
16429#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
16430#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
16431#[cfg_attr(
16432    all(feature = "serde", feature = "alloc"),
16433    derive(serde::Serialize, serde::Deserialize),
16434    serde(rename_all = "snake_case")
16435)]
16436#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
16437pub struct LedgerEntryExtensionV1 {
16438    pub sponsoring_id: SponsorshipDescriptor,
16439    pub ext: LedgerEntryExtensionV1Ext,
16440}
16441
16442impl ReadXdr for LedgerEntryExtensionV1 {
16443    #[cfg(feature = "std")]
16444    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
16445        r.with_limited_depth(|r| {
16446            Ok(Self {
16447                sponsoring_id: SponsorshipDescriptor::read_xdr(r)?,
16448                ext: LedgerEntryExtensionV1Ext::read_xdr(r)?,
16449            })
16450        })
16451    }
16452}
16453
16454impl WriteXdr for LedgerEntryExtensionV1 {
16455    #[cfg(feature = "std")]
16456    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
16457        w.with_limited_depth(|w| {
16458            self.sponsoring_id.write_xdr(w)?;
16459            self.ext.write_xdr(w)?;
16460            Ok(())
16461        })
16462    }
16463}
16464
16465/// LedgerEntryData is an XDR NestedUnion defines as:
16466///
16467/// ```text
16468/// union switch (LedgerEntryType type)
16469///     {
16470///     case ACCOUNT:
16471///         AccountEntry account;
16472///     case TRUSTLINE:
16473///         TrustLineEntry trustLine;
16474///     case OFFER:
16475///         OfferEntry offer;
16476///     case DATA:
16477///         DataEntry data;
16478///     case CLAIMABLE_BALANCE:
16479///         ClaimableBalanceEntry claimableBalance;
16480///     case LIQUIDITY_POOL:
16481///         LiquidityPoolEntry liquidityPool;
16482///     case CONTRACT_DATA:
16483///         ContractDataEntry contractData;
16484///     case CONTRACT_CODE:
16485///         ContractCodeEntry contractCode;
16486///     case CONFIG_SETTING:
16487///         ConfigSettingEntry configSetting;
16488///     case TTL:
16489///         TTLEntry ttl;
16490///     }
16491/// ```
16492///
16493// union with discriminant LedgerEntryType
16494#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
16495#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
16496#[cfg_attr(
16497    all(feature = "serde", feature = "alloc"),
16498    derive(serde::Serialize, serde::Deserialize),
16499    serde(rename_all = "snake_case")
16500)]
16501#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
16502#[allow(clippy::large_enum_variant)]
16503pub enum LedgerEntryData {
16504    Account(AccountEntry),
16505    Trustline(TrustLineEntry),
16506    Offer(OfferEntry),
16507    Data(DataEntry),
16508    ClaimableBalance(ClaimableBalanceEntry),
16509    LiquidityPool(LiquidityPoolEntry),
16510    ContractData(ContractDataEntry),
16511    ContractCode(ContractCodeEntry),
16512    ConfigSetting(ConfigSettingEntry),
16513    Ttl(TtlEntry),
16514}
16515
16516impl LedgerEntryData {
16517    pub const VARIANTS: [LedgerEntryType; 10] = [
16518        LedgerEntryType::Account,
16519        LedgerEntryType::Trustline,
16520        LedgerEntryType::Offer,
16521        LedgerEntryType::Data,
16522        LedgerEntryType::ClaimableBalance,
16523        LedgerEntryType::LiquidityPool,
16524        LedgerEntryType::ContractData,
16525        LedgerEntryType::ContractCode,
16526        LedgerEntryType::ConfigSetting,
16527        LedgerEntryType::Ttl,
16528    ];
16529    pub const VARIANTS_STR: [&'static str; 10] = [
16530        "Account",
16531        "Trustline",
16532        "Offer",
16533        "Data",
16534        "ClaimableBalance",
16535        "LiquidityPool",
16536        "ContractData",
16537        "ContractCode",
16538        "ConfigSetting",
16539        "Ttl",
16540    ];
16541
16542    #[must_use]
16543    pub const fn name(&self) -> &'static str {
16544        match self {
16545            Self::Account(_) => "Account",
16546            Self::Trustline(_) => "Trustline",
16547            Self::Offer(_) => "Offer",
16548            Self::Data(_) => "Data",
16549            Self::ClaimableBalance(_) => "ClaimableBalance",
16550            Self::LiquidityPool(_) => "LiquidityPool",
16551            Self::ContractData(_) => "ContractData",
16552            Self::ContractCode(_) => "ContractCode",
16553            Self::ConfigSetting(_) => "ConfigSetting",
16554            Self::Ttl(_) => "Ttl",
16555        }
16556    }
16557
16558    #[must_use]
16559    pub const fn discriminant(&self) -> LedgerEntryType {
16560        #[allow(clippy::match_same_arms)]
16561        match self {
16562            Self::Account(_) => LedgerEntryType::Account,
16563            Self::Trustline(_) => LedgerEntryType::Trustline,
16564            Self::Offer(_) => LedgerEntryType::Offer,
16565            Self::Data(_) => LedgerEntryType::Data,
16566            Self::ClaimableBalance(_) => LedgerEntryType::ClaimableBalance,
16567            Self::LiquidityPool(_) => LedgerEntryType::LiquidityPool,
16568            Self::ContractData(_) => LedgerEntryType::ContractData,
16569            Self::ContractCode(_) => LedgerEntryType::ContractCode,
16570            Self::ConfigSetting(_) => LedgerEntryType::ConfigSetting,
16571            Self::Ttl(_) => LedgerEntryType::Ttl,
16572        }
16573    }
16574
16575    #[must_use]
16576    pub const fn variants() -> [LedgerEntryType; 10] {
16577        Self::VARIANTS
16578    }
16579}
16580
16581impl Name for LedgerEntryData {
16582    #[must_use]
16583    fn name(&self) -> &'static str {
16584        Self::name(self)
16585    }
16586}
16587
16588impl Discriminant<LedgerEntryType> for LedgerEntryData {
16589    #[must_use]
16590    fn discriminant(&self) -> LedgerEntryType {
16591        Self::discriminant(self)
16592    }
16593}
16594
16595impl Variants<LedgerEntryType> for LedgerEntryData {
16596    fn variants() -> slice::Iter<'static, LedgerEntryType> {
16597        Self::VARIANTS.iter()
16598    }
16599}
16600
16601impl Union<LedgerEntryType> for LedgerEntryData {}
16602
16603impl ReadXdr for LedgerEntryData {
16604    #[cfg(feature = "std")]
16605    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
16606        r.with_limited_depth(|r| {
16607            let dv: LedgerEntryType = <LedgerEntryType as ReadXdr>::read_xdr(r)?;
16608            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
16609            let v = match dv {
16610                LedgerEntryType::Account => Self::Account(AccountEntry::read_xdr(r)?),
16611                LedgerEntryType::Trustline => Self::Trustline(TrustLineEntry::read_xdr(r)?),
16612                LedgerEntryType::Offer => Self::Offer(OfferEntry::read_xdr(r)?),
16613                LedgerEntryType::Data => Self::Data(DataEntry::read_xdr(r)?),
16614                LedgerEntryType::ClaimableBalance => {
16615                    Self::ClaimableBalance(ClaimableBalanceEntry::read_xdr(r)?)
16616                }
16617                LedgerEntryType::LiquidityPool => {
16618                    Self::LiquidityPool(LiquidityPoolEntry::read_xdr(r)?)
16619                }
16620                LedgerEntryType::ContractData => {
16621                    Self::ContractData(ContractDataEntry::read_xdr(r)?)
16622                }
16623                LedgerEntryType::ContractCode => {
16624                    Self::ContractCode(ContractCodeEntry::read_xdr(r)?)
16625                }
16626                LedgerEntryType::ConfigSetting => {
16627                    Self::ConfigSetting(ConfigSettingEntry::read_xdr(r)?)
16628                }
16629                LedgerEntryType::Ttl => Self::Ttl(TtlEntry::read_xdr(r)?),
16630                #[allow(unreachable_patterns)]
16631                _ => return Err(Error::Invalid),
16632            };
16633            Ok(v)
16634        })
16635    }
16636}
16637
16638impl WriteXdr for LedgerEntryData {
16639    #[cfg(feature = "std")]
16640    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
16641        w.with_limited_depth(|w| {
16642            self.discriminant().write_xdr(w)?;
16643            #[allow(clippy::match_same_arms)]
16644            match self {
16645                Self::Account(v) => v.write_xdr(w)?,
16646                Self::Trustline(v) => v.write_xdr(w)?,
16647                Self::Offer(v) => v.write_xdr(w)?,
16648                Self::Data(v) => v.write_xdr(w)?,
16649                Self::ClaimableBalance(v) => v.write_xdr(w)?,
16650                Self::LiquidityPool(v) => v.write_xdr(w)?,
16651                Self::ContractData(v) => v.write_xdr(w)?,
16652                Self::ContractCode(v) => v.write_xdr(w)?,
16653                Self::ConfigSetting(v) => v.write_xdr(w)?,
16654                Self::Ttl(v) => v.write_xdr(w)?,
16655            };
16656            Ok(())
16657        })
16658    }
16659}
16660
16661/// LedgerEntryExt is an XDR NestedUnion defines as:
16662///
16663/// ```text
16664/// union switch (int v)
16665///     {
16666///     case 0:
16667///         void;
16668///     case 1:
16669///         LedgerEntryExtensionV1 v1;
16670///     }
16671/// ```
16672///
16673// union with discriminant i32
16674#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
16675#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
16676#[cfg_attr(
16677    all(feature = "serde", feature = "alloc"),
16678    derive(serde::Serialize, serde::Deserialize),
16679    serde(rename_all = "snake_case")
16680)]
16681#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
16682#[allow(clippy::large_enum_variant)]
16683pub enum LedgerEntryExt {
16684    V0,
16685    V1(LedgerEntryExtensionV1),
16686}
16687
16688impl LedgerEntryExt {
16689    pub const VARIANTS: [i32; 2] = [0, 1];
16690    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"];
16691
16692    #[must_use]
16693    pub const fn name(&self) -> &'static str {
16694        match self {
16695            Self::V0 => "V0",
16696            Self::V1(_) => "V1",
16697        }
16698    }
16699
16700    #[must_use]
16701    pub const fn discriminant(&self) -> i32 {
16702        #[allow(clippy::match_same_arms)]
16703        match self {
16704            Self::V0 => 0,
16705            Self::V1(_) => 1,
16706        }
16707    }
16708
16709    #[must_use]
16710    pub const fn variants() -> [i32; 2] {
16711        Self::VARIANTS
16712    }
16713}
16714
16715impl Name for LedgerEntryExt {
16716    #[must_use]
16717    fn name(&self) -> &'static str {
16718        Self::name(self)
16719    }
16720}
16721
16722impl Discriminant<i32> for LedgerEntryExt {
16723    #[must_use]
16724    fn discriminant(&self) -> i32 {
16725        Self::discriminant(self)
16726    }
16727}
16728
16729impl Variants<i32> for LedgerEntryExt {
16730    fn variants() -> slice::Iter<'static, i32> {
16731        Self::VARIANTS.iter()
16732    }
16733}
16734
16735impl Union<i32> for LedgerEntryExt {}
16736
16737impl ReadXdr for LedgerEntryExt {
16738    #[cfg(feature = "std")]
16739    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
16740        r.with_limited_depth(|r| {
16741            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
16742            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
16743            let v = match dv {
16744                0 => Self::V0,
16745                1 => Self::V1(LedgerEntryExtensionV1::read_xdr(r)?),
16746                #[allow(unreachable_patterns)]
16747                _ => return Err(Error::Invalid),
16748            };
16749            Ok(v)
16750        })
16751    }
16752}
16753
16754impl WriteXdr for LedgerEntryExt {
16755    #[cfg(feature = "std")]
16756    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
16757        w.with_limited_depth(|w| {
16758            self.discriminant().write_xdr(w)?;
16759            #[allow(clippy::match_same_arms)]
16760            match self {
16761                Self::V0 => ().write_xdr(w)?,
16762                Self::V1(v) => v.write_xdr(w)?,
16763            };
16764            Ok(())
16765        })
16766    }
16767}
16768
16769/// LedgerEntry is an XDR Struct defines as:
16770///
16771/// ```text
16772/// struct LedgerEntry
16773/// {
16774///     uint32 lastModifiedLedgerSeq; // ledger the LedgerEntry was last changed
16775///
16776///     union switch (LedgerEntryType type)
16777///     {
16778///     case ACCOUNT:
16779///         AccountEntry account;
16780///     case TRUSTLINE:
16781///         TrustLineEntry trustLine;
16782///     case OFFER:
16783///         OfferEntry offer;
16784///     case DATA:
16785///         DataEntry data;
16786///     case CLAIMABLE_BALANCE:
16787///         ClaimableBalanceEntry claimableBalance;
16788///     case LIQUIDITY_POOL:
16789///         LiquidityPoolEntry liquidityPool;
16790///     case CONTRACT_DATA:
16791///         ContractDataEntry contractData;
16792///     case CONTRACT_CODE:
16793///         ContractCodeEntry contractCode;
16794///     case CONFIG_SETTING:
16795///         ConfigSettingEntry configSetting;
16796///     case TTL:
16797///         TTLEntry ttl;
16798///     }
16799///     data;
16800///
16801///     // reserved for future use
16802///     union switch (int v)
16803///     {
16804///     case 0:
16805///         void;
16806///     case 1:
16807///         LedgerEntryExtensionV1 v1;
16808///     }
16809///     ext;
16810/// };
16811/// ```
16812///
16813#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
16814#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
16815#[cfg_attr(
16816    all(feature = "serde", feature = "alloc"),
16817    derive(serde::Serialize, serde::Deserialize),
16818    serde(rename_all = "snake_case")
16819)]
16820#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
16821pub struct LedgerEntry {
16822    pub last_modified_ledger_seq: u32,
16823    pub data: LedgerEntryData,
16824    pub ext: LedgerEntryExt,
16825}
16826
16827impl ReadXdr for LedgerEntry {
16828    #[cfg(feature = "std")]
16829    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
16830        r.with_limited_depth(|r| {
16831            Ok(Self {
16832                last_modified_ledger_seq: u32::read_xdr(r)?,
16833                data: LedgerEntryData::read_xdr(r)?,
16834                ext: LedgerEntryExt::read_xdr(r)?,
16835            })
16836        })
16837    }
16838}
16839
16840impl WriteXdr for LedgerEntry {
16841    #[cfg(feature = "std")]
16842    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
16843        w.with_limited_depth(|w| {
16844            self.last_modified_ledger_seq.write_xdr(w)?;
16845            self.data.write_xdr(w)?;
16846            self.ext.write_xdr(w)?;
16847            Ok(())
16848        })
16849    }
16850}
16851
16852/// LedgerKeyAccount is an XDR NestedStruct defines as:
16853///
16854/// ```text
16855/// struct
16856///     {
16857///         AccountID accountID;
16858///     }
16859/// ```
16860///
16861#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
16862#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
16863#[cfg_attr(
16864    all(feature = "serde", feature = "alloc"),
16865    derive(serde::Serialize, serde::Deserialize),
16866    serde(rename_all = "snake_case")
16867)]
16868#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
16869pub struct LedgerKeyAccount {
16870    pub account_id: AccountId,
16871}
16872
16873impl ReadXdr for LedgerKeyAccount {
16874    #[cfg(feature = "std")]
16875    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
16876        r.with_limited_depth(|r| {
16877            Ok(Self {
16878                account_id: AccountId::read_xdr(r)?,
16879            })
16880        })
16881    }
16882}
16883
16884impl WriteXdr for LedgerKeyAccount {
16885    #[cfg(feature = "std")]
16886    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
16887        w.with_limited_depth(|w| {
16888            self.account_id.write_xdr(w)?;
16889            Ok(())
16890        })
16891    }
16892}
16893
16894/// LedgerKeyTrustLine is an XDR NestedStruct defines as:
16895///
16896/// ```text
16897/// struct
16898///     {
16899///         AccountID accountID;
16900///         TrustLineAsset asset;
16901///     }
16902/// ```
16903///
16904#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
16905#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
16906#[cfg_attr(
16907    all(feature = "serde", feature = "alloc"),
16908    derive(serde::Serialize, serde::Deserialize),
16909    serde(rename_all = "snake_case")
16910)]
16911#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
16912pub struct LedgerKeyTrustLine {
16913    pub account_id: AccountId,
16914    pub asset: TrustLineAsset,
16915}
16916
16917impl ReadXdr for LedgerKeyTrustLine {
16918    #[cfg(feature = "std")]
16919    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
16920        r.with_limited_depth(|r| {
16921            Ok(Self {
16922                account_id: AccountId::read_xdr(r)?,
16923                asset: TrustLineAsset::read_xdr(r)?,
16924            })
16925        })
16926    }
16927}
16928
16929impl WriteXdr for LedgerKeyTrustLine {
16930    #[cfg(feature = "std")]
16931    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
16932        w.with_limited_depth(|w| {
16933            self.account_id.write_xdr(w)?;
16934            self.asset.write_xdr(w)?;
16935            Ok(())
16936        })
16937    }
16938}
16939
16940/// LedgerKeyOffer is an XDR NestedStruct defines as:
16941///
16942/// ```text
16943/// struct
16944///     {
16945///         AccountID sellerID;
16946///         int64 offerID;
16947///     }
16948/// ```
16949///
16950#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
16951#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
16952#[cfg_attr(
16953    all(feature = "serde", feature = "alloc"),
16954    derive(serde::Serialize, serde::Deserialize),
16955    serde(rename_all = "snake_case")
16956)]
16957#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
16958pub struct LedgerKeyOffer {
16959    pub seller_id: AccountId,
16960    pub offer_id: i64,
16961}
16962
16963impl ReadXdr for LedgerKeyOffer {
16964    #[cfg(feature = "std")]
16965    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
16966        r.with_limited_depth(|r| {
16967            Ok(Self {
16968                seller_id: AccountId::read_xdr(r)?,
16969                offer_id: i64::read_xdr(r)?,
16970            })
16971        })
16972    }
16973}
16974
16975impl WriteXdr for LedgerKeyOffer {
16976    #[cfg(feature = "std")]
16977    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
16978        w.with_limited_depth(|w| {
16979            self.seller_id.write_xdr(w)?;
16980            self.offer_id.write_xdr(w)?;
16981            Ok(())
16982        })
16983    }
16984}
16985
16986/// LedgerKeyData is an XDR NestedStruct defines as:
16987///
16988/// ```text
16989/// struct
16990///     {
16991///         AccountID accountID;
16992///         string64 dataName;
16993///     }
16994/// ```
16995///
16996#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
16997#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
16998#[cfg_attr(
16999    all(feature = "serde", feature = "alloc"),
17000    derive(serde::Serialize, serde::Deserialize),
17001    serde(rename_all = "snake_case")
17002)]
17003#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
17004pub struct LedgerKeyData {
17005    pub account_id: AccountId,
17006    pub data_name: String64,
17007}
17008
17009impl ReadXdr for LedgerKeyData {
17010    #[cfg(feature = "std")]
17011    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
17012        r.with_limited_depth(|r| {
17013            Ok(Self {
17014                account_id: AccountId::read_xdr(r)?,
17015                data_name: String64::read_xdr(r)?,
17016            })
17017        })
17018    }
17019}
17020
17021impl WriteXdr for LedgerKeyData {
17022    #[cfg(feature = "std")]
17023    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
17024        w.with_limited_depth(|w| {
17025            self.account_id.write_xdr(w)?;
17026            self.data_name.write_xdr(w)?;
17027            Ok(())
17028        })
17029    }
17030}
17031
17032/// LedgerKeyClaimableBalance is an XDR NestedStruct defines as:
17033///
17034/// ```text
17035/// struct
17036///     {
17037///         ClaimableBalanceID balanceID;
17038///     }
17039/// ```
17040///
17041#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
17042#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
17043#[cfg_attr(
17044    all(feature = "serde", feature = "alloc"),
17045    derive(serde::Serialize, serde::Deserialize),
17046    serde(rename_all = "snake_case")
17047)]
17048#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
17049pub struct LedgerKeyClaimableBalance {
17050    pub balance_id: ClaimableBalanceId,
17051}
17052
17053impl ReadXdr for LedgerKeyClaimableBalance {
17054    #[cfg(feature = "std")]
17055    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
17056        r.with_limited_depth(|r| {
17057            Ok(Self {
17058                balance_id: ClaimableBalanceId::read_xdr(r)?,
17059            })
17060        })
17061    }
17062}
17063
17064impl WriteXdr for LedgerKeyClaimableBalance {
17065    #[cfg(feature = "std")]
17066    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
17067        w.with_limited_depth(|w| {
17068            self.balance_id.write_xdr(w)?;
17069            Ok(())
17070        })
17071    }
17072}
17073
17074/// LedgerKeyLiquidityPool is an XDR NestedStruct defines as:
17075///
17076/// ```text
17077/// struct
17078///     {
17079///         PoolID liquidityPoolID;
17080///     }
17081/// ```
17082///
17083#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
17084#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
17085#[cfg_attr(
17086    all(feature = "serde", feature = "alloc"),
17087    derive(serde::Serialize, serde::Deserialize),
17088    serde(rename_all = "snake_case")
17089)]
17090#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
17091pub struct LedgerKeyLiquidityPool {
17092    pub liquidity_pool_id: PoolId,
17093}
17094
17095impl ReadXdr for LedgerKeyLiquidityPool {
17096    #[cfg(feature = "std")]
17097    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
17098        r.with_limited_depth(|r| {
17099            Ok(Self {
17100                liquidity_pool_id: PoolId::read_xdr(r)?,
17101            })
17102        })
17103    }
17104}
17105
17106impl WriteXdr for LedgerKeyLiquidityPool {
17107    #[cfg(feature = "std")]
17108    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
17109        w.with_limited_depth(|w| {
17110            self.liquidity_pool_id.write_xdr(w)?;
17111            Ok(())
17112        })
17113    }
17114}
17115
17116/// LedgerKeyContractData is an XDR NestedStruct defines as:
17117///
17118/// ```text
17119/// struct
17120///     {
17121///         SCAddress contract;
17122///         SCVal key;
17123///         ContractDataDurability durability;
17124///     }
17125/// ```
17126///
17127#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
17128#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
17129#[cfg_attr(
17130    all(feature = "serde", feature = "alloc"),
17131    derive(serde::Serialize, serde::Deserialize),
17132    serde(rename_all = "snake_case")
17133)]
17134#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
17135pub struct LedgerKeyContractData {
17136    pub contract: ScAddress,
17137    pub key: ScVal,
17138    pub durability: ContractDataDurability,
17139}
17140
17141impl ReadXdr for LedgerKeyContractData {
17142    #[cfg(feature = "std")]
17143    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
17144        r.with_limited_depth(|r| {
17145            Ok(Self {
17146                contract: ScAddress::read_xdr(r)?,
17147                key: ScVal::read_xdr(r)?,
17148                durability: ContractDataDurability::read_xdr(r)?,
17149            })
17150        })
17151    }
17152}
17153
17154impl WriteXdr for LedgerKeyContractData {
17155    #[cfg(feature = "std")]
17156    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
17157        w.with_limited_depth(|w| {
17158            self.contract.write_xdr(w)?;
17159            self.key.write_xdr(w)?;
17160            self.durability.write_xdr(w)?;
17161            Ok(())
17162        })
17163    }
17164}
17165
17166/// LedgerKeyContractCode is an XDR NestedStruct defines as:
17167///
17168/// ```text
17169/// struct
17170///     {
17171///         Hash hash;
17172///     }
17173/// ```
17174///
17175#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
17176#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
17177#[cfg_attr(
17178    all(feature = "serde", feature = "alloc"),
17179    derive(serde::Serialize, serde::Deserialize),
17180    serde(rename_all = "snake_case")
17181)]
17182#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
17183pub struct LedgerKeyContractCode {
17184    pub hash: Hash,
17185}
17186
17187impl ReadXdr for LedgerKeyContractCode {
17188    #[cfg(feature = "std")]
17189    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
17190        r.with_limited_depth(|r| {
17191            Ok(Self {
17192                hash: Hash::read_xdr(r)?,
17193            })
17194        })
17195    }
17196}
17197
17198impl WriteXdr for LedgerKeyContractCode {
17199    #[cfg(feature = "std")]
17200    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
17201        w.with_limited_depth(|w| {
17202            self.hash.write_xdr(w)?;
17203            Ok(())
17204        })
17205    }
17206}
17207
17208/// LedgerKeyConfigSetting is an XDR NestedStruct defines as:
17209///
17210/// ```text
17211/// struct
17212///     {
17213///         ConfigSettingID configSettingID;
17214///     }
17215/// ```
17216///
17217#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
17218#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
17219#[cfg_attr(
17220    all(feature = "serde", feature = "alloc"),
17221    derive(serde::Serialize, serde::Deserialize),
17222    serde(rename_all = "snake_case")
17223)]
17224#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
17225pub struct LedgerKeyConfigSetting {
17226    pub config_setting_id: ConfigSettingId,
17227}
17228
17229impl ReadXdr for LedgerKeyConfigSetting {
17230    #[cfg(feature = "std")]
17231    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
17232        r.with_limited_depth(|r| {
17233            Ok(Self {
17234                config_setting_id: ConfigSettingId::read_xdr(r)?,
17235            })
17236        })
17237    }
17238}
17239
17240impl WriteXdr for LedgerKeyConfigSetting {
17241    #[cfg(feature = "std")]
17242    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
17243        w.with_limited_depth(|w| {
17244            self.config_setting_id.write_xdr(w)?;
17245            Ok(())
17246        })
17247    }
17248}
17249
17250/// LedgerKeyTtl is an XDR NestedStruct defines as:
17251///
17252/// ```text
17253/// struct
17254///     {
17255///         // Hash of the LedgerKey that is associated with this TTLEntry
17256///         Hash keyHash;
17257///     }
17258/// ```
17259///
17260#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
17261#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
17262#[cfg_attr(
17263    all(feature = "serde", feature = "alloc"),
17264    derive(serde::Serialize, serde::Deserialize),
17265    serde(rename_all = "snake_case")
17266)]
17267#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
17268pub struct LedgerKeyTtl {
17269    pub key_hash: Hash,
17270}
17271
17272impl ReadXdr for LedgerKeyTtl {
17273    #[cfg(feature = "std")]
17274    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
17275        r.with_limited_depth(|r| {
17276            Ok(Self {
17277                key_hash: Hash::read_xdr(r)?,
17278            })
17279        })
17280    }
17281}
17282
17283impl WriteXdr for LedgerKeyTtl {
17284    #[cfg(feature = "std")]
17285    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
17286        w.with_limited_depth(|w| {
17287            self.key_hash.write_xdr(w)?;
17288            Ok(())
17289        })
17290    }
17291}
17292
17293/// LedgerKey is an XDR Union defines as:
17294///
17295/// ```text
17296/// union LedgerKey switch (LedgerEntryType type)
17297/// {
17298/// case ACCOUNT:
17299///     struct
17300///     {
17301///         AccountID accountID;
17302///     } account;
17303///
17304/// case TRUSTLINE:
17305///     struct
17306///     {
17307///         AccountID accountID;
17308///         TrustLineAsset asset;
17309///     } trustLine;
17310///
17311/// case OFFER:
17312///     struct
17313///     {
17314///         AccountID sellerID;
17315///         int64 offerID;
17316///     } offer;
17317///
17318/// case DATA:
17319///     struct
17320///     {
17321///         AccountID accountID;
17322///         string64 dataName;
17323///     } data;
17324///
17325/// case CLAIMABLE_BALANCE:
17326///     struct
17327///     {
17328///         ClaimableBalanceID balanceID;
17329///     } claimableBalance;
17330///
17331/// case LIQUIDITY_POOL:
17332///     struct
17333///     {
17334///         PoolID liquidityPoolID;
17335///     } liquidityPool;
17336/// case CONTRACT_DATA:
17337///     struct
17338///     {
17339///         SCAddress contract;
17340///         SCVal key;
17341///         ContractDataDurability durability;
17342///     } contractData;
17343/// case CONTRACT_CODE:
17344///     struct
17345///     {
17346///         Hash hash;
17347///     } contractCode;
17348/// case CONFIG_SETTING:
17349///     struct
17350///     {
17351///         ConfigSettingID configSettingID;
17352///     } configSetting;
17353/// case TTL:
17354///     struct
17355///     {
17356///         // Hash of the LedgerKey that is associated with this TTLEntry
17357///         Hash keyHash;
17358///     } ttl;
17359/// };
17360/// ```
17361///
17362// union with discriminant LedgerEntryType
17363#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
17364#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
17365#[cfg_attr(
17366    all(feature = "serde", feature = "alloc"),
17367    derive(serde::Serialize, serde::Deserialize),
17368    serde(rename_all = "snake_case")
17369)]
17370#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
17371#[allow(clippy::large_enum_variant)]
17372pub enum LedgerKey {
17373    Account(LedgerKeyAccount),
17374    Trustline(LedgerKeyTrustLine),
17375    Offer(LedgerKeyOffer),
17376    Data(LedgerKeyData),
17377    ClaimableBalance(LedgerKeyClaimableBalance),
17378    LiquidityPool(LedgerKeyLiquidityPool),
17379    ContractData(LedgerKeyContractData),
17380    ContractCode(LedgerKeyContractCode),
17381    ConfigSetting(LedgerKeyConfigSetting),
17382    Ttl(LedgerKeyTtl),
17383}
17384
17385impl LedgerKey {
17386    pub const VARIANTS: [LedgerEntryType; 10] = [
17387        LedgerEntryType::Account,
17388        LedgerEntryType::Trustline,
17389        LedgerEntryType::Offer,
17390        LedgerEntryType::Data,
17391        LedgerEntryType::ClaimableBalance,
17392        LedgerEntryType::LiquidityPool,
17393        LedgerEntryType::ContractData,
17394        LedgerEntryType::ContractCode,
17395        LedgerEntryType::ConfigSetting,
17396        LedgerEntryType::Ttl,
17397    ];
17398    pub const VARIANTS_STR: [&'static str; 10] = [
17399        "Account",
17400        "Trustline",
17401        "Offer",
17402        "Data",
17403        "ClaimableBalance",
17404        "LiquidityPool",
17405        "ContractData",
17406        "ContractCode",
17407        "ConfigSetting",
17408        "Ttl",
17409    ];
17410
17411    #[must_use]
17412    pub const fn name(&self) -> &'static str {
17413        match self {
17414            Self::Account(_) => "Account",
17415            Self::Trustline(_) => "Trustline",
17416            Self::Offer(_) => "Offer",
17417            Self::Data(_) => "Data",
17418            Self::ClaimableBalance(_) => "ClaimableBalance",
17419            Self::LiquidityPool(_) => "LiquidityPool",
17420            Self::ContractData(_) => "ContractData",
17421            Self::ContractCode(_) => "ContractCode",
17422            Self::ConfigSetting(_) => "ConfigSetting",
17423            Self::Ttl(_) => "Ttl",
17424        }
17425    }
17426
17427    #[must_use]
17428    pub const fn discriminant(&self) -> LedgerEntryType {
17429        #[allow(clippy::match_same_arms)]
17430        match self {
17431            Self::Account(_) => LedgerEntryType::Account,
17432            Self::Trustline(_) => LedgerEntryType::Trustline,
17433            Self::Offer(_) => LedgerEntryType::Offer,
17434            Self::Data(_) => LedgerEntryType::Data,
17435            Self::ClaimableBalance(_) => LedgerEntryType::ClaimableBalance,
17436            Self::LiquidityPool(_) => LedgerEntryType::LiquidityPool,
17437            Self::ContractData(_) => LedgerEntryType::ContractData,
17438            Self::ContractCode(_) => LedgerEntryType::ContractCode,
17439            Self::ConfigSetting(_) => LedgerEntryType::ConfigSetting,
17440            Self::Ttl(_) => LedgerEntryType::Ttl,
17441        }
17442    }
17443
17444    #[must_use]
17445    pub const fn variants() -> [LedgerEntryType; 10] {
17446        Self::VARIANTS
17447    }
17448}
17449
17450impl Name for LedgerKey {
17451    #[must_use]
17452    fn name(&self) -> &'static str {
17453        Self::name(self)
17454    }
17455}
17456
17457impl Discriminant<LedgerEntryType> for LedgerKey {
17458    #[must_use]
17459    fn discriminant(&self) -> LedgerEntryType {
17460        Self::discriminant(self)
17461    }
17462}
17463
17464impl Variants<LedgerEntryType> for LedgerKey {
17465    fn variants() -> slice::Iter<'static, LedgerEntryType> {
17466        Self::VARIANTS.iter()
17467    }
17468}
17469
17470impl Union<LedgerEntryType> for LedgerKey {}
17471
17472impl ReadXdr for LedgerKey {
17473    #[cfg(feature = "std")]
17474    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
17475        r.with_limited_depth(|r| {
17476            let dv: LedgerEntryType = <LedgerEntryType as ReadXdr>::read_xdr(r)?;
17477            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
17478            let v = match dv {
17479                LedgerEntryType::Account => Self::Account(LedgerKeyAccount::read_xdr(r)?),
17480                LedgerEntryType::Trustline => Self::Trustline(LedgerKeyTrustLine::read_xdr(r)?),
17481                LedgerEntryType::Offer => Self::Offer(LedgerKeyOffer::read_xdr(r)?),
17482                LedgerEntryType::Data => Self::Data(LedgerKeyData::read_xdr(r)?),
17483                LedgerEntryType::ClaimableBalance => {
17484                    Self::ClaimableBalance(LedgerKeyClaimableBalance::read_xdr(r)?)
17485                }
17486                LedgerEntryType::LiquidityPool => {
17487                    Self::LiquidityPool(LedgerKeyLiquidityPool::read_xdr(r)?)
17488                }
17489                LedgerEntryType::ContractData => {
17490                    Self::ContractData(LedgerKeyContractData::read_xdr(r)?)
17491                }
17492                LedgerEntryType::ContractCode => {
17493                    Self::ContractCode(LedgerKeyContractCode::read_xdr(r)?)
17494                }
17495                LedgerEntryType::ConfigSetting => {
17496                    Self::ConfigSetting(LedgerKeyConfigSetting::read_xdr(r)?)
17497                }
17498                LedgerEntryType::Ttl => Self::Ttl(LedgerKeyTtl::read_xdr(r)?),
17499                #[allow(unreachable_patterns)]
17500                _ => return Err(Error::Invalid),
17501            };
17502            Ok(v)
17503        })
17504    }
17505}
17506
17507impl WriteXdr for LedgerKey {
17508    #[cfg(feature = "std")]
17509    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
17510        w.with_limited_depth(|w| {
17511            self.discriminant().write_xdr(w)?;
17512            #[allow(clippy::match_same_arms)]
17513            match self {
17514                Self::Account(v) => v.write_xdr(w)?,
17515                Self::Trustline(v) => v.write_xdr(w)?,
17516                Self::Offer(v) => v.write_xdr(w)?,
17517                Self::Data(v) => v.write_xdr(w)?,
17518                Self::ClaimableBalance(v) => v.write_xdr(w)?,
17519                Self::LiquidityPool(v) => v.write_xdr(w)?,
17520                Self::ContractData(v) => v.write_xdr(w)?,
17521                Self::ContractCode(v) => v.write_xdr(w)?,
17522                Self::ConfigSetting(v) => v.write_xdr(w)?,
17523                Self::Ttl(v) => v.write_xdr(w)?,
17524            };
17525            Ok(())
17526        })
17527    }
17528}
17529
17530/// EnvelopeType is an XDR Enum defines as:
17531///
17532/// ```text
17533/// enum EnvelopeType
17534/// {
17535///     ENVELOPE_TYPE_TX_V0 = 0,
17536///     ENVELOPE_TYPE_SCP = 1,
17537///     ENVELOPE_TYPE_TX = 2,
17538///     ENVELOPE_TYPE_AUTH = 3,
17539///     ENVELOPE_TYPE_SCPVALUE = 4,
17540///     ENVELOPE_TYPE_TX_FEE_BUMP = 5,
17541///     ENVELOPE_TYPE_OP_ID = 6,
17542///     ENVELOPE_TYPE_POOL_REVOKE_OP_ID = 7,
17543///     ENVELOPE_TYPE_CONTRACT_ID = 8,
17544///     ENVELOPE_TYPE_SOROBAN_AUTHORIZATION = 9
17545/// };
17546/// ```
17547///
17548// enum
17549#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
17550#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
17551#[cfg_attr(
17552    all(feature = "serde", feature = "alloc"),
17553    derive(serde::Serialize, serde::Deserialize),
17554    serde(rename_all = "snake_case")
17555)]
17556#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
17557#[repr(i32)]
17558pub enum EnvelopeType {
17559    TxV0 = 0,
17560    Scp = 1,
17561    Tx = 2,
17562    Auth = 3,
17563    Scpvalue = 4,
17564    TxFeeBump = 5,
17565    OpId = 6,
17566    PoolRevokeOpId = 7,
17567    ContractId = 8,
17568    SorobanAuthorization = 9,
17569}
17570
17571impl EnvelopeType {
17572    pub const VARIANTS: [EnvelopeType; 10] = [
17573        EnvelopeType::TxV0,
17574        EnvelopeType::Scp,
17575        EnvelopeType::Tx,
17576        EnvelopeType::Auth,
17577        EnvelopeType::Scpvalue,
17578        EnvelopeType::TxFeeBump,
17579        EnvelopeType::OpId,
17580        EnvelopeType::PoolRevokeOpId,
17581        EnvelopeType::ContractId,
17582        EnvelopeType::SorobanAuthorization,
17583    ];
17584    pub const VARIANTS_STR: [&'static str; 10] = [
17585        "TxV0",
17586        "Scp",
17587        "Tx",
17588        "Auth",
17589        "Scpvalue",
17590        "TxFeeBump",
17591        "OpId",
17592        "PoolRevokeOpId",
17593        "ContractId",
17594        "SorobanAuthorization",
17595    ];
17596
17597    #[must_use]
17598    pub const fn name(&self) -> &'static str {
17599        match self {
17600            Self::TxV0 => "TxV0",
17601            Self::Scp => "Scp",
17602            Self::Tx => "Tx",
17603            Self::Auth => "Auth",
17604            Self::Scpvalue => "Scpvalue",
17605            Self::TxFeeBump => "TxFeeBump",
17606            Self::OpId => "OpId",
17607            Self::PoolRevokeOpId => "PoolRevokeOpId",
17608            Self::ContractId => "ContractId",
17609            Self::SorobanAuthorization => "SorobanAuthorization",
17610        }
17611    }
17612
17613    #[must_use]
17614    pub const fn variants() -> [EnvelopeType; 10] {
17615        Self::VARIANTS
17616    }
17617}
17618
17619impl Name for EnvelopeType {
17620    #[must_use]
17621    fn name(&self) -> &'static str {
17622        Self::name(self)
17623    }
17624}
17625
17626impl Variants<EnvelopeType> for EnvelopeType {
17627    fn variants() -> slice::Iter<'static, EnvelopeType> {
17628        Self::VARIANTS.iter()
17629    }
17630}
17631
17632impl Enum for EnvelopeType {}
17633
17634impl fmt::Display for EnvelopeType {
17635    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
17636        f.write_str(self.name())
17637    }
17638}
17639
17640impl TryFrom<i32> for EnvelopeType {
17641    type Error = Error;
17642
17643    fn try_from(i: i32) -> Result<Self> {
17644        let e = match i {
17645            0 => EnvelopeType::TxV0,
17646            1 => EnvelopeType::Scp,
17647            2 => EnvelopeType::Tx,
17648            3 => EnvelopeType::Auth,
17649            4 => EnvelopeType::Scpvalue,
17650            5 => EnvelopeType::TxFeeBump,
17651            6 => EnvelopeType::OpId,
17652            7 => EnvelopeType::PoolRevokeOpId,
17653            8 => EnvelopeType::ContractId,
17654            9 => EnvelopeType::SorobanAuthorization,
17655            #[allow(unreachable_patterns)]
17656            _ => return Err(Error::Invalid),
17657        };
17658        Ok(e)
17659    }
17660}
17661
17662impl From<EnvelopeType> for i32 {
17663    #[must_use]
17664    fn from(e: EnvelopeType) -> Self {
17665        e as Self
17666    }
17667}
17668
17669impl ReadXdr for EnvelopeType {
17670    #[cfg(feature = "std")]
17671    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
17672        r.with_limited_depth(|r| {
17673            let e = i32::read_xdr(r)?;
17674            let v: Self = e.try_into()?;
17675            Ok(v)
17676        })
17677    }
17678}
17679
17680impl WriteXdr for EnvelopeType {
17681    #[cfg(feature = "std")]
17682    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
17683        w.with_limited_depth(|w| {
17684            let i: i32 = (*self).into();
17685            i.write_xdr(w)
17686        })
17687    }
17688}
17689
17690/// BucketListType is an XDR Enum defines as:
17691///
17692/// ```text
17693/// enum BucketListType
17694/// {
17695///     LIVE = 0,
17696///     HOT_ARCHIVE = 1,
17697///     COLD_ARCHIVE = 2
17698/// };
17699/// ```
17700///
17701// enum
17702#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
17703#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
17704#[cfg_attr(
17705    all(feature = "serde", feature = "alloc"),
17706    derive(serde::Serialize, serde::Deserialize),
17707    serde(rename_all = "snake_case")
17708)]
17709#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
17710#[repr(i32)]
17711pub enum BucketListType {
17712    Live = 0,
17713    HotArchive = 1,
17714    ColdArchive = 2,
17715}
17716
17717impl BucketListType {
17718    pub const VARIANTS: [BucketListType; 3] = [
17719        BucketListType::Live,
17720        BucketListType::HotArchive,
17721        BucketListType::ColdArchive,
17722    ];
17723    pub const VARIANTS_STR: [&'static str; 3] = ["Live", "HotArchive", "ColdArchive"];
17724
17725    #[must_use]
17726    pub const fn name(&self) -> &'static str {
17727        match self {
17728            Self::Live => "Live",
17729            Self::HotArchive => "HotArchive",
17730            Self::ColdArchive => "ColdArchive",
17731        }
17732    }
17733
17734    #[must_use]
17735    pub const fn variants() -> [BucketListType; 3] {
17736        Self::VARIANTS
17737    }
17738}
17739
17740impl Name for BucketListType {
17741    #[must_use]
17742    fn name(&self) -> &'static str {
17743        Self::name(self)
17744    }
17745}
17746
17747impl Variants<BucketListType> for BucketListType {
17748    fn variants() -> slice::Iter<'static, BucketListType> {
17749        Self::VARIANTS.iter()
17750    }
17751}
17752
17753impl Enum for BucketListType {}
17754
17755impl fmt::Display for BucketListType {
17756    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
17757        f.write_str(self.name())
17758    }
17759}
17760
17761impl TryFrom<i32> for BucketListType {
17762    type Error = Error;
17763
17764    fn try_from(i: i32) -> Result<Self> {
17765        let e = match i {
17766            0 => BucketListType::Live,
17767            1 => BucketListType::HotArchive,
17768            2 => BucketListType::ColdArchive,
17769            #[allow(unreachable_patterns)]
17770            _ => return Err(Error::Invalid),
17771        };
17772        Ok(e)
17773    }
17774}
17775
17776impl From<BucketListType> for i32 {
17777    #[must_use]
17778    fn from(e: BucketListType) -> Self {
17779        e as Self
17780    }
17781}
17782
17783impl ReadXdr for BucketListType {
17784    #[cfg(feature = "std")]
17785    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
17786        r.with_limited_depth(|r| {
17787            let e = i32::read_xdr(r)?;
17788            let v: Self = e.try_into()?;
17789            Ok(v)
17790        })
17791    }
17792}
17793
17794impl WriteXdr for BucketListType {
17795    #[cfg(feature = "std")]
17796    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
17797        w.with_limited_depth(|w| {
17798            let i: i32 = (*self).into();
17799            i.write_xdr(w)
17800        })
17801    }
17802}
17803
17804/// BucketEntryType is an XDR Enum defines as:
17805///
17806/// ```text
17807/// enum BucketEntryType
17808/// {
17809///     METAENTRY =
17810///         -1, // At-and-after protocol 11: bucket metadata, should come first.
17811///     LIVEENTRY = 0, // Before protocol 11: created-or-updated;
17812///                    // At-and-after protocol 11: only updated.
17813///     DEADENTRY = 1,
17814///     INITENTRY = 2 // At-and-after protocol 11: only created.
17815/// };
17816/// ```
17817///
17818// enum
17819#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
17820#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
17821#[cfg_attr(
17822    all(feature = "serde", feature = "alloc"),
17823    derive(serde::Serialize, serde::Deserialize),
17824    serde(rename_all = "snake_case")
17825)]
17826#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
17827#[repr(i32)]
17828pub enum BucketEntryType {
17829    Metaentry = -1,
17830    Liveentry = 0,
17831    Deadentry = 1,
17832    Initentry = 2,
17833}
17834
17835impl BucketEntryType {
17836    pub const VARIANTS: [BucketEntryType; 4] = [
17837        BucketEntryType::Metaentry,
17838        BucketEntryType::Liveentry,
17839        BucketEntryType::Deadentry,
17840        BucketEntryType::Initentry,
17841    ];
17842    pub const VARIANTS_STR: [&'static str; 4] =
17843        ["Metaentry", "Liveentry", "Deadentry", "Initentry"];
17844
17845    #[must_use]
17846    pub const fn name(&self) -> &'static str {
17847        match self {
17848            Self::Metaentry => "Metaentry",
17849            Self::Liveentry => "Liveentry",
17850            Self::Deadentry => "Deadentry",
17851            Self::Initentry => "Initentry",
17852        }
17853    }
17854
17855    #[must_use]
17856    pub const fn variants() -> [BucketEntryType; 4] {
17857        Self::VARIANTS
17858    }
17859}
17860
17861impl Name for BucketEntryType {
17862    #[must_use]
17863    fn name(&self) -> &'static str {
17864        Self::name(self)
17865    }
17866}
17867
17868impl Variants<BucketEntryType> for BucketEntryType {
17869    fn variants() -> slice::Iter<'static, BucketEntryType> {
17870        Self::VARIANTS.iter()
17871    }
17872}
17873
17874impl Enum for BucketEntryType {}
17875
17876impl fmt::Display for BucketEntryType {
17877    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
17878        f.write_str(self.name())
17879    }
17880}
17881
17882impl TryFrom<i32> for BucketEntryType {
17883    type Error = Error;
17884
17885    fn try_from(i: i32) -> Result<Self> {
17886        let e = match i {
17887            -1 => BucketEntryType::Metaentry,
17888            0 => BucketEntryType::Liveentry,
17889            1 => BucketEntryType::Deadentry,
17890            2 => BucketEntryType::Initentry,
17891            #[allow(unreachable_patterns)]
17892            _ => return Err(Error::Invalid),
17893        };
17894        Ok(e)
17895    }
17896}
17897
17898impl From<BucketEntryType> for i32 {
17899    #[must_use]
17900    fn from(e: BucketEntryType) -> Self {
17901        e as Self
17902    }
17903}
17904
17905impl ReadXdr for BucketEntryType {
17906    #[cfg(feature = "std")]
17907    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
17908        r.with_limited_depth(|r| {
17909            let e = i32::read_xdr(r)?;
17910            let v: Self = e.try_into()?;
17911            Ok(v)
17912        })
17913    }
17914}
17915
17916impl WriteXdr for BucketEntryType {
17917    #[cfg(feature = "std")]
17918    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
17919        w.with_limited_depth(|w| {
17920            let i: i32 = (*self).into();
17921            i.write_xdr(w)
17922        })
17923    }
17924}
17925
17926/// HotArchiveBucketEntryType is an XDR Enum defines as:
17927///
17928/// ```text
17929/// enum HotArchiveBucketEntryType
17930/// {
17931///     HOT_ARCHIVE_METAENTRY = -1, // Bucket metadata, should come first.
17932///     HOT_ARCHIVE_ARCHIVED = 0,   // Entry is Archived
17933///     HOT_ARCHIVE_LIVE = 1,       // Entry was previously HOT_ARCHIVE_ARCHIVED, or HOT_ARCHIVE_DELETED, but
17934///                                 // has been added back to the live BucketList.
17935///                                 // Does not need to be persisted.
17936///     HOT_ARCHIVE_DELETED = 2     // Entry deleted (Note: must be persisted in archive)
17937/// };
17938/// ```
17939///
17940// enum
17941#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
17942#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
17943#[cfg_attr(
17944    all(feature = "serde", feature = "alloc"),
17945    derive(serde::Serialize, serde::Deserialize),
17946    serde(rename_all = "snake_case")
17947)]
17948#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
17949#[repr(i32)]
17950pub enum HotArchiveBucketEntryType {
17951    Metaentry = -1,
17952    Archived = 0,
17953    Live = 1,
17954    Deleted = 2,
17955}
17956
17957impl HotArchiveBucketEntryType {
17958    pub const VARIANTS: [HotArchiveBucketEntryType; 4] = [
17959        HotArchiveBucketEntryType::Metaentry,
17960        HotArchiveBucketEntryType::Archived,
17961        HotArchiveBucketEntryType::Live,
17962        HotArchiveBucketEntryType::Deleted,
17963    ];
17964    pub const VARIANTS_STR: [&'static str; 4] = ["Metaentry", "Archived", "Live", "Deleted"];
17965
17966    #[must_use]
17967    pub const fn name(&self) -> &'static str {
17968        match self {
17969            Self::Metaentry => "Metaentry",
17970            Self::Archived => "Archived",
17971            Self::Live => "Live",
17972            Self::Deleted => "Deleted",
17973        }
17974    }
17975
17976    #[must_use]
17977    pub const fn variants() -> [HotArchiveBucketEntryType; 4] {
17978        Self::VARIANTS
17979    }
17980}
17981
17982impl Name for HotArchiveBucketEntryType {
17983    #[must_use]
17984    fn name(&self) -> &'static str {
17985        Self::name(self)
17986    }
17987}
17988
17989impl Variants<HotArchiveBucketEntryType> for HotArchiveBucketEntryType {
17990    fn variants() -> slice::Iter<'static, HotArchiveBucketEntryType> {
17991        Self::VARIANTS.iter()
17992    }
17993}
17994
17995impl Enum for HotArchiveBucketEntryType {}
17996
17997impl fmt::Display for HotArchiveBucketEntryType {
17998    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
17999        f.write_str(self.name())
18000    }
18001}
18002
18003impl TryFrom<i32> for HotArchiveBucketEntryType {
18004    type Error = Error;
18005
18006    fn try_from(i: i32) -> Result<Self> {
18007        let e = match i {
18008            -1 => HotArchiveBucketEntryType::Metaentry,
18009            0 => HotArchiveBucketEntryType::Archived,
18010            1 => HotArchiveBucketEntryType::Live,
18011            2 => HotArchiveBucketEntryType::Deleted,
18012            #[allow(unreachable_patterns)]
18013            _ => return Err(Error::Invalid),
18014        };
18015        Ok(e)
18016    }
18017}
18018
18019impl From<HotArchiveBucketEntryType> for i32 {
18020    #[must_use]
18021    fn from(e: HotArchiveBucketEntryType) -> Self {
18022        e as Self
18023    }
18024}
18025
18026impl ReadXdr for HotArchiveBucketEntryType {
18027    #[cfg(feature = "std")]
18028    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
18029        r.with_limited_depth(|r| {
18030            let e = i32::read_xdr(r)?;
18031            let v: Self = e.try_into()?;
18032            Ok(v)
18033        })
18034    }
18035}
18036
18037impl WriteXdr for HotArchiveBucketEntryType {
18038    #[cfg(feature = "std")]
18039    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
18040        w.with_limited_depth(|w| {
18041            let i: i32 = (*self).into();
18042            i.write_xdr(w)
18043        })
18044    }
18045}
18046
18047/// ColdArchiveBucketEntryType is an XDR Enum defines as:
18048///
18049/// ```text
18050/// enum ColdArchiveBucketEntryType
18051/// {
18052///     COLD_ARCHIVE_METAENTRY     = -1,  // Bucket metadata, should come first.
18053///     COLD_ARCHIVE_ARCHIVED_LEAF = 0,   // Full LedgerEntry that was archived during the epoch
18054///     COLD_ARCHIVE_DELETED_LEAF  = 1,   // LedgerKey that was deleted during the epoch
18055///     COLD_ARCHIVE_BOUNDARY_LEAF = 2,   // Dummy leaf representing low/high bound
18056///     COLD_ARCHIVE_HASH          = 3    // Intermediary Merkle hash entry
18057/// };
18058/// ```
18059///
18060// enum
18061#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
18062#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
18063#[cfg_attr(
18064    all(feature = "serde", feature = "alloc"),
18065    derive(serde::Serialize, serde::Deserialize),
18066    serde(rename_all = "snake_case")
18067)]
18068#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
18069#[repr(i32)]
18070pub enum ColdArchiveBucketEntryType {
18071    Metaentry = -1,
18072    ArchivedLeaf = 0,
18073    DeletedLeaf = 1,
18074    BoundaryLeaf = 2,
18075    Hash = 3,
18076}
18077
18078impl ColdArchiveBucketEntryType {
18079    pub const VARIANTS: [ColdArchiveBucketEntryType; 5] = [
18080        ColdArchiveBucketEntryType::Metaentry,
18081        ColdArchiveBucketEntryType::ArchivedLeaf,
18082        ColdArchiveBucketEntryType::DeletedLeaf,
18083        ColdArchiveBucketEntryType::BoundaryLeaf,
18084        ColdArchiveBucketEntryType::Hash,
18085    ];
18086    pub const VARIANTS_STR: [&'static str; 5] = [
18087        "Metaentry",
18088        "ArchivedLeaf",
18089        "DeletedLeaf",
18090        "BoundaryLeaf",
18091        "Hash",
18092    ];
18093
18094    #[must_use]
18095    pub const fn name(&self) -> &'static str {
18096        match self {
18097            Self::Metaentry => "Metaentry",
18098            Self::ArchivedLeaf => "ArchivedLeaf",
18099            Self::DeletedLeaf => "DeletedLeaf",
18100            Self::BoundaryLeaf => "BoundaryLeaf",
18101            Self::Hash => "Hash",
18102        }
18103    }
18104
18105    #[must_use]
18106    pub const fn variants() -> [ColdArchiveBucketEntryType; 5] {
18107        Self::VARIANTS
18108    }
18109}
18110
18111impl Name for ColdArchiveBucketEntryType {
18112    #[must_use]
18113    fn name(&self) -> &'static str {
18114        Self::name(self)
18115    }
18116}
18117
18118impl Variants<ColdArchiveBucketEntryType> for ColdArchiveBucketEntryType {
18119    fn variants() -> slice::Iter<'static, ColdArchiveBucketEntryType> {
18120        Self::VARIANTS.iter()
18121    }
18122}
18123
18124impl Enum for ColdArchiveBucketEntryType {}
18125
18126impl fmt::Display for ColdArchiveBucketEntryType {
18127    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
18128        f.write_str(self.name())
18129    }
18130}
18131
18132impl TryFrom<i32> for ColdArchiveBucketEntryType {
18133    type Error = Error;
18134
18135    fn try_from(i: i32) -> Result<Self> {
18136        let e = match i {
18137            -1 => ColdArchiveBucketEntryType::Metaentry,
18138            0 => ColdArchiveBucketEntryType::ArchivedLeaf,
18139            1 => ColdArchiveBucketEntryType::DeletedLeaf,
18140            2 => ColdArchiveBucketEntryType::BoundaryLeaf,
18141            3 => ColdArchiveBucketEntryType::Hash,
18142            #[allow(unreachable_patterns)]
18143            _ => return Err(Error::Invalid),
18144        };
18145        Ok(e)
18146    }
18147}
18148
18149impl From<ColdArchiveBucketEntryType> for i32 {
18150    #[must_use]
18151    fn from(e: ColdArchiveBucketEntryType) -> Self {
18152        e as Self
18153    }
18154}
18155
18156impl ReadXdr for ColdArchiveBucketEntryType {
18157    #[cfg(feature = "std")]
18158    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
18159        r.with_limited_depth(|r| {
18160            let e = i32::read_xdr(r)?;
18161            let v: Self = e.try_into()?;
18162            Ok(v)
18163        })
18164    }
18165}
18166
18167impl WriteXdr for ColdArchiveBucketEntryType {
18168    #[cfg(feature = "std")]
18169    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
18170        w.with_limited_depth(|w| {
18171            let i: i32 = (*self).into();
18172            i.write_xdr(w)
18173        })
18174    }
18175}
18176
18177/// BucketMetadataExt is an XDR NestedUnion defines as:
18178///
18179/// ```text
18180/// union switch (int v)
18181///     {
18182///     case 0:
18183///         void;
18184///     case 1:
18185///         BucketListType bucketListType;
18186///     }
18187/// ```
18188///
18189// union with discriminant i32
18190#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
18191#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
18192#[cfg_attr(
18193    all(feature = "serde", feature = "alloc"),
18194    derive(serde::Serialize, serde::Deserialize),
18195    serde(rename_all = "snake_case")
18196)]
18197#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
18198#[allow(clippy::large_enum_variant)]
18199pub enum BucketMetadataExt {
18200    V0,
18201    V1(BucketListType),
18202}
18203
18204impl BucketMetadataExt {
18205    pub const VARIANTS: [i32; 2] = [0, 1];
18206    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"];
18207
18208    #[must_use]
18209    pub const fn name(&self) -> &'static str {
18210        match self {
18211            Self::V0 => "V0",
18212            Self::V1(_) => "V1",
18213        }
18214    }
18215
18216    #[must_use]
18217    pub const fn discriminant(&self) -> i32 {
18218        #[allow(clippy::match_same_arms)]
18219        match self {
18220            Self::V0 => 0,
18221            Self::V1(_) => 1,
18222        }
18223    }
18224
18225    #[must_use]
18226    pub const fn variants() -> [i32; 2] {
18227        Self::VARIANTS
18228    }
18229}
18230
18231impl Name for BucketMetadataExt {
18232    #[must_use]
18233    fn name(&self) -> &'static str {
18234        Self::name(self)
18235    }
18236}
18237
18238impl Discriminant<i32> for BucketMetadataExt {
18239    #[must_use]
18240    fn discriminant(&self) -> i32 {
18241        Self::discriminant(self)
18242    }
18243}
18244
18245impl Variants<i32> for BucketMetadataExt {
18246    fn variants() -> slice::Iter<'static, i32> {
18247        Self::VARIANTS.iter()
18248    }
18249}
18250
18251impl Union<i32> for BucketMetadataExt {}
18252
18253impl ReadXdr for BucketMetadataExt {
18254    #[cfg(feature = "std")]
18255    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
18256        r.with_limited_depth(|r| {
18257            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
18258            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
18259            let v = match dv {
18260                0 => Self::V0,
18261                1 => Self::V1(BucketListType::read_xdr(r)?),
18262                #[allow(unreachable_patterns)]
18263                _ => return Err(Error::Invalid),
18264            };
18265            Ok(v)
18266        })
18267    }
18268}
18269
18270impl WriteXdr for BucketMetadataExt {
18271    #[cfg(feature = "std")]
18272    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
18273        w.with_limited_depth(|w| {
18274            self.discriminant().write_xdr(w)?;
18275            #[allow(clippy::match_same_arms)]
18276            match self {
18277                Self::V0 => ().write_xdr(w)?,
18278                Self::V1(v) => v.write_xdr(w)?,
18279            };
18280            Ok(())
18281        })
18282    }
18283}
18284
18285/// BucketMetadata is an XDR Struct defines as:
18286///
18287/// ```text
18288/// struct BucketMetadata
18289/// {
18290///     // Indicates the protocol version used to create / merge this bucket.
18291///     uint32 ledgerVersion;
18292///
18293///     // reserved for future use
18294///     union switch (int v)
18295///     {
18296///     case 0:
18297///         void;
18298///     case 1:
18299///         BucketListType bucketListType;
18300///     }
18301///     ext;
18302/// };
18303/// ```
18304///
18305#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
18306#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
18307#[cfg_attr(
18308    all(feature = "serde", feature = "alloc"),
18309    derive(serde::Serialize, serde::Deserialize),
18310    serde(rename_all = "snake_case")
18311)]
18312#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
18313pub struct BucketMetadata {
18314    pub ledger_version: u32,
18315    pub ext: BucketMetadataExt,
18316}
18317
18318impl ReadXdr for BucketMetadata {
18319    #[cfg(feature = "std")]
18320    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
18321        r.with_limited_depth(|r| {
18322            Ok(Self {
18323                ledger_version: u32::read_xdr(r)?,
18324                ext: BucketMetadataExt::read_xdr(r)?,
18325            })
18326        })
18327    }
18328}
18329
18330impl WriteXdr for BucketMetadata {
18331    #[cfg(feature = "std")]
18332    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
18333        w.with_limited_depth(|w| {
18334            self.ledger_version.write_xdr(w)?;
18335            self.ext.write_xdr(w)?;
18336            Ok(())
18337        })
18338    }
18339}
18340
18341/// BucketEntry is an XDR Union defines as:
18342///
18343/// ```text
18344/// union BucketEntry switch (BucketEntryType type)
18345/// {
18346/// case LIVEENTRY:
18347/// case INITENTRY:
18348///     LedgerEntry liveEntry;
18349///
18350/// case DEADENTRY:
18351///     LedgerKey deadEntry;
18352/// case METAENTRY:
18353///     BucketMetadata metaEntry;
18354/// };
18355/// ```
18356///
18357// union with discriminant BucketEntryType
18358#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
18359#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
18360#[cfg_attr(
18361    all(feature = "serde", feature = "alloc"),
18362    derive(serde::Serialize, serde::Deserialize),
18363    serde(rename_all = "snake_case")
18364)]
18365#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
18366#[allow(clippy::large_enum_variant)]
18367pub enum BucketEntry {
18368    Liveentry(LedgerEntry),
18369    Initentry(LedgerEntry),
18370    Deadentry(LedgerKey),
18371    Metaentry(BucketMetadata),
18372}
18373
18374impl BucketEntry {
18375    pub const VARIANTS: [BucketEntryType; 4] = [
18376        BucketEntryType::Liveentry,
18377        BucketEntryType::Initentry,
18378        BucketEntryType::Deadentry,
18379        BucketEntryType::Metaentry,
18380    ];
18381    pub const VARIANTS_STR: [&'static str; 4] =
18382        ["Liveentry", "Initentry", "Deadentry", "Metaentry"];
18383
18384    #[must_use]
18385    pub const fn name(&self) -> &'static str {
18386        match self {
18387            Self::Liveentry(_) => "Liveentry",
18388            Self::Initentry(_) => "Initentry",
18389            Self::Deadentry(_) => "Deadentry",
18390            Self::Metaentry(_) => "Metaentry",
18391        }
18392    }
18393
18394    #[must_use]
18395    pub const fn discriminant(&self) -> BucketEntryType {
18396        #[allow(clippy::match_same_arms)]
18397        match self {
18398            Self::Liveentry(_) => BucketEntryType::Liveentry,
18399            Self::Initentry(_) => BucketEntryType::Initentry,
18400            Self::Deadentry(_) => BucketEntryType::Deadentry,
18401            Self::Metaentry(_) => BucketEntryType::Metaentry,
18402        }
18403    }
18404
18405    #[must_use]
18406    pub const fn variants() -> [BucketEntryType; 4] {
18407        Self::VARIANTS
18408    }
18409}
18410
18411impl Name for BucketEntry {
18412    #[must_use]
18413    fn name(&self) -> &'static str {
18414        Self::name(self)
18415    }
18416}
18417
18418impl Discriminant<BucketEntryType> for BucketEntry {
18419    #[must_use]
18420    fn discriminant(&self) -> BucketEntryType {
18421        Self::discriminant(self)
18422    }
18423}
18424
18425impl Variants<BucketEntryType> for BucketEntry {
18426    fn variants() -> slice::Iter<'static, BucketEntryType> {
18427        Self::VARIANTS.iter()
18428    }
18429}
18430
18431impl Union<BucketEntryType> for BucketEntry {}
18432
18433impl ReadXdr for BucketEntry {
18434    #[cfg(feature = "std")]
18435    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
18436        r.with_limited_depth(|r| {
18437            let dv: BucketEntryType = <BucketEntryType as ReadXdr>::read_xdr(r)?;
18438            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
18439            let v = match dv {
18440                BucketEntryType::Liveentry => Self::Liveentry(LedgerEntry::read_xdr(r)?),
18441                BucketEntryType::Initentry => Self::Initentry(LedgerEntry::read_xdr(r)?),
18442                BucketEntryType::Deadentry => Self::Deadentry(LedgerKey::read_xdr(r)?),
18443                BucketEntryType::Metaentry => Self::Metaentry(BucketMetadata::read_xdr(r)?),
18444                #[allow(unreachable_patterns)]
18445                _ => return Err(Error::Invalid),
18446            };
18447            Ok(v)
18448        })
18449    }
18450}
18451
18452impl WriteXdr for BucketEntry {
18453    #[cfg(feature = "std")]
18454    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
18455        w.with_limited_depth(|w| {
18456            self.discriminant().write_xdr(w)?;
18457            #[allow(clippy::match_same_arms)]
18458            match self {
18459                Self::Liveentry(v) => v.write_xdr(w)?,
18460                Self::Initentry(v) => v.write_xdr(w)?,
18461                Self::Deadentry(v) => v.write_xdr(w)?,
18462                Self::Metaentry(v) => v.write_xdr(w)?,
18463            };
18464            Ok(())
18465        })
18466    }
18467}
18468
18469/// HotArchiveBucketEntry is an XDR Union defines as:
18470///
18471/// ```text
18472/// union HotArchiveBucketEntry switch (HotArchiveBucketEntryType type)
18473/// {
18474/// case HOT_ARCHIVE_ARCHIVED:
18475///     LedgerEntry archivedEntry;
18476///
18477/// case HOT_ARCHIVE_LIVE:
18478/// case HOT_ARCHIVE_DELETED:
18479///     LedgerKey key;
18480/// case HOT_ARCHIVE_METAENTRY:
18481///     BucketMetadata metaEntry;
18482/// };
18483/// ```
18484///
18485// union with discriminant HotArchiveBucketEntryType
18486#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
18487#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
18488#[cfg_attr(
18489    all(feature = "serde", feature = "alloc"),
18490    derive(serde::Serialize, serde::Deserialize),
18491    serde(rename_all = "snake_case")
18492)]
18493#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
18494#[allow(clippy::large_enum_variant)]
18495pub enum HotArchiveBucketEntry {
18496    Archived(LedgerEntry),
18497    Live(LedgerKey),
18498    Deleted(LedgerKey),
18499    Metaentry(BucketMetadata),
18500}
18501
18502impl HotArchiveBucketEntry {
18503    pub const VARIANTS: [HotArchiveBucketEntryType; 4] = [
18504        HotArchiveBucketEntryType::Archived,
18505        HotArchiveBucketEntryType::Live,
18506        HotArchiveBucketEntryType::Deleted,
18507        HotArchiveBucketEntryType::Metaentry,
18508    ];
18509    pub const VARIANTS_STR: [&'static str; 4] = ["Archived", "Live", "Deleted", "Metaentry"];
18510
18511    #[must_use]
18512    pub const fn name(&self) -> &'static str {
18513        match self {
18514            Self::Archived(_) => "Archived",
18515            Self::Live(_) => "Live",
18516            Self::Deleted(_) => "Deleted",
18517            Self::Metaentry(_) => "Metaentry",
18518        }
18519    }
18520
18521    #[must_use]
18522    pub const fn discriminant(&self) -> HotArchiveBucketEntryType {
18523        #[allow(clippy::match_same_arms)]
18524        match self {
18525            Self::Archived(_) => HotArchiveBucketEntryType::Archived,
18526            Self::Live(_) => HotArchiveBucketEntryType::Live,
18527            Self::Deleted(_) => HotArchiveBucketEntryType::Deleted,
18528            Self::Metaentry(_) => HotArchiveBucketEntryType::Metaentry,
18529        }
18530    }
18531
18532    #[must_use]
18533    pub const fn variants() -> [HotArchiveBucketEntryType; 4] {
18534        Self::VARIANTS
18535    }
18536}
18537
18538impl Name for HotArchiveBucketEntry {
18539    #[must_use]
18540    fn name(&self) -> &'static str {
18541        Self::name(self)
18542    }
18543}
18544
18545impl Discriminant<HotArchiveBucketEntryType> for HotArchiveBucketEntry {
18546    #[must_use]
18547    fn discriminant(&self) -> HotArchiveBucketEntryType {
18548        Self::discriminant(self)
18549    }
18550}
18551
18552impl Variants<HotArchiveBucketEntryType> for HotArchiveBucketEntry {
18553    fn variants() -> slice::Iter<'static, HotArchiveBucketEntryType> {
18554        Self::VARIANTS.iter()
18555    }
18556}
18557
18558impl Union<HotArchiveBucketEntryType> for HotArchiveBucketEntry {}
18559
18560impl ReadXdr for HotArchiveBucketEntry {
18561    #[cfg(feature = "std")]
18562    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
18563        r.with_limited_depth(|r| {
18564            let dv: HotArchiveBucketEntryType =
18565                <HotArchiveBucketEntryType as ReadXdr>::read_xdr(r)?;
18566            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
18567            let v = match dv {
18568                HotArchiveBucketEntryType::Archived => Self::Archived(LedgerEntry::read_xdr(r)?),
18569                HotArchiveBucketEntryType::Live => Self::Live(LedgerKey::read_xdr(r)?),
18570                HotArchiveBucketEntryType::Deleted => Self::Deleted(LedgerKey::read_xdr(r)?),
18571                HotArchiveBucketEntryType::Metaentry => {
18572                    Self::Metaentry(BucketMetadata::read_xdr(r)?)
18573                }
18574                #[allow(unreachable_patterns)]
18575                _ => return Err(Error::Invalid),
18576            };
18577            Ok(v)
18578        })
18579    }
18580}
18581
18582impl WriteXdr for HotArchiveBucketEntry {
18583    #[cfg(feature = "std")]
18584    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
18585        w.with_limited_depth(|w| {
18586            self.discriminant().write_xdr(w)?;
18587            #[allow(clippy::match_same_arms)]
18588            match self {
18589                Self::Archived(v) => v.write_xdr(w)?,
18590                Self::Live(v) => v.write_xdr(w)?,
18591                Self::Deleted(v) => v.write_xdr(w)?,
18592                Self::Metaentry(v) => v.write_xdr(w)?,
18593            };
18594            Ok(())
18595        })
18596    }
18597}
18598
18599/// ColdArchiveArchivedLeaf is an XDR Struct defines as:
18600///
18601/// ```text
18602/// struct ColdArchiveArchivedLeaf
18603/// {
18604///     uint32 index;
18605///     LedgerEntry archivedEntry;
18606/// };
18607/// ```
18608///
18609#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
18610#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
18611#[cfg_attr(
18612    all(feature = "serde", feature = "alloc"),
18613    derive(serde::Serialize, serde::Deserialize),
18614    serde(rename_all = "snake_case")
18615)]
18616#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
18617pub struct ColdArchiveArchivedLeaf {
18618    pub index: u32,
18619    pub archived_entry: LedgerEntry,
18620}
18621
18622impl ReadXdr for ColdArchiveArchivedLeaf {
18623    #[cfg(feature = "std")]
18624    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
18625        r.with_limited_depth(|r| {
18626            Ok(Self {
18627                index: u32::read_xdr(r)?,
18628                archived_entry: LedgerEntry::read_xdr(r)?,
18629            })
18630        })
18631    }
18632}
18633
18634impl WriteXdr for ColdArchiveArchivedLeaf {
18635    #[cfg(feature = "std")]
18636    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
18637        w.with_limited_depth(|w| {
18638            self.index.write_xdr(w)?;
18639            self.archived_entry.write_xdr(w)?;
18640            Ok(())
18641        })
18642    }
18643}
18644
18645/// ColdArchiveDeletedLeaf is an XDR Struct defines as:
18646///
18647/// ```text
18648/// struct ColdArchiveDeletedLeaf
18649/// {
18650///     uint32 index;
18651///     LedgerKey deletedKey;
18652/// };
18653/// ```
18654///
18655#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
18656#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
18657#[cfg_attr(
18658    all(feature = "serde", feature = "alloc"),
18659    derive(serde::Serialize, serde::Deserialize),
18660    serde(rename_all = "snake_case")
18661)]
18662#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
18663pub struct ColdArchiveDeletedLeaf {
18664    pub index: u32,
18665    pub deleted_key: LedgerKey,
18666}
18667
18668impl ReadXdr for ColdArchiveDeletedLeaf {
18669    #[cfg(feature = "std")]
18670    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
18671        r.with_limited_depth(|r| {
18672            Ok(Self {
18673                index: u32::read_xdr(r)?,
18674                deleted_key: LedgerKey::read_xdr(r)?,
18675            })
18676        })
18677    }
18678}
18679
18680impl WriteXdr for ColdArchiveDeletedLeaf {
18681    #[cfg(feature = "std")]
18682    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
18683        w.with_limited_depth(|w| {
18684            self.index.write_xdr(w)?;
18685            self.deleted_key.write_xdr(w)?;
18686            Ok(())
18687        })
18688    }
18689}
18690
18691/// ColdArchiveBoundaryLeaf is an XDR Struct defines as:
18692///
18693/// ```text
18694/// struct ColdArchiveBoundaryLeaf
18695/// {
18696///     uint32 index;
18697///     bool isLowerBound;
18698/// };
18699/// ```
18700///
18701#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
18702#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
18703#[cfg_attr(
18704    all(feature = "serde", feature = "alloc"),
18705    derive(serde::Serialize, serde::Deserialize),
18706    serde(rename_all = "snake_case")
18707)]
18708#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
18709pub struct ColdArchiveBoundaryLeaf {
18710    pub index: u32,
18711    pub is_lower_bound: bool,
18712}
18713
18714impl ReadXdr for ColdArchiveBoundaryLeaf {
18715    #[cfg(feature = "std")]
18716    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
18717        r.with_limited_depth(|r| {
18718            Ok(Self {
18719                index: u32::read_xdr(r)?,
18720                is_lower_bound: bool::read_xdr(r)?,
18721            })
18722        })
18723    }
18724}
18725
18726impl WriteXdr for ColdArchiveBoundaryLeaf {
18727    #[cfg(feature = "std")]
18728    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
18729        w.with_limited_depth(|w| {
18730            self.index.write_xdr(w)?;
18731            self.is_lower_bound.write_xdr(w)?;
18732            Ok(())
18733        })
18734    }
18735}
18736
18737/// ColdArchiveHashEntry is an XDR Struct defines as:
18738///
18739/// ```text
18740/// struct ColdArchiveHashEntry
18741/// {
18742///     uint32 index;
18743///     uint32 level;
18744///     Hash hash;
18745/// };
18746/// ```
18747///
18748#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
18749#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
18750#[cfg_attr(
18751    all(feature = "serde", feature = "alloc"),
18752    derive(serde::Serialize, serde::Deserialize),
18753    serde(rename_all = "snake_case")
18754)]
18755#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
18756pub struct ColdArchiveHashEntry {
18757    pub index: u32,
18758    pub level: u32,
18759    pub hash: Hash,
18760}
18761
18762impl ReadXdr for ColdArchiveHashEntry {
18763    #[cfg(feature = "std")]
18764    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
18765        r.with_limited_depth(|r| {
18766            Ok(Self {
18767                index: u32::read_xdr(r)?,
18768                level: u32::read_xdr(r)?,
18769                hash: Hash::read_xdr(r)?,
18770            })
18771        })
18772    }
18773}
18774
18775impl WriteXdr for ColdArchiveHashEntry {
18776    #[cfg(feature = "std")]
18777    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
18778        w.with_limited_depth(|w| {
18779            self.index.write_xdr(w)?;
18780            self.level.write_xdr(w)?;
18781            self.hash.write_xdr(w)?;
18782            Ok(())
18783        })
18784    }
18785}
18786
18787/// ColdArchiveBucketEntry is an XDR Union defines as:
18788///
18789/// ```text
18790/// union ColdArchiveBucketEntry switch (ColdArchiveBucketEntryType type)
18791/// {
18792/// case COLD_ARCHIVE_METAENTRY:
18793///     BucketMetadata metaEntry;
18794/// case COLD_ARCHIVE_ARCHIVED_LEAF:
18795///     ColdArchiveArchivedLeaf archivedLeaf;
18796/// case COLD_ARCHIVE_DELETED_LEAF:
18797///     ColdArchiveDeletedLeaf deletedLeaf;
18798/// case COLD_ARCHIVE_BOUNDARY_LEAF:
18799///     ColdArchiveBoundaryLeaf boundaryLeaf;
18800/// case COLD_ARCHIVE_HASH:
18801///     ColdArchiveHashEntry hashEntry;
18802/// };
18803/// ```
18804///
18805// union with discriminant ColdArchiveBucketEntryType
18806#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
18807#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
18808#[cfg_attr(
18809    all(feature = "serde", feature = "alloc"),
18810    derive(serde::Serialize, serde::Deserialize),
18811    serde(rename_all = "snake_case")
18812)]
18813#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
18814#[allow(clippy::large_enum_variant)]
18815pub enum ColdArchiveBucketEntry {
18816    Metaentry(BucketMetadata),
18817    ArchivedLeaf(ColdArchiveArchivedLeaf),
18818    DeletedLeaf(ColdArchiveDeletedLeaf),
18819    BoundaryLeaf(ColdArchiveBoundaryLeaf),
18820    Hash(ColdArchiveHashEntry),
18821}
18822
18823impl ColdArchiveBucketEntry {
18824    pub const VARIANTS: [ColdArchiveBucketEntryType; 5] = [
18825        ColdArchiveBucketEntryType::Metaentry,
18826        ColdArchiveBucketEntryType::ArchivedLeaf,
18827        ColdArchiveBucketEntryType::DeletedLeaf,
18828        ColdArchiveBucketEntryType::BoundaryLeaf,
18829        ColdArchiveBucketEntryType::Hash,
18830    ];
18831    pub const VARIANTS_STR: [&'static str; 5] = [
18832        "Metaentry",
18833        "ArchivedLeaf",
18834        "DeletedLeaf",
18835        "BoundaryLeaf",
18836        "Hash",
18837    ];
18838
18839    #[must_use]
18840    pub const fn name(&self) -> &'static str {
18841        match self {
18842            Self::Metaentry(_) => "Metaentry",
18843            Self::ArchivedLeaf(_) => "ArchivedLeaf",
18844            Self::DeletedLeaf(_) => "DeletedLeaf",
18845            Self::BoundaryLeaf(_) => "BoundaryLeaf",
18846            Self::Hash(_) => "Hash",
18847        }
18848    }
18849
18850    #[must_use]
18851    pub const fn discriminant(&self) -> ColdArchiveBucketEntryType {
18852        #[allow(clippy::match_same_arms)]
18853        match self {
18854            Self::Metaentry(_) => ColdArchiveBucketEntryType::Metaentry,
18855            Self::ArchivedLeaf(_) => ColdArchiveBucketEntryType::ArchivedLeaf,
18856            Self::DeletedLeaf(_) => ColdArchiveBucketEntryType::DeletedLeaf,
18857            Self::BoundaryLeaf(_) => ColdArchiveBucketEntryType::BoundaryLeaf,
18858            Self::Hash(_) => ColdArchiveBucketEntryType::Hash,
18859        }
18860    }
18861
18862    #[must_use]
18863    pub const fn variants() -> [ColdArchiveBucketEntryType; 5] {
18864        Self::VARIANTS
18865    }
18866}
18867
18868impl Name for ColdArchiveBucketEntry {
18869    #[must_use]
18870    fn name(&self) -> &'static str {
18871        Self::name(self)
18872    }
18873}
18874
18875impl Discriminant<ColdArchiveBucketEntryType> for ColdArchiveBucketEntry {
18876    #[must_use]
18877    fn discriminant(&self) -> ColdArchiveBucketEntryType {
18878        Self::discriminant(self)
18879    }
18880}
18881
18882impl Variants<ColdArchiveBucketEntryType> for ColdArchiveBucketEntry {
18883    fn variants() -> slice::Iter<'static, ColdArchiveBucketEntryType> {
18884        Self::VARIANTS.iter()
18885    }
18886}
18887
18888impl Union<ColdArchiveBucketEntryType> for ColdArchiveBucketEntry {}
18889
18890impl ReadXdr for ColdArchiveBucketEntry {
18891    #[cfg(feature = "std")]
18892    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
18893        r.with_limited_depth(|r| {
18894            let dv: ColdArchiveBucketEntryType =
18895                <ColdArchiveBucketEntryType as ReadXdr>::read_xdr(r)?;
18896            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
18897            let v = match dv {
18898                ColdArchiveBucketEntryType::Metaentry => {
18899                    Self::Metaentry(BucketMetadata::read_xdr(r)?)
18900                }
18901                ColdArchiveBucketEntryType::ArchivedLeaf => {
18902                    Self::ArchivedLeaf(ColdArchiveArchivedLeaf::read_xdr(r)?)
18903                }
18904                ColdArchiveBucketEntryType::DeletedLeaf => {
18905                    Self::DeletedLeaf(ColdArchiveDeletedLeaf::read_xdr(r)?)
18906                }
18907                ColdArchiveBucketEntryType::BoundaryLeaf => {
18908                    Self::BoundaryLeaf(ColdArchiveBoundaryLeaf::read_xdr(r)?)
18909                }
18910                ColdArchiveBucketEntryType::Hash => Self::Hash(ColdArchiveHashEntry::read_xdr(r)?),
18911                #[allow(unreachable_patterns)]
18912                _ => return Err(Error::Invalid),
18913            };
18914            Ok(v)
18915        })
18916    }
18917}
18918
18919impl WriteXdr for ColdArchiveBucketEntry {
18920    #[cfg(feature = "std")]
18921    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
18922        w.with_limited_depth(|w| {
18923            self.discriminant().write_xdr(w)?;
18924            #[allow(clippy::match_same_arms)]
18925            match self {
18926                Self::Metaentry(v) => v.write_xdr(w)?,
18927                Self::ArchivedLeaf(v) => v.write_xdr(w)?,
18928                Self::DeletedLeaf(v) => v.write_xdr(w)?,
18929                Self::BoundaryLeaf(v) => v.write_xdr(w)?,
18930                Self::Hash(v) => v.write_xdr(w)?,
18931            };
18932            Ok(())
18933        })
18934    }
18935}
18936
18937/// UpgradeType is an XDR Typedef defines as:
18938///
18939/// ```text
18940/// typedef opaque UpgradeType<128>;
18941/// ```
18942///
18943#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
18944#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
18945#[derive(Default)]
18946#[cfg_attr(
18947    all(feature = "serde", feature = "alloc"),
18948    derive(serde::Serialize, serde::Deserialize),
18949    serde(rename_all = "snake_case")
18950)]
18951#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
18952#[derive(Debug)]
18953pub struct UpgradeType(pub BytesM<128>);
18954
18955impl From<UpgradeType> for BytesM<128> {
18956    #[must_use]
18957    fn from(x: UpgradeType) -> Self {
18958        x.0
18959    }
18960}
18961
18962impl From<BytesM<128>> for UpgradeType {
18963    #[must_use]
18964    fn from(x: BytesM<128>) -> Self {
18965        UpgradeType(x)
18966    }
18967}
18968
18969impl AsRef<BytesM<128>> for UpgradeType {
18970    #[must_use]
18971    fn as_ref(&self) -> &BytesM<128> {
18972        &self.0
18973    }
18974}
18975
18976impl ReadXdr for UpgradeType {
18977    #[cfg(feature = "std")]
18978    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
18979        r.with_limited_depth(|r| {
18980            let i = BytesM::<128>::read_xdr(r)?;
18981            let v = UpgradeType(i);
18982            Ok(v)
18983        })
18984    }
18985}
18986
18987impl WriteXdr for UpgradeType {
18988    #[cfg(feature = "std")]
18989    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
18990        w.with_limited_depth(|w| self.0.write_xdr(w))
18991    }
18992}
18993
18994impl Deref for UpgradeType {
18995    type Target = BytesM<128>;
18996    fn deref(&self) -> &Self::Target {
18997        &self.0
18998    }
18999}
19000
19001impl From<UpgradeType> for Vec<u8> {
19002    #[must_use]
19003    fn from(x: UpgradeType) -> Self {
19004        x.0 .0
19005    }
19006}
19007
19008impl TryFrom<Vec<u8>> for UpgradeType {
19009    type Error = Error;
19010    fn try_from(x: Vec<u8>) -> Result<Self> {
19011        Ok(UpgradeType(x.try_into()?))
19012    }
19013}
19014
19015#[cfg(feature = "alloc")]
19016impl TryFrom<&Vec<u8>> for UpgradeType {
19017    type Error = Error;
19018    fn try_from(x: &Vec<u8>) -> Result<Self> {
19019        Ok(UpgradeType(x.try_into()?))
19020    }
19021}
19022
19023impl AsRef<Vec<u8>> for UpgradeType {
19024    #[must_use]
19025    fn as_ref(&self) -> &Vec<u8> {
19026        &self.0 .0
19027    }
19028}
19029
19030impl AsRef<[u8]> for UpgradeType {
19031    #[cfg(feature = "alloc")]
19032    #[must_use]
19033    fn as_ref(&self) -> &[u8] {
19034        &self.0 .0
19035    }
19036    #[cfg(not(feature = "alloc"))]
19037    #[must_use]
19038    fn as_ref(&self) -> &[u8] {
19039        self.0 .0
19040    }
19041}
19042
19043/// StellarValueType is an XDR Enum defines as:
19044///
19045/// ```text
19046/// enum StellarValueType
19047/// {
19048///     STELLAR_VALUE_BASIC = 0,
19049///     STELLAR_VALUE_SIGNED = 1
19050/// };
19051/// ```
19052///
19053// enum
19054#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
19055#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
19056#[cfg_attr(
19057    all(feature = "serde", feature = "alloc"),
19058    derive(serde::Serialize, serde::Deserialize),
19059    serde(rename_all = "snake_case")
19060)]
19061#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
19062#[repr(i32)]
19063pub enum StellarValueType {
19064    Basic = 0,
19065    Signed = 1,
19066}
19067
19068impl StellarValueType {
19069    pub const VARIANTS: [StellarValueType; 2] = [StellarValueType::Basic, StellarValueType::Signed];
19070    pub const VARIANTS_STR: [&'static str; 2] = ["Basic", "Signed"];
19071
19072    #[must_use]
19073    pub const fn name(&self) -> &'static str {
19074        match self {
19075            Self::Basic => "Basic",
19076            Self::Signed => "Signed",
19077        }
19078    }
19079
19080    #[must_use]
19081    pub const fn variants() -> [StellarValueType; 2] {
19082        Self::VARIANTS
19083    }
19084}
19085
19086impl Name for StellarValueType {
19087    #[must_use]
19088    fn name(&self) -> &'static str {
19089        Self::name(self)
19090    }
19091}
19092
19093impl Variants<StellarValueType> for StellarValueType {
19094    fn variants() -> slice::Iter<'static, StellarValueType> {
19095        Self::VARIANTS.iter()
19096    }
19097}
19098
19099impl Enum for StellarValueType {}
19100
19101impl fmt::Display for StellarValueType {
19102    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
19103        f.write_str(self.name())
19104    }
19105}
19106
19107impl TryFrom<i32> for StellarValueType {
19108    type Error = Error;
19109
19110    fn try_from(i: i32) -> Result<Self> {
19111        let e = match i {
19112            0 => StellarValueType::Basic,
19113            1 => StellarValueType::Signed,
19114            #[allow(unreachable_patterns)]
19115            _ => return Err(Error::Invalid),
19116        };
19117        Ok(e)
19118    }
19119}
19120
19121impl From<StellarValueType> for i32 {
19122    #[must_use]
19123    fn from(e: StellarValueType) -> Self {
19124        e as Self
19125    }
19126}
19127
19128impl ReadXdr for StellarValueType {
19129    #[cfg(feature = "std")]
19130    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
19131        r.with_limited_depth(|r| {
19132            let e = i32::read_xdr(r)?;
19133            let v: Self = e.try_into()?;
19134            Ok(v)
19135        })
19136    }
19137}
19138
19139impl WriteXdr for StellarValueType {
19140    #[cfg(feature = "std")]
19141    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
19142        w.with_limited_depth(|w| {
19143            let i: i32 = (*self).into();
19144            i.write_xdr(w)
19145        })
19146    }
19147}
19148
19149/// LedgerCloseValueSignature is an XDR Struct defines as:
19150///
19151/// ```text
19152/// struct LedgerCloseValueSignature
19153/// {
19154///     NodeID nodeID;       // which node introduced the value
19155///     Signature signature; // nodeID's signature
19156/// };
19157/// ```
19158///
19159#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
19160#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
19161#[cfg_attr(
19162    all(feature = "serde", feature = "alloc"),
19163    derive(serde::Serialize, serde::Deserialize),
19164    serde(rename_all = "snake_case")
19165)]
19166#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
19167pub struct LedgerCloseValueSignature {
19168    pub node_id: NodeId,
19169    pub signature: Signature,
19170}
19171
19172impl ReadXdr for LedgerCloseValueSignature {
19173    #[cfg(feature = "std")]
19174    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
19175        r.with_limited_depth(|r| {
19176            Ok(Self {
19177                node_id: NodeId::read_xdr(r)?,
19178                signature: Signature::read_xdr(r)?,
19179            })
19180        })
19181    }
19182}
19183
19184impl WriteXdr for LedgerCloseValueSignature {
19185    #[cfg(feature = "std")]
19186    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
19187        w.with_limited_depth(|w| {
19188            self.node_id.write_xdr(w)?;
19189            self.signature.write_xdr(w)?;
19190            Ok(())
19191        })
19192    }
19193}
19194
19195/// StellarValueExt is an XDR NestedUnion defines as:
19196///
19197/// ```text
19198/// union switch (StellarValueType v)
19199///     {
19200///     case STELLAR_VALUE_BASIC:
19201///         void;
19202///     case STELLAR_VALUE_SIGNED:
19203///         LedgerCloseValueSignature lcValueSignature;
19204///     }
19205/// ```
19206///
19207// union with discriminant StellarValueType
19208#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
19209#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
19210#[cfg_attr(
19211    all(feature = "serde", feature = "alloc"),
19212    derive(serde::Serialize, serde::Deserialize),
19213    serde(rename_all = "snake_case")
19214)]
19215#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
19216#[allow(clippy::large_enum_variant)]
19217pub enum StellarValueExt {
19218    Basic,
19219    Signed(LedgerCloseValueSignature),
19220}
19221
19222impl StellarValueExt {
19223    pub const VARIANTS: [StellarValueType; 2] = [StellarValueType::Basic, StellarValueType::Signed];
19224    pub const VARIANTS_STR: [&'static str; 2] = ["Basic", "Signed"];
19225
19226    #[must_use]
19227    pub const fn name(&self) -> &'static str {
19228        match self {
19229            Self::Basic => "Basic",
19230            Self::Signed(_) => "Signed",
19231        }
19232    }
19233
19234    #[must_use]
19235    pub const fn discriminant(&self) -> StellarValueType {
19236        #[allow(clippy::match_same_arms)]
19237        match self {
19238            Self::Basic => StellarValueType::Basic,
19239            Self::Signed(_) => StellarValueType::Signed,
19240        }
19241    }
19242
19243    #[must_use]
19244    pub const fn variants() -> [StellarValueType; 2] {
19245        Self::VARIANTS
19246    }
19247}
19248
19249impl Name for StellarValueExt {
19250    #[must_use]
19251    fn name(&self) -> &'static str {
19252        Self::name(self)
19253    }
19254}
19255
19256impl Discriminant<StellarValueType> for StellarValueExt {
19257    #[must_use]
19258    fn discriminant(&self) -> StellarValueType {
19259        Self::discriminant(self)
19260    }
19261}
19262
19263impl Variants<StellarValueType> for StellarValueExt {
19264    fn variants() -> slice::Iter<'static, StellarValueType> {
19265        Self::VARIANTS.iter()
19266    }
19267}
19268
19269impl Union<StellarValueType> for StellarValueExt {}
19270
19271impl ReadXdr for StellarValueExt {
19272    #[cfg(feature = "std")]
19273    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
19274        r.with_limited_depth(|r| {
19275            let dv: StellarValueType = <StellarValueType as ReadXdr>::read_xdr(r)?;
19276            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
19277            let v = match dv {
19278                StellarValueType::Basic => Self::Basic,
19279                StellarValueType::Signed => Self::Signed(LedgerCloseValueSignature::read_xdr(r)?),
19280                #[allow(unreachable_patterns)]
19281                _ => return Err(Error::Invalid),
19282            };
19283            Ok(v)
19284        })
19285    }
19286}
19287
19288impl WriteXdr for StellarValueExt {
19289    #[cfg(feature = "std")]
19290    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
19291        w.with_limited_depth(|w| {
19292            self.discriminant().write_xdr(w)?;
19293            #[allow(clippy::match_same_arms)]
19294            match self {
19295                Self::Basic => ().write_xdr(w)?,
19296                Self::Signed(v) => v.write_xdr(w)?,
19297            };
19298            Ok(())
19299        })
19300    }
19301}
19302
19303/// StellarValue is an XDR Struct defines as:
19304///
19305/// ```text
19306/// struct StellarValue
19307/// {
19308///     Hash txSetHash;      // transaction set to apply to previous ledger
19309///     TimePoint closeTime; // network close time
19310///
19311///     // upgrades to apply to the previous ledger (usually empty)
19312///     // this is a vector of encoded 'LedgerUpgrade' so that nodes can drop
19313///     // unknown steps during consensus if needed.
19314///     // see notes below on 'LedgerUpgrade' for more detail
19315///     // max size is dictated by number of upgrade types (+ room for future)
19316///     UpgradeType upgrades<6>;
19317///
19318///     // reserved for future use
19319///     union switch (StellarValueType v)
19320///     {
19321///     case STELLAR_VALUE_BASIC:
19322///         void;
19323///     case STELLAR_VALUE_SIGNED:
19324///         LedgerCloseValueSignature lcValueSignature;
19325///     }
19326///     ext;
19327/// };
19328/// ```
19329///
19330#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
19331#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
19332#[cfg_attr(
19333    all(feature = "serde", feature = "alloc"),
19334    derive(serde::Serialize, serde::Deserialize),
19335    serde(rename_all = "snake_case")
19336)]
19337#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
19338pub struct StellarValue {
19339    pub tx_set_hash: Hash,
19340    pub close_time: TimePoint,
19341    pub upgrades: VecM<UpgradeType, 6>,
19342    pub ext: StellarValueExt,
19343}
19344
19345impl ReadXdr for StellarValue {
19346    #[cfg(feature = "std")]
19347    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
19348        r.with_limited_depth(|r| {
19349            Ok(Self {
19350                tx_set_hash: Hash::read_xdr(r)?,
19351                close_time: TimePoint::read_xdr(r)?,
19352                upgrades: VecM::<UpgradeType, 6>::read_xdr(r)?,
19353                ext: StellarValueExt::read_xdr(r)?,
19354            })
19355        })
19356    }
19357}
19358
19359impl WriteXdr for StellarValue {
19360    #[cfg(feature = "std")]
19361    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
19362        w.with_limited_depth(|w| {
19363            self.tx_set_hash.write_xdr(w)?;
19364            self.close_time.write_xdr(w)?;
19365            self.upgrades.write_xdr(w)?;
19366            self.ext.write_xdr(w)?;
19367            Ok(())
19368        })
19369    }
19370}
19371
19372/// MaskLedgerHeaderFlags is an XDR Const defines as:
19373///
19374/// ```text
19375/// const MASK_LEDGER_HEADER_FLAGS = 0x7;
19376/// ```
19377///
19378pub const MASK_LEDGER_HEADER_FLAGS: u64 = 0x7;
19379
19380/// LedgerHeaderFlags is an XDR Enum defines as:
19381///
19382/// ```text
19383/// enum LedgerHeaderFlags
19384/// {
19385///     DISABLE_LIQUIDITY_POOL_TRADING_FLAG = 0x1,
19386///     DISABLE_LIQUIDITY_POOL_DEPOSIT_FLAG = 0x2,
19387///     DISABLE_LIQUIDITY_POOL_WITHDRAWAL_FLAG = 0x4
19388/// };
19389/// ```
19390///
19391// enum
19392#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
19393#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
19394#[cfg_attr(
19395    all(feature = "serde", feature = "alloc"),
19396    derive(serde::Serialize, serde::Deserialize),
19397    serde(rename_all = "snake_case")
19398)]
19399#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
19400#[repr(i32)]
19401pub enum LedgerHeaderFlags {
19402    TradingFlag = 1,
19403    DepositFlag = 2,
19404    WithdrawalFlag = 4,
19405}
19406
19407impl LedgerHeaderFlags {
19408    pub const VARIANTS: [LedgerHeaderFlags; 3] = [
19409        LedgerHeaderFlags::TradingFlag,
19410        LedgerHeaderFlags::DepositFlag,
19411        LedgerHeaderFlags::WithdrawalFlag,
19412    ];
19413    pub const VARIANTS_STR: [&'static str; 3] = ["TradingFlag", "DepositFlag", "WithdrawalFlag"];
19414
19415    #[must_use]
19416    pub const fn name(&self) -> &'static str {
19417        match self {
19418            Self::TradingFlag => "TradingFlag",
19419            Self::DepositFlag => "DepositFlag",
19420            Self::WithdrawalFlag => "WithdrawalFlag",
19421        }
19422    }
19423
19424    #[must_use]
19425    pub const fn variants() -> [LedgerHeaderFlags; 3] {
19426        Self::VARIANTS
19427    }
19428}
19429
19430impl Name for LedgerHeaderFlags {
19431    #[must_use]
19432    fn name(&self) -> &'static str {
19433        Self::name(self)
19434    }
19435}
19436
19437impl Variants<LedgerHeaderFlags> for LedgerHeaderFlags {
19438    fn variants() -> slice::Iter<'static, LedgerHeaderFlags> {
19439        Self::VARIANTS.iter()
19440    }
19441}
19442
19443impl Enum for LedgerHeaderFlags {}
19444
19445impl fmt::Display for LedgerHeaderFlags {
19446    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
19447        f.write_str(self.name())
19448    }
19449}
19450
19451impl TryFrom<i32> for LedgerHeaderFlags {
19452    type Error = Error;
19453
19454    fn try_from(i: i32) -> Result<Self> {
19455        let e = match i {
19456            1 => LedgerHeaderFlags::TradingFlag,
19457            2 => LedgerHeaderFlags::DepositFlag,
19458            4 => LedgerHeaderFlags::WithdrawalFlag,
19459            #[allow(unreachable_patterns)]
19460            _ => return Err(Error::Invalid),
19461        };
19462        Ok(e)
19463    }
19464}
19465
19466impl From<LedgerHeaderFlags> for i32 {
19467    #[must_use]
19468    fn from(e: LedgerHeaderFlags) -> Self {
19469        e as Self
19470    }
19471}
19472
19473impl ReadXdr for LedgerHeaderFlags {
19474    #[cfg(feature = "std")]
19475    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
19476        r.with_limited_depth(|r| {
19477            let e = i32::read_xdr(r)?;
19478            let v: Self = e.try_into()?;
19479            Ok(v)
19480        })
19481    }
19482}
19483
19484impl WriteXdr for LedgerHeaderFlags {
19485    #[cfg(feature = "std")]
19486    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
19487        w.with_limited_depth(|w| {
19488            let i: i32 = (*self).into();
19489            i.write_xdr(w)
19490        })
19491    }
19492}
19493
19494/// LedgerHeaderExtensionV1Ext is an XDR NestedUnion defines as:
19495///
19496/// ```text
19497/// union switch (int v)
19498///     {
19499///     case 0:
19500///         void;
19501///     }
19502/// ```
19503///
19504// union with discriminant i32
19505#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
19506#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
19507#[cfg_attr(
19508    all(feature = "serde", feature = "alloc"),
19509    derive(serde::Serialize, serde::Deserialize),
19510    serde(rename_all = "snake_case")
19511)]
19512#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
19513#[allow(clippy::large_enum_variant)]
19514pub enum LedgerHeaderExtensionV1Ext {
19515    V0,
19516}
19517
19518impl LedgerHeaderExtensionV1Ext {
19519    pub const VARIANTS: [i32; 1] = [0];
19520    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
19521
19522    #[must_use]
19523    pub const fn name(&self) -> &'static str {
19524        match self {
19525            Self::V0 => "V0",
19526        }
19527    }
19528
19529    #[must_use]
19530    pub const fn discriminant(&self) -> i32 {
19531        #[allow(clippy::match_same_arms)]
19532        match self {
19533            Self::V0 => 0,
19534        }
19535    }
19536
19537    #[must_use]
19538    pub const fn variants() -> [i32; 1] {
19539        Self::VARIANTS
19540    }
19541}
19542
19543impl Name for LedgerHeaderExtensionV1Ext {
19544    #[must_use]
19545    fn name(&self) -> &'static str {
19546        Self::name(self)
19547    }
19548}
19549
19550impl Discriminant<i32> for LedgerHeaderExtensionV1Ext {
19551    #[must_use]
19552    fn discriminant(&self) -> i32 {
19553        Self::discriminant(self)
19554    }
19555}
19556
19557impl Variants<i32> for LedgerHeaderExtensionV1Ext {
19558    fn variants() -> slice::Iter<'static, i32> {
19559        Self::VARIANTS.iter()
19560    }
19561}
19562
19563impl Union<i32> for LedgerHeaderExtensionV1Ext {}
19564
19565impl ReadXdr for LedgerHeaderExtensionV1Ext {
19566    #[cfg(feature = "std")]
19567    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
19568        r.with_limited_depth(|r| {
19569            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
19570            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
19571            let v = match dv {
19572                0 => Self::V0,
19573                #[allow(unreachable_patterns)]
19574                _ => return Err(Error::Invalid),
19575            };
19576            Ok(v)
19577        })
19578    }
19579}
19580
19581impl WriteXdr for LedgerHeaderExtensionV1Ext {
19582    #[cfg(feature = "std")]
19583    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
19584        w.with_limited_depth(|w| {
19585            self.discriminant().write_xdr(w)?;
19586            #[allow(clippy::match_same_arms)]
19587            match self {
19588                Self::V0 => ().write_xdr(w)?,
19589            };
19590            Ok(())
19591        })
19592    }
19593}
19594
19595/// LedgerHeaderExtensionV1 is an XDR Struct defines as:
19596///
19597/// ```text
19598/// struct LedgerHeaderExtensionV1
19599/// {
19600///     uint32 flags; // LedgerHeaderFlags
19601///
19602///     union switch (int v)
19603///     {
19604///     case 0:
19605///         void;
19606///     }
19607///     ext;
19608/// };
19609/// ```
19610///
19611#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
19612#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
19613#[cfg_attr(
19614    all(feature = "serde", feature = "alloc"),
19615    derive(serde::Serialize, serde::Deserialize),
19616    serde(rename_all = "snake_case")
19617)]
19618#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
19619pub struct LedgerHeaderExtensionV1 {
19620    pub flags: u32,
19621    pub ext: LedgerHeaderExtensionV1Ext,
19622}
19623
19624impl ReadXdr for LedgerHeaderExtensionV1 {
19625    #[cfg(feature = "std")]
19626    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
19627        r.with_limited_depth(|r| {
19628            Ok(Self {
19629                flags: u32::read_xdr(r)?,
19630                ext: LedgerHeaderExtensionV1Ext::read_xdr(r)?,
19631            })
19632        })
19633    }
19634}
19635
19636impl WriteXdr for LedgerHeaderExtensionV1 {
19637    #[cfg(feature = "std")]
19638    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
19639        w.with_limited_depth(|w| {
19640            self.flags.write_xdr(w)?;
19641            self.ext.write_xdr(w)?;
19642            Ok(())
19643        })
19644    }
19645}
19646
19647/// LedgerHeaderExt is an XDR NestedUnion defines as:
19648///
19649/// ```text
19650/// union switch (int v)
19651///     {
19652///     case 0:
19653///         void;
19654///     case 1:
19655///         LedgerHeaderExtensionV1 v1;
19656///     }
19657/// ```
19658///
19659// union with discriminant i32
19660#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
19661#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
19662#[cfg_attr(
19663    all(feature = "serde", feature = "alloc"),
19664    derive(serde::Serialize, serde::Deserialize),
19665    serde(rename_all = "snake_case")
19666)]
19667#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
19668#[allow(clippy::large_enum_variant)]
19669pub enum LedgerHeaderExt {
19670    V0,
19671    V1(LedgerHeaderExtensionV1),
19672}
19673
19674impl LedgerHeaderExt {
19675    pub const VARIANTS: [i32; 2] = [0, 1];
19676    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"];
19677
19678    #[must_use]
19679    pub const fn name(&self) -> &'static str {
19680        match self {
19681            Self::V0 => "V0",
19682            Self::V1(_) => "V1",
19683        }
19684    }
19685
19686    #[must_use]
19687    pub const fn discriminant(&self) -> i32 {
19688        #[allow(clippy::match_same_arms)]
19689        match self {
19690            Self::V0 => 0,
19691            Self::V1(_) => 1,
19692        }
19693    }
19694
19695    #[must_use]
19696    pub const fn variants() -> [i32; 2] {
19697        Self::VARIANTS
19698    }
19699}
19700
19701impl Name for LedgerHeaderExt {
19702    #[must_use]
19703    fn name(&self) -> &'static str {
19704        Self::name(self)
19705    }
19706}
19707
19708impl Discriminant<i32> for LedgerHeaderExt {
19709    #[must_use]
19710    fn discriminant(&self) -> i32 {
19711        Self::discriminant(self)
19712    }
19713}
19714
19715impl Variants<i32> for LedgerHeaderExt {
19716    fn variants() -> slice::Iter<'static, i32> {
19717        Self::VARIANTS.iter()
19718    }
19719}
19720
19721impl Union<i32> for LedgerHeaderExt {}
19722
19723impl ReadXdr for LedgerHeaderExt {
19724    #[cfg(feature = "std")]
19725    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
19726        r.with_limited_depth(|r| {
19727            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
19728            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
19729            let v = match dv {
19730                0 => Self::V0,
19731                1 => Self::V1(LedgerHeaderExtensionV1::read_xdr(r)?),
19732                #[allow(unreachable_patterns)]
19733                _ => return Err(Error::Invalid),
19734            };
19735            Ok(v)
19736        })
19737    }
19738}
19739
19740impl WriteXdr for LedgerHeaderExt {
19741    #[cfg(feature = "std")]
19742    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
19743        w.with_limited_depth(|w| {
19744            self.discriminant().write_xdr(w)?;
19745            #[allow(clippy::match_same_arms)]
19746            match self {
19747                Self::V0 => ().write_xdr(w)?,
19748                Self::V1(v) => v.write_xdr(w)?,
19749            };
19750            Ok(())
19751        })
19752    }
19753}
19754
19755/// LedgerHeader is an XDR Struct defines as:
19756///
19757/// ```text
19758/// struct LedgerHeader
19759/// {
19760///     uint32 ledgerVersion;    // the protocol version of the ledger
19761///     Hash previousLedgerHash; // hash of the previous ledger header
19762///     StellarValue scpValue;   // what consensus agreed to
19763///     Hash txSetResultHash;    // the TransactionResultSet that led to this ledger
19764///     Hash bucketListHash;     // hash of the ledger state
19765///
19766///     uint32 ledgerSeq; // sequence number of this ledger
19767///
19768///     int64 totalCoins; // total number of stroops in existence.
19769///                       // 10,000,000 stroops in 1 XLM
19770///
19771///     int64 feePool;       // fees burned since last inflation run
19772///     uint32 inflationSeq; // inflation sequence number
19773///
19774///     uint64 idPool; // last used global ID, used for generating objects
19775///
19776///     uint32 baseFee;     // base fee per operation in stroops
19777///     uint32 baseReserve; // account base reserve in stroops
19778///
19779///     uint32 maxTxSetSize; // maximum size a transaction set can be
19780///
19781///     Hash skipList[4]; // hashes of ledgers in the past. allows you to jump back
19782///                       // in time without walking the chain back ledger by ledger
19783///                       // each slot contains the oldest ledger that is mod of
19784///                       // either 50  5000  50000 or 500000 depending on index
19785///                       // skipList[0] mod(50), skipList[1] mod(5000), etc
19786///
19787///     // reserved for future use
19788///     union switch (int v)
19789///     {
19790///     case 0:
19791///         void;
19792///     case 1:
19793///         LedgerHeaderExtensionV1 v1;
19794///     }
19795///     ext;
19796/// };
19797/// ```
19798///
19799#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
19800#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
19801#[cfg_attr(
19802    all(feature = "serde", feature = "alloc"),
19803    derive(serde::Serialize, serde::Deserialize),
19804    serde(rename_all = "snake_case")
19805)]
19806#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
19807pub struct LedgerHeader {
19808    pub ledger_version: u32,
19809    pub previous_ledger_hash: Hash,
19810    pub scp_value: StellarValue,
19811    pub tx_set_result_hash: Hash,
19812    pub bucket_list_hash: Hash,
19813    pub ledger_seq: u32,
19814    pub total_coins: i64,
19815    pub fee_pool: i64,
19816    pub inflation_seq: u32,
19817    pub id_pool: u64,
19818    pub base_fee: u32,
19819    pub base_reserve: u32,
19820    pub max_tx_set_size: u32,
19821    pub skip_list: [Hash; 4],
19822    pub ext: LedgerHeaderExt,
19823}
19824
19825impl ReadXdr for LedgerHeader {
19826    #[cfg(feature = "std")]
19827    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
19828        r.with_limited_depth(|r| {
19829            Ok(Self {
19830                ledger_version: u32::read_xdr(r)?,
19831                previous_ledger_hash: Hash::read_xdr(r)?,
19832                scp_value: StellarValue::read_xdr(r)?,
19833                tx_set_result_hash: Hash::read_xdr(r)?,
19834                bucket_list_hash: Hash::read_xdr(r)?,
19835                ledger_seq: u32::read_xdr(r)?,
19836                total_coins: i64::read_xdr(r)?,
19837                fee_pool: i64::read_xdr(r)?,
19838                inflation_seq: u32::read_xdr(r)?,
19839                id_pool: u64::read_xdr(r)?,
19840                base_fee: u32::read_xdr(r)?,
19841                base_reserve: u32::read_xdr(r)?,
19842                max_tx_set_size: u32::read_xdr(r)?,
19843                skip_list: <[Hash; 4]>::read_xdr(r)?,
19844                ext: LedgerHeaderExt::read_xdr(r)?,
19845            })
19846        })
19847    }
19848}
19849
19850impl WriteXdr for LedgerHeader {
19851    #[cfg(feature = "std")]
19852    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
19853        w.with_limited_depth(|w| {
19854            self.ledger_version.write_xdr(w)?;
19855            self.previous_ledger_hash.write_xdr(w)?;
19856            self.scp_value.write_xdr(w)?;
19857            self.tx_set_result_hash.write_xdr(w)?;
19858            self.bucket_list_hash.write_xdr(w)?;
19859            self.ledger_seq.write_xdr(w)?;
19860            self.total_coins.write_xdr(w)?;
19861            self.fee_pool.write_xdr(w)?;
19862            self.inflation_seq.write_xdr(w)?;
19863            self.id_pool.write_xdr(w)?;
19864            self.base_fee.write_xdr(w)?;
19865            self.base_reserve.write_xdr(w)?;
19866            self.max_tx_set_size.write_xdr(w)?;
19867            self.skip_list.write_xdr(w)?;
19868            self.ext.write_xdr(w)?;
19869            Ok(())
19870        })
19871    }
19872}
19873
19874/// LedgerUpgradeType is an XDR Enum defines as:
19875///
19876/// ```text
19877/// enum LedgerUpgradeType
19878/// {
19879///     LEDGER_UPGRADE_VERSION = 1,
19880///     LEDGER_UPGRADE_BASE_FEE = 2,
19881///     LEDGER_UPGRADE_MAX_TX_SET_SIZE = 3,
19882///     LEDGER_UPGRADE_BASE_RESERVE = 4,
19883///     LEDGER_UPGRADE_FLAGS = 5,
19884///     LEDGER_UPGRADE_CONFIG = 6,
19885///     LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE = 7
19886/// };
19887/// ```
19888///
19889// enum
19890#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
19891#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
19892#[cfg_attr(
19893    all(feature = "serde", feature = "alloc"),
19894    derive(serde::Serialize, serde::Deserialize),
19895    serde(rename_all = "snake_case")
19896)]
19897#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
19898#[repr(i32)]
19899pub enum LedgerUpgradeType {
19900    Version = 1,
19901    BaseFee = 2,
19902    MaxTxSetSize = 3,
19903    BaseReserve = 4,
19904    Flags = 5,
19905    Config = 6,
19906    MaxSorobanTxSetSize = 7,
19907}
19908
19909impl LedgerUpgradeType {
19910    pub const VARIANTS: [LedgerUpgradeType; 7] = [
19911        LedgerUpgradeType::Version,
19912        LedgerUpgradeType::BaseFee,
19913        LedgerUpgradeType::MaxTxSetSize,
19914        LedgerUpgradeType::BaseReserve,
19915        LedgerUpgradeType::Flags,
19916        LedgerUpgradeType::Config,
19917        LedgerUpgradeType::MaxSorobanTxSetSize,
19918    ];
19919    pub const VARIANTS_STR: [&'static str; 7] = [
19920        "Version",
19921        "BaseFee",
19922        "MaxTxSetSize",
19923        "BaseReserve",
19924        "Flags",
19925        "Config",
19926        "MaxSorobanTxSetSize",
19927    ];
19928
19929    #[must_use]
19930    pub const fn name(&self) -> &'static str {
19931        match self {
19932            Self::Version => "Version",
19933            Self::BaseFee => "BaseFee",
19934            Self::MaxTxSetSize => "MaxTxSetSize",
19935            Self::BaseReserve => "BaseReserve",
19936            Self::Flags => "Flags",
19937            Self::Config => "Config",
19938            Self::MaxSorobanTxSetSize => "MaxSorobanTxSetSize",
19939        }
19940    }
19941
19942    #[must_use]
19943    pub const fn variants() -> [LedgerUpgradeType; 7] {
19944        Self::VARIANTS
19945    }
19946}
19947
19948impl Name for LedgerUpgradeType {
19949    #[must_use]
19950    fn name(&self) -> &'static str {
19951        Self::name(self)
19952    }
19953}
19954
19955impl Variants<LedgerUpgradeType> for LedgerUpgradeType {
19956    fn variants() -> slice::Iter<'static, LedgerUpgradeType> {
19957        Self::VARIANTS.iter()
19958    }
19959}
19960
19961impl Enum for LedgerUpgradeType {}
19962
19963impl fmt::Display for LedgerUpgradeType {
19964    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
19965        f.write_str(self.name())
19966    }
19967}
19968
19969impl TryFrom<i32> for LedgerUpgradeType {
19970    type Error = Error;
19971
19972    fn try_from(i: i32) -> Result<Self> {
19973        let e = match i {
19974            1 => LedgerUpgradeType::Version,
19975            2 => LedgerUpgradeType::BaseFee,
19976            3 => LedgerUpgradeType::MaxTxSetSize,
19977            4 => LedgerUpgradeType::BaseReserve,
19978            5 => LedgerUpgradeType::Flags,
19979            6 => LedgerUpgradeType::Config,
19980            7 => LedgerUpgradeType::MaxSorobanTxSetSize,
19981            #[allow(unreachable_patterns)]
19982            _ => return Err(Error::Invalid),
19983        };
19984        Ok(e)
19985    }
19986}
19987
19988impl From<LedgerUpgradeType> for i32 {
19989    #[must_use]
19990    fn from(e: LedgerUpgradeType) -> Self {
19991        e as Self
19992    }
19993}
19994
19995impl ReadXdr for LedgerUpgradeType {
19996    #[cfg(feature = "std")]
19997    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
19998        r.with_limited_depth(|r| {
19999            let e = i32::read_xdr(r)?;
20000            let v: Self = e.try_into()?;
20001            Ok(v)
20002        })
20003    }
20004}
20005
20006impl WriteXdr for LedgerUpgradeType {
20007    #[cfg(feature = "std")]
20008    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
20009        w.with_limited_depth(|w| {
20010            let i: i32 = (*self).into();
20011            i.write_xdr(w)
20012        })
20013    }
20014}
20015
20016/// ConfigUpgradeSetKey is an XDR Struct defines as:
20017///
20018/// ```text
20019/// struct ConfigUpgradeSetKey {
20020///     Hash contractID;
20021///     Hash contentHash;
20022/// };
20023/// ```
20024///
20025#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
20026#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
20027#[cfg_attr(
20028    all(feature = "serde", feature = "alloc"),
20029    derive(serde::Serialize, serde::Deserialize),
20030    serde(rename_all = "snake_case")
20031)]
20032#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
20033pub struct ConfigUpgradeSetKey {
20034    pub contract_id: Hash,
20035    pub content_hash: Hash,
20036}
20037
20038impl ReadXdr for ConfigUpgradeSetKey {
20039    #[cfg(feature = "std")]
20040    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
20041        r.with_limited_depth(|r| {
20042            Ok(Self {
20043                contract_id: Hash::read_xdr(r)?,
20044                content_hash: Hash::read_xdr(r)?,
20045            })
20046        })
20047    }
20048}
20049
20050impl WriteXdr for ConfigUpgradeSetKey {
20051    #[cfg(feature = "std")]
20052    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
20053        w.with_limited_depth(|w| {
20054            self.contract_id.write_xdr(w)?;
20055            self.content_hash.write_xdr(w)?;
20056            Ok(())
20057        })
20058    }
20059}
20060
20061/// LedgerUpgrade is an XDR Union defines as:
20062///
20063/// ```text
20064/// union LedgerUpgrade switch (LedgerUpgradeType type)
20065/// {
20066/// case LEDGER_UPGRADE_VERSION:
20067///     uint32 newLedgerVersion; // update ledgerVersion
20068/// case LEDGER_UPGRADE_BASE_FEE:
20069///     uint32 newBaseFee; // update baseFee
20070/// case LEDGER_UPGRADE_MAX_TX_SET_SIZE:
20071///     uint32 newMaxTxSetSize; // update maxTxSetSize
20072/// case LEDGER_UPGRADE_BASE_RESERVE:
20073///     uint32 newBaseReserve; // update baseReserve
20074/// case LEDGER_UPGRADE_FLAGS:
20075///     uint32 newFlags; // update flags
20076/// case LEDGER_UPGRADE_CONFIG:
20077///     // Update arbitrary `ConfigSetting` entries identified by the key.
20078///     ConfigUpgradeSetKey newConfig;
20079/// case LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE:
20080///     // Update ConfigSettingContractExecutionLanesV0.ledgerMaxTxCount without
20081///     // using `LEDGER_UPGRADE_CONFIG`.
20082///     uint32 newMaxSorobanTxSetSize;
20083/// };
20084/// ```
20085///
20086// union with discriminant LedgerUpgradeType
20087#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
20088#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
20089#[cfg_attr(
20090    all(feature = "serde", feature = "alloc"),
20091    derive(serde::Serialize, serde::Deserialize),
20092    serde(rename_all = "snake_case")
20093)]
20094#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
20095#[allow(clippy::large_enum_variant)]
20096pub enum LedgerUpgrade {
20097    Version(u32),
20098    BaseFee(u32),
20099    MaxTxSetSize(u32),
20100    BaseReserve(u32),
20101    Flags(u32),
20102    Config(ConfigUpgradeSetKey),
20103    MaxSorobanTxSetSize(u32),
20104}
20105
20106impl LedgerUpgrade {
20107    pub const VARIANTS: [LedgerUpgradeType; 7] = [
20108        LedgerUpgradeType::Version,
20109        LedgerUpgradeType::BaseFee,
20110        LedgerUpgradeType::MaxTxSetSize,
20111        LedgerUpgradeType::BaseReserve,
20112        LedgerUpgradeType::Flags,
20113        LedgerUpgradeType::Config,
20114        LedgerUpgradeType::MaxSorobanTxSetSize,
20115    ];
20116    pub const VARIANTS_STR: [&'static str; 7] = [
20117        "Version",
20118        "BaseFee",
20119        "MaxTxSetSize",
20120        "BaseReserve",
20121        "Flags",
20122        "Config",
20123        "MaxSorobanTxSetSize",
20124    ];
20125
20126    #[must_use]
20127    pub const fn name(&self) -> &'static str {
20128        match self {
20129            Self::Version(_) => "Version",
20130            Self::BaseFee(_) => "BaseFee",
20131            Self::MaxTxSetSize(_) => "MaxTxSetSize",
20132            Self::BaseReserve(_) => "BaseReserve",
20133            Self::Flags(_) => "Flags",
20134            Self::Config(_) => "Config",
20135            Self::MaxSorobanTxSetSize(_) => "MaxSorobanTxSetSize",
20136        }
20137    }
20138
20139    #[must_use]
20140    pub const fn discriminant(&self) -> LedgerUpgradeType {
20141        #[allow(clippy::match_same_arms)]
20142        match self {
20143            Self::Version(_) => LedgerUpgradeType::Version,
20144            Self::BaseFee(_) => LedgerUpgradeType::BaseFee,
20145            Self::MaxTxSetSize(_) => LedgerUpgradeType::MaxTxSetSize,
20146            Self::BaseReserve(_) => LedgerUpgradeType::BaseReserve,
20147            Self::Flags(_) => LedgerUpgradeType::Flags,
20148            Self::Config(_) => LedgerUpgradeType::Config,
20149            Self::MaxSorobanTxSetSize(_) => LedgerUpgradeType::MaxSorobanTxSetSize,
20150        }
20151    }
20152
20153    #[must_use]
20154    pub const fn variants() -> [LedgerUpgradeType; 7] {
20155        Self::VARIANTS
20156    }
20157}
20158
20159impl Name for LedgerUpgrade {
20160    #[must_use]
20161    fn name(&self) -> &'static str {
20162        Self::name(self)
20163    }
20164}
20165
20166impl Discriminant<LedgerUpgradeType> for LedgerUpgrade {
20167    #[must_use]
20168    fn discriminant(&self) -> LedgerUpgradeType {
20169        Self::discriminant(self)
20170    }
20171}
20172
20173impl Variants<LedgerUpgradeType> for LedgerUpgrade {
20174    fn variants() -> slice::Iter<'static, LedgerUpgradeType> {
20175        Self::VARIANTS.iter()
20176    }
20177}
20178
20179impl Union<LedgerUpgradeType> for LedgerUpgrade {}
20180
20181impl ReadXdr for LedgerUpgrade {
20182    #[cfg(feature = "std")]
20183    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
20184        r.with_limited_depth(|r| {
20185            let dv: LedgerUpgradeType = <LedgerUpgradeType as ReadXdr>::read_xdr(r)?;
20186            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
20187            let v = match dv {
20188                LedgerUpgradeType::Version => Self::Version(u32::read_xdr(r)?),
20189                LedgerUpgradeType::BaseFee => Self::BaseFee(u32::read_xdr(r)?),
20190                LedgerUpgradeType::MaxTxSetSize => Self::MaxTxSetSize(u32::read_xdr(r)?),
20191                LedgerUpgradeType::BaseReserve => Self::BaseReserve(u32::read_xdr(r)?),
20192                LedgerUpgradeType::Flags => Self::Flags(u32::read_xdr(r)?),
20193                LedgerUpgradeType::Config => Self::Config(ConfigUpgradeSetKey::read_xdr(r)?),
20194                LedgerUpgradeType::MaxSorobanTxSetSize => {
20195                    Self::MaxSorobanTxSetSize(u32::read_xdr(r)?)
20196                }
20197                #[allow(unreachable_patterns)]
20198                _ => return Err(Error::Invalid),
20199            };
20200            Ok(v)
20201        })
20202    }
20203}
20204
20205impl WriteXdr for LedgerUpgrade {
20206    #[cfg(feature = "std")]
20207    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
20208        w.with_limited_depth(|w| {
20209            self.discriminant().write_xdr(w)?;
20210            #[allow(clippy::match_same_arms)]
20211            match self {
20212                Self::Version(v) => v.write_xdr(w)?,
20213                Self::BaseFee(v) => v.write_xdr(w)?,
20214                Self::MaxTxSetSize(v) => v.write_xdr(w)?,
20215                Self::BaseReserve(v) => v.write_xdr(w)?,
20216                Self::Flags(v) => v.write_xdr(w)?,
20217                Self::Config(v) => v.write_xdr(w)?,
20218                Self::MaxSorobanTxSetSize(v) => v.write_xdr(w)?,
20219            };
20220            Ok(())
20221        })
20222    }
20223}
20224
20225/// ConfigUpgradeSet is an XDR Struct defines as:
20226///
20227/// ```text
20228/// struct ConfigUpgradeSet {
20229///     ConfigSettingEntry updatedEntry<>;
20230/// };
20231/// ```
20232///
20233#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
20234#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
20235#[cfg_attr(
20236    all(feature = "serde", feature = "alloc"),
20237    derive(serde::Serialize, serde::Deserialize),
20238    serde(rename_all = "snake_case")
20239)]
20240#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
20241pub struct ConfigUpgradeSet {
20242    pub updated_entry: VecM<ConfigSettingEntry>,
20243}
20244
20245impl ReadXdr for ConfigUpgradeSet {
20246    #[cfg(feature = "std")]
20247    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
20248        r.with_limited_depth(|r| {
20249            Ok(Self {
20250                updated_entry: VecM::<ConfigSettingEntry>::read_xdr(r)?,
20251            })
20252        })
20253    }
20254}
20255
20256impl WriteXdr for ConfigUpgradeSet {
20257    #[cfg(feature = "std")]
20258    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
20259        w.with_limited_depth(|w| {
20260            self.updated_entry.write_xdr(w)?;
20261            Ok(())
20262        })
20263    }
20264}
20265
20266/// TxSetComponentType is an XDR Enum defines as:
20267///
20268/// ```text
20269/// enum TxSetComponentType
20270/// {
20271///   // txs with effective fee <= bid derived from a base fee (if any).
20272///   // If base fee is not specified, no discount is applied.
20273///   TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE = 0
20274/// };
20275/// ```
20276///
20277// enum
20278#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
20279#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
20280#[cfg_attr(
20281    all(feature = "serde", feature = "alloc"),
20282    derive(serde::Serialize, serde::Deserialize),
20283    serde(rename_all = "snake_case")
20284)]
20285#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
20286#[repr(i32)]
20287pub enum TxSetComponentType {
20288    TxsetCompTxsMaybeDiscountedFee = 0,
20289}
20290
20291impl TxSetComponentType {
20292    pub const VARIANTS: [TxSetComponentType; 1] =
20293        [TxSetComponentType::TxsetCompTxsMaybeDiscountedFee];
20294    pub const VARIANTS_STR: [&'static str; 1] = ["TxsetCompTxsMaybeDiscountedFee"];
20295
20296    #[must_use]
20297    pub const fn name(&self) -> &'static str {
20298        match self {
20299            Self::TxsetCompTxsMaybeDiscountedFee => "TxsetCompTxsMaybeDiscountedFee",
20300        }
20301    }
20302
20303    #[must_use]
20304    pub const fn variants() -> [TxSetComponentType; 1] {
20305        Self::VARIANTS
20306    }
20307}
20308
20309impl Name for TxSetComponentType {
20310    #[must_use]
20311    fn name(&self) -> &'static str {
20312        Self::name(self)
20313    }
20314}
20315
20316impl Variants<TxSetComponentType> for TxSetComponentType {
20317    fn variants() -> slice::Iter<'static, TxSetComponentType> {
20318        Self::VARIANTS.iter()
20319    }
20320}
20321
20322impl Enum for TxSetComponentType {}
20323
20324impl fmt::Display for TxSetComponentType {
20325    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
20326        f.write_str(self.name())
20327    }
20328}
20329
20330impl TryFrom<i32> for TxSetComponentType {
20331    type Error = Error;
20332
20333    fn try_from(i: i32) -> Result<Self> {
20334        let e = match i {
20335            0 => TxSetComponentType::TxsetCompTxsMaybeDiscountedFee,
20336            #[allow(unreachable_patterns)]
20337            _ => return Err(Error::Invalid),
20338        };
20339        Ok(e)
20340    }
20341}
20342
20343impl From<TxSetComponentType> for i32 {
20344    #[must_use]
20345    fn from(e: TxSetComponentType) -> Self {
20346        e as Self
20347    }
20348}
20349
20350impl ReadXdr for TxSetComponentType {
20351    #[cfg(feature = "std")]
20352    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
20353        r.with_limited_depth(|r| {
20354            let e = i32::read_xdr(r)?;
20355            let v: Self = e.try_into()?;
20356            Ok(v)
20357        })
20358    }
20359}
20360
20361impl WriteXdr for TxSetComponentType {
20362    #[cfg(feature = "std")]
20363    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
20364        w.with_limited_depth(|w| {
20365            let i: i32 = (*self).into();
20366            i.write_xdr(w)
20367        })
20368    }
20369}
20370
20371/// TxSetComponentTxsMaybeDiscountedFee is an XDR NestedStruct defines as:
20372///
20373/// ```text
20374/// struct
20375///   {
20376///     int64* baseFee;
20377///     TransactionEnvelope txs<>;
20378///   }
20379/// ```
20380///
20381#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
20382#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
20383#[cfg_attr(
20384    all(feature = "serde", feature = "alloc"),
20385    derive(serde::Serialize, serde::Deserialize),
20386    serde(rename_all = "snake_case")
20387)]
20388#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
20389pub struct TxSetComponentTxsMaybeDiscountedFee {
20390    pub base_fee: Option<i64>,
20391    pub txs: VecM<TransactionEnvelope>,
20392}
20393
20394impl ReadXdr for TxSetComponentTxsMaybeDiscountedFee {
20395    #[cfg(feature = "std")]
20396    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
20397        r.with_limited_depth(|r| {
20398            Ok(Self {
20399                base_fee: Option::<i64>::read_xdr(r)?,
20400                txs: VecM::<TransactionEnvelope>::read_xdr(r)?,
20401            })
20402        })
20403    }
20404}
20405
20406impl WriteXdr for TxSetComponentTxsMaybeDiscountedFee {
20407    #[cfg(feature = "std")]
20408    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
20409        w.with_limited_depth(|w| {
20410            self.base_fee.write_xdr(w)?;
20411            self.txs.write_xdr(w)?;
20412            Ok(())
20413        })
20414    }
20415}
20416
20417/// TxSetComponent is an XDR Union defines as:
20418///
20419/// ```text
20420/// union TxSetComponent switch (TxSetComponentType type)
20421/// {
20422/// case TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE:
20423///   struct
20424///   {
20425///     int64* baseFee;
20426///     TransactionEnvelope txs<>;
20427///   } txsMaybeDiscountedFee;
20428/// };
20429/// ```
20430///
20431// union with discriminant TxSetComponentType
20432#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
20433#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
20434#[cfg_attr(
20435    all(feature = "serde", feature = "alloc"),
20436    derive(serde::Serialize, serde::Deserialize),
20437    serde(rename_all = "snake_case")
20438)]
20439#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
20440#[allow(clippy::large_enum_variant)]
20441pub enum TxSetComponent {
20442    TxsetCompTxsMaybeDiscountedFee(TxSetComponentTxsMaybeDiscountedFee),
20443}
20444
20445impl TxSetComponent {
20446    pub const VARIANTS: [TxSetComponentType; 1] =
20447        [TxSetComponentType::TxsetCompTxsMaybeDiscountedFee];
20448    pub const VARIANTS_STR: [&'static str; 1] = ["TxsetCompTxsMaybeDiscountedFee"];
20449
20450    #[must_use]
20451    pub const fn name(&self) -> &'static str {
20452        match self {
20453            Self::TxsetCompTxsMaybeDiscountedFee(_) => "TxsetCompTxsMaybeDiscountedFee",
20454        }
20455    }
20456
20457    #[must_use]
20458    pub const fn discriminant(&self) -> TxSetComponentType {
20459        #[allow(clippy::match_same_arms)]
20460        match self {
20461            Self::TxsetCompTxsMaybeDiscountedFee(_) => {
20462                TxSetComponentType::TxsetCompTxsMaybeDiscountedFee
20463            }
20464        }
20465    }
20466
20467    #[must_use]
20468    pub const fn variants() -> [TxSetComponentType; 1] {
20469        Self::VARIANTS
20470    }
20471}
20472
20473impl Name for TxSetComponent {
20474    #[must_use]
20475    fn name(&self) -> &'static str {
20476        Self::name(self)
20477    }
20478}
20479
20480impl Discriminant<TxSetComponentType> for TxSetComponent {
20481    #[must_use]
20482    fn discriminant(&self) -> TxSetComponentType {
20483        Self::discriminant(self)
20484    }
20485}
20486
20487impl Variants<TxSetComponentType> for TxSetComponent {
20488    fn variants() -> slice::Iter<'static, TxSetComponentType> {
20489        Self::VARIANTS.iter()
20490    }
20491}
20492
20493impl Union<TxSetComponentType> for TxSetComponent {}
20494
20495impl ReadXdr for TxSetComponent {
20496    #[cfg(feature = "std")]
20497    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
20498        r.with_limited_depth(|r| {
20499            let dv: TxSetComponentType = <TxSetComponentType as ReadXdr>::read_xdr(r)?;
20500            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
20501            let v = match dv {
20502                TxSetComponentType::TxsetCompTxsMaybeDiscountedFee => {
20503                    Self::TxsetCompTxsMaybeDiscountedFee(
20504                        TxSetComponentTxsMaybeDiscountedFee::read_xdr(r)?,
20505                    )
20506                }
20507                #[allow(unreachable_patterns)]
20508                _ => return Err(Error::Invalid),
20509            };
20510            Ok(v)
20511        })
20512    }
20513}
20514
20515impl WriteXdr for TxSetComponent {
20516    #[cfg(feature = "std")]
20517    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
20518        w.with_limited_depth(|w| {
20519            self.discriminant().write_xdr(w)?;
20520            #[allow(clippy::match_same_arms)]
20521            match self {
20522                Self::TxsetCompTxsMaybeDiscountedFee(v) => v.write_xdr(w)?,
20523            };
20524            Ok(())
20525        })
20526    }
20527}
20528
20529/// TransactionPhase is an XDR Union defines as:
20530///
20531/// ```text
20532/// union TransactionPhase switch (int v)
20533/// {
20534/// case 0:
20535///     TxSetComponent v0Components<>;
20536/// };
20537/// ```
20538///
20539// union with discriminant i32
20540#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
20541#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
20542#[cfg_attr(
20543    all(feature = "serde", feature = "alloc"),
20544    derive(serde::Serialize, serde::Deserialize),
20545    serde(rename_all = "snake_case")
20546)]
20547#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
20548#[allow(clippy::large_enum_variant)]
20549pub enum TransactionPhase {
20550    V0(VecM<TxSetComponent>),
20551}
20552
20553impl TransactionPhase {
20554    pub const VARIANTS: [i32; 1] = [0];
20555    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
20556
20557    #[must_use]
20558    pub const fn name(&self) -> &'static str {
20559        match self {
20560            Self::V0(_) => "V0",
20561        }
20562    }
20563
20564    #[must_use]
20565    pub const fn discriminant(&self) -> i32 {
20566        #[allow(clippy::match_same_arms)]
20567        match self {
20568            Self::V0(_) => 0,
20569        }
20570    }
20571
20572    #[must_use]
20573    pub const fn variants() -> [i32; 1] {
20574        Self::VARIANTS
20575    }
20576}
20577
20578impl Name for TransactionPhase {
20579    #[must_use]
20580    fn name(&self) -> &'static str {
20581        Self::name(self)
20582    }
20583}
20584
20585impl Discriminant<i32> for TransactionPhase {
20586    #[must_use]
20587    fn discriminant(&self) -> i32 {
20588        Self::discriminant(self)
20589    }
20590}
20591
20592impl Variants<i32> for TransactionPhase {
20593    fn variants() -> slice::Iter<'static, i32> {
20594        Self::VARIANTS.iter()
20595    }
20596}
20597
20598impl Union<i32> for TransactionPhase {}
20599
20600impl ReadXdr for TransactionPhase {
20601    #[cfg(feature = "std")]
20602    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
20603        r.with_limited_depth(|r| {
20604            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
20605            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
20606            let v = match dv {
20607                0 => Self::V0(VecM::<TxSetComponent>::read_xdr(r)?),
20608                #[allow(unreachable_patterns)]
20609                _ => return Err(Error::Invalid),
20610            };
20611            Ok(v)
20612        })
20613    }
20614}
20615
20616impl WriteXdr for TransactionPhase {
20617    #[cfg(feature = "std")]
20618    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
20619        w.with_limited_depth(|w| {
20620            self.discriminant().write_xdr(w)?;
20621            #[allow(clippy::match_same_arms)]
20622            match self {
20623                Self::V0(v) => v.write_xdr(w)?,
20624            };
20625            Ok(())
20626        })
20627    }
20628}
20629
20630/// TransactionSet is an XDR Struct defines as:
20631///
20632/// ```text
20633/// struct TransactionSet
20634/// {
20635///     Hash previousLedgerHash;
20636///     TransactionEnvelope txs<>;
20637/// };
20638/// ```
20639///
20640#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
20641#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
20642#[cfg_attr(
20643    all(feature = "serde", feature = "alloc"),
20644    derive(serde::Serialize, serde::Deserialize),
20645    serde(rename_all = "snake_case")
20646)]
20647#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
20648pub struct TransactionSet {
20649    pub previous_ledger_hash: Hash,
20650    pub txs: VecM<TransactionEnvelope>,
20651}
20652
20653impl ReadXdr for TransactionSet {
20654    #[cfg(feature = "std")]
20655    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
20656        r.with_limited_depth(|r| {
20657            Ok(Self {
20658                previous_ledger_hash: Hash::read_xdr(r)?,
20659                txs: VecM::<TransactionEnvelope>::read_xdr(r)?,
20660            })
20661        })
20662    }
20663}
20664
20665impl WriteXdr for TransactionSet {
20666    #[cfg(feature = "std")]
20667    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
20668        w.with_limited_depth(|w| {
20669            self.previous_ledger_hash.write_xdr(w)?;
20670            self.txs.write_xdr(w)?;
20671            Ok(())
20672        })
20673    }
20674}
20675
20676/// TransactionSetV1 is an XDR Struct defines as:
20677///
20678/// ```text
20679/// struct TransactionSetV1
20680/// {
20681///     Hash previousLedgerHash;
20682///     TransactionPhase phases<>;
20683/// };
20684/// ```
20685///
20686#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
20687#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
20688#[cfg_attr(
20689    all(feature = "serde", feature = "alloc"),
20690    derive(serde::Serialize, serde::Deserialize),
20691    serde(rename_all = "snake_case")
20692)]
20693#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
20694pub struct TransactionSetV1 {
20695    pub previous_ledger_hash: Hash,
20696    pub phases: VecM<TransactionPhase>,
20697}
20698
20699impl ReadXdr for TransactionSetV1 {
20700    #[cfg(feature = "std")]
20701    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
20702        r.with_limited_depth(|r| {
20703            Ok(Self {
20704                previous_ledger_hash: Hash::read_xdr(r)?,
20705                phases: VecM::<TransactionPhase>::read_xdr(r)?,
20706            })
20707        })
20708    }
20709}
20710
20711impl WriteXdr for TransactionSetV1 {
20712    #[cfg(feature = "std")]
20713    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
20714        w.with_limited_depth(|w| {
20715            self.previous_ledger_hash.write_xdr(w)?;
20716            self.phases.write_xdr(w)?;
20717            Ok(())
20718        })
20719    }
20720}
20721
20722/// GeneralizedTransactionSet is an XDR Union defines as:
20723///
20724/// ```text
20725/// union GeneralizedTransactionSet switch (int v)
20726/// {
20727/// // We consider the legacy TransactionSet to be v0.
20728/// case 1:
20729///     TransactionSetV1 v1TxSet;
20730/// };
20731/// ```
20732///
20733// union with discriminant i32
20734#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
20735#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
20736#[cfg_attr(
20737    all(feature = "serde", feature = "alloc"),
20738    derive(serde::Serialize, serde::Deserialize),
20739    serde(rename_all = "snake_case")
20740)]
20741#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
20742#[allow(clippy::large_enum_variant)]
20743pub enum GeneralizedTransactionSet {
20744    V1(TransactionSetV1),
20745}
20746
20747impl GeneralizedTransactionSet {
20748    pub const VARIANTS: [i32; 1] = [1];
20749    pub const VARIANTS_STR: [&'static str; 1] = ["V1"];
20750
20751    #[must_use]
20752    pub const fn name(&self) -> &'static str {
20753        match self {
20754            Self::V1(_) => "V1",
20755        }
20756    }
20757
20758    #[must_use]
20759    pub const fn discriminant(&self) -> i32 {
20760        #[allow(clippy::match_same_arms)]
20761        match self {
20762            Self::V1(_) => 1,
20763        }
20764    }
20765
20766    #[must_use]
20767    pub const fn variants() -> [i32; 1] {
20768        Self::VARIANTS
20769    }
20770}
20771
20772impl Name for GeneralizedTransactionSet {
20773    #[must_use]
20774    fn name(&self) -> &'static str {
20775        Self::name(self)
20776    }
20777}
20778
20779impl Discriminant<i32> for GeneralizedTransactionSet {
20780    #[must_use]
20781    fn discriminant(&self) -> i32 {
20782        Self::discriminant(self)
20783    }
20784}
20785
20786impl Variants<i32> for GeneralizedTransactionSet {
20787    fn variants() -> slice::Iter<'static, i32> {
20788        Self::VARIANTS.iter()
20789    }
20790}
20791
20792impl Union<i32> for GeneralizedTransactionSet {}
20793
20794impl ReadXdr for GeneralizedTransactionSet {
20795    #[cfg(feature = "std")]
20796    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
20797        r.with_limited_depth(|r| {
20798            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
20799            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
20800            let v = match dv {
20801                1 => Self::V1(TransactionSetV1::read_xdr(r)?),
20802                #[allow(unreachable_patterns)]
20803                _ => return Err(Error::Invalid),
20804            };
20805            Ok(v)
20806        })
20807    }
20808}
20809
20810impl WriteXdr for GeneralizedTransactionSet {
20811    #[cfg(feature = "std")]
20812    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
20813        w.with_limited_depth(|w| {
20814            self.discriminant().write_xdr(w)?;
20815            #[allow(clippy::match_same_arms)]
20816            match self {
20817                Self::V1(v) => v.write_xdr(w)?,
20818            };
20819            Ok(())
20820        })
20821    }
20822}
20823
20824/// TransactionResultPair is an XDR Struct defines as:
20825///
20826/// ```text
20827/// struct TransactionResultPair
20828/// {
20829///     Hash transactionHash;
20830///     TransactionResult result; // result for the transaction
20831/// };
20832/// ```
20833///
20834#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
20835#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
20836#[cfg_attr(
20837    all(feature = "serde", feature = "alloc"),
20838    derive(serde::Serialize, serde::Deserialize),
20839    serde(rename_all = "snake_case")
20840)]
20841#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
20842pub struct TransactionResultPair {
20843    pub transaction_hash: Hash,
20844    pub result: TransactionResult,
20845}
20846
20847impl ReadXdr for TransactionResultPair {
20848    #[cfg(feature = "std")]
20849    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
20850        r.with_limited_depth(|r| {
20851            Ok(Self {
20852                transaction_hash: Hash::read_xdr(r)?,
20853                result: TransactionResult::read_xdr(r)?,
20854            })
20855        })
20856    }
20857}
20858
20859impl WriteXdr for TransactionResultPair {
20860    #[cfg(feature = "std")]
20861    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
20862        w.with_limited_depth(|w| {
20863            self.transaction_hash.write_xdr(w)?;
20864            self.result.write_xdr(w)?;
20865            Ok(())
20866        })
20867    }
20868}
20869
20870/// TransactionResultSet is an XDR Struct defines as:
20871///
20872/// ```text
20873/// struct TransactionResultSet
20874/// {
20875///     TransactionResultPair results<>;
20876/// };
20877/// ```
20878///
20879#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
20880#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
20881#[cfg_attr(
20882    all(feature = "serde", feature = "alloc"),
20883    derive(serde::Serialize, serde::Deserialize),
20884    serde(rename_all = "snake_case")
20885)]
20886#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
20887pub struct TransactionResultSet {
20888    pub results: VecM<TransactionResultPair>,
20889}
20890
20891impl ReadXdr for TransactionResultSet {
20892    #[cfg(feature = "std")]
20893    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
20894        r.with_limited_depth(|r| {
20895            Ok(Self {
20896                results: VecM::<TransactionResultPair>::read_xdr(r)?,
20897            })
20898        })
20899    }
20900}
20901
20902impl WriteXdr for TransactionResultSet {
20903    #[cfg(feature = "std")]
20904    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
20905        w.with_limited_depth(|w| {
20906            self.results.write_xdr(w)?;
20907            Ok(())
20908        })
20909    }
20910}
20911
20912/// TransactionHistoryEntryExt is an XDR NestedUnion defines as:
20913///
20914/// ```text
20915/// union switch (int v)
20916///     {
20917///     case 0:
20918///         void;
20919///     case 1:
20920///         GeneralizedTransactionSet generalizedTxSet;
20921///     }
20922/// ```
20923///
20924// union with discriminant i32
20925#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
20926#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
20927#[cfg_attr(
20928    all(feature = "serde", feature = "alloc"),
20929    derive(serde::Serialize, serde::Deserialize),
20930    serde(rename_all = "snake_case")
20931)]
20932#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
20933#[allow(clippy::large_enum_variant)]
20934pub enum TransactionHistoryEntryExt {
20935    V0,
20936    V1(GeneralizedTransactionSet),
20937}
20938
20939impl TransactionHistoryEntryExt {
20940    pub const VARIANTS: [i32; 2] = [0, 1];
20941    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"];
20942
20943    #[must_use]
20944    pub const fn name(&self) -> &'static str {
20945        match self {
20946            Self::V0 => "V0",
20947            Self::V1(_) => "V1",
20948        }
20949    }
20950
20951    #[must_use]
20952    pub const fn discriminant(&self) -> i32 {
20953        #[allow(clippy::match_same_arms)]
20954        match self {
20955            Self::V0 => 0,
20956            Self::V1(_) => 1,
20957        }
20958    }
20959
20960    #[must_use]
20961    pub const fn variants() -> [i32; 2] {
20962        Self::VARIANTS
20963    }
20964}
20965
20966impl Name for TransactionHistoryEntryExt {
20967    #[must_use]
20968    fn name(&self) -> &'static str {
20969        Self::name(self)
20970    }
20971}
20972
20973impl Discriminant<i32> for TransactionHistoryEntryExt {
20974    #[must_use]
20975    fn discriminant(&self) -> i32 {
20976        Self::discriminant(self)
20977    }
20978}
20979
20980impl Variants<i32> for TransactionHistoryEntryExt {
20981    fn variants() -> slice::Iter<'static, i32> {
20982        Self::VARIANTS.iter()
20983    }
20984}
20985
20986impl Union<i32> for TransactionHistoryEntryExt {}
20987
20988impl ReadXdr for TransactionHistoryEntryExt {
20989    #[cfg(feature = "std")]
20990    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
20991        r.with_limited_depth(|r| {
20992            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
20993            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
20994            let v = match dv {
20995                0 => Self::V0,
20996                1 => Self::V1(GeneralizedTransactionSet::read_xdr(r)?),
20997                #[allow(unreachable_patterns)]
20998                _ => return Err(Error::Invalid),
20999            };
21000            Ok(v)
21001        })
21002    }
21003}
21004
21005impl WriteXdr for TransactionHistoryEntryExt {
21006    #[cfg(feature = "std")]
21007    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
21008        w.with_limited_depth(|w| {
21009            self.discriminant().write_xdr(w)?;
21010            #[allow(clippy::match_same_arms)]
21011            match self {
21012                Self::V0 => ().write_xdr(w)?,
21013                Self::V1(v) => v.write_xdr(w)?,
21014            };
21015            Ok(())
21016        })
21017    }
21018}
21019
21020/// TransactionHistoryEntry is an XDR Struct defines as:
21021///
21022/// ```text
21023/// struct TransactionHistoryEntry
21024/// {
21025///     uint32 ledgerSeq;
21026///     TransactionSet txSet;
21027///
21028///     // when v != 0, txSet must be empty
21029///     union switch (int v)
21030///     {
21031///     case 0:
21032///         void;
21033///     case 1:
21034///         GeneralizedTransactionSet generalizedTxSet;
21035///     }
21036///     ext;
21037/// };
21038/// ```
21039///
21040#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
21041#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
21042#[cfg_attr(
21043    all(feature = "serde", feature = "alloc"),
21044    derive(serde::Serialize, serde::Deserialize),
21045    serde(rename_all = "snake_case")
21046)]
21047#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
21048pub struct TransactionHistoryEntry {
21049    pub ledger_seq: u32,
21050    pub tx_set: TransactionSet,
21051    pub ext: TransactionHistoryEntryExt,
21052}
21053
21054impl ReadXdr for TransactionHistoryEntry {
21055    #[cfg(feature = "std")]
21056    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
21057        r.with_limited_depth(|r| {
21058            Ok(Self {
21059                ledger_seq: u32::read_xdr(r)?,
21060                tx_set: TransactionSet::read_xdr(r)?,
21061                ext: TransactionHistoryEntryExt::read_xdr(r)?,
21062            })
21063        })
21064    }
21065}
21066
21067impl WriteXdr for TransactionHistoryEntry {
21068    #[cfg(feature = "std")]
21069    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
21070        w.with_limited_depth(|w| {
21071            self.ledger_seq.write_xdr(w)?;
21072            self.tx_set.write_xdr(w)?;
21073            self.ext.write_xdr(w)?;
21074            Ok(())
21075        })
21076    }
21077}
21078
21079/// TransactionHistoryResultEntryExt is an XDR NestedUnion defines as:
21080///
21081/// ```text
21082/// union switch (int v)
21083///     {
21084///     case 0:
21085///         void;
21086///     }
21087/// ```
21088///
21089// union with discriminant i32
21090#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
21091#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
21092#[cfg_attr(
21093    all(feature = "serde", feature = "alloc"),
21094    derive(serde::Serialize, serde::Deserialize),
21095    serde(rename_all = "snake_case")
21096)]
21097#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
21098#[allow(clippy::large_enum_variant)]
21099pub enum TransactionHistoryResultEntryExt {
21100    V0,
21101}
21102
21103impl TransactionHistoryResultEntryExt {
21104    pub const VARIANTS: [i32; 1] = [0];
21105    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
21106
21107    #[must_use]
21108    pub const fn name(&self) -> &'static str {
21109        match self {
21110            Self::V0 => "V0",
21111        }
21112    }
21113
21114    #[must_use]
21115    pub const fn discriminant(&self) -> i32 {
21116        #[allow(clippy::match_same_arms)]
21117        match self {
21118            Self::V0 => 0,
21119        }
21120    }
21121
21122    #[must_use]
21123    pub const fn variants() -> [i32; 1] {
21124        Self::VARIANTS
21125    }
21126}
21127
21128impl Name for TransactionHistoryResultEntryExt {
21129    #[must_use]
21130    fn name(&self) -> &'static str {
21131        Self::name(self)
21132    }
21133}
21134
21135impl Discriminant<i32> for TransactionHistoryResultEntryExt {
21136    #[must_use]
21137    fn discriminant(&self) -> i32 {
21138        Self::discriminant(self)
21139    }
21140}
21141
21142impl Variants<i32> for TransactionHistoryResultEntryExt {
21143    fn variants() -> slice::Iter<'static, i32> {
21144        Self::VARIANTS.iter()
21145    }
21146}
21147
21148impl Union<i32> for TransactionHistoryResultEntryExt {}
21149
21150impl ReadXdr for TransactionHistoryResultEntryExt {
21151    #[cfg(feature = "std")]
21152    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
21153        r.with_limited_depth(|r| {
21154            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
21155            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
21156            let v = match dv {
21157                0 => Self::V0,
21158                #[allow(unreachable_patterns)]
21159                _ => return Err(Error::Invalid),
21160            };
21161            Ok(v)
21162        })
21163    }
21164}
21165
21166impl WriteXdr for TransactionHistoryResultEntryExt {
21167    #[cfg(feature = "std")]
21168    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
21169        w.with_limited_depth(|w| {
21170            self.discriminant().write_xdr(w)?;
21171            #[allow(clippy::match_same_arms)]
21172            match self {
21173                Self::V0 => ().write_xdr(w)?,
21174            };
21175            Ok(())
21176        })
21177    }
21178}
21179
21180/// TransactionHistoryResultEntry is an XDR Struct defines as:
21181///
21182/// ```text
21183/// struct TransactionHistoryResultEntry
21184/// {
21185///     uint32 ledgerSeq;
21186///     TransactionResultSet txResultSet;
21187///
21188///     // reserved for future use
21189///     union switch (int v)
21190///     {
21191///     case 0:
21192///         void;
21193///     }
21194///     ext;
21195/// };
21196/// ```
21197///
21198#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
21199#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
21200#[cfg_attr(
21201    all(feature = "serde", feature = "alloc"),
21202    derive(serde::Serialize, serde::Deserialize),
21203    serde(rename_all = "snake_case")
21204)]
21205#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
21206pub struct TransactionHistoryResultEntry {
21207    pub ledger_seq: u32,
21208    pub tx_result_set: TransactionResultSet,
21209    pub ext: TransactionHistoryResultEntryExt,
21210}
21211
21212impl ReadXdr for TransactionHistoryResultEntry {
21213    #[cfg(feature = "std")]
21214    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
21215        r.with_limited_depth(|r| {
21216            Ok(Self {
21217                ledger_seq: u32::read_xdr(r)?,
21218                tx_result_set: TransactionResultSet::read_xdr(r)?,
21219                ext: TransactionHistoryResultEntryExt::read_xdr(r)?,
21220            })
21221        })
21222    }
21223}
21224
21225impl WriteXdr for TransactionHistoryResultEntry {
21226    #[cfg(feature = "std")]
21227    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
21228        w.with_limited_depth(|w| {
21229            self.ledger_seq.write_xdr(w)?;
21230            self.tx_result_set.write_xdr(w)?;
21231            self.ext.write_xdr(w)?;
21232            Ok(())
21233        })
21234    }
21235}
21236
21237/// LedgerHeaderHistoryEntryExt is an XDR NestedUnion defines as:
21238///
21239/// ```text
21240/// union switch (int v)
21241///     {
21242///     case 0:
21243///         void;
21244///     }
21245/// ```
21246///
21247// union with discriminant i32
21248#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
21249#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
21250#[cfg_attr(
21251    all(feature = "serde", feature = "alloc"),
21252    derive(serde::Serialize, serde::Deserialize),
21253    serde(rename_all = "snake_case")
21254)]
21255#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
21256#[allow(clippy::large_enum_variant)]
21257pub enum LedgerHeaderHistoryEntryExt {
21258    V0,
21259}
21260
21261impl LedgerHeaderHistoryEntryExt {
21262    pub const VARIANTS: [i32; 1] = [0];
21263    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
21264
21265    #[must_use]
21266    pub const fn name(&self) -> &'static str {
21267        match self {
21268            Self::V0 => "V0",
21269        }
21270    }
21271
21272    #[must_use]
21273    pub const fn discriminant(&self) -> i32 {
21274        #[allow(clippy::match_same_arms)]
21275        match self {
21276            Self::V0 => 0,
21277        }
21278    }
21279
21280    #[must_use]
21281    pub const fn variants() -> [i32; 1] {
21282        Self::VARIANTS
21283    }
21284}
21285
21286impl Name for LedgerHeaderHistoryEntryExt {
21287    #[must_use]
21288    fn name(&self) -> &'static str {
21289        Self::name(self)
21290    }
21291}
21292
21293impl Discriminant<i32> for LedgerHeaderHistoryEntryExt {
21294    #[must_use]
21295    fn discriminant(&self) -> i32 {
21296        Self::discriminant(self)
21297    }
21298}
21299
21300impl Variants<i32> for LedgerHeaderHistoryEntryExt {
21301    fn variants() -> slice::Iter<'static, i32> {
21302        Self::VARIANTS.iter()
21303    }
21304}
21305
21306impl Union<i32> for LedgerHeaderHistoryEntryExt {}
21307
21308impl ReadXdr for LedgerHeaderHistoryEntryExt {
21309    #[cfg(feature = "std")]
21310    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
21311        r.with_limited_depth(|r| {
21312            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
21313            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
21314            let v = match dv {
21315                0 => Self::V0,
21316                #[allow(unreachable_patterns)]
21317                _ => return Err(Error::Invalid),
21318            };
21319            Ok(v)
21320        })
21321    }
21322}
21323
21324impl WriteXdr for LedgerHeaderHistoryEntryExt {
21325    #[cfg(feature = "std")]
21326    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
21327        w.with_limited_depth(|w| {
21328            self.discriminant().write_xdr(w)?;
21329            #[allow(clippy::match_same_arms)]
21330            match self {
21331                Self::V0 => ().write_xdr(w)?,
21332            };
21333            Ok(())
21334        })
21335    }
21336}
21337
21338/// LedgerHeaderHistoryEntry is an XDR Struct defines as:
21339///
21340/// ```text
21341/// struct LedgerHeaderHistoryEntry
21342/// {
21343///     Hash hash;
21344///     LedgerHeader header;
21345///
21346///     // reserved for future use
21347///     union switch (int v)
21348///     {
21349///     case 0:
21350///         void;
21351///     }
21352///     ext;
21353/// };
21354/// ```
21355///
21356#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
21357#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
21358#[cfg_attr(
21359    all(feature = "serde", feature = "alloc"),
21360    derive(serde::Serialize, serde::Deserialize),
21361    serde(rename_all = "snake_case")
21362)]
21363#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
21364pub struct LedgerHeaderHistoryEntry {
21365    pub hash: Hash,
21366    pub header: LedgerHeader,
21367    pub ext: LedgerHeaderHistoryEntryExt,
21368}
21369
21370impl ReadXdr for LedgerHeaderHistoryEntry {
21371    #[cfg(feature = "std")]
21372    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
21373        r.with_limited_depth(|r| {
21374            Ok(Self {
21375                hash: Hash::read_xdr(r)?,
21376                header: LedgerHeader::read_xdr(r)?,
21377                ext: LedgerHeaderHistoryEntryExt::read_xdr(r)?,
21378            })
21379        })
21380    }
21381}
21382
21383impl WriteXdr for LedgerHeaderHistoryEntry {
21384    #[cfg(feature = "std")]
21385    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
21386        w.with_limited_depth(|w| {
21387            self.hash.write_xdr(w)?;
21388            self.header.write_xdr(w)?;
21389            self.ext.write_xdr(w)?;
21390            Ok(())
21391        })
21392    }
21393}
21394
21395/// LedgerScpMessages is an XDR Struct defines as:
21396///
21397/// ```text
21398/// struct LedgerSCPMessages
21399/// {
21400///     uint32 ledgerSeq;
21401///     SCPEnvelope messages<>;
21402/// };
21403/// ```
21404///
21405#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
21406#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
21407#[cfg_attr(
21408    all(feature = "serde", feature = "alloc"),
21409    derive(serde::Serialize, serde::Deserialize),
21410    serde(rename_all = "snake_case")
21411)]
21412#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
21413pub struct LedgerScpMessages {
21414    pub ledger_seq: u32,
21415    pub messages: VecM<ScpEnvelope>,
21416}
21417
21418impl ReadXdr for LedgerScpMessages {
21419    #[cfg(feature = "std")]
21420    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
21421        r.with_limited_depth(|r| {
21422            Ok(Self {
21423                ledger_seq: u32::read_xdr(r)?,
21424                messages: VecM::<ScpEnvelope>::read_xdr(r)?,
21425            })
21426        })
21427    }
21428}
21429
21430impl WriteXdr for LedgerScpMessages {
21431    #[cfg(feature = "std")]
21432    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
21433        w.with_limited_depth(|w| {
21434            self.ledger_seq.write_xdr(w)?;
21435            self.messages.write_xdr(w)?;
21436            Ok(())
21437        })
21438    }
21439}
21440
21441/// ScpHistoryEntryV0 is an XDR Struct defines as:
21442///
21443/// ```text
21444/// struct SCPHistoryEntryV0
21445/// {
21446///     SCPQuorumSet quorumSets<>; // additional quorum sets used by ledgerMessages
21447///     LedgerSCPMessages ledgerMessages;
21448/// };
21449/// ```
21450///
21451#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
21452#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
21453#[cfg_attr(
21454    all(feature = "serde", feature = "alloc"),
21455    derive(serde::Serialize, serde::Deserialize),
21456    serde(rename_all = "snake_case")
21457)]
21458#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
21459pub struct ScpHistoryEntryV0 {
21460    pub quorum_sets: VecM<ScpQuorumSet>,
21461    pub ledger_messages: LedgerScpMessages,
21462}
21463
21464impl ReadXdr for ScpHistoryEntryV0 {
21465    #[cfg(feature = "std")]
21466    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
21467        r.with_limited_depth(|r| {
21468            Ok(Self {
21469                quorum_sets: VecM::<ScpQuorumSet>::read_xdr(r)?,
21470                ledger_messages: LedgerScpMessages::read_xdr(r)?,
21471            })
21472        })
21473    }
21474}
21475
21476impl WriteXdr for ScpHistoryEntryV0 {
21477    #[cfg(feature = "std")]
21478    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
21479        w.with_limited_depth(|w| {
21480            self.quorum_sets.write_xdr(w)?;
21481            self.ledger_messages.write_xdr(w)?;
21482            Ok(())
21483        })
21484    }
21485}
21486
21487/// ScpHistoryEntry is an XDR Union defines as:
21488///
21489/// ```text
21490/// union SCPHistoryEntry switch (int v)
21491/// {
21492/// case 0:
21493///     SCPHistoryEntryV0 v0;
21494/// };
21495/// ```
21496///
21497// union with discriminant i32
21498#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
21499#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
21500#[cfg_attr(
21501    all(feature = "serde", feature = "alloc"),
21502    derive(serde::Serialize, serde::Deserialize),
21503    serde(rename_all = "snake_case")
21504)]
21505#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
21506#[allow(clippy::large_enum_variant)]
21507pub enum ScpHistoryEntry {
21508    V0(ScpHistoryEntryV0),
21509}
21510
21511impl ScpHistoryEntry {
21512    pub const VARIANTS: [i32; 1] = [0];
21513    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
21514
21515    #[must_use]
21516    pub const fn name(&self) -> &'static str {
21517        match self {
21518            Self::V0(_) => "V0",
21519        }
21520    }
21521
21522    #[must_use]
21523    pub const fn discriminant(&self) -> i32 {
21524        #[allow(clippy::match_same_arms)]
21525        match self {
21526            Self::V0(_) => 0,
21527        }
21528    }
21529
21530    #[must_use]
21531    pub const fn variants() -> [i32; 1] {
21532        Self::VARIANTS
21533    }
21534}
21535
21536impl Name for ScpHistoryEntry {
21537    #[must_use]
21538    fn name(&self) -> &'static str {
21539        Self::name(self)
21540    }
21541}
21542
21543impl Discriminant<i32> for ScpHistoryEntry {
21544    #[must_use]
21545    fn discriminant(&self) -> i32 {
21546        Self::discriminant(self)
21547    }
21548}
21549
21550impl Variants<i32> for ScpHistoryEntry {
21551    fn variants() -> slice::Iter<'static, i32> {
21552        Self::VARIANTS.iter()
21553    }
21554}
21555
21556impl Union<i32> for ScpHistoryEntry {}
21557
21558impl ReadXdr for ScpHistoryEntry {
21559    #[cfg(feature = "std")]
21560    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
21561        r.with_limited_depth(|r| {
21562            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
21563            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
21564            let v = match dv {
21565                0 => Self::V0(ScpHistoryEntryV0::read_xdr(r)?),
21566                #[allow(unreachable_patterns)]
21567                _ => return Err(Error::Invalid),
21568            };
21569            Ok(v)
21570        })
21571    }
21572}
21573
21574impl WriteXdr for ScpHistoryEntry {
21575    #[cfg(feature = "std")]
21576    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
21577        w.with_limited_depth(|w| {
21578            self.discriminant().write_xdr(w)?;
21579            #[allow(clippy::match_same_arms)]
21580            match self {
21581                Self::V0(v) => v.write_xdr(w)?,
21582            };
21583            Ok(())
21584        })
21585    }
21586}
21587
21588/// LedgerEntryChangeType is an XDR Enum defines as:
21589///
21590/// ```text
21591/// enum LedgerEntryChangeType
21592/// {
21593///     LEDGER_ENTRY_CREATED = 0, // entry was added to the ledger
21594///     LEDGER_ENTRY_UPDATED = 1, // entry was modified in the ledger
21595///     LEDGER_ENTRY_REMOVED = 2, // entry was removed from the ledger
21596///     LEDGER_ENTRY_STATE = 3    // value of the entry
21597/// };
21598/// ```
21599///
21600// enum
21601#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
21602#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
21603#[cfg_attr(
21604    all(feature = "serde", feature = "alloc"),
21605    derive(serde::Serialize, serde::Deserialize),
21606    serde(rename_all = "snake_case")
21607)]
21608#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
21609#[repr(i32)]
21610pub enum LedgerEntryChangeType {
21611    Created = 0,
21612    Updated = 1,
21613    Removed = 2,
21614    State = 3,
21615}
21616
21617impl LedgerEntryChangeType {
21618    pub const VARIANTS: [LedgerEntryChangeType; 4] = [
21619        LedgerEntryChangeType::Created,
21620        LedgerEntryChangeType::Updated,
21621        LedgerEntryChangeType::Removed,
21622        LedgerEntryChangeType::State,
21623    ];
21624    pub const VARIANTS_STR: [&'static str; 4] = ["Created", "Updated", "Removed", "State"];
21625
21626    #[must_use]
21627    pub const fn name(&self) -> &'static str {
21628        match self {
21629            Self::Created => "Created",
21630            Self::Updated => "Updated",
21631            Self::Removed => "Removed",
21632            Self::State => "State",
21633        }
21634    }
21635
21636    #[must_use]
21637    pub const fn variants() -> [LedgerEntryChangeType; 4] {
21638        Self::VARIANTS
21639    }
21640}
21641
21642impl Name for LedgerEntryChangeType {
21643    #[must_use]
21644    fn name(&self) -> &'static str {
21645        Self::name(self)
21646    }
21647}
21648
21649impl Variants<LedgerEntryChangeType> for LedgerEntryChangeType {
21650    fn variants() -> slice::Iter<'static, LedgerEntryChangeType> {
21651        Self::VARIANTS.iter()
21652    }
21653}
21654
21655impl Enum for LedgerEntryChangeType {}
21656
21657impl fmt::Display for LedgerEntryChangeType {
21658    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
21659        f.write_str(self.name())
21660    }
21661}
21662
21663impl TryFrom<i32> for LedgerEntryChangeType {
21664    type Error = Error;
21665
21666    fn try_from(i: i32) -> Result<Self> {
21667        let e = match i {
21668            0 => LedgerEntryChangeType::Created,
21669            1 => LedgerEntryChangeType::Updated,
21670            2 => LedgerEntryChangeType::Removed,
21671            3 => LedgerEntryChangeType::State,
21672            #[allow(unreachable_patterns)]
21673            _ => return Err(Error::Invalid),
21674        };
21675        Ok(e)
21676    }
21677}
21678
21679impl From<LedgerEntryChangeType> for i32 {
21680    #[must_use]
21681    fn from(e: LedgerEntryChangeType) -> Self {
21682        e as Self
21683    }
21684}
21685
21686impl ReadXdr for LedgerEntryChangeType {
21687    #[cfg(feature = "std")]
21688    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
21689        r.with_limited_depth(|r| {
21690            let e = i32::read_xdr(r)?;
21691            let v: Self = e.try_into()?;
21692            Ok(v)
21693        })
21694    }
21695}
21696
21697impl WriteXdr for LedgerEntryChangeType {
21698    #[cfg(feature = "std")]
21699    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
21700        w.with_limited_depth(|w| {
21701            let i: i32 = (*self).into();
21702            i.write_xdr(w)
21703        })
21704    }
21705}
21706
21707/// LedgerEntryChange is an XDR Union defines as:
21708///
21709/// ```text
21710/// union LedgerEntryChange switch (LedgerEntryChangeType type)
21711/// {
21712/// case LEDGER_ENTRY_CREATED:
21713///     LedgerEntry created;
21714/// case LEDGER_ENTRY_UPDATED:
21715///     LedgerEntry updated;
21716/// case LEDGER_ENTRY_REMOVED:
21717///     LedgerKey removed;
21718/// case LEDGER_ENTRY_STATE:
21719///     LedgerEntry state;
21720/// };
21721/// ```
21722///
21723// union with discriminant LedgerEntryChangeType
21724#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
21725#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
21726#[cfg_attr(
21727    all(feature = "serde", feature = "alloc"),
21728    derive(serde::Serialize, serde::Deserialize),
21729    serde(rename_all = "snake_case")
21730)]
21731#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
21732#[allow(clippy::large_enum_variant)]
21733pub enum LedgerEntryChange {
21734    Created(LedgerEntry),
21735    Updated(LedgerEntry),
21736    Removed(LedgerKey),
21737    State(LedgerEntry),
21738}
21739
21740impl LedgerEntryChange {
21741    pub const VARIANTS: [LedgerEntryChangeType; 4] = [
21742        LedgerEntryChangeType::Created,
21743        LedgerEntryChangeType::Updated,
21744        LedgerEntryChangeType::Removed,
21745        LedgerEntryChangeType::State,
21746    ];
21747    pub const VARIANTS_STR: [&'static str; 4] = ["Created", "Updated", "Removed", "State"];
21748
21749    #[must_use]
21750    pub const fn name(&self) -> &'static str {
21751        match self {
21752            Self::Created(_) => "Created",
21753            Self::Updated(_) => "Updated",
21754            Self::Removed(_) => "Removed",
21755            Self::State(_) => "State",
21756        }
21757    }
21758
21759    #[must_use]
21760    pub const fn discriminant(&self) -> LedgerEntryChangeType {
21761        #[allow(clippy::match_same_arms)]
21762        match self {
21763            Self::Created(_) => LedgerEntryChangeType::Created,
21764            Self::Updated(_) => LedgerEntryChangeType::Updated,
21765            Self::Removed(_) => LedgerEntryChangeType::Removed,
21766            Self::State(_) => LedgerEntryChangeType::State,
21767        }
21768    }
21769
21770    #[must_use]
21771    pub const fn variants() -> [LedgerEntryChangeType; 4] {
21772        Self::VARIANTS
21773    }
21774}
21775
21776impl Name for LedgerEntryChange {
21777    #[must_use]
21778    fn name(&self) -> &'static str {
21779        Self::name(self)
21780    }
21781}
21782
21783impl Discriminant<LedgerEntryChangeType> for LedgerEntryChange {
21784    #[must_use]
21785    fn discriminant(&self) -> LedgerEntryChangeType {
21786        Self::discriminant(self)
21787    }
21788}
21789
21790impl Variants<LedgerEntryChangeType> for LedgerEntryChange {
21791    fn variants() -> slice::Iter<'static, LedgerEntryChangeType> {
21792        Self::VARIANTS.iter()
21793    }
21794}
21795
21796impl Union<LedgerEntryChangeType> for LedgerEntryChange {}
21797
21798impl ReadXdr for LedgerEntryChange {
21799    #[cfg(feature = "std")]
21800    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
21801        r.with_limited_depth(|r| {
21802            let dv: LedgerEntryChangeType = <LedgerEntryChangeType as ReadXdr>::read_xdr(r)?;
21803            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
21804            let v = match dv {
21805                LedgerEntryChangeType::Created => Self::Created(LedgerEntry::read_xdr(r)?),
21806                LedgerEntryChangeType::Updated => Self::Updated(LedgerEntry::read_xdr(r)?),
21807                LedgerEntryChangeType::Removed => Self::Removed(LedgerKey::read_xdr(r)?),
21808                LedgerEntryChangeType::State => Self::State(LedgerEntry::read_xdr(r)?),
21809                #[allow(unreachable_patterns)]
21810                _ => return Err(Error::Invalid),
21811            };
21812            Ok(v)
21813        })
21814    }
21815}
21816
21817impl WriteXdr for LedgerEntryChange {
21818    #[cfg(feature = "std")]
21819    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
21820        w.with_limited_depth(|w| {
21821            self.discriminant().write_xdr(w)?;
21822            #[allow(clippy::match_same_arms)]
21823            match self {
21824                Self::Created(v) => v.write_xdr(w)?,
21825                Self::Updated(v) => v.write_xdr(w)?,
21826                Self::Removed(v) => v.write_xdr(w)?,
21827                Self::State(v) => v.write_xdr(w)?,
21828            };
21829            Ok(())
21830        })
21831    }
21832}
21833
21834/// LedgerEntryChanges is an XDR Typedef defines as:
21835///
21836/// ```text
21837/// typedef LedgerEntryChange LedgerEntryChanges<>;
21838/// ```
21839///
21840#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
21841#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
21842#[derive(Default)]
21843#[cfg_attr(
21844    all(feature = "serde", feature = "alloc"),
21845    derive(serde::Serialize, serde::Deserialize),
21846    serde(rename_all = "snake_case")
21847)]
21848#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
21849#[derive(Debug)]
21850pub struct LedgerEntryChanges(pub VecM<LedgerEntryChange>);
21851
21852impl From<LedgerEntryChanges> for VecM<LedgerEntryChange> {
21853    #[must_use]
21854    fn from(x: LedgerEntryChanges) -> Self {
21855        x.0
21856    }
21857}
21858
21859impl From<VecM<LedgerEntryChange>> for LedgerEntryChanges {
21860    #[must_use]
21861    fn from(x: VecM<LedgerEntryChange>) -> Self {
21862        LedgerEntryChanges(x)
21863    }
21864}
21865
21866impl AsRef<VecM<LedgerEntryChange>> for LedgerEntryChanges {
21867    #[must_use]
21868    fn as_ref(&self) -> &VecM<LedgerEntryChange> {
21869        &self.0
21870    }
21871}
21872
21873impl ReadXdr for LedgerEntryChanges {
21874    #[cfg(feature = "std")]
21875    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
21876        r.with_limited_depth(|r| {
21877            let i = VecM::<LedgerEntryChange>::read_xdr(r)?;
21878            let v = LedgerEntryChanges(i);
21879            Ok(v)
21880        })
21881    }
21882}
21883
21884impl WriteXdr for LedgerEntryChanges {
21885    #[cfg(feature = "std")]
21886    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
21887        w.with_limited_depth(|w| self.0.write_xdr(w))
21888    }
21889}
21890
21891impl Deref for LedgerEntryChanges {
21892    type Target = VecM<LedgerEntryChange>;
21893    fn deref(&self) -> &Self::Target {
21894        &self.0
21895    }
21896}
21897
21898impl From<LedgerEntryChanges> for Vec<LedgerEntryChange> {
21899    #[must_use]
21900    fn from(x: LedgerEntryChanges) -> Self {
21901        x.0 .0
21902    }
21903}
21904
21905impl TryFrom<Vec<LedgerEntryChange>> for LedgerEntryChanges {
21906    type Error = Error;
21907    fn try_from(x: Vec<LedgerEntryChange>) -> Result<Self> {
21908        Ok(LedgerEntryChanges(x.try_into()?))
21909    }
21910}
21911
21912#[cfg(feature = "alloc")]
21913impl TryFrom<&Vec<LedgerEntryChange>> for LedgerEntryChanges {
21914    type Error = Error;
21915    fn try_from(x: &Vec<LedgerEntryChange>) -> Result<Self> {
21916        Ok(LedgerEntryChanges(x.try_into()?))
21917    }
21918}
21919
21920impl AsRef<Vec<LedgerEntryChange>> for LedgerEntryChanges {
21921    #[must_use]
21922    fn as_ref(&self) -> &Vec<LedgerEntryChange> {
21923        &self.0 .0
21924    }
21925}
21926
21927impl AsRef<[LedgerEntryChange]> for LedgerEntryChanges {
21928    #[cfg(feature = "alloc")]
21929    #[must_use]
21930    fn as_ref(&self) -> &[LedgerEntryChange] {
21931        &self.0 .0
21932    }
21933    #[cfg(not(feature = "alloc"))]
21934    #[must_use]
21935    fn as_ref(&self) -> &[LedgerEntryChange] {
21936        self.0 .0
21937    }
21938}
21939
21940/// OperationMeta is an XDR Struct defines as:
21941///
21942/// ```text
21943/// struct OperationMeta
21944/// {
21945///     LedgerEntryChanges changes;
21946/// };
21947/// ```
21948///
21949#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
21950#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
21951#[cfg_attr(
21952    all(feature = "serde", feature = "alloc"),
21953    derive(serde::Serialize, serde::Deserialize),
21954    serde(rename_all = "snake_case")
21955)]
21956#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
21957pub struct OperationMeta {
21958    pub changes: LedgerEntryChanges,
21959}
21960
21961impl ReadXdr for OperationMeta {
21962    #[cfg(feature = "std")]
21963    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
21964        r.with_limited_depth(|r| {
21965            Ok(Self {
21966                changes: LedgerEntryChanges::read_xdr(r)?,
21967            })
21968        })
21969    }
21970}
21971
21972impl WriteXdr for OperationMeta {
21973    #[cfg(feature = "std")]
21974    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
21975        w.with_limited_depth(|w| {
21976            self.changes.write_xdr(w)?;
21977            Ok(())
21978        })
21979    }
21980}
21981
21982/// TransactionMetaV1 is an XDR Struct defines as:
21983///
21984/// ```text
21985/// struct TransactionMetaV1
21986/// {
21987///     LedgerEntryChanges txChanges; // tx level changes if any
21988///     OperationMeta operations<>;   // meta for each operation
21989/// };
21990/// ```
21991///
21992#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
21993#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
21994#[cfg_attr(
21995    all(feature = "serde", feature = "alloc"),
21996    derive(serde::Serialize, serde::Deserialize),
21997    serde(rename_all = "snake_case")
21998)]
21999#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
22000pub struct TransactionMetaV1 {
22001    pub tx_changes: LedgerEntryChanges,
22002    pub operations: VecM<OperationMeta>,
22003}
22004
22005impl ReadXdr for TransactionMetaV1 {
22006    #[cfg(feature = "std")]
22007    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
22008        r.with_limited_depth(|r| {
22009            Ok(Self {
22010                tx_changes: LedgerEntryChanges::read_xdr(r)?,
22011                operations: VecM::<OperationMeta>::read_xdr(r)?,
22012            })
22013        })
22014    }
22015}
22016
22017impl WriteXdr for TransactionMetaV1 {
22018    #[cfg(feature = "std")]
22019    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
22020        w.with_limited_depth(|w| {
22021            self.tx_changes.write_xdr(w)?;
22022            self.operations.write_xdr(w)?;
22023            Ok(())
22024        })
22025    }
22026}
22027
22028/// TransactionMetaV2 is an XDR Struct defines as:
22029///
22030/// ```text
22031/// struct TransactionMetaV2
22032/// {
22033///     LedgerEntryChanges txChangesBefore; // tx level changes before operations
22034///                                         // are applied if any
22035///     OperationMeta operations<>;         // meta for each operation
22036///     LedgerEntryChanges txChangesAfter;  // tx level changes after operations are
22037///                                         // applied if any
22038/// };
22039/// ```
22040///
22041#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
22042#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
22043#[cfg_attr(
22044    all(feature = "serde", feature = "alloc"),
22045    derive(serde::Serialize, serde::Deserialize),
22046    serde(rename_all = "snake_case")
22047)]
22048#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
22049pub struct TransactionMetaV2 {
22050    pub tx_changes_before: LedgerEntryChanges,
22051    pub operations: VecM<OperationMeta>,
22052    pub tx_changes_after: LedgerEntryChanges,
22053}
22054
22055impl ReadXdr for TransactionMetaV2 {
22056    #[cfg(feature = "std")]
22057    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
22058        r.with_limited_depth(|r| {
22059            Ok(Self {
22060                tx_changes_before: LedgerEntryChanges::read_xdr(r)?,
22061                operations: VecM::<OperationMeta>::read_xdr(r)?,
22062                tx_changes_after: LedgerEntryChanges::read_xdr(r)?,
22063            })
22064        })
22065    }
22066}
22067
22068impl WriteXdr for TransactionMetaV2 {
22069    #[cfg(feature = "std")]
22070    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
22071        w.with_limited_depth(|w| {
22072            self.tx_changes_before.write_xdr(w)?;
22073            self.operations.write_xdr(w)?;
22074            self.tx_changes_after.write_xdr(w)?;
22075            Ok(())
22076        })
22077    }
22078}
22079
22080/// ContractEventType is an XDR Enum defines as:
22081///
22082/// ```text
22083/// enum ContractEventType
22084/// {
22085///     SYSTEM = 0,
22086///     CONTRACT = 1,
22087///     DIAGNOSTIC = 2
22088/// };
22089/// ```
22090///
22091// enum
22092#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
22093#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
22094#[cfg_attr(
22095    all(feature = "serde", feature = "alloc"),
22096    derive(serde::Serialize, serde::Deserialize),
22097    serde(rename_all = "snake_case")
22098)]
22099#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
22100#[repr(i32)]
22101pub enum ContractEventType {
22102    System = 0,
22103    Contract = 1,
22104    Diagnostic = 2,
22105}
22106
22107impl ContractEventType {
22108    pub const VARIANTS: [ContractEventType; 3] = [
22109        ContractEventType::System,
22110        ContractEventType::Contract,
22111        ContractEventType::Diagnostic,
22112    ];
22113    pub const VARIANTS_STR: [&'static str; 3] = ["System", "Contract", "Diagnostic"];
22114
22115    #[must_use]
22116    pub const fn name(&self) -> &'static str {
22117        match self {
22118            Self::System => "System",
22119            Self::Contract => "Contract",
22120            Self::Diagnostic => "Diagnostic",
22121        }
22122    }
22123
22124    #[must_use]
22125    pub const fn variants() -> [ContractEventType; 3] {
22126        Self::VARIANTS
22127    }
22128}
22129
22130impl Name for ContractEventType {
22131    #[must_use]
22132    fn name(&self) -> &'static str {
22133        Self::name(self)
22134    }
22135}
22136
22137impl Variants<ContractEventType> for ContractEventType {
22138    fn variants() -> slice::Iter<'static, ContractEventType> {
22139        Self::VARIANTS.iter()
22140    }
22141}
22142
22143impl Enum for ContractEventType {}
22144
22145impl fmt::Display for ContractEventType {
22146    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
22147        f.write_str(self.name())
22148    }
22149}
22150
22151impl TryFrom<i32> for ContractEventType {
22152    type Error = Error;
22153
22154    fn try_from(i: i32) -> Result<Self> {
22155        let e = match i {
22156            0 => ContractEventType::System,
22157            1 => ContractEventType::Contract,
22158            2 => ContractEventType::Diagnostic,
22159            #[allow(unreachable_patterns)]
22160            _ => return Err(Error::Invalid),
22161        };
22162        Ok(e)
22163    }
22164}
22165
22166impl From<ContractEventType> for i32 {
22167    #[must_use]
22168    fn from(e: ContractEventType) -> Self {
22169        e as Self
22170    }
22171}
22172
22173impl ReadXdr for ContractEventType {
22174    #[cfg(feature = "std")]
22175    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
22176        r.with_limited_depth(|r| {
22177            let e = i32::read_xdr(r)?;
22178            let v: Self = e.try_into()?;
22179            Ok(v)
22180        })
22181    }
22182}
22183
22184impl WriteXdr for ContractEventType {
22185    #[cfg(feature = "std")]
22186    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
22187        w.with_limited_depth(|w| {
22188            let i: i32 = (*self).into();
22189            i.write_xdr(w)
22190        })
22191    }
22192}
22193
22194/// ContractEventV0 is an XDR NestedStruct defines as:
22195///
22196/// ```text
22197/// struct
22198///         {
22199///             SCVal topics<>;
22200///             SCVal data;
22201///         }
22202/// ```
22203///
22204#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
22205#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
22206#[cfg_attr(
22207    all(feature = "serde", feature = "alloc"),
22208    derive(serde::Serialize, serde::Deserialize),
22209    serde(rename_all = "snake_case")
22210)]
22211#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
22212pub struct ContractEventV0 {
22213    pub topics: VecM<ScVal>,
22214    pub data: ScVal,
22215}
22216
22217impl ReadXdr for ContractEventV0 {
22218    #[cfg(feature = "std")]
22219    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
22220        r.with_limited_depth(|r| {
22221            Ok(Self {
22222                topics: VecM::<ScVal>::read_xdr(r)?,
22223                data: ScVal::read_xdr(r)?,
22224            })
22225        })
22226    }
22227}
22228
22229impl WriteXdr for ContractEventV0 {
22230    #[cfg(feature = "std")]
22231    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
22232        w.with_limited_depth(|w| {
22233            self.topics.write_xdr(w)?;
22234            self.data.write_xdr(w)?;
22235            Ok(())
22236        })
22237    }
22238}
22239
22240/// ContractEventBody is an XDR NestedUnion defines as:
22241///
22242/// ```text
22243/// union switch (int v)
22244///     {
22245///     case 0:
22246///         struct
22247///         {
22248///             SCVal topics<>;
22249///             SCVal data;
22250///         } v0;
22251///     }
22252/// ```
22253///
22254// union with discriminant i32
22255#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
22256#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
22257#[cfg_attr(
22258    all(feature = "serde", feature = "alloc"),
22259    derive(serde::Serialize, serde::Deserialize),
22260    serde(rename_all = "snake_case")
22261)]
22262#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
22263#[allow(clippy::large_enum_variant)]
22264pub enum ContractEventBody {
22265    V0(ContractEventV0),
22266}
22267
22268impl ContractEventBody {
22269    pub const VARIANTS: [i32; 1] = [0];
22270    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
22271
22272    #[must_use]
22273    pub const fn name(&self) -> &'static str {
22274        match self {
22275            Self::V0(_) => "V0",
22276        }
22277    }
22278
22279    #[must_use]
22280    pub const fn discriminant(&self) -> i32 {
22281        #[allow(clippy::match_same_arms)]
22282        match self {
22283            Self::V0(_) => 0,
22284        }
22285    }
22286
22287    #[must_use]
22288    pub const fn variants() -> [i32; 1] {
22289        Self::VARIANTS
22290    }
22291}
22292
22293impl Name for ContractEventBody {
22294    #[must_use]
22295    fn name(&self) -> &'static str {
22296        Self::name(self)
22297    }
22298}
22299
22300impl Discriminant<i32> for ContractEventBody {
22301    #[must_use]
22302    fn discriminant(&self) -> i32 {
22303        Self::discriminant(self)
22304    }
22305}
22306
22307impl Variants<i32> for ContractEventBody {
22308    fn variants() -> slice::Iter<'static, i32> {
22309        Self::VARIANTS.iter()
22310    }
22311}
22312
22313impl Union<i32> for ContractEventBody {}
22314
22315impl ReadXdr for ContractEventBody {
22316    #[cfg(feature = "std")]
22317    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
22318        r.with_limited_depth(|r| {
22319            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
22320            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
22321            let v = match dv {
22322                0 => Self::V0(ContractEventV0::read_xdr(r)?),
22323                #[allow(unreachable_patterns)]
22324                _ => return Err(Error::Invalid),
22325            };
22326            Ok(v)
22327        })
22328    }
22329}
22330
22331impl WriteXdr for ContractEventBody {
22332    #[cfg(feature = "std")]
22333    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
22334        w.with_limited_depth(|w| {
22335            self.discriminant().write_xdr(w)?;
22336            #[allow(clippy::match_same_arms)]
22337            match self {
22338                Self::V0(v) => v.write_xdr(w)?,
22339            };
22340            Ok(())
22341        })
22342    }
22343}
22344
22345/// ContractEvent is an XDR Struct defines as:
22346///
22347/// ```text
22348/// struct ContractEvent
22349/// {
22350///     // We can use this to add more fields, or because it
22351///     // is first, to change ContractEvent into a union.
22352///     ExtensionPoint ext;
22353///
22354///     Hash* contractID;
22355///     ContractEventType type;
22356///
22357///     union switch (int v)
22358///     {
22359///     case 0:
22360///         struct
22361///         {
22362///             SCVal topics<>;
22363///             SCVal data;
22364///         } v0;
22365///     }
22366///     body;
22367/// };
22368/// ```
22369///
22370#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
22371#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
22372#[cfg_attr(
22373    all(feature = "serde", feature = "alloc"),
22374    derive(serde::Serialize, serde::Deserialize),
22375    serde(rename_all = "snake_case")
22376)]
22377#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
22378pub struct ContractEvent {
22379    pub ext: ExtensionPoint,
22380    pub contract_id: Option<Hash>,
22381    pub type_: ContractEventType,
22382    pub body: ContractEventBody,
22383}
22384
22385impl ReadXdr for ContractEvent {
22386    #[cfg(feature = "std")]
22387    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
22388        r.with_limited_depth(|r| {
22389            Ok(Self {
22390                ext: ExtensionPoint::read_xdr(r)?,
22391                contract_id: Option::<Hash>::read_xdr(r)?,
22392                type_: ContractEventType::read_xdr(r)?,
22393                body: ContractEventBody::read_xdr(r)?,
22394            })
22395        })
22396    }
22397}
22398
22399impl WriteXdr for ContractEvent {
22400    #[cfg(feature = "std")]
22401    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
22402        w.with_limited_depth(|w| {
22403            self.ext.write_xdr(w)?;
22404            self.contract_id.write_xdr(w)?;
22405            self.type_.write_xdr(w)?;
22406            self.body.write_xdr(w)?;
22407            Ok(())
22408        })
22409    }
22410}
22411
22412/// DiagnosticEvent is an XDR Struct defines as:
22413///
22414/// ```text
22415/// struct DiagnosticEvent
22416/// {
22417///     bool inSuccessfulContractCall;
22418///     ContractEvent event;
22419/// };
22420/// ```
22421///
22422#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
22423#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
22424#[cfg_attr(
22425    all(feature = "serde", feature = "alloc"),
22426    derive(serde::Serialize, serde::Deserialize),
22427    serde(rename_all = "snake_case")
22428)]
22429#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
22430pub struct DiagnosticEvent {
22431    pub in_successful_contract_call: bool,
22432    pub event: ContractEvent,
22433}
22434
22435impl ReadXdr for DiagnosticEvent {
22436    #[cfg(feature = "std")]
22437    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
22438        r.with_limited_depth(|r| {
22439            Ok(Self {
22440                in_successful_contract_call: bool::read_xdr(r)?,
22441                event: ContractEvent::read_xdr(r)?,
22442            })
22443        })
22444    }
22445}
22446
22447impl WriteXdr for DiagnosticEvent {
22448    #[cfg(feature = "std")]
22449    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
22450        w.with_limited_depth(|w| {
22451            self.in_successful_contract_call.write_xdr(w)?;
22452            self.event.write_xdr(w)?;
22453            Ok(())
22454        })
22455    }
22456}
22457
22458/// DiagnosticEvents is an XDR Typedef defines as:
22459///
22460/// ```text
22461/// typedef DiagnosticEvent DiagnosticEvents<>;
22462/// ```
22463///
22464#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
22465#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
22466#[derive(Default)]
22467#[cfg_attr(
22468    all(feature = "serde", feature = "alloc"),
22469    derive(serde::Serialize, serde::Deserialize),
22470    serde(rename_all = "snake_case")
22471)]
22472#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
22473#[derive(Debug)]
22474pub struct DiagnosticEvents(pub VecM<DiagnosticEvent>);
22475
22476impl From<DiagnosticEvents> for VecM<DiagnosticEvent> {
22477    #[must_use]
22478    fn from(x: DiagnosticEvents) -> Self {
22479        x.0
22480    }
22481}
22482
22483impl From<VecM<DiagnosticEvent>> for DiagnosticEvents {
22484    #[must_use]
22485    fn from(x: VecM<DiagnosticEvent>) -> Self {
22486        DiagnosticEvents(x)
22487    }
22488}
22489
22490impl AsRef<VecM<DiagnosticEvent>> for DiagnosticEvents {
22491    #[must_use]
22492    fn as_ref(&self) -> &VecM<DiagnosticEvent> {
22493        &self.0
22494    }
22495}
22496
22497impl ReadXdr for DiagnosticEvents {
22498    #[cfg(feature = "std")]
22499    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
22500        r.with_limited_depth(|r| {
22501            let i = VecM::<DiagnosticEvent>::read_xdr(r)?;
22502            let v = DiagnosticEvents(i);
22503            Ok(v)
22504        })
22505    }
22506}
22507
22508impl WriteXdr for DiagnosticEvents {
22509    #[cfg(feature = "std")]
22510    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
22511        w.with_limited_depth(|w| self.0.write_xdr(w))
22512    }
22513}
22514
22515impl Deref for DiagnosticEvents {
22516    type Target = VecM<DiagnosticEvent>;
22517    fn deref(&self) -> &Self::Target {
22518        &self.0
22519    }
22520}
22521
22522impl From<DiagnosticEvents> for Vec<DiagnosticEvent> {
22523    #[must_use]
22524    fn from(x: DiagnosticEvents) -> Self {
22525        x.0 .0
22526    }
22527}
22528
22529impl TryFrom<Vec<DiagnosticEvent>> for DiagnosticEvents {
22530    type Error = Error;
22531    fn try_from(x: Vec<DiagnosticEvent>) -> Result<Self> {
22532        Ok(DiagnosticEvents(x.try_into()?))
22533    }
22534}
22535
22536#[cfg(feature = "alloc")]
22537impl TryFrom<&Vec<DiagnosticEvent>> for DiagnosticEvents {
22538    type Error = Error;
22539    fn try_from(x: &Vec<DiagnosticEvent>) -> Result<Self> {
22540        Ok(DiagnosticEvents(x.try_into()?))
22541    }
22542}
22543
22544impl AsRef<Vec<DiagnosticEvent>> for DiagnosticEvents {
22545    #[must_use]
22546    fn as_ref(&self) -> &Vec<DiagnosticEvent> {
22547        &self.0 .0
22548    }
22549}
22550
22551impl AsRef<[DiagnosticEvent]> for DiagnosticEvents {
22552    #[cfg(feature = "alloc")]
22553    #[must_use]
22554    fn as_ref(&self) -> &[DiagnosticEvent] {
22555        &self.0 .0
22556    }
22557    #[cfg(not(feature = "alloc"))]
22558    #[must_use]
22559    fn as_ref(&self) -> &[DiagnosticEvent] {
22560        self.0 .0
22561    }
22562}
22563
22564/// SorobanTransactionMetaExtV1 is an XDR Struct defines as:
22565///
22566/// ```text
22567/// struct SorobanTransactionMetaExtV1
22568/// {
22569///     ExtensionPoint ext;
22570///
22571///     // The following are the components of the overall Soroban resource fee
22572///     // charged for the transaction.
22573///     // The following relation holds:
22574///     // `resourceFeeCharged = totalNonRefundableResourceFeeCharged + totalRefundableResourceFeeCharged`
22575///     // where `resourceFeeCharged` is the overall fee charged for the
22576///     // transaction. Also, `resourceFeeCharged` <= `sorobanData.resourceFee`
22577///     // i.e.we never charge more than the declared resource fee.
22578///     // The inclusion fee for charged the Soroban transaction can be found using
22579///     // the following equation:
22580///     // `result.feeCharged = resourceFeeCharged + inclusionFeeCharged`.
22581///
22582///     // Total amount (in stroops) that has been charged for non-refundable
22583///     // Soroban resources.
22584///     // Non-refundable resources are charged based on the usage declared in
22585///     // the transaction envelope (such as `instructions`, `readBytes` etc.) and
22586///     // is charged regardless of the success of the transaction.
22587///     int64 totalNonRefundableResourceFeeCharged;
22588///     // Total amount (in stroops) that has been charged for refundable
22589///     // Soroban resource fees.
22590///     // Currently this comprises the rent fee (`rentFeeCharged`) and the
22591///     // fee for the events and return value.
22592///     // Refundable resources are charged based on the actual resources usage.
22593///     // Since currently refundable resources are only used for the successful
22594///     // transactions, this will be `0` for failed transactions.
22595///     int64 totalRefundableResourceFeeCharged;
22596///     // Amount (in stroops) that has been charged for rent.
22597///     // This is a part of `totalNonRefundableResourceFeeCharged`.
22598///     int64 rentFeeCharged;
22599/// };
22600/// ```
22601///
22602#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
22603#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
22604#[cfg_attr(
22605    all(feature = "serde", feature = "alloc"),
22606    derive(serde::Serialize, serde::Deserialize),
22607    serde(rename_all = "snake_case")
22608)]
22609#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
22610pub struct SorobanTransactionMetaExtV1 {
22611    pub ext: ExtensionPoint,
22612    pub total_non_refundable_resource_fee_charged: i64,
22613    pub total_refundable_resource_fee_charged: i64,
22614    pub rent_fee_charged: i64,
22615}
22616
22617impl ReadXdr for SorobanTransactionMetaExtV1 {
22618    #[cfg(feature = "std")]
22619    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
22620        r.with_limited_depth(|r| {
22621            Ok(Self {
22622                ext: ExtensionPoint::read_xdr(r)?,
22623                total_non_refundable_resource_fee_charged: i64::read_xdr(r)?,
22624                total_refundable_resource_fee_charged: i64::read_xdr(r)?,
22625                rent_fee_charged: i64::read_xdr(r)?,
22626            })
22627        })
22628    }
22629}
22630
22631impl WriteXdr for SorobanTransactionMetaExtV1 {
22632    #[cfg(feature = "std")]
22633    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
22634        w.with_limited_depth(|w| {
22635            self.ext.write_xdr(w)?;
22636            self.total_non_refundable_resource_fee_charged
22637                .write_xdr(w)?;
22638            self.total_refundable_resource_fee_charged.write_xdr(w)?;
22639            self.rent_fee_charged.write_xdr(w)?;
22640            Ok(())
22641        })
22642    }
22643}
22644
22645/// SorobanTransactionMetaExt is an XDR Union defines as:
22646///
22647/// ```text
22648/// union SorobanTransactionMetaExt switch (int v)
22649/// {
22650/// case 0:
22651///     void;
22652/// case 1:
22653///     SorobanTransactionMetaExtV1 v1;
22654/// };
22655/// ```
22656///
22657// union with discriminant i32
22658#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
22659#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
22660#[cfg_attr(
22661    all(feature = "serde", feature = "alloc"),
22662    derive(serde::Serialize, serde::Deserialize),
22663    serde(rename_all = "snake_case")
22664)]
22665#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
22666#[allow(clippy::large_enum_variant)]
22667pub enum SorobanTransactionMetaExt {
22668    V0,
22669    V1(SorobanTransactionMetaExtV1),
22670}
22671
22672impl SorobanTransactionMetaExt {
22673    pub const VARIANTS: [i32; 2] = [0, 1];
22674    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"];
22675
22676    #[must_use]
22677    pub const fn name(&self) -> &'static str {
22678        match self {
22679            Self::V0 => "V0",
22680            Self::V1(_) => "V1",
22681        }
22682    }
22683
22684    #[must_use]
22685    pub const fn discriminant(&self) -> i32 {
22686        #[allow(clippy::match_same_arms)]
22687        match self {
22688            Self::V0 => 0,
22689            Self::V1(_) => 1,
22690        }
22691    }
22692
22693    #[must_use]
22694    pub const fn variants() -> [i32; 2] {
22695        Self::VARIANTS
22696    }
22697}
22698
22699impl Name for SorobanTransactionMetaExt {
22700    #[must_use]
22701    fn name(&self) -> &'static str {
22702        Self::name(self)
22703    }
22704}
22705
22706impl Discriminant<i32> for SorobanTransactionMetaExt {
22707    #[must_use]
22708    fn discriminant(&self) -> i32 {
22709        Self::discriminant(self)
22710    }
22711}
22712
22713impl Variants<i32> for SorobanTransactionMetaExt {
22714    fn variants() -> slice::Iter<'static, i32> {
22715        Self::VARIANTS.iter()
22716    }
22717}
22718
22719impl Union<i32> for SorobanTransactionMetaExt {}
22720
22721impl ReadXdr for SorobanTransactionMetaExt {
22722    #[cfg(feature = "std")]
22723    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
22724        r.with_limited_depth(|r| {
22725            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
22726            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
22727            let v = match dv {
22728                0 => Self::V0,
22729                1 => Self::V1(SorobanTransactionMetaExtV1::read_xdr(r)?),
22730                #[allow(unreachable_patterns)]
22731                _ => return Err(Error::Invalid),
22732            };
22733            Ok(v)
22734        })
22735    }
22736}
22737
22738impl WriteXdr for SorobanTransactionMetaExt {
22739    #[cfg(feature = "std")]
22740    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
22741        w.with_limited_depth(|w| {
22742            self.discriminant().write_xdr(w)?;
22743            #[allow(clippy::match_same_arms)]
22744            match self {
22745                Self::V0 => ().write_xdr(w)?,
22746                Self::V1(v) => v.write_xdr(w)?,
22747            };
22748            Ok(())
22749        })
22750    }
22751}
22752
22753/// SorobanTransactionMeta is an XDR Struct defines as:
22754///
22755/// ```text
22756/// struct SorobanTransactionMeta
22757/// {
22758///     SorobanTransactionMetaExt ext;
22759///
22760///     ContractEvent events<>;             // custom events populated by the
22761///                                         // contracts themselves.
22762///     SCVal returnValue;                  // return value of the host fn invocation
22763///
22764///     // Diagnostics events that are not hashed.
22765///     // This will contain all contract and diagnostic events. Even ones
22766///     // that were emitted in a failed contract call.
22767///     DiagnosticEvent diagnosticEvents<>;
22768/// };
22769/// ```
22770///
22771#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
22772#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
22773#[cfg_attr(
22774    all(feature = "serde", feature = "alloc"),
22775    derive(serde::Serialize, serde::Deserialize),
22776    serde(rename_all = "snake_case")
22777)]
22778#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
22779pub struct SorobanTransactionMeta {
22780    pub ext: SorobanTransactionMetaExt,
22781    pub events: VecM<ContractEvent>,
22782    pub return_value: ScVal,
22783    pub diagnostic_events: VecM<DiagnosticEvent>,
22784}
22785
22786impl ReadXdr for SorobanTransactionMeta {
22787    #[cfg(feature = "std")]
22788    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
22789        r.with_limited_depth(|r| {
22790            Ok(Self {
22791                ext: SorobanTransactionMetaExt::read_xdr(r)?,
22792                events: VecM::<ContractEvent>::read_xdr(r)?,
22793                return_value: ScVal::read_xdr(r)?,
22794                diagnostic_events: VecM::<DiagnosticEvent>::read_xdr(r)?,
22795            })
22796        })
22797    }
22798}
22799
22800impl WriteXdr for SorobanTransactionMeta {
22801    #[cfg(feature = "std")]
22802    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
22803        w.with_limited_depth(|w| {
22804            self.ext.write_xdr(w)?;
22805            self.events.write_xdr(w)?;
22806            self.return_value.write_xdr(w)?;
22807            self.diagnostic_events.write_xdr(w)?;
22808            Ok(())
22809        })
22810    }
22811}
22812
22813/// TransactionMetaV3 is an XDR Struct defines as:
22814///
22815/// ```text
22816/// struct TransactionMetaV3
22817/// {
22818///     ExtensionPoint ext;
22819///
22820///     LedgerEntryChanges txChangesBefore;  // tx level changes before operations
22821///                                          // are applied if any
22822///     OperationMeta operations<>;          // meta for each operation
22823///     LedgerEntryChanges txChangesAfter;   // tx level changes after operations are
22824///                                          // applied if any
22825///     SorobanTransactionMeta* sorobanMeta; // Soroban-specific meta (only for
22826///                                          // Soroban transactions).
22827/// };
22828/// ```
22829///
22830#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
22831#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
22832#[cfg_attr(
22833    all(feature = "serde", feature = "alloc"),
22834    derive(serde::Serialize, serde::Deserialize),
22835    serde(rename_all = "snake_case")
22836)]
22837#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
22838pub struct TransactionMetaV3 {
22839    pub ext: ExtensionPoint,
22840    pub tx_changes_before: LedgerEntryChanges,
22841    pub operations: VecM<OperationMeta>,
22842    pub tx_changes_after: LedgerEntryChanges,
22843    pub soroban_meta: Option<SorobanTransactionMeta>,
22844}
22845
22846impl ReadXdr for TransactionMetaV3 {
22847    #[cfg(feature = "std")]
22848    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
22849        r.with_limited_depth(|r| {
22850            Ok(Self {
22851                ext: ExtensionPoint::read_xdr(r)?,
22852                tx_changes_before: LedgerEntryChanges::read_xdr(r)?,
22853                operations: VecM::<OperationMeta>::read_xdr(r)?,
22854                tx_changes_after: LedgerEntryChanges::read_xdr(r)?,
22855                soroban_meta: Option::<SorobanTransactionMeta>::read_xdr(r)?,
22856            })
22857        })
22858    }
22859}
22860
22861impl WriteXdr for TransactionMetaV3 {
22862    #[cfg(feature = "std")]
22863    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
22864        w.with_limited_depth(|w| {
22865            self.ext.write_xdr(w)?;
22866            self.tx_changes_before.write_xdr(w)?;
22867            self.operations.write_xdr(w)?;
22868            self.tx_changes_after.write_xdr(w)?;
22869            self.soroban_meta.write_xdr(w)?;
22870            Ok(())
22871        })
22872    }
22873}
22874
22875/// InvokeHostFunctionSuccessPreImage is an XDR Struct defines as:
22876///
22877/// ```text
22878/// struct InvokeHostFunctionSuccessPreImage
22879/// {
22880///     SCVal returnValue;
22881///     ContractEvent events<>;
22882/// };
22883/// ```
22884///
22885#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
22886#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
22887#[cfg_attr(
22888    all(feature = "serde", feature = "alloc"),
22889    derive(serde::Serialize, serde::Deserialize),
22890    serde(rename_all = "snake_case")
22891)]
22892#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
22893pub struct InvokeHostFunctionSuccessPreImage {
22894    pub return_value: ScVal,
22895    pub events: VecM<ContractEvent>,
22896}
22897
22898impl ReadXdr for InvokeHostFunctionSuccessPreImage {
22899    #[cfg(feature = "std")]
22900    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
22901        r.with_limited_depth(|r| {
22902            Ok(Self {
22903                return_value: ScVal::read_xdr(r)?,
22904                events: VecM::<ContractEvent>::read_xdr(r)?,
22905            })
22906        })
22907    }
22908}
22909
22910impl WriteXdr for InvokeHostFunctionSuccessPreImage {
22911    #[cfg(feature = "std")]
22912    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
22913        w.with_limited_depth(|w| {
22914            self.return_value.write_xdr(w)?;
22915            self.events.write_xdr(w)?;
22916            Ok(())
22917        })
22918    }
22919}
22920
22921/// TransactionMeta is an XDR Union defines as:
22922///
22923/// ```text
22924/// union TransactionMeta switch (int v)
22925/// {
22926/// case 0:
22927///     OperationMeta operations<>;
22928/// case 1:
22929///     TransactionMetaV1 v1;
22930/// case 2:
22931///     TransactionMetaV2 v2;
22932/// case 3:
22933///     TransactionMetaV3 v3;
22934/// };
22935/// ```
22936///
22937// union with discriminant i32
22938#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
22939#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
22940#[cfg_attr(
22941    all(feature = "serde", feature = "alloc"),
22942    derive(serde::Serialize, serde::Deserialize),
22943    serde(rename_all = "snake_case")
22944)]
22945#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
22946#[allow(clippy::large_enum_variant)]
22947pub enum TransactionMeta {
22948    V0(VecM<OperationMeta>),
22949    V1(TransactionMetaV1),
22950    V2(TransactionMetaV2),
22951    V3(TransactionMetaV3),
22952}
22953
22954impl TransactionMeta {
22955    pub const VARIANTS: [i32; 4] = [0, 1, 2, 3];
22956    pub const VARIANTS_STR: [&'static str; 4] = ["V0", "V1", "V2", "V3"];
22957
22958    #[must_use]
22959    pub const fn name(&self) -> &'static str {
22960        match self {
22961            Self::V0(_) => "V0",
22962            Self::V1(_) => "V1",
22963            Self::V2(_) => "V2",
22964            Self::V3(_) => "V3",
22965        }
22966    }
22967
22968    #[must_use]
22969    pub const fn discriminant(&self) -> i32 {
22970        #[allow(clippy::match_same_arms)]
22971        match self {
22972            Self::V0(_) => 0,
22973            Self::V1(_) => 1,
22974            Self::V2(_) => 2,
22975            Self::V3(_) => 3,
22976        }
22977    }
22978
22979    #[must_use]
22980    pub const fn variants() -> [i32; 4] {
22981        Self::VARIANTS
22982    }
22983}
22984
22985impl Name for TransactionMeta {
22986    #[must_use]
22987    fn name(&self) -> &'static str {
22988        Self::name(self)
22989    }
22990}
22991
22992impl Discriminant<i32> for TransactionMeta {
22993    #[must_use]
22994    fn discriminant(&self) -> i32 {
22995        Self::discriminant(self)
22996    }
22997}
22998
22999impl Variants<i32> for TransactionMeta {
23000    fn variants() -> slice::Iter<'static, i32> {
23001        Self::VARIANTS.iter()
23002    }
23003}
23004
23005impl Union<i32> for TransactionMeta {}
23006
23007impl ReadXdr for TransactionMeta {
23008    #[cfg(feature = "std")]
23009    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
23010        r.with_limited_depth(|r| {
23011            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
23012            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
23013            let v = match dv {
23014                0 => Self::V0(VecM::<OperationMeta>::read_xdr(r)?),
23015                1 => Self::V1(TransactionMetaV1::read_xdr(r)?),
23016                2 => Self::V2(TransactionMetaV2::read_xdr(r)?),
23017                3 => Self::V3(TransactionMetaV3::read_xdr(r)?),
23018                #[allow(unreachable_patterns)]
23019                _ => return Err(Error::Invalid),
23020            };
23021            Ok(v)
23022        })
23023    }
23024}
23025
23026impl WriteXdr for TransactionMeta {
23027    #[cfg(feature = "std")]
23028    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
23029        w.with_limited_depth(|w| {
23030            self.discriminant().write_xdr(w)?;
23031            #[allow(clippy::match_same_arms)]
23032            match self {
23033                Self::V0(v) => v.write_xdr(w)?,
23034                Self::V1(v) => v.write_xdr(w)?,
23035                Self::V2(v) => v.write_xdr(w)?,
23036                Self::V3(v) => v.write_xdr(w)?,
23037            };
23038            Ok(())
23039        })
23040    }
23041}
23042
23043/// TransactionResultMeta is an XDR Struct defines as:
23044///
23045/// ```text
23046/// struct TransactionResultMeta
23047/// {
23048///     TransactionResultPair result;
23049///     LedgerEntryChanges feeProcessing;
23050///     TransactionMeta txApplyProcessing;
23051/// };
23052/// ```
23053///
23054#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
23055#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
23056#[cfg_attr(
23057    all(feature = "serde", feature = "alloc"),
23058    derive(serde::Serialize, serde::Deserialize),
23059    serde(rename_all = "snake_case")
23060)]
23061#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
23062pub struct TransactionResultMeta {
23063    pub result: TransactionResultPair,
23064    pub fee_processing: LedgerEntryChanges,
23065    pub tx_apply_processing: TransactionMeta,
23066}
23067
23068impl ReadXdr for TransactionResultMeta {
23069    #[cfg(feature = "std")]
23070    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
23071        r.with_limited_depth(|r| {
23072            Ok(Self {
23073                result: TransactionResultPair::read_xdr(r)?,
23074                fee_processing: LedgerEntryChanges::read_xdr(r)?,
23075                tx_apply_processing: TransactionMeta::read_xdr(r)?,
23076            })
23077        })
23078    }
23079}
23080
23081impl WriteXdr for TransactionResultMeta {
23082    #[cfg(feature = "std")]
23083    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
23084        w.with_limited_depth(|w| {
23085            self.result.write_xdr(w)?;
23086            self.fee_processing.write_xdr(w)?;
23087            self.tx_apply_processing.write_xdr(w)?;
23088            Ok(())
23089        })
23090    }
23091}
23092
23093/// UpgradeEntryMeta is an XDR Struct defines as:
23094///
23095/// ```text
23096/// struct UpgradeEntryMeta
23097/// {
23098///     LedgerUpgrade upgrade;
23099///     LedgerEntryChanges changes;
23100/// };
23101/// ```
23102///
23103#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
23104#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
23105#[cfg_attr(
23106    all(feature = "serde", feature = "alloc"),
23107    derive(serde::Serialize, serde::Deserialize),
23108    serde(rename_all = "snake_case")
23109)]
23110#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
23111pub struct UpgradeEntryMeta {
23112    pub upgrade: LedgerUpgrade,
23113    pub changes: LedgerEntryChanges,
23114}
23115
23116impl ReadXdr for UpgradeEntryMeta {
23117    #[cfg(feature = "std")]
23118    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
23119        r.with_limited_depth(|r| {
23120            Ok(Self {
23121                upgrade: LedgerUpgrade::read_xdr(r)?,
23122                changes: LedgerEntryChanges::read_xdr(r)?,
23123            })
23124        })
23125    }
23126}
23127
23128impl WriteXdr for UpgradeEntryMeta {
23129    #[cfg(feature = "std")]
23130    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
23131        w.with_limited_depth(|w| {
23132            self.upgrade.write_xdr(w)?;
23133            self.changes.write_xdr(w)?;
23134            Ok(())
23135        })
23136    }
23137}
23138
23139/// LedgerCloseMetaV0 is an XDR Struct defines as:
23140///
23141/// ```text
23142/// struct LedgerCloseMetaV0
23143/// {
23144///     LedgerHeaderHistoryEntry ledgerHeader;
23145///     // NB: txSet is sorted in "Hash order"
23146///     TransactionSet txSet;
23147///
23148///     // NB: transactions are sorted in apply order here
23149///     // fees for all transactions are processed first
23150///     // followed by applying transactions
23151///     TransactionResultMeta txProcessing<>;
23152///
23153///     // upgrades are applied last
23154///     UpgradeEntryMeta upgradesProcessing<>;
23155///
23156///     // other misc information attached to the ledger close
23157///     SCPHistoryEntry scpInfo<>;
23158/// };
23159/// ```
23160///
23161#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
23162#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
23163#[cfg_attr(
23164    all(feature = "serde", feature = "alloc"),
23165    derive(serde::Serialize, serde::Deserialize),
23166    serde(rename_all = "snake_case")
23167)]
23168#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
23169pub struct LedgerCloseMetaV0 {
23170    pub ledger_header: LedgerHeaderHistoryEntry,
23171    pub tx_set: TransactionSet,
23172    pub tx_processing: VecM<TransactionResultMeta>,
23173    pub upgrades_processing: VecM<UpgradeEntryMeta>,
23174    pub scp_info: VecM<ScpHistoryEntry>,
23175}
23176
23177impl ReadXdr for LedgerCloseMetaV0 {
23178    #[cfg(feature = "std")]
23179    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
23180        r.with_limited_depth(|r| {
23181            Ok(Self {
23182                ledger_header: LedgerHeaderHistoryEntry::read_xdr(r)?,
23183                tx_set: TransactionSet::read_xdr(r)?,
23184                tx_processing: VecM::<TransactionResultMeta>::read_xdr(r)?,
23185                upgrades_processing: VecM::<UpgradeEntryMeta>::read_xdr(r)?,
23186                scp_info: VecM::<ScpHistoryEntry>::read_xdr(r)?,
23187            })
23188        })
23189    }
23190}
23191
23192impl WriteXdr for LedgerCloseMetaV0 {
23193    #[cfg(feature = "std")]
23194    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
23195        w.with_limited_depth(|w| {
23196            self.ledger_header.write_xdr(w)?;
23197            self.tx_set.write_xdr(w)?;
23198            self.tx_processing.write_xdr(w)?;
23199            self.upgrades_processing.write_xdr(w)?;
23200            self.scp_info.write_xdr(w)?;
23201            Ok(())
23202        })
23203    }
23204}
23205
23206/// LedgerCloseMetaExtV1 is an XDR Struct defines as:
23207///
23208/// ```text
23209/// struct LedgerCloseMetaExtV1
23210/// {
23211///     ExtensionPoint ext;
23212///     int64 sorobanFeeWrite1KB;
23213/// };
23214/// ```
23215///
23216#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
23217#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
23218#[cfg_attr(
23219    all(feature = "serde", feature = "alloc"),
23220    derive(serde::Serialize, serde::Deserialize),
23221    serde(rename_all = "snake_case")
23222)]
23223#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
23224pub struct LedgerCloseMetaExtV1 {
23225    pub ext: ExtensionPoint,
23226    pub soroban_fee_write1_kb: i64,
23227}
23228
23229impl ReadXdr for LedgerCloseMetaExtV1 {
23230    #[cfg(feature = "std")]
23231    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
23232        r.with_limited_depth(|r| {
23233            Ok(Self {
23234                ext: ExtensionPoint::read_xdr(r)?,
23235                soroban_fee_write1_kb: i64::read_xdr(r)?,
23236            })
23237        })
23238    }
23239}
23240
23241impl WriteXdr for LedgerCloseMetaExtV1 {
23242    #[cfg(feature = "std")]
23243    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
23244        w.with_limited_depth(|w| {
23245            self.ext.write_xdr(w)?;
23246            self.soroban_fee_write1_kb.write_xdr(w)?;
23247            Ok(())
23248        })
23249    }
23250}
23251
23252/// LedgerCloseMetaExt is an XDR Union defines as:
23253///
23254/// ```text
23255/// union LedgerCloseMetaExt switch (int v)
23256/// {
23257/// case 0:
23258///     void;
23259/// case 1:
23260///     LedgerCloseMetaExtV1 v1;
23261/// };
23262/// ```
23263///
23264// union with discriminant i32
23265#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
23266#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
23267#[cfg_attr(
23268    all(feature = "serde", feature = "alloc"),
23269    derive(serde::Serialize, serde::Deserialize),
23270    serde(rename_all = "snake_case")
23271)]
23272#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
23273#[allow(clippy::large_enum_variant)]
23274pub enum LedgerCloseMetaExt {
23275    V0,
23276    V1(LedgerCloseMetaExtV1),
23277}
23278
23279impl LedgerCloseMetaExt {
23280    pub const VARIANTS: [i32; 2] = [0, 1];
23281    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"];
23282
23283    #[must_use]
23284    pub const fn name(&self) -> &'static str {
23285        match self {
23286            Self::V0 => "V0",
23287            Self::V1(_) => "V1",
23288        }
23289    }
23290
23291    #[must_use]
23292    pub const fn discriminant(&self) -> i32 {
23293        #[allow(clippy::match_same_arms)]
23294        match self {
23295            Self::V0 => 0,
23296            Self::V1(_) => 1,
23297        }
23298    }
23299
23300    #[must_use]
23301    pub const fn variants() -> [i32; 2] {
23302        Self::VARIANTS
23303    }
23304}
23305
23306impl Name for LedgerCloseMetaExt {
23307    #[must_use]
23308    fn name(&self) -> &'static str {
23309        Self::name(self)
23310    }
23311}
23312
23313impl Discriminant<i32> for LedgerCloseMetaExt {
23314    #[must_use]
23315    fn discriminant(&self) -> i32 {
23316        Self::discriminant(self)
23317    }
23318}
23319
23320impl Variants<i32> for LedgerCloseMetaExt {
23321    fn variants() -> slice::Iter<'static, i32> {
23322        Self::VARIANTS.iter()
23323    }
23324}
23325
23326impl Union<i32> for LedgerCloseMetaExt {}
23327
23328impl ReadXdr for LedgerCloseMetaExt {
23329    #[cfg(feature = "std")]
23330    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
23331        r.with_limited_depth(|r| {
23332            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
23333            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
23334            let v = match dv {
23335                0 => Self::V0,
23336                1 => Self::V1(LedgerCloseMetaExtV1::read_xdr(r)?),
23337                #[allow(unreachable_patterns)]
23338                _ => return Err(Error::Invalid),
23339            };
23340            Ok(v)
23341        })
23342    }
23343}
23344
23345impl WriteXdr for LedgerCloseMetaExt {
23346    #[cfg(feature = "std")]
23347    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
23348        w.with_limited_depth(|w| {
23349            self.discriminant().write_xdr(w)?;
23350            #[allow(clippy::match_same_arms)]
23351            match self {
23352                Self::V0 => ().write_xdr(w)?,
23353                Self::V1(v) => v.write_xdr(w)?,
23354            };
23355            Ok(())
23356        })
23357    }
23358}
23359
23360/// LedgerCloseMetaV1 is an XDR Struct defines as:
23361///
23362/// ```text
23363/// struct LedgerCloseMetaV1
23364/// {
23365///     LedgerCloseMetaExt ext;
23366///
23367///     LedgerHeaderHistoryEntry ledgerHeader;
23368///
23369///     GeneralizedTransactionSet txSet;
23370///
23371///     // NB: transactions are sorted in apply order here
23372///     // fees for all transactions are processed first
23373///     // followed by applying transactions
23374///     TransactionResultMeta txProcessing<>;
23375///
23376///     // upgrades are applied last
23377///     UpgradeEntryMeta upgradesProcessing<>;
23378///
23379///     // other misc information attached to the ledger close
23380///     SCPHistoryEntry scpInfo<>;
23381///
23382///     // Size in bytes of BucketList, to support downstream
23383///     // systems calculating storage fees correctly.
23384///     uint64 totalByteSizeOfBucketList;
23385///
23386///     // Temp keys that are being evicted at this ledger.
23387///     LedgerKey evictedTemporaryLedgerKeys<>;
23388///
23389///     // Archived restorable ledger entries that are being
23390///     // evicted at this ledger.
23391///     LedgerEntry evictedPersistentLedgerEntries<>;
23392/// };
23393/// ```
23394///
23395#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
23396#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
23397#[cfg_attr(
23398    all(feature = "serde", feature = "alloc"),
23399    derive(serde::Serialize, serde::Deserialize),
23400    serde(rename_all = "snake_case")
23401)]
23402#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
23403pub struct LedgerCloseMetaV1 {
23404    pub ext: LedgerCloseMetaExt,
23405    pub ledger_header: LedgerHeaderHistoryEntry,
23406    pub tx_set: GeneralizedTransactionSet,
23407    pub tx_processing: VecM<TransactionResultMeta>,
23408    pub upgrades_processing: VecM<UpgradeEntryMeta>,
23409    pub scp_info: VecM<ScpHistoryEntry>,
23410    pub total_byte_size_of_bucket_list: u64,
23411    pub evicted_temporary_ledger_keys: VecM<LedgerKey>,
23412    pub evicted_persistent_ledger_entries: VecM<LedgerEntry>,
23413}
23414
23415impl ReadXdr for LedgerCloseMetaV1 {
23416    #[cfg(feature = "std")]
23417    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
23418        r.with_limited_depth(|r| {
23419            Ok(Self {
23420                ext: LedgerCloseMetaExt::read_xdr(r)?,
23421                ledger_header: LedgerHeaderHistoryEntry::read_xdr(r)?,
23422                tx_set: GeneralizedTransactionSet::read_xdr(r)?,
23423                tx_processing: VecM::<TransactionResultMeta>::read_xdr(r)?,
23424                upgrades_processing: VecM::<UpgradeEntryMeta>::read_xdr(r)?,
23425                scp_info: VecM::<ScpHistoryEntry>::read_xdr(r)?,
23426                total_byte_size_of_bucket_list: u64::read_xdr(r)?,
23427                evicted_temporary_ledger_keys: VecM::<LedgerKey>::read_xdr(r)?,
23428                evicted_persistent_ledger_entries: VecM::<LedgerEntry>::read_xdr(r)?,
23429            })
23430        })
23431    }
23432}
23433
23434impl WriteXdr for LedgerCloseMetaV1 {
23435    #[cfg(feature = "std")]
23436    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
23437        w.with_limited_depth(|w| {
23438            self.ext.write_xdr(w)?;
23439            self.ledger_header.write_xdr(w)?;
23440            self.tx_set.write_xdr(w)?;
23441            self.tx_processing.write_xdr(w)?;
23442            self.upgrades_processing.write_xdr(w)?;
23443            self.scp_info.write_xdr(w)?;
23444            self.total_byte_size_of_bucket_list.write_xdr(w)?;
23445            self.evicted_temporary_ledger_keys.write_xdr(w)?;
23446            self.evicted_persistent_ledger_entries.write_xdr(w)?;
23447            Ok(())
23448        })
23449    }
23450}
23451
23452/// LedgerCloseMeta is an XDR Union defines as:
23453///
23454/// ```text
23455/// union LedgerCloseMeta switch (int v)
23456/// {
23457/// case 0:
23458///     LedgerCloseMetaV0 v0;
23459/// case 1:
23460///     LedgerCloseMetaV1 v1;
23461/// };
23462/// ```
23463///
23464// union with discriminant i32
23465#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
23466#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
23467#[cfg_attr(
23468    all(feature = "serde", feature = "alloc"),
23469    derive(serde::Serialize, serde::Deserialize),
23470    serde(rename_all = "snake_case")
23471)]
23472#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
23473#[allow(clippy::large_enum_variant)]
23474pub enum LedgerCloseMeta {
23475    V0(LedgerCloseMetaV0),
23476    V1(LedgerCloseMetaV1),
23477}
23478
23479impl LedgerCloseMeta {
23480    pub const VARIANTS: [i32; 2] = [0, 1];
23481    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"];
23482
23483    #[must_use]
23484    pub const fn name(&self) -> &'static str {
23485        match self {
23486            Self::V0(_) => "V0",
23487            Self::V1(_) => "V1",
23488        }
23489    }
23490
23491    #[must_use]
23492    pub const fn discriminant(&self) -> i32 {
23493        #[allow(clippy::match_same_arms)]
23494        match self {
23495            Self::V0(_) => 0,
23496            Self::V1(_) => 1,
23497        }
23498    }
23499
23500    #[must_use]
23501    pub const fn variants() -> [i32; 2] {
23502        Self::VARIANTS
23503    }
23504}
23505
23506impl Name for LedgerCloseMeta {
23507    #[must_use]
23508    fn name(&self) -> &'static str {
23509        Self::name(self)
23510    }
23511}
23512
23513impl Discriminant<i32> for LedgerCloseMeta {
23514    #[must_use]
23515    fn discriminant(&self) -> i32 {
23516        Self::discriminant(self)
23517    }
23518}
23519
23520impl Variants<i32> for LedgerCloseMeta {
23521    fn variants() -> slice::Iter<'static, i32> {
23522        Self::VARIANTS.iter()
23523    }
23524}
23525
23526impl Union<i32> for LedgerCloseMeta {}
23527
23528impl ReadXdr for LedgerCloseMeta {
23529    #[cfg(feature = "std")]
23530    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
23531        r.with_limited_depth(|r| {
23532            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
23533            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
23534            let v = match dv {
23535                0 => Self::V0(LedgerCloseMetaV0::read_xdr(r)?),
23536                1 => Self::V1(LedgerCloseMetaV1::read_xdr(r)?),
23537                #[allow(unreachable_patterns)]
23538                _ => return Err(Error::Invalid),
23539            };
23540            Ok(v)
23541        })
23542    }
23543}
23544
23545impl WriteXdr for LedgerCloseMeta {
23546    #[cfg(feature = "std")]
23547    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
23548        w.with_limited_depth(|w| {
23549            self.discriminant().write_xdr(w)?;
23550            #[allow(clippy::match_same_arms)]
23551            match self {
23552                Self::V0(v) => v.write_xdr(w)?,
23553                Self::V1(v) => v.write_xdr(w)?,
23554            };
23555            Ok(())
23556        })
23557    }
23558}
23559
23560/// ErrorCode is an XDR Enum defines as:
23561///
23562/// ```text
23563/// enum ErrorCode
23564/// {
23565///     ERR_MISC = 0, // Unspecific error
23566///     ERR_DATA = 1, // Malformed data
23567///     ERR_CONF = 2, // Misconfiguration error
23568///     ERR_AUTH = 3, // Authentication failure
23569///     ERR_LOAD = 4  // System overloaded
23570/// };
23571/// ```
23572///
23573// enum
23574#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
23575#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
23576#[cfg_attr(
23577    all(feature = "serde", feature = "alloc"),
23578    derive(serde::Serialize, serde::Deserialize),
23579    serde(rename_all = "snake_case")
23580)]
23581#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
23582#[repr(i32)]
23583pub enum ErrorCode {
23584    Misc = 0,
23585    Data = 1,
23586    Conf = 2,
23587    Auth = 3,
23588    Load = 4,
23589}
23590
23591impl ErrorCode {
23592    pub const VARIANTS: [ErrorCode; 5] = [
23593        ErrorCode::Misc,
23594        ErrorCode::Data,
23595        ErrorCode::Conf,
23596        ErrorCode::Auth,
23597        ErrorCode::Load,
23598    ];
23599    pub const VARIANTS_STR: [&'static str; 5] = ["Misc", "Data", "Conf", "Auth", "Load"];
23600
23601    #[must_use]
23602    pub const fn name(&self) -> &'static str {
23603        match self {
23604            Self::Misc => "Misc",
23605            Self::Data => "Data",
23606            Self::Conf => "Conf",
23607            Self::Auth => "Auth",
23608            Self::Load => "Load",
23609        }
23610    }
23611
23612    #[must_use]
23613    pub const fn variants() -> [ErrorCode; 5] {
23614        Self::VARIANTS
23615    }
23616}
23617
23618impl Name for ErrorCode {
23619    #[must_use]
23620    fn name(&self) -> &'static str {
23621        Self::name(self)
23622    }
23623}
23624
23625impl Variants<ErrorCode> for ErrorCode {
23626    fn variants() -> slice::Iter<'static, ErrorCode> {
23627        Self::VARIANTS.iter()
23628    }
23629}
23630
23631impl Enum for ErrorCode {}
23632
23633impl fmt::Display for ErrorCode {
23634    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
23635        f.write_str(self.name())
23636    }
23637}
23638
23639impl TryFrom<i32> for ErrorCode {
23640    type Error = Error;
23641
23642    fn try_from(i: i32) -> Result<Self> {
23643        let e = match i {
23644            0 => ErrorCode::Misc,
23645            1 => ErrorCode::Data,
23646            2 => ErrorCode::Conf,
23647            3 => ErrorCode::Auth,
23648            4 => ErrorCode::Load,
23649            #[allow(unreachable_patterns)]
23650            _ => return Err(Error::Invalid),
23651        };
23652        Ok(e)
23653    }
23654}
23655
23656impl From<ErrorCode> for i32 {
23657    #[must_use]
23658    fn from(e: ErrorCode) -> Self {
23659        e as Self
23660    }
23661}
23662
23663impl ReadXdr for ErrorCode {
23664    #[cfg(feature = "std")]
23665    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
23666        r.with_limited_depth(|r| {
23667            let e = i32::read_xdr(r)?;
23668            let v: Self = e.try_into()?;
23669            Ok(v)
23670        })
23671    }
23672}
23673
23674impl WriteXdr for ErrorCode {
23675    #[cfg(feature = "std")]
23676    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
23677        w.with_limited_depth(|w| {
23678            let i: i32 = (*self).into();
23679            i.write_xdr(w)
23680        })
23681    }
23682}
23683
23684/// SError is an XDR Struct defines as:
23685///
23686/// ```text
23687/// struct Error
23688/// {
23689///     ErrorCode code;
23690///     string msg<100>;
23691/// };
23692/// ```
23693///
23694#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
23695#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
23696#[cfg_attr(
23697    all(feature = "serde", feature = "alloc"),
23698    derive(serde::Serialize, serde::Deserialize),
23699    serde(rename_all = "snake_case")
23700)]
23701#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
23702pub struct SError {
23703    pub code: ErrorCode,
23704    pub msg: StringM<100>,
23705}
23706
23707impl ReadXdr for SError {
23708    #[cfg(feature = "std")]
23709    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
23710        r.with_limited_depth(|r| {
23711            Ok(Self {
23712                code: ErrorCode::read_xdr(r)?,
23713                msg: StringM::<100>::read_xdr(r)?,
23714            })
23715        })
23716    }
23717}
23718
23719impl WriteXdr for SError {
23720    #[cfg(feature = "std")]
23721    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
23722        w.with_limited_depth(|w| {
23723            self.code.write_xdr(w)?;
23724            self.msg.write_xdr(w)?;
23725            Ok(())
23726        })
23727    }
23728}
23729
23730/// SendMore is an XDR Struct defines as:
23731///
23732/// ```text
23733/// struct SendMore
23734/// {
23735///     uint32 numMessages;
23736/// };
23737/// ```
23738///
23739#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
23740#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
23741#[cfg_attr(
23742    all(feature = "serde", feature = "alloc"),
23743    derive(serde::Serialize, serde::Deserialize),
23744    serde(rename_all = "snake_case")
23745)]
23746#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
23747pub struct SendMore {
23748    pub num_messages: u32,
23749}
23750
23751impl ReadXdr for SendMore {
23752    #[cfg(feature = "std")]
23753    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
23754        r.with_limited_depth(|r| {
23755            Ok(Self {
23756                num_messages: u32::read_xdr(r)?,
23757            })
23758        })
23759    }
23760}
23761
23762impl WriteXdr for SendMore {
23763    #[cfg(feature = "std")]
23764    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
23765        w.with_limited_depth(|w| {
23766            self.num_messages.write_xdr(w)?;
23767            Ok(())
23768        })
23769    }
23770}
23771
23772/// SendMoreExtended is an XDR Struct defines as:
23773///
23774/// ```text
23775/// struct SendMoreExtended
23776/// {
23777///     uint32 numMessages;
23778///     uint32 numBytes;
23779/// };
23780/// ```
23781///
23782#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
23783#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
23784#[cfg_attr(
23785    all(feature = "serde", feature = "alloc"),
23786    derive(serde::Serialize, serde::Deserialize),
23787    serde(rename_all = "snake_case")
23788)]
23789#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
23790pub struct SendMoreExtended {
23791    pub num_messages: u32,
23792    pub num_bytes: u32,
23793}
23794
23795impl ReadXdr for SendMoreExtended {
23796    #[cfg(feature = "std")]
23797    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
23798        r.with_limited_depth(|r| {
23799            Ok(Self {
23800                num_messages: u32::read_xdr(r)?,
23801                num_bytes: u32::read_xdr(r)?,
23802            })
23803        })
23804    }
23805}
23806
23807impl WriteXdr for SendMoreExtended {
23808    #[cfg(feature = "std")]
23809    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
23810        w.with_limited_depth(|w| {
23811            self.num_messages.write_xdr(w)?;
23812            self.num_bytes.write_xdr(w)?;
23813            Ok(())
23814        })
23815    }
23816}
23817
23818/// AuthCert is an XDR Struct defines as:
23819///
23820/// ```text
23821/// struct AuthCert
23822/// {
23823///     Curve25519Public pubkey;
23824///     uint64 expiration;
23825///     Signature sig;
23826/// };
23827/// ```
23828///
23829#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
23830#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
23831#[cfg_attr(
23832    all(feature = "serde", feature = "alloc"),
23833    derive(serde::Serialize, serde::Deserialize),
23834    serde(rename_all = "snake_case")
23835)]
23836#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
23837pub struct AuthCert {
23838    pub pubkey: Curve25519Public,
23839    pub expiration: u64,
23840    pub sig: Signature,
23841}
23842
23843impl ReadXdr for AuthCert {
23844    #[cfg(feature = "std")]
23845    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
23846        r.with_limited_depth(|r| {
23847            Ok(Self {
23848                pubkey: Curve25519Public::read_xdr(r)?,
23849                expiration: u64::read_xdr(r)?,
23850                sig: Signature::read_xdr(r)?,
23851            })
23852        })
23853    }
23854}
23855
23856impl WriteXdr for AuthCert {
23857    #[cfg(feature = "std")]
23858    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
23859        w.with_limited_depth(|w| {
23860            self.pubkey.write_xdr(w)?;
23861            self.expiration.write_xdr(w)?;
23862            self.sig.write_xdr(w)?;
23863            Ok(())
23864        })
23865    }
23866}
23867
23868/// Hello is an XDR Struct defines as:
23869///
23870/// ```text
23871/// struct Hello
23872/// {
23873///     uint32 ledgerVersion;
23874///     uint32 overlayVersion;
23875///     uint32 overlayMinVersion;
23876///     Hash networkID;
23877///     string versionStr<100>;
23878///     int listeningPort;
23879///     NodeID peerID;
23880///     AuthCert cert;
23881///     uint256 nonce;
23882/// };
23883/// ```
23884///
23885#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
23886#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
23887#[cfg_attr(
23888    all(feature = "serde", feature = "alloc"),
23889    derive(serde::Serialize, serde::Deserialize),
23890    serde(rename_all = "snake_case")
23891)]
23892#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
23893pub struct Hello {
23894    pub ledger_version: u32,
23895    pub overlay_version: u32,
23896    pub overlay_min_version: u32,
23897    pub network_id: Hash,
23898    pub version_str: StringM<100>,
23899    pub listening_port: i32,
23900    pub peer_id: NodeId,
23901    pub cert: AuthCert,
23902    pub nonce: Uint256,
23903}
23904
23905impl ReadXdr for Hello {
23906    #[cfg(feature = "std")]
23907    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
23908        r.with_limited_depth(|r| {
23909            Ok(Self {
23910                ledger_version: u32::read_xdr(r)?,
23911                overlay_version: u32::read_xdr(r)?,
23912                overlay_min_version: u32::read_xdr(r)?,
23913                network_id: Hash::read_xdr(r)?,
23914                version_str: StringM::<100>::read_xdr(r)?,
23915                listening_port: i32::read_xdr(r)?,
23916                peer_id: NodeId::read_xdr(r)?,
23917                cert: AuthCert::read_xdr(r)?,
23918                nonce: Uint256::read_xdr(r)?,
23919            })
23920        })
23921    }
23922}
23923
23924impl WriteXdr for Hello {
23925    #[cfg(feature = "std")]
23926    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
23927        w.with_limited_depth(|w| {
23928            self.ledger_version.write_xdr(w)?;
23929            self.overlay_version.write_xdr(w)?;
23930            self.overlay_min_version.write_xdr(w)?;
23931            self.network_id.write_xdr(w)?;
23932            self.version_str.write_xdr(w)?;
23933            self.listening_port.write_xdr(w)?;
23934            self.peer_id.write_xdr(w)?;
23935            self.cert.write_xdr(w)?;
23936            self.nonce.write_xdr(w)?;
23937            Ok(())
23938        })
23939    }
23940}
23941
23942/// AuthMsgFlagFlowControlBytesRequested is an XDR Const defines as:
23943///
23944/// ```text
23945/// const AUTH_MSG_FLAG_FLOW_CONTROL_BYTES_REQUESTED = 200;
23946/// ```
23947///
23948pub const AUTH_MSG_FLAG_FLOW_CONTROL_BYTES_REQUESTED: u64 = 200;
23949
23950/// Auth is an XDR Struct defines as:
23951///
23952/// ```text
23953/// struct Auth
23954/// {
23955///     int flags;
23956/// };
23957/// ```
23958///
23959#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
23960#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
23961#[cfg_attr(
23962    all(feature = "serde", feature = "alloc"),
23963    derive(serde::Serialize, serde::Deserialize),
23964    serde(rename_all = "snake_case")
23965)]
23966#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
23967pub struct Auth {
23968    pub flags: i32,
23969}
23970
23971impl ReadXdr for Auth {
23972    #[cfg(feature = "std")]
23973    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
23974        r.with_limited_depth(|r| {
23975            Ok(Self {
23976                flags: i32::read_xdr(r)?,
23977            })
23978        })
23979    }
23980}
23981
23982impl WriteXdr for Auth {
23983    #[cfg(feature = "std")]
23984    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
23985        w.with_limited_depth(|w| {
23986            self.flags.write_xdr(w)?;
23987            Ok(())
23988        })
23989    }
23990}
23991
23992/// IpAddrType is an XDR Enum defines as:
23993///
23994/// ```text
23995/// enum IPAddrType
23996/// {
23997///     IPv4 = 0,
23998///     IPv6 = 1
23999/// };
24000/// ```
24001///
24002// enum
24003#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
24004#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
24005#[cfg_attr(
24006    all(feature = "serde", feature = "alloc"),
24007    derive(serde::Serialize, serde::Deserialize),
24008    serde(rename_all = "snake_case")
24009)]
24010#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
24011#[repr(i32)]
24012pub enum IpAddrType {
24013    IPv4 = 0,
24014    IPv6 = 1,
24015}
24016
24017impl IpAddrType {
24018    pub const VARIANTS: [IpAddrType; 2] = [IpAddrType::IPv4, IpAddrType::IPv6];
24019    pub const VARIANTS_STR: [&'static str; 2] = ["IPv4", "IPv6"];
24020
24021    #[must_use]
24022    pub const fn name(&self) -> &'static str {
24023        match self {
24024            Self::IPv4 => "IPv4",
24025            Self::IPv6 => "IPv6",
24026        }
24027    }
24028
24029    #[must_use]
24030    pub const fn variants() -> [IpAddrType; 2] {
24031        Self::VARIANTS
24032    }
24033}
24034
24035impl Name for IpAddrType {
24036    #[must_use]
24037    fn name(&self) -> &'static str {
24038        Self::name(self)
24039    }
24040}
24041
24042impl Variants<IpAddrType> for IpAddrType {
24043    fn variants() -> slice::Iter<'static, IpAddrType> {
24044        Self::VARIANTS.iter()
24045    }
24046}
24047
24048impl Enum for IpAddrType {}
24049
24050impl fmt::Display for IpAddrType {
24051    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
24052        f.write_str(self.name())
24053    }
24054}
24055
24056impl TryFrom<i32> for IpAddrType {
24057    type Error = Error;
24058
24059    fn try_from(i: i32) -> Result<Self> {
24060        let e = match i {
24061            0 => IpAddrType::IPv4,
24062            1 => IpAddrType::IPv6,
24063            #[allow(unreachable_patterns)]
24064            _ => return Err(Error::Invalid),
24065        };
24066        Ok(e)
24067    }
24068}
24069
24070impl From<IpAddrType> for i32 {
24071    #[must_use]
24072    fn from(e: IpAddrType) -> Self {
24073        e as Self
24074    }
24075}
24076
24077impl ReadXdr for IpAddrType {
24078    #[cfg(feature = "std")]
24079    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
24080        r.with_limited_depth(|r| {
24081            let e = i32::read_xdr(r)?;
24082            let v: Self = e.try_into()?;
24083            Ok(v)
24084        })
24085    }
24086}
24087
24088impl WriteXdr for IpAddrType {
24089    #[cfg(feature = "std")]
24090    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
24091        w.with_limited_depth(|w| {
24092            let i: i32 = (*self).into();
24093            i.write_xdr(w)
24094        })
24095    }
24096}
24097
24098/// PeerAddressIp is an XDR NestedUnion defines as:
24099///
24100/// ```text
24101/// union switch (IPAddrType type)
24102///     {
24103///     case IPv4:
24104///         opaque ipv4[4];
24105///     case IPv6:
24106///         opaque ipv6[16];
24107///     }
24108/// ```
24109///
24110// union with discriminant IpAddrType
24111#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
24112#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
24113#[cfg_attr(
24114    all(feature = "serde", feature = "alloc"),
24115    derive(serde::Serialize, serde::Deserialize),
24116    serde(rename_all = "snake_case")
24117)]
24118#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
24119#[allow(clippy::large_enum_variant)]
24120pub enum PeerAddressIp {
24121    IPv4([u8; 4]),
24122    IPv6([u8; 16]),
24123}
24124
24125impl PeerAddressIp {
24126    pub const VARIANTS: [IpAddrType; 2] = [IpAddrType::IPv4, IpAddrType::IPv6];
24127    pub const VARIANTS_STR: [&'static str; 2] = ["IPv4", "IPv6"];
24128
24129    #[must_use]
24130    pub const fn name(&self) -> &'static str {
24131        match self {
24132            Self::IPv4(_) => "IPv4",
24133            Self::IPv6(_) => "IPv6",
24134        }
24135    }
24136
24137    #[must_use]
24138    pub const fn discriminant(&self) -> IpAddrType {
24139        #[allow(clippy::match_same_arms)]
24140        match self {
24141            Self::IPv4(_) => IpAddrType::IPv4,
24142            Self::IPv6(_) => IpAddrType::IPv6,
24143        }
24144    }
24145
24146    #[must_use]
24147    pub const fn variants() -> [IpAddrType; 2] {
24148        Self::VARIANTS
24149    }
24150}
24151
24152impl Name for PeerAddressIp {
24153    #[must_use]
24154    fn name(&self) -> &'static str {
24155        Self::name(self)
24156    }
24157}
24158
24159impl Discriminant<IpAddrType> for PeerAddressIp {
24160    #[must_use]
24161    fn discriminant(&self) -> IpAddrType {
24162        Self::discriminant(self)
24163    }
24164}
24165
24166impl Variants<IpAddrType> for PeerAddressIp {
24167    fn variants() -> slice::Iter<'static, IpAddrType> {
24168        Self::VARIANTS.iter()
24169    }
24170}
24171
24172impl Union<IpAddrType> for PeerAddressIp {}
24173
24174impl ReadXdr for PeerAddressIp {
24175    #[cfg(feature = "std")]
24176    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
24177        r.with_limited_depth(|r| {
24178            let dv: IpAddrType = <IpAddrType as ReadXdr>::read_xdr(r)?;
24179            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
24180            let v = match dv {
24181                IpAddrType::IPv4 => Self::IPv4(<[u8; 4]>::read_xdr(r)?),
24182                IpAddrType::IPv6 => Self::IPv6(<[u8; 16]>::read_xdr(r)?),
24183                #[allow(unreachable_patterns)]
24184                _ => return Err(Error::Invalid),
24185            };
24186            Ok(v)
24187        })
24188    }
24189}
24190
24191impl WriteXdr for PeerAddressIp {
24192    #[cfg(feature = "std")]
24193    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
24194        w.with_limited_depth(|w| {
24195            self.discriminant().write_xdr(w)?;
24196            #[allow(clippy::match_same_arms)]
24197            match self {
24198                Self::IPv4(v) => v.write_xdr(w)?,
24199                Self::IPv6(v) => v.write_xdr(w)?,
24200            };
24201            Ok(())
24202        })
24203    }
24204}
24205
24206/// PeerAddress is an XDR Struct defines as:
24207///
24208/// ```text
24209/// struct PeerAddress
24210/// {
24211///     union switch (IPAddrType type)
24212///     {
24213///     case IPv4:
24214///         opaque ipv4[4];
24215///     case IPv6:
24216///         opaque ipv6[16];
24217///     }
24218///     ip;
24219///     uint32 port;
24220///     uint32 numFailures;
24221/// };
24222/// ```
24223///
24224#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
24225#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
24226#[cfg_attr(
24227    all(feature = "serde", feature = "alloc"),
24228    derive(serde::Serialize, serde::Deserialize),
24229    serde(rename_all = "snake_case")
24230)]
24231#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
24232pub struct PeerAddress {
24233    pub ip: PeerAddressIp,
24234    pub port: u32,
24235    pub num_failures: u32,
24236}
24237
24238impl ReadXdr for PeerAddress {
24239    #[cfg(feature = "std")]
24240    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
24241        r.with_limited_depth(|r| {
24242            Ok(Self {
24243                ip: PeerAddressIp::read_xdr(r)?,
24244                port: u32::read_xdr(r)?,
24245                num_failures: u32::read_xdr(r)?,
24246            })
24247        })
24248    }
24249}
24250
24251impl WriteXdr for PeerAddress {
24252    #[cfg(feature = "std")]
24253    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
24254        w.with_limited_depth(|w| {
24255            self.ip.write_xdr(w)?;
24256            self.port.write_xdr(w)?;
24257            self.num_failures.write_xdr(w)?;
24258            Ok(())
24259        })
24260    }
24261}
24262
24263/// MessageType is an XDR Enum defines as:
24264///
24265/// ```text
24266/// enum MessageType
24267/// {
24268///     ERROR_MSG = 0,
24269///     AUTH = 2,
24270///     DONT_HAVE = 3,
24271///
24272///     GET_PEERS = 4, // gets a list of peers this guy knows about
24273///     PEERS = 5,
24274///
24275///     GET_TX_SET = 6, // gets a particular txset by hash
24276///     TX_SET = 7,
24277///     GENERALIZED_TX_SET = 17,
24278///
24279///     TRANSACTION = 8, // pass on a tx you have heard about
24280///
24281///     // SCP
24282///     GET_SCP_QUORUMSET = 9,
24283///     SCP_QUORUMSET = 10,
24284///     SCP_MESSAGE = 11,
24285///     GET_SCP_STATE = 12,
24286///
24287///     // new messages
24288///     HELLO = 13,
24289///
24290///     SURVEY_REQUEST = 14,
24291///     SURVEY_RESPONSE = 15,
24292///
24293///     SEND_MORE = 16,
24294///     SEND_MORE_EXTENDED = 20,
24295///
24296///     FLOOD_ADVERT = 18,
24297///     FLOOD_DEMAND = 19,
24298///
24299///     TIME_SLICED_SURVEY_REQUEST = 21,
24300///     TIME_SLICED_SURVEY_RESPONSE = 22,
24301///     TIME_SLICED_SURVEY_START_COLLECTING = 23,
24302///     TIME_SLICED_SURVEY_STOP_COLLECTING = 24
24303/// };
24304/// ```
24305///
24306// enum
24307#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
24308#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
24309#[cfg_attr(
24310    all(feature = "serde", feature = "alloc"),
24311    derive(serde::Serialize, serde::Deserialize),
24312    serde(rename_all = "snake_case")
24313)]
24314#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
24315#[repr(i32)]
24316pub enum MessageType {
24317    ErrorMsg = 0,
24318    Auth = 2,
24319    DontHave = 3,
24320    GetPeers = 4,
24321    Peers = 5,
24322    GetTxSet = 6,
24323    TxSet = 7,
24324    GeneralizedTxSet = 17,
24325    Transaction = 8,
24326    GetScpQuorumset = 9,
24327    ScpQuorumset = 10,
24328    ScpMessage = 11,
24329    GetScpState = 12,
24330    Hello = 13,
24331    SurveyRequest = 14,
24332    SurveyResponse = 15,
24333    SendMore = 16,
24334    SendMoreExtended = 20,
24335    FloodAdvert = 18,
24336    FloodDemand = 19,
24337    TimeSlicedSurveyRequest = 21,
24338    TimeSlicedSurveyResponse = 22,
24339    TimeSlicedSurveyStartCollecting = 23,
24340    TimeSlicedSurveyStopCollecting = 24,
24341}
24342
24343impl MessageType {
24344    pub const VARIANTS: [MessageType; 24] = [
24345        MessageType::ErrorMsg,
24346        MessageType::Auth,
24347        MessageType::DontHave,
24348        MessageType::GetPeers,
24349        MessageType::Peers,
24350        MessageType::GetTxSet,
24351        MessageType::TxSet,
24352        MessageType::GeneralizedTxSet,
24353        MessageType::Transaction,
24354        MessageType::GetScpQuorumset,
24355        MessageType::ScpQuorumset,
24356        MessageType::ScpMessage,
24357        MessageType::GetScpState,
24358        MessageType::Hello,
24359        MessageType::SurveyRequest,
24360        MessageType::SurveyResponse,
24361        MessageType::SendMore,
24362        MessageType::SendMoreExtended,
24363        MessageType::FloodAdvert,
24364        MessageType::FloodDemand,
24365        MessageType::TimeSlicedSurveyRequest,
24366        MessageType::TimeSlicedSurveyResponse,
24367        MessageType::TimeSlicedSurveyStartCollecting,
24368        MessageType::TimeSlicedSurveyStopCollecting,
24369    ];
24370    pub const VARIANTS_STR: [&'static str; 24] = [
24371        "ErrorMsg",
24372        "Auth",
24373        "DontHave",
24374        "GetPeers",
24375        "Peers",
24376        "GetTxSet",
24377        "TxSet",
24378        "GeneralizedTxSet",
24379        "Transaction",
24380        "GetScpQuorumset",
24381        "ScpQuorumset",
24382        "ScpMessage",
24383        "GetScpState",
24384        "Hello",
24385        "SurveyRequest",
24386        "SurveyResponse",
24387        "SendMore",
24388        "SendMoreExtended",
24389        "FloodAdvert",
24390        "FloodDemand",
24391        "TimeSlicedSurveyRequest",
24392        "TimeSlicedSurveyResponse",
24393        "TimeSlicedSurveyStartCollecting",
24394        "TimeSlicedSurveyStopCollecting",
24395    ];
24396
24397    #[must_use]
24398    pub const fn name(&self) -> &'static str {
24399        match self {
24400            Self::ErrorMsg => "ErrorMsg",
24401            Self::Auth => "Auth",
24402            Self::DontHave => "DontHave",
24403            Self::GetPeers => "GetPeers",
24404            Self::Peers => "Peers",
24405            Self::GetTxSet => "GetTxSet",
24406            Self::TxSet => "TxSet",
24407            Self::GeneralizedTxSet => "GeneralizedTxSet",
24408            Self::Transaction => "Transaction",
24409            Self::GetScpQuorumset => "GetScpQuorumset",
24410            Self::ScpQuorumset => "ScpQuorumset",
24411            Self::ScpMessage => "ScpMessage",
24412            Self::GetScpState => "GetScpState",
24413            Self::Hello => "Hello",
24414            Self::SurveyRequest => "SurveyRequest",
24415            Self::SurveyResponse => "SurveyResponse",
24416            Self::SendMore => "SendMore",
24417            Self::SendMoreExtended => "SendMoreExtended",
24418            Self::FloodAdvert => "FloodAdvert",
24419            Self::FloodDemand => "FloodDemand",
24420            Self::TimeSlicedSurveyRequest => "TimeSlicedSurveyRequest",
24421            Self::TimeSlicedSurveyResponse => "TimeSlicedSurveyResponse",
24422            Self::TimeSlicedSurveyStartCollecting => "TimeSlicedSurveyStartCollecting",
24423            Self::TimeSlicedSurveyStopCollecting => "TimeSlicedSurveyStopCollecting",
24424        }
24425    }
24426
24427    #[must_use]
24428    pub const fn variants() -> [MessageType; 24] {
24429        Self::VARIANTS
24430    }
24431}
24432
24433impl Name for MessageType {
24434    #[must_use]
24435    fn name(&self) -> &'static str {
24436        Self::name(self)
24437    }
24438}
24439
24440impl Variants<MessageType> for MessageType {
24441    fn variants() -> slice::Iter<'static, MessageType> {
24442        Self::VARIANTS.iter()
24443    }
24444}
24445
24446impl Enum for MessageType {}
24447
24448impl fmt::Display for MessageType {
24449    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
24450        f.write_str(self.name())
24451    }
24452}
24453
24454impl TryFrom<i32> for MessageType {
24455    type Error = Error;
24456
24457    fn try_from(i: i32) -> Result<Self> {
24458        let e = match i {
24459            0 => MessageType::ErrorMsg,
24460            2 => MessageType::Auth,
24461            3 => MessageType::DontHave,
24462            4 => MessageType::GetPeers,
24463            5 => MessageType::Peers,
24464            6 => MessageType::GetTxSet,
24465            7 => MessageType::TxSet,
24466            17 => MessageType::GeneralizedTxSet,
24467            8 => MessageType::Transaction,
24468            9 => MessageType::GetScpQuorumset,
24469            10 => MessageType::ScpQuorumset,
24470            11 => MessageType::ScpMessage,
24471            12 => MessageType::GetScpState,
24472            13 => MessageType::Hello,
24473            14 => MessageType::SurveyRequest,
24474            15 => MessageType::SurveyResponse,
24475            16 => MessageType::SendMore,
24476            20 => MessageType::SendMoreExtended,
24477            18 => MessageType::FloodAdvert,
24478            19 => MessageType::FloodDemand,
24479            21 => MessageType::TimeSlicedSurveyRequest,
24480            22 => MessageType::TimeSlicedSurveyResponse,
24481            23 => MessageType::TimeSlicedSurveyStartCollecting,
24482            24 => MessageType::TimeSlicedSurveyStopCollecting,
24483            #[allow(unreachable_patterns)]
24484            _ => return Err(Error::Invalid),
24485        };
24486        Ok(e)
24487    }
24488}
24489
24490impl From<MessageType> for i32 {
24491    #[must_use]
24492    fn from(e: MessageType) -> Self {
24493        e as Self
24494    }
24495}
24496
24497impl ReadXdr for MessageType {
24498    #[cfg(feature = "std")]
24499    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
24500        r.with_limited_depth(|r| {
24501            let e = i32::read_xdr(r)?;
24502            let v: Self = e.try_into()?;
24503            Ok(v)
24504        })
24505    }
24506}
24507
24508impl WriteXdr for MessageType {
24509    #[cfg(feature = "std")]
24510    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
24511        w.with_limited_depth(|w| {
24512            let i: i32 = (*self).into();
24513            i.write_xdr(w)
24514        })
24515    }
24516}
24517
24518/// DontHave is an XDR Struct defines as:
24519///
24520/// ```text
24521/// struct DontHave
24522/// {
24523///     MessageType type;
24524///     uint256 reqHash;
24525/// };
24526/// ```
24527///
24528#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
24529#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
24530#[cfg_attr(
24531    all(feature = "serde", feature = "alloc"),
24532    derive(serde::Serialize, serde::Deserialize),
24533    serde(rename_all = "snake_case")
24534)]
24535#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
24536pub struct DontHave {
24537    pub type_: MessageType,
24538    pub req_hash: Uint256,
24539}
24540
24541impl ReadXdr for DontHave {
24542    #[cfg(feature = "std")]
24543    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
24544        r.with_limited_depth(|r| {
24545            Ok(Self {
24546                type_: MessageType::read_xdr(r)?,
24547                req_hash: Uint256::read_xdr(r)?,
24548            })
24549        })
24550    }
24551}
24552
24553impl WriteXdr for DontHave {
24554    #[cfg(feature = "std")]
24555    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
24556        w.with_limited_depth(|w| {
24557            self.type_.write_xdr(w)?;
24558            self.req_hash.write_xdr(w)?;
24559            Ok(())
24560        })
24561    }
24562}
24563
24564/// SurveyMessageCommandType is an XDR Enum defines as:
24565///
24566/// ```text
24567/// enum SurveyMessageCommandType
24568/// {
24569///     SURVEY_TOPOLOGY = 0,
24570///     TIME_SLICED_SURVEY_TOPOLOGY = 1
24571/// };
24572/// ```
24573///
24574// enum
24575#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
24576#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
24577#[cfg_attr(
24578    all(feature = "serde", feature = "alloc"),
24579    derive(serde::Serialize, serde::Deserialize),
24580    serde(rename_all = "snake_case")
24581)]
24582#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
24583#[repr(i32)]
24584pub enum SurveyMessageCommandType {
24585    SurveyTopology = 0,
24586    TimeSlicedSurveyTopology = 1,
24587}
24588
24589impl SurveyMessageCommandType {
24590    pub const VARIANTS: [SurveyMessageCommandType; 2] = [
24591        SurveyMessageCommandType::SurveyTopology,
24592        SurveyMessageCommandType::TimeSlicedSurveyTopology,
24593    ];
24594    pub const VARIANTS_STR: [&'static str; 2] = ["SurveyTopology", "TimeSlicedSurveyTopology"];
24595
24596    #[must_use]
24597    pub const fn name(&self) -> &'static str {
24598        match self {
24599            Self::SurveyTopology => "SurveyTopology",
24600            Self::TimeSlicedSurveyTopology => "TimeSlicedSurveyTopology",
24601        }
24602    }
24603
24604    #[must_use]
24605    pub const fn variants() -> [SurveyMessageCommandType; 2] {
24606        Self::VARIANTS
24607    }
24608}
24609
24610impl Name for SurveyMessageCommandType {
24611    #[must_use]
24612    fn name(&self) -> &'static str {
24613        Self::name(self)
24614    }
24615}
24616
24617impl Variants<SurveyMessageCommandType> for SurveyMessageCommandType {
24618    fn variants() -> slice::Iter<'static, SurveyMessageCommandType> {
24619        Self::VARIANTS.iter()
24620    }
24621}
24622
24623impl Enum for SurveyMessageCommandType {}
24624
24625impl fmt::Display for SurveyMessageCommandType {
24626    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
24627        f.write_str(self.name())
24628    }
24629}
24630
24631impl TryFrom<i32> for SurveyMessageCommandType {
24632    type Error = Error;
24633
24634    fn try_from(i: i32) -> Result<Self> {
24635        let e = match i {
24636            0 => SurveyMessageCommandType::SurveyTopology,
24637            1 => SurveyMessageCommandType::TimeSlicedSurveyTopology,
24638            #[allow(unreachable_patterns)]
24639            _ => return Err(Error::Invalid),
24640        };
24641        Ok(e)
24642    }
24643}
24644
24645impl From<SurveyMessageCommandType> for i32 {
24646    #[must_use]
24647    fn from(e: SurveyMessageCommandType) -> Self {
24648        e as Self
24649    }
24650}
24651
24652impl ReadXdr for SurveyMessageCommandType {
24653    #[cfg(feature = "std")]
24654    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
24655        r.with_limited_depth(|r| {
24656            let e = i32::read_xdr(r)?;
24657            let v: Self = e.try_into()?;
24658            Ok(v)
24659        })
24660    }
24661}
24662
24663impl WriteXdr for SurveyMessageCommandType {
24664    #[cfg(feature = "std")]
24665    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
24666        w.with_limited_depth(|w| {
24667            let i: i32 = (*self).into();
24668            i.write_xdr(w)
24669        })
24670    }
24671}
24672
24673/// SurveyMessageResponseType is an XDR Enum defines as:
24674///
24675/// ```text
24676/// enum SurveyMessageResponseType
24677/// {
24678///     SURVEY_TOPOLOGY_RESPONSE_V0 = 0,
24679///     SURVEY_TOPOLOGY_RESPONSE_V1 = 1,
24680///     SURVEY_TOPOLOGY_RESPONSE_V2 = 2
24681/// };
24682/// ```
24683///
24684// enum
24685#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
24686#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
24687#[cfg_attr(
24688    all(feature = "serde", feature = "alloc"),
24689    derive(serde::Serialize, serde::Deserialize),
24690    serde(rename_all = "snake_case")
24691)]
24692#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
24693#[repr(i32)]
24694pub enum SurveyMessageResponseType {
24695    V0 = 0,
24696    V1 = 1,
24697    V2 = 2,
24698}
24699
24700impl SurveyMessageResponseType {
24701    pub const VARIANTS: [SurveyMessageResponseType; 3] = [
24702        SurveyMessageResponseType::V0,
24703        SurveyMessageResponseType::V1,
24704        SurveyMessageResponseType::V2,
24705    ];
24706    pub const VARIANTS_STR: [&'static str; 3] = ["V0", "V1", "V2"];
24707
24708    #[must_use]
24709    pub const fn name(&self) -> &'static str {
24710        match self {
24711            Self::V0 => "V0",
24712            Self::V1 => "V1",
24713            Self::V2 => "V2",
24714        }
24715    }
24716
24717    #[must_use]
24718    pub const fn variants() -> [SurveyMessageResponseType; 3] {
24719        Self::VARIANTS
24720    }
24721}
24722
24723impl Name for SurveyMessageResponseType {
24724    #[must_use]
24725    fn name(&self) -> &'static str {
24726        Self::name(self)
24727    }
24728}
24729
24730impl Variants<SurveyMessageResponseType> for SurveyMessageResponseType {
24731    fn variants() -> slice::Iter<'static, SurveyMessageResponseType> {
24732        Self::VARIANTS.iter()
24733    }
24734}
24735
24736impl Enum for SurveyMessageResponseType {}
24737
24738impl fmt::Display for SurveyMessageResponseType {
24739    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
24740        f.write_str(self.name())
24741    }
24742}
24743
24744impl TryFrom<i32> for SurveyMessageResponseType {
24745    type Error = Error;
24746
24747    fn try_from(i: i32) -> Result<Self> {
24748        let e = match i {
24749            0 => SurveyMessageResponseType::V0,
24750            1 => SurveyMessageResponseType::V1,
24751            2 => SurveyMessageResponseType::V2,
24752            #[allow(unreachable_patterns)]
24753            _ => return Err(Error::Invalid),
24754        };
24755        Ok(e)
24756    }
24757}
24758
24759impl From<SurveyMessageResponseType> for i32 {
24760    #[must_use]
24761    fn from(e: SurveyMessageResponseType) -> Self {
24762        e as Self
24763    }
24764}
24765
24766impl ReadXdr for SurveyMessageResponseType {
24767    #[cfg(feature = "std")]
24768    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
24769        r.with_limited_depth(|r| {
24770            let e = i32::read_xdr(r)?;
24771            let v: Self = e.try_into()?;
24772            Ok(v)
24773        })
24774    }
24775}
24776
24777impl WriteXdr for SurveyMessageResponseType {
24778    #[cfg(feature = "std")]
24779    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
24780        w.with_limited_depth(|w| {
24781            let i: i32 = (*self).into();
24782            i.write_xdr(w)
24783        })
24784    }
24785}
24786
24787/// TimeSlicedSurveyStartCollectingMessage is an XDR Struct defines as:
24788///
24789/// ```text
24790/// struct TimeSlicedSurveyStartCollectingMessage
24791/// {
24792///     NodeID surveyorID;
24793///     uint32 nonce;
24794///     uint32 ledgerNum;
24795/// };
24796/// ```
24797///
24798#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
24799#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
24800#[cfg_attr(
24801    all(feature = "serde", feature = "alloc"),
24802    derive(serde::Serialize, serde::Deserialize),
24803    serde(rename_all = "snake_case")
24804)]
24805#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
24806pub struct TimeSlicedSurveyStartCollectingMessage {
24807    pub surveyor_id: NodeId,
24808    pub nonce: u32,
24809    pub ledger_num: u32,
24810}
24811
24812impl ReadXdr for TimeSlicedSurveyStartCollectingMessage {
24813    #[cfg(feature = "std")]
24814    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
24815        r.with_limited_depth(|r| {
24816            Ok(Self {
24817                surveyor_id: NodeId::read_xdr(r)?,
24818                nonce: u32::read_xdr(r)?,
24819                ledger_num: u32::read_xdr(r)?,
24820            })
24821        })
24822    }
24823}
24824
24825impl WriteXdr for TimeSlicedSurveyStartCollectingMessage {
24826    #[cfg(feature = "std")]
24827    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
24828        w.with_limited_depth(|w| {
24829            self.surveyor_id.write_xdr(w)?;
24830            self.nonce.write_xdr(w)?;
24831            self.ledger_num.write_xdr(w)?;
24832            Ok(())
24833        })
24834    }
24835}
24836
24837/// SignedTimeSlicedSurveyStartCollectingMessage is an XDR Struct defines as:
24838///
24839/// ```text
24840/// struct SignedTimeSlicedSurveyStartCollectingMessage
24841/// {
24842///     Signature signature;
24843///     TimeSlicedSurveyStartCollectingMessage startCollecting;
24844/// };
24845/// ```
24846///
24847#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
24848#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
24849#[cfg_attr(
24850    all(feature = "serde", feature = "alloc"),
24851    derive(serde::Serialize, serde::Deserialize),
24852    serde(rename_all = "snake_case")
24853)]
24854#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
24855pub struct SignedTimeSlicedSurveyStartCollectingMessage {
24856    pub signature: Signature,
24857    pub start_collecting: TimeSlicedSurveyStartCollectingMessage,
24858}
24859
24860impl ReadXdr for SignedTimeSlicedSurveyStartCollectingMessage {
24861    #[cfg(feature = "std")]
24862    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
24863        r.with_limited_depth(|r| {
24864            Ok(Self {
24865                signature: Signature::read_xdr(r)?,
24866                start_collecting: TimeSlicedSurveyStartCollectingMessage::read_xdr(r)?,
24867            })
24868        })
24869    }
24870}
24871
24872impl WriteXdr for SignedTimeSlicedSurveyStartCollectingMessage {
24873    #[cfg(feature = "std")]
24874    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
24875        w.with_limited_depth(|w| {
24876            self.signature.write_xdr(w)?;
24877            self.start_collecting.write_xdr(w)?;
24878            Ok(())
24879        })
24880    }
24881}
24882
24883/// TimeSlicedSurveyStopCollectingMessage is an XDR Struct defines as:
24884///
24885/// ```text
24886/// struct TimeSlicedSurveyStopCollectingMessage
24887/// {
24888///     NodeID surveyorID;
24889///     uint32 nonce;
24890///     uint32 ledgerNum;
24891/// };
24892/// ```
24893///
24894#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
24895#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
24896#[cfg_attr(
24897    all(feature = "serde", feature = "alloc"),
24898    derive(serde::Serialize, serde::Deserialize),
24899    serde(rename_all = "snake_case")
24900)]
24901#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
24902pub struct TimeSlicedSurveyStopCollectingMessage {
24903    pub surveyor_id: NodeId,
24904    pub nonce: u32,
24905    pub ledger_num: u32,
24906}
24907
24908impl ReadXdr for TimeSlicedSurveyStopCollectingMessage {
24909    #[cfg(feature = "std")]
24910    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
24911        r.with_limited_depth(|r| {
24912            Ok(Self {
24913                surveyor_id: NodeId::read_xdr(r)?,
24914                nonce: u32::read_xdr(r)?,
24915                ledger_num: u32::read_xdr(r)?,
24916            })
24917        })
24918    }
24919}
24920
24921impl WriteXdr for TimeSlicedSurveyStopCollectingMessage {
24922    #[cfg(feature = "std")]
24923    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
24924        w.with_limited_depth(|w| {
24925            self.surveyor_id.write_xdr(w)?;
24926            self.nonce.write_xdr(w)?;
24927            self.ledger_num.write_xdr(w)?;
24928            Ok(())
24929        })
24930    }
24931}
24932
24933/// SignedTimeSlicedSurveyStopCollectingMessage is an XDR Struct defines as:
24934///
24935/// ```text
24936/// struct SignedTimeSlicedSurveyStopCollectingMessage
24937/// {
24938///     Signature signature;
24939///     TimeSlicedSurveyStopCollectingMessage stopCollecting;
24940/// };
24941/// ```
24942///
24943#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
24944#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
24945#[cfg_attr(
24946    all(feature = "serde", feature = "alloc"),
24947    derive(serde::Serialize, serde::Deserialize),
24948    serde(rename_all = "snake_case")
24949)]
24950#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
24951pub struct SignedTimeSlicedSurveyStopCollectingMessage {
24952    pub signature: Signature,
24953    pub stop_collecting: TimeSlicedSurveyStopCollectingMessage,
24954}
24955
24956impl ReadXdr for SignedTimeSlicedSurveyStopCollectingMessage {
24957    #[cfg(feature = "std")]
24958    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
24959        r.with_limited_depth(|r| {
24960            Ok(Self {
24961                signature: Signature::read_xdr(r)?,
24962                stop_collecting: TimeSlicedSurveyStopCollectingMessage::read_xdr(r)?,
24963            })
24964        })
24965    }
24966}
24967
24968impl WriteXdr for SignedTimeSlicedSurveyStopCollectingMessage {
24969    #[cfg(feature = "std")]
24970    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
24971        w.with_limited_depth(|w| {
24972            self.signature.write_xdr(w)?;
24973            self.stop_collecting.write_xdr(w)?;
24974            Ok(())
24975        })
24976    }
24977}
24978
24979/// SurveyRequestMessage is an XDR Struct defines as:
24980///
24981/// ```text
24982/// struct SurveyRequestMessage
24983/// {
24984///     NodeID surveyorPeerID;
24985///     NodeID surveyedPeerID;
24986///     uint32 ledgerNum;
24987///     Curve25519Public encryptionKey;
24988///     SurveyMessageCommandType commandType;
24989/// };
24990/// ```
24991///
24992#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
24993#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
24994#[cfg_attr(
24995    all(feature = "serde", feature = "alloc"),
24996    derive(serde::Serialize, serde::Deserialize),
24997    serde(rename_all = "snake_case")
24998)]
24999#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25000pub struct SurveyRequestMessage {
25001    pub surveyor_peer_id: NodeId,
25002    pub surveyed_peer_id: NodeId,
25003    pub ledger_num: u32,
25004    pub encryption_key: Curve25519Public,
25005    pub command_type: SurveyMessageCommandType,
25006}
25007
25008impl ReadXdr for SurveyRequestMessage {
25009    #[cfg(feature = "std")]
25010    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
25011        r.with_limited_depth(|r| {
25012            Ok(Self {
25013                surveyor_peer_id: NodeId::read_xdr(r)?,
25014                surveyed_peer_id: NodeId::read_xdr(r)?,
25015                ledger_num: u32::read_xdr(r)?,
25016                encryption_key: Curve25519Public::read_xdr(r)?,
25017                command_type: SurveyMessageCommandType::read_xdr(r)?,
25018            })
25019        })
25020    }
25021}
25022
25023impl WriteXdr for SurveyRequestMessage {
25024    #[cfg(feature = "std")]
25025    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
25026        w.with_limited_depth(|w| {
25027            self.surveyor_peer_id.write_xdr(w)?;
25028            self.surveyed_peer_id.write_xdr(w)?;
25029            self.ledger_num.write_xdr(w)?;
25030            self.encryption_key.write_xdr(w)?;
25031            self.command_type.write_xdr(w)?;
25032            Ok(())
25033        })
25034    }
25035}
25036
25037/// TimeSlicedSurveyRequestMessage is an XDR Struct defines as:
25038///
25039/// ```text
25040/// struct TimeSlicedSurveyRequestMessage
25041/// {
25042///     SurveyRequestMessage request;
25043///     uint32 nonce;
25044///     uint32 inboundPeersIndex;
25045///     uint32 outboundPeersIndex;
25046/// };
25047/// ```
25048///
25049#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
25050#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
25051#[cfg_attr(
25052    all(feature = "serde", feature = "alloc"),
25053    derive(serde::Serialize, serde::Deserialize),
25054    serde(rename_all = "snake_case")
25055)]
25056#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25057pub struct TimeSlicedSurveyRequestMessage {
25058    pub request: SurveyRequestMessage,
25059    pub nonce: u32,
25060    pub inbound_peers_index: u32,
25061    pub outbound_peers_index: u32,
25062}
25063
25064impl ReadXdr for TimeSlicedSurveyRequestMessage {
25065    #[cfg(feature = "std")]
25066    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
25067        r.with_limited_depth(|r| {
25068            Ok(Self {
25069                request: SurveyRequestMessage::read_xdr(r)?,
25070                nonce: u32::read_xdr(r)?,
25071                inbound_peers_index: u32::read_xdr(r)?,
25072                outbound_peers_index: u32::read_xdr(r)?,
25073            })
25074        })
25075    }
25076}
25077
25078impl WriteXdr for TimeSlicedSurveyRequestMessage {
25079    #[cfg(feature = "std")]
25080    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
25081        w.with_limited_depth(|w| {
25082            self.request.write_xdr(w)?;
25083            self.nonce.write_xdr(w)?;
25084            self.inbound_peers_index.write_xdr(w)?;
25085            self.outbound_peers_index.write_xdr(w)?;
25086            Ok(())
25087        })
25088    }
25089}
25090
25091/// SignedSurveyRequestMessage is an XDR Struct defines as:
25092///
25093/// ```text
25094/// struct SignedSurveyRequestMessage
25095/// {
25096///     Signature requestSignature;
25097///     SurveyRequestMessage request;
25098/// };
25099/// ```
25100///
25101#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
25102#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
25103#[cfg_attr(
25104    all(feature = "serde", feature = "alloc"),
25105    derive(serde::Serialize, serde::Deserialize),
25106    serde(rename_all = "snake_case")
25107)]
25108#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25109pub struct SignedSurveyRequestMessage {
25110    pub request_signature: Signature,
25111    pub request: SurveyRequestMessage,
25112}
25113
25114impl ReadXdr for SignedSurveyRequestMessage {
25115    #[cfg(feature = "std")]
25116    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
25117        r.with_limited_depth(|r| {
25118            Ok(Self {
25119                request_signature: Signature::read_xdr(r)?,
25120                request: SurveyRequestMessage::read_xdr(r)?,
25121            })
25122        })
25123    }
25124}
25125
25126impl WriteXdr for SignedSurveyRequestMessage {
25127    #[cfg(feature = "std")]
25128    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
25129        w.with_limited_depth(|w| {
25130            self.request_signature.write_xdr(w)?;
25131            self.request.write_xdr(w)?;
25132            Ok(())
25133        })
25134    }
25135}
25136
25137/// SignedTimeSlicedSurveyRequestMessage is an XDR Struct defines as:
25138///
25139/// ```text
25140/// struct SignedTimeSlicedSurveyRequestMessage
25141/// {
25142///     Signature requestSignature;
25143///     TimeSlicedSurveyRequestMessage request;
25144/// };
25145/// ```
25146///
25147#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
25148#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
25149#[cfg_attr(
25150    all(feature = "serde", feature = "alloc"),
25151    derive(serde::Serialize, serde::Deserialize),
25152    serde(rename_all = "snake_case")
25153)]
25154#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25155pub struct SignedTimeSlicedSurveyRequestMessage {
25156    pub request_signature: Signature,
25157    pub request: TimeSlicedSurveyRequestMessage,
25158}
25159
25160impl ReadXdr for SignedTimeSlicedSurveyRequestMessage {
25161    #[cfg(feature = "std")]
25162    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
25163        r.with_limited_depth(|r| {
25164            Ok(Self {
25165                request_signature: Signature::read_xdr(r)?,
25166                request: TimeSlicedSurveyRequestMessage::read_xdr(r)?,
25167            })
25168        })
25169    }
25170}
25171
25172impl WriteXdr for SignedTimeSlicedSurveyRequestMessage {
25173    #[cfg(feature = "std")]
25174    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
25175        w.with_limited_depth(|w| {
25176            self.request_signature.write_xdr(w)?;
25177            self.request.write_xdr(w)?;
25178            Ok(())
25179        })
25180    }
25181}
25182
25183/// EncryptedBody is an XDR Typedef defines as:
25184///
25185/// ```text
25186/// typedef opaque EncryptedBody<64000>;
25187/// ```
25188///
25189#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
25190#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
25191#[derive(Default)]
25192#[cfg_attr(
25193    all(feature = "serde", feature = "alloc"),
25194    derive(serde::Serialize, serde::Deserialize),
25195    serde(rename_all = "snake_case")
25196)]
25197#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25198#[derive(Debug)]
25199pub struct EncryptedBody(pub BytesM<64000>);
25200
25201impl From<EncryptedBody> for BytesM<64000> {
25202    #[must_use]
25203    fn from(x: EncryptedBody) -> Self {
25204        x.0
25205    }
25206}
25207
25208impl From<BytesM<64000>> for EncryptedBody {
25209    #[must_use]
25210    fn from(x: BytesM<64000>) -> Self {
25211        EncryptedBody(x)
25212    }
25213}
25214
25215impl AsRef<BytesM<64000>> for EncryptedBody {
25216    #[must_use]
25217    fn as_ref(&self) -> &BytesM<64000> {
25218        &self.0
25219    }
25220}
25221
25222impl ReadXdr for EncryptedBody {
25223    #[cfg(feature = "std")]
25224    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
25225        r.with_limited_depth(|r| {
25226            let i = BytesM::<64000>::read_xdr(r)?;
25227            let v = EncryptedBody(i);
25228            Ok(v)
25229        })
25230    }
25231}
25232
25233impl WriteXdr for EncryptedBody {
25234    #[cfg(feature = "std")]
25235    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
25236        w.with_limited_depth(|w| self.0.write_xdr(w))
25237    }
25238}
25239
25240impl Deref for EncryptedBody {
25241    type Target = BytesM<64000>;
25242    fn deref(&self) -> &Self::Target {
25243        &self.0
25244    }
25245}
25246
25247impl From<EncryptedBody> for Vec<u8> {
25248    #[must_use]
25249    fn from(x: EncryptedBody) -> Self {
25250        x.0 .0
25251    }
25252}
25253
25254impl TryFrom<Vec<u8>> for EncryptedBody {
25255    type Error = Error;
25256    fn try_from(x: Vec<u8>) -> Result<Self> {
25257        Ok(EncryptedBody(x.try_into()?))
25258    }
25259}
25260
25261#[cfg(feature = "alloc")]
25262impl TryFrom<&Vec<u8>> for EncryptedBody {
25263    type Error = Error;
25264    fn try_from(x: &Vec<u8>) -> Result<Self> {
25265        Ok(EncryptedBody(x.try_into()?))
25266    }
25267}
25268
25269impl AsRef<Vec<u8>> for EncryptedBody {
25270    #[must_use]
25271    fn as_ref(&self) -> &Vec<u8> {
25272        &self.0 .0
25273    }
25274}
25275
25276impl AsRef<[u8]> for EncryptedBody {
25277    #[cfg(feature = "alloc")]
25278    #[must_use]
25279    fn as_ref(&self) -> &[u8] {
25280        &self.0 .0
25281    }
25282    #[cfg(not(feature = "alloc"))]
25283    #[must_use]
25284    fn as_ref(&self) -> &[u8] {
25285        self.0 .0
25286    }
25287}
25288
25289/// SurveyResponseMessage is an XDR Struct defines as:
25290///
25291/// ```text
25292/// struct SurveyResponseMessage
25293/// {
25294///     NodeID surveyorPeerID;
25295///     NodeID surveyedPeerID;
25296///     uint32 ledgerNum;
25297///     SurveyMessageCommandType commandType;
25298///     EncryptedBody encryptedBody;
25299/// };
25300/// ```
25301///
25302#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
25303#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
25304#[cfg_attr(
25305    all(feature = "serde", feature = "alloc"),
25306    derive(serde::Serialize, serde::Deserialize),
25307    serde(rename_all = "snake_case")
25308)]
25309#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25310pub struct SurveyResponseMessage {
25311    pub surveyor_peer_id: NodeId,
25312    pub surveyed_peer_id: NodeId,
25313    pub ledger_num: u32,
25314    pub command_type: SurveyMessageCommandType,
25315    pub encrypted_body: EncryptedBody,
25316}
25317
25318impl ReadXdr for SurveyResponseMessage {
25319    #[cfg(feature = "std")]
25320    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
25321        r.with_limited_depth(|r| {
25322            Ok(Self {
25323                surveyor_peer_id: NodeId::read_xdr(r)?,
25324                surveyed_peer_id: NodeId::read_xdr(r)?,
25325                ledger_num: u32::read_xdr(r)?,
25326                command_type: SurveyMessageCommandType::read_xdr(r)?,
25327                encrypted_body: EncryptedBody::read_xdr(r)?,
25328            })
25329        })
25330    }
25331}
25332
25333impl WriteXdr for SurveyResponseMessage {
25334    #[cfg(feature = "std")]
25335    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
25336        w.with_limited_depth(|w| {
25337            self.surveyor_peer_id.write_xdr(w)?;
25338            self.surveyed_peer_id.write_xdr(w)?;
25339            self.ledger_num.write_xdr(w)?;
25340            self.command_type.write_xdr(w)?;
25341            self.encrypted_body.write_xdr(w)?;
25342            Ok(())
25343        })
25344    }
25345}
25346
25347/// TimeSlicedSurveyResponseMessage is an XDR Struct defines as:
25348///
25349/// ```text
25350/// struct TimeSlicedSurveyResponseMessage
25351/// {
25352///     SurveyResponseMessage response;
25353///     uint32 nonce;
25354/// };
25355/// ```
25356///
25357#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
25358#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
25359#[cfg_attr(
25360    all(feature = "serde", feature = "alloc"),
25361    derive(serde::Serialize, serde::Deserialize),
25362    serde(rename_all = "snake_case")
25363)]
25364#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25365pub struct TimeSlicedSurveyResponseMessage {
25366    pub response: SurveyResponseMessage,
25367    pub nonce: u32,
25368}
25369
25370impl ReadXdr for TimeSlicedSurveyResponseMessage {
25371    #[cfg(feature = "std")]
25372    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
25373        r.with_limited_depth(|r| {
25374            Ok(Self {
25375                response: SurveyResponseMessage::read_xdr(r)?,
25376                nonce: u32::read_xdr(r)?,
25377            })
25378        })
25379    }
25380}
25381
25382impl WriteXdr for TimeSlicedSurveyResponseMessage {
25383    #[cfg(feature = "std")]
25384    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
25385        w.with_limited_depth(|w| {
25386            self.response.write_xdr(w)?;
25387            self.nonce.write_xdr(w)?;
25388            Ok(())
25389        })
25390    }
25391}
25392
25393/// SignedSurveyResponseMessage is an XDR Struct defines as:
25394///
25395/// ```text
25396/// struct SignedSurveyResponseMessage
25397/// {
25398///     Signature responseSignature;
25399///     SurveyResponseMessage response;
25400/// };
25401/// ```
25402///
25403#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
25404#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
25405#[cfg_attr(
25406    all(feature = "serde", feature = "alloc"),
25407    derive(serde::Serialize, serde::Deserialize),
25408    serde(rename_all = "snake_case")
25409)]
25410#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25411pub struct SignedSurveyResponseMessage {
25412    pub response_signature: Signature,
25413    pub response: SurveyResponseMessage,
25414}
25415
25416impl ReadXdr for SignedSurveyResponseMessage {
25417    #[cfg(feature = "std")]
25418    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
25419        r.with_limited_depth(|r| {
25420            Ok(Self {
25421                response_signature: Signature::read_xdr(r)?,
25422                response: SurveyResponseMessage::read_xdr(r)?,
25423            })
25424        })
25425    }
25426}
25427
25428impl WriteXdr for SignedSurveyResponseMessage {
25429    #[cfg(feature = "std")]
25430    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
25431        w.with_limited_depth(|w| {
25432            self.response_signature.write_xdr(w)?;
25433            self.response.write_xdr(w)?;
25434            Ok(())
25435        })
25436    }
25437}
25438
25439/// SignedTimeSlicedSurveyResponseMessage is an XDR Struct defines as:
25440///
25441/// ```text
25442/// struct SignedTimeSlicedSurveyResponseMessage
25443/// {
25444///     Signature responseSignature;
25445///     TimeSlicedSurveyResponseMessage response;
25446/// };
25447/// ```
25448///
25449#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
25450#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
25451#[cfg_attr(
25452    all(feature = "serde", feature = "alloc"),
25453    derive(serde::Serialize, serde::Deserialize),
25454    serde(rename_all = "snake_case")
25455)]
25456#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25457pub struct SignedTimeSlicedSurveyResponseMessage {
25458    pub response_signature: Signature,
25459    pub response: TimeSlicedSurveyResponseMessage,
25460}
25461
25462impl ReadXdr for SignedTimeSlicedSurveyResponseMessage {
25463    #[cfg(feature = "std")]
25464    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
25465        r.with_limited_depth(|r| {
25466            Ok(Self {
25467                response_signature: Signature::read_xdr(r)?,
25468                response: TimeSlicedSurveyResponseMessage::read_xdr(r)?,
25469            })
25470        })
25471    }
25472}
25473
25474impl WriteXdr for SignedTimeSlicedSurveyResponseMessage {
25475    #[cfg(feature = "std")]
25476    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
25477        w.with_limited_depth(|w| {
25478            self.response_signature.write_xdr(w)?;
25479            self.response.write_xdr(w)?;
25480            Ok(())
25481        })
25482    }
25483}
25484
25485/// PeerStats is an XDR Struct defines as:
25486///
25487/// ```text
25488/// struct PeerStats
25489/// {
25490///     NodeID id;
25491///     string versionStr<100>;
25492///     uint64 messagesRead;
25493///     uint64 messagesWritten;
25494///     uint64 bytesRead;
25495///     uint64 bytesWritten;
25496///     uint64 secondsConnected;
25497///
25498///     uint64 uniqueFloodBytesRecv;
25499///     uint64 duplicateFloodBytesRecv;
25500///     uint64 uniqueFetchBytesRecv;
25501///     uint64 duplicateFetchBytesRecv;
25502///
25503///     uint64 uniqueFloodMessageRecv;
25504///     uint64 duplicateFloodMessageRecv;
25505///     uint64 uniqueFetchMessageRecv;
25506///     uint64 duplicateFetchMessageRecv;
25507/// };
25508/// ```
25509///
25510#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
25511#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
25512#[cfg_attr(
25513    all(feature = "serde", feature = "alloc"),
25514    derive(serde::Serialize, serde::Deserialize),
25515    serde(rename_all = "snake_case")
25516)]
25517#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25518pub struct PeerStats {
25519    pub id: NodeId,
25520    pub version_str: StringM<100>,
25521    pub messages_read: u64,
25522    pub messages_written: u64,
25523    pub bytes_read: u64,
25524    pub bytes_written: u64,
25525    pub seconds_connected: u64,
25526    pub unique_flood_bytes_recv: u64,
25527    pub duplicate_flood_bytes_recv: u64,
25528    pub unique_fetch_bytes_recv: u64,
25529    pub duplicate_fetch_bytes_recv: u64,
25530    pub unique_flood_message_recv: u64,
25531    pub duplicate_flood_message_recv: u64,
25532    pub unique_fetch_message_recv: u64,
25533    pub duplicate_fetch_message_recv: u64,
25534}
25535
25536impl ReadXdr for PeerStats {
25537    #[cfg(feature = "std")]
25538    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
25539        r.with_limited_depth(|r| {
25540            Ok(Self {
25541                id: NodeId::read_xdr(r)?,
25542                version_str: StringM::<100>::read_xdr(r)?,
25543                messages_read: u64::read_xdr(r)?,
25544                messages_written: u64::read_xdr(r)?,
25545                bytes_read: u64::read_xdr(r)?,
25546                bytes_written: u64::read_xdr(r)?,
25547                seconds_connected: u64::read_xdr(r)?,
25548                unique_flood_bytes_recv: u64::read_xdr(r)?,
25549                duplicate_flood_bytes_recv: u64::read_xdr(r)?,
25550                unique_fetch_bytes_recv: u64::read_xdr(r)?,
25551                duplicate_fetch_bytes_recv: u64::read_xdr(r)?,
25552                unique_flood_message_recv: u64::read_xdr(r)?,
25553                duplicate_flood_message_recv: u64::read_xdr(r)?,
25554                unique_fetch_message_recv: u64::read_xdr(r)?,
25555                duplicate_fetch_message_recv: u64::read_xdr(r)?,
25556            })
25557        })
25558    }
25559}
25560
25561impl WriteXdr for PeerStats {
25562    #[cfg(feature = "std")]
25563    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
25564        w.with_limited_depth(|w| {
25565            self.id.write_xdr(w)?;
25566            self.version_str.write_xdr(w)?;
25567            self.messages_read.write_xdr(w)?;
25568            self.messages_written.write_xdr(w)?;
25569            self.bytes_read.write_xdr(w)?;
25570            self.bytes_written.write_xdr(w)?;
25571            self.seconds_connected.write_xdr(w)?;
25572            self.unique_flood_bytes_recv.write_xdr(w)?;
25573            self.duplicate_flood_bytes_recv.write_xdr(w)?;
25574            self.unique_fetch_bytes_recv.write_xdr(w)?;
25575            self.duplicate_fetch_bytes_recv.write_xdr(w)?;
25576            self.unique_flood_message_recv.write_xdr(w)?;
25577            self.duplicate_flood_message_recv.write_xdr(w)?;
25578            self.unique_fetch_message_recv.write_xdr(w)?;
25579            self.duplicate_fetch_message_recv.write_xdr(w)?;
25580            Ok(())
25581        })
25582    }
25583}
25584
25585/// PeerStatList is an XDR Typedef defines as:
25586///
25587/// ```text
25588/// typedef PeerStats PeerStatList<25>;
25589/// ```
25590///
25591#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
25592#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
25593#[derive(Default)]
25594#[cfg_attr(
25595    all(feature = "serde", feature = "alloc"),
25596    derive(serde::Serialize, serde::Deserialize),
25597    serde(rename_all = "snake_case")
25598)]
25599#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25600#[derive(Debug)]
25601pub struct PeerStatList(pub VecM<PeerStats, 25>);
25602
25603impl From<PeerStatList> for VecM<PeerStats, 25> {
25604    #[must_use]
25605    fn from(x: PeerStatList) -> Self {
25606        x.0
25607    }
25608}
25609
25610impl From<VecM<PeerStats, 25>> for PeerStatList {
25611    #[must_use]
25612    fn from(x: VecM<PeerStats, 25>) -> Self {
25613        PeerStatList(x)
25614    }
25615}
25616
25617impl AsRef<VecM<PeerStats, 25>> for PeerStatList {
25618    #[must_use]
25619    fn as_ref(&self) -> &VecM<PeerStats, 25> {
25620        &self.0
25621    }
25622}
25623
25624impl ReadXdr for PeerStatList {
25625    #[cfg(feature = "std")]
25626    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
25627        r.with_limited_depth(|r| {
25628            let i = VecM::<PeerStats, 25>::read_xdr(r)?;
25629            let v = PeerStatList(i);
25630            Ok(v)
25631        })
25632    }
25633}
25634
25635impl WriteXdr for PeerStatList {
25636    #[cfg(feature = "std")]
25637    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
25638        w.with_limited_depth(|w| self.0.write_xdr(w))
25639    }
25640}
25641
25642impl Deref for PeerStatList {
25643    type Target = VecM<PeerStats, 25>;
25644    fn deref(&self) -> &Self::Target {
25645        &self.0
25646    }
25647}
25648
25649impl From<PeerStatList> for Vec<PeerStats> {
25650    #[must_use]
25651    fn from(x: PeerStatList) -> Self {
25652        x.0 .0
25653    }
25654}
25655
25656impl TryFrom<Vec<PeerStats>> for PeerStatList {
25657    type Error = Error;
25658    fn try_from(x: Vec<PeerStats>) -> Result<Self> {
25659        Ok(PeerStatList(x.try_into()?))
25660    }
25661}
25662
25663#[cfg(feature = "alloc")]
25664impl TryFrom<&Vec<PeerStats>> for PeerStatList {
25665    type Error = Error;
25666    fn try_from(x: &Vec<PeerStats>) -> Result<Self> {
25667        Ok(PeerStatList(x.try_into()?))
25668    }
25669}
25670
25671impl AsRef<Vec<PeerStats>> for PeerStatList {
25672    #[must_use]
25673    fn as_ref(&self) -> &Vec<PeerStats> {
25674        &self.0 .0
25675    }
25676}
25677
25678impl AsRef<[PeerStats]> for PeerStatList {
25679    #[cfg(feature = "alloc")]
25680    #[must_use]
25681    fn as_ref(&self) -> &[PeerStats] {
25682        &self.0 .0
25683    }
25684    #[cfg(not(feature = "alloc"))]
25685    #[must_use]
25686    fn as_ref(&self) -> &[PeerStats] {
25687        self.0 .0
25688    }
25689}
25690
25691/// TimeSlicedNodeData is an XDR Struct defines as:
25692///
25693/// ```text
25694/// struct TimeSlicedNodeData
25695/// {
25696///     uint32 addedAuthenticatedPeers;
25697///     uint32 droppedAuthenticatedPeers;
25698///     uint32 totalInboundPeerCount;
25699///     uint32 totalOutboundPeerCount;
25700///
25701///     // SCP stats
25702///     uint32 p75SCPFirstToSelfLatencyMs;
25703///     uint32 p75SCPSelfToOtherLatencyMs;
25704///
25705///     // How many times the node lost sync in the time slice
25706///     uint32 lostSyncCount;
25707///
25708///     // Config data
25709///     bool isValidator;
25710///     uint32 maxInboundPeerCount;
25711///     uint32 maxOutboundPeerCount;
25712/// };
25713/// ```
25714///
25715#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
25716#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
25717#[cfg_attr(
25718    all(feature = "serde", feature = "alloc"),
25719    derive(serde::Serialize, serde::Deserialize),
25720    serde(rename_all = "snake_case")
25721)]
25722#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25723pub struct TimeSlicedNodeData {
25724    pub added_authenticated_peers: u32,
25725    pub dropped_authenticated_peers: u32,
25726    pub total_inbound_peer_count: u32,
25727    pub total_outbound_peer_count: u32,
25728    pub p75_scp_first_to_self_latency_ms: u32,
25729    pub p75_scp_self_to_other_latency_ms: u32,
25730    pub lost_sync_count: u32,
25731    pub is_validator: bool,
25732    pub max_inbound_peer_count: u32,
25733    pub max_outbound_peer_count: u32,
25734}
25735
25736impl ReadXdr for TimeSlicedNodeData {
25737    #[cfg(feature = "std")]
25738    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
25739        r.with_limited_depth(|r| {
25740            Ok(Self {
25741                added_authenticated_peers: u32::read_xdr(r)?,
25742                dropped_authenticated_peers: u32::read_xdr(r)?,
25743                total_inbound_peer_count: u32::read_xdr(r)?,
25744                total_outbound_peer_count: u32::read_xdr(r)?,
25745                p75_scp_first_to_self_latency_ms: u32::read_xdr(r)?,
25746                p75_scp_self_to_other_latency_ms: u32::read_xdr(r)?,
25747                lost_sync_count: u32::read_xdr(r)?,
25748                is_validator: bool::read_xdr(r)?,
25749                max_inbound_peer_count: u32::read_xdr(r)?,
25750                max_outbound_peer_count: u32::read_xdr(r)?,
25751            })
25752        })
25753    }
25754}
25755
25756impl WriteXdr for TimeSlicedNodeData {
25757    #[cfg(feature = "std")]
25758    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
25759        w.with_limited_depth(|w| {
25760            self.added_authenticated_peers.write_xdr(w)?;
25761            self.dropped_authenticated_peers.write_xdr(w)?;
25762            self.total_inbound_peer_count.write_xdr(w)?;
25763            self.total_outbound_peer_count.write_xdr(w)?;
25764            self.p75_scp_first_to_self_latency_ms.write_xdr(w)?;
25765            self.p75_scp_self_to_other_latency_ms.write_xdr(w)?;
25766            self.lost_sync_count.write_xdr(w)?;
25767            self.is_validator.write_xdr(w)?;
25768            self.max_inbound_peer_count.write_xdr(w)?;
25769            self.max_outbound_peer_count.write_xdr(w)?;
25770            Ok(())
25771        })
25772    }
25773}
25774
25775/// TimeSlicedPeerData is an XDR Struct defines as:
25776///
25777/// ```text
25778/// struct TimeSlicedPeerData
25779/// {
25780///     PeerStats peerStats;
25781///     uint32 averageLatencyMs;
25782/// };
25783/// ```
25784///
25785#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
25786#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
25787#[cfg_attr(
25788    all(feature = "serde", feature = "alloc"),
25789    derive(serde::Serialize, serde::Deserialize),
25790    serde(rename_all = "snake_case")
25791)]
25792#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25793pub struct TimeSlicedPeerData {
25794    pub peer_stats: PeerStats,
25795    pub average_latency_ms: u32,
25796}
25797
25798impl ReadXdr for TimeSlicedPeerData {
25799    #[cfg(feature = "std")]
25800    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
25801        r.with_limited_depth(|r| {
25802            Ok(Self {
25803                peer_stats: PeerStats::read_xdr(r)?,
25804                average_latency_ms: u32::read_xdr(r)?,
25805            })
25806        })
25807    }
25808}
25809
25810impl WriteXdr for TimeSlicedPeerData {
25811    #[cfg(feature = "std")]
25812    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
25813        w.with_limited_depth(|w| {
25814            self.peer_stats.write_xdr(w)?;
25815            self.average_latency_ms.write_xdr(w)?;
25816            Ok(())
25817        })
25818    }
25819}
25820
25821/// TimeSlicedPeerDataList is an XDR Typedef defines as:
25822///
25823/// ```text
25824/// typedef TimeSlicedPeerData TimeSlicedPeerDataList<25>;
25825/// ```
25826///
25827#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
25828#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
25829#[derive(Default)]
25830#[cfg_attr(
25831    all(feature = "serde", feature = "alloc"),
25832    derive(serde::Serialize, serde::Deserialize),
25833    serde(rename_all = "snake_case")
25834)]
25835#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25836#[derive(Debug)]
25837pub struct TimeSlicedPeerDataList(pub VecM<TimeSlicedPeerData, 25>);
25838
25839impl From<TimeSlicedPeerDataList> for VecM<TimeSlicedPeerData, 25> {
25840    #[must_use]
25841    fn from(x: TimeSlicedPeerDataList) -> Self {
25842        x.0
25843    }
25844}
25845
25846impl From<VecM<TimeSlicedPeerData, 25>> for TimeSlicedPeerDataList {
25847    #[must_use]
25848    fn from(x: VecM<TimeSlicedPeerData, 25>) -> Self {
25849        TimeSlicedPeerDataList(x)
25850    }
25851}
25852
25853impl AsRef<VecM<TimeSlicedPeerData, 25>> for TimeSlicedPeerDataList {
25854    #[must_use]
25855    fn as_ref(&self) -> &VecM<TimeSlicedPeerData, 25> {
25856        &self.0
25857    }
25858}
25859
25860impl ReadXdr for TimeSlicedPeerDataList {
25861    #[cfg(feature = "std")]
25862    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
25863        r.with_limited_depth(|r| {
25864            let i = VecM::<TimeSlicedPeerData, 25>::read_xdr(r)?;
25865            let v = TimeSlicedPeerDataList(i);
25866            Ok(v)
25867        })
25868    }
25869}
25870
25871impl WriteXdr for TimeSlicedPeerDataList {
25872    #[cfg(feature = "std")]
25873    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
25874        w.with_limited_depth(|w| self.0.write_xdr(w))
25875    }
25876}
25877
25878impl Deref for TimeSlicedPeerDataList {
25879    type Target = VecM<TimeSlicedPeerData, 25>;
25880    fn deref(&self) -> &Self::Target {
25881        &self.0
25882    }
25883}
25884
25885impl From<TimeSlicedPeerDataList> for Vec<TimeSlicedPeerData> {
25886    #[must_use]
25887    fn from(x: TimeSlicedPeerDataList) -> Self {
25888        x.0 .0
25889    }
25890}
25891
25892impl TryFrom<Vec<TimeSlicedPeerData>> for TimeSlicedPeerDataList {
25893    type Error = Error;
25894    fn try_from(x: Vec<TimeSlicedPeerData>) -> Result<Self> {
25895        Ok(TimeSlicedPeerDataList(x.try_into()?))
25896    }
25897}
25898
25899#[cfg(feature = "alloc")]
25900impl TryFrom<&Vec<TimeSlicedPeerData>> for TimeSlicedPeerDataList {
25901    type Error = Error;
25902    fn try_from(x: &Vec<TimeSlicedPeerData>) -> Result<Self> {
25903        Ok(TimeSlicedPeerDataList(x.try_into()?))
25904    }
25905}
25906
25907impl AsRef<Vec<TimeSlicedPeerData>> for TimeSlicedPeerDataList {
25908    #[must_use]
25909    fn as_ref(&self) -> &Vec<TimeSlicedPeerData> {
25910        &self.0 .0
25911    }
25912}
25913
25914impl AsRef<[TimeSlicedPeerData]> for TimeSlicedPeerDataList {
25915    #[cfg(feature = "alloc")]
25916    #[must_use]
25917    fn as_ref(&self) -> &[TimeSlicedPeerData] {
25918        &self.0 .0
25919    }
25920    #[cfg(not(feature = "alloc"))]
25921    #[must_use]
25922    fn as_ref(&self) -> &[TimeSlicedPeerData] {
25923        self.0 .0
25924    }
25925}
25926
25927/// TopologyResponseBodyV0 is an XDR Struct defines as:
25928///
25929/// ```text
25930/// struct TopologyResponseBodyV0
25931/// {
25932///     PeerStatList inboundPeers;
25933///     PeerStatList outboundPeers;
25934///
25935///     uint32 totalInboundPeerCount;
25936///     uint32 totalOutboundPeerCount;
25937/// };
25938/// ```
25939///
25940#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
25941#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
25942#[cfg_attr(
25943    all(feature = "serde", feature = "alloc"),
25944    derive(serde::Serialize, serde::Deserialize),
25945    serde(rename_all = "snake_case")
25946)]
25947#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25948pub struct TopologyResponseBodyV0 {
25949    pub inbound_peers: PeerStatList,
25950    pub outbound_peers: PeerStatList,
25951    pub total_inbound_peer_count: u32,
25952    pub total_outbound_peer_count: u32,
25953}
25954
25955impl ReadXdr for TopologyResponseBodyV0 {
25956    #[cfg(feature = "std")]
25957    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
25958        r.with_limited_depth(|r| {
25959            Ok(Self {
25960                inbound_peers: PeerStatList::read_xdr(r)?,
25961                outbound_peers: PeerStatList::read_xdr(r)?,
25962                total_inbound_peer_count: u32::read_xdr(r)?,
25963                total_outbound_peer_count: u32::read_xdr(r)?,
25964            })
25965        })
25966    }
25967}
25968
25969impl WriteXdr for TopologyResponseBodyV0 {
25970    #[cfg(feature = "std")]
25971    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
25972        w.with_limited_depth(|w| {
25973            self.inbound_peers.write_xdr(w)?;
25974            self.outbound_peers.write_xdr(w)?;
25975            self.total_inbound_peer_count.write_xdr(w)?;
25976            self.total_outbound_peer_count.write_xdr(w)?;
25977            Ok(())
25978        })
25979    }
25980}
25981
25982/// TopologyResponseBodyV1 is an XDR Struct defines as:
25983///
25984/// ```text
25985/// struct TopologyResponseBodyV1
25986/// {
25987///     PeerStatList inboundPeers;
25988///     PeerStatList outboundPeers;
25989///
25990///     uint32 totalInboundPeerCount;
25991///     uint32 totalOutboundPeerCount;
25992///
25993///     uint32 maxInboundPeerCount;
25994///     uint32 maxOutboundPeerCount;
25995/// };
25996/// ```
25997///
25998#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
25999#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
26000#[cfg_attr(
26001    all(feature = "serde", feature = "alloc"),
26002    derive(serde::Serialize, serde::Deserialize),
26003    serde(rename_all = "snake_case")
26004)]
26005#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
26006pub struct TopologyResponseBodyV1 {
26007    pub inbound_peers: PeerStatList,
26008    pub outbound_peers: PeerStatList,
26009    pub total_inbound_peer_count: u32,
26010    pub total_outbound_peer_count: u32,
26011    pub max_inbound_peer_count: u32,
26012    pub max_outbound_peer_count: u32,
26013}
26014
26015impl ReadXdr for TopologyResponseBodyV1 {
26016    #[cfg(feature = "std")]
26017    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
26018        r.with_limited_depth(|r| {
26019            Ok(Self {
26020                inbound_peers: PeerStatList::read_xdr(r)?,
26021                outbound_peers: PeerStatList::read_xdr(r)?,
26022                total_inbound_peer_count: u32::read_xdr(r)?,
26023                total_outbound_peer_count: u32::read_xdr(r)?,
26024                max_inbound_peer_count: u32::read_xdr(r)?,
26025                max_outbound_peer_count: u32::read_xdr(r)?,
26026            })
26027        })
26028    }
26029}
26030
26031impl WriteXdr for TopologyResponseBodyV1 {
26032    #[cfg(feature = "std")]
26033    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
26034        w.with_limited_depth(|w| {
26035            self.inbound_peers.write_xdr(w)?;
26036            self.outbound_peers.write_xdr(w)?;
26037            self.total_inbound_peer_count.write_xdr(w)?;
26038            self.total_outbound_peer_count.write_xdr(w)?;
26039            self.max_inbound_peer_count.write_xdr(w)?;
26040            self.max_outbound_peer_count.write_xdr(w)?;
26041            Ok(())
26042        })
26043    }
26044}
26045
26046/// TopologyResponseBodyV2 is an XDR Struct defines as:
26047///
26048/// ```text
26049/// struct TopologyResponseBodyV2
26050/// {
26051///     TimeSlicedPeerDataList inboundPeers;
26052///     TimeSlicedPeerDataList outboundPeers;
26053///     TimeSlicedNodeData nodeData;
26054/// };
26055/// ```
26056///
26057#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
26058#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
26059#[cfg_attr(
26060    all(feature = "serde", feature = "alloc"),
26061    derive(serde::Serialize, serde::Deserialize),
26062    serde(rename_all = "snake_case")
26063)]
26064#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
26065pub struct TopologyResponseBodyV2 {
26066    pub inbound_peers: TimeSlicedPeerDataList,
26067    pub outbound_peers: TimeSlicedPeerDataList,
26068    pub node_data: TimeSlicedNodeData,
26069}
26070
26071impl ReadXdr for TopologyResponseBodyV2 {
26072    #[cfg(feature = "std")]
26073    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
26074        r.with_limited_depth(|r| {
26075            Ok(Self {
26076                inbound_peers: TimeSlicedPeerDataList::read_xdr(r)?,
26077                outbound_peers: TimeSlicedPeerDataList::read_xdr(r)?,
26078                node_data: TimeSlicedNodeData::read_xdr(r)?,
26079            })
26080        })
26081    }
26082}
26083
26084impl WriteXdr for TopologyResponseBodyV2 {
26085    #[cfg(feature = "std")]
26086    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
26087        w.with_limited_depth(|w| {
26088            self.inbound_peers.write_xdr(w)?;
26089            self.outbound_peers.write_xdr(w)?;
26090            self.node_data.write_xdr(w)?;
26091            Ok(())
26092        })
26093    }
26094}
26095
26096/// SurveyResponseBody is an XDR Union defines as:
26097///
26098/// ```text
26099/// union SurveyResponseBody switch (SurveyMessageResponseType type)
26100/// {
26101/// case SURVEY_TOPOLOGY_RESPONSE_V0:
26102///     TopologyResponseBodyV0 topologyResponseBodyV0;
26103/// case SURVEY_TOPOLOGY_RESPONSE_V1:
26104///     TopologyResponseBodyV1 topologyResponseBodyV1;
26105/// case SURVEY_TOPOLOGY_RESPONSE_V2:
26106///     TopologyResponseBodyV2 topologyResponseBodyV2;
26107/// };
26108/// ```
26109///
26110// union with discriminant SurveyMessageResponseType
26111#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
26112#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
26113#[cfg_attr(
26114    all(feature = "serde", feature = "alloc"),
26115    derive(serde::Serialize, serde::Deserialize),
26116    serde(rename_all = "snake_case")
26117)]
26118#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
26119#[allow(clippy::large_enum_variant)]
26120pub enum SurveyResponseBody {
26121    V0(TopologyResponseBodyV0),
26122    V1(TopologyResponseBodyV1),
26123    V2(TopologyResponseBodyV2),
26124}
26125
26126impl SurveyResponseBody {
26127    pub const VARIANTS: [SurveyMessageResponseType; 3] = [
26128        SurveyMessageResponseType::V0,
26129        SurveyMessageResponseType::V1,
26130        SurveyMessageResponseType::V2,
26131    ];
26132    pub const VARIANTS_STR: [&'static str; 3] = ["V0", "V1", "V2"];
26133
26134    #[must_use]
26135    pub const fn name(&self) -> &'static str {
26136        match self {
26137            Self::V0(_) => "V0",
26138            Self::V1(_) => "V1",
26139            Self::V2(_) => "V2",
26140        }
26141    }
26142
26143    #[must_use]
26144    pub const fn discriminant(&self) -> SurveyMessageResponseType {
26145        #[allow(clippy::match_same_arms)]
26146        match self {
26147            Self::V0(_) => SurveyMessageResponseType::V0,
26148            Self::V1(_) => SurveyMessageResponseType::V1,
26149            Self::V2(_) => SurveyMessageResponseType::V2,
26150        }
26151    }
26152
26153    #[must_use]
26154    pub const fn variants() -> [SurveyMessageResponseType; 3] {
26155        Self::VARIANTS
26156    }
26157}
26158
26159impl Name for SurveyResponseBody {
26160    #[must_use]
26161    fn name(&self) -> &'static str {
26162        Self::name(self)
26163    }
26164}
26165
26166impl Discriminant<SurveyMessageResponseType> for SurveyResponseBody {
26167    #[must_use]
26168    fn discriminant(&self) -> SurveyMessageResponseType {
26169        Self::discriminant(self)
26170    }
26171}
26172
26173impl Variants<SurveyMessageResponseType> for SurveyResponseBody {
26174    fn variants() -> slice::Iter<'static, SurveyMessageResponseType> {
26175        Self::VARIANTS.iter()
26176    }
26177}
26178
26179impl Union<SurveyMessageResponseType> for SurveyResponseBody {}
26180
26181impl ReadXdr for SurveyResponseBody {
26182    #[cfg(feature = "std")]
26183    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
26184        r.with_limited_depth(|r| {
26185            let dv: SurveyMessageResponseType =
26186                <SurveyMessageResponseType as ReadXdr>::read_xdr(r)?;
26187            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
26188            let v = match dv {
26189                SurveyMessageResponseType::V0 => Self::V0(TopologyResponseBodyV0::read_xdr(r)?),
26190                SurveyMessageResponseType::V1 => Self::V1(TopologyResponseBodyV1::read_xdr(r)?),
26191                SurveyMessageResponseType::V2 => Self::V2(TopologyResponseBodyV2::read_xdr(r)?),
26192                #[allow(unreachable_patterns)]
26193                _ => return Err(Error::Invalid),
26194            };
26195            Ok(v)
26196        })
26197    }
26198}
26199
26200impl WriteXdr for SurveyResponseBody {
26201    #[cfg(feature = "std")]
26202    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
26203        w.with_limited_depth(|w| {
26204            self.discriminant().write_xdr(w)?;
26205            #[allow(clippy::match_same_arms)]
26206            match self {
26207                Self::V0(v) => v.write_xdr(w)?,
26208                Self::V1(v) => v.write_xdr(w)?,
26209                Self::V2(v) => v.write_xdr(w)?,
26210            };
26211            Ok(())
26212        })
26213    }
26214}
26215
26216/// TxAdvertVectorMaxSize is an XDR Const defines as:
26217///
26218/// ```text
26219/// const TX_ADVERT_VECTOR_MAX_SIZE = 1000;
26220/// ```
26221///
26222pub const TX_ADVERT_VECTOR_MAX_SIZE: u64 = 1000;
26223
26224/// TxAdvertVector is an XDR Typedef defines as:
26225///
26226/// ```text
26227/// typedef Hash TxAdvertVector<TX_ADVERT_VECTOR_MAX_SIZE>;
26228/// ```
26229///
26230#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
26231#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
26232#[derive(Default)]
26233#[cfg_attr(
26234    all(feature = "serde", feature = "alloc"),
26235    derive(serde::Serialize, serde::Deserialize),
26236    serde(rename_all = "snake_case")
26237)]
26238#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
26239#[derive(Debug)]
26240pub struct TxAdvertVector(pub VecM<Hash, 1000>);
26241
26242impl From<TxAdvertVector> for VecM<Hash, 1000> {
26243    #[must_use]
26244    fn from(x: TxAdvertVector) -> Self {
26245        x.0
26246    }
26247}
26248
26249impl From<VecM<Hash, 1000>> for TxAdvertVector {
26250    #[must_use]
26251    fn from(x: VecM<Hash, 1000>) -> Self {
26252        TxAdvertVector(x)
26253    }
26254}
26255
26256impl AsRef<VecM<Hash, 1000>> for TxAdvertVector {
26257    #[must_use]
26258    fn as_ref(&self) -> &VecM<Hash, 1000> {
26259        &self.0
26260    }
26261}
26262
26263impl ReadXdr for TxAdvertVector {
26264    #[cfg(feature = "std")]
26265    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
26266        r.with_limited_depth(|r| {
26267            let i = VecM::<Hash, 1000>::read_xdr(r)?;
26268            let v = TxAdvertVector(i);
26269            Ok(v)
26270        })
26271    }
26272}
26273
26274impl WriteXdr for TxAdvertVector {
26275    #[cfg(feature = "std")]
26276    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
26277        w.with_limited_depth(|w| self.0.write_xdr(w))
26278    }
26279}
26280
26281impl Deref for TxAdvertVector {
26282    type Target = VecM<Hash, 1000>;
26283    fn deref(&self) -> &Self::Target {
26284        &self.0
26285    }
26286}
26287
26288impl From<TxAdvertVector> for Vec<Hash> {
26289    #[must_use]
26290    fn from(x: TxAdvertVector) -> Self {
26291        x.0 .0
26292    }
26293}
26294
26295impl TryFrom<Vec<Hash>> for TxAdvertVector {
26296    type Error = Error;
26297    fn try_from(x: Vec<Hash>) -> Result<Self> {
26298        Ok(TxAdvertVector(x.try_into()?))
26299    }
26300}
26301
26302#[cfg(feature = "alloc")]
26303impl TryFrom<&Vec<Hash>> for TxAdvertVector {
26304    type Error = Error;
26305    fn try_from(x: &Vec<Hash>) -> Result<Self> {
26306        Ok(TxAdvertVector(x.try_into()?))
26307    }
26308}
26309
26310impl AsRef<Vec<Hash>> for TxAdvertVector {
26311    #[must_use]
26312    fn as_ref(&self) -> &Vec<Hash> {
26313        &self.0 .0
26314    }
26315}
26316
26317impl AsRef<[Hash]> for TxAdvertVector {
26318    #[cfg(feature = "alloc")]
26319    #[must_use]
26320    fn as_ref(&self) -> &[Hash] {
26321        &self.0 .0
26322    }
26323    #[cfg(not(feature = "alloc"))]
26324    #[must_use]
26325    fn as_ref(&self) -> &[Hash] {
26326        self.0 .0
26327    }
26328}
26329
26330/// FloodAdvert is an XDR Struct defines as:
26331///
26332/// ```text
26333/// struct FloodAdvert
26334/// {
26335///     TxAdvertVector txHashes;
26336/// };
26337/// ```
26338///
26339#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
26340#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
26341#[cfg_attr(
26342    all(feature = "serde", feature = "alloc"),
26343    derive(serde::Serialize, serde::Deserialize),
26344    serde(rename_all = "snake_case")
26345)]
26346#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
26347pub struct FloodAdvert {
26348    pub tx_hashes: TxAdvertVector,
26349}
26350
26351impl ReadXdr for FloodAdvert {
26352    #[cfg(feature = "std")]
26353    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
26354        r.with_limited_depth(|r| {
26355            Ok(Self {
26356                tx_hashes: TxAdvertVector::read_xdr(r)?,
26357            })
26358        })
26359    }
26360}
26361
26362impl WriteXdr for FloodAdvert {
26363    #[cfg(feature = "std")]
26364    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
26365        w.with_limited_depth(|w| {
26366            self.tx_hashes.write_xdr(w)?;
26367            Ok(())
26368        })
26369    }
26370}
26371
26372/// TxDemandVectorMaxSize is an XDR Const defines as:
26373///
26374/// ```text
26375/// const TX_DEMAND_VECTOR_MAX_SIZE = 1000;
26376/// ```
26377///
26378pub const TX_DEMAND_VECTOR_MAX_SIZE: u64 = 1000;
26379
26380/// TxDemandVector is an XDR Typedef defines as:
26381///
26382/// ```text
26383/// typedef Hash TxDemandVector<TX_DEMAND_VECTOR_MAX_SIZE>;
26384/// ```
26385///
26386#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
26387#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
26388#[derive(Default)]
26389#[cfg_attr(
26390    all(feature = "serde", feature = "alloc"),
26391    derive(serde::Serialize, serde::Deserialize),
26392    serde(rename_all = "snake_case")
26393)]
26394#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
26395#[derive(Debug)]
26396pub struct TxDemandVector(pub VecM<Hash, 1000>);
26397
26398impl From<TxDemandVector> for VecM<Hash, 1000> {
26399    #[must_use]
26400    fn from(x: TxDemandVector) -> Self {
26401        x.0
26402    }
26403}
26404
26405impl From<VecM<Hash, 1000>> for TxDemandVector {
26406    #[must_use]
26407    fn from(x: VecM<Hash, 1000>) -> Self {
26408        TxDemandVector(x)
26409    }
26410}
26411
26412impl AsRef<VecM<Hash, 1000>> for TxDemandVector {
26413    #[must_use]
26414    fn as_ref(&self) -> &VecM<Hash, 1000> {
26415        &self.0
26416    }
26417}
26418
26419impl ReadXdr for TxDemandVector {
26420    #[cfg(feature = "std")]
26421    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
26422        r.with_limited_depth(|r| {
26423            let i = VecM::<Hash, 1000>::read_xdr(r)?;
26424            let v = TxDemandVector(i);
26425            Ok(v)
26426        })
26427    }
26428}
26429
26430impl WriteXdr for TxDemandVector {
26431    #[cfg(feature = "std")]
26432    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
26433        w.with_limited_depth(|w| self.0.write_xdr(w))
26434    }
26435}
26436
26437impl Deref for TxDemandVector {
26438    type Target = VecM<Hash, 1000>;
26439    fn deref(&self) -> &Self::Target {
26440        &self.0
26441    }
26442}
26443
26444impl From<TxDemandVector> for Vec<Hash> {
26445    #[must_use]
26446    fn from(x: TxDemandVector) -> Self {
26447        x.0 .0
26448    }
26449}
26450
26451impl TryFrom<Vec<Hash>> for TxDemandVector {
26452    type Error = Error;
26453    fn try_from(x: Vec<Hash>) -> Result<Self> {
26454        Ok(TxDemandVector(x.try_into()?))
26455    }
26456}
26457
26458#[cfg(feature = "alloc")]
26459impl TryFrom<&Vec<Hash>> for TxDemandVector {
26460    type Error = Error;
26461    fn try_from(x: &Vec<Hash>) -> Result<Self> {
26462        Ok(TxDemandVector(x.try_into()?))
26463    }
26464}
26465
26466impl AsRef<Vec<Hash>> for TxDemandVector {
26467    #[must_use]
26468    fn as_ref(&self) -> &Vec<Hash> {
26469        &self.0 .0
26470    }
26471}
26472
26473impl AsRef<[Hash]> for TxDemandVector {
26474    #[cfg(feature = "alloc")]
26475    #[must_use]
26476    fn as_ref(&self) -> &[Hash] {
26477        &self.0 .0
26478    }
26479    #[cfg(not(feature = "alloc"))]
26480    #[must_use]
26481    fn as_ref(&self) -> &[Hash] {
26482        self.0 .0
26483    }
26484}
26485
26486/// FloodDemand is an XDR Struct defines as:
26487///
26488/// ```text
26489/// struct FloodDemand
26490/// {
26491///     TxDemandVector txHashes;
26492/// };
26493/// ```
26494///
26495#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
26496#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
26497#[cfg_attr(
26498    all(feature = "serde", feature = "alloc"),
26499    derive(serde::Serialize, serde::Deserialize),
26500    serde(rename_all = "snake_case")
26501)]
26502#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
26503pub struct FloodDemand {
26504    pub tx_hashes: TxDemandVector,
26505}
26506
26507impl ReadXdr for FloodDemand {
26508    #[cfg(feature = "std")]
26509    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
26510        r.with_limited_depth(|r| {
26511            Ok(Self {
26512                tx_hashes: TxDemandVector::read_xdr(r)?,
26513            })
26514        })
26515    }
26516}
26517
26518impl WriteXdr for FloodDemand {
26519    #[cfg(feature = "std")]
26520    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
26521        w.with_limited_depth(|w| {
26522            self.tx_hashes.write_xdr(w)?;
26523            Ok(())
26524        })
26525    }
26526}
26527
26528/// StellarMessage is an XDR Union defines as:
26529///
26530/// ```text
26531/// union StellarMessage switch (MessageType type)
26532/// {
26533/// case ERROR_MSG:
26534///     Error error;
26535/// case HELLO:
26536///     Hello hello;
26537/// case AUTH:
26538///     Auth auth;
26539/// case DONT_HAVE:
26540///     DontHave dontHave;
26541/// case GET_PEERS:
26542///     void;
26543/// case PEERS:
26544///     PeerAddress peers<100>;
26545///
26546/// case GET_TX_SET:
26547///     uint256 txSetHash;
26548/// case TX_SET:
26549///     TransactionSet txSet;
26550/// case GENERALIZED_TX_SET:
26551///     GeneralizedTransactionSet generalizedTxSet;
26552///
26553/// case TRANSACTION:
26554///     TransactionEnvelope transaction;
26555///
26556/// case SURVEY_REQUEST:
26557///     SignedSurveyRequestMessage signedSurveyRequestMessage;
26558///
26559/// case SURVEY_RESPONSE:
26560///     SignedSurveyResponseMessage signedSurveyResponseMessage;
26561///
26562/// case TIME_SLICED_SURVEY_REQUEST:
26563///     SignedTimeSlicedSurveyRequestMessage signedTimeSlicedSurveyRequestMessage;
26564///
26565/// case TIME_SLICED_SURVEY_RESPONSE:
26566///     SignedTimeSlicedSurveyResponseMessage signedTimeSlicedSurveyResponseMessage;
26567///
26568/// case TIME_SLICED_SURVEY_START_COLLECTING:
26569///     SignedTimeSlicedSurveyStartCollectingMessage
26570///         signedTimeSlicedSurveyStartCollectingMessage;
26571///
26572/// case TIME_SLICED_SURVEY_STOP_COLLECTING:
26573///     SignedTimeSlicedSurveyStopCollectingMessage
26574///         signedTimeSlicedSurveyStopCollectingMessage;
26575///
26576/// // SCP
26577/// case GET_SCP_QUORUMSET:
26578///     uint256 qSetHash;
26579/// case SCP_QUORUMSET:
26580///     SCPQuorumSet qSet;
26581/// case SCP_MESSAGE:
26582///     SCPEnvelope envelope;
26583/// case GET_SCP_STATE:
26584///     uint32 getSCPLedgerSeq; // ledger seq requested ; if 0, requests the latest
26585/// case SEND_MORE:
26586///     SendMore sendMoreMessage;
26587/// case SEND_MORE_EXTENDED:
26588///     SendMoreExtended sendMoreExtendedMessage;
26589/// // Pull mode
26590/// case FLOOD_ADVERT:
26591///      FloodAdvert floodAdvert;
26592/// case FLOOD_DEMAND:
26593///      FloodDemand floodDemand;
26594/// };
26595/// ```
26596///
26597// union with discriminant MessageType
26598#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
26599#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
26600#[cfg_attr(
26601    all(feature = "serde", feature = "alloc"),
26602    derive(serde::Serialize, serde::Deserialize),
26603    serde(rename_all = "snake_case")
26604)]
26605#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
26606#[allow(clippy::large_enum_variant)]
26607pub enum StellarMessage {
26608    ErrorMsg(SError),
26609    Hello(Hello),
26610    Auth(Auth),
26611    DontHave(DontHave),
26612    GetPeers,
26613    Peers(VecM<PeerAddress, 100>),
26614    GetTxSet(Uint256),
26615    TxSet(TransactionSet),
26616    GeneralizedTxSet(GeneralizedTransactionSet),
26617    Transaction(TransactionEnvelope),
26618    SurveyRequest(SignedSurveyRequestMessage),
26619    SurveyResponse(SignedSurveyResponseMessage),
26620    TimeSlicedSurveyRequest(SignedTimeSlicedSurveyRequestMessage),
26621    TimeSlicedSurveyResponse(SignedTimeSlicedSurveyResponseMessage),
26622    TimeSlicedSurveyStartCollecting(SignedTimeSlicedSurveyStartCollectingMessage),
26623    TimeSlicedSurveyStopCollecting(SignedTimeSlicedSurveyStopCollectingMessage),
26624    GetScpQuorumset(Uint256),
26625    ScpQuorumset(ScpQuorumSet),
26626    ScpMessage(ScpEnvelope),
26627    GetScpState(u32),
26628    SendMore(SendMore),
26629    SendMoreExtended(SendMoreExtended),
26630    FloodAdvert(FloodAdvert),
26631    FloodDemand(FloodDemand),
26632}
26633
26634impl StellarMessage {
26635    pub const VARIANTS: [MessageType; 24] = [
26636        MessageType::ErrorMsg,
26637        MessageType::Hello,
26638        MessageType::Auth,
26639        MessageType::DontHave,
26640        MessageType::GetPeers,
26641        MessageType::Peers,
26642        MessageType::GetTxSet,
26643        MessageType::TxSet,
26644        MessageType::GeneralizedTxSet,
26645        MessageType::Transaction,
26646        MessageType::SurveyRequest,
26647        MessageType::SurveyResponse,
26648        MessageType::TimeSlicedSurveyRequest,
26649        MessageType::TimeSlicedSurveyResponse,
26650        MessageType::TimeSlicedSurveyStartCollecting,
26651        MessageType::TimeSlicedSurveyStopCollecting,
26652        MessageType::GetScpQuorumset,
26653        MessageType::ScpQuorumset,
26654        MessageType::ScpMessage,
26655        MessageType::GetScpState,
26656        MessageType::SendMore,
26657        MessageType::SendMoreExtended,
26658        MessageType::FloodAdvert,
26659        MessageType::FloodDemand,
26660    ];
26661    pub const VARIANTS_STR: [&'static str; 24] = [
26662        "ErrorMsg",
26663        "Hello",
26664        "Auth",
26665        "DontHave",
26666        "GetPeers",
26667        "Peers",
26668        "GetTxSet",
26669        "TxSet",
26670        "GeneralizedTxSet",
26671        "Transaction",
26672        "SurveyRequest",
26673        "SurveyResponse",
26674        "TimeSlicedSurveyRequest",
26675        "TimeSlicedSurveyResponse",
26676        "TimeSlicedSurveyStartCollecting",
26677        "TimeSlicedSurveyStopCollecting",
26678        "GetScpQuorumset",
26679        "ScpQuorumset",
26680        "ScpMessage",
26681        "GetScpState",
26682        "SendMore",
26683        "SendMoreExtended",
26684        "FloodAdvert",
26685        "FloodDemand",
26686    ];
26687
26688    #[must_use]
26689    pub const fn name(&self) -> &'static str {
26690        match self {
26691            Self::ErrorMsg(_) => "ErrorMsg",
26692            Self::Hello(_) => "Hello",
26693            Self::Auth(_) => "Auth",
26694            Self::DontHave(_) => "DontHave",
26695            Self::GetPeers => "GetPeers",
26696            Self::Peers(_) => "Peers",
26697            Self::GetTxSet(_) => "GetTxSet",
26698            Self::TxSet(_) => "TxSet",
26699            Self::GeneralizedTxSet(_) => "GeneralizedTxSet",
26700            Self::Transaction(_) => "Transaction",
26701            Self::SurveyRequest(_) => "SurveyRequest",
26702            Self::SurveyResponse(_) => "SurveyResponse",
26703            Self::TimeSlicedSurveyRequest(_) => "TimeSlicedSurveyRequest",
26704            Self::TimeSlicedSurveyResponse(_) => "TimeSlicedSurveyResponse",
26705            Self::TimeSlicedSurveyStartCollecting(_) => "TimeSlicedSurveyStartCollecting",
26706            Self::TimeSlicedSurveyStopCollecting(_) => "TimeSlicedSurveyStopCollecting",
26707            Self::GetScpQuorumset(_) => "GetScpQuorumset",
26708            Self::ScpQuorumset(_) => "ScpQuorumset",
26709            Self::ScpMessage(_) => "ScpMessage",
26710            Self::GetScpState(_) => "GetScpState",
26711            Self::SendMore(_) => "SendMore",
26712            Self::SendMoreExtended(_) => "SendMoreExtended",
26713            Self::FloodAdvert(_) => "FloodAdvert",
26714            Self::FloodDemand(_) => "FloodDemand",
26715        }
26716    }
26717
26718    #[must_use]
26719    pub const fn discriminant(&self) -> MessageType {
26720        #[allow(clippy::match_same_arms)]
26721        match self {
26722            Self::ErrorMsg(_) => MessageType::ErrorMsg,
26723            Self::Hello(_) => MessageType::Hello,
26724            Self::Auth(_) => MessageType::Auth,
26725            Self::DontHave(_) => MessageType::DontHave,
26726            Self::GetPeers => MessageType::GetPeers,
26727            Self::Peers(_) => MessageType::Peers,
26728            Self::GetTxSet(_) => MessageType::GetTxSet,
26729            Self::TxSet(_) => MessageType::TxSet,
26730            Self::GeneralizedTxSet(_) => MessageType::GeneralizedTxSet,
26731            Self::Transaction(_) => MessageType::Transaction,
26732            Self::SurveyRequest(_) => MessageType::SurveyRequest,
26733            Self::SurveyResponse(_) => MessageType::SurveyResponse,
26734            Self::TimeSlicedSurveyRequest(_) => MessageType::TimeSlicedSurveyRequest,
26735            Self::TimeSlicedSurveyResponse(_) => MessageType::TimeSlicedSurveyResponse,
26736            Self::TimeSlicedSurveyStartCollecting(_) => {
26737                MessageType::TimeSlicedSurveyStartCollecting
26738            }
26739            Self::TimeSlicedSurveyStopCollecting(_) => MessageType::TimeSlicedSurveyStopCollecting,
26740            Self::GetScpQuorumset(_) => MessageType::GetScpQuorumset,
26741            Self::ScpQuorumset(_) => MessageType::ScpQuorumset,
26742            Self::ScpMessage(_) => MessageType::ScpMessage,
26743            Self::GetScpState(_) => MessageType::GetScpState,
26744            Self::SendMore(_) => MessageType::SendMore,
26745            Self::SendMoreExtended(_) => MessageType::SendMoreExtended,
26746            Self::FloodAdvert(_) => MessageType::FloodAdvert,
26747            Self::FloodDemand(_) => MessageType::FloodDemand,
26748        }
26749    }
26750
26751    #[must_use]
26752    pub const fn variants() -> [MessageType; 24] {
26753        Self::VARIANTS
26754    }
26755}
26756
26757impl Name for StellarMessage {
26758    #[must_use]
26759    fn name(&self) -> &'static str {
26760        Self::name(self)
26761    }
26762}
26763
26764impl Discriminant<MessageType> for StellarMessage {
26765    #[must_use]
26766    fn discriminant(&self) -> MessageType {
26767        Self::discriminant(self)
26768    }
26769}
26770
26771impl Variants<MessageType> for StellarMessage {
26772    fn variants() -> slice::Iter<'static, MessageType> {
26773        Self::VARIANTS.iter()
26774    }
26775}
26776
26777impl Union<MessageType> for StellarMessage {}
26778
26779impl ReadXdr for StellarMessage {
26780    #[cfg(feature = "std")]
26781    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
26782        r.with_limited_depth(|r| {
26783            let dv: MessageType = <MessageType as ReadXdr>::read_xdr(r)?;
26784            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
26785            let v = match dv {
26786                MessageType::ErrorMsg => Self::ErrorMsg(SError::read_xdr(r)?),
26787                MessageType::Hello => Self::Hello(Hello::read_xdr(r)?),
26788                MessageType::Auth => Self::Auth(Auth::read_xdr(r)?),
26789                MessageType::DontHave => Self::DontHave(DontHave::read_xdr(r)?),
26790                MessageType::GetPeers => Self::GetPeers,
26791                MessageType::Peers => Self::Peers(VecM::<PeerAddress, 100>::read_xdr(r)?),
26792                MessageType::GetTxSet => Self::GetTxSet(Uint256::read_xdr(r)?),
26793                MessageType::TxSet => Self::TxSet(TransactionSet::read_xdr(r)?),
26794                MessageType::GeneralizedTxSet => {
26795                    Self::GeneralizedTxSet(GeneralizedTransactionSet::read_xdr(r)?)
26796                }
26797                MessageType::Transaction => Self::Transaction(TransactionEnvelope::read_xdr(r)?),
26798                MessageType::SurveyRequest => {
26799                    Self::SurveyRequest(SignedSurveyRequestMessage::read_xdr(r)?)
26800                }
26801                MessageType::SurveyResponse => {
26802                    Self::SurveyResponse(SignedSurveyResponseMessage::read_xdr(r)?)
26803                }
26804                MessageType::TimeSlicedSurveyRequest => Self::TimeSlicedSurveyRequest(
26805                    SignedTimeSlicedSurveyRequestMessage::read_xdr(r)?,
26806                ),
26807                MessageType::TimeSlicedSurveyResponse => Self::TimeSlicedSurveyResponse(
26808                    SignedTimeSlicedSurveyResponseMessage::read_xdr(r)?,
26809                ),
26810                MessageType::TimeSlicedSurveyStartCollecting => {
26811                    Self::TimeSlicedSurveyStartCollecting(
26812                        SignedTimeSlicedSurveyStartCollectingMessage::read_xdr(r)?,
26813                    )
26814                }
26815                MessageType::TimeSlicedSurveyStopCollecting => {
26816                    Self::TimeSlicedSurveyStopCollecting(
26817                        SignedTimeSlicedSurveyStopCollectingMessage::read_xdr(r)?,
26818                    )
26819                }
26820                MessageType::GetScpQuorumset => Self::GetScpQuorumset(Uint256::read_xdr(r)?),
26821                MessageType::ScpQuorumset => Self::ScpQuorumset(ScpQuorumSet::read_xdr(r)?),
26822                MessageType::ScpMessage => Self::ScpMessage(ScpEnvelope::read_xdr(r)?),
26823                MessageType::GetScpState => Self::GetScpState(u32::read_xdr(r)?),
26824                MessageType::SendMore => Self::SendMore(SendMore::read_xdr(r)?),
26825                MessageType::SendMoreExtended => {
26826                    Self::SendMoreExtended(SendMoreExtended::read_xdr(r)?)
26827                }
26828                MessageType::FloodAdvert => Self::FloodAdvert(FloodAdvert::read_xdr(r)?),
26829                MessageType::FloodDemand => Self::FloodDemand(FloodDemand::read_xdr(r)?),
26830                #[allow(unreachable_patterns)]
26831                _ => return Err(Error::Invalid),
26832            };
26833            Ok(v)
26834        })
26835    }
26836}
26837
26838impl WriteXdr for StellarMessage {
26839    #[cfg(feature = "std")]
26840    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
26841        w.with_limited_depth(|w| {
26842            self.discriminant().write_xdr(w)?;
26843            #[allow(clippy::match_same_arms)]
26844            match self {
26845                Self::ErrorMsg(v) => v.write_xdr(w)?,
26846                Self::Hello(v) => v.write_xdr(w)?,
26847                Self::Auth(v) => v.write_xdr(w)?,
26848                Self::DontHave(v) => v.write_xdr(w)?,
26849                Self::GetPeers => ().write_xdr(w)?,
26850                Self::Peers(v) => v.write_xdr(w)?,
26851                Self::GetTxSet(v) => v.write_xdr(w)?,
26852                Self::TxSet(v) => v.write_xdr(w)?,
26853                Self::GeneralizedTxSet(v) => v.write_xdr(w)?,
26854                Self::Transaction(v) => v.write_xdr(w)?,
26855                Self::SurveyRequest(v) => v.write_xdr(w)?,
26856                Self::SurveyResponse(v) => v.write_xdr(w)?,
26857                Self::TimeSlicedSurveyRequest(v) => v.write_xdr(w)?,
26858                Self::TimeSlicedSurveyResponse(v) => v.write_xdr(w)?,
26859                Self::TimeSlicedSurveyStartCollecting(v) => v.write_xdr(w)?,
26860                Self::TimeSlicedSurveyStopCollecting(v) => v.write_xdr(w)?,
26861                Self::GetScpQuorumset(v) => v.write_xdr(w)?,
26862                Self::ScpQuorumset(v) => v.write_xdr(w)?,
26863                Self::ScpMessage(v) => v.write_xdr(w)?,
26864                Self::GetScpState(v) => v.write_xdr(w)?,
26865                Self::SendMore(v) => v.write_xdr(w)?,
26866                Self::SendMoreExtended(v) => v.write_xdr(w)?,
26867                Self::FloodAdvert(v) => v.write_xdr(w)?,
26868                Self::FloodDemand(v) => v.write_xdr(w)?,
26869            };
26870            Ok(())
26871        })
26872    }
26873}
26874
26875/// AuthenticatedMessageV0 is an XDR NestedStruct defines as:
26876///
26877/// ```text
26878/// struct
26879///     {
26880///         uint64 sequence;
26881///         StellarMessage message;
26882///         HmacSha256Mac mac;
26883///     }
26884/// ```
26885///
26886#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
26887#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
26888#[cfg_attr(
26889    all(feature = "serde", feature = "alloc"),
26890    derive(serde::Serialize, serde::Deserialize),
26891    serde(rename_all = "snake_case")
26892)]
26893#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
26894pub struct AuthenticatedMessageV0 {
26895    pub sequence: u64,
26896    pub message: StellarMessage,
26897    pub mac: HmacSha256Mac,
26898}
26899
26900impl ReadXdr for AuthenticatedMessageV0 {
26901    #[cfg(feature = "std")]
26902    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
26903        r.with_limited_depth(|r| {
26904            Ok(Self {
26905                sequence: u64::read_xdr(r)?,
26906                message: StellarMessage::read_xdr(r)?,
26907                mac: HmacSha256Mac::read_xdr(r)?,
26908            })
26909        })
26910    }
26911}
26912
26913impl WriteXdr for AuthenticatedMessageV0 {
26914    #[cfg(feature = "std")]
26915    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
26916        w.with_limited_depth(|w| {
26917            self.sequence.write_xdr(w)?;
26918            self.message.write_xdr(w)?;
26919            self.mac.write_xdr(w)?;
26920            Ok(())
26921        })
26922    }
26923}
26924
26925/// AuthenticatedMessage is an XDR Union defines as:
26926///
26927/// ```text
26928/// union AuthenticatedMessage switch (uint32 v)
26929/// {
26930/// case 0:
26931///     struct
26932///     {
26933///         uint64 sequence;
26934///         StellarMessage message;
26935///         HmacSha256Mac mac;
26936///     } v0;
26937/// };
26938/// ```
26939///
26940// union with discriminant u32
26941#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
26942#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
26943#[cfg_attr(
26944    all(feature = "serde", feature = "alloc"),
26945    derive(serde::Serialize, serde::Deserialize),
26946    serde(rename_all = "snake_case")
26947)]
26948#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
26949#[allow(clippy::large_enum_variant)]
26950pub enum AuthenticatedMessage {
26951    V0(AuthenticatedMessageV0),
26952}
26953
26954impl AuthenticatedMessage {
26955    pub const VARIANTS: [u32; 1] = [0];
26956    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
26957
26958    #[must_use]
26959    pub const fn name(&self) -> &'static str {
26960        match self {
26961            Self::V0(_) => "V0",
26962        }
26963    }
26964
26965    #[must_use]
26966    pub const fn discriminant(&self) -> u32 {
26967        #[allow(clippy::match_same_arms)]
26968        match self {
26969            Self::V0(_) => 0,
26970        }
26971    }
26972
26973    #[must_use]
26974    pub const fn variants() -> [u32; 1] {
26975        Self::VARIANTS
26976    }
26977}
26978
26979impl Name for AuthenticatedMessage {
26980    #[must_use]
26981    fn name(&self) -> &'static str {
26982        Self::name(self)
26983    }
26984}
26985
26986impl Discriminant<u32> for AuthenticatedMessage {
26987    #[must_use]
26988    fn discriminant(&self) -> u32 {
26989        Self::discriminant(self)
26990    }
26991}
26992
26993impl Variants<u32> for AuthenticatedMessage {
26994    fn variants() -> slice::Iter<'static, u32> {
26995        Self::VARIANTS.iter()
26996    }
26997}
26998
26999impl Union<u32> for AuthenticatedMessage {}
27000
27001impl ReadXdr for AuthenticatedMessage {
27002    #[cfg(feature = "std")]
27003    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
27004        r.with_limited_depth(|r| {
27005            let dv: u32 = <u32 as ReadXdr>::read_xdr(r)?;
27006            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
27007            let v = match dv {
27008                0 => Self::V0(AuthenticatedMessageV0::read_xdr(r)?),
27009                #[allow(unreachable_patterns)]
27010                _ => return Err(Error::Invalid),
27011            };
27012            Ok(v)
27013        })
27014    }
27015}
27016
27017impl WriteXdr for AuthenticatedMessage {
27018    #[cfg(feature = "std")]
27019    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
27020        w.with_limited_depth(|w| {
27021            self.discriminant().write_xdr(w)?;
27022            #[allow(clippy::match_same_arms)]
27023            match self {
27024                Self::V0(v) => v.write_xdr(w)?,
27025            };
27026            Ok(())
27027        })
27028    }
27029}
27030
27031/// MaxOpsPerTx is an XDR Const defines as:
27032///
27033/// ```text
27034/// const MAX_OPS_PER_TX = 100;
27035/// ```
27036///
27037pub const MAX_OPS_PER_TX: u64 = 100;
27038
27039/// LiquidityPoolParameters is an XDR Union defines as:
27040///
27041/// ```text
27042/// union LiquidityPoolParameters switch (LiquidityPoolType type)
27043/// {
27044/// case LIQUIDITY_POOL_CONSTANT_PRODUCT:
27045///     LiquidityPoolConstantProductParameters constantProduct;
27046/// };
27047/// ```
27048///
27049// union with discriminant LiquidityPoolType
27050#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
27051#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
27052#[cfg_attr(
27053    all(feature = "serde", feature = "alloc"),
27054    derive(serde::Serialize, serde::Deserialize),
27055    serde(rename_all = "snake_case")
27056)]
27057#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
27058#[allow(clippy::large_enum_variant)]
27059pub enum LiquidityPoolParameters {
27060    LiquidityPoolConstantProduct(LiquidityPoolConstantProductParameters),
27061}
27062
27063impl LiquidityPoolParameters {
27064    pub const VARIANTS: [LiquidityPoolType; 1] = [LiquidityPoolType::LiquidityPoolConstantProduct];
27065    pub const VARIANTS_STR: [&'static str; 1] = ["LiquidityPoolConstantProduct"];
27066
27067    #[must_use]
27068    pub const fn name(&self) -> &'static str {
27069        match self {
27070            Self::LiquidityPoolConstantProduct(_) => "LiquidityPoolConstantProduct",
27071        }
27072    }
27073
27074    #[must_use]
27075    pub const fn discriminant(&self) -> LiquidityPoolType {
27076        #[allow(clippy::match_same_arms)]
27077        match self {
27078            Self::LiquidityPoolConstantProduct(_) => {
27079                LiquidityPoolType::LiquidityPoolConstantProduct
27080            }
27081        }
27082    }
27083
27084    #[must_use]
27085    pub const fn variants() -> [LiquidityPoolType; 1] {
27086        Self::VARIANTS
27087    }
27088}
27089
27090impl Name for LiquidityPoolParameters {
27091    #[must_use]
27092    fn name(&self) -> &'static str {
27093        Self::name(self)
27094    }
27095}
27096
27097impl Discriminant<LiquidityPoolType> for LiquidityPoolParameters {
27098    #[must_use]
27099    fn discriminant(&self) -> LiquidityPoolType {
27100        Self::discriminant(self)
27101    }
27102}
27103
27104impl Variants<LiquidityPoolType> for LiquidityPoolParameters {
27105    fn variants() -> slice::Iter<'static, LiquidityPoolType> {
27106        Self::VARIANTS.iter()
27107    }
27108}
27109
27110impl Union<LiquidityPoolType> for LiquidityPoolParameters {}
27111
27112impl ReadXdr for LiquidityPoolParameters {
27113    #[cfg(feature = "std")]
27114    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
27115        r.with_limited_depth(|r| {
27116            let dv: LiquidityPoolType = <LiquidityPoolType as ReadXdr>::read_xdr(r)?;
27117            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
27118            let v = match dv {
27119                LiquidityPoolType::LiquidityPoolConstantProduct => {
27120                    Self::LiquidityPoolConstantProduct(
27121                        LiquidityPoolConstantProductParameters::read_xdr(r)?,
27122                    )
27123                }
27124                #[allow(unreachable_patterns)]
27125                _ => return Err(Error::Invalid),
27126            };
27127            Ok(v)
27128        })
27129    }
27130}
27131
27132impl WriteXdr for LiquidityPoolParameters {
27133    #[cfg(feature = "std")]
27134    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
27135        w.with_limited_depth(|w| {
27136            self.discriminant().write_xdr(w)?;
27137            #[allow(clippy::match_same_arms)]
27138            match self {
27139                Self::LiquidityPoolConstantProduct(v) => v.write_xdr(w)?,
27140            };
27141            Ok(())
27142        })
27143    }
27144}
27145
27146/// MuxedAccountMed25519 is an XDR NestedStruct defines as:
27147///
27148/// ```text
27149/// struct
27150///     {
27151///         uint64 id;
27152///         uint256 ed25519;
27153///     }
27154/// ```
27155///
27156#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
27157#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
27158#[cfg_attr(
27159    all(feature = "serde", feature = "alloc"),
27160    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
27161)]
27162pub struct MuxedAccountMed25519 {
27163    pub id: u64,
27164    pub ed25519: Uint256,
27165}
27166
27167impl ReadXdr for MuxedAccountMed25519 {
27168    #[cfg(feature = "std")]
27169    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
27170        r.with_limited_depth(|r| {
27171            Ok(Self {
27172                id: u64::read_xdr(r)?,
27173                ed25519: Uint256::read_xdr(r)?,
27174            })
27175        })
27176    }
27177}
27178
27179impl WriteXdr for MuxedAccountMed25519 {
27180    #[cfg(feature = "std")]
27181    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
27182        w.with_limited_depth(|w| {
27183            self.id.write_xdr(w)?;
27184            self.ed25519.write_xdr(w)?;
27185            Ok(())
27186        })
27187    }
27188}
27189
27190/// MuxedAccount is an XDR Union defines as:
27191///
27192/// ```text
27193/// union MuxedAccount switch (CryptoKeyType type)
27194/// {
27195/// case KEY_TYPE_ED25519:
27196///     uint256 ed25519;
27197/// case KEY_TYPE_MUXED_ED25519:
27198///     struct
27199///     {
27200///         uint64 id;
27201///         uint256 ed25519;
27202///     } med25519;
27203/// };
27204/// ```
27205///
27206// union with discriminant CryptoKeyType
27207#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
27208#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
27209#[cfg_attr(
27210    all(feature = "serde", feature = "alloc"),
27211    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
27212)]
27213#[allow(clippy::large_enum_variant)]
27214pub enum MuxedAccount {
27215    Ed25519(Uint256),
27216    MuxedEd25519(MuxedAccountMed25519),
27217}
27218
27219impl MuxedAccount {
27220    pub const VARIANTS: [CryptoKeyType; 2] = [CryptoKeyType::Ed25519, CryptoKeyType::MuxedEd25519];
27221    pub const VARIANTS_STR: [&'static str; 2] = ["Ed25519", "MuxedEd25519"];
27222
27223    #[must_use]
27224    pub const fn name(&self) -> &'static str {
27225        match self {
27226            Self::Ed25519(_) => "Ed25519",
27227            Self::MuxedEd25519(_) => "MuxedEd25519",
27228        }
27229    }
27230
27231    #[must_use]
27232    pub const fn discriminant(&self) -> CryptoKeyType {
27233        #[allow(clippy::match_same_arms)]
27234        match self {
27235            Self::Ed25519(_) => CryptoKeyType::Ed25519,
27236            Self::MuxedEd25519(_) => CryptoKeyType::MuxedEd25519,
27237        }
27238    }
27239
27240    #[must_use]
27241    pub const fn variants() -> [CryptoKeyType; 2] {
27242        Self::VARIANTS
27243    }
27244}
27245
27246impl Name for MuxedAccount {
27247    #[must_use]
27248    fn name(&self) -> &'static str {
27249        Self::name(self)
27250    }
27251}
27252
27253impl Discriminant<CryptoKeyType> for MuxedAccount {
27254    #[must_use]
27255    fn discriminant(&self) -> CryptoKeyType {
27256        Self::discriminant(self)
27257    }
27258}
27259
27260impl Variants<CryptoKeyType> for MuxedAccount {
27261    fn variants() -> slice::Iter<'static, CryptoKeyType> {
27262        Self::VARIANTS.iter()
27263    }
27264}
27265
27266impl Union<CryptoKeyType> for MuxedAccount {}
27267
27268impl ReadXdr for MuxedAccount {
27269    #[cfg(feature = "std")]
27270    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
27271        r.with_limited_depth(|r| {
27272            let dv: CryptoKeyType = <CryptoKeyType as ReadXdr>::read_xdr(r)?;
27273            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
27274            let v = match dv {
27275                CryptoKeyType::Ed25519 => Self::Ed25519(Uint256::read_xdr(r)?),
27276                CryptoKeyType::MuxedEd25519 => {
27277                    Self::MuxedEd25519(MuxedAccountMed25519::read_xdr(r)?)
27278                }
27279                #[allow(unreachable_patterns)]
27280                _ => return Err(Error::Invalid),
27281            };
27282            Ok(v)
27283        })
27284    }
27285}
27286
27287impl WriteXdr for MuxedAccount {
27288    #[cfg(feature = "std")]
27289    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
27290        w.with_limited_depth(|w| {
27291            self.discriminant().write_xdr(w)?;
27292            #[allow(clippy::match_same_arms)]
27293            match self {
27294                Self::Ed25519(v) => v.write_xdr(w)?,
27295                Self::MuxedEd25519(v) => v.write_xdr(w)?,
27296            };
27297            Ok(())
27298        })
27299    }
27300}
27301
27302/// DecoratedSignature is an XDR Struct defines as:
27303///
27304/// ```text
27305/// struct DecoratedSignature
27306/// {
27307///     SignatureHint hint;  // last 4 bytes of the public key, used as a hint
27308///     Signature signature; // actual signature
27309/// };
27310/// ```
27311///
27312#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
27313#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
27314#[cfg_attr(
27315    all(feature = "serde", feature = "alloc"),
27316    derive(serde::Serialize, serde::Deserialize),
27317    serde(rename_all = "snake_case")
27318)]
27319#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
27320pub struct DecoratedSignature {
27321    pub hint: SignatureHint,
27322    pub signature: Signature,
27323}
27324
27325impl ReadXdr for DecoratedSignature {
27326    #[cfg(feature = "std")]
27327    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
27328        r.with_limited_depth(|r| {
27329            Ok(Self {
27330                hint: SignatureHint::read_xdr(r)?,
27331                signature: Signature::read_xdr(r)?,
27332            })
27333        })
27334    }
27335}
27336
27337impl WriteXdr for DecoratedSignature {
27338    #[cfg(feature = "std")]
27339    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
27340        w.with_limited_depth(|w| {
27341            self.hint.write_xdr(w)?;
27342            self.signature.write_xdr(w)?;
27343            Ok(())
27344        })
27345    }
27346}
27347
27348/// OperationType is an XDR Enum defines as:
27349///
27350/// ```text
27351/// enum OperationType
27352/// {
27353///     CREATE_ACCOUNT = 0,
27354///     PAYMENT = 1,
27355///     PATH_PAYMENT_STRICT_RECEIVE = 2,
27356///     MANAGE_SELL_OFFER = 3,
27357///     CREATE_PASSIVE_SELL_OFFER = 4,
27358///     SET_OPTIONS = 5,
27359///     CHANGE_TRUST = 6,
27360///     ALLOW_TRUST = 7,
27361///     ACCOUNT_MERGE = 8,
27362///     INFLATION = 9,
27363///     MANAGE_DATA = 10,
27364///     BUMP_SEQUENCE = 11,
27365///     MANAGE_BUY_OFFER = 12,
27366///     PATH_PAYMENT_STRICT_SEND = 13,
27367///     CREATE_CLAIMABLE_BALANCE = 14,
27368///     CLAIM_CLAIMABLE_BALANCE = 15,
27369///     BEGIN_SPONSORING_FUTURE_RESERVES = 16,
27370///     END_SPONSORING_FUTURE_RESERVES = 17,
27371///     REVOKE_SPONSORSHIP = 18,
27372///     CLAWBACK = 19,
27373///     CLAWBACK_CLAIMABLE_BALANCE = 20,
27374///     SET_TRUST_LINE_FLAGS = 21,
27375///     LIQUIDITY_POOL_DEPOSIT = 22,
27376///     LIQUIDITY_POOL_WITHDRAW = 23,
27377///     INVOKE_HOST_FUNCTION = 24,
27378///     EXTEND_FOOTPRINT_TTL = 25,
27379///     RESTORE_FOOTPRINT = 26
27380/// };
27381/// ```
27382///
27383// enum
27384#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
27385#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
27386#[cfg_attr(
27387    all(feature = "serde", feature = "alloc"),
27388    derive(serde::Serialize, serde::Deserialize),
27389    serde(rename_all = "snake_case")
27390)]
27391#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
27392#[repr(i32)]
27393pub enum OperationType {
27394    CreateAccount = 0,
27395    Payment = 1,
27396    PathPaymentStrictReceive = 2,
27397    ManageSellOffer = 3,
27398    CreatePassiveSellOffer = 4,
27399    SetOptions = 5,
27400    ChangeTrust = 6,
27401    AllowTrust = 7,
27402    AccountMerge = 8,
27403    Inflation = 9,
27404    ManageData = 10,
27405    BumpSequence = 11,
27406    ManageBuyOffer = 12,
27407    PathPaymentStrictSend = 13,
27408    CreateClaimableBalance = 14,
27409    ClaimClaimableBalance = 15,
27410    BeginSponsoringFutureReserves = 16,
27411    EndSponsoringFutureReserves = 17,
27412    RevokeSponsorship = 18,
27413    Clawback = 19,
27414    ClawbackClaimableBalance = 20,
27415    SetTrustLineFlags = 21,
27416    LiquidityPoolDeposit = 22,
27417    LiquidityPoolWithdraw = 23,
27418    InvokeHostFunction = 24,
27419    ExtendFootprintTtl = 25,
27420    RestoreFootprint = 26,
27421}
27422
27423impl OperationType {
27424    pub const VARIANTS: [OperationType; 27] = [
27425        OperationType::CreateAccount,
27426        OperationType::Payment,
27427        OperationType::PathPaymentStrictReceive,
27428        OperationType::ManageSellOffer,
27429        OperationType::CreatePassiveSellOffer,
27430        OperationType::SetOptions,
27431        OperationType::ChangeTrust,
27432        OperationType::AllowTrust,
27433        OperationType::AccountMerge,
27434        OperationType::Inflation,
27435        OperationType::ManageData,
27436        OperationType::BumpSequence,
27437        OperationType::ManageBuyOffer,
27438        OperationType::PathPaymentStrictSend,
27439        OperationType::CreateClaimableBalance,
27440        OperationType::ClaimClaimableBalance,
27441        OperationType::BeginSponsoringFutureReserves,
27442        OperationType::EndSponsoringFutureReserves,
27443        OperationType::RevokeSponsorship,
27444        OperationType::Clawback,
27445        OperationType::ClawbackClaimableBalance,
27446        OperationType::SetTrustLineFlags,
27447        OperationType::LiquidityPoolDeposit,
27448        OperationType::LiquidityPoolWithdraw,
27449        OperationType::InvokeHostFunction,
27450        OperationType::ExtendFootprintTtl,
27451        OperationType::RestoreFootprint,
27452    ];
27453    pub const VARIANTS_STR: [&'static str; 27] = [
27454        "CreateAccount",
27455        "Payment",
27456        "PathPaymentStrictReceive",
27457        "ManageSellOffer",
27458        "CreatePassiveSellOffer",
27459        "SetOptions",
27460        "ChangeTrust",
27461        "AllowTrust",
27462        "AccountMerge",
27463        "Inflation",
27464        "ManageData",
27465        "BumpSequence",
27466        "ManageBuyOffer",
27467        "PathPaymentStrictSend",
27468        "CreateClaimableBalance",
27469        "ClaimClaimableBalance",
27470        "BeginSponsoringFutureReserves",
27471        "EndSponsoringFutureReserves",
27472        "RevokeSponsorship",
27473        "Clawback",
27474        "ClawbackClaimableBalance",
27475        "SetTrustLineFlags",
27476        "LiquidityPoolDeposit",
27477        "LiquidityPoolWithdraw",
27478        "InvokeHostFunction",
27479        "ExtendFootprintTtl",
27480        "RestoreFootprint",
27481    ];
27482
27483    #[must_use]
27484    pub const fn name(&self) -> &'static str {
27485        match self {
27486            Self::CreateAccount => "CreateAccount",
27487            Self::Payment => "Payment",
27488            Self::PathPaymentStrictReceive => "PathPaymentStrictReceive",
27489            Self::ManageSellOffer => "ManageSellOffer",
27490            Self::CreatePassiveSellOffer => "CreatePassiveSellOffer",
27491            Self::SetOptions => "SetOptions",
27492            Self::ChangeTrust => "ChangeTrust",
27493            Self::AllowTrust => "AllowTrust",
27494            Self::AccountMerge => "AccountMerge",
27495            Self::Inflation => "Inflation",
27496            Self::ManageData => "ManageData",
27497            Self::BumpSequence => "BumpSequence",
27498            Self::ManageBuyOffer => "ManageBuyOffer",
27499            Self::PathPaymentStrictSend => "PathPaymentStrictSend",
27500            Self::CreateClaimableBalance => "CreateClaimableBalance",
27501            Self::ClaimClaimableBalance => "ClaimClaimableBalance",
27502            Self::BeginSponsoringFutureReserves => "BeginSponsoringFutureReserves",
27503            Self::EndSponsoringFutureReserves => "EndSponsoringFutureReserves",
27504            Self::RevokeSponsorship => "RevokeSponsorship",
27505            Self::Clawback => "Clawback",
27506            Self::ClawbackClaimableBalance => "ClawbackClaimableBalance",
27507            Self::SetTrustLineFlags => "SetTrustLineFlags",
27508            Self::LiquidityPoolDeposit => "LiquidityPoolDeposit",
27509            Self::LiquidityPoolWithdraw => "LiquidityPoolWithdraw",
27510            Self::InvokeHostFunction => "InvokeHostFunction",
27511            Self::ExtendFootprintTtl => "ExtendFootprintTtl",
27512            Self::RestoreFootprint => "RestoreFootprint",
27513        }
27514    }
27515
27516    #[must_use]
27517    pub const fn variants() -> [OperationType; 27] {
27518        Self::VARIANTS
27519    }
27520}
27521
27522impl Name for OperationType {
27523    #[must_use]
27524    fn name(&self) -> &'static str {
27525        Self::name(self)
27526    }
27527}
27528
27529impl Variants<OperationType> for OperationType {
27530    fn variants() -> slice::Iter<'static, OperationType> {
27531        Self::VARIANTS.iter()
27532    }
27533}
27534
27535impl Enum for OperationType {}
27536
27537impl fmt::Display for OperationType {
27538    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
27539        f.write_str(self.name())
27540    }
27541}
27542
27543impl TryFrom<i32> for OperationType {
27544    type Error = Error;
27545
27546    fn try_from(i: i32) -> Result<Self> {
27547        let e = match i {
27548            0 => OperationType::CreateAccount,
27549            1 => OperationType::Payment,
27550            2 => OperationType::PathPaymentStrictReceive,
27551            3 => OperationType::ManageSellOffer,
27552            4 => OperationType::CreatePassiveSellOffer,
27553            5 => OperationType::SetOptions,
27554            6 => OperationType::ChangeTrust,
27555            7 => OperationType::AllowTrust,
27556            8 => OperationType::AccountMerge,
27557            9 => OperationType::Inflation,
27558            10 => OperationType::ManageData,
27559            11 => OperationType::BumpSequence,
27560            12 => OperationType::ManageBuyOffer,
27561            13 => OperationType::PathPaymentStrictSend,
27562            14 => OperationType::CreateClaimableBalance,
27563            15 => OperationType::ClaimClaimableBalance,
27564            16 => OperationType::BeginSponsoringFutureReserves,
27565            17 => OperationType::EndSponsoringFutureReserves,
27566            18 => OperationType::RevokeSponsorship,
27567            19 => OperationType::Clawback,
27568            20 => OperationType::ClawbackClaimableBalance,
27569            21 => OperationType::SetTrustLineFlags,
27570            22 => OperationType::LiquidityPoolDeposit,
27571            23 => OperationType::LiquidityPoolWithdraw,
27572            24 => OperationType::InvokeHostFunction,
27573            25 => OperationType::ExtendFootprintTtl,
27574            26 => OperationType::RestoreFootprint,
27575            #[allow(unreachable_patterns)]
27576            _ => return Err(Error::Invalid),
27577        };
27578        Ok(e)
27579    }
27580}
27581
27582impl From<OperationType> for i32 {
27583    #[must_use]
27584    fn from(e: OperationType) -> Self {
27585        e as Self
27586    }
27587}
27588
27589impl ReadXdr for OperationType {
27590    #[cfg(feature = "std")]
27591    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
27592        r.with_limited_depth(|r| {
27593            let e = i32::read_xdr(r)?;
27594            let v: Self = e.try_into()?;
27595            Ok(v)
27596        })
27597    }
27598}
27599
27600impl WriteXdr for OperationType {
27601    #[cfg(feature = "std")]
27602    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
27603        w.with_limited_depth(|w| {
27604            let i: i32 = (*self).into();
27605            i.write_xdr(w)
27606        })
27607    }
27608}
27609
27610/// CreateAccountOp is an XDR Struct defines as:
27611///
27612/// ```text
27613/// struct CreateAccountOp
27614/// {
27615///     AccountID destination; // account to create
27616///     int64 startingBalance; // amount they end up with
27617/// };
27618/// ```
27619///
27620#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
27621#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
27622#[cfg_attr(
27623    all(feature = "serde", feature = "alloc"),
27624    derive(serde::Serialize, serde::Deserialize),
27625    serde(rename_all = "snake_case")
27626)]
27627#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
27628pub struct CreateAccountOp {
27629    pub destination: AccountId,
27630    pub starting_balance: i64,
27631}
27632
27633impl ReadXdr for CreateAccountOp {
27634    #[cfg(feature = "std")]
27635    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
27636        r.with_limited_depth(|r| {
27637            Ok(Self {
27638                destination: AccountId::read_xdr(r)?,
27639                starting_balance: i64::read_xdr(r)?,
27640            })
27641        })
27642    }
27643}
27644
27645impl WriteXdr for CreateAccountOp {
27646    #[cfg(feature = "std")]
27647    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
27648        w.with_limited_depth(|w| {
27649            self.destination.write_xdr(w)?;
27650            self.starting_balance.write_xdr(w)?;
27651            Ok(())
27652        })
27653    }
27654}
27655
27656/// PaymentOp is an XDR Struct defines as:
27657///
27658/// ```text
27659/// struct PaymentOp
27660/// {
27661///     MuxedAccount destination; // recipient of the payment
27662///     Asset asset;              // what they end up with
27663///     int64 amount;             // amount they end up with
27664/// };
27665/// ```
27666///
27667#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
27668#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
27669#[cfg_attr(
27670    all(feature = "serde", feature = "alloc"),
27671    derive(serde::Serialize, serde::Deserialize),
27672    serde(rename_all = "snake_case")
27673)]
27674#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
27675pub struct PaymentOp {
27676    pub destination: MuxedAccount,
27677    pub asset: Asset,
27678    pub amount: i64,
27679}
27680
27681impl ReadXdr for PaymentOp {
27682    #[cfg(feature = "std")]
27683    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
27684        r.with_limited_depth(|r| {
27685            Ok(Self {
27686                destination: MuxedAccount::read_xdr(r)?,
27687                asset: Asset::read_xdr(r)?,
27688                amount: i64::read_xdr(r)?,
27689            })
27690        })
27691    }
27692}
27693
27694impl WriteXdr for PaymentOp {
27695    #[cfg(feature = "std")]
27696    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
27697        w.with_limited_depth(|w| {
27698            self.destination.write_xdr(w)?;
27699            self.asset.write_xdr(w)?;
27700            self.amount.write_xdr(w)?;
27701            Ok(())
27702        })
27703    }
27704}
27705
27706/// PathPaymentStrictReceiveOp is an XDR Struct defines as:
27707///
27708/// ```text
27709/// struct PathPaymentStrictReceiveOp
27710/// {
27711///     Asset sendAsset; // asset we pay with
27712///     int64 sendMax;   // the maximum amount of sendAsset to
27713///                      // send (excluding fees).
27714///                      // The operation will fail if can't be met
27715///
27716///     MuxedAccount destination; // recipient of the payment
27717///     Asset destAsset;          // what they end up with
27718///     int64 destAmount;         // amount they end up with
27719///
27720///     Asset path<5>; // additional hops it must go through to get there
27721/// };
27722/// ```
27723///
27724#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
27725#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
27726#[cfg_attr(
27727    all(feature = "serde", feature = "alloc"),
27728    derive(serde::Serialize, serde::Deserialize),
27729    serde(rename_all = "snake_case")
27730)]
27731#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
27732pub struct PathPaymentStrictReceiveOp {
27733    pub send_asset: Asset,
27734    pub send_max: i64,
27735    pub destination: MuxedAccount,
27736    pub dest_asset: Asset,
27737    pub dest_amount: i64,
27738    pub path: VecM<Asset, 5>,
27739}
27740
27741impl ReadXdr for PathPaymentStrictReceiveOp {
27742    #[cfg(feature = "std")]
27743    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
27744        r.with_limited_depth(|r| {
27745            Ok(Self {
27746                send_asset: Asset::read_xdr(r)?,
27747                send_max: i64::read_xdr(r)?,
27748                destination: MuxedAccount::read_xdr(r)?,
27749                dest_asset: Asset::read_xdr(r)?,
27750                dest_amount: i64::read_xdr(r)?,
27751                path: VecM::<Asset, 5>::read_xdr(r)?,
27752            })
27753        })
27754    }
27755}
27756
27757impl WriteXdr for PathPaymentStrictReceiveOp {
27758    #[cfg(feature = "std")]
27759    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
27760        w.with_limited_depth(|w| {
27761            self.send_asset.write_xdr(w)?;
27762            self.send_max.write_xdr(w)?;
27763            self.destination.write_xdr(w)?;
27764            self.dest_asset.write_xdr(w)?;
27765            self.dest_amount.write_xdr(w)?;
27766            self.path.write_xdr(w)?;
27767            Ok(())
27768        })
27769    }
27770}
27771
27772/// PathPaymentStrictSendOp is an XDR Struct defines as:
27773///
27774/// ```text
27775/// struct PathPaymentStrictSendOp
27776/// {
27777///     Asset sendAsset;  // asset we pay with
27778///     int64 sendAmount; // amount of sendAsset to send (excluding fees)
27779///
27780///     MuxedAccount destination; // recipient of the payment
27781///     Asset destAsset;          // what they end up with
27782///     int64 destMin;            // the minimum amount of dest asset to
27783///                               // be received
27784///                               // The operation will fail if it can't be met
27785///
27786///     Asset path<5>; // additional hops it must go through to get there
27787/// };
27788/// ```
27789///
27790#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
27791#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
27792#[cfg_attr(
27793    all(feature = "serde", feature = "alloc"),
27794    derive(serde::Serialize, serde::Deserialize),
27795    serde(rename_all = "snake_case")
27796)]
27797#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
27798pub struct PathPaymentStrictSendOp {
27799    pub send_asset: Asset,
27800    pub send_amount: i64,
27801    pub destination: MuxedAccount,
27802    pub dest_asset: Asset,
27803    pub dest_min: i64,
27804    pub path: VecM<Asset, 5>,
27805}
27806
27807impl ReadXdr for PathPaymentStrictSendOp {
27808    #[cfg(feature = "std")]
27809    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
27810        r.with_limited_depth(|r| {
27811            Ok(Self {
27812                send_asset: Asset::read_xdr(r)?,
27813                send_amount: i64::read_xdr(r)?,
27814                destination: MuxedAccount::read_xdr(r)?,
27815                dest_asset: Asset::read_xdr(r)?,
27816                dest_min: i64::read_xdr(r)?,
27817                path: VecM::<Asset, 5>::read_xdr(r)?,
27818            })
27819        })
27820    }
27821}
27822
27823impl WriteXdr for PathPaymentStrictSendOp {
27824    #[cfg(feature = "std")]
27825    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
27826        w.with_limited_depth(|w| {
27827            self.send_asset.write_xdr(w)?;
27828            self.send_amount.write_xdr(w)?;
27829            self.destination.write_xdr(w)?;
27830            self.dest_asset.write_xdr(w)?;
27831            self.dest_min.write_xdr(w)?;
27832            self.path.write_xdr(w)?;
27833            Ok(())
27834        })
27835    }
27836}
27837
27838/// ManageSellOfferOp is an XDR Struct defines as:
27839///
27840/// ```text
27841/// struct ManageSellOfferOp
27842/// {
27843///     Asset selling;
27844///     Asset buying;
27845///     int64 amount; // amount being sold. if set to 0, delete the offer
27846///     Price price;  // price of thing being sold in terms of what you are buying
27847///
27848///     // 0=create a new offer, otherwise edit an existing offer
27849///     int64 offerID;
27850/// };
27851/// ```
27852///
27853#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
27854#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
27855#[cfg_attr(
27856    all(feature = "serde", feature = "alloc"),
27857    derive(serde::Serialize, serde::Deserialize),
27858    serde(rename_all = "snake_case")
27859)]
27860#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
27861pub struct ManageSellOfferOp {
27862    pub selling: Asset,
27863    pub buying: Asset,
27864    pub amount: i64,
27865    pub price: Price,
27866    pub offer_id: i64,
27867}
27868
27869impl ReadXdr for ManageSellOfferOp {
27870    #[cfg(feature = "std")]
27871    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
27872        r.with_limited_depth(|r| {
27873            Ok(Self {
27874                selling: Asset::read_xdr(r)?,
27875                buying: Asset::read_xdr(r)?,
27876                amount: i64::read_xdr(r)?,
27877                price: Price::read_xdr(r)?,
27878                offer_id: i64::read_xdr(r)?,
27879            })
27880        })
27881    }
27882}
27883
27884impl WriteXdr for ManageSellOfferOp {
27885    #[cfg(feature = "std")]
27886    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
27887        w.with_limited_depth(|w| {
27888            self.selling.write_xdr(w)?;
27889            self.buying.write_xdr(w)?;
27890            self.amount.write_xdr(w)?;
27891            self.price.write_xdr(w)?;
27892            self.offer_id.write_xdr(w)?;
27893            Ok(())
27894        })
27895    }
27896}
27897
27898/// ManageBuyOfferOp is an XDR Struct defines as:
27899///
27900/// ```text
27901/// struct ManageBuyOfferOp
27902/// {
27903///     Asset selling;
27904///     Asset buying;
27905///     int64 buyAmount; // amount being bought. if set to 0, delete the offer
27906///     Price price;     // price of thing being bought in terms of what you are
27907///                      // selling
27908///
27909///     // 0=create a new offer, otherwise edit an existing offer
27910///     int64 offerID;
27911/// };
27912/// ```
27913///
27914#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
27915#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
27916#[cfg_attr(
27917    all(feature = "serde", feature = "alloc"),
27918    derive(serde::Serialize, serde::Deserialize),
27919    serde(rename_all = "snake_case")
27920)]
27921#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
27922pub struct ManageBuyOfferOp {
27923    pub selling: Asset,
27924    pub buying: Asset,
27925    pub buy_amount: i64,
27926    pub price: Price,
27927    pub offer_id: i64,
27928}
27929
27930impl ReadXdr for ManageBuyOfferOp {
27931    #[cfg(feature = "std")]
27932    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
27933        r.with_limited_depth(|r| {
27934            Ok(Self {
27935                selling: Asset::read_xdr(r)?,
27936                buying: Asset::read_xdr(r)?,
27937                buy_amount: i64::read_xdr(r)?,
27938                price: Price::read_xdr(r)?,
27939                offer_id: i64::read_xdr(r)?,
27940            })
27941        })
27942    }
27943}
27944
27945impl WriteXdr for ManageBuyOfferOp {
27946    #[cfg(feature = "std")]
27947    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
27948        w.with_limited_depth(|w| {
27949            self.selling.write_xdr(w)?;
27950            self.buying.write_xdr(w)?;
27951            self.buy_amount.write_xdr(w)?;
27952            self.price.write_xdr(w)?;
27953            self.offer_id.write_xdr(w)?;
27954            Ok(())
27955        })
27956    }
27957}
27958
27959/// CreatePassiveSellOfferOp is an XDR Struct defines as:
27960///
27961/// ```text
27962/// struct CreatePassiveSellOfferOp
27963/// {
27964///     Asset selling; // A
27965///     Asset buying;  // B
27966///     int64 amount;  // amount taker gets
27967///     Price price;   // cost of A in terms of B
27968/// };
27969/// ```
27970///
27971#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
27972#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
27973#[cfg_attr(
27974    all(feature = "serde", feature = "alloc"),
27975    derive(serde::Serialize, serde::Deserialize),
27976    serde(rename_all = "snake_case")
27977)]
27978#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
27979pub struct CreatePassiveSellOfferOp {
27980    pub selling: Asset,
27981    pub buying: Asset,
27982    pub amount: i64,
27983    pub price: Price,
27984}
27985
27986impl ReadXdr for CreatePassiveSellOfferOp {
27987    #[cfg(feature = "std")]
27988    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
27989        r.with_limited_depth(|r| {
27990            Ok(Self {
27991                selling: Asset::read_xdr(r)?,
27992                buying: Asset::read_xdr(r)?,
27993                amount: i64::read_xdr(r)?,
27994                price: Price::read_xdr(r)?,
27995            })
27996        })
27997    }
27998}
27999
28000impl WriteXdr for CreatePassiveSellOfferOp {
28001    #[cfg(feature = "std")]
28002    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28003        w.with_limited_depth(|w| {
28004            self.selling.write_xdr(w)?;
28005            self.buying.write_xdr(w)?;
28006            self.amount.write_xdr(w)?;
28007            self.price.write_xdr(w)?;
28008            Ok(())
28009        })
28010    }
28011}
28012
28013/// SetOptionsOp is an XDR Struct defines as:
28014///
28015/// ```text
28016/// struct SetOptionsOp
28017/// {
28018///     AccountID* inflationDest; // sets the inflation destination
28019///
28020///     uint32* clearFlags; // which flags to clear
28021///     uint32* setFlags;   // which flags to set
28022///
28023///     // account threshold manipulation
28024///     uint32* masterWeight; // weight of the master account
28025///     uint32* lowThreshold;
28026///     uint32* medThreshold;
28027///     uint32* highThreshold;
28028///
28029///     string32* homeDomain; // sets the home domain
28030///
28031///     // Add, update or remove a signer for the account
28032///     // signer is deleted if the weight is 0
28033///     Signer* signer;
28034/// };
28035/// ```
28036///
28037#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28038#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28039#[cfg_attr(
28040    all(feature = "serde", feature = "alloc"),
28041    derive(serde::Serialize, serde::Deserialize),
28042    serde(rename_all = "snake_case")
28043)]
28044#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28045pub struct SetOptionsOp {
28046    pub inflation_dest: Option<AccountId>,
28047    pub clear_flags: Option<u32>,
28048    pub set_flags: Option<u32>,
28049    pub master_weight: Option<u32>,
28050    pub low_threshold: Option<u32>,
28051    pub med_threshold: Option<u32>,
28052    pub high_threshold: Option<u32>,
28053    pub home_domain: Option<String32>,
28054    pub signer: Option<Signer>,
28055}
28056
28057impl ReadXdr for SetOptionsOp {
28058    #[cfg(feature = "std")]
28059    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
28060        r.with_limited_depth(|r| {
28061            Ok(Self {
28062                inflation_dest: Option::<AccountId>::read_xdr(r)?,
28063                clear_flags: Option::<u32>::read_xdr(r)?,
28064                set_flags: Option::<u32>::read_xdr(r)?,
28065                master_weight: Option::<u32>::read_xdr(r)?,
28066                low_threshold: Option::<u32>::read_xdr(r)?,
28067                med_threshold: Option::<u32>::read_xdr(r)?,
28068                high_threshold: Option::<u32>::read_xdr(r)?,
28069                home_domain: Option::<String32>::read_xdr(r)?,
28070                signer: Option::<Signer>::read_xdr(r)?,
28071            })
28072        })
28073    }
28074}
28075
28076impl WriteXdr for SetOptionsOp {
28077    #[cfg(feature = "std")]
28078    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28079        w.with_limited_depth(|w| {
28080            self.inflation_dest.write_xdr(w)?;
28081            self.clear_flags.write_xdr(w)?;
28082            self.set_flags.write_xdr(w)?;
28083            self.master_weight.write_xdr(w)?;
28084            self.low_threshold.write_xdr(w)?;
28085            self.med_threshold.write_xdr(w)?;
28086            self.high_threshold.write_xdr(w)?;
28087            self.home_domain.write_xdr(w)?;
28088            self.signer.write_xdr(w)?;
28089            Ok(())
28090        })
28091    }
28092}
28093
28094/// ChangeTrustAsset is an XDR Union defines as:
28095///
28096/// ```text
28097/// union ChangeTrustAsset switch (AssetType type)
28098/// {
28099/// case ASSET_TYPE_NATIVE: // Not credit
28100///     void;
28101///
28102/// case ASSET_TYPE_CREDIT_ALPHANUM4:
28103///     AlphaNum4 alphaNum4;
28104///
28105/// case ASSET_TYPE_CREDIT_ALPHANUM12:
28106///     AlphaNum12 alphaNum12;
28107///
28108/// case ASSET_TYPE_POOL_SHARE:
28109///     LiquidityPoolParameters liquidityPool;
28110///
28111///     // add other asset types here in the future
28112/// };
28113/// ```
28114///
28115// union with discriminant AssetType
28116#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28117#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28118#[cfg_attr(
28119    all(feature = "serde", feature = "alloc"),
28120    derive(serde::Serialize, serde::Deserialize),
28121    serde(rename_all = "snake_case")
28122)]
28123#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28124#[allow(clippy::large_enum_variant)]
28125pub enum ChangeTrustAsset {
28126    Native,
28127    CreditAlphanum4(AlphaNum4),
28128    CreditAlphanum12(AlphaNum12),
28129    PoolShare(LiquidityPoolParameters),
28130}
28131
28132impl ChangeTrustAsset {
28133    pub const VARIANTS: [AssetType; 4] = [
28134        AssetType::Native,
28135        AssetType::CreditAlphanum4,
28136        AssetType::CreditAlphanum12,
28137        AssetType::PoolShare,
28138    ];
28139    pub const VARIANTS_STR: [&'static str; 4] =
28140        ["Native", "CreditAlphanum4", "CreditAlphanum12", "PoolShare"];
28141
28142    #[must_use]
28143    pub const fn name(&self) -> &'static str {
28144        match self {
28145            Self::Native => "Native",
28146            Self::CreditAlphanum4(_) => "CreditAlphanum4",
28147            Self::CreditAlphanum12(_) => "CreditAlphanum12",
28148            Self::PoolShare(_) => "PoolShare",
28149        }
28150    }
28151
28152    #[must_use]
28153    pub const fn discriminant(&self) -> AssetType {
28154        #[allow(clippy::match_same_arms)]
28155        match self {
28156            Self::Native => AssetType::Native,
28157            Self::CreditAlphanum4(_) => AssetType::CreditAlphanum4,
28158            Self::CreditAlphanum12(_) => AssetType::CreditAlphanum12,
28159            Self::PoolShare(_) => AssetType::PoolShare,
28160        }
28161    }
28162
28163    #[must_use]
28164    pub const fn variants() -> [AssetType; 4] {
28165        Self::VARIANTS
28166    }
28167}
28168
28169impl Name for ChangeTrustAsset {
28170    #[must_use]
28171    fn name(&self) -> &'static str {
28172        Self::name(self)
28173    }
28174}
28175
28176impl Discriminant<AssetType> for ChangeTrustAsset {
28177    #[must_use]
28178    fn discriminant(&self) -> AssetType {
28179        Self::discriminant(self)
28180    }
28181}
28182
28183impl Variants<AssetType> for ChangeTrustAsset {
28184    fn variants() -> slice::Iter<'static, AssetType> {
28185        Self::VARIANTS.iter()
28186    }
28187}
28188
28189impl Union<AssetType> for ChangeTrustAsset {}
28190
28191impl ReadXdr for ChangeTrustAsset {
28192    #[cfg(feature = "std")]
28193    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
28194        r.with_limited_depth(|r| {
28195            let dv: AssetType = <AssetType as ReadXdr>::read_xdr(r)?;
28196            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
28197            let v = match dv {
28198                AssetType::Native => Self::Native,
28199                AssetType::CreditAlphanum4 => Self::CreditAlphanum4(AlphaNum4::read_xdr(r)?),
28200                AssetType::CreditAlphanum12 => Self::CreditAlphanum12(AlphaNum12::read_xdr(r)?),
28201                AssetType::PoolShare => Self::PoolShare(LiquidityPoolParameters::read_xdr(r)?),
28202                #[allow(unreachable_patterns)]
28203                _ => return Err(Error::Invalid),
28204            };
28205            Ok(v)
28206        })
28207    }
28208}
28209
28210impl WriteXdr for ChangeTrustAsset {
28211    #[cfg(feature = "std")]
28212    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28213        w.with_limited_depth(|w| {
28214            self.discriminant().write_xdr(w)?;
28215            #[allow(clippy::match_same_arms)]
28216            match self {
28217                Self::Native => ().write_xdr(w)?,
28218                Self::CreditAlphanum4(v) => v.write_xdr(w)?,
28219                Self::CreditAlphanum12(v) => v.write_xdr(w)?,
28220                Self::PoolShare(v) => v.write_xdr(w)?,
28221            };
28222            Ok(())
28223        })
28224    }
28225}
28226
28227/// ChangeTrustOp is an XDR Struct defines as:
28228///
28229/// ```text
28230/// struct ChangeTrustOp
28231/// {
28232///     ChangeTrustAsset line;
28233///
28234///     // if limit is set to 0, deletes the trust line
28235///     int64 limit;
28236/// };
28237/// ```
28238///
28239#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28240#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28241#[cfg_attr(
28242    all(feature = "serde", feature = "alloc"),
28243    derive(serde::Serialize, serde::Deserialize),
28244    serde(rename_all = "snake_case")
28245)]
28246#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28247pub struct ChangeTrustOp {
28248    pub line: ChangeTrustAsset,
28249    pub limit: i64,
28250}
28251
28252impl ReadXdr for ChangeTrustOp {
28253    #[cfg(feature = "std")]
28254    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
28255        r.with_limited_depth(|r| {
28256            Ok(Self {
28257                line: ChangeTrustAsset::read_xdr(r)?,
28258                limit: i64::read_xdr(r)?,
28259            })
28260        })
28261    }
28262}
28263
28264impl WriteXdr for ChangeTrustOp {
28265    #[cfg(feature = "std")]
28266    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28267        w.with_limited_depth(|w| {
28268            self.line.write_xdr(w)?;
28269            self.limit.write_xdr(w)?;
28270            Ok(())
28271        })
28272    }
28273}
28274
28275/// AllowTrustOp is an XDR Struct defines as:
28276///
28277/// ```text
28278/// struct AllowTrustOp
28279/// {
28280///     AccountID trustor;
28281///     AssetCode asset;
28282///
28283///     // One of 0, AUTHORIZED_FLAG, or AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG
28284///     uint32 authorize;
28285/// };
28286/// ```
28287///
28288#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28289#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28290#[cfg_attr(
28291    all(feature = "serde", feature = "alloc"),
28292    derive(serde::Serialize, serde::Deserialize),
28293    serde(rename_all = "snake_case")
28294)]
28295#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28296pub struct AllowTrustOp {
28297    pub trustor: AccountId,
28298    pub asset: AssetCode,
28299    pub authorize: u32,
28300}
28301
28302impl ReadXdr for AllowTrustOp {
28303    #[cfg(feature = "std")]
28304    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
28305        r.with_limited_depth(|r| {
28306            Ok(Self {
28307                trustor: AccountId::read_xdr(r)?,
28308                asset: AssetCode::read_xdr(r)?,
28309                authorize: u32::read_xdr(r)?,
28310            })
28311        })
28312    }
28313}
28314
28315impl WriteXdr for AllowTrustOp {
28316    #[cfg(feature = "std")]
28317    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28318        w.with_limited_depth(|w| {
28319            self.trustor.write_xdr(w)?;
28320            self.asset.write_xdr(w)?;
28321            self.authorize.write_xdr(w)?;
28322            Ok(())
28323        })
28324    }
28325}
28326
28327/// ManageDataOp is an XDR Struct defines as:
28328///
28329/// ```text
28330/// struct ManageDataOp
28331/// {
28332///     string64 dataName;
28333///     DataValue* dataValue; // set to null to clear
28334/// };
28335/// ```
28336///
28337#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28338#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28339#[cfg_attr(
28340    all(feature = "serde", feature = "alloc"),
28341    derive(serde::Serialize, serde::Deserialize),
28342    serde(rename_all = "snake_case")
28343)]
28344#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28345pub struct ManageDataOp {
28346    pub data_name: String64,
28347    pub data_value: Option<DataValue>,
28348}
28349
28350impl ReadXdr for ManageDataOp {
28351    #[cfg(feature = "std")]
28352    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
28353        r.with_limited_depth(|r| {
28354            Ok(Self {
28355                data_name: String64::read_xdr(r)?,
28356                data_value: Option::<DataValue>::read_xdr(r)?,
28357            })
28358        })
28359    }
28360}
28361
28362impl WriteXdr for ManageDataOp {
28363    #[cfg(feature = "std")]
28364    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28365        w.with_limited_depth(|w| {
28366            self.data_name.write_xdr(w)?;
28367            self.data_value.write_xdr(w)?;
28368            Ok(())
28369        })
28370    }
28371}
28372
28373/// BumpSequenceOp is an XDR Struct defines as:
28374///
28375/// ```text
28376/// struct BumpSequenceOp
28377/// {
28378///     SequenceNumber bumpTo;
28379/// };
28380/// ```
28381///
28382#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28383#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28384#[cfg_attr(
28385    all(feature = "serde", feature = "alloc"),
28386    derive(serde::Serialize, serde::Deserialize),
28387    serde(rename_all = "snake_case")
28388)]
28389#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28390pub struct BumpSequenceOp {
28391    pub bump_to: SequenceNumber,
28392}
28393
28394impl ReadXdr for BumpSequenceOp {
28395    #[cfg(feature = "std")]
28396    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
28397        r.with_limited_depth(|r| {
28398            Ok(Self {
28399                bump_to: SequenceNumber::read_xdr(r)?,
28400            })
28401        })
28402    }
28403}
28404
28405impl WriteXdr for BumpSequenceOp {
28406    #[cfg(feature = "std")]
28407    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28408        w.with_limited_depth(|w| {
28409            self.bump_to.write_xdr(w)?;
28410            Ok(())
28411        })
28412    }
28413}
28414
28415/// CreateClaimableBalanceOp is an XDR Struct defines as:
28416///
28417/// ```text
28418/// struct CreateClaimableBalanceOp
28419/// {
28420///     Asset asset;
28421///     int64 amount;
28422///     Claimant claimants<10>;
28423/// };
28424/// ```
28425///
28426#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28427#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28428#[cfg_attr(
28429    all(feature = "serde", feature = "alloc"),
28430    derive(serde::Serialize, serde::Deserialize),
28431    serde(rename_all = "snake_case")
28432)]
28433#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28434pub struct CreateClaimableBalanceOp {
28435    pub asset: Asset,
28436    pub amount: i64,
28437    pub claimants: VecM<Claimant, 10>,
28438}
28439
28440impl ReadXdr for CreateClaimableBalanceOp {
28441    #[cfg(feature = "std")]
28442    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
28443        r.with_limited_depth(|r| {
28444            Ok(Self {
28445                asset: Asset::read_xdr(r)?,
28446                amount: i64::read_xdr(r)?,
28447                claimants: VecM::<Claimant, 10>::read_xdr(r)?,
28448            })
28449        })
28450    }
28451}
28452
28453impl WriteXdr for CreateClaimableBalanceOp {
28454    #[cfg(feature = "std")]
28455    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28456        w.with_limited_depth(|w| {
28457            self.asset.write_xdr(w)?;
28458            self.amount.write_xdr(w)?;
28459            self.claimants.write_xdr(w)?;
28460            Ok(())
28461        })
28462    }
28463}
28464
28465/// ClaimClaimableBalanceOp is an XDR Struct defines as:
28466///
28467/// ```text
28468/// struct ClaimClaimableBalanceOp
28469/// {
28470///     ClaimableBalanceID balanceID;
28471/// };
28472/// ```
28473///
28474#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28475#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28476#[cfg_attr(
28477    all(feature = "serde", feature = "alloc"),
28478    derive(serde::Serialize, serde::Deserialize),
28479    serde(rename_all = "snake_case")
28480)]
28481#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28482pub struct ClaimClaimableBalanceOp {
28483    pub balance_id: ClaimableBalanceId,
28484}
28485
28486impl ReadXdr for ClaimClaimableBalanceOp {
28487    #[cfg(feature = "std")]
28488    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
28489        r.with_limited_depth(|r| {
28490            Ok(Self {
28491                balance_id: ClaimableBalanceId::read_xdr(r)?,
28492            })
28493        })
28494    }
28495}
28496
28497impl WriteXdr for ClaimClaimableBalanceOp {
28498    #[cfg(feature = "std")]
28499    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28500        w.with_limited_depth(|w| {
28501            self.balance_id.write_xdr(w)?;
28502            Ok(())
28503        })
28504    }
28505}
28506
28507/// BeginSponsoringFutureReservesOp is an XDR Struct defines as:
28508///
28509/// ```text
28510/// struct BeginSponsoringFutureReservesOp
28511/// {
28512///     AccountID sponsoredID;
28513/// };
28514/// ```
28515///
28516#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28517#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28518#[cfg_attr(
28519    all(feature = "serde", feature = "alloc"),
28520    derive(serde::Serialize, serde::Deserialize),
28521    serde(rename_all = "snake_case")
28522)]
28523#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28524pub struct BeginSponsoringFutureReservesOp {
28525    pub sponsored_id: AccountId,
28526}
28527
28528impl ReadXdr for BeginSponsoringFutureReservesOp {
28529    #[cfg(feature = "std")]
28530    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
28531        r.with_limited_depth(|r| {
28532            Ok(Self {
28533                sponsored_id: AccountId::read_xdr(r)?,
28534            })
28535        })
28536    }
28537}
28538
28539impl WriteXdr for BeginSponsoringFutureReservesOp {
28540    #[cfg(feature = "std")]
28541    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28542        w.with_limited_depth(|w| {
28543            self.sponsored_id.write_xdr(w)?;
28544            Ok(())
28545        })
28546    }
28547}
28548
28549/// RevokeSponsorshipType is an XDR Enum defines as:
28550///
28551/// ```text
28552/// enum RevokeSponsorshipType
28553/// {
28554///     REVOKE_SPONSORSHIP_LEDGER_ENTRY = 0,
28555///     REVOKE_SPONSORSHIP_SIGNER = 1
28556/// };
28557/// ```
28558///
28559// enum
28560#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28561#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28562#[cfg_attr(
28563    all(feature = "serde", feature = "alloc"),
28564    derive(serde::Serialize, serde::Deserialize),
28565    serde(rename_all = "snake_case")
28566)]
28567#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28568#[repr(i32)]
28569pub enum RevokeSponsorshipType {
28570    LedgerEntry = 0,
28571    Signer = 1,
28572}
28573
28574impl RevokeSponsorshipType {
28575    pub const VARIANTS: [RevokeSponsorshipType; 2] = [
28576        RevokeSponsorshipType::LedgerEntry,
28577        RevokeSponsorshipType::Signer,
28578    ];
28579    pub const VARIANTS_STR: [&'static str; 2] = ["LedgerEntry", "Signer"];
28580
28581    #[must_use]
28582    pub const fn name(&self) -> &'static str {
28583        match self {
28584            Self::LedgerEntry => "LedgerEntry",
28585            Self::Signer => "Signer",
28586        }
28587    }
28588
28589    #[must_use]
28590    pub const fn variants() -> [RevokeSponsorshipType; 2] {
28591        Self::VARIANTS
28592    }
28593}
28594
28595impl Name for RevokeSponsorshipType {
28596    #[must_use]
28597    fn name(&self) -> &'static str {
28598        Self::name(self)
28599    }
28600}
28601
28602impl Variants<RevokeSponsorshipType> for RevokeSponsorshipType {
28603    fn variants() -> slice::Iter<'static, RevokeSponsorshipType> {
28604        Self::VARIANTS.iter()
28605    }
28606}
28607
28608impl Enum for RevokeSponsorshipType {}
28609
28610impl fmt::Display for RevokeSponsorshipType {
28611    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
28612        f.write_str(self.name())
28613    }
28614}
28615
28616impl TryFrom<i32> for RevokeSponsorshipType {
28617    type Error = Error;
28618
28619    fn try_from(i: i32) -> Result<Self> {
28620        let e = match i {
28621            0 => RevokeSponsorshipType::LedgerEntry,
28622            1 => RevokeSponsorshipType::Signer,
28623            #[allow(unreachable_patterns)]
28624            _ => return Err(Error::Invalid),
28625        };
28626        Ok(e)
28627    }
28628}
28629
28630impl From<RevokeSponsorshipType> for i32 {
28631    #[must_use]
28632    fn from(e: RevokeSponsorshipType) -> Self {
28633        e as Self
28634    }
28635}
28636
28637impl ReadXdr for RevokeSponsorshipType {
28638    #[cfg(feature = "std")]
28639    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
28640        r.with_limited_depth(|r| {
28641            let e = i32::read_xdr(r)?;
28642            let v: Self = e.try_into()?;
28643            Ok(v)
28644        })
28645    }
28646}
28647
28648impl WriteXdr for RevokeSponsorshipType {
28649    #[cfg(feature = "std")]
28650    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28651        w.with_limited_depth(|w| {
28652            let i: i32 = (*self).into();
28653            i.write_xdr(w)
28654        })
28655    }
28656}
28657
28658/// RevokeSponsorshipOpSigner is an XDR NestedStruct defines as:
28659///
28660/// ```text
28661/// struct
28662///     {
28663///         AccountID accountID;
28664///         SignerKey signerKey;
28665///     }
28666/// ```
28667///
28668#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28669#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28670#[cfg_attr(
28671    all(feature = "serde", feature = "alloc"),
28672    derive(serde::Serialize, serde::Deserialize),
28673    serde(rename_all = "snake_case")
28674)]
28675#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28676pub struct RevokeSponsorshipOpSigner {
28677    pub account_id: AccountId,
28678    pub signer_key: SignerKey,
28679}
28680
28681impl ReadXdr for RevokeSponsorshipOpSigner {
28682    #[cfg(feature = "std")]
28683    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
28684        r.with_limited_depth(|r| {
28685            Ok(Self {
28686                account_id: AccountId::read_xdr(r)?,
28687                signer_key: SignerKey::read_xdr(r)?,
28688            })
28689        })
28690    }
28691}
28692
28693impl WriteXdr for RevokeSponsorshipOpSigner {
28694    #[cfg(feature = "std")]
28695    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28696        w.with_limited_depth(|w| {
28697            self.account_id.write_xdr(w)?;
28698            self.signer_key.write_xdr(w)?;
28699            Ok(())
28700        })
28701    }
28702}
28703
28704/// RevokeSponsorshipOp is an XDR Union defines as:
28705///
28706/// ```text
28707/// union RevokeSponsorshipOp switch (RevokeSponsorshipType type)
28708/// {
28709/// case REVOKE_SPONSORSHIP_LEDGER_ENTRY:
28710///     LedgerKey ledgerKey;
28711/// case REVOKE_SPONSORSHIP_SIGNER:
28712///     struct
28713///     {
28714///         AccountID accountID;
28715///         SignerKey signerKey;
28716///     } signer;
28717/// };
28718/// ```
28719///
28720// union with discriminant RevokeSponsorshipType
28721#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28722#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28723#[cfg_attr(
28724    all(feature = "serde", feature = "alloc"),
28725    derive(serde::Serialize, serde::Deserialize),
28726    serde(rename_all = "snake_case")
28727)]
28728#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28729#[allow(clippy::large_enum_variant)]
28730pub enum RevokeSponsorshipOp {
28731    LedgerEntry(LedgerKey),
28732    Signer(RevokeSponsorshipOpSigner),
28733}
28734
28735impl RevokeSponsorshipOp {
28736    pub const VARIANTS: [RevokeSponsorshipType; 2] = [
28737        RevokeSponsorshipType::LedgerEntry,
28738        RevokeSponsorshipType::Signer,
28739    ];
28740    pub const VARIANTS_STR: [&'static str; 2] = ["LedgerEntry", "Signer"];
28741
28742    #[must_use]
28743    pub const fn name(&self) -> &'static str {
28744        match self {
28745            Self::LedgerEntry(_) => "LedgerEntry",
28746            Self::Signer(_) => "Signer",
28747        }
28748    }
28749
28750    #[must_use]
28751    pub const fn discriminant(&self) -> RevokeSponsorshipType {
28752        #[allow(clippy::match_same_arms)]
28753        match self {
28754            Self::LedgerEntry(_) => RevokeSponsorshipType::LedgerEntry,
28755            Self::Signer(_) => RevokeSponsorshipType::Signer,
28756        }
28757    }
28758
28759    #[must_use]
28760    pub const fn variants() -> [RevokeSponsorshipType; 2] {
28761        Self::VARIANTS
28762    }
28763}
28764
28765impl Name for RevokeSponsorshipOp {
28766    #[must_use]
28767    fn name(&self) -> &'static str {
28768        Self::name(self)
28769    }
28770}
28771
28772impl Discriminant<RevokeSponsorshipType> for RevokeSponsorshipOp {
28773    #[must_use]
28774    fn discriminant(&self) -> RevokeSponsorshipType {
28775        Self::discriminant(self)
28776    }
28777}
28778
28779impl Variants<RevokeSponsorshipType> for RevokeSponsorshipOp {
28780    fn variants() -> slice::Iter<'static, RevokeSponsorshipType> {
28781        Self::VARIANTS.iter()
28782    }
28783}
28784
28785impl Union<RevokeSponsorshipType> for RevokeSponsorshipOp {}
28786
28787impl ReadXdr for RevokeSponsorshipOp {
28788    #[cfg(feature = "std")]
28789    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
28790        r.with_limited_depth(|r| {
28791            let dv: RevokeSponsorshipType = <RevokeSponsorshipType as ReadXdr>::read_xdr(r)?;
28792            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
28793            let v = match dv {
28794                RevokeSponsorshipType::LedgerEntry => Self::LedgerEntry(LedgerKey::read_xdr(r)?),
28795                RevokeSponsorshipType::Signer => {
28796                    Self::Signer(RevokeSponsorshipOpSigner::read_xdr(r)?)
28797                }
28798                #[allow(unreachable_patterns)]
28799                _ => return Err(Error::Invalid),
28800            };
28801            Ok(v)
28802        })
28803    }
28804}
28805
28806impl WriteXdr for RevokeSponsorshipOp {
28807    #[cfg(feature = "std")]
28808    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28809        w.with_limited_depth(|w| {
28810            self.discriminant().write_xdr(w)?;
28811            #[allow(clippy::match_same_arms)]
28812            match self {
28813                Self::LedgerEntry(v) => v.write_xdr(w)?,
28814                Self::Signer(v) => v.write_xdr(w)?,
28815            };
28816            Ok(())
28817        })
28818    }
28819}
28820
28821/// ClawbackOp is an XDR Struct defines as:
28822///
28823/// ```text
28824/// struct ClawbackOp
28825/// {
28826///     Asset asset;
28827///     MuxedAccount from;
28828///     int64 amount;
28829/// };
28830/// ```
28831///
28832#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28833#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28834#[cfg_attr(
28835    all(feature = "serde", feature = "alloc"),
28836    derive(serde::Serialize, serde::Deserialize),
28837    serde(rename_all = "snake_case")
28838)]
28839#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28840pub struct ClawbackOp {
28841    pub asset: Asset,
28842    pub from: MuxedAccount,
28843    pub amount: i64,
28844}
28845
28846impl ReadXdr for ClawbackOp {
28847    #[cfg(feature = "std")]
28848    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
28849        r.with_limited_depth(|r| {
28850            Ok(Self {
28851                asset: Asset::read_xdr(r)?,
28852                from: MuxedAccount::read_xdr(r)?,
28853                amount: i64::read_xdr(r)?,
28854            })
28855        })
28856    }
28857}
28858
28859impl WriteXdr for ClawbackOp {
28860    #[cfg(feature = "std")]
28861    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28862        w.with_limited_depth(|w| {
28863            self.asset.write_xdr(w)?;
28864            self.from.write_xdr(w)?;
28865            self.amount.write_xdr(w)?;
28866            Ok(())
28867        })
28868    }
28869}
28870
28871/// ClawbackClaimableBalanceOp is an XDR Struct defines as:
28872///
28873/// ```text
28874/// struct ClawbackClaimableBalanceOp
28875/// {
28876///     ClaimableBalanceID balanceID;
28877/// };
28878/// ```
28879///
28880#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28881#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28882#[cfg_attr(
28883    all(feature = "serde", feature = "alloc"),
28884    derive(serde::Serialize, serde::Deserialize),
28885    serde(rename_all = "snake_case")
28886)]
28887#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28888pub struct ClawbackClaimableBalanceOp {
28889    pub balance_id: ClaimableBalanceId,
28890}
28891
28892impl ReadXdr for ClawbackClaimableBalanceOp {
28893    #[cfg(feature = "std")]
28894    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
28895        r.with_limited_depth(|r| {
28896            Ok(Self {
28897                balance_id: ClaimableBalanceId::read_xdr(r)?,
28898            })
28899        })
28900    }
28901}
28902
28903impl WriteXdr for ClawbackClaimableBalanceOp {
28904    #[cfg(feature = "std")]
28905    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28906        w.with_limited_depth(|w| {
28907            self.balance_id.write_xdr(w)?;
28908            Ok(())
28909        })
28910    }
28911}
28912
28913/// SetTrustLineFlagsOp is an XDR Struct defines as:
28914///
28915/// ```text
28916/// struct SetTrustLineFlagsOp
28917/// {
28918///     AccountID trustor;
28919///     Asset asset;
28920///
28921///     uint32 clearFlags; // which flags to clear
28922///     uint32 setFlags;   // which flags to set
28923/// };
28924/// ```
28925///
28926#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28927#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28928#[cfg_attr(
28929    all(feature = "serde", feature = "alloc"),
28930    derive(serde::Serialize, serde::Deserialize),
28931    serde(rename_all = "snake_case")
28932)]
28933#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28934pub struct SetTrustLineFlagsOp {
28935    pub trustor: AccountId,
28936    pub asset: Asset,
28937    pub clear_flags: u32,
28938    pub set_flags: u32,
28939}
28940
28941impl ReadXdr for SetTrustLineFlagsOp {
28942    #[cfg(feature = "std")]
28943    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
28944        r.with_limited_depth(|r| {
28945            Ok(Self {
28946                trustor: AccountId::read_xdr(r)?,
28947                asset: Asset::read_xdr(r)?,
28948                clear_flags: u32::read_xdr(r)?,
28949                set_flags: u32::read_xdr(r)?,
28950            })
28951        })
28952    }
28953}
28954
28955impl WriteXdr for SetTrustLineFlagsOp {
28956    #[cfg(feature = "std")]
28957    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28958        w.with_limited_depth(|w| {
28959            self.trustor.write_xdr(w)?;
28960            self.asset.write_xdr(w)?;
28961            self.clear_flags.write_xdr(w)?;
28962            self.set_flags.write_xdr(w)?;
28963            Ok(())
28964        })
28965    }
28966}
28967
28968/// LiquidityPoolFeeV18 is an XDR Const defines as:
28969///
28970/// ```text
28971/// const LIQUIDITY_POOL_FEE_V18 = 30;
28972/// ```
28973///
28974pub const LIQUIDITY_POOL_FEE_V18: u64 = 30;
28975
28976/// LiquidityPoolDepositOp is an XDR Struct defines as:
28977///
28978/// ```text
28979/// struct LiquidityPoolDepositOp
28980/// {
28981///     PoolID liquidityPoolID;
28982///     int64 maxAmountA; // maximum amount of first asset to deposit
28983///     int64 maxAmountB; // maximum amount of second asset to deposit
28984///     Price minPrice;   // minimum depositA/depositB
28985///     Price maxPrice;   // maximum depositA/depositB
28986/// };
28987/// ```
28988///
28989#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28990#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28991#[cfg_attr(
28992    all(feature = "serde", feature = "alloc"),
28993    derive(serde::Serialize, serde::Deserialize),
28994    serde(rename_all = "snake_case")
28995)]
28996#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28997pub struct LiquidityPoolDepositOp {
28998    pub liquidity_pool_id: PoolId,
28999    pub max_amount_a: i64,
29000    pub max_amount_b: i64,
29001    pub min_price: Price,
29002    pub max_price: Price,
29003}
29004
29005impl ReadXdr for LiquidityPoolDepositOp {
29006    #[cfg(feature = "std")]
29007    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
29008        r.with_limited_depth(|r| {
29009            Ok(Self {
29010                liquidity_pool_id: PoolId::read_xdr(r)?,
29011                max_amount_a: i64::read_xdr(r)?,
29012                max_amount_b: i64::read_xdr(r)?,
29013                min_price: Price::read_xdr(r)?,
29014                max_price: Price::read_xdr(r)?,
29015            })
29016        })
29017    }
29018}
29019
29020impl WriteXdr for LiquidityPoolDepositOp {
29021    #[cfg(feature = "std")]
29022    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
29023        w.with_limited_depth(|w| {
29024            self.liquidity_pool_id.write_xdr(w)?;
29025            self.max_amount_a.write_xdr(w)?;
29026            self.max_amount_b.write_xdr(w)?;
29027            self.min_price.write_xdr(w)?;
29028            self.max_price.write_xdr(w)?;
29029            Ok(())
29030        })
29031    }
29032}
29033
29034/// LiquidityPoolWithdrawOp is an XDR Struct defines as:
29035///
29036/// ```text
29037/// struct LiquidityPoolWithdrawOp
29038/// {
29039///     PoolID liquidityPoolID;
29040///     int64 amount;     // amount of pool shares to withdraw
29041///     int64 minAmountA; // minimum amount of first asset to withdraw
29042///     int64 minAmountB; // minimum amount of second asset to withdraw
29043/// };
29044/// ```
29045///
29046#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
29047#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
29048#[cfg_attr(
29049    all(feature = "serde", feature = "alloc"),
29050    derive(serde::Serialize, serde::Deserialize),
29051    serde(rename_all = "snake_case")
29052)]
29053#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
29054pub struct LiquidityPoolWithdrawOp {
29055    pub liquidity_pool_id: PoolId,
29056    pub amount: i64,
29057    pub min_amount_a: i64,
29058    pub min_amount_b: i64,
29059}
29060
29061impl ReadXdr for LiquidityPoolWithdrawOp {
29062    #[cfg(feature = "std")]
29063    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
29064        r.with_limited_depth(|r| {
29065            Ok(Self {
29066                liquidity_pool_id: PoolId::read_xdr(r)?,
29067                amount: i64::read_xdr(r)?,
29068                min_amount_a: i64::read_xdr(r)?,
29069                min_amount_b: i64::read_xdr(r)?,
29070            })
29071        })
29072    }
29073}
29074
29075impl WriteXdr for LiquidityPoolWithdrawOp {
29076    #[cfg(feature = "std")]
29077    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
29078        w.with_limited_depth(|w| {
29079            self.liquidity_pool_id.write_xdr(w)?;
29080            self.amount.write_xdr(w)?;
29081            self.min_amount_a.write_xdr(w)?;
29082            self.min_amount_b.write_xdr(w)?;
29083            Ok(())
29084        })
29085    }
29086}
29087
29088/// HostFunctionType is an XDR Enum defines as:
29089///
29090/// ```text
29091/// enum HostFunctionType
29092/// {
29093///     HOST_FUNCTION_TYPE_INVOKE_CONTRACT = 0,
29094///     HOST_FUNCTION_TYPE_CREATE_CONTRACT = 1,
29095///     HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM = 2,
29096///     HOST_FUNCTION_TYPE_CREATE_CONTRACT_V2 = 3
29097/// };
29098/// ```
29099///
29100// enum
29101#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
29102#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
29103#[cfg_attr(
29104    all(feature = "serde", feature = "alloc"),
29105    derive(serde::Serialize, serde::Deserialize),
29106    serde(rename_all = "snake_case")
29107)]
29108#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
29109#[repr(i32)]
29110pub enum HostFunctionType {
29111    InvokeContract = 0,
29112    CreateContract = 1,
29113    UploadContractWasm = 2,
29114    CreateContractV2 = 3,
29115}
29116
29117impl HostFunctionType {
29118    pub const VARIANTS: [HostFunctionType; 4] = [
29119        HostFunctionType::InvokeContract,
29120        HostFunctionType::CreateContract,
29121        HostFunctionType::UploadContractWasm,
29122        HostFunctionType::CreateContractV2,
29123    ];
29124    pub const VARIANTS_STR: [&'static str; 4] = [
29125        "InvokeContract",
29126        "CreateContract",
29127        "UploadContractWasm",
29128        "CreateContractV2",
29129    ];
29130
29131    #[must_use]
29132    pub const fn name(&self) -> &'static str {
29133        match self {
29134            Self::InvokeContract => "InvokeContract",
29135            Self::CreateContract => "CreateContract",
29136            Self::UploadContractWasm => "UploadContractWasm",
29137            Self::CreateContractV2 => "CreateContractV2",
29138        }
29139    }
29140
29141    #[must_use]
29142    pub const fn variants() -> [HostFunctionType; 4] {
29143        Self::VARIANTS
29144    }
29145}
29146
29147impl Name for HostFunctionType {
29148    #[must_use]
29149    fn name(&self) -> &'static str {
29150        Self::name(self)
29151    }
29152}
29153
29154impl Variants<HostFunctionType> for HostFunctionType {
29155    fn variants() -> slice::Iter<'static, HostFunctionType> {
29156        Self::VARIANTS.iter()
29157    }
29158}
29159
29160impl Enum for HostFunctionType {}
29161
29162impl fmt::Display for HostFunctionType {
29163    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
29164        f.write_str(self.name())
29165    }
29166}
29167
29168impl TryFrom<i32> for HostFunctionType {
29169    type Error = Error;
29170
29171    fn try_from(i: i32) -> Result<Self> {
29172        let e = match i {
29173            0 => HostFunctionType::InvokeContract,
29174            1 => HostFunctionType::CreateContract,
29175            2 => HostFunctionType::UploadContractWasm,
29176            3 => HostFunctionType::CreateContractV2,
29177            #[allow(unreachable_patterns)]
29178            _ => return Err(Error::Invalid),
29179        };
29180        Ok(e)
29181    }
29182}
29183
29184impl From<HostFunctionType> for i32 {
29185    #[must_use]
29186    fn from(e: HostFunctionType) -> Self {
29187        e as Self
29188    }
29189}
29190
29191impl ReadXdr for HostFunctionType {
29192    #[cfg(feature = "std")]
29193    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
29194        r.with_limited_depth(|r| {
29195            let e = i32::read_xdr(r)?;
29196            let v: Self = e.try_into()?;
29197            Ok(v)
29198        })
29199    }
29200}
29201
29202impl WriteXdr for HostFunctionType {
29203    #[cfg(feature = "std")]
29204    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
29205        w.with_limited_depth(|w| {
29206            let i: i32 = (*self).into();
29207            i.write_xdr(w)
29208        })
29209    }
29210}
29211
29212/// ContractIdPreimageType is an XDR Enum defines as:
29213///
29214/// ```text
29215/// enum ContractIDPreimageType
29216/// {
29217///     CONTRACT_ID_PREIMAGE_FROM_ADDRESS = 0,
29218///     CONTRACT_ID_PREIMAGE_FROM_ASSET = 1
29219/// };
29220/// ```
29221///
29222// enum
29223#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
29224#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
29225#[cfg_attr(
29226    all(feature = "serde", feature = "alloc"),
29227    derive(serde::Serialize, serde::Deserialize),
29228    serde(rename_all = "snake_case")
29229)]
29230#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
29231#[repr(i32)]
29232pub enum ContractIdPreimageType {
29233    Address = 0,
29234    Asset = 1,
29235}
29236
29237impl ContractIdPreimageType {
29238    pub const VARIANTS: [ContractIdPreimageType; 2] = [
29239        ContractIdPreimageType::Address,
29240        ContractIdPreimageType::Asset,
29241    ];
29242    pub const VARIANTS_STR: [&'static str; 2] = ["Address", "Asset"];
29243
29244    #[must_use]
29245    pub const fn name(&self) -> &'static str {
29246        match self {
29247            Self::Address => "Address",
29248            Self::Asset => "Asset",
29249        }
29250    }
29251
29252    #[must_use]
29253    pub const fn variants() -> [ContractIdPreimageType; 2] {
29254        Self::VARIANTS
29255    }
29256}
29257
29258impl Name for ContractIdPreimageType {
29259    #[must_use]
29260    fn name(&self) -> &'static str {
29261        Self::name(self)
29262    }
29263}
29264
29265impl Variants<ContractIdPreimageType> for ContractIdPreimageType {
29266    fn variants() -> slice::Iter<'static, ContractIdPreimageType> {
29267        Self::VARIANTS.iter()
29268    }
29269}
29270
29271impl Enum for ContractIdPreimageType {}
29272
29273impl fmt::Display for ContractIdPreimageType {
29274    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
29275        f.write_str(self.name())
29276    }
29277}
29278
29279impl TryFrom<i32> for ContractIdPreimageType {
29280    type Error = Error;
29281
29282    fn try_from(i: i32) -> Result<Self> {
29283        let e = match i {
29284            0 => ContractIdPreimageType::Address,
29285            1 => ContractIdPreimageType::Asset,
29286            #[allow(unreachable_patterns)]
29287            _ => return Err(Error::Invalid),
29288        };
29289        Ok(e)
29290    }
29291}
29292
29293impl From<ContractIdPreimageType> for i32 {
29294    #[must_use]
29295    fn from(e: ContractIdPreimageType) -> Self {
29296        e as Self
29297    }
29298}
29299
29300impl ReadXdr for ContractIdPreimageType {
29301    #[cfg(feature = "std")]
29302    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
29303        r.with_limited_depth(|r| {
29304            let e = i32::read_xdr(r)?;
29305            let v: Self = e.try_into()?;
29306            Ok(v)
29307        })
29308    }
29309}
29310
29311impl WriteXdr for ContractIdPreimageType {
29312    #[cfg(feature = "std")]
29313    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
29314        w.with_limited_depth(|w| {
29315            let i: i32 = (*self).into();
29316            i.write_xdr(w)
29317        })
29318    }
29319}
29320
29321/// ContractIdPreimageFromAddress is an XDR NestedStruct defines as:
29322///
29323/// ```text
29324/// struct
29325///     {
29326///         SCAddress address;
29327///         uint256 salt;
29328///     }
29329/// ```
29330///
29331#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
29332#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
29333#[cfg_attr(
29334    all(feature = "serde", feature = "alloc"),
29335    derive(serde::Serialize, serde::Deserialize),
29336    serde(rename_all = "snake_case")
29337)]
29338#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
29339pub struct ContractIdPreimageFromAddress {
29340    pub address: ScAddress,
29341    pub salt: Uint256,
29342}
29343
29344impl ReadXdr for ContractIdPreimageFromAddress {
29345    #[cfg(feature = "std")]
29346    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
29347        r.with_limited_depth(|r| {
29348            Ok(Self {
29349                address: ScAddress::read_xdr(r)?,
29350                salt: Uint256::read_xdr(r)?,
29351            })
29352        })
29353    }
29354}
29355
29356impl WriteXdr for ContractIdPreimageFromAddress {
29357    #[cfg(feature = "std")]
29358    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
29359        w.with_limited_depth(|w| {
29360            self.address.write_xdr(w)?;
29361            self.salt.write_xdr(w)?;
29362            Ok(())
29363        })
29364    }
29365}
29366
29367/// ContractIdPreimage is an XDR Union defines as:
29368///
29369/// ```text
29370/// union ContractIDPreimage switch (ContractIDPreimageType type)
29371/// {
29372/// case CONTRACT_ID_PREIMAGE_FROM_ADDRESS:
29373///     struct
29374///     {
29375///         SCAddress address;
29376///         uint256 salt;
29377///     } fromAddress;
29378/// case CONTRACT_ID_PREIMAGE_FROM_ASSET:
29379///     Asset fromAsset;
29380/// };
29381/// ```
29382///
29383// union with discriminant ContractIdPreimageType
29384#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
29385#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
29386#[cfg_attr(
29387    all(feature = "serde", feature = "alloc"),
29388    derive(serde::Serialize, serde::Deserialize),
29389    serde(rename_all = "snake_case")
29390)]
29391#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
29392#[allow(clippy::large_enum_variant)]
29393pub enum ContractIdPreimage {
29394    Address(ContractIdPreimageFromAddress),
29395    Asset(Asset),
29396}
29397
29398impl ContractIdPreimage {
29399    pub const VARIANTS: [ContractIdPreimageType; 2] = [
29400        ContractIdPreimageType::Address,
29401        ContractIdPreimageType::Asset,
29402    ];
29403    pub const VARIANTS_STR: [&'static str; 2] = ["Address", "Asset"];
29404
29405    #[must_use]
29406    pub const fn name(&self) -> &'static str {
29407        match self {
29408            Self::Address(_) => "Address",
29409            Self::Asset(_) => "Asset",
29410        }
29411    }
29412
29413    #[must_use]
29414    pub const fn discriminant(&self) -> ContractIdPreimageType {
29415        #[allow(clippy::match_same_arms)]
29416        match self {
29417            Self::Address(_) => ContractIdPreimageType::Address,
29418            Self::Asset(_) => ContractIdPreimageType::Asset,
29419        }
29420    }
29421
29422    #[must_use]
29423    pub const fn variants() -> [ContractIdPreimageType; 2] {
29424        Self::VARIANTS
29425    }
29426}
29427
29428impl Name for ContractIdPreimage {
29429    #[must_use]
29430    fn name(&self) -> &'static str {
29431        Self::name(self)
29432    }
29433}
29434
29435impl Discriminant<ContractIdPreimageType> for ContractIdPreimage {
29436    #[must_use]
29437    fn discriminant(&self) -> ContractIdPreimageType {
29438        Self::discriminant(self)
29439    }
29440}
29441
29442impl Variants<ContractIdPreimageType> for ContractIdPreimage {
29443    fn variants() -> slice::Iter<'static, ContractIdPreimageType> {
29444        Self::VARIANTS.iter()
29445    }
29446}
29447
29448impl Union<ContractIdPreimageType> for ContractIdPreimage {}
29449
29450impl ReadXdr for ContractIdPreimage {
29451    #[cfg(feature = "std")]
29452    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
29453        r.with_limited_depth(|r| {
29454            let dv: ContractIdPreimageType = <ContractIdPreimageType as ReadXdr>::read_xdr(r)?;
29455            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
29456            let v = match dv {
29457                ContractIdPreimageType::Address => {
29458                    Self::Address(ContractIdPreimageFromAddress::read_xdr(r)?)
29459                }
29460                ContractIdPreimageType::Asset => Self::Asset(Asset::read_xdr(r)?),
29461                #[allow(unreachable_patterns)]
29462                _ => return Err(Error::Invalid),
29463            };
29464            Ok(v)
29465        })
29466    }
29467}
29468
29469impl WriteXdr for ContractIdPreimage {
29470    #[cfg(feature = "std")]
29471    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
29472        w.with_limited_depth(|w| {
29473            self.discriminant().write_xdr(w)?;
29474            #[allow(clippy::match_same_arms)]
29475            match self {
29476                Self::Address(v) => v.write_xdr(w)?,
29477                Self::Asset(v) => v.write_xdr(w)?,
29478            };
29479            Ok(())
29480        })
29481    }
29482}
29483
29484/// CreateContractArgs is an XDR Struct defines as:
29485///
29486/// ```text
29487/// struct CreateContractArgs
29488/// {
29489///     ContractIDPreimage contractIDPreimage;
29490///     ContractExecutable executable;
29491/// };
29492/// ```
29493///
29494#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
29495#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
29496#[cfg_attr(
29497    all(feature = "serde", feature = "alloc"),
29498    derive(serde::Serialize, serde::Deserialize),
29499    serde(rename_all = "snake_case")
29500)]
29501#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
29502pub struct CreateContractArgs {
29503    pub contract_id_preimage: ContractIdPreimage,
29504    pub executable: ContractExecutable,
29505}
29506
29507impl ReadXdr for CreateContractArgs {
29508    #[cfg(feature = "std")]
29509    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
29510        r.with_limited_depth(|r| {
29511            Ok(Self {
29512                contract_id_preimage: ContractIdPreimage::read_xdr(r)?,
29513                executable: ContractExecutable::read_xdr(r)?,
29514            })
29515        })
29516    }
29517}
29518
29519impl WriteXdr for CreateContractArgs {
29520    #[cfg(feature = "std")]
29521    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
29522        w.with_limited_depth(|w| {
29523            self.contract_id_preimage.write_xdr(w)?;
29524            self.executable.write_xdr(w)?;
29525            Ok(())
29526        })
29527    }
29528}
29529
29530/// CreateContractArgsV2 is an XDR Struct defines as:
29531///
29532/// ```text
29533/// struct CreateContractArgsV2
29534/// {
29535///     ContractIDPreimage contractIDPreimage;
29536///     ContractExecutable executable;
29537///     // Arguments of the contract's constructor.
29538///     SCVal constructorArgs<>;
29539/// };
29540/// ```
29541///
29542#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
29543#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
29544#[cfg_attr(
29545    all(feature = "serde", feature = "alloc"),
29546    derive(serde::Serialize, serde::Deserialize),
29547    serde(rename_all = "snake_case")
29548)]
29549#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
29550pub struct CreateContractArgsV2 {
29551    pub contract_id_preimage: ContractIdPreimage,
29552    pub executable: ContractExecutable,
29553    pub constructor_args: VecM<ScVal>,
29554}
29555
29556impl ReadXdr for CreateContractArgsV2 {
29557    #[cfg(feature = "std")]
29558    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
29559        r.with_limited_depth(|r| {
29560            Ok(Self {
29561                contract_id_preimage: ContractIdPreimage::read_xdr(r)?,
29562                executable: ContractExecutable::read_xdr(r)?,
29563                constructor_args: VecM::<ScVal>::read_xdr(r)?,
29564            })
29565        })
29566    }
29567}
29568
29569impl WriteXdr for CreateContractArgsV2 {
29570    #[cfg(feature = "std")]
29571    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
29572        w.with_limited_depth(|w| {
29573            self.contract_id_preimage.write_xdr(w)?;
29574            self.executable.write_xdr(w)?;
29575            self.constructor_args.write_xdr(w)?;
29576            Ok(())
29577        })
29578    }
29579}
29580
29581/// InvokeContractArgs is an XDR Struct defines as:
29582///
29583/// ```text
29584/// struct InvokeContractArgs {
29585///     SCAddress contractAddress;
29586///     SCSymbol functionName;
29587///     SCVal args<>;
29588/// };
29589/// ```
29590///
29591#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
29592#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
29593#[cfg_attr(
29594    all(feature = "serde", feature = "alloc"),
29595    derive(serde::Serialize, serde::Deserialize),
29596    serde(rename_all = "snake_case")
29597)]
29598#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
29599pub struct InvokeContractArgs {
29600    pub contract_address: ScAddress,
29601    pub function_name: ScSymbol,
29602    pub args: VecM<ScVal>,
29603}
29604
29605impl ReadXdr for InvokeContractArgs {
29606    #[cfg(feature = "std")]
29607    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
29608        r.with_limited_depth(|r| {
29609            Ok(Self {
29610                contract_address: ScAddress::read_xdr(r)?,
29611                function_name: ScSymbol::read_xdr(r)?,
29612                args: VecM::<ScVal>::read_xdr(r)?,
29613            })
29614        })
29615    }
29616}
29617
29618impl WriteXdr for InvokeContractArgs {
29619    #[cfg(feature = "std")]
29620    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
29621        w.with_limited_depth(|w| {
29622            self.contract_address.write_xdr(w)?;
29623            self.function_name.write_xdr(w)?;
29624            self.args.write_xdr(w)?;
29625            Ok(())
29626        })
29627    }
29628}
29629
29630/// HostFunction is an XDR Union defines as:
29631///
29632/// ```text
29633/// union HostFunction switch (HostFunctionType type)
29634/// {
29635/// case HOST_FUNCTION_TYPE_INVOKE_CONTRACT:
29636///     InvokeContractArgs invokeContract;
29637/// case HOST_FUNCTION_TYPE_CREATE_CONTRACT:
29638///     CreateContractArgs createContract;
29639/// case HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM:
29640///     opaque wasm<>;
29641/// case HOST_FUNCTION_TYPE_CREATE_CONTRACT_V2:
29642///     CreateContractArgsV2 createContractV2;
29643/// };
29644/// ```
29645///
29646// union with discriminant HostFunctionType
29647#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
29648#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
29649#[cfg_attr(
29650    all(feature = "serde", feature = "alloc"),
29651    derive(serde::Serialize, serde::Deserialize),
29652    serde(rename_all = "snake_case")
29653)]
29654#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
29655#[allow(clippy::large_enum_variant)]
29656pub enum HostFunction {
29657    InvokeContract(InvokeContractArgs),
29658    CreateContract(CreateContractArgs),
29659    UploadContractWasm(BytesM),
29660    CreateContractV2(CreateContractArgsV2),
29661}
29662
29663impl HostFunction {
29664    pub const VARIANTS: [HostFunctionType; 4] = [
29665        HostFunctionType::InvokeContract,
29666        HostFunctionType::CreateContract,
29667        HostFunctionType::UploadContractWasm,
29668        HostFunctionType::CreateContractV2,
29669    ];
29670    pub const VARIANTS_STR: [&'static str; 4] = [
29671        "InvokeContract",
29672        "CreateContract",
29673        "UploadContractWasm",
29674        "CreateContractV2",
29675    ];
29676
29677    #[must_use]
29678    pub const fn name(&self) -> &'static str {
29679        match self {
29680            Self::InvokeContract(_) => "InvokeContract",
29681            Self::CreateContract(_) => "CreateContract",
29682            Self::UploadContractWasm(_) => "UploadContractWasm",
29683            Self::CreateContractV2(_) => "CreateContractV2",
29684        }
29685    }
29686
29687    #[must_use]
29688    pub const fn discriminant(&self) -> HostFunctionType {
29689        #[allow(clippy::match_same_arms)]
29690        match self {
29691            Self::InvokeContract(_) => HostFunctionType::InvokeContract,
29692            Self::CreateContract(_) => HostFunctionType::CreateContract,
29693            Self::UploadContractWasm(_) => HostFunctionType::UploadContractWasm,
29694            Self::CreateContractV2(_) => HostFunctionType::CreateContractV2,
29695        }
29696    }
29697
29698    #[must_use]
29699    pub const fn variants() -> [HostFunctionType; 4] {
29700        Self::VARIANTS
29701    }
29702}
29703
29704impl Name for HostFunction {
29705    #[must_use]
29706    fn name(&self) -> &'static str {
29707        Self::name(self)
29708    }
29709}
29710
29711impl Discriminant<HostFunctionType> for HostFunction {
29712    #[must_use]
29713    fn discriminant(&self) -> HostFunctionType {
29714        Self::discriminant(self)
29715    }
29716}
29717
29718impl Variants<HostFunctionType> for HostFunction {
29719    fn variants() -> slice::Iter<'static, HostFunctionType> {
29720        Self::VARIANTS.iter()
29721    }
29722}
29723
29724impl Union<HostFunctionType> for HostFunction {}
29725
29726impl ReadXdr for HostFunction {
29727    #[cfg(feature = "std")]
29728    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
29729        r.with_limited_depth(|r| {
29730            let dv: HostFunctionType = <HostFunctionType as ReadXdr>::read_xdr(r)?;
29731            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
29732            let v = match dv {
29733                HostFunctionType::InvokeContract => {
29734                    Self::InvokeContract(InvokeContractArgs::read_xdr(r)?)
29735                }
29736                HostFunctionType::CreateContract => {
29737                    Self::CreateContract(CreateContractArgs::read_xdr(r)?)
29738                }
29739                HostFunctionType::UploadContractWasm => {
29740                    Self::UploadContractWasm(BytesM::read_xdr(r)?)
29741                }
29742                HostFunctionType::CreateContractV2 => {
29743                    Self::CreateContractV2(CreateContractArgsV2::read_xdr(r)?)
29744                }
29745                #[allow(unreachable_patterns)]
29746                _ => return Err(Error::Invalid),
29747            };
29748            Ok(v)
29749        })
29750    }
29751}
29752
29753impl WriteXdr for HostFunction {
29754    #[cfg(feature = "std")]
29755    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
29756        w.with_limited_depth(|w| {
29757            self.discriminant().write_xdr(w)?;
29758            #[allow(clippy::match_same_arms)]
29759            match self {
29760                Self::InvokeContract(v) => v.write_xdr(w)?,
29761                Self::CreateContract(v) => v.write_xdr(w)?,
29762                Self::UploadContractWasm(v) => v.write_xdr(w)?,
29763                Self::CreateContractV2(v) => v.write_xdr(w)?,
29764            };
29765            Ok(())
29766        })
29767    }
29768}
29769
29770/// SorobanAuthorizedFunctionType is an XDR Enum defines as:
29771///
29772/// ```text
29773/// enum SorobanAuthorizedFunctionType
29774/// {
29775///     SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN = 0,
29776///     SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN = 1,
29777///     SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN = 2
29778/// };
29779/// ```
29780///
29781// enum
29782#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
29783#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
29784#[cfg_attr(
29785    all(feature = "serde", feature = "alloc"),
29786    derive(serde::Serialize, serde::Deserialize),
29787    serde(rename_all = "snake_case")
29788)]
29789#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
29790#[repr(i32)]
29791pub enum SorobanAuthorizedFunctionType {
29792    ContractFn = 0,
29793    CreateContractHostFn = 1,
29794    CreateContractV2HostFn = 2,
29795}
29796
29797impl SorobanAuthorizedFunctionType {
29798    pub const VARIANTS: [SorobanAuthorizedFunctionType; 3] = [
29799        SorobanAuthorizedFunctionType::ContractFn,
29800        SorobanAuthorizedFunctionType::CreateContractHostFn,
29801        SorobanAuthorizedFunctionType::CreateContractV2HostFn,
29802    ];
29803    pub const VARIANTS_STR: [&'static str; 3] = [
29804        "ContractFn",
29805        "CreateContractHostFn",
29806        "CreateContractV2HostFn",
29807    ];
29808
29809    #[must_use]
29810    pub const fn name(&self) -> &'static str {
29811        match self {
29812            Self::ContractFn => "ContractFn",
29813            Self::CreateContractHostFn => "CreateContractHostFn",
29814            Self::CreateContractV2HostFn => "CreateContractV2HostFn",
29815        }
29816    }
29817
29818    #[must_use]
29819    pub const fn variants() -> [SorobanAuthorizedFunctionType; 3] {
29820        Self::VARIANTS
29821    }
29822}
29823
29824impl Name for SorobanAuthorizedFunctionType {
29825    #[must_use]
29826    fn name(&self) -> &'static str {
29827        Self::name(self)
29828    }
29829}
29830
29831impl Variants<SorobanAuthorizedFunctionType> for SorobanAuthorizedFunctionType {
29832    fn variants() -> slice::Iter<'static, SorobanAuthorizedFunctionType> {
29833        Self::VARIANTS.iter()
29834    }
29835}
29836
29837impl Enum for SorobanAuthorizedFunctionType {}
29838
29839impl fmt::Display for SorobanAuthorizedFunctionType {
29840    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
29841        f.write_str(self.name())
29842    }
29843}
29844
29845impl TryFrom<i32> for SorobanAuthorizedFunctionType {
29846    type Error = Error;
29847
29848    fn try_from(i: i32) -> Result<Self> {
29849        let e = match i {
29850            0 => SorobanAuthorizedFunctionType::ContractFn,
29851            1 => SorobanAuthorizedFunctionType::CreateContractHostFn,
29852            2 => SorobanAuthorizedFunctionType::CreateContractV2HostFn,
29853            #[allow(unreachable_patterns)]
29854            _ => return Err(Error::Invalid),
29855        };
29856        Ok(e)
29857    }
29858}
29859
29860impl From<SorobanAuthorizedFunctionType> for i32 {
29861    #[must_use]
29862    fn from(e: SorobanAuthorizedFunctionType) -> Self {
29863        e as Self
29864    }
29865}
29866
29867impl ReadXdr for SorobanAuthorizedFunctionType {
29868    #[cfg(feature = "std")]
29869    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
29870        r.with_limited_depth(|r| {
29871            let e = i32::read_xdr(r)?;
29872            let v: Self = e.try_into()?;
29873            Ok(v)
29874        })
29875    }
29876}
29877
29878impl WriteXdr for SorobanAuthorizedFunctionType {
29879    #[cfg(feature = "std")]
29880    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
29881        w.with_limited_depth(|w| {
29882            let i: i32 = (*self).into();
29883            i.write_xdr(w)
29884        })
29885    }
29886}
29887
29888/// SorobanAuthorizedFunction is an XDR Union defines as:
29889///
29890/// ```text
29891/// union SorobanAuthorizedFunction switch (SorobanAuthorizedFunctionType type)
29892/// {
29893/// case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN:
29894///     InvokeContractArgs contractFn;
29895/// // This variant of auth payload for creating new contract instances
29896/// // doesn't allow specifying the constructor arguments, creating contracts
29897/// // with constructors that take arguments is only possible by authorizing
29898/// // `SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN`
29899/// // (protocol 22+).
29900/// case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN:
29901///     CreateContractArgs createContractHostFn;
29902/// // This variant of auth payload for creating new contract instances
29903/// // is only accepted in and after protocol 22. It allows authorizing the
29904/// // contract constructor arguments.
29905/// case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN:
29906///     CreateContractArgsV2 createContractV2HostFn;
29907/// };
29908/// ```
29909///
29910// union with discriminant SorobanAuthorizedFunctionType
29911#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
29912#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
29913#[cfg_attr(
29914    all(feature = "serde", feature = "alloc"),
29915    derive(serde::Serialize, serde::Deserialize),
29916    serde(rename_all = "snake_case")
29917)]
29918#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
29919#[allow(clippy::large_enum_variant)]
29920pub enum SorobanAuthorizedFunction {
29921    ContractFn(InvokeContractArgs),
29922    CreateContractHostFn(CreateContractArgs),
29923    CreateContractV2HostFn(CreateContractArgsV2),
29924}
29925
29926impl SorobanAuthorizedFunction {
29927    pub const VARIANTS: [SorobanAuthorizedFunctionType; 3] = [
29928        SorobanAuthorizedFunctionType::ContractFn,
29929        SorobanAuthorizedFunctionType::CreateContractHostFn,
29930        SorobanAuthorizedFunctionType::CreateContractV2HostFn,
29931    ];
29932    pub const VARIANTS_STR: [&'static str; 3] = [
29933        "ContractFn",
29934        "CreateContractHostFn",
29935        "CreateContractV2HostFn",
29936    ];
29937
29938    #[must_use]
29939    pub const fn name(&self) -> &'static str {
29940        match self {
29941            Self::ContractFn(_) => "ContractFn",
29942            Self::CreateContractHostFn(_) => "CreateContractHostFn",
29943            Self::CreateContractV2HostFn(_) => "CreateContractV2HostFn",
29944        }
29945    }
29946
29947    #[must_use]
29948    pub const fn discriminant(&self) -> SorobanAuthorizedFunctionType {
29949        #[allow(clippy::match_same_arms)]
29950        match self {
29951            Self::ContractFn(_) => SorobanAuthorizedFunctionType::ContractFn,
29952            Self::CreateContractHostFn(_) => SorobanAuthorizedFunctionType::CreateContractHostFn,
29953            Self::CreateContractV2HostFn(_) => {
29954                SorobanAuthorizedFunctionType::CreateContractV2HostFn
29955            }
29956        }
29957    }
29958
29959    #[must_use]
29960    pub const fn variants() -> [SorobanAuthorizedFunctionType; 3] {
29961        Self::VARIANTS
29962    }
29963}
29964
29965impl Name for SorobanAuthorizedFunction {
29966    #[must_use]
29967    fn name(&self) -> &'static str {
29968        Self::name(self)
29969    }
29970}
29971
29972impl Discriminant<SorobanAuthorizedFunctionType> for SorobanAuthorizedFunction {
29973    #[must_use]
29974    fn discriminant(&self) -> SorobanAuthorizedFunctionType {
29975        Self::discriminant(self)
29976    }
29977}
29978
29979impl Variants<SorobanAuthorizedFunctionType> for SorobanAuthorizedFunction {
29980    fn variants() -> slice::Iter<'static, SorobanAuthorizedFunctionType> {
29981        Self::VARIANTS.iter()
29982    }
29983}
29984
29985impl Union<SorobanAuthorizedFunctionType> for SorobanAuthorizedFunction {}
29986
29987impl ReadXdr for SorobanAuthorizedFunction {
29988    #[cfg(feature = "std")]
29989    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
29990        r.with_limited_depth(|r| {
29991            let dv: SorobanAuthorizedFunctionType =
29992                <SorobanAuthorizedFunctionType as ReadXdr>::read_xdr(r)?;
29993            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
29994            let v = match dv {
29995                SorobanAuthorizedFunctionType::ContractFn => {
29996                    Self::ContractFn(InvokeContractArgs::read_xdr(r)?)
29997                }
29998                SorobanAuthorizedFunctionType::CreateContractHostFn => {
29999                    Self::CreateContractHostFn(CreateContractArgs::read_xdr(r)?)
30000                }
30001                SorobanAuthorizedFunctionType::CreateContractV2HostFn => {
30002                    Self::CreateContractV2HostFn(CreateContractArgsV2::read_xdr(r)?)
30003                }
30004                #[allow(unreachable_patterns)]
30005                _ => return Err(Error::Invalid),
30006            };
30007            Ok(v)
30008        })
30009    }
30010}
30011
30012impl WriteXdr for SorobanAuthorizedFunction {
30013    #[cfg(feature = "std")]
30014    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
30015        w.with_limited_depth(|w| {
30016            self.discriminant().write_xdr(w)?;
30017            #[allow(clippy::match_same_arms)]
30018            match self {
30019                Self::ContractFn(v) => v.write_xdr(w)?,
30020                Self::CreateContractHostFn(v) => v.write_xdr(w)?,
30021                Self::CreateContractV2HostFn(v) => v.write_xdr(w)?,
30022            };
30023            Ok(())
30024        })
30025    }
30026}
30027
30028/// SorobanAuthorizedInvocation is an XDR Struct defines as:
30029///
30030/// ```text
30031/// struct SorobanAuthorizedInvocation
30032/// {
30033///     SorobanAuthorizedFunction function;
30034///     SorobanAuthorizedInvocation subInvocations<>;
30035/// };
30036/// ```
30037///
30038#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
30039#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
30040#[cfg_attr(
30041    all(feature = "serde", feature = "alloc"),
30042    derive(serde::Serialize, serde::Deserialize),
30043    serde(rename_all = "snake_case")
30044)]
30045#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
30046pub struct SorobanAuthorizedInvocation {
30047    pub function: SorobanAuthorizedFunction,
30048    pub sub_invocations: VecM<SorobanAuthorizedInvocation>,
30049}
30050
30051impl ReadXdr for SorobanAuthorizedInvocation {
30052    #[cfg(feature = "std")]
30053    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
30054        r.with_limited_depth(|r| {
30055            Ok(Self {
30056                function: SorobanAuthorizedFunction::read_xdr(r)?,
30057                sub_invocations: VecM::<SorobanAuthorizedInvocation>::read_xdr(r)?,
30058            })
30059        })
30060    }
30061}
30062
30063impl WriteXdr for SorobanAuthorizedInvocation {
30064    #[cfg(feature = "std")]
30065    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
30066        w.with_limited_depth(|w| {
30067            self.function.write_xdr(w)?;
30068            self.sub_invocations.write_xdr(w)?;
30069            Ok(())
30070        })
30071    }
30072}
30073
30074/// SorobanAddressCredentials is an XDR Struct defines as:
30075///
30076/// ```text
30077/// struct SorobanAddressCredentials
30078/// {
30079///     SCAddress address;
30080///     int64 nonce;
30081///     uint32 signatureExpirationLedger;    
30082///     SCVal signature;
30083/// };
30084/// ```
30085///
30086#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
30087#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
30088#[cfg_attr(
30089    all(feature = "serde", feature = "alloc"),
30090    derive(serde::Serialize, serde::Deserialize),
30091    serde(rename_all = "snake_case")
30092)]
30093#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
30094pub struct SorobanAddressCredentials {
30095    pub address: ScAddress,
30096    pub nonce: i64,
30097    pub signature_expiration_ledger: u32,
30098    pub signature: ScVal,
30099}
30100
30101impl ReadXdr for SorobanAddressCredentials {
30102    #[cfg(feature = "std")]
30103    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
30104        r.with_limited_depth(|r| {
30105            Ok(Self {
30106                address: ScAddress::read_xdr(r)?,
30107                nonce: i64::read_xdr(r)?,
30108                signature_expiration_ledger: u32::read_xdr(r)?,
30109                signature: ScVal::read_xdr(r)?,
30110            })
30111        })
30112    }
30113}
30114
30115impl WriteXdr for SorobanAddressCredentials {
30116    #[cfg(feature = "std")]
30117    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
30118        w.with_limited_depth(|w| {
30119            self.address.write_xdr(w)?;
30120            self.nonce.write_xdr(w)?;
30121            self.signature_expiration_ledger.write_xdr(w)?;
30122            self.signature.write_xdr(w)?;
30123            Ok(())
30124        })
30125    }
30126}
30127
30128/// SorobanCredentialsType is an XDR Enum defines as:
30129///
30130/// ```text
30131/// enum SorobanCredentialsType
30132/// {
30133///     SOROBAN_CREDENTIALS_SOURCE_ACCOUNT = 0,
30134///     SOROBAN_CREDENTIALS_ADDRESS = 1
30135/// };
30136/// ```
30137///
30138// enum
30139#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
30140#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
30141#[cfg_attr(
30142    all(feature = "serde", feature = "alloc"),
30143    derive(serde::Serialize, serde::Deserialize),
30144    serde(rename_all = "snake_case")
30145)]
30146#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
30147#[repr(i32)]
30148pub enum SorobanCredentialsType {
30149    SourceAccount = 0,
30150    Address = 1,
30151}
30152
30153impl SorobanCredentialsType {
30154    pub const VARIANTS: [SorobanCredentialsType; 2] = [
30155        SorobanCredentialsType::SourceAccount,
30156        SorobanCredentialsType::Address,
30157    ];
30158    pub const VARIANTS_STR: [&'static str; 2] = ["SourceAccount", "Address"];
30159
30160    #[must_use]
30161    pub const fn name(&self) -> &'static str {
30162        match self {
30163            Self::SourceAccount => "SourceAccount",
30164            Self::Address => "Address",
30165        }
30166    }
30167
30168    #[must_use]
30169    pub const fn variants() -> [SorobanCredentialsType; 2] {
30170        Self::VARIANTS
30171    }
30172}
30173
30174impl Name for SorobanCredentialsType {
30175    #[must_use]
30176    fn name(&self) -> &'static str {
30177        Self::name(self)
30178    }
30179}
30180
30181impl Variants<SorobanCredentialsType> for SorobanCredentialsType {
30182    fn variants() -> slice::Iter<'static, SorobanCredentialsType> {
30183        Self::VARIANTS.iter()
30184    }
30185}
30186
30187impl Enum for SorobanCredentialsType {}
30188
30189impl fmt::Display for SorobanCredentialsType {
30190    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
30191        f.write_str(self.name())
30192    }
30193}
30194
30195impl TryFrom<i32> for SorobanCredentialsType {
30196    type Error = Error;
30197
30198    fn try_from(i: i32) -> Result<Self> {
30199        let e = match i {
30200            0 => SorobanCredentialsType::SourceAccount,
30201            1 => SorobanCredentialsType::Address,
30202            #[allow(unreachable_patterns)]
30203            _ => return Err(Error::Invalid),
30204        };
30205        Ok(e)
30206    }
30207}
30208
30209impl From<SorobanCredentialsType> for i32 {
30210    #[must_use]
30211    fn from(e: SorobanCredentialsType) -> Self {
30212        e as Self
30213    }
30214}
30215
30216impl ReadXdr for SorobanCredentialsType {
30217    #[cfg(feature = "std")]
30218    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
30219        r.with_limited_depth(|r| {
30220            let e = i32::read_xdr(r)?;
30221            let v: Self = e.try_into()?;
30222            Ok(v)
30223        })
30224    }
30225}
30226
30227impl WriteXdr for SorobanCredentialsType {
30228    #[cfg(feature = "std")]
30229    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
30230        w.with_limited_depth(|w| {
30231            let i: i32 = (*self).into();
30232            i.write_xdr(w)
30233        })
30234    }
30235}
30236
30237/// SorobanCredentials is an XDR Union defines as:
30238///
30239/// ```text
30240/// union SorobanCredentials switch (SorobanCredentialsType type)
30241/// {
30242/// case SOROBAN_CREDENTIALS_SOURCE_ACCOUNT:
30243///     void;
30244/// case SOROBAN_CREDENTIALS_ADDRESS:
30245///     SorobanAddressCredentials address;
30246/// };
30247/// ```
30248///
30249// union with discriminant SorobanCredentialsType
30250#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
30251#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
30252#[cfg_attr(
30253    all(feature = "serde", feature = "alloc"),
30254    derive(serde::Serialize, serde::Deserialize),
30255    serde(rename_all = "snake_case")
30256)]
30257#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
30258#[allow(clippy::large_enum_variant)]
30259pub enum SorobanCredentials {
30260    SourceAccount,
30261    Address(SorobanAddressCredentials),
30262}
30263
30264impl SorobanCredentials {
30265    pub const VARIANTS: [SorobanCredentialsType; 2] = [
30266        SorobanCredentialsType::SourceAccount,
30267        SorobanCredentialsType::Address,
30268    ];
30269    pub const VARIANTS_STR: [&'static str; 2] = ["SourceAccount", "Address"];
30270
30271    #[must_use]
30272    pub const fn name(&self) -> &'static str {
30273        match self {
30274            Self::SourceAccount => "SourceAccount",
30275            Self::Address(_) => "Address",
30276        }
30277    }
30278
30279    #[must_use]
30280    pub const fn discriminant(&self) -> SorobanCredentialsType {
30281        #[allow(clippy::match_same_arms)]
30282        match self {
30283            Self::SourceAccount => SorobanCredentialsType::SourceAccount,
30284            Self::Address(_) => SorobanCredentialsType::Address,
30285        }
30286    }
30287
30288    #[must_use]
30289    pub const fn variants() -> [SorobanCredentialsType; 2] {
30290        Self::VARIANTS
30291    }
30292}
30293
30294impl Name for SorobanCredentials {
30295    #[must_use]
30296    fn name(&self) -> &'static str {
30297        Self::name(self)
30298    }
30299}
30300
30301impl Discriminant<SorobanCredentialsType> for SorobanCredentials {
30302    #[must_use]
30303    fn discriminant(&self) -> SorobanCredentialsType {
30304        Self::discriminant(self)
30305    }
30306}
30307
30308impl Variants<SorobanCredentialsType> for SorobanCredentials {
30309    fn variants() -> slice::Iter<'static, SorobanCredentialsType> {
30310        Self::VARIANTS.iter()
30311    }
30312}
30313
30314impl Union<SorobanCredentialsType> for SorobanCredentials {}
30315
30316impl ReadXdr for SorobanCredentials {
30317    #[cfg(feature = "std")]
30318    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
30319        r.with_limited_depth(|r| {
30320            let dv: SorobanCredentialsType = <SorobanCredentialsType as ReadXdr>::read_xdr(r)?;
30321            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
30322            let v = match dv {
30323                SorobanCredentialsType::SourceAccount => Self::SourceAccount,
30324                SorobanCredentialsType::Address => {
30325                    Self::Address(SorobanAddressCredentials::read_xdr(r)?)
30326                }
30327                #[allow(unreachable_patterns)]
30328                _ => return Err(Error::Invalid),
30329            };
30330            Ok(v)
30331        })
30332    }
30333}
30334
30335impl WriteXdr for SorobanCredentials {
30336    #[cfg(feature = "std")]
30337    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
30338        w.with_limited_depth(|w| {
30339            self.discriminant().write_xdr(w)?;
30340            #[allow(clippy::match_same_arms)]
30341            match self {
30342                Self::SourceAccount => ().write_xdr(w)?,
30343                Self::Address(v) => v.write_xdr(w)?,
30344            };
30345            Ok(())
30346        })
30347    }
30348}
30349
30350/// SorobanAuthorizationEntry is an XDR Struct defines as:
30351///
30352/// ```text
30353/// struct SorobanAuthorizationEntry
30354/// {
30355///     SorobanCredentials credentials;
30356///     SorobanAuthorizedInvocation rootInvocation;
30357/// };
30358/// ```
30359///
30360#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
30361#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
30362#[cfg_attr(
30363    all(feature = "serde", feature = "alloc"),
30364    derive(serde::Serialize, serde::Deserialize),
30365    serde(rename_all = "snake_case")
30366)]
30367#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
30368pub struct SorobanAuthorizationEntry {
30369    pub credentials: SorobanCredentials,
30370    pub root_invocation: SorobanAuthorizedInvocation,
30371}
30372
30373impl ReadXdr for SorobanAuthorizationEntry {
30374    #[cfg(feature = "std")]
30375    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
30376        r.with_limited_depth(|r| {
30377            Ok(Self {
30378                credentials: SorobanCredentials::read_xdr(r)?,
30379                root_invocation: SorobanAuthorizedInvocation::read_xdr(r)?,
30380            })
30381        })
30382    }
30383}
30384
30385impl WriteXdr for SorobanAuthorizationEntry {
30386    #[cfg(feature = "std")]
30387    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
30388        w.with_limited_depth(|w| {
30389            self.credentials.write_xdr(w)?;
30390            self.root_invocation.write_xdr(w)?;
30391            Ok(())
30392        })
30393    }
30394}
30395
30396/// InvokeHostFunctionOp is an XDR Struct defines as:
30397///
30398/// ```text
30399/// struct InvokeHostFunctionOp
30400/// {
30401///     // Host function to invoke.
30402///     HostFunction hostFunction;
30403///     // Per-address authorizations for this host function.
30404///     SorobanAuthorizationEntry auth<>;
30405/// };
30406/// ```
30407///
30408#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
30409#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
30410#[cfg_attr(
30411    all(feature = "serde", feature = "alloc"),
30412    derive(serde::Serialize, serde::Deserialize),
30413    serde(rename_all = "snake_case")
30414)]
30415#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
30416pub struct InvokeHostFunctionOp {
30417    pub host_function: HostFunction,
30418    pub auth: VecM<SorobanAuthorizationEntry>,
30419}
30420
30421impl ReadXdr for InvokeHostFunctionOp {
30422    #[cfg(feature = "std")]
30423    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
30424        r.with_limited_depth(|r| {
30425            Ok(Self {
30426                host_function: HostFunction::read_xdr(r)?,
30427                auth: VecM::<SorobanAuthorizationEntry>::read_xdr(r)?,
30428            })
30429        })
30430    }
30431}
30432
30433impl WriteXdr for InvokeHostFunctionOp {
30434    #[cfg(feature = "std")]
30435    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
30436        w.with_limited_depth(|w| {
30437            self.host_function.write_xdr(w)?;
30438            self.auth.write_xdr(w)?;
30439            Ok(())
30440        })
30441    }
30442}
30443
30444/// ExtendFootprintTtlOp is an XDR Struct defines as:
30445///
30446/// ```text
30447/// struct ExtendFootprintTTLOp
30448/// {
30449///     ExtensionPoint ext;
30450///     uint32 extendTo;
30451/// };
30452/// ```
30453///
30454#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
30455#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
30456#[cfg_attr(
30457    all(feature = "serde", feature = "alloc"),
30458    derive(serde::Serialize, serde::Deserialize),
30459    serde(rename_all = "snake_case")
30460)]
30461#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
30462pub struct ExtendFootprintTtlOp {
30463    pub ext: ExtensionPoint,
30464    pub extend_to: u32,
30465}
30466
30467impl ReadXdr for ExtendFootprintTtlOp {
30468    #[cfg(feature = "std")]
30469    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
30470        r.with_limited_depth(|r| {
30471            Ok(Self {
30472                ext: ExtensionPoint::read_xdr(r)?,
30473                extend_to: u32::read_xdr(r)?,
30474            })
30475        })
30476    }
30477}
30478
30479impl WriteXdr for ExtendFootprintTtlOp {
30480    #[cfg(feature = "std")]
30481    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
30482        w.with_limited_depth(|w| {
30483            self.ext.write_xdr(w)?;
30484            self.extend_to.write_xdr(w)?;
30485            Ok(())
30486        })
30487    }
30488}
30489
30490/// RestoreFootprintOp is an XDR Struct defines as:
30491///
30492/// ```text
30493/// struct RestoreFootprintOp
30494/// {
30495///     ExtensionPoint ext;
30496/// };
30497/// ```
30498///
30499#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
30500#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
30501#[cfg_attr(
30502    all(feature = "serde", feature = "alloc"),
30503    derive(serde::Serialize, serde::Deserialize),
30504    serde(rename_all = "snake_case")
30505)]
30506#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
30507pub struct RestoreFootprintOp {
30508    pub ext: ExtensionPoint,
30509}
30510
30511impl ReadXdr for RestoreFootprintOp {
30512    #[cfg(feature = "std")]
30513    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
30514        r.with_limited_depth(|r| {
30515            Ok(Self {
30516                ext: ExtensionPoint::read_xdr(r)?,
30517            })
30518        })
30519    }
30520}
30521
30522impl WriteXdr for RestoreFootprintOp {
30523    #[cfg(feature = "std")]
30524    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
30525        w.with_limited_depth(|w| {
30526            self.ext.write_xdr(w)?;
30527            Ok(())
30528        })
30529    }
30530}
30531
30532/// OperationBody is an XDR NestedUnion defines as:
30533///
30534/// ```text
30535/// union switch (OperationType type)
30536///     {
30537///     case CREATE_ACCOUNT:
30538///         CreateAccountOp createAccountOp;
30539///     case PAYMENT:
30540///         PaymentOp paymentOp;
30541///     case PATH_PAYMENT_STRICT_RECEIVE:
30542///         PathPaymentStrictReceiveOp pathPaymentStrictReceiveOp;
30543///     case MANAGE_SELL_OFFER:
30544///         ManageSellOfferOp manageSellOfferOp;
30545///     case CREATE_PASSIVE_SELL_OFFER:
30546///         CreatePassiveSellOfferOp createPassiveSellOfferOp;
30547///     case SET_OPTIONS:
30548///         SetOptionsOp setOptionsOp;
30549///     case CHANGE_TRUST:
30550///         ChangeTrustOp changeTrustOp;
30551///     case ALLOW_TRUST:
30552///         AllowTrustOp allowTrustOp;
30553///     case ACCOUNT_MERGE:
30554///         MuxedAccount destination;
30555///     case INFLATION:
30556///         void;
30557///     case MANAGE_DATA:
30558///         ManageDataOp manageDataOp;
30559///     case BUMP_SEQUENCE:
30560///         BumpSequenceOp bumpSequenceOp;
30561///     case MANAGE_BUY_OFFER:
30562///         ManageBuyOfferOp manageBuyOfferOp;
30563///     case PATH_PAYMENT_STRICT_SEND:
30564///         PathPaymentStrictSendOp pathPaymentStrictSendOp;
30565///     case CREATE_CLAIMABLE_BALANCE:
30566///         CreateClaimableBalanceOp createClaimableBalanceOp;
30567///     case CLAIM_CLAIMABLE_BALANCE:
30568///         ClaimClaimableBalanceOp claimClaimableBalanceOp;
30569///     case BEGIN_SPONSORING_FUTURE_RESERVES:
30570///         BeginSponsoringFutureReservesOp beginSponsoringFutureReservesOp;
30571///     case END_SPONSORING_FUTURE_RESERVES:
30572///         void;
30573///     case REVOKE_SPONSORSHIP:
30574///         RevokeSponsorshipOp revokeSponsorshipOp;
30575///     case CLAWBACK:
30576///         ClawbackOp clawbackOp;
30577///     case CLAWBACK_CLAIMABLE_BALANCE:
30578///         ClawbackClaimableBalanceOp clawbackClaimableBalanceOp;
30579///     case SET_TRUST_LINE_FLAGS:
30580///         SetTrustLineFlagsOp setTrustLineFlagsOp;
30581///     case LIQUIDITY_POOL_DEPOSIT:
30582///         LiquidityPoolDepositOp liquidityPoolDepositOp;
30583///     case LIQUIDITY_POOL_WITHDRAW:
30584///         LiquidityPoolWithdrawOp liquidityPoolWithdrawOp;
30585///     case INVOKE_HOST_FUNCTION:
30586///         InvokeHostFunctionOp invokeHostFunctionOp;
30587///     case EXTEND_FOOTPRINT_TTL:
30588///         ExtendFootprintTTLOp extendFootprintTTLOp;
30589///     case RESTORE_FOOTPRINT:
30590///         RestoreFootprintOp restoreFootprintOp;
30591///     }
30592/// ```
30593///
30594// union with discriminant OperationType
30595#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
30596#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
30597#[cfg_attr(
30598    all(feature = "serde", feature = "alloc"),
30599    derive(serde::Serialize, serde::Deserialize),
30600    serde(rename_all = "snake_case")
30601)]
30602#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
30603#[allow(clippy::large_enum_variant)]
30604pub enum OperationBody {
30605    CreateAccount(CreateAccountOp),
30606    Payment(PaymentOp),
30607    PathPaymentStrictReceive(PathPaymentStrictReceiveOp),
30608    ManageSellOffer(ManageSellOfferOp),
30609    CreatePassiveSellOffer(CreatePassiveSellOfferOp),
30610    SetOptions(SetOptionsOp),
30611    ChangeTrust(ChangeTrustOp),
30612    AllowTrust(AllowTrustOp),
30613    AccountMerge(MuxedAccount),
30614    Inflation,
30615    ManageData(ManageDataOp),
30616    BumpSequence(BumpSequenceOp),
30617    ManageBuyOffer(ManageBuyOfferOp),
30618    PathPaymentStrictSend(PathPaymentStrictSendOp),
30619    CreateClaimableBalance(CreateClaimableBalanceOp),
30620    ClaimClaimableBalance(ClaimClaimableBalanceOp),
30621    BeginSponsoringFutureReserves(BeginSponsoringFutureReservesOp),
30622    EndSponsoringFutureReserves,
30623    RevokeSponsorship(RevokeSponsorshipOp),
30624    Clawback(ClawbackOp),
30625    ClawbackClaimableBalance(ClawbackClaimableBalanceOp),
30626    SetTrustLineFlags(SetTrustLineFlagsOp),
30627    LiquidityPoolDeposit(LiquidityPoolDepositOp),
30628    LiquidityPoolWithdraw(LiquidityPoolWithdrawOp),
30629    InvokeHostFunction(InvokeHostFunctionOp),
30630    ExtendFootprintTtl(ExtendFootprintTtlOp),
30631    RestoreFootprint(RestoreFootprintOp),
30632}
30633
30634impl OperationBody {
30635    pub const VARIANTS: [OperationType; 27] = [
30636        OperationType::CreateAccount,
30637        OperationType::Payment,
30638        OperationType::PathPaymentStrictReceive,
30639        OperationType::ManageSellOffer,
30640        OperationType::CreatePassiveSellOffer,
30641        OperationType::SetOptions,
30642        OperationType::ChangeTrust,
30643        OperationType::AllowTrust,
30644        OperationType::AccountMerge,
30645        OperationType::Inflation,
30646        OperationType::ManageData,
30647        OperationType::BumpSequence,
30648        OperationType::ManageBuyOffer,
30649        OperationType::PathPaymentStrictSend,
30650        OperationType::CreateClaimableBalance,
30651        OperationType::ClaimClaimableBalance,
30652        OperationType::BeginSponsoringFutureReserves,
30653        OperationType::EndSponsoringFutureReserves,
30654        OperationType::RevokeSponsorship,
30655        OperationType::Clawback,
30656        OperationType::ClawbackClaimableBalance,
30657        OperationType::SetTrustLineFlags,
30658        OperationType::LiquidityPoolDeposit,
30659        OperationType::LiquidityPoolWithdraw,
30660        OperationType::InvokeHostFunction,
30661        OperationType::ExtendFootprintTtl,
30662        OperationType::RestoreFootprint,
30663    ];
30664    pub const VARIANTS_STR: [&'static str; 27] = [
30665        "CreateAccount",
30666        "Payment",
30667        "PathPaymentStrictReceive",
30668        "ManageSellOffer",
30669        "CreatePassiveSellOffer",
30670        "SetOptions",
30671        "ChangeTrust",
30672        "AllowTrust",
30673        "AccountMerge",
30674        "Inflation",
30675        "ManageData",
30676        "BumpSequence",
30677        "ManageBuyOffer",
30678        "PathPaymentStrictSend",
30679        "CreateClaimableBalance",
30680        "ClaimClaimableBalance",
30681        "BeginSponsoringFutureReserves",
30682        "EndSponsoringFutureReserves",
30683        "RevokeSponsorship",
30684        "Clawback",
30685        "ClawbackClaimableBalance",
30686        "SetTrustLineFlags",
30687        "LiquidityPoolDeposit",
30688        "LiquidityPoolWithdraw",
30689        "InvokeHostFunction",
30690        "ExtendFootprintTtl",
30691        "RestoreFootprint",
30692    ];
30693
30694    #[must_use]
30695    pub const fn name(&self) -> &'static str {
30696        match self {
30697            Self::CreateAccount(_) => "CreateAccount",
30698            Self::Payment(_) => "Payment",
30699            Self::PathPaymentStrictReceive(_) => "PathPaymentStrictReceive",
30700            Self::ManageSellOffer(_) => "ManageSellOffer",
30701            Self::CreatePassiveSellOffer(_) => "CreatePassiveSellOffer",
30702            Self::SetOptions(_) => "SetOptions",
30703            Self::ChangeTrust(_) => "ChangeTrust",
30704            Self::AllowTrust(_) => "AllowTrust",
30705            Self::AccountMerge(_) => "AccountMerge",
30706            Self::Inflation => "Inflation",
30707            Self::ManageData(_) => "ManageData",
30708            Self::BumpSequence(_) => "BumpSequence",
30709            Self::ManageBuyOffer(_) => "ManageBuyOffer",
30710            Self::PathPaymentStrictSend(_) => "PathPaymentStrictSend",
30711            Self::CreateClaimableBalance(_) => "CreateClaimableBalance",
30712            Self::ClaimClaimableBalance(_) => "ClaimClaimableBalance",
30713            Self::BeginSponsoringFutureReserves(_) => "BeginSponsoringFutureReserves",
30714            Self::EndSponsoringFutureReserves => "EndSponsoringFutureReserves",
30715            Self::RevokeSponsorship(_) => "RevokeSponsorship",
30716            Self::Clawback(_) => "Clawback",
30717            Self::ClawbackClaimableBalance(_) => "ClawbackClaimableBalance",
30718            Self::SetTrustLineFlags(_) => "SetTrustLineFlags",
30719            Self::LiquidityPoolDeposit(_) => "LiquidityPoolDeposit",
30720            Self::LiquidityPoolWithdraw(_) => "LiquidityPoolWithdraw",
30721            Self::InvokeHostFunction(_) => "InvokeHostFunction",
30722            Self::ExtendFootprintTtl(_) => "ExtendFootprintTtl",
30723            Self::RestoreFootprint(_) => "RestoreFootprint",
30724        }
30725    }
30726
30727    #[must_use]
30728    pub const fn discriminant(&self) -> OperationType {
30729        #[allow(clippy::match_same_arms)]
30730        match self {
30731            Self::CreateAccount(_) => OperationType::CreateAccount,
30732            Self::Payment(_) => OperationType::Payment,
30733            Self::PathPaymentStrictReceive(_) => OperationType::PathPaymentStrictReceive,
30734            Self::ManageSellOffer(_) => OperationType::ManageSellOffer,
30735            Self::CreatePassiveSellOffer(_) => OperationType::CreatePassiveSellOffer,
30736            Self::SetOptions(_) => OperationType::SetOptions,
30737            Self::ChangeTrust(_) => OperationType::ChangeTrust,
30738            Self::AllowTrust(_) => OperationType::AllowTrust,
30739            Self::AccountMerge(_) => OperationType::AccountMerge,
30740            Self::Inflation => OperationType::Inflation,
30741            Self::ManageData(_) => OperationType::ManageData,
30742            Self::BumpSequence(_) => OperationType::BumpSequence,
30743            Self::ManageBuyOffer(_) => OperationType::ManageBuyOffer,
30744            Self::PathPaymentStrictSend(_) => OperationType::PathPaymentStrictSend,
30745            Self::CreateClaimableBalance(_) => OperationType::CreateClaimableBalance,
30746            Self::ClaimClaimableBalance(_) => OperationType::ClaimClaimableBalance,
30747            Self::BeginSponsoringFutureReserves(_) => OperationType::BeginSponsoringFutureReserves,
30748            Self::EndSponsoringFutureReserves => OperationType::EndSponsoringFutureReserves,
30749            Self::RevokeSponsorship(_) => OperationType::RevokeSponsorship,
30750            Self::Clawback(_) => OperationType::Clawback,
30751            Self::ClawbackClaimableBalance(_) => OperationType::ClawbackClaimableBalance,
30752            Self::SetTrustLineFlags(_) => OperationType::SetTrustLineFlags,
30753            Self::LiquidityPoolDeposit(_) => OperationType::LiquidityPoolDeposit,
30754            Self::LiquidityPoolWithdraw(_) => OperationType::LiquidityPoolWithdraw,
30755            Self::InvokeHostFunction(_) => OperationType::InvokeHostFunction,
30756            Self::ExtendFootprintTtl(_) => OperationType::ExtendFootprintTtl,
30757            Self::RestoreFootprint(_) => OperationType::RestoreFootprint,
30758        }
30759    }
30760
30761    #[must_use]
30762    pub const fn variants() -> [OperationType; 27] {
30763        Self::VARIANTS
30764    }
30765}
30766
30767impl Name for OperationBody {
30768    #[must_use]
30769    fn name(&self) -> &'static str {
30770        Self::name(self)
30771    }
30772}
30773
30774impl Discriminant<OperationType> for OperationBody {
30775    #[must_use]
30776    fn discriminant(&self) -> OperationType {
30777        Self::discriminant(self)
30778    }
30779}
30780
30781impl Variants<OperationType> for OperationBody {
30782    fn variants() -> slice::Iter<'static, OperationType> {
30783        Self::VARIANTS.iter()
30784    }
30785}
30786
30787impl Union<OperationType> for OperationBody {}
30788
30789impl ReadXdr for OperationBody {
30790    #[cfg(feature = "std")]
30791    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
30792        r.with_limited_depth(|r| {
30793            let dv: OperationType = <OperationType as ReadXdr>::read_xdr(r)?;
30794            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
30795            let v = match dv {
30796                OperationType::CreateAccount => Self::CreateAccount(CreateAccountOp::read_xdr(r)?),
30797                OperationType::Payment => Self::Payment(PaymentOp::read_xdr(r)?),
30798                OperationType::PathPaymentStrictReceive => {
30799                    Self::PathPaymentStrictReceive(PathPaymentStrictReceiveOp::read_xdr(r)?)
30800                }
30801                OperationType::ManageSellOffer => {
30802                    Self::ManageSellOffer(ManageSellOfferOp::read_xdr(r)?)
30803                }
30804                OperationType::CreatePassiveSellOffer => {
30805                    Self::CreatePassiveSellOffer(CreatePassiveSellOfferOp::read_xdr(r)?)
30806                }
30807                OperationType::SetOptions => Self::SetOptions(SetOptionsOp::read_xdr(r)?),
30808                OperationType::ChangeTrust => Self::ChangeTrust(ChangeTrustOp::read_xdr(r)?),
30809                OperationType::AllowTrust => Self::AllowTrust(AllowTrustOp::read_xdr(r)?),
30810                OperationType::AccountMerge => Self::AccountMerge(MuxedAccount::read_xdr(r)?),
30811                OperationType::Inflation => Self::Inflation,
30812                OperationType::ManageData => Self::ManageData(ManageDataOp::read_xdr(r)?),
30813                OperationType::BumpSequence => Self::BumpSequence(BumpSequenceOp::read_xdr(r)?),
30814                OperationType::ManageBuyOffer => {
30815                    Self::ManageBuyOffer(ManageBuyOfferOp::read_xdr(r)?)
30816                }
30817                OperationType::PathPaymentStrictSend => {
30818                    Self::PathPaymentStrictSend(PathPaymentStrictSendOp::read_xdr(r)?)
30819                }
30820                OperationType::CreateClaimableBalance => {
30821                    Self::CreateClaimableBalance(CreateClaimableBalanceOp::read_xdr(r)?)
30822                }
30823                OperationType::ClaimClaimableBalance => {
30824                    Self::ClaimClaimableBalance(ClaimClaimableBalanceOp::read_xdr(r)?)
30825                }
30826                OperationType::BeginSponsoringFutureReserves => {
30827                    Self::BeginSponsoringFutureReserves(BeginSponsoringFutureReservesOp::read_xdr(
30828                        r,
30829                    )?)
30830                }
30831                OperationType::EndSponsoringFutureReserves => Self::EndSponsoringFutureReserves,
30832                OperationType::RevokeSponsorship => {
30833                    Self::RevokeSponsorship(RevokeSponsorshipOp::read_xdr(r)?)
30834                }
30835                OperationType::Clawback => Self::Clawback(ClawbackOp::read_xdr(r)?),
30836                OperationType::ClawbackClaimableBalance => {
30837                    Self::ClawbackClaimableBalance(ClawbackClaimableBalanceOp::read_xdr(r)?)
30838                }
30839                OperationType::SetTrustLineFlags => {
30840                    Self::SetTrustLineFlags(SetTrustLineFlagsOp::read_xdr(r)?)
30841                }
30842                OperationType::LiquidityPoolDeposit => {
30843                    Self::LiquidityPoolDeposit(LiquidityPoolDepositOp::read_xdr(r)?)
30844                }
30845                OperationType::LiquidityPoolWithdraw => {
30846                    Self::LiquidityPoolWithdraw(LiquidityPoolWithdrawOp::read_xdr(r)?)
30847                }
30848                OperationType::InvokeHostFunction => {
30849                    Self::InvokeHostFunction(InvokeHostFunctionOp::read_xdr(r)?)
30850                }
30851                OperationType::ExtendFootprintTtl => {
30852                    Self::ExtendFootprintTtl(ExtendFootprintTtlOp::read_xdr(r)?)
30853                }
30854                OperationType::RestoreFootprint => {
30855                    Self::RestoreFootprint(RestoreFootprintOp::read_xdr(r)?)
30856                }
30857                #[allow(unreachable_patterns)]
30858                _ => return Err(Error::Invalid),
30859            };
30860            Ok(v)
30861        })
30862    }
30863}
30864
30865impl WriteXdr for OperationBody {
30866    #[cfg(feature = "std")]
30867    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
30868        w.with_limited_depth(|w| {
30869            self.discriminant().write_xdr(w)?;
30870            #[allow(clippy::match_same_arms)]
30871            match self {
30872                Self::CreateAccount(v) => v.write_xdr(w)?,
30873                Self::Payment(v) => v.write_xdr(w)?,
30874                Self::PathPaymentStrictReceive(v) => v.write_xdr(w)?,
30875                Self::ManageSellOffer(v) => v.write_xdr(w)?,
30876                Self::CreatePassiveSellOffer(v) => v.write_xdr(w)?,
30877                Self::SetOptions(v) => v.write_xdr(w)?,
30878                Self::ChangeTrust(v) => v.write_xdr(w)?,
30879                Self::AllowTrust(v) => v.write_xdr(w)?,
30880                Self::AccountMerge(v) => v.write_xdr(w)?,
30881                Self::Inflation => ().write_xdr(w)?,
30882                Self::ManageData(v) => v.write_xdr(w)?,
30883                Self::BumpSequence(v) => v.write_xdr(w)?,
30884                Self::ManageBuyOffer(v) => v.write_xdr(w)?,
30885                Self::PathPaymentStrictSend(v) => v.write_xdr(w)?,
30886                Self::CreateClaimableBalance(v) => v.write_xdr(w)?,
30887                Self::ClaimClaimableBalance(v) => v.write_xdr(w)?,
30888                Self::BeginSponsoringFutureReserves(v) => v.write_xdr(w)?,
30889                Self::EndSponsoringFutureReserves => ().write_xdr(w)?,
30890                Self::RevokeSponsorship(v) => v.write_xdr(w)?,
30891                Self::Clawback(v) => v.write_xdr(w)?,
30892                Self::ClawbackClaimableBalance(v) => v.write_xdr(w)?,
30893                Self::SetTrustLineFlags(v) => v.write_xdr(w)?,
30894                Self::LiquidityPoolDeposit(v) => v.write_xdr(w)?,
30895                Self::LiquidityPoolWithdraw(v) => v.write_xdr(w)?,
30896                Self::InvokeHostFunction(v) => v.write_xdr(w)?,
30897                Self::ExtendFootprintTtl(v) => v.write_xdr(w)?,
30898                Self::RestoreFootprint(v) => v.write_xdr(w)?,
30899            };
30900            Ok(())
30901        })
30902    }
30903}
30904
30905/// Operation is an XDR Struct defines as:
30906///
30907/// ```text
30908/// struct Operation
30909/// {
30910///     // sourceAccount is the account used to run the operation
30911///     // if not set, the runtime defaults to "sourceAccount" specified at
30912///     // the transaction level
30913///     MuxedAccount* sourceAccount;
30914///
30915///     union switch (OperationType type)
30916///     {
30917///     case CREATE_ACCOUNT:
30918///         CreateAccountOp createAccountOp;
30919///     case PAYMENT:
30920///         PaymentOp paymentOp;
30921///     case PATH_PAYMENT_STRICT_RECEIVE:
30922///         PathPaymentStrictReceiveOp pathPaymentStrictReceiveOp;
30923///     case MANAGE_SELL_OFFER:
30924///         ManageSellOfferOp manageSellOfferOp;
30925///     case CREATE_PASSIVE_SELL_OFFER:
30926///         CreatePassiveSellOfferOp createPassiveSellOfferOp;
30927///     case SET_OPTIONS:
30928///         SetOptionsOp setOptionsOp;
30929///     case CHANGE_TRUST:
30930///         ChangeTrustOp changeTrustOp;
30931///     case ALLOW_TRUST:
30932///         AllowTrustOp allowTrustOp;
30933///     case ACCOUNT_MERGE:
30934///         MuxedAccount destination;
30935///     case INFLATION:
30936///         void;
30937///     case MANAGE_DATA:
30938///         ManageDataOp manageDataOp;
30939///     case BUMP_SEQUENCE:
30940///         BumpSequenceOp bumpSequenceOp;
30941///     case MANAGE_BUY_OFFER:
30942///         ManageBuyOfferOp manageBuyOfferOp;
30943///     case PATH_PAYMENT_STRICT_SEND:
30944///         PathPaymentStrictSendOp pathPaymentStrictSendOp;
30945///     case CREATE_CLAIMABLE_BALANCE:
30946///         CreateClaimableBalanceOp createClaimableBalanceOp;
30947///     case CLAIM_CLAIMABLE_BALANCE:
30948///         ClaimClaimableBalanceOp claimClaimableBalanceOp;
30949///     case BEGIN_SPONSORING_FUTURE_RESERVES:
30950///         BeginSponsoringFutureReservesOp beginSponsoringFutureReservesOp;
30951///     case END_SPONSORING_FUTURE_RESERVES:
30952///         void;
30953///     case REVOKE_SPONSORSHIP:
30954///         RevokeSponsorshipOp revokeSponsorshipOp;
30955///     case CLAWBACK:
30956///         ClawbackOp clawbackOp;
30957///     case CLAWBACK_CLAIMABLE_BALANCE:
30958///         ClawbackClaimableBalanceOp clawbackClaimableBalanceOp;
30959///     case SET_TRUST_LINE_FLAGS:
30960///         SetTrustLineFlagsOp setTrustLineFlagsOp;
30961///     case LIQUIDITY_POOL_DEPOSIT:
30962///         LiquidityPoolDepositOp liquidityPoolDepositOp;
30963///     case LIQUIDITY_POOL_WITHDRAW:
30964///         LiquidityPoolWithdrawOp liquidityPoolWithdrawOp;
30965///     case INVOKE_HOST_FUNCTION:
30966///         InvokeHostFunctionOp invokeHostFunctionOp;
30967///     case EXTEND_FOOTPRINT_TTL:
30968///         ExtendFootprintTTLOp extendFootprintTTLOp;
30969///     case RESTORE_FOOTPRINT:
30970///         RestoreFootprintOp restoreFootprintOp;
30971///     }
30972///     body;
30973/// };
30974/// ```
30975///
30976#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
30977#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
30978#[cfg_attr(
30979    all(feature = "serde", feature = "alloc"),
30980    derive(serde::Serialize, serde::Deserialize),
30981    serde(rename_all = "snake_case")
30982)]
30983#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
30984pub struct Operation {
30985    pub source_account: Option<MuxedAccount>,
30986    pub body: OperationBody,
30987}
30988
30989impl ReadXdr for Operation {
30990    #[cfg(feature = "std")]
30991    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
30992        r.with_limited_depth(|r| {
30993            Ok(Self {
30994                source_account: Option::<MuxedAccount>::read_xdr(r)?,
30995                body: OperationBody::read_xdr(r)?,
30996            })
30997        })
30998    }
30999}
31000
31001impl WriteXdr for Operation {
31002    #[cfg(feature = "std")]
31003    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
31004        w.with_limited_depth(|w| {
31005            self.source_account.write_xdr(w)?;
31006            self.body.write_xdr(w)?;
31007            Ok(())
31008        })
31009    }
31010}
31011
31012/// HashIdPreimageOperationId is an XDR NestedStruct defines as:
31013///
31014/// ```text
31015/// struct
31016///     {
31017///         AccountID sourceAccount;
31018///         SequenceNumber seqNum;
31019///         uint32 opNum;
31020///     }
31021/// ```
31022///
31023#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
31024#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
31025#[cfg_attr(
31026    all(feature = "serde", feature = "alloc"),
31027    derive(serde::Serialize, serde::Deserialize),
31028    serde(rename_all = "snake_case")
31029)]
31030#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
31031pub struct HashIdPreimageOperationId {
31032    pub source_account: AccountId,
31033    pub seq_num: SequenceNumber,
31034    pub op_num: u32,
31035}
31036
31037impl ReadXdr for HashIdPreimageOperationId {
31038    #[cfg(feature = "std")]
31039    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
31040        r.with_limited_depth(|r| {
31041            Ok(Self {
31042                source_account: AccountId::read_xdr(r)?,
31043                seq_num: SequenceNumber::read_xdr(r)?,
31044                op_num: u32::read_xdr(r)?,
31045            })
31046        })
31047    }
31048}
31049
31050impl WriteXdr for HashIdPreimageOperationId {
31051    #[cfg(feature = "std")]
31052    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
31053        w.with_limited_depth(|w| {
31054            self.source_account.write_xdr(w)?;
31055            self.seq_num.write_xdr(w)?;
31056            self.op_num.write_xdr(w)?;
31057            Ok(())
31058        })
31059    }
31060}
31061
31062/// HashIdPreimageRevokeId is an XDR NestedStruct defines as:
31063///
31064/// ```text
31065/// struct
31066///     {
31067///         AccountID sourceAccount;
31068///         SequenceNumber seqNum;
31069///         uint32 opNum;
31070///         PoolID liquidityPoolID;
31071///         Asset asset;
31072///     }
31073/// ```
31074///
31075#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
31076#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
31077#[cfg_attr(
31078    all(feature = "serde", feature = "alloc"),
31079    derive(serde::Serialize, serde::Deserialize),
31080    serde(rename_all = "snake_case")
31081)]
31082#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
31083pub struct HashIdPreimageRevokeId {
31084    pub source_account: AccountId,
31085    pub seq_num: SequenceNumber,
31086    pub op_num: u32,
31087    pub liquidity_pool_id: PoolId,
31088    pub asset: Asset,
31089}
31090
31091impl ReadXdr for HashIdPreimageRevokeId {
31092    #[cfg(feature = "std")]
31093    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
31094        r.with_limited_depth(|r| {
31095            Ok(Self {
31096                source_account: AccountId::read_xdr(r)?,
31097                seq_num: SequenceNumber::read_xdr(r)?,
31098                op_num: u32::read_xdr(r)?,
31099                liquidity_pool_id: PoolId::read_xdr(r)?,
31100                asset: Asset::read_xdr(r)?,
31101            })
31102        })
31103    }
31104}
31105
31106impl WriteXdr for HashIdPreimageRevokeId {
31107    #[cfg(feature = "std")]
31108    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
31109        w.with_limited_depth(|w| {
31110            self.source_account.write_xdr(w)?;
31111            self.seq_num.write_xdr(w)?;
31112            self.op_num.write_xdr(w)?;
31113            self.liquidity_pool_id.write_xdr(w)?;
31114            self.asset.write_xdr(w)?;
31115            Ok(())
31116        })
31117    }
31118}
31119
31120/// HashIdPreimageContractId is an XDR NestedStruct defines as:
31121///
31122/// ```text
31123/// struct
31124///     {
31125///         Hash networkID;
31126///         ContractIDPreimage contractIDPreimage;
31127///     }
31128/// ```
31129///
31130#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
31131#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
31132#[cfg_attr(
31133    all(feature = "serde", feature = "alloc"),
31134    derive(serde::Serialize, serde::Deserialize),
31135    serde(rename_all = "snake_case")
31136)]
31137#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
31138pub struct HashIdPreimageContractId {
31139    pub network_id: Hash,
31140    pub contract_id_preimage: ContractIdPreimage,
31141}
31142
31143impl ReadXdr for HashIdPreimageContractId {
31144    #[cfg(feature = "std")]
31145    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
31146        r.with_limited_depth(|r| {
31147            Ok(Self {
31148                network_id: Hash::read_xdr(r)?,
31149                contract_id_preimage: ContractIdPreimage::read_xdr(r)?,
31150            })
31151        })
31152    }
31153}
31154
31155impl WriteXdr for HashIdPreimageContractId {
31156    #[cfg(feature = "std")]
31157    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
31158        w.with_limited_depth(|w| {
31159            self.network_id.write_xdr(w)?;
31160            self.contract_id_preimage.write_xdr(w)?;
31161            Ok(())
31162        })
31163    }
31164}
31165
31166/// HashIdPreimageSorobanAuthorization is an XDR NestedStruct defines as:
31167///
31168/// ```text
31169/// struct
31170///     {
31171///         Hash networkID;
31172///         int64 nonce;
31173///         uint32 signatureExpirationLedger;
31174///         SorobanAuthorizedInvocation invocation;
31175///     }
31176/// ```
31177///
31178#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
31179#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
31180#[cfg_attr(
31181    all(feature = "serde", feature = "alloc"),
31182    derive(serde::Serialize, serde::Deserialize),
31183    serde(rename_all = "snake_case")
31184)]
31185#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
31186pub struct HashIdPreimageSorobanAuthorization {
31187    pub network_id: Hash,
31188    pub nonce: i64,
31189    pub signature_expiration_ledger: u32,
31190    pub invocation: SorobanAuthorizedInvocation,
31191}
31192
31193impl ReadXdr for HashIdPreimageSorobanAuthorization {
31194    #[cfg(feature = "std")]
31195    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
31196        r.with_limited_depth(|r| {
31197            Ok(Self {
31198                network_id: Hash::read_xdr(r)?,
31199                nonce: i64::read_xdr(r)?,
31200                signature_expiration_ledger: u32::read_xdr(r)?,
31201                invocation: SorobanAuthorizedInvocation::read_xdr(r)?,
31202            })
31203        })
31204    }
31205}
31206
31207impl WriteXdr for HashIdPreimageSorobanAuthorization {
31208    #[cfg(feature = "std")]
31209    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
31210        w.with_limited_depth(|w| {
31211            self.network_id.write_xdr(w)?;
31212            self.nonce.write_xdr(w)?;
31213            self.signature_expiration_ledger.write_xdr(w)?;
31214            self.invocation.write_xdr(w)?;
31215            Ok(())
31216        })
31217    }
31218}
31219
31220/// HashIdPreimage is an XDR Union defines as:
31221///
31222/// ```text
31223/// union HashIDPreimage switch (EnvelopeType type)
31224/// {
31225/// case ENVELOPE_TYPE_OP_ID:
31226///     struct
31227///     {
31228///         AccountID sourceAccount;
31229///         SequenceNumber seqNum;
31230///         uint32 opNum;
31231///     } operationID;
31232/// case ENVELOPE_TYPE_POOL_REVOKE_OP_ID:
31233///     struct
31234///     {
31235///         AccountID sourceAccount;
31236///         SequenceNumber seqNum;
31237///         uint32 opNum;
31238///         PoolID liquidityPoolID;
31239///         Asset asset;
31240///     } revokeID;
31241/// case ENVELOPE_TYPE_CONTRACT_ID:
31242///     struct
31243///     {
31244///         Hash networkID;
31245///         ContractIDPreimage contractIDPreimage;
31246///     } contractID;
31247/// case ENVELOPE_TYPE_SOROBAN_AUTHORIZATION:
31248///     struct
31249///     {
31250///         Hash networkID;
31251///         int64 nonce;
31252///         uint32 signatureExpirationLedger;
31253///         SorobanAuthorizedInvocation invocation;
31254///     } sorobanAuthorization;
31255/// };
31256/// ```
31257///
31258// union with discriminant EnvelopeType
31259#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
31260#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
31261#[cfg_attr(
31262    all(feature = "serde", feature = "alloc"),
31263    derive(serde::Serialize, serde::Deserialize),
31264    serde(rename_all = "snake_case")
31265)]
31266#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
31267#[allow(clippy::large_enum_variant)]
31268pub enum HashIdPreimage {
31269    OpId(HashIdPreimageOperationId),
31270    PoolRevokeOpId(HashIdPreimageRevokeId),
31271    ContractId(HashIdPreimageContractId),
31272    SorobanAuthorization(HashIdPreimageSorobanAuthorization),
31273}
31274
31275impl HashIdPreimage {
31276    pub const VARIANTS: [EnvelopeType; 4] = [
31277        EnvelopeType::OpId,
31278        EnvelopeType::PoolRevokeOpId,
31279        EnvelopeType::ContractId,
31280        EnvelopeType::SorobanAuthorization,
31281    ];
31282    pub const VARIANTS_STR: [&'static str; 4] = [
31283        "OpId",
31284        "PoolRevokeOpId",
31285        "ContractId",
31286        "SorobanAuthorization",
31287    ];
31288
31289    #[must_use]
31290    pub const fn name(&self) -> &'static str {
31291        match self {
31292            Self::OpId(_) => "OpId",
31293            Self::PoolRevokeOpId(_) => "PoolRevokeOpId",
31294            Self::ContractId(_) => "ContractId",
31295            Self::SorobanAuthorization(_) => "SorobanAuthorization",
31296        }
31297    }
31298
31299    #[must_use]
31300    pub const fn discriminant(&self) -> EnvelopeType {
31301        #[allow(clippy::match_same_arms)]
31302        match self {
31303            Self::OpId(_) => EnvelopeType::OpId,
31304            Self::PoolRevokeOpId(_) => EnvelopeType::PoolRevokeOpId,
31305            Self::ContractId(_) => EnvelopeType::ContractId,
31306            Self::SorobanAuthorization(_) => EnvelopeType::SorobanAuthorization,
31307        }
31308    }
31309
31310    #[must_use]
31311    pub const fn variants() -> [EnvelopeType; 4] {
31312        Self::VARIANTS
31313    }
31314}
31315
31316impl Name for HashIdPreimage {
31317    #[must_use]
31318    fn name(&self) -> &'static str {
31319        Self::name(self)
31320    }
31321}
31322
31323impl Discriminant<EnvelopeType> for HashIdPreimage {
31324    #[must_use]
31325    fn discriminant(&self) -> EnvelopeType {
31326        Self::discriminant(self)
31327    }
31328}
31329
31330impl Variants<EnvelopeType> for HashIdPreimage {
31331    fn variants() -> slice::Iter<'static, EnvelopeType> {
31332        Self::VARIANTS.iter()
31333    }
31334}
31335
31336impl Union<EnvelopeType> for HashIdPreimage {}
31337
31338impl ReadXdr for HashIdPreimage {
31339    #[cfg(feature = "std")]
31340    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
31341        r.with_limited_depth(|r| {
31342            let dv: EnvelopeType = <EnvelopeType as ReadXdr>::read_xdr(r)?;
31343            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
31344            let v = match dv {
31345                EnvelopeType::OpId => Self::OpId(HashIdPreimageOperationId::read_xdr(r)?),
31346                EnvelopeType::PoolRevokeOpId => {
31347                    Self::PoolRevokeOpId(HashIdPreimageRevokeId::read_xdr(r)?)
31348                }
31349                EnvelopeType::ContractId => {
31350                    Self::ContractId(HashIdPreimageContractId::read_xdr(r)?)
31351                }
31352                EnvelopeType::SorobanAuthorization => {
31353                    Self::SorobanAuthorization(HashIdPreimageSorobanAuthorization::read_xdr(r)?)
31354                }
31355                #[allow(unreachable_patterns)]
31356                _ => return Err(Error::Invalid),
31357            };
31358            Ok(v)
31359        })
31360    }
31361}
31362
31363impl WriteXdr for HashIdPreimage {
31364    #[cfg(feature = "std")]
31365    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
31366        w.with_limited_depth(|w| {
31367            self.discriminant().write_xdr(w)?;
31368            #[allow(clippy::match_same_arms)]
31369            match self {
31370                Self::OpId(v) => v.write_xdr(w)?,
31371                Self::PoolRevokeOpId(v) => v.write_xdr(w)?,
31372                Self::ContractId(v) => v.write_xdr(w)?,
31373                Self::SorobanAuthorization(v) => v.write_xdr(w)?,
31374            };
31375            Ok(())
31376        })
31377    }
31378}
31379
31380/// MemoType is an XDR Enum defines as:
31381///
31382/// ```text
31383/// enum MemoType
31384/// {
31385///     MEMO_NONE = 0,
31386///     MEMO_TEXT = 1,
31387///     MEMO_ID = 2,
31388///     MEMO_HASH = 3,
31389///     MEMO_RETURN = 4
31390/// };
31391/// ```
31392///
31393// enum
31394#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
31395#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
31396#[cfg_attr(
31397    all(feature = "serde", feature = "alloc"),
31398    derive(serde::Serialize, serde::Deserialize),
31399    serde(rename_all = "snake_case")
31400)]
31401#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
31402#[repr(i32)]
31403pub enum MemoType {
31404    None = 0,
31405    Text = 1,
31406    Id = 2,
31407    Hash = 3,
31408    Return = 4,
31409}
31410
31411impl MemoType {
31412    pub const VARIANTS: [MemoType; 5] = [
31413        MemoType::None,
31414        MemoType::Text,
31415        MemoType::Id,
31416        MemoType::Hash,
31417        MemoType::Return,
31418    ];
31419    pub const VARIANTS_STR: [&'static str; 5] = ["None", "Text", "Id", "Hash", "Return"];
31420
31421    #[must_use]
31422    pub const fn name(&self) -> &'static str {
31423        match self {
31424            Self::None => "None",
31425            Self::Text => "Text",
31426            Self::Id => "Id",
31427            Self::Hash => "Hash",
31428            Self::Return => "Return",
31429        }
31430    }
31431
31432    #[must_use]
31433    pub const fn variants() -> [MemoType; 5] {
31434        Self::VARIANTS
31435    }
31436}
31437
31438impl Name for MemoType {
31439    #[must_use]
31440    fn name(&self) -> &'static str {
31441        Self::name(self)
31442    }
31443}
31444
31445impl Variants<MemoType> for MemoType {
31446    fn variants() -> slice::Iter<'static, MemoType> {
31447        Self::VARIANTS.iter()
31448    }
31449}
31450
31451impl Enum for MemoType {}
31452
31453impl fmt::Display for MemoType {
31454    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
31455        f.write_str(self.name())
31456    }
31457}
31458
31459impl TryFrom<i32> for MemoType {
31460    type Error = Error;
31461
31462    fn try_from(i: i32) -> Result<Self> {
31463        let e = match i {
31464            0 => MemoType::None,
31465            1 => MemoType::Text,
31466            2 => MemoType::Id,
31467            3 => MemoType::Hash,
31468            4 => MemoType::Return,
31469            #[allow(unreachable_patterns)]
31470            _ => return Err(Error::Invalid),
31471        };
31472        Ok(e)
31473    }
31474}
31475
31476impl From<MemoType> for i32 {
31477    #[must_use]
31478    fn from(e: MemoType) -> Self {
31479        e as Self
31480    }
31481}
31482
31483impl ReadXdr for MemoType {
31484    #[cfg(feature = "std")]
31485    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
31486        r.with_limited_depth(|r| {
31487            let e = i32::read_xdr(r)?;
31488            let v: Self = e.try_into()?;
31489            Ok(v)
31490        })
31491    }
31492}
31493
31494impl WriteXdr for MemoType {
31495    #[cfg(feature = "std")]
31496    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
31497        w.with_limited_depth(|w| {
31498            let i: i32 = (*self).into();
31499            i.write_xdr(w)
31500        })
31501    }
31502}
31503
31504/// Memo is an XDR Union defines as:
31505///
31506/// ```text
31507/// union Memo switch (MemoType type)
31508/// {
31509/// case MEMO_NONE:
31510///     void;
31511/// case MEMO_TEXT:
31512///     string text<28>;
31513/// case MEMO_ID:
31514///     uint64 id;
31515/// case MEMO_HASH:
31516///     Hash hash; // the hash of what to pull from the content server
31517/// case MEMO_RETURN:
31518///     Hash retHash; // the hash of the tx you are rejecting
31519/// };
31520/// ```
31521///
31522// union with discriminant MemoType
31523#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
31524#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
31525#[cfg_attr(
31526    all(feature = "serde", feature = "alloc"),
31527    derive(serde::Serialize, serde::Deserialize),
31528    serde(rename_all = "snake_case")
31529)]
31530#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
31531#[allow(clippy::large_enum_variant)]
31532pub enum Memo {
31533    None,
31534    Text(StringM<28>),
31535    Id(u64),
31536    Hash(Hash),
31537    Return(Hash),
31538}
31539
31540impl Memo {
31541    pub const VARIANTS: [MemoType; 5] = [
31542        MemoType::None,
31543        MemoType::Text,
31544        MemoType::Id,
31545        MemoType::Hash,
31546        MemoType::Return,
31547    ];
31548    pub const VARIANTS_STR: [&'static str; 5] = ["None", "Text", "Id", "Hash", "Return"];
31549
31550    #[must_use]
31551    pub const fn name(&self) -> &'static str {
31552        match self {
31553            Self::None => "None",
31554            Self::Text(_) => "Text",
31555            Self::Id(_) => "Id",
31556            Self::Hash(_) => "Hash",
31557            Self::Return(_) => "Return",
31558        }
31559    }
31560
31561    #[must_use]
31562    pub const fn discriminant(&self) -> MemoType {
31563        #[allow(clippy::match_same_arms)]
31564        match self {
31565            Self::None => MemoType::None,
31566            Self::Text(_) => MemoType::Text,
31567            Self::Id(_) => MemoType::Id,
31568            Self::Hash(_) => MemoType::Hash,
31569            Self::Return(_) => MemoType::Return,
31570        }
31571    }
31572
31573    #[must_use]
31574    pub const fn variants() -> [MemoType; 5] {
31575        Self::VARIANTS
31576    }
31577}
31578
31579impl Name for Memo {
31580    #[must_use]
31581    fn name(&self) -> &'static str {
31582        Self::name(self)
31583    }
31584}
31585
31586impl Discriminant<MemoType> for Memo {
31587    #[must_use]
31588    fn discriminant(&self) -> MemoType {
31589        Self::discriminant(self)
31590    }
31591}
31592
31593impl Variants<MemoType> for Memo {
31594    fn variants() -> slice::Iter<'static, MemoType> {
31595        Self::VARIANTS.iter()
31596    }
31597}
31598
31599impl Union<MemoType> for Memo {}
31600
31601impl ReadXdr for Memo {
31602    #[cfg(feature = "std")]
31603    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
31604        r.with_limited_depth(|r| {
31605            let dv: MemoType = <MemoType as ReadXdr>::read_xdr(r)?;
31606            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
31607            let v = match dv {
31608                MemoType::None => Self::None,
31609                MemoType::Text => Self::Text(StringM::<28>::read_xdr(r)?),
31610                MemoType::Id => Self::Id(u64::read_xdr(r)?),
31611                MemoType::Hash => Self::Hash(Hash::read_xdr(r)?),
31612                MemoType::Return => Self::Return(Hash::read_xdr(r)?),
31613                #[allow(unreachable_patterns)]
31614                _ => return Err(Error::Invalid),
31615            };
31616            Ok(v)
31617        })
31618    }
31619}
31620
31621impl WriteXdr for Memo {
31622    #[cfg(feature = "std")]
31623    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
31624        w.with_limited_depth(|w| {
31625            self.discriminant().write_xdr(w)?;
31626            #[allow(clippy::match_same_arms)]
31627            match self {
31628                Self::None => ().write_xdr(w)?,
31629                Self::Text(v) => v.write_xdr(w)?,
31630                Self::Id(v) => v.write_xdr(w)?,
31631                Self::Hash(v) => v.write_xdr(w)?,
31632                Self::Return(v) => v.write_xdr(w)?,
31633            };
31634            Ok(())
31635        })
31636    }
31637}
31638
31639/// TimeBounds is an XDR Struct defines as:
31640///
31641/// ```text
31642/// struct TimeBounds
31643/// {
31644///     TimePoint minTime;
31645///     TimePoint maxTime; // 0 here means no maxTime
31646/// };
31647/// ```
31648///
31649#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
31650#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
31651#[cfg_attr(
31652    all(feature = "serde", feature = "alloc"),
31653    derive(serde::Serialize, serde::Deserialize),
31654    serde(rename_all = "snake_case")
31655)]
31656#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
31657pub struct TimeBounds {
31658    pub min_time: TimePoint,
31659    pub max_time: TimePoint,
31660}
31661
31662impl ReadXdr for TimeBounds {
31663    #[cfg(feature = "std")]
31664    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
31665        r.with_limited_depth(|r| {
31666            Ok(Self {
31667                min_time: TimePoint::read_xdr(r)?,
31668                max_time: TimePoint::read_xdr(r)?,
31669            })
31670        })
31671    }
31672}
31673
31674impl WriteXdr for TimeBounds {
31675    #[cfg(feature = "std")]
31676    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
31677        w.with_limited_depth(|w| {
31678            self.min_time.write_xdr(w)?;
31679            self.max_time.write_xdr(w)?;
31680            Ok(())
31681        })
31682    }
31683}
31684
31685/// LedgerBounds is an XDR Struct defines as:
31686///
31687/// ```text
31688/// struct LedgerBounds
31689/// {
31690///     uint32 minLedger;
31691///     uint32 maxLedger; // 0 here means no maxLedger
31692/// };
31693/// ```
31694///
31695#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
31696#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
31697#[cfg_attr(
31698    all(feature = "serde", feature = "alloc"),
31699    derive(serde::Serialize, serde::Deserialize),
31700    serde(rename_all = "snake_case")
31701)]
31702#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
31703pub struct LedgerBounds {
31704    pub min_ledger: u32,
31705    pub max_ledger: u32,
31706}
31707
31708impl ReadXdr for LedgerBounds {
31709    #[cfg(feature = "std")]
31710    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
31711        r.with_limited_depth(|r| {
31712            Ok(Self {
31713                min_ledger: u32::read_xdr(r)?,
31714                max_ledger: u32::read_xdr(r)?,
31715            })
31716        })
31717    }
31718}
31719
31720impl WriteXdr for LedgerBounds {
31721    #[cfg(feature = "std")]
31722    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
31723        w.with_limited_depth(|w| {
31724            self.min_ledger.write_xdr(w)?;
31725            self.max_ledger.write_xdr(w)?;
31726            Ok(())
31727        })
31728    }
31729}
31730
31731/// PreconditionsV2 is an XDR Struct defines as:
31732///
31733/// ```text
31734/// struct PreconditionsV2
31735/// {
31736///     TimeBounds* timeBounds;
31737///
31738///     // Transaction only valid for ledger numbers n such that
31739///     // minLedger <= n < maxLedger (if maxLedger == 0, then
31740///     // only minLedger is checked)
31741///     LedgerBounds* ledgerBounds;
31742///
31743///     // If NULL, only valid when sourceAccount's sequence number
31744///     // is seqNum - 1.  Otherwise, valid when sourceAccount's
31745///     // sequence number n satisfies minSeqNum <= n < tx.seqNum.
31746///     // Note that after execution the account's sequence number
31747///     // is always raised to tx.seqNum, and a transaction is not
31748///     // valid if tx.seqNum is too high to ensure replay protection.
31749///     SequenceNumber* minSeqNum;
31750///
31751///     // For the transaction to be valid, the current ledger time must
31752///     // be at least minSeqAge greater than sourceAccount's seqTime.
31753///     Duration minSeqAge;
31754///
31755///     // For the transaction to be valid, the current ledger number
31756///     // must be at least minSeqLedgerGap greater than sourceAccount's
31757///     // seqLedger.
31758///     uint32 minSeqLedgerGap;
31759///
31760///     // For the transaction to be valid, there must be a signature
31761///     // corresponding to every Signer in this array, even if the
31762///     // signature is not otherwise required by the sourceAccount or
31763///     // operations.
31764///     SignerKey extraSigners<2>;
31765/// };
31766/// ```
31767///
31768#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
31769#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
31770#[cfg_attr(
31771    all(feature = "serde", feature = "alloc"),
31772    derive(serde::Serialize, serde::Deserialize),
31773    serde(rename_all = "snake_case")
31774)]
31775#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
31776pub struct PreconditionsV2 {
31777    pub time_bounds: Option<TimeBounds>,
31778    pub ledger_bounds: Option<LedgerBounds>,
31779    pub min_seq_num: Option<SequenceNumber>,
31780    pub min_seq_age: Duration,
31781    pub min_seq_ledger_gap: u32,
31782    pub extra_signers: VecM<SignerKey, 2>,
31783}
31784
31785impl ReadXdr for PreconditionsV2 {
31786    #[cfg(feature = "std")]
31787    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
31788        r.with_limited_depth(|r| {
31789            Ok(Self {
31790                time_bounds: Option::<TimeBounds>::read_xdr(r)?,
31791                ledger_bounds: Option::<LedgerBounds>::read_xdr(r)?,
31792                min_seq_num: Option::<SequenceNumber>::read_xdr(r)?,
31793                min_seq_age: Duration::read_xdr(r)?,
31794                min_seq_ledger_gap: u32::read_xdr(r)?,
31795                extra_signers: VecM::<SignerKey, 2>::read_xdr(r)?,
31796            })
31797        })
31798    }
31799}
31800
31801impl WriteXdr for PreconditionsV2 {
31802    #[cfg(feature = "std")]
31803    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
31804        w.with_limited_depth(|w| {
31805            self.time_bounds.write_xdr(w)?;
31806            self.ledger_bounds.write_xdr(w)?;
31807            self.min_seq_num.write_xdr(w)?;
31808            self.min_seq_age.write_xdr(w)?;
31809            self.min_seq_ledger_gap.write_xdr(w)?;
31810            self.extra_signers.write_xdr(w)?;
31811            Ok(())
31812        })
31813    }
31814}
31815
31816/// PreconditionType is an XDR Enum defines as:
31817///
31818/// ```text
31819/// enum PreconditionType
31820/// {
31821///     PRECOND_NONE = 0,
31822///     PRECOND_TIME = 1,
31823///     PRECOND_V2 = 2
31824/// };
31825/// ```
31826///
31827// enum
31828#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
31829#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
31830#[cfg_attr(
31831    all(feature = "serde", feature = "alloc"),
31832    derive(serde::Serialize, serde::Deserialize),
31833    serde(rename_all = "snake_case")
31834)]
31835#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
31836#[repr(i32)]
31837pub enum PreconditionType {
31838    None = 0,
31839    Time = 1,
31840    V2 = 2,
31841}
31842
31843impl PreconditionType {
31844    pub const VARIANTS: [PreconditionType; 3] = [
31845        PreconditionType::None,
31846        PreconditionType::Time,
31847        PreconditionType::V2,
31848    ];
31849    pub const VARIANTS_STR: [&'static str; 3] = ["None", "Time", "V2"];
31850
31851    #[must_use]
31852    pub const fn name(&self) -> &'static str {
31853        match self {
31854            Self::None => "None",
31855            Self::Time => "Time",
31856            Self::V2 => "V2",
31857        }
31858    }
31859
31860    #[must_use]
31861    pub const fn variants() -> [PreconditionType; 3] {
31862        Self::VARIANTS
31863    }
31864}
31865
31866impl Name for PreconditionType {
31867    #[must_use]
31868    fn name(&self) -> &'static str {
31869        Self::name(self)
31870    }
31871}
31872
31873impl Variants<PreconditionType> for PreconditionType {
31874    fn variants() -> slice::Iter<'static, PreconditionType> {
31875        Self::VARIANTS.iter()
31876    }
31877}
31878
31879impl Enum for PreconditionType {}
31880
31881impl fmt::Display for PreconditionType {
31882    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
31883        f.write_str(self.name())
31884    }
31885}
31886
31887impl TryFrom<i32> for PreconditionType {
31888    type Error = Error;
31889
31890    fn try_from(i: i32) -> Result<Self> {
31891        let e = match i {
31892            0 => PreconditionType::None,
31893            1 => PreconditionType::Time,
31894            2 => PreconditionType::V2,
31895            #[allow(unreachable_patterns)]
31896            _ => return Err(Error::Invalid),
31897        };
31898        Ok(e)
31899    }
31900}
31901
31902impl From<PreconditionType> for i32 {
31903    #[must_use]
31904    fn from(e: PreconditionType) -> Self {
31905        e as Self
31906    }
31907}
31908
31909impl ReadXdr for PreconditionType {
31910    #[cfg(feature = "std")]
31911    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
31912        r.with_limited_depth(|r| {
31913            let e = i32::read_xdr(r)?;
31914            let v: Self = e.try_into()?;
31915            Ok(v)
31916        })
31917    }
31918}
31919
31920impl WriteXdr for PreconditionType {
31921    #[cfg(feature = "std")]
31922    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
31923        w.with_limited_depth(|w| {
31924            let i: i32 = (*self).into();
31925            i.write_xdr(w)
31926        })
31927    }
31928}
31929
31930/// Preconditions is an XDR Union defines as:
31931///
31932/// ```text
31933/// union Preconditions switch (PreconditionType type)
31934/// {
31935/// case PRECOND_NONE:
31936///     void;
31937/// case PRECOND_TIME:
31938///     TimeBounds timeBounds;
31939/// case PRECOND_V2:
31940///     PreconditionsV2 v2;
31941/// };
31942/// ```
31943///
31944// union with discriminant PreconditionType
31945#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
31946#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
31947#[cfg_attr(
31948    all(feature = "serde", feature = "alloc"),
31949    derive(serde::Serialize, serde::Deserialize),
31950    serde(rename_all = "snake_case")
31951)]
31952#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
31953#[allow(clippy::large_enum_variant)]
31954pub enum Preconditions {
31955    None,
31956    Time(TimeBounds),
31957    V2(PreconditionsV2),
31958}
31959
31960impl Preconditions {
31961    pub const VARIANTS: [PreconditionType; 3] = [
31962        PreconditionType::None,
31963        PreconditionType::Time,
31964        PreconditionType::V2,
31965    ];
31966    pub const VARIANTS_STR: [&'static str; 3] = ["None", "Time", "V2"];
31967
31968    #[must_use]
31969    pub const fn name(&self) -> &'static str {
31970        match self {
31971            Self::None => "None",
31972            Self::Time(_) => "Time",
31973            Self::V2(_) => "V2",
31974        }
31975    }
31976
31977    #[must_use]
31978    pub const fn discriminant(&self) -> PreconditionType {
31979        #[allow(clippy::match_same_arms)]
31980        match self {
31981            Self::None => PreconditionType::None,
31982            Self::Time(_) => PreconditionType::Time,
31983            Self::V2(_) => PreconditionType::V2,
31984        }
31985    }
31986
31987    #[must_use]
31988    pub const fn variants() -> [PreconditionType; 3] {
31989        Self::VARIANTS
31990    }
31991}
31992
31993impl Name for Preconditions {
31994    #[must_use]
31995    fn name(&self) -> &'static str {
31996        Self::name(self)
31997    }
31998}
31999
32000impl Discriminant<PreconditionType> for Preconditions {
32001    #[must_use]
32002    fn discriminant(&self) -> PreconditionType {
32003        Self::discriminant(self)
32004    }
32005}
32006
32007impl Variants<PreconditionType> for Preconditions {
32008    fn variants() -> slice::Iter<'static, PreconditionType> {
32009        Self::VARIANTS.iter()
32010    }
32011}
32012
32013impl Union<PreconditionType> for Preconditions {}
32014
32015impl ReadXdr for Preconditions {
32016    #[cfg(feature = "std")]
32017    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
32018        r.with_limited_depth(|r| {
32019            let dv: PreconditionType = <PreconditionType as ReadXdr>::read_xdr(r)?;
32020            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
32021            let v = match dv {
32022                PreconditionType::None => Self::None,
32023                PreconditionType::Time => Self::Time(TimeBounds::read_xdr(r)?),
32024                PreconditionType::V2 => Self::V2(PreconditionsV2::read_xdr(r)?),
32025                #[allow(unreachable_patterns)]
32026                _ => return Err(Error::Invalid),
32027            };
32028            Ok(v)
32029        })
32030    }
32031}
32032
32033impl WriteXdr for Preconditions {
32034    #[cfg(feature = "std")]
32035    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
32036        w.with_limited_depth(|w| {
32037            self.discriminant().write_xdr(w)?;
32038            #[allow(clippy::match_same_arms)]
32039            match self {
32040                Self::None => ().write_xdr(w)?,
32041                Self::Time(v) => v.write_xdr(w)?,
32042                Self::V2(v) => v.write_xdr(w)?,
32043            };
32044            Ok(())
32045        })
32046    }
32047}
32048
32049/// LedgerFootprint is an XDR Struct defines as:
32050///
32051/// ```text
32052/// struct LedgerFootprint
32053/// {
32054///     LedgerKey readOnly<>;
32055///     LedgerKey readWrite<>;
32056/// };
32057/// ```
32058///
32059#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
32060#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
32061#[cfg_attr(
32062    all(feature = "serde", feature = "alloc"),
32063    derive(serde::Serialize, serde::Deserialize),
32064    serde(rename_all = "snake_case")
32065)]
32066#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
32067pub struct LedgerFootprint {
32068    pub read_only: VecM<LedgerKey>,
32069    pub read_write: VecM<LedgerKey>,
32070}
32071
32072impl ReadXdr for LedgerFootprint {
32073    #[cfg(feature = "std")]
32074    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
32075        r.with_limited_depth(|r| {
32076            Ok(Self {
32077                read_only: VecM::<LedgerKey>::read_xdr(r)?,
32078                read_write: VecM::<LedgerKey>::read_xdr(r)?,
32079            })
32080        })
32081    }
32082}
32083
32084impl WriteXdr for LedgerFootprint {
32085    #[cfg(feature = "std")]
32086    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
32087        w.with_limited_depth(|w| {
32088            self.read_only.write_xdr(w)?;
32089            self.read_write.write_xdr(w)?;
32090            Ok(())
32091        })
32092    }
32093}
32094
32095/// ArchivalProofType is an XDR Enum defines as:
32096///
32097/// ```text
32098/// enum ArchivalProofType
32099/// {
32100///     EXISTENCE = 0,
32101///     NONEXISTENCE = 1
32102/// };
32103/// ```
32104///
32105// enum
32106#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
32107#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
32108#[cfg_attr(
32109    all(feature = "serde", feature = "alloc"),
32110    derive(serde::Serialize, serde::Deserialize),
32111    serde(rename_all = "snake_case")
32112)]
32113#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
32114#[repr(i32)]
32115pub enum ArchivalProofType {
32116    Existence = 0,
32117    Nonexistence = 1,
32118}
32119
32120impl ArchivalProofType {
32121    pub const VARIANTS: [ArchivalProofType; 2] = [
32122        ArchivalProofType::Existence,
32123        ArchivalProofType::Nonexistence,
32124    ];
32125    pub const VARIANTS_STR: [&'static str; 2] = ["Existence", "Nonexistence"];
32126
32127    #[must_use]
32128    pub const fn name(&self) -> &'static str {
32129        match self {
32130            Self::Existence => "Existence",
32131            Self::Nonexistence => "Nonexistence",
32132        }
32133    }
32134
32135    #[must_use]
32136    pub const fn variants() -> [ArchivalProofType; 2] {
32137        Self::VARIANTS
32138    }
32139}
32140
32141impl Name for ArchivalProofType {
32142    #[must_use]
32143    fn name(&self) -> &'static str {
32144        Self::name(self)
32145    }
32146}
32147
32148impl Variants<ArchivalProofType> for ArchivalProofType {
32149    fn variants() -> slice::Iter<'static, ArchivalProofType> {
32150        Self::VARIANTS.iter()
32151    }
32152}
32153
32154impl Enum for ArchivalProofType {}
32155
32156impl fmt::Display for ArchivalProofType {
32157    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
32158        f.write_str(self.name())
32159    }
32160}
32161
32162impl TryFrom<i32> for ArchivalProofType {
32163    type Error = Error;
32164
32165    fn try_from(i: i32) -> Result<Self> {
32166        let e = match i {
32167            0 => ArchivalProofType::Existence,
32168            1 => ArchivalProofType::Nonexistence,
32169            #[allow(unreachable_patterns)]
32170            _ => return Err(Error::Invalid),
32171        };
32172        Ok(e)
32173    }
32174}
32175
32176impl From<ArchivalProofType> for i32 {
32177    #[must_use]
32178    fn from(e: ArchivalProofType) -> Self {
32179        e as Self
32180    }
32181}
32182
32183impl ReadXdr for ArchivalProofType {
32184    #[cfg(feature = "std")]
32185    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
32186        r.with_limited_depth(|r| {
32187            let e = i32::read_xdr(r)?;
32188            let v: Self = e.try_into()?;
32189            Ok(v)
32190        })
32191    }
32192}
32193
32194impl WriteXdr for ArchivalProofType {
32195    #[cfg(feature = "std")]
32196    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
32197        w.with_limited_depth(|w| {
32198            let i: i32 = (*self).into();
32199            i.write_xdr(w)
32200        })
32201    }
32202}
32203
32204/// ArchivalProofNode is an XDR Struct defines as:
32205///
32206/// ```text
32207/// struct ArchivalProofNode
32208/// {
32209///     uint32 index;
32210///     Hash hash;
32211/// };
32212/// ```
32213///
32214#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
32215#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
32216#[cfg_attr(
32217    all(feature = "serde", feature = "alloc"),
32218    derive(serde::Serialize, serde::Deserialize),
32219    serde(rename_all = "snake_case")
32220)]
32221#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
32222pub struct ArchivalProofNode {
32223    pub index: u32,
32224    pub hash: Hash,
32225}
32226
32227impl ReadXdr for ArchivalProofNode {
32228    #[cfg(feature = "std")]
32229    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
32230        r.with_limited_depth(|r| {
32231            Ok(Self {
32232                index: u32::read_xdr(r)?,
32233                hash: Hash::read_xdr(r)?,
32234            })
32235        })
32236    }
32237}
32238
32239impl WriteXdr for ArchivalProofNode {
32240    #[cfg(feature = "std")]
32241    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
32242        w.with_limited_depth(|w| {
32243            self.index.write_xdr(w)?;
32244            self.hash.write_xdr(w)?;
32245            Ok(())
32246        })
32247    }
32248}
32249
32250/// ProofLevel is an XDR Typedef defines as:
32251///
32252/// ```text
32253/// typedef ArchivalProofNode ProofLevel<>;
32254/// ```
32255///
32256#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
32257#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
32258#[derive(Default)]
32259#[cfg_attr(
32260    all(feature = "serde", feature = "alloc"),
32261    derive(serde::Serialize, serde::Deserialize),
32262    serde(rename_all = "snake_case")
32263)]
32264#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
32265#[derive(Debug)]
32266pub struct ProofLevel(pub VecM<ArchivalProofNode>);
32267
32268impl From<ProofLevel> for VecM<ArchivalProofNode> {
32269    #[must_use]
32270    fn from(x: ProofLevel) -> Self {
32271        x.0
32272    }
32273}
32274
32275impl From<VecM<ArchivalProofNode>> for ProofLevel {
32276    #[must_use]
32277    fn from(x: VecM<ArchivalProofNode>) -> Self {
32278        ProofLevel(x)
32279    }
32280}
32281
32282impl AsRef<VecM<ArchivalProofNode>> for ProofLevel {
32283    #[must_use]
32284    fn as_ref(&self) -> &VecM<ArchivalProofNode> {
32285        &self.0
32286    }
32287}
32288
32289impl ReadXdr for ProofLevel {
32290    #[cfg(feature = "std")]
32291    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
32292        r.with_limited_depth(|r| {
32293            let i = VecM::<ArchivalProofNode>::read_xdr(r)?;
32294            let v = ProofLevel(i);
32295            Ok(v)
32296        })
32297    }
32298}
32299
32300impl WriteXdr for ProofLevel {
32301    #[cfg(feature = "std")]
32302    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
32303        w.with_limited_depth(|w| self.0.write_xdr(w))
32304    }
32305}
32306
32307impl Deref for ProofLevel {
32308    type Target = VecM<ArchivalProofNode>;
32309    fn deref(&self) -> &Self::Target {
32310        &self.0
32311    }
32312}
32313
32314impl From<ProofLevel> for Vec<ArchivalProofNode> {
32315    #[must_use]
32316    fn from(x: ProofLevel) -> Self {
32317        x.0 .0
32318    }
32319}
32320
32321impl TryFrom<Vec<ArchivalProofNode>> for ProofLevel {
32322    type Error = Error;
32323    fn try_from(x: Vec<ArchivalProofNode>) -> Result<Self> {
32324        Ok(ProofLevel(x.try_into()?))
32325    }
32326}
32327
32328#[cfg(feature = "alloc")]
32329impl TryFrom<&Vec<ArchivalProofNode>> for ProofLevel {
32330    type Error = Error;
32331    fn try_from(x: &Vec<ArchivalProofNode>) -> Result<Self> {
32332        Ok(ProofLevel(x.try_into()?))
32333    }
32334}
32335
32336impl AsRef<Vec<ArchivalProofNode>> for ProofLevel {
32337    #[must_use]
32338    fn as_ref(&self) -> &Vec<ArchivalProofNode> {
32339        &self.0 .0
32340    }
32341}
32342
32343impl AsRef<[ArchivalProofNode]> for ProofLevel {
32344    #[cfg(feature = "alloc")]
32345    #[must_use]
32346    fn as_ref(&self) -> &[ArchivalProofNode] {
32347        &self.0 .0
32348    }
32349    #[cfg(not(feature = "alloc"))]
32350    #[must_use]
32351    fn as_ref(&self) -> &[ArchivalProofNode] {
32352        self.0 .0
32353    }
32354}
32355
32356/// NonexistenceProofBody is an XDR Struct defines as:
32357///
32358/// ```text
32359/// struct NonexistenceProofBody
32360/// {
32361///     ColdArchiveBucketEntry entriesToProve<>;
32362///
32363///     // Vector of vectors, where proofLevels[level]
32364///     // contains all HashNodes that correspond with that level
32365///     ProofLevel proofLevels<>;
32366/// };
32367/// ```
32368///
32369#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
32370#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
32371#[cfg_attr(
32372    all(feature = "serde", feature = "alloc"),
32373    derive(serde::Serialize, serde::Deserialize),
32374    serde(rename_all = "snake_case")
32375)]
32376#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
32377pub struct NonexistenceProofBody {
32378    pub entries_to_prove: VecM<ColdArchiveBucketEntry>,
32379    pub proof_levels: VecM<ProofLevel>,
32380}
32381
32382impl ReadXdr for NonexistenceProofBody {
32383    #[cfg(feature = "std")]
32384    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
32385        r.with_limited_depth(|r| {
32386            Ok(Self {
32387                entries_to_prove: VecM::<ColdArchiveBucketEntry>::read_xdr(r)?,
32388                proof_levels: VecM::<ProofLevel>::read_xdr(r)?,
32389            })
32390        })
32391    }
32392}
32393
32394impl WriteXdr for NonexistenceProofBody {
32395    #[cfg(feature = "std")]
32396    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
32397        w.with_limited_depth(|w| {
32398            self.entries_to_prove.write_xdr(w)?;
32399            self.proof_levels.write_xdr(w)?;
32400            Ok(())
32401        })
32402    }
32403}
32404
32405/// ExistenceProofBody is an XDR Struct defines as:
32406///
32407/// ```text
32408/// struct ExistenceProofBody
32409/// {
32410///     LedgerKey keysToProve<>;
32411///
32412///     // Bounds for each key being proved, where bound[n]
32413///     // corresponds to keysToProve[n]
32414///     ColdArchiveBucketEntry lowBoundEntries<>;
32415///     ColdArchiveBucketEntry highBoundEntries<>;
32416///
32417///     // Vector of vectors, where proofLevels[level]
32418///     // contains all HashNodes that correspond with that level
32419///     ProofLevel proofLevels<>;
32420/// };
32421/// ```
32422///
32423#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
32424#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
32425#[cfg_attr(
32426    all(feature = "serde", feature = "alloc"),
32427    derive(serde::Serialize, serde::Deserialize),
32428    serde(rename_all = "snake_case")
32429)]
32430#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
32431pub struct ExistenceProofBody {
32432    pub keys_to_prove: VecM<LedgerKey>,
32433    pub low_bound_entries: VecM<ColdArchiveBucketEntry>,
32434    pub high_bound_entries: VecM<ColdArchiveBucketEntry>,
32435    pub proof_levels: VecM<ProofLevel>,
32436}
32437
32438impl ReadXdr for ExistenceProofBody {
32439    #[cfg(feature = "std")]
32440    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
32441        r.with_limited_depth(|r| {
32442            Ok(Self {
32443                keys_to_prove: VecM::<LedgerKey>::read_xdr(r)?,
32444                low_bound_entries: VecM::<ColdArchiveBucketEntry>::read_xdr(r)?,
32445                high_bound_entries: VecM::<ColdArchiveBucketEntry>::read_xdr(r)?,
32446                proof_levels: VecM::<ProofLevel>::read_xdr(r)?,
32447            })
32448        })
32449    }
32450}
32451
32452impl WriteXdr for ExistenceProofBody {
32453    #[cfg(feature = "std")]
32454    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
32455        w.with_limited_depth(|w| {
32456            self.keys_to_prove.write_xdr(w)?;
32457            self.low_bound_entries.write_xdr(w)?;
32458            self.high_bound_entries.write_xdr(w)?;
32459            self.proof_levels.write_xdr(w)?;
32460            Ok(())
32461        })
32462    }
32463}
32464
32465/// ArchivalProofBody is an XDR NestedUnion defines as:
32466///
32467/// ```text
32468/// union switch (ArchivalProofType t)
32469///     {
32470///     case EXISTENCE:
32471///         NonexistenceProofBody nonexistenceProof;
32472///     case NONEXISTENCE:
32473///         ExistenceProofBody existenceProof;
32474///     }
32475/// ```
32476///
32477// union with discriminant ArchivalProofType
32478#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
32479#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
32480#[cfg_attr(
32481    all(feature = "serde", feature = "alloc"),
32482    derive(serde::Serialize, serde::Deserialize),
32483    serde(rename_all = "snake_case")
32484)]
32485#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
32486#[allow(clippy::large_enum_variant)]
32487pub enum ArchivalProofBody {
32488    Existence(NonexistenceProofBody),
32489    Nonexistence(ExistenceProofBody),
32490}
32491
32492impl ArchivalProofBody {
32493    pub const VARIANTS: [ArchivalProofType; 2] = [
32494        ArchivalProofType::Existence,
32495        ArchivalProofType::Nonexistence,
32496    ];
32497    pub const VARIANTS_STR: [&'static str; 2] = ["Existence", "Nonexistence"];
32498
32499    #[must_use]
32500    pub const fn name(&self) -> &'static str {
32501        match self {
32502            Self::Existence(_) => "Existence",
32503            Self::Nonexistence(_) => "Nonexistence",
32504        }
32505    }
32506
32507    #[must_use]
32508    pub const fn discriminant(&self) -> ArchivalProofType {
32509        #[allow(clippy::match_same_arms)]
32510        match self {
32511            Self::Existence(_) => ArchivalProofType::Existence,
32512            Self::Nonexistence(_) => ArchivalProofType::Nonexistence,
32513        }
32514    }
32515
32516    #[must_use]
32517    pub const fn variants() -> [ArchivalProofType; 2] {
32518        Self::VARIANTS
32519    }
32520}
32521
32522impl Name for ArchivalProofBody {
32523    #[must_use]
32524    fn name(&self) -> &'static str {
32525        Self::name(self)
32526    }
32527}
32528
32529impl Discriminant<ArchivalProofType> for ArchivalProofBody {
32530    #[must_use]
32531    fn discriminant(&self) -> ArchivalProofType {
32532        Self::discriminant(self)
32533    }
32534}
32535
32536impl Variants<ArchivalProofType> for ArchivalProofBody {
32537    fn variants() -> slice::Iter<'static, ArchivalProofType> {
32538        Self::VARIANTS.iter()
32539    }
32540}
32541
32542impl Union<ArchivalProofType> for ArchivalProofBody {}
32543
32544impl ReadXdr for ArchivalProofBody {
32545    #[cfg(feature = "std")]
32546    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
32547        r.with_limited_depth(|r| {
32548            let dv: ArchivalProofType = <ArchivalProofType as ReadXdr>::read_xdr(r)?;
32549            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
32550            let v = match dv {
32551                ArchivalProofType::Existence => {
32552                    Self::Existence(NonexistenceProofBody::read_xdr(r)?)
32553                }
32554                ArchivalProofType::Nonexistence => {
32555                    Self::Nonexistence(ExistenceProofBody::read_xdr(r)?)
32556                }
32557                #[allow(unreachable_patterns)]
32558                _ => return Err(Error::Invalid),
32559            };
32560            Ok(v)
32561        })
32562    }
32563}
32564
32565impl WriteXdr for ArchivalProofBody {
32566    #[cfg(feature = "std")]
32567    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
32568        w.with_limited_depth(|w| {
32569            self.discriminant().write_xdr(w)?;
32570            #[allow(clippy::match_same_arms)]
32571            match self {
32572                Self::Existence(v) => v.write_xdr(w)?,
32573                Self::Nonexistence(v) => v.write_xdr(w)?,
32574            };
32575            Ok(())
32576        })
32577    }
32578}
32579
32580/// ArchivalProof is an XDR Struct defines as:
32581///
32582/// ```text
32583/// struct ArchivalProof
32584/// {
32585///     uint32 epoch; // AST Subtree for this proof
32586///
32587///     union switch (ArchivalProofType t)
32588///     {
32589///     case EXISTENCE:
32590///         NonexistenceProofBody nonexistenceProof;
32591///     case NONEXISTENCE:
32592///         ExistenceProofBody existenceProof;
32593///     } body;
32594/// };
32595/// ```
32596///
32597#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
32598#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
32599#[cfg_attr(
32600    all(feature = "serde", feature = "alloc"),
32601    derive(serde::Serialize, serde::Deserialize),
32602    serde(rename_all = "snake_case")
32603)]
32604#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
32605pub struct ArchivalProof {
32606    pub epoch: u32,
32607    pub body: ArchivalProofBody,
32608}
32609
32610impl ReadXdr for ArchivalProof {
32611    #[cfg(feature = "std")]
32612    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
32613        r.with_limited_depth(|r| {
32614            Ok(Self {
32615                epoch: u32::read_xdr(r)?,
32616                body: ArchivalProofBody::read_xdr(r)?,
32617            })
32618        })
32619    }
32620}
32621
32622impl WriteXdr for ArchivalProof {
32623    #[cfg(feature = "std")]
32624    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
32625        w.with_limited_depth(|w| {
32626            self.epoch.write_xdr(w)?;
32627            self.body.write_xdr(w)?;
32628            Ok(())
32629        })
32630    }
32631}
32632
32633/// SorobanResources is an XDR Struct defines as:
32634///
32635/// ```text
32636/// struct SorobanResources
32637/// {   
32638///     // The ledger footprint of the transaction.
32639///     LedgerFootprint footprint;
32640///     // The maximum number of instructions this transaction can use
32641///     uint32 instructions;
32642///
32643///     // The maximum number of bytes this transaction can read from ledger
32644///     uint32 readBytes;
32645///     // The maximum number of bytes this transaction can write to ledger
32646///     uint32 writeBytes;
32647/// };
32648/// ```
32649///
32650#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
32651#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
32652#[cfg_attr(
32653    all(feature = "serde", feature = "alloc"),
32654    derive(serde::Serialize, serde::Deserialize),
32655    serde(rename_all = "snake_case")
32656)]
32657#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
32658pub struct SorobanResources {
32659    pub footprint: LedgerFootprint,
32660    pub instructions: u32,
32661    pub read_bytes: u32,
32662    pub write_bytes: u32,
32663}
32664
32665impl ReadXdr for SorobanResources {
32666    #[cfg(feature = "std")]
32667    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
32668        r.with_limited_depth(|r| {
32669            Ok(Self {
32670                footprint: LedgerFootprint::read_xdr(r)?,
32671                instructions: u32::read_xdr(r)?,
32672                read_bytes: u32::read_xdr(r)?,
32673                write_bytes: u32::read_xdr(r)?,
32674            })
32675        })
32676    }
32677}
32678
32679impl WriteXdr for SorobanResources {
32680    #[cfg(feature = "std")]
32681    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
32682        w.with_limited_depth(|w| {
32683            self.footprint.write_xdr(w)?;
32684            self.instructions.write_xdr(w)?;
32685            self.read_bytes.write_xdr(w)?;
32686            self.write_bytes.write_xdr(w)?;
32687            Ok(())
32688        })
32689    }
32690}
32691
32692/// SorobanTransactionData is an XDR Struct defines as:
32693///
32694/// ```text
32695/// struct SorobanTransactionData
32696/// {
32697///     ExtensionPoint ext;
32698///     SorobanResources resources;
32699///     // Amount of the transaction `fee` allocated to the Soroban resource fees.
32700///     // The fraction of `resourceFee` corresponding to `resources` specified
32701///     // above is *not* refundable (i.e. fees for instructions, ledger I/O), as
32702///     // well as fees for the transaction size.
32703///     // The remaining part of the fee is refundable and the charged value is
32704///     // based on the actual consumption of refundable resources (events, ledger
32705///     // rent bumps).
32706///     // The `inclusionFee` used for prioritization of the transaction is defined
32707///     // as `tx.fee - resourceFee`.
32708///     int64 resourceFee;
32709/// };
32710/// ```
32711///
32712#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
32713#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
32714#[cfg_attr(
32715    all(feature = "serde", feature = "alloc"),
32716    derive(serde::Serialize, serde::Deserialize),
32717    serde(rename_all = "snake_case")
32718)]
32719#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
32720pub struct SorobanTransactionData {
32721    pub ext: ExtensionPoint,
32722    pub resources: SorobanResources,
32723    pub resource_fee: i64,
32724}
32725
32726impl ReadXdr for SorobanTransactionData {
32727    #[cfg(feature = "std")]
32728    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
32729        r.with_limited_depth(|r| {
32730            Ok(Self {
32731                ext: ExtensionPoint::read_xdr(r)?,
32732                resources: SorobanResources::read_xdr(r)?,
32733                resource_fee: i64::read_xdr(r)?,
32734            })
32735        })
32736    }
32737}
32738
32739impl WriteXdr for SorobanTransactionData {
32740    #[cfg(feature = "std")]
32741    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
32742        w.with_limited_depth(|w| {
32743            self.ext.write_xdr(w)?;
32744            self.resources.write_xdr(w)?;
32745            self.resource_fee.write_xdr(w)?;
32746            Ok(())
32747        })
32748    }
32749}
32750
32751/// TransactionV0Ext is an XDR NestedUnion defines as:
32752///
32753/// ```text
32754/// union switch (int v)
32755///     {
32756///     case 0:
32757///         void;
32758///     }
32759/// ```
32760///
32761// union with discriminant i32
32762#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
32763#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
32764#[cfg_attr(
32765    all(feature = "serde", feature = "alloc"),
32766    derive(serde::Serialize, serde::Deserialize),
32767    serde(rename_all = "snake_case")
32768)]
32769#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
32770#[allow(clippy::large_enum_variant)]
32771pub enum TransactionV0Ext {
32772    V0,
32773}
32774
32775impl TransactionV0Ext {
32776    pub const VARIANTS: [i32; 1] = [0];
32777    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
32778
32779    #[must_use]
32780    pub const fn name(&self) -> &'static str {
32781        match self {
32782            Self::V0 => "V0",
32783        }
32784    }
32785
32786    #[must_use]
32787    pub const fn discriminant(&self) -> i32 {
32788        #[allow(clippy::match_same_arms)]
32789        match self {
32790            Self::V0 => 0,
32791        }
32792    }
32793
32794    #[must_use]
32795    pub const fn variants() -> [i32; 1] {
32796        Self::VARIANTS
32797    }
32798}
32799
32800impl Name for TransactionV0Ext {
32801    #[must_use]
32802    fn name(&self) -> &'static str {
32803        Self::name(self)
32804    }
32805}
32806
32807impl Discriminant<i32> for TransactionV0Ext {
32808    #[must_use]
32809    fn discriminant(&self) -> i32 {
32810        Self::discriminant(self)
32811    }
32812}
32813
32814impl Variants<i32> for TransactionV0Ext {
32815    fn variants() -> slice::Iter<'static, i32> {
32816        Self::VARIANTS.iter()
32817    }
32818}
32819
32820impl Union<i32> for TransactionV0Ext {}
32821
32822impl ReadXdr for TransactionV0Ext {
32823    #[cfg(feature = "std")]
32824    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
32825        r.with_limited_depth(|r| {
32826            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
32827            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
32828            let v = match dv {
32829                0 => Self::V0,
32830                #[allow(unreachable_patterns)]
32831                _ => return Err(Error::Invalid),
32832            };
32833            Ok(v)
32834        })
32835    }
32836}
32837
32838impl WriteXdr for TransactionV0Ext {
32839    #[cfg(feature = "std")]
32840    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
32841        w.with_limited_depth(|w| {
32842            self.discriminant().write_xdr(w)?;
32843            #[allow(clippy::match_same_arms)]
32844            match self {
32845                Self::V0 => ().write_xdr(w)?,
32846            };
32847            Ok(())
32848        })
32849    }
32850}
32851
32852/// TransactionV0 is an XDR Struct defines as:
32853///
32854/// ```text
32855/// struct TransactionV0
32856/// {
32857///     uint256 sourceAccountEd25519;
32858///     uint32 fee;
32859///     SequenceNumber seqNum;
32860///     TimeBounds* timeBounds;
32861///     Memo memo;
32862///     Operation operations<MAX_OPS_PER_TX>;
32863///     union switch (int v)
32864///     {
32865///     case 0:
32866///         void;
32867///     }
32868///     ext;
32869/// };
32870/// ```
32871///
32872#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
32873#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
32874#[cfg_attr(
32875    all(feature = "serde", feature = "alloc"),
32876    derive(serde::Serialize, serde::Deserialize),
32877    serde(rename_all = "snake_case")
32878)]
32879#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
32880pub struct TransactionV0 {
32881    pub source_account_ed25519: Uint256,
32882    pub fee: u32,
32883    pub seq_num: SequenceNumber,
32884    pub time_bounds: Option<TimeBounds>,
32885    pub memo: Memo,
32886    pub operations: VecM<Operation, 100>,
32887    pub ext: TransactionV0Ext,
32888}
32889
32890impl ReadXdr for TransactionV0 {
32891    #[cfg(feature = "std")]
32892    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
32893        r.with_limited_depth(|r| {
32894            Ok(Self {
32895                source_account_ed25519: Uint256::read_xdr(r)?,
32896                fee: u32::read_xdr(r)?,
32897                seq_num: SequenceNumber::read_xdr(r)?,
32898                time_bounds: Option::<TimeBounds>::read_xdr(r)?,
32899                memo: Memo::read_xdr(r)?,
32900                operations: VecM::<Operation, 100>::read_xdr(r)?,
32901                ext: TransactionV0Ext::read_xdr(r)?,
32902            })
32903        })
32904    }
32905}
32906
32907impl WriteXdr for TransactionV0 {
32908    #[cfg(feature = "std")]
32909    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
32910        w.with_limited_depth(|w| {
32911            self.source_account_ed25519.write_xdr(w)?;
32912            self.fee.write_xdr(w)?;
32913            self.seq_num.write_xdr(w)?;
32914            self.time_bounds.write_xdr(w)?;
32915            self.memo.write_xdr(w)?;
32916            self.operations.write_xdr(w)?;
32917            self.ext.write_xdr(w)?;
32918            Ok(())
32919        })
32920    }
32921}
32922
32923/// TransactionV0Envelope is an XDR Struct defines as:
32924///
32925/// ```text
32926/// struct TransactionV0Envelope
32927/// {
32928///     TransactionV0 tx;
32929///     /* Each decorated signature is a signature over the SHA256 hash of
32930///      * a TransactionSignaturePayload */
32931///     DecoratedSignature signatures<20>;
32932/// };
32933/// ```
32934///
32935#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
32936#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
32937#[cfg_attr(
32938    all(feature = "serde", feature = "alloc"),
32939    derive(serde::Serialize, serde::Deserialize),
32940    serde(rename_all = "snake_case")
32941)]
32942#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
32943pub struct TransactionV0Envelope {
32944    pub tx: TransactionV0,
32945    pub signatures: VecM<DecoratedSignature, 20>,
32946}
32947
32948impl ReadXdr for TransactionV0Envelope {
32949    #[cfg(feature = "std")]
32950    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
32951        r.with_limited_depth(|r| {
32952            Ok(Self {
32953                tx: TransactionV0::read_xdr(r)?,
32954                signatures: VecM::<DecoratedSignature, 20>::read_xdr(r)?,
32955            })
32956        })
32957    }
32958}
32959
32960impl WriteXdr for TransactionV0Envelope {
32961    #[cfg(feature = "std")]
32962    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
32963        w.with_limited_depth(|w| {
32964            self.tx.write_xdr(w)?;
32965            self.signatures.write_xdr(w)?;
32966            Ok(())
32967        })
32968    }
32969}
32970
32971/// TransactionExt is an XDR NestedUnion defines as:
32972///
32973/// ```text
32974/// union switch (int v)
32975///     {
32976///     case 0:
32977///         void;
32978///     case 1:
32979///         SorobanTransactionData sorobanData;
32980///     }
32981/// ```
32982///
32983// union with discriminant i32
32984#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
32985#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
32986#[cfg_attr(
32987    all(feature = "serde", feature = "alloc"),
32988    derive(serde::Serialize, serde::Deserialize),
32989    serde(rename_all = "snake_case")
32990)]
32991#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
32992#[allow(clippy::large_enum_variant)]
32993pub enum TransactionExt {
32994    V0,
32995    V1(SorobanTransactionData),
32996}
32997
32998impl TransactionExt {
32999    pub const VARIANTS: [i32; 2] = [0, 1];
33000    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"];
33001
33002    #[must_use]
33003    pub const fn name(&self) -> &'static str {
33004        match self {
33005            Self::V0 => "V0",
33006            Self::V1(_) => "V1",
33007        }
33008    }
33009
33010    #[must_use]
33011    pub const fn discriminant(&self) -> i32 {
33012        #[allow(clippy::match_same_arms)]
33013        match self {
33014            Self::V0 => 0,
33015            Self::V1(_) => 1,
33016        }
33017    }
33018
33019    #[must_use]
33020    pub const fn variants() -> [i32; 2] {
33021        Self::VARIANTS
33022    }
33023}
33024
33025impl Name for TransactionExt {
33026    #[must_use]
33027    fn name(&self) -> &'static str {
33028        Self::name(self)
33029    }
33030}
33031
33032impl Discriminant<i32> for TransactionExt {
33033    #[must_use]
33034    fn discriminant(&self) -> i32 {
33035        Self::discriminant(self)
33036    }
33037}
33038
33039impl Variants<i32> for TransactionExt {
33040    fn variants() -> slice::Iter<'static, i32> {
33041        Self::VARIANTS.iter()
33042    }
33043}
33044
33045impl Union<i32> for TransactionExt {}
33046
33047impl ReadXdr for TransactionExt {
33048    #[cfg(feature = "std")]
33049    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
33050        r.with_limited_depth(|r| {
33051            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
33052            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
33053            let v = match dv {
33054                0 => Self::V0,
33055                1 => Self::V1(SorobanTransactionData::read_xdr(r)?),
33056                #[allow(unreachable_patterns)]
33057                _ => return Err(Error::Invalid),
33058            };
33059            Ok(v)
33060        })
33061    }
33062}
33063
33064impl WriteXdr for TransactionExt {
33065    #[cfg(feature = "std")]
33066    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
33067        w.with_limited_depth(|w| {
33068            self.discriminant().write_xdr(w)?;
33069            #[allow(clippy::match_same_arms)]
33070            match self {
33071                Self::V0 => ().write_xdr(w)?,
33072                Self::V1(v) => v.write_xdr(w)?,
33073            };
33074            Ok(())
33075        })
33076    }
33077}
33078
33079/// Transaction is an XDR Struct defines as:
33080///
33081/// ```text
33082/// struct Transaction
33083/// {
33084///     // account used to run the transaction
33085///     MuxedAccount sourceAccount;
33086///
33087///     // the fee the sourceAccount will pay
33088///     uint32 fee;
33089///
33090///     // sequence number to consume in the account
33091///     SequenceNumber seqNum;
33092///
33093///     // validity conditions
33094///     Preconditions cond;
33095///
33096///     Memo memo;
33097///
33098///     Operation operations<MAX_OPS_PER_TX>;
33099///
33100///     // reserved for future use
33101///     union switch (int v)
33102///     {
33103///     case 0:
33104///         void;
33105///     case 1:
33106///         SorobanTransactionData sorobanData;
33107///     }
33108///     ext;
33109/// };
33110/// ```
33111///
33112#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
33113#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
33114#[cfg_attr(
33115    all(feature = "serde", feature = "alloc"),
33116    derive(serde::Serialize, serde::Deserialize),
33117    serde(rename_all = "snake_case")
33118)]
33119#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
33120pub struct Transaction {
33121    pub source_account: MuxedAccount,
33122    pub fee: u32,
33123    pub seq_num: SequenceNumber,
33124    pub cond: Preconditions,
33125    pub memo: Memo,
33126    pub operations: VecM<Operation, 100>,
33127    pub ext: TransactionExt,
33128}
33129
33130impl ReadXdr for Transaction {
33131    #[cfg(feature = "std")]
33132    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
33133        r.with_limited_depth(|r| {
33134            Ok(Self {
33135                source_account: MuxedAccount::read_xdr(r)?,
33136                fee: u32::read_xdr(r)?,
33137                seq_num: SequenceNumber::read_xdr(r)?,
33138                cond: Preconditions::read_xdr(r)?,
33139                memo: Memo::read_xdr(r)?,
33140                operations: VecM::<Operation, 100>::read_xdr(r)?,
33141                ext: TransactionExt::read_xdr(r)?,
33142            })
33143        })
33144    }
33145}
33146
33147impl WriteXdr for Transaction {
33148    #[cfg(feature = "std")]
33149    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
33150        w.with_limited_depth(|w| {
33151            self.source_account.write_xdr(w)?;
33152            self.fee.write_xdr(w)?;
33153            self.seq_num.write_xdr(w)?;
33154            self.cond.write_xdr(w)?;
33155            self.memo.write_xdr(w)?;
33156            self.operations.write_xdr(w)?;
33157            self.ext.write_xdr(w)?;
33158            Ok(())
33159        })
33160    }
33161}
33162
33163/// TransactionV1Envelope is an XDR Struct defines as:
33164///
33165/// ```text
33166/// struct TransactionV1Envelope
33167/// {
33168///     Transaction tx;
33169///     /* Each decorated signature is a signature over the SHA256 hash of
33170///      * a TransactionSignaturePayload */
33171///     DecoratedSignature signatures<20>;
33172/// };
33173/// ```
33174///
33175#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
33176#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
33177#[cfg_attr(
33178    all(feature = "serde", feature = "alloc"),
33179    derive(serde::Serialize, serde::Deserialize),
33180    serde(rename_all = "snake_case")
33181)]
33182#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
33183pub struct TransactionV1Envelope {
33184    pub tx: Transaction,
33185    pub signatures: VecM<DecoratedSignature, 20>,
33186}
33187
33188impl ReadXdr for TransactionV1Envelope {
33189    #[cfg(feature = "std")]
33190    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
33191        r.with_limited_depth(|r| {
33192            Ok(Self {
33193                tx: Transaction::read_xdr(r)?,
33194                signatures: VecM::<DecoratedSignature, 20>::read_xdr(r)?,
33195            })
33196        })
33197    }
33198}
33199
33200impl WriteXdr for TransactionV1Envelope {
33201    #[cfg(feature = "std")]
33202    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
33203        w.with_limited_depth(|w| {
33204            self.tx.write_xdr(w)?;
33205            self.signatures.write_xdr(w)?;
33206            Ok(())
33207        })
33208    }
33209}
33210
33211/// FeeBumpTransactionInnerTx is an XDR NestedUnion defines as:
33212///
33213/// ```text
33214/// union switch (EnvelopeType type)
33215///     {
33216///     case ENVELOPE_TYPE_TX:
33217///         TransactionV1Envelope v1;
33218///     }
33219/// ```
33220///
33221// union with discriminant EnvelopeType
33222#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
33223#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
33224#[cfg_attr(
33225    all(feature = "serde", feature = "alloc"),
33226    derive(serde::Serialize, serde::Deserialize),
33227    serde(rename_all = "snake_case")
33228)]
33229#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
33230#[allow(clippy::large_enum_variant)]
33231pub enum FeeBumpTransactionInnerTx {
33232    Tx(TransactionV1Envelope),
33233}
33234
33235impl FeeBumpTransactionInnerTx {
33236    pub const VARIANTS: [EnvelopeType; 1] = [EnvelopeType::Tx];
33237    pub const VARIANTS_STR: [&'static str; 1] = ["Tx"];
33238
33239    #[must_use]
33240    pub const fn name(&self) -> &'static str {
33241        match self {
33242            Self::Tx(_) => "Tx",
33243        }
33244    }
33245
33246    #[must_use]
33247    pub const fn discriminant(&self) -> EnvelopeType {
33248        #[allow(clippy::match_same_arms)]
33249        match self {
33250            Self::Tx(_) => EnvelopeType::Tx,
33251        }
33252    }
33253
33254    #[must_use]
33255    pub const fn variants() -> [EnvelopeType; 1] {
33256        Self::VARIANTS
33257    }
33258}
33259
33260impl Name for FeeBumpTransactionInnerTx {
33261    #[must_use]
33262    fn name(&self) -> &'static str {
33263        Self::name(self)
33264    }
33265}
33266
33267impl Discriminant<EnvelopeType> for FeeBumpTransactionInnerTx {
33268    #[must_use]
33269    fn discriminant(&self) -> EnvelopeType {
33270        Self::discriminant(self)
33271    }
33272}
33273
33274impl Variants<EnvelopeType> for FeeBumpTransactionInnerTx {
33275    fn variants() -> slice::Iter<'static, EnvelopeType> {
33276        Self::VARIANTS.iter()
33277    }
33278}
33279
33280impl Union<EnvelopeType> for FeeBumpTransactionInnerTx {}
33281
33282impl ReadXdr for FeeBumpTransactionInnerTx {
33283    #[cfg(feature = "std")]
33284    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
33285        r.with_limited_depth(|r| {
33286            let dv: EnvelopeType = <EnvelopeType as ReadXdr>::read_xdr(r)?;
33287            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
33288            let v = match dv {
33289                EnvelopeType::Tx => Self::Tx(TransactionV1Envelope::read_xdr(r)?),
33290                #[allow(unreachable_patterns)]
33291                _ => return Err(Error::Invalid),
33292            };
33293            Ok(v)
33294        })
33295    }
33296}
33297
33298impl WriteXdr for FeeBumpTransactionInnerTx {
33299    #[cfg(feature = "std")]
33300    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
33301        w.with_limited_depth(|w| {
33302            self.discriminant().write_xdr(w)?;
33303            #[allow(clippy::match_same_arms)]
33304            match self {
33305                Self::Tx(v) => v.write_xdr(w)?,
33306            };
33307            Ok(())
33308        })
33309    }
33310}
33311
33312/// FeeBumpTransactionExt is an XDR NestedUnion defines as:
33313///
33314/// ```text
33315/// union switch (int v)
33316///     {
33317///     case 0:
33318///         void;
33319///     }
33320/// ```
33321///
33322// union with discriminant i32
33323#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
33324#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
33325#[cfg_attr(
33326    all(feature = "serde", feature = "alloc"),
33327    derive(serde::Serialize, serde::Deserialize),
33328    serde(rename_all = "snake_case")
33329)]
33330#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
33331#[allow(clippy::large_enum_variant)]
33332pub enum FeeBumpTransactionExt {
33333    V0,
33334}
33335
33336impl FeeBumpTransactionExt {
33337    pub const VARIANTS: [i32; 1] = [0];
33338    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
33339
33340    #[must_use]
33341    pub const fn name(&self) -> &'static str {
33342        match self {
33343            Self::V0 => "V0",
33344        }
33345    }
33346
33347    #[must_use]
33348    pub const fn discriminant(&self) -> i32 {
33349        #[allow(clippy::match_same_arms)]
33350        match self {
33351            Self::V0 => 0,
33352        }
33353    }
33354
33355    #[must_use]
33356    pub const fn variants() -> [i32; 1] {
33357        Self::VARIANTS
33358    }
33359}
33360
33361impl Name for FeeBumpTransactionExt {
33362    #[must_use]
33363    fn name(&self) -> &'static str {
33364        Self::name(self)
33365    }
33366}
33367
33368impl Discriminant<i32> for FeeBumpTransactionExt {
33369    #[must_use]
33370    fn discriminant(&self) -> i32 {
33371        Self::discriminant(self)
33372    }
33373}
33374
33375impl Variants<i32> for FeeBumpTransactionExt {
33376    fn variants() -> slice::Iter<'static, i32> {
33377        Self::VARIANTS.iter()
33378    }
33379}
33380
33381impl Union<i32> for FeeBumpTransactionExt {}
33382
33383impl ReadXdr for FeeBumpTransactionExt {
33384    #[cfg(feature = "std")]
33385    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
33386        r.with_limited_depth(|r| {
33387            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
33388            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
33389            let v = match dv {
33390                0 => Self::V0,
33391                #[allow(unreachable_patterns)]
33392                _ => return Err(Error::Invalid),
33393            };
33394            Ok(v)
33395        })
33396    }
33397}
33398
33399impl WriteXdr for FeeBumpTransactionExt {
33400    #[cfg(feature = "std")]
33401    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
33402        w.with_limited_depth(|w| {
33403            self.discriminant().write_xdr(w)?;
33404            #[allow(clippy::match_same_arms)]
33405            match self {
33406                Self::V0 => ().write_xdr(w)?,
33407            };
33408            Ok(())
33409        })
33410    }
33411}
33412
33413/// FeeBumpTransaction is an XDR Struct defines as:
33414///
33415/// ```text
33416/// struct FeeBumpTransaction
33417/// {
33418///     MuxedAccount feeSource;
33419///     int64 fee;
33420///     union switch (EnvelopeType type)
33421///     {
33422///     case ENVELOPE_TYPE_TX:
33423///         TransactionV1Envelope v1;
33424///     }
33425///     innerTx;
33426///     union switch (int v)
33427///     {
33428///     case 0:
33429///         void;
33430///     }
33431///     ext;
33432/// };
33433/// ```
33434///
33435#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
33436#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
33437#[cfg_attr(
33438    all(feature = "serde", feature = "alloc"),
33439    derive(serde::Serialize, serde::Deserialize),
33440    serde(rename_all = "snake_case")
33441)]
33442#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
33443pub struct FeeBumpTransaction {
33444    pub fee_source: MuxedAccount,
33445    pub fee: i64,
33446    pub inner_tx: FeeBumpTransactionInnerTx,
33447    pub ext: FeeBumpTransactionExt,
33448}
33449
33450impl ReadXdr for FeeBumpTransaction {
33451    #[cfg(feature = "std")]
33452    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
33453        r.with_limited_depth(|r| {
33454            Ok(Self {
33455                fee_source: MuxedAccount::read_xdr(r)?,
33456                fee: i64::read_xdr(r)?,
33457                inner_tx: FeeBumpTransactionInnerTx::read_xdr(r)?,
33458                ext: FeeBumpTransactionExt::read_xdr(r)?,
33459            })
33460        })
33461    }
33462}
33463
33464impl WriteXdr for FeeBumpTransaction {
33465    #[cfg(feature = "std")]
33466    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
33467        w.with_limited_depth(|w| {
33468            self.fee_source.write_xdr(w)?;
33469            self.fee.write_xdr(w)?;
33470            self.inner_tx.write_xdr(w)?;
33471            self.ext.write_xdr(w)?;
33472            Ok(())
33473        })
33474    }
33475}
33476
33477/// FeeBumpTransactionEnvelope is an XDR Struct defines as:
33478///
33479/// ```text
33480/// struct FeeBumpTransactionEnvelope
33481/// {
33482///     FeeBumpTransaction tx;
33483///     /* Each decorated signature is a signature over the SHA256 hash of
33484///      * a TransactionSignaturePayload */
33485///     DecoratedSignature signatures<20>;
33486/// };
33487/// ```
33488///
33489#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
33490#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
33491#[cfg_attr(
33492    all(feature = "serde", feature = "alloc"),
33493    derive(serde::Serialize, serde::Deserialize),
33494    serde(rename_all = "snake_case")
33495)]
33496#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
33497pub struct FeeBumpTransactionEnvelope {
33498    pub tx: FeeBumpTransaction,
33499    pub signatures: VecM<DecoratedSignature, 20>,
33500}
33501
33502impl ReadXdr for FeeBumpTransactionEnvelope {
33503    #[cfg(feature = "std")]
33504    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
33505        r.with_limited_depth(|r| {
33506            Ok(Self {
33507                tx: FeeBumpTransaction::read_xdr(r)?,
33508                signatures: VecM::<DecoratedSignature, 20>::read_xdr(r)?,
33509            })
33510        })
33511    }
33512}
33513
33514impl WriteXdr for FeeBumpTransactionEnvelope {
33515    #[cfg(feature = "std")]
33516    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
33517        w.with_limited_depth(|w| {
33518            self.tx.write_xdr(w)?;
33519            self.signatures.write_xdr(w)?;
33520            Ok(())
33521        })
33522    }
33523}
33524
33525/// TransactionEnvelope is an XDR Union defines as:
33526///
33527/// ```text
33528/// union TransactionEnvelope switch (EnvelopeType type)
33529/// {
33530/// case ENVELOPE_TYPE_TX_V0:
33531///     TransactionV0Envelope v0;
33532/// case ENVELOPE_TYPE_TX:
33533///     TransactionV1Envelope v1;
33534/// case ENVELOPE_TYPE_TX_FEE_BUMP:
33535///     FeeBumpTransactionEnvelope feeBump;
33536/// };
33537/// ```
33538///
33539// union with discriminant EnvelopeType
33540#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
33541#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
33542#[cfg_attr(
33543    all(feature = "serde", feature = "alloc"),
33544    derive(serde::Serialize, serde::Deserialize),
33545    serde(rename_all = "snake_case")
33546)]
33547#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
33548#[allow(clippy::large_enum_variant)]
33549pub enum TransactionEnvelope {
33550    TxV0(TransactionV0Envelope),
33551    Tx(TransactionV1Envelope),
33552    TxFeeBump(FeeBumpTransactionEnvelope),
33553}
33554
33555impl TransactionEnvelope {
33556    pub const VARIANTS: [EnvelopeType; 3] = [
33557        EnvelopeType::TxV0,
33558        EnvelopeType::Tx,
33559        EnvelopeType::TxFeeBump,
33560    ];
33561    pub const VARIANTS_STR: [&'static str; 3] = ["TxV0", "Tx", "TxFeeBump"];
33562
33563    #[must_use]
33564    pub const fn name(&self) -> &'static str {
33565        match self {
33566            Self::TxV0(_) => "TxV0",
33567            Self::Tx(_) => "Tx",
33568            Self::TxFeeBump(_) => "TxFeeBump",
33569        }
33570    }
33571
33572    #[must_use]
33573    pub const fn discriminant(&self) -> EnvelopeType {
33574        #[allow(clippy::match_same_arms)]
33575        match self {
33576            Self::TxV0(_) => EnvelopeType::TxV0,
33577            Self::Tx(_) => EnvelopeType::Tx,
33578            Self::TxFeeBump(_) => EnvelopeType::TxFeeBump,
33579        }
33580    }
33581
33582    #[must_use]
33583    pub const fn variants() -> [EnvelopeType; 3] {
33584        Self::VARIANTS
33585    }
33586}
33587
33588impl Name for TransactionEnvelope {
33589    #[must_use]
33590    fn name(&self) -> &'static str {
33591        Self::name(self)
33592    }
33593}
33594
33595impl Discriminant<EnvelopeType> for TransactionEnvelope {
33596    #[must_use]
33597    fn discriminant(&self) -> EnvelopeType {
33598        Self::discriminant(self)
33599    }
33600}
33601
33602impl Variants<EnvelopeType> for TransactionEnvelope {
33603    fn variants() -> slice::Iter<'static, EnvelopeType> {
33604        Self::VARIANTS.iter()
33605    }
33606}
33607
33608impl Union<EnvelopeType> for TransactionEnvelope {}
33609
33610impl ReadXdr for TransactionEnvelope {
33611    #[cfg(feature = "std")]
33612    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
33613        r.with_limited_depth(|r| {
33614            let dv: EnvelopeType = <EnvelopeType as ReadXdr>::read_xdr(r)?;
33615            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
33616            let v = match dv {
33617                EnvelopeType::TxV0 => Self::TxV0(TransactionV0Envelope::read_xdr(r)?),
33618                EnvelopeType::Tx => Self::Tx(TransactionV1Envelope::read_xdr(r)?),
33619                EnvelopeType::TxFeeBump => {
33620                    Self::TxFeeBump(FeeBumpTransactionEnvelope::read_xdr(r)?)
33621                }
33622                #[allow(unreachable_patterns)]
33623                _ => return Err(Error::Invalid),
33624            };
33625            Ok(v)
33626        })
33627    }
33628}
33629
33630impl WriteXdr for TransactionEnvelope {
33631    #[cfg(feature = "std")]
33632    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
33633        w.with_limited_depth(|w| {
33634            self.discriminant().write_xdr(w)?;
33635            #[allow(clippy::match_same_arms)]
33636            match self {
33637                Self::TxV0(v) => v.write_xdr(w)?,
33638                Self::Tx(v) => v.write_xdr(w)?,
33639                Self::TxFeeBump(v) => v.write_xdr(w)?,
33640            };
33641            Ok(())
33642        })
33643    }
33644}
33645
33646/// TransactionSignaturePayloadTaggedTransaction is an XDR NestedUnion defines as:
33647///
33648/// ```text
33649/// union switch (EnvelopeType type)
33650///     {
33651///     // Backwards Compatibility: Use ENVELOPE_TYPE_TX to sign ENVELOPE_TYPE_TX_V0
33652///     case ENVELOPE_TYPE_TX:
33653///         Transaction tx;
33654///     case ENVELOPE_TYPE_TX_FEE_BUMP:
33655///         FeeBumpTransaction feeBump;
33656///     }
33657/// ```
33658///
33659// union with discriminant EnvelopeType
33660#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
33661#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
33662#[cfg_attr(
33663    all(feature = "serde", feature = "alloc"),
33664    derive(serde::Serialize, serde::Deserialize),
33665    serde(rename_all = "snake_case")
33666)]
33667#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
33668#[allow(clippy::large_enum_variant)]
33669pub enum TransactionSignaturePayloadTaggedTransaction {
33670    Tx(Transaction),
33671    TxFeeBump(FeeBumpTransaction),
33672}
33673
33674impl TransactionSignaturePayloadTaggedTransaction {
33675    pub const VARIANTS: [EnvelopeType; 2] = [EnvelopeType::Tx, EnvelopeType::TxFeeBump];
33676    pub const VARIANTS_STR: [&'static str; 2] = ["Tx", "TxFeeBump"];
33677
33678    #[must_use]
33679    pub const fn name(&self) -> &'static str {
33680        match self {
33681            Self::Tx(_) => "Tx",
33682            Self::TxFeeBump(_) => "TxFeeBump",
33683        }
33684    }
33685
33686    #[must_use]
33687    pub const fn discriminant(&self) -> EnvelopeType {
33688        #[allow(clippy::match_same_arms)]
33689        match self {
33690            Self::Tx(_) => EnvelopeType::Tx,
33691            Self::TxFeeBump(_) => EnvelopeType::TxFeeBump,
33692        }
33693    }
33694
33695    #[must_use]
33696    pub const fn variants() -> [EnvelopeType; 2] {
33697        Self::VARIANTS
33698    }
33699}
33700
33701impl Name for TransactionSignaturePayloadTaggedTransaction {
33702    #[must_use]
33703    fn name(&self) -> &'static str {
33704        Self::name(self)
33705    }
33706}
33707
33708impl Discriminant<EnvelopeType> for TransactionSignaturePayloadTaggedTransaction {
33709    #[must_use]
33710    fn discriminant(&self) -> EnvelopeType {
33711        Self::discriminant(self)
33712    }
33713}
33714
33715impl Variants<EnvelopeType> for TransactionSignaturePayloadTaggedTransaction {
33716    fn variants() -> slice::Iter<'static, EnvelopeType> {
33717        Self::VARIANTS.iter()
33718    }
33719}
33720
33721impl Union<EnvelopeType> for TransactionSignaturePayloadTaggedTransaction {}
33722
33723impl ReadXdr for TransactionSignaturePayloadTaggedTransaction {
33724    #[cfg(feature = "std")]
33725    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
33726        r.with_limited_depth(|r| {
33727            let dv: EnvelopeType = <EnvelopeType as ReadXdr>::read_xdr(r)?;
33728            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
33729            let v = match dv {
33730                EnvelopeType::Tx => Self::Tx(Transaction::read_xdr(r)?),
33731                EnvelopeType::TxFeeBump => Self::TxFeeBump(FeeBumpTransaction::read_xdr(r)?),
33732                #[allow(unreachable_patterns)]
33733                _ => return Err(Error::Invalid),
33734            };
33735            Ok(v)
33736        })
33737    }
33738}
33739
33740impl WriteXdr for TransactionSignaturePayloadTaggedTransaction {
33741    #[cfg(feature = "std")]
33742    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
33743        w.with_limited_depth(|w| {
33744            self.discriminant().write_xdr(w)?;
33745            #[allow(clippy::match_same_arms)]
33746            match self {
33747                Self::Tx(v) => v.write_xdr(w)?,
33748                Self::TxFeeBump(v) => v.write_xdr(w)?,
33749            };
33750            Ok(())
33751        })
33752    }
33753}
33754
33755/// TransactionSignaturePayload is an XDR Struct defines as:
33756///
33757/// ```text
33758/// struct TransactionSignaturePayload
33759/// {
33760///     Hash networkId;
33761///     union switch (EnvelopeType type)
33762///     {
33763///     // Backwards Compatibility: Use ENVELOPE_TYPE_TX to sign ENVELOPE_TYPE_TX_V0
33764///     case ENVELOPE_TYPE_TX:
33765///         Transaction tx;
33766///     case ENVELOPE_TYPE_TX_FEE_BUMP:
33767///         FeeBumpTransaction feeBump;
33768///     }
33769///     taggedTransaction;
33770/// };
33771/// ```
33772///
33773#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
33774#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
33775#[cfg_attr(
33776    all(feature = "serde", feature = "alloc"),
33777    derive(serde::Serialize, serde::Deserialize),
33778    serde(rename_all = "snake_case")
33779)]
33780#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
33781pub struct TransactionSignaturePayload {
33782    pub network_id: Hash,
33783    pub tagged_transaction: TransactionSignaturePayloadTaggedTransaction,
33784}
33785
33786impl ReadXdr for TransactionSignaturePayload {
33787    #[cfg(feature = "std")]
33788    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
33789        r.with_limited_depth(|r| {
33790            Ok(Self {
33791                network_id: Hash::read_xdr(r)?,
33792                tagged_transaction: TransactionSignaturePayloadTaggedTransaction::read_xdr(r)?,
33793            })
33794        })
33795    }
33796}
33797
33798impl WriteXdr for TransactionSignaturePayload {
33799    #[cfg(feature = "std")]
33800    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
33801        w.with_limited_depth(|w| {
33802            self.network_id.write_xdr(w)?;
33803            self.tagged_transaction.write_xdr(w)?;
33804            Ok(())
33805        })
33806    }
33807}
33808
33809/// ClaimAtomType is an XDR Enum defines as:
33810///
33811/// ```text
33812/// enum ClaimAtomType
33813/// {
33814///     CLAIM_ATOM_TYPE_V0 = 0,
33815///     CLAIM_ATOM_TYPE_ORDER_BOOK = 1,
33816///     CLAIM_ATOM_TYPE_LIQUIDITY_POOL = 2
33817/// };
33818/// ```
33819///
33820// enum
33821#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
33822#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
33823#[cfg_attr(
33824    all(feature = "serde", feature = "alloc"),
33825    derive(serde::Serialize, serde::Deserialize),
33826    serde(rename_all = "snake_case")
33827)]
33828#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
33829#[repr(i32)]
33830pub enum ClaimAtomType {
33831    V0 = 0,
33832    OrderBook = 1,
33833    LiquidityPool = 2,
33834}
33835
33836impl ClaimAtomType {
33837    pub const VARIANTS: [ClaimAtomType; 3] = [
33838        ClaimAtomType::V0,
33839        ClaimAtomType::OrderBook,
33840        ClaimAtomType::LiquidityPool,
33841    ];
33842    pub const VARIANTS_STR: [&'static str; 3] = ["V0", "OrderBook", "LiquidityPool"];
33843
33844    #[must_use]
33845    pub const fn name(&self) -> &'static str {
33846        match self {
33847            Self::V0 => "V0",
33848            Self::OrderBook => "OrderBook",
33849            Self::LiquidityPool => "LiquidityPool",
33850        }
33851    }
33852
33853    #[must_use]
33854    pub const fn variants() -> [ClaimAtomType; 3] {
33855        Self::VARIANTS
33856    }
33857}
33858
33859impl Name for ClaimAtomType {
33860    #[must_use]
33861    fn name(&self) -> &'static str {
33862        Self::name(self)
33863    }
33864}
33865
33866impl Variants<ClaimAtomType> for ClaimAtomType {
33867    fn variants() -> slice::Iter<'static, ClaimAtomType> {
33868        Self::VARIANTS.iter()
33869    }
33870}
33871
33872impl Enum for ClaimAtomType {}
33873
33874impl fmt::Display for ClaimAtomType {
33875    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
33876        f.write_str(self.name())
33877    }
33878}
33879
33880impl TryFrom<i32> for ClaimAtomType {
33881    type Error = Error;
33882
33883    fn try_from(i: i32) -> Result<Self> {
33884        let e = match i {
33885            0 => ClaimAtomType::V0,
33886            1 => ClaimAtomType::OrderBook,
33887            2 => ClaimAtomType::LiquidityPool,
33888            #[allow(unreachable_patterns)]
33889            _ => return Err(Error::Invalid),
33890        };
33891        Ok(e)
33892    }
33893}
33894
33895impl From<ClaimAtomType> for i32 {
33896    #[must_use]
33897    fn from(e: ClaimAtomType) -> Self {
33898        e as Self
33899    }
33900}
33901
33902impl ReadXdr for ClaimAtomType {
33903    #[cfg(feature = "std")]
33904    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
33905        r.with_limited_depth(|r| {
33906            let e = i32::read_xdr(r)?;
33907            let v: Self = e.try_into()?;
33908            Ok(v)
33909        })
33910    }
33911}
33912
33913impl WriteXdr for ClaimAtomType {
33914    #[cfg(feature = "std")]
33915    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
33916        w.with_limited_depth(|w| {
33917            let i: i32 = (*self).into();
33918            i.write_xdr(w)
33919        })
33920    }
33921}
33922
33923/// ClaimOfferAtomV0 is an XDR Struct defines as:
33924///
33925/// ```text
33926/// struct ClaimOfferAtomV0
33927/// {
33928///     // emitted to identify the offer
33929///     uint256 sellerEd25519; // Account that owns the offer
33930///     int64 offerID;
33931///
33932///     // amount and asset taken from the owner
33933///     Asset assetSold;
33934///     int64 amountSold;
33935///
33936///     // amount and asset sent to the owner
33937///     Asset assetBought;
33938///     int64 amountBought;
33939/// };
33940/// ```
33941///
33942#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
33943#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
33944#[cfg_attr(
33945    all(feature = "serde", feature = "alloc"),
33946    derive(serde::Serialize, serde::Deserialize),
33947    serde(rename_all = "snake_case")
33948)]
33949#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
33950pub struct ClaimOfferAtomV0 {
33951    pub seller_ed25519: Uint256,
33952    pub offer_id: i64,
33953    pub asset_sold: Asset,
33954    pub amount_sold: i64,
33955    pub asset_bought: Asset,
33956    pub amount_bought: i64,
33957}
33958
33959impl ReadXdr for ClaimOfferAtomV0 {
33960    #[cfg(feature = "std")]
33961    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
33962        r.with_limited_depth(|r| {
33963            Ok(Self {
33964                seller_ed25519: Uint256::read_xdr(r)?,
33965                offer_id: i64::read_xdr(r)?,
33966                asset_sold: Asset::read_xdr(r)?,
33967                amount_sold: i64::read_xdr(r)?,
33968                asset_bought: Asset::read_xdr(r)?,
33969                amount_bought: i64::read_xdr(r)?,
33970            })
33971        })
33972    }
33973}
33974
33975impl WriteXdr for ClaimOfferAtomV0 {
33976    #[cfg(feature = "std")]
33977    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
33978        w.with_limited_depth(|w| {
33979            self.seller_ed25519.write_xdr(w)?;
33980            self.offer_id.write_xdr(w)?;
33981            self.asset_sold.write_xdr(w)?;
33982            self.amount_sold.write_xdr(w)?;
33983            self.asset_bought.write_xdr(w)?;
33984            self.amount_bought.write_xdr(w)?;
33985            Ok(())
33986        })
33987    }
33988}
33989
33990/// ClaimOfferAtom is an XDR Struct defines as:
33991///
33992/// ```text
33993/// struct ClaimOfferAtom
33994/// {
33995///     // emitted to identify the offer
33996///     AccountID sellerID; // Account that owns the offer
33997///     int64 offerID;
33998///
33999///     // amount and asset taken from the owner
34000///     Asset assetSold;
34001///     int64 amountSold;
34002///
34003///     // amount and asset sent to the owner
34004///     Asset assetBought;
34005///     int64 amountBought;
34006/// };
34007/// ```
34008///
34009#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
34010#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
34011#[cfg_attr(
34012    all(feature = "serde", feature = "alloc"),
34013    derive(serde::Serialize, serde::Deserialize),
34014    serde(rename_all = "snake_case")
34015)]
34016#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
34017pub struct ClaimOfferAtom {
34018    pub seller_id: AccountId,
34019    pub offer_id: i64,
34020    pub asset_sold: Asset,
34021    pub amount_sold: i64,
34022    pub asset_bought: Asset,
34023    pub amount_bought: i64,
34024}
34025
34026impl ReadXdr for ClaimOfferAtom {
34027    #[cfg(feature = "std")]
34028    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
34029        r.with_limited_depth(|r| {
34030            Ok(Self {
34031                seller_id: AccountId::read_xdr(r)?,
34032                offer_id: i64::read_xdr(r)?,
34033                asset_sold: Asset::read_xdr(r)?,
34034                amount_sold: i64::read_xdr(r)?,
34035                asset_bought: Asset::read_xdr(r)?,
34036                amount_bought: i64::read_xdr(r)?,
34037            })
34038        })
34039    }
34040}
34041
34042impl WriteXdr for ClaimOfferAtom {
34043    #[cfg(feature = "std")]
34044    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
34045        w.with_limited_depth(|w| {
34046            self.seller_id.write_xdr(w)?;
34047            self.offer_id.write_xdr(w)?;
34048            self.asset_sold.write_xdr(w)?;
34049            self.amount_sold.write_xdr(w)?;
34050            self.asset_bought.write_xdr(w)?;
34051            self.amount_bought.write_xdr(w)?;
34052            Ok(())
34053        })
34054    }
34055}
34056
34057/// ClaimLiquidityAtom is an XDR Struct defines as:
34058///
34059/// ```text
34060/// struct ClaimLiquidityAtom
34061/// {
34062///     PoolID liquidityPoolID;
34063///
34064///     // amount and asset taken from the pool
34065///     Asset assetSold;
34066///     int64 amountSold;
34067///
34068///     // amount and asset sent to the pool
34069///     Asset assetBought;
34070///     int64 amountBought;
34071/// };
34072/// ```
34073///
34074#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
34075#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
34076#[cfg_attr(
34077    all(feature = "serde", feature = "alloc"),
34078    derive(serde::Serialize, serde::Deserialize),
34079    serde(rename_all = "snake_case")
34080)]
34081#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
34082pub struct ClaimLiquidityAtom {
34083    pub liquidity_pool_id: PoolId,
34084    pub asset_sold: Asset,
34085    pub amount_sold: i64,
34086    pub asset_bought: Asset,
34087    pub amount_bought: i64,
34088}
34089
34090impl ReadXdr for ClaimLiquidityAtom {
34091    #[cfg(feature = "std")]
34092    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
34093        r.with_limited_depth(|r| {
34094            Ok(Self {
34095                liquidity_pool_id: PoolId::read_xdr(r)?,
34096                asset_sold: Asset::read_xdr(r)?,
34097                amount_sold: i64::read_xdr(r)?,
34098                asset_bought: Asset::read_xdr(r)?,
34099                amount_bought: i64::read_xdr(r)?,
34100            })
34101        })
34102    }
34103}
34104
34105impl WriteXdr for ClaimLiquidityAtom {
34106    #[cfg(feature = "std")]
34107    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
34108        w.with_limited_depth(|w| {
34109            self.liquidity_pool_id.write_xdr(w)?;
34110            self.asset_sold.write_xdr(w)?;
34111            self.amount_sold.write_xdr(w)?;
34112            self.asset_bought.write_xdr(w)?;
34113            self.amount_bought.write_xdr(w)?;
34114            Ok(())
34115        })
34116    }
34117}
34118
34119/// ClaimAtom is an XDR Union defines as:
34120///
34121/// ```text
34122/// union ClaimAtom switch (ClaimAtomType type)
34123/// {
34124/// case CLAIM_ATOM_TYPE_V0:
34125///     ClaimOfferAtomV0 v0;
34126/// case CLAIM_ATOM_TYPE_ORDER_BOOK:
34127///     ClaimOfferAtom orderBook;
34128/// case CLAIM_ATOM_TYPE_LIQUIDITY_POOL:
34129///     ClaimLiquidityAtom liquidityPool;
34130/// };
34131/// ```
34132///
34133// union with discriminant ClaimAtomType
34134#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
34135#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
34136#[cfg_attr(
34137    all(feature = "serde", feature = "alloc"),
34138    derive(serde::Serialize, serde::Deserialize),
34139    serde(rename_all = "snake_case")
34140)]
34141#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
34142#[allow(clippy::large_enum_variant)]
34143pub enum ClaimAtom {
34144    V0(ClaimOfferAtomV0),
34145    OrderBook(ClaimOfferAtom),
34146    LiquidityPool(ClaimLiquidityAtom),
34147}
34148
34149impl ClaimAtom {
34150    pub const VARIANTS: [ClaimAtomType; 3] = [
34151        ClaimAtomType::V0,
34152        ClaimAtomType::OrderBook,
34153        ClaimAtomType::LiquidityPool,
34154    ];
34155    pub const VARIANTS_STR: [&'static str; 3] = ["V0", "OrderBook", "LiquidityPool"];
34156
34157    #[must_use]
34158    pub const fn name(&self) -> &'static str {
34159        match self {
34160            Self::V0(_) => "V0",
34161            Self::OrderBook(_) => "OrderBook",
34162            Self::LiquidityPool(_) => "LiquidityPool",
34163        }
34164    }
34165
34166    #[must_use]
34167    pub const fn discriminant(&self) -> ClaimAtomType {
34168        #[allow(clippy::match_same_arms)]
34169        match self {
34170            Self::V0(_) => ClaimAtomType::V0,
34171            Self::OrderBook(_) => ClaimAtomType::OrderBook,
34172            Self::LiquidityPool(_) => ClaimAtomType::LiquidityPool,
34173        }
34174    }
34175
34176    #[must_use]
34177    pub const fn variants() -> [ClaimAtomType; 3] {
34178        Self::VARIANTS
34179    }
34180}
34181
34182impl Name for ClaimAtom {
34183    #[must_use]
34184    fn name(&self) -> &'static str {
34185        Self::name(self)
34186    }
34187}
34188
34189impl Discriminant<ClaimAtomType> for ClaimAtom {
34190    #[must_use]
34191    fn discriminant(&self) -> ClaimAtomType {
34192        Self::discriminant(self)
34193    }
34194}
34195
34196impl Variants<ClaimAtomType> for ClaimAtom {
34197    fn variants() -> slice::Iter<'static, ClaimAtomType> {
34198        Self::VARIANTS.iter()
34199    }
34200}
34201
34202impl Union<ClaimAtomType> for ClaimAtom {}
34203
34204impl ReadXdr for ClaimAtom {
34205    #[cfg(feature = "std")]
34206    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
34207        r.with_limited_depth(|r| {
34208            let dv: ClaimAtomType = <ClaimAtomType as ReadXdr>::read_xdr(r)?;
34209            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
34210            let v = match dv {
34211                ClaimAtomType::V0 => Self::V0(ClaimOfferAtomV0::read_xdr(r)?),
34212                ClaimAtomType::OrderBook => Self::OrderBook(ClaimOfferAtom::read_xdr(r)?),
34213                ClaimAtomType::LiquidityPool => {
34214                    Self::LiquidityPool(ClaimLiquidityAtom::read_xdr(r)?)
34215                }
34216                #[allow(unreachable_patterns)]
34217                _ => return Err(Error::Invalid),
34218            };
34219            Ok(v)
34220        })
34221    }
34222}
34223
34224impl WriteXdr for ClaimAtom {
34225    #[cfg(feature = "std")]
34226    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
34227        w.with_limited_depth(|w| {
34228            self.discriminant().write_xdr(w)?;
34229            #[allow(clippy::match_same_arms)]
34230            match self {
34231                Self::V0(v) => v.write_xdr(w)?,
34232                Self::OrderBook(v) => v.write_xdr(w)?,
34233                Self::LiquidityPool(v) => v.write_xdr(w)?,
34234            };
34235            Ok(())
34236        })
34237    }
34238}
34239
34240/// CreateAccountResultCode is an XDR Enum defines as:
34241///
34242/// ```text
34243/// enum CreateAccountResultCode
34244/// {
34245///     // codes considered as "success" for the operation
34246///     CREATE_ACCOUNT_SUCCESS = 0, // account was created
34247///
34248///     // codes considered as "failure" for the operation
34249///     CREATE_ACCOUNT_MALFORMED = -1,   // invalid destination
34250///     CREATE_ACCOUNT_UNDERFUNDED = -2, // not enough funds in source account
34251///     CREATE_ACCOUNT_LOW_RESERVE =
34252///         -3, // would create an account below the min reserve
34253///     CREATE_ACCOUNT_ALREADY_EXIST = -4 // account already exists
34254/// };
34255/// ```
34256///
34257// enum
34258#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
34259#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
34260#[cfg_attr(
34261    all(feature = "serde", feature = "alloc"),
34262    derive(serde::Serialize, serde::Deserialize),
34263    serde(rename_all = "snake_case")
34264)]
34265#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
34266#[repr(i32)]
34267pub enum CreateAccountResultCode {
34268    Success = 0,
34269    Malformed = -1,
34270    Underfunded = -2,
34271    LowReserve = -3,
34272    AlreadyExist = -4,
34273}
34274
34275impl CreateAccountResultCode {
34276    pub const VARIANTS: [CreateAccountResultCode; 5] = [
34277        CreateAccountResultCode::Success,
34278        CreateAccountResultCode::Malformed,
34279        CreateAccountResultCode::Underfunded,
34280        CreateAccountResultCode::LowReserve,
34281        CreateAccountResultCode::AlreadyExist,
34282    ];
34283    pub const VARIANTS_STR: [&'static str; 5] = [
34284        "Success",
34285        "Malformed",
34286        "Underfunded",
34287        "LowReserve",
34288        "AlreadyExist",
34289    ];
34290
34291    #[must_use]
34292    pub const fn name(&self) -> &'static str {
34293        match self {
34294            Self::Success => "Success",
34295            Self::Malformed => "Malformed",
34296            Self::Underfunded => "Underfunded",
34297            Self::LowReserve => "LowReserve",
34298            Self::AlreadyExist => "AlreadyExist",
34299        }
34300    }
34301
34302    #[must_use]
34303    pub const fn variants() -> [CreateAccountResultCode; 5] {
34304        Self::VARIANTS
34305    }
34306}
34307
34308impl Name for CreateAccountResultCode {
34309    #[must_use]
34310    fn name(&self) -> &'static str {
34311        Self::name(self)
34312    }
34313}
34314
34315impl Variants<CreateAccountResultCode> for CreateAccountResultCode {
34316    fn variants() -> slice::Iter<'static, CreateAccountResultCode> {
34317        Self::VARIANTS.iter()
34318    }
34319}
34320
34321impl Enum for CreateAccountResultCode {}
34322
34323impl fmt::Display for CreateAccountResultCode {
34324    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
34325        f.write_str(self.name())
34326    }
34327}
34328
34329impl TryFrom<i32> for CreateAccountResultCode {
34330    type Error = Error;
34331
34332    fn try_from(i: i32) -> Result<Self> {
34333        let e = match i {
34334            0 => CreateAccountResultCode::Success,
34335            -1 => CreateAccountResultCode::Malformed,
34336            -2 => CreateAccountResultCode::Underfunded,
34337            -3 => CreateAccountResultCode::LowReserve,
34338            -4 => CreateAccountResultCode::AlreadyExist,
34339            #[allow(unreachable_patterns)]
34340            _ => return Err(Error::Invalid),
34341        };
34342        Ok(e)
34343    }
34344}
34345
34346impl From<CreateAccountResultCode> for i32 {
34347    #[must_use]
34348    fn from(e: CreateAccountResultCode) -> Self {
34349        e as Self
34350    }
34351}
34352
34353impl ReadXdr for CreateAccountResultCode {
34354    #[cfg(feature = "std")]
34355    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
34356        r.with_limited_depth(|r| {
34357            let e = i32::read_xdr(r)?;
34358            let v: Self = e.try_into()?;
34359            Ok(v)
34360        })
34361    }
34362}
34363
34364impl WriteXdr for CreateAccountResultCode {
34365    #[cfg(feature = "std")]
34366    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
34367        w.with_limited_depth(|w| {
34368            let i: i32 = (*self).into();
34369            i.write_xdr(w)
34370        })
34371    }
34372}
34373
34374/// CreateAccountResult is an XDR Union defines as:
34375///
34376/// ```text
34377/// union CreateAccountResult switch (CreateAccountResultCode code)
34378/// {
34379/// case CREATE_ACCOUNT_SUCCESS:
34380///     void;
34381/// case CREATE_ACCOUNT_MALFORMED:
34382/// case CREATE_ACCOUNT_UNDERFUNDED:
34383/// case CREATE_ACCOUNT_LOW_RESERVE:
34384/// case CREATE_ACCOUNT_ALREADY_EXIST:
34385///     void;
34386/// };
34387/// ```
34388///
34389// union with discriminant CreateAccountResultCode
34390#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
34391#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
34392#[cfg_attr(
34393    all(feature = "serde", feature = "alloc"),
34394    derive(serde::Serialize, serde::Deserialize),
34395    serde(rename_all = "snake_case")
34396)]
34397#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
34398#[allow(clippy::large_enum_variant)]
34399pub enum CreateAccountResult {
34400    Success,
34401    Malformed,
34402    Underfunded,
34403    LowReserve,
34404    AlreadyExist,
34405}
34406
34407impl CreateAccountResult {
34408    pub const VARIANTS: [CreateAccountResultCode; 5] = [
34409        CreateAccountResultCode::Success,
34410        CreateAccountResultCode::Malformed,
34411        CreateAccountResultCode::Underfunded,
34412        CreateAccountResultCode::LowReserve,
34413        CreateAccountResultCode::AlreadyExist,
34414    ];
34415    pub const VARIANTS_STR: [&'static str; 5] = [
34416        "Success",
34417        "Malformed",
34418        "Underfunded",
34419        "LowReserve",
34420        "AlreadyExist",
34421    ];
34422
34423    #[must_use]
34424    pub const fn name(&self) -> &'static str {
34425        match self {
34426            Self::Success => "Success",
34427            Self::Malformed => "Malformed",
34428            Self::Underfunded => "Underfunded",
34429            Self::LowReserve => "LowReserve",
34430            Self::AlreadyExist => "AlreadyExist",
34431        }
34432    }
34433
34434    #[must_use]
34435    pub const fn discriminant(&self) -> CreateAccountResultCode {
34436        #[allow(clippy::match_same_arms)]
34437        match self {
34438            Self::Success => CreateAccountResultCode::Success,
34439            Self::Malformed => CreateAccountResultCode::Malformed,
34440            Self::Underfunded => CreateAccountResultCode::Underfunded,
34441            Self::LowReserve => CreateAccountResultCode::LowReserve,
34442            Self::AlreadyExist => CreateAccountResultCode::AlreadyExist,
34443        }
34444    }
34445
34446    #[must_use]
34447    pub const fn variants() -> [CreateAccountResultCode; 5] {
34448        Self::VARIANTS
34449    }
34450}
34451
34452impl Name for CreateAccountResult {
34453    #[must_use]
34454    fn name(&self) -> &'static str {
34455        Self::name(self)
34456    }
34457}
34458
34459impl Discriminant<CreateAccountResultCode> for CreateAccountResult {
34460    #[must_use]
34461    fn discriminant(&self) -> CreateAccountResultCode {
34462        Self::discriminant(self)
34463    }
34464}
34465
34466impl Variants<CreateAccountResultCode> for CreateAccountResult {
34467    fn variants() -> slice::Iter<'static, CreateAccountResultCode> {
34468        Self::VARIANTS.iter()
34469    }
34470}
34471
34472impl Union<CreateAccountResultCode> for CreateAccountResult {}
34473
34474impl ReadXdr for CreateAccountResult {
34475    #[cfg(feature = "std")]
34476    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
34477        r.with_limited_depth(|r| {
34478            let dv: CreateAccountResultCode = <CreateAccountResultCode as ReadXdr>::read_xdr(r)?;
34479            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
34480            let v = match dv {
34481                CreateAccountResultCode::Success => Self::Success,
34482                CreateAccountResultCode::Malformed => Self::Malformed,
34483                CreateAccountResultCode::Underfunded => Self::Underfunded,
34484                CreateAccountResultCode::LowReserve => Self::LowReserve,
34485                CreateAccountResultCode::AlreadyExist => Self::AlreadyExist,
34486                #[allow(unreachable_patterns)]
34487                _ => return Err(Error::Invalid),
34488            };
34489            Ok(v)
34490        })
34491    }
34492}
34493
34494impl WriteXdr for CreateAccountResult {
34495    #[cfg(feature = "std")]
34496    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
34497        w.with_limited_depth(|w| {
34498            self.discriminant().write_xdr(w)?;
34499            #[allow(clippy::match_same_arms)]
34500            match self {
34501                Self::Success => ().write_xdr(w)?,
34502                Self::Malformed => ().write_xdr(w)?,
34503                Self::Underfunded => ().write_xdr(w)?,
34504                Self::LowReserve => ().write_xdr(w)?,
34505                Self::AlreadyExist => ().write_xdr(w)?,
34506            };
34507            Ok(())
34508        })
34509    }
34510}
34511
34512/// PaymentResultCode is an XDR Enum defines as:
34513///
34514/// ```text
34515/// enum PaymentResultCode
34516/// {
34517///     // codes considered as "success" for the operation
34518///     PAYMENT_SUCCESS = 0, // payment successfully completed
34519///
34520///     // codes considered as "failure" for the operation
34521///     PAYMENT_MALFORMED = -1,          // bad input
34522///     PAYMENT_UNDERFUNDED = -2,        // not enough funds in source account
34523///     PAYMENT_SRC_NO_TRUST = -3,       // no trust line on source account
34524///     PAYMENT_SRC_NOT_AUTHORIZED = -4, // source not authorized to transfer
34525///     PAYMENT_NO_DESTINATION = -5,     // destination account does not exist
34526///     PAYMENT_NO_TRUST = -6,       // destination missing a trust line for asset
34527///     PAYMENT_NOT_AUTHORIZED = -7, // destination not authorized to hold asset
34528///     PAYMENT_LINE_FULL = -8,      // destination would go above their limit
34529///     PAYMENT_NO_ISSUER = -9       // missing issuer on asset
34530/// };
34531/// ```
34532///
34533// enum
34534#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
34535#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
34536#[cfg_attr(
34537    all(feature = "serde", feature = "alloc"),
34538    derive(serde::Serialize, serde::Deserialize),
34539    serde(rename_all = "snake_case")
34540)]
34541#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
34542#[repr(i32)]
34543pub enum PaymentResultCode {
34544    Success = 0,
34545    Malformed = -1,
34546    Underfunded = -2,
34547    SrcNoTrust = -3,
34548    SrcNotAuthorized = -4,
34549    NoDestination = -5,
34550    NoTrust = -6,
34551    NotAuthorized = -7,
34552    LineFull = -8,
34553    NoIssuer = -9,
34554}
34555
34556impl PaymentResultCode {
34557    pub const VARIANTS: [PaymentResultCode; 10] = [
34558        PaymentResultCode::Success,
34559        PaymentResultCode::Malformed,
34560        PaymentResultCode::Underfunded,
34561        PaymentResultCode::SrcNoTrust,
34562        PaymentResultCode::SrcNotAuthorized,
34563        PaymentResultCode::NoDestination,
34564        PaymentResultCode::NoTrust,
34565        PaymentResultCode::NotAuthorized,
34566        PaymentResultCode::LineFull,
34567        PaymentResultCode::NoIssuer,
34568    ];
34569    pub const VARIANTS_STR: [&'static str; 10] = [
34570        "Success",
34571        "Malformed",
34572        "Underfunded",
34573        "SrcNoTrust",
34574        "SrcNotAuthorized",
34575        "NoDestination",
34576        "NoTrust",
34577        "NotAuthorized",
34578        "LineFull",
34579        "NoIssuer",
34580    ];
34581
34582    #[must_use]
34583    pub const fn name(&self) -> &'static str {
34584        match self {
34585            Self::Success => "Success",
34586            Self::Malformed => "Malformed",
34587            Self::Underfunded => "Underfunded",
34588            Self::SrcNoTrust => "SrcNoTrust",
34589            Self::SrcNotAuthorized => "SrcNotAuthorized",
34590            Self::NoDestination => "NoDestination",
34591            Self::NoTrust => "NoTrust",
34592            Self::NotAuthorized => "NotAuthorized",
34593            Self::LineFull => "LineFull",
34594            Self::NoIssuer => "NoIssuer",
34595        }
34596    }
34597
34598    #[must_use]
34599    pub const fn variants() -> [PaymentResultCode; 10] {
34600        Self::VARIANTS
34601    }
34602}
34603
34604impl Name for PaymentResultCode {
34605    #[must_use]
34606    fn name(&self) -> &'static str {
34607        Self::name(self)
34608    }
34609}
34610
34611impl Variants<PaymentResultCode> for PaymentResultCode {
34612    fn variants() -> slice::Iter<'static, PaymentResultCode> {
34613        Self::VARIANTS.iter()
34614    }
34615}
34616
34617impl Enum for PaymentResultCode {}
34618
34619impl fmt::Display for PaymentResultCode {
34620    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
34621        f.write_str(self.name())
34622    }
34623}
34624
34625impl TryFrom<i32> for PaymentResultCode {
34626    type Error = Error;
34627
34628    fn try_from(i: i32) -> Result<Self> {
34629        let e = match i {
34630            0 => PaymentResultCode::Success,
34631            -1 => PaymentResultCode::Malformed,
34632            -2 => PaymentResultCode::Underfunded,
34633            -3 => PaymentResultCode::SrcNoTrust,
34634            -4 => PaymentResultCode::SrcNotAuthorized,
34635            -5 => PaymentResultCode::NoDestination,
34636            -6 => PaymentResultCode::NoTrust,
34637            -7 => PaymentResultCode::NotAuthorized,
34638            -8 => PaymentResultCode::LineFull,
34639            -9 => PaymentResultCode::NoIssuer,
34640            #[allow(unreachable_patterns)]
34641            _ => return Err(Error::Invalid),
34642        };
34643        Ok(e)
34644    }
34645}
34646
34647impl From<PaymentResultCode> for i32 {
34648    #[must_use]
34649    fn from(e: PaymentResultCode) -> Self {
34650        e as Self
34651    }
34652}
34653
34654impl ReadXdr for PaymentResultCode {
34655    #[cfg(feature = "std")]
34656    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
34657        r.with_limited_depth(|r| {
34658            let e = i32::read_xdr(r)?;
34659            let v: Self = e.try_into()?;
34660            Ok(v)
34661        })
34662    }
34663}
34664
34665impl WriteXdr for PaymentResultCode {
34666    #[cfg(feature = "std")]
34667    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
34668        w.with_limited_depth(|w| {
34669            let i: i32 = (*self).into();
34670            i.write_xdr(w)
34671        })
34672    }
34673}
34674
34675/// PaymentResult is an XDR Union defines as:
34676///
34677/// ```text
34678/// union PaymentResult switch (PaymentResultCode code)
34679/// {
34680/// case PAYMENT_SUCCESS:
34681///     void;
34682/// case PAYMENT_MALFORMED:
34683/// case PAYMENT_UNDERFUNDED:
34684/// case PAYMENT_SRC_NO_TRUST:
34685/// case PAYMENT_SRC_NOT_AUTHORIZED:
34686/// case PAYMENT_NO_DESTINATION:
34687/// case PAYMENT_NO_TRUST:
34688/// case PAYMENT_NOT_AUTHORIZED:
34689/// case PAYMENT_LINE_FULL:
34690/// case PAYMENT_NO_ISSUER:
34691///     void;
34692/// };
34693/// ```
34694///
34695// union with discriminant PaymentResultCode
34696#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
34697#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
34698#[cfg_attr(
34699    all(feature = "serde", feature = "alloc"),
34700    derive(serde::Serialize, serde::Deserialize),
34701    serde(rename_all = "snake_case")
34702)]
34703#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
34704#[allow(clippy::large_enum_variant)]
34705pub enum PaymentResult {
34706    Success,
34707    Malformed,
34708    Underfunded,
34709    SrcNoTrust,
34710    SrcNotAuthorized,
34711    NoDestination,
34712    NoTrust,
34713    NotAuthorized,
34714    LineFull,
34715    NoIssuer,
34716}
34717
34718impl PaymentResult {
34719    pub const VARIANTS: [PaymentResultCode; 10] = [
34720        PaymentResultCode::Success,
34721        PaymentResultCode::Malformed,
34722        PaymentResultCode::Underfunded,
34723        PaymentResultCode::SrcNoTrust,
34724        PaymentResultCode::SrcNotAuthorized,
34725        PaymentResultCode::NoDestination,
34726        PaymentResultCode::NoTrust,
34727        PaymentResultCode::NotAuthorized,
34728        PaymentResultCode::LineFull,
34729        PaymentResultCode::NoIssuer,
34730    ];
34731    pub const VARIANTS_STR: [&'static str; 10] = [
34732        "Success",
34733        "Malformed",
34734        "Underfunded",
34735        "SrcNoTrust",
34736        "SrcNotAuthorized",
34737        "NoDestination",
34738        "NoTrust",
34739        "NotAuthorized",
34740        "LineFull",
34741        "NoIssuer",
34742    ];
34743
34744    #[must_use]
34745    pub const fn name(&self) -> &'static str {
34746        match self {
34747            Self::Success => "Success",
34748            Self::Malformed => "Malformed",
34749            Self::Underfunded => "Underfunded",
34750            Self::SrcNoTrust => "SrcNoTrust",
34751            Self::SrcNotAuthorized => "SrcNotAuthorized",
34752            Self::NoDestination => "NoDestination",
34753            Self::NoTrust => "NoTrust",
34754            Self::NotAuthorized => "NotAuthorized",
34755            Self::LineFull => "LineFull",
34756            Self::NoIssuer => "NoIssuer",
34757        }
34758    }
34759
34760    #[must_use]
34761    pub const fn discriminant(&self) -> PaymentResultCode {
34762        #[allow(clippy::match_same_arms)]
34763        match self {
34764            Self::Success => PaymentResultCode::Success,
34765            Self::Malformed => PaymentResultCode::Malformed,
34766            Self::Underfunded => PaymentResultCode::Underfunded,
34767            Self::SrcNoTrust => PaymentResultCode::SrcNoTrust,
34768            Self::SrcNotAuthorized => PaymentResultCode::SrcNotAuthorized,
34769            Self::NoDestination => PaymentResultCode::NoDestination,
34770            Self::NoTrust => PaymentResultCode::NoTrust,
34771            Self::NotAuthorized => PaymentResultCode::NotAuthorized,
34772            Self::LineFull => PaymentResultCode::LineFull,
34773            Self::NoIssuer => PaymentResultCode::NoIssuer,
34774        }
34775    }
34776
34777    #[must_use]
34778    pub const fn variants() -> [PaymentResultCode; 10] {
34779        Self::VARIANTS
34780    }
34781}
34782
34783impl Name for PaymentResult {
34784    #[must_use]
34785    fn name(&self) -> &'static str {
34786        Self::name(self)
34787    }
34788}
34789
34790impl Discriminant<PaymentResultCode> for PaymentResult {
34791    #[must_use]
34792    fn discriminant(&self) -> PaymentResultCode {
34793        Self::discriminant(self)
34794    }
34795}
34796
34797impl Variants<PaymentResultCode> for PaymentResult {
34798    fn variants() -> slice::Iter<'static, PaymentResultCode> {
34799        Self::VARIANTS.iter()
34800    }
34801}
34802
34803impl Union<PaymentResultCode> for PaymentResult {}
34804
34805impl ReadXdr for PaymentResult {
34806    #[cfg(feature = "std")]
34807    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
34808        r.with_limited_depth(|r| {
34809            let dv: PaymentResultCode = <PaymentResultCode as ReadXdr>::read_xdr(r)?;
34810            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
34811            let v = match dv {
34812                PaymentResultCode::Success => Self::Success,
34813                PaymentResultCode::Malformed => Self::Malformed,
34814                PaymentResultCode::Underfunded => Self::Underfunded,
34815                PaymentResultCode::SrcNoTrust => Self::SrcNoTrust,
34816                PaymentResultCode::SrcNotAuthorized => Self::SrcNotAuthorized,
34817                PaymentResultCode::NoDestination => Self::NoDestination,
34818                PaymentResultCode::NoTrust => Self::NoTrust,
34819                PaymentResultCode::NotAuthorized => Self::NotAuthorized,
34820                PaymentResultCode::LineFull => Self::LineFull,
34821                PaymentResultCode::NoIssuer => Self::NoIssuer,
34822                #[allow(unreachable_patterns)]
34823                _ => return Err(Error::Invalid),
34824            };
34825            Ok(v)
34826        })
34827    }
34828}
34829
34830impl WriteXdr for PaymentResult {
34831    #[cfg(feature = "std")]
34832    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
34833        w.with_limited_depth(|w| {
34834            self.discriminant().write_xdr(w)?;
34835            #[allow(clippy::match_same_arms)]
34836            match self {
34837                Self::Success => ().write_xdr(w)?,
34838                Self::Malformed => ().write_xdr(w)?,
34839                Self::Underfunded => ().write_xdr(w)?,
34840                Self::SrcNoTrust => ().write_xdr(w)?,
34841                Self::SrcNotAuthorized => ().write_xdr(w)?,
34842                Self::NoDestination => ().write_xdr(w)?,
34843                Self::NoTrust => ().write_xdr(w)?,
34844                Self::NotAuthorized => ().write_xdr(w)?,
34845                Self::LineFull => ().write_xdr(w)?,
34846                Self::NoIssuer => ().write_xdr(w)?,
34847            };
34848            Ok(())
34849        })
34850    }
34851}
34852
34853/// PathPaymentStrictReceiveResultCode is an XDR Enum defines as:
34854///
34855/// ```text
34856/// enum PathPaymentStrictReceiveResultCode
34857/// {
34858///     // codes considered as "success" for the operation
34859///     PATH_PAYMENT_STRICT_RECEIVE_SUCCESS = 0, // success
34860///
34861///     // codes considered as "failure" for the operation
34862///     PATH_PAYMENT_STRICT_RECEIVE_MALFORMED = -1, // bad input
34863///     PATH_PAYMENT_STRICT_RECEIVE_UNDERFUNDED =
34864///         -2, // not enough funds in source account
34865///     PATH_PAYMENT_STRICT_RECEIVE_SRC_NO_TRUST =
34866///         -3, // no trust line on source account
34867///     PATH_PAYMENT_STRICT_RECEIVE_SRC_NOT_AUTHORIZED =
34868///         -4, // source not authorized to transfer
34869///     PATH_PAYMENT_STRICT_RECEIVE_NO_DESTINATION =
34870///         -5, // destination account does not exist
34871///     PATH_PAYMENT_STRICT_RECEIVE_NO_TRUST =
34872///         -6, // dest missing a trust line for asset
34873///     PATH_PAYMENT_STRICT_RECEIVE_NOT_AUTHORIZED =
34874///         -7, // dest not authorized to hold asset
34875///     PATH_PAYMENT_STRICT_RECEIVE_LINE_FULL =
34876///         -8, // dest would go above their limit
34877///     PATH_PAYMENT_STRICT_RECEIVE_NO_ISSUER = -9, // missing issuer on one asset
34878///     PATH_PAYMENT_STRICT_RECEIVE_TOO_FEW_OFFERS =
34879///         -10, // not enough offers to satisfy path
34880///     PATH_PAYMENT_STRICT_RECEIVE_OFFER_CROSS_SELF =
34881///         -11, // would cross one of its own offers
34882///     PATH_PAYMENT_STRICT_RECEIVE_OVER_SENDMAX = -12 // could not satisfy sendmax
34883/// };
34884/// ```
34885///
34886// enum
34887#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
34888#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
34889#[cfg_attr(
34890    all(feature = "serde", feature = "alloc"),
34891    derive(serde::Serialize, serde::Deserialize),
34892    serde(rename_all = "snake_case")
34893)]
34894#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
34895#[repr(i32)]
34896pub enum PathPaymentStrictReceiveResultCode {
34897    Success = 0,
34898    Malformed = -1,
34899    Underfunded = -2,
34900    SrcNoTrust = -3,
34901    SrcNotAuthorized = -4,
34902    NoDestination = -5,
34903    NoTrust = -6,
34904    NotAuthorized = -7,
34905    LineFull = -8,
34906    NoIssuer = -9,
34907    TooFewOffers = -10,
34908    OfferCrossSelf = -11,
34909    OverSendmax = -12,
34910}
34911
34912impl PathPaymentStrictReceiveResultCode {
34913    pub const VARIANTS: [PathPaymentStrictReceiveResultCode; 13] = [
34914        PathPaymentStrictReceiveResultCode::Success,
34915        PathPaymentStrictReceiveResultCode::Malformed,
34916        PathPaymentStrictReceiveResultCode::Underfunded,
34917        PathPaymentStrictReceiveResultCode::SrcNoTrust,
34918        PathPaymentStrictReceiveResultCode::SrcNotAuthorized,
34919        PathPaymentStrictReceiveResultCode::NoDestination,
34920        PathPaymentStrictReceiveResultCode::NoTrust,
34921        PathPaymentStrictReceiveResultCode::NotAuthorized,
34922        PathPaymentStrictReceiveResultCode::LineFull,
34923        PathPaymentStrictReceiveResultCode::NoIssuer,
34924        PathPaymentStrictReceiveResultCode::TooFewOffers,
34925        PathPaymentStrictReceiveResultCode::OfferCrossSelf,
34926        PathPaymentStrictReceiveResultCode::OverSendmax,
34927    ];
34928    pub const VARIANTS_STR: [&'static str; 13] = [
34929        "Success",
34930        "Malformed",
34931        "Underfunded",
34932        "SrcNoTrust",
34933        "SrcNotAuthorized",
34934        "NoDestination",
34935        "NoTrust",
34936        "NotAuthorized",
34937        "LineFull",
34938        "NoIssuer",
34939        "TooFewOffers",
34940        "OfferCrossSelf",
34941        "OverSendmax",
34942    ];
34943
34944    #[must_use]
34945    pub const fn name(&self) -> &'static str {
34946        match self {
34947            Self::Success => "Success",
34948            Self::Malformed => "Malformed",
34949            Self::Underfunded => "Underfunded",
34950            Self::SrcNoTrust => "SrcNoTrust",
34951            Self::SrcNotAuthorized => "SrcNotAuthorized",
34952            Self::NoDestination => "NoDestination",
34953            Self::NoTrust => "NoTrust",
34954            Self::NotAuthorized => "NotAuthorized",
34955            Self::LineFull => "LineFull",
34956            Self::NoIssuer => "NoIssuer",
34957            Self::TooFewOffers => "TooFewOffers",
34958            Self::OfferCrossSelf => "OfferCrossSelf",
34959            Self::OverSendmax => "OverSendmax",
34960        }
34961    }
34962
34963    #[must_use]
34964    pub const fn variants() -> [PathPaymentStrictReceiveResultCode; 13] {
34965        Self::VARIANTS
34966    }
34967}
34968
34969impl Name for PathPaymentStrictReceiveResultCode {
34970    #[must_use]
34971    fn name(&self) -> &'static str {
34972        Self::name(self)
34973    }
34974}
34975
34976impl Variants<PathPaymentStrictReceiveResultCode> for PathPaymentStrictReceiveResultCode {
34977    fn variants() -> slice::Iter<'static, PathPaymentStrictReceiveResultCode> {
34978        Self::VARIANTS.iter()
34979    }
34980}
34981
34982impl Enum for PathPaymentStrictReceiveResultCode {}
34983
34984impl fmt::Display for PathPaymentStrictReceiveResultCode {
34985    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
34986        f.write_str(self.name())
34987    }
34988}
34989
34990impl TryFrom<i32> for PathPaymentStrictReceiveResultCode {
34991    type Error = Error;
34992
34993    fn try_from(i: i32) -> Result<Self> {
34994        let e = match i {
34995            0 => PathPaymentStrictReceiveResultCode::Success,
34996            -1 => PathPaymentStrictReceiveResultCode::Malformed,
34997            -2 => PathPaymentStrictReceiveResultCode::Underfunded,
34998            -3 => PathPaymentStrictReceiveResultCode::SrcNoTrust,
34999            -4 => PathPaymentStrictReceiveResultCode::SrcNotAuthorized,
35000            -5 => PathPaymentStrictReceiveResultCode::NoDestination,
35001            -6 => PathPaymentStrictReceiveResultCode::NoTrust,
35002            -7 => PathPaymentStrictReceiveResultCode::NotAuthorized,
35003            -8 => PathPaymentStrictReceiveResultCode::LineFull,
35004            -9 => PathPaymentStrictReceiveResultCode::NoIssuer,
35005            -10 => PathPaymentStrictReceiveResultCode::TooFewOffers,
35006            -11 => PathPaymentStrictReceiveResultCode::OfferCrossSelf,
35007            -12 => PathPaymentStrictReceiveResultCode::OverSendmax,
35008            #[allow(unreachable_patterns)]
35009            _ => return Err(Error::Invalid),
35010        };
35011        Ok(e)
35012    }
35013}
35014
35015impl From<PathPaymentStrictReceiveResultCode> for i32 {
35016    #[must_use]
35017    fn from(e: PathPaymentStrictReceiveResultCode) -> Self {
35018        e as Self
35019    }
35020}
35021
35022impl ReadXdr for PathPaymentStrictReceiveResultCode {
35023    #[cfg(feature = "std")]
35024    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
35025        r.with_limited_depth(|r| {
35026            let e = i32::read_xdr(r)?;
35027            let v: Self = e.try_into()?;
35028            Ok(v)
35029        })
35030    }
35031}
35032
35033impl WriteXdr for PathPaymentStrictReceiveResultCode {
35034    #[cfg(feature = "std")]
35035    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
35036        w.with_limited_depth(|w| {
35037            let i: i32 = (*self).into();
35038            i.write_xdr(w)
35039        })
35040    }
35041}
35042
35043/// SimplePaymentResult is an XDR Struct defines as:
35044///
35045/// ```text
35046/// struct SimplePaymentResult
35047/// {
35048///     AccountID destination;
35049///     Asset asset;
35050///     int64 amount;
35051/// };
35052/// ```
35053///
35054#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
35055#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
35056#[cfg_attr(
35057    all(feature = "serde", feature = "alloc"),
35058    derive(serde::Serialize, serde::Deserialize),
35059    serde(rename_all = "snake_case")
35060)]
35061#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
35062pub struct SimplePaymentResult {
35063    pub destination: AccountId,
35064    pub asset: Asset,
35065    pub amount: i64,
35066}
35067
35068impl ReadXdr for SimplePaymentResult {
35069    #[cfg(feature = "std")]
35070    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
35071        r.with_limited_depth(|r| {
35072            Ok(Self {
35073                destination: AccountId::read_xdr(r)?,
35074                asset: Asset::read_xdr(r)?,
35075                amount: i64::read_xdr(r)?,
35076            })
35077        })
35078    }
35079}
35080
35081impl WriteXdr for SimplePaymentResult {
35082    #[cfg(feature = "std")]
35083    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
35084        w.with_limited_depth(|w| {
35085            self.destination.write_xdr(w)?;
35086            self.asset.write_xdr(w)?;
35087            self.amount.write_xdr(w)?;
35088            Ok(())
35089        })
35090    }
35091}
35092
35093/// PathPaymentStrictReceiveResultSuccess is an XDR NestedStruct defines as:
35094///
35095/// ```text
35096/// struct
35097///     {
35098///         ClaimAtom offers<>;
35099///         SimplePaymentResult last;
35100///     }
35101/// ```
35102///
35103#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
35104#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
35105#[cfg_attr(
35106    all(feature = "serde", feature = "alloc"),
35107    derive(serde::Serialize, serde::Deserialize),
35108    serde(rename_all = "snake_case")
35109)]
35110#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
35111pub struct PathPaymentStrictReceiveResultSuccess {
35112    pub offers: VecM<ClaimAtom>,
35113    pub last: SimplePaymentResult,
35114}
35115
35116impl ReadXdr for PathPaymentStrictReceiveResultSuccess {
35117    #[cfg(feature = "std")]
35118    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
35119        r.with_limited_depth(|r| {
35120            Ok(Self {
35121                offers: VecM::<ClaimAtom>::read_xdr(r)?,
35122                last: SimplePaymentResult::read_xdr(r)?,
35123            })
35124        })
35125    }
35126}
35127
35128impl WriteXdr for PathPaymentStrictReceiveResultSuccess {
35129    #[cfg(feature = "std")]
35130    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
35131        w.with_limited_depth(|w| {
35132            self.offers.write_xdr(w)?;
35133            self.last.write_xdr(w)?;
35134            Ok(())
35135        })
35136    }
35137}
35138
35139/// PathPaymentStrictReceiveResult is an XDR Union defines as:
35140///
35141/// ```text
35142/// union PathPaymentStrictReceiveResult switch (
35143///     PathPaymentStrictReceiveResultCode code)
35144/// {
35145/// case PATH_PAYMENT_STRICT_RECEIVE_SUCCESS:
35146///     struct
35147///     {
35148///         ClaimAtom offers<>;
35149///         SimplePaymentResult last;
35150///     } success;
35151/// case PATH_PAYMENT_STRICT_RECEIVE_MALFORMED:
35152/// case PATH_PAYMENT_STRICT_RECEIVE_UNDERFUNDED:
35153/// case PATH_PAYMENT_STRICT_RECEIVE_SRC_NO_TRUST:
35154/// case PATH_PAYMENT_STRICT_RECEIVE_SRC_NOT_AUTHORIZED:
35155/// case PATH_PAYMENT_STRICT_RECEIVE_NO_DESTINATION:
35156/// case PATH_PAYMENT_STRICT_RECEIVE_NO_TRUST:
35157/// case PATH_PAYMENT_STRICT_RECEIVE_NOT_AUTHORIZED:
35158/// case PATH_PAYMENT_STRICT_RECEIVE_LINE_FULL:
35159///     void;
35160/// case PATH_PAYMENT_STRICT_RECEIVE_NO_ISSUER:
35161///     Asset noIssuer; // the asset that caused the error
35162/// case PATH_PAYMENT_STRICT_RECEIVE_TOO_FEW_OFFERS:
35163/// case PATH_PAYMENT_STRICT_RECEIVE_OFFER_CROSS_SELF:
35164/// case PATH_PAYMENT_STRICT_RECEIVE_OVER_SENDMAX:
35165///     void;
35166/// };
35167/// ```
35168///
35169// union with discriminant PathPaymentStrictReceiveResultCode
35170#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
35171#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
35172#[cfg_attr(
35173    all(feature = "serde", feature = "alloc"),
35174    derive(serde::Serialize, serde::Deserialize),
35175    serde(rename_all = "snake_case")
35176)]
35177#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
35178#[allow(clippy::large_enum_variant)]
35179pub enum PathPaymentStrictReceiveResult {
35180    Success(PathPaymentStrictReceiveResultSuccess),
35181    Malformed,
35182    Underfunded,
35183    SrcNoTrust,
35184    SrcNotAuthorized,
35185    NoDestination,
35186    NoTrust,
35187    NotAuthorized,
35188    LineFull,
35189    NoIssuer(Asset),
35190    TooFewOffers,
35191    OfferCrossSelf,
35192    OverSendmax,
35193}
35194
35195impl PathPaymentStrictReceiveResult {
35196    pub const VARIANTS: [PathPaymentStrictReceiveResultCode; 13] = [
35197        PathPaymentStrictReceiveResultCode::Success,
35198        PathPaymentStrictReceiveResultCode::Malformed,
35199        PathPaymentStrictReceiveResultCode::Underfunded,
35200        PathPaymentStrictReceiveResultCode::SrcNoTrust,
35201        PathPaymentStrictReceiveResultCode::SrcNotAuthorized,
35202        PathPaymentStrictReceiveResultCode::NoDestination,
35203        PathPaymentStrictReceiveResultCode::NoTrust,
35204        PathPaymentStrictReceiveResultCode::NotAuthorized,
35205        PathPaymentStrictReceiveResultCode::LineFull,
35206        PathPaymentStrictReceiveResultCode::NoIssuer,
35207        PathPaymentStrictReceiveResultCode::TooFewOffers,
35208        PathPaymentStrictReceiveResultCode::OfferCrossSelf,
35209        PathPaymentStrictReceiveResultCode::OverSendmax,
35210    ];
35211    pub const VARIANTS_STR: [&'static str; 13] = [
35212        "Success",
35213        "Malformed",
35214        "Underfunded",
35215        "SrcNoTrust",
35216        "SrcNotAuthorized",
35217        "NoDestination",
35218        "NoTrust",
35219        "NotAuthorized",
35220        "LineFull",
35221        "NoIssuer",
35222        "TooFewOffers",
35223        "OfferCrossSelf",
35224        "OverSendmax",
35225    ];
35226
35227    #[must_use]
35228    pub const fn name(&self) -> &'static str {
35229        match self {
35230            Self::Success(_) => "Success",
35231            Self::Malformed => "Malformed",
35232            Self::Underfunded => "Underfunded",
35233            Self::SrcNoTrust => "SrcNoTrust",
35234            Self::SrcNotAuthorized => "SrcNotAuthorized",
35235            Self::NoDestination => "NoDestination",
35236            Self::NoTrust => "NoTrust",
35237            Self::NotAuthorized => "NotAuthorized",
35238            Self::LineFull => "LineFull",
35239            Self::NoIssuer(_) => "NoIssuer",
35240            Self::TooFewOffers => "TooFewOffers",
35241            Self::OfferCrossSelf => "OfferCrossSelf",
35242            Self::OverSendmax => "OverSendmax",
35243        }
35244    }
35245
35246    #[must_use]
35247    pub const fn discriminant(&self) -> PathPaymentStrictReceiveResultCode {
35248        #[allow(clippy::match_same_arms)]
35249        match self {
35250            Self::Success(_) => PathPaymentStrictReceiveResultCode::Success,
35251            Self::Malformed => PathPaymentStrictReceiveResultCode::Malformed,
35252            Self::Underfunded => PathPaymentStrictReceiveResultCode::Underfunded,
35253            Self::SrcNoTrust => PathPaymentStrictReceiveResultCode::SrcNoTrust,
35254            Self::SrcNotAuthorized => PathPaymentStrictReceiveResultCode::SrcNotAuthorized,
35255            Self::NoDestination => PathPaymentStrictReceiveResultCode::NoDestination,
35256            Self::NoTrust => PathPaymentStrictReceiveResultCode::NoTrust,
35257            Self::NotAuthorized => PathPaymentStrictReceiveResultCode::NotAuthorized,
35258            Self::LineFull => PathPaymentStrictReceiveResultCode::LineFull,
35259            Self::NoIssuer(_) => PathPaymentStrictReceiveResultCode::NoIssuer,
35260            Self::TooFewOffers => PathPaymentStrictReceiveResultCode::TooFewOffers,
35261            Self::OfferCrossSelf => PathPaymentStrictReceiveResultCode::OfferCrossSelf,
35262            Self::OverSendmax => PathPaymentStrictReceiveResultCode::OverSendmax,
35263        }
35264    }
35265
35266    #[must_use]
35267    pub const fn variants() -> [PathPaymentStrictReceiveResultCode; 13] {
35268        Self::VARIANTS
35269    }
35270}
35271
35272impl Name for PathPaymentStrictReceiveResult {
35273    #[must_use]
35274    fn name(&self) -> &'static str {
35275        Self::name(self)
35276    }
35277}
35278
35279impl Discriminant<PathPaymentStrictReceiveResultCode> for PathPaymentStrictReceiveResult {
35280    #[must_use]
35281    fn discriminant(&self) -> PathPaymentStrictReceiveResultCode {
35282        Self::discriminant(self)
35283    }
35284}
35285
35286impl Variants<PathPaymentStrictReceiveResultCode> for PathPaymentStrictReceiveResult {
35287    fn variants() -> slice::Iter<'static, PathPaymentStrictReceiveResultCode> {
35288        Self::VARIANTS.iter()
35289    }
35290}
35291
35292impl Union<PathPaymentStrictReceiveResultCode> for PathPaymentStrictReceiveResult {}
35293
35294impl ReadXdr for PathPaymentStrictReceiveResult {
35295    #[cfg(feature = "std")]
35296    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
35297        r.with_limited_depth(|r| {
35298            let dv: PathPaymentStrictReceiveResultCode =
35299                <PathPaymentStrictReceiveResultCode as ReadXdr>::read_xdr(r)?;
35300            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
35301            let v = match dv {
35302                PathPaymentStrictReceiveResultCode::Success => {
35303                    Self::Success(PathPaymentStrictReceiveResultSuccess::read_xdr(r)?)
35304                }
35305                PathPaymentStrictReceiveResultCode::Malformed => Self::Malformed,
35306                PathPaymentStrictReceiveResultCode::Underfunded => Self::Underfunded,
35307                PathPaymentStrictReceiveResultCode::SrcNoTrust => Self::SrcNoTrust,
35308                PathPaymentStrictReceiveResultCode::SrcNotAuthorized => Self::SrcNotAuthorized,
35309                PathPaymentStrictReceiveResultCode::NoDestination => Self::NoDestination,
35310                PathPaymentStrictReceiveResultCode::NoTrust => Self::NoTrust,
35311                PathPaymentStrictReceiveResultCode::NotAuthorized => Self::NotAuthorized,
35312                PathPaymentStrictReceiveResultCode::LineFull => Self::LineFull,
35313                PathPaymentStrictReceiveResultCode::NoIssuer => Self::NoIssuer(Asset::read_xdr(r)?),
35314                PathPaymentStrictReceiveResultCode::TooFewOffers => Self::TooFewOffers,
35315                PathPaymentStrictReceiveResultCode::OfferCrossSelf => Self::OfferCrossSelf,
35316                PathPaymentStrictReceiveResultCode::OverSendmax => Self::OverSendmax,
35317                #[allow(unreachable_patterns)]
35318                _ => return Err(Error::Invalid),
35319            };
35320            Ok(v)
35321        })
35322    }
35323}
35324
35325impl WriteXdr for PathPaymentStrictReceiveResult {
35326    #[cfg(feature = "std")]
35327    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
35328        w.with_limited_depth(|w| {
35329            self.discriminant().write_xdr(w)?;
35330            #[allow(clippy::match_same_arms)]
35331            match self {
35332                Self::Success(v) => v.write_xdr(w)?,
35333                Self::Malformed => ().write_xdr(w)?,
35334                Self::Underfunded => ().write_xdr(w)?,
35335                Self::SrcNoTrust => ().write_xdr(w)?,
35336                Self::SrcNotAuthorized => ().write_xdr(w)?,
35337                Self::NoDestination => ().write_xdr(w)?,
35338                Self::NoTrust => ().write_xdr(w)?,
35339                Self::NotAuthorized => ().write_xdr(w)?,
35340                Self::LineFull => ().write_xdr(w)?,
35341                Self::NoIssuer(v) => v.write_xdr(w)?,
35342                Self::TooFewOffers => ().write_xdr(w)?,
35343                Self::OfferCrossSelf => ().write_xdr(w)?,
35344                Self::OverSendmax => ().write_xdr(w)?,
35345            };
35346            Ok(())
35347        })
35348    }
35349}
35350
35351/// PathPaymentStrictSendResultCode is an XDR Enum defines as:
35352///
35353/// ```text
35354/// enum PathPaymentStrictSendResultCode
35355/// {
35356///     // codes considered as "success" for the operation
35357///     PATH_PAYMENT_STRICT_SEND_SUCCESS = 0, // success
35358///
35359///     // codes considered as "failure" for the operation
35360///     PATH_PAYMENT_STRICT_SEND_MALFORMED = -1, // bad input
35361///     PATH_PAYMENT_STRICT_SEND_UNDERFUNDED =
35362///         -2, // not enough funds in source account
35363///     PATH_PAYMENT_STRICT_SEND_SRC_NO_TRUST =
35364///         -3, // no trust line on source account
35365///     PATH_PAYMENT_STRICT_SEND_SRC_NOT_AUTHORIZED =
35366///         -4, // source not authorized to transfer
35367///     PATH_PAYMENT_STRICT_SEND_NO_DESTINATION =
35368///         -5, // destination account does not exist
35369///     PATH_PAYMENT_STRICT_SEND_NO_TRUST =
35370///         -6, // dest missing a trust line for asset
35371///     PATH_PAYMENT_STRICT_SEND_NOT_AUTHORIZED =
35372///         -7, // dest not authorized to hold asset
35373///     PATH_PAYMENT_STRICT_SEND_LINE_FULL = -8, // dest would go above their limit
35374///     PATH_PAYMENT_STRICT_SEND_NO_ISSUER = -9, // missing issuer on one asset
35375///     PATH_PAYMENT_STRICT_SEND_TOO_FEW_OFFERS =
35376///         -10, // not enough offers to satisfy path
35377///     PATH_PAYMENT_STRICT_SEND_OFFER_CROSS_SELF =
35378///         -11, // would cross one of its own offers
35379///     PATH_PAYMENT_STRICT_SEND_UNDER_DESTMIN = -12 // could not satisfy destMin
35380/// };
35381/// ```
35382///
35383// enum
35384#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
35385#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
35386#[cfg_attr(
35387    all(feature = "serde", feature = "alloc"),
35388    derive(serde::Serialize, serde::Deserialize),
35389    serde(rename_all = "snake_case")
35390)]
35391#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
35392#[repr(i32)]
35393pub enum PathPaymentStrictSendResultCode {
35394    Success = 0,
35395    Malformed = -1,
35396    Underfunded = -2,
35397    SrcNoTrust = -3,
35398    SrcNotAuthorized = -4,
35399    NoDestination = -5,
35400    NoTrust = -6,
35401    NotAuthorized = -7,
35402    LineFull = -8,
35403    NoIssuer = -9,
35404    TooFewOffers = -10,
35405    OfferCrossSelf = -11,
35406    UnderDestmin = -12,
35407}
35408
35409impl PathPaymentStrictSendResultCode {
35410    pub const VARIANTS: [PathPaymentStrictSendResultCode; 13] = [
35411        PathPaymentStrictSendResultCode::Success,
35412        PathPaymentStrictSendResultCode::Malformed,
35413        PathPaymentStrictSendResultCode::Underfunded,
35414        PathPaymentStrictSendResultCode::SrcNoTrust,
35415        PathPaymentStrictSendResultCode::SrcNotAuthorized,
35416        PathPaymentStrictSendResultCode::NoDestination,
35417        PathPaymentStrictSendResultCode::NoTrust,
35418        PathPaymentStrictSendResultCode::NotAuthorized,
35419        PathPaymentStrictSendResultCode::LineFull,
35420        PathPaymentStrictSendResultCode::NoIssuer,
35421        PathPaymentStrictSendResultCode::TooFewOffers,
35422        PathPaymentStrictSendResultCode::OfferCrossSelf,
35423        PathPaymentStrictSendResultCode::UnderDestmin,
35424    ];
35425    pub const VARIANTS_STR: [&'static str; 13] = [
35426        "Success",
35427        "Malformed",
35428        "Underfunded",
35429        "SrcNoTrust",
35430        "SrcNotAuthorized",
35431        "NoDestination",
35432        "NoTrust",
35433        "NotAuthorized",
35434        "LineFull",
35435        "NoIssuer",
35436        "TooFewOffers",
35437        "OfferCrossSelf",
35438        "UnderDestmin",
35439    ];
35440
35441    #[must_use]
35442    pub const fn name(&self) -> &'static str {
35443        match self {
35444            Self::Success => "Success",
35445            Self::Malformed => "Malformed",
35446            Self::Underfunded => "Underfunded",
35447            Self::SrcNoTrust => "SrcNoTrust",
35448            Self::SrcNotAuthorized => "SrcNotAuthorized",
35449            Self::NoDestination => "NoDestination",
35450            Self::NoTrust => "NoTrust",
35451            Self::NotAuthorized => "NotAuthorized",
35452            Self::LineFull => "LineFull",
35453            Self::NoIssuer => "NoIssuer",
35454            Self::TooFewOffers => "TooFewOffers",
35455            Self::OfferCrossSelf => "OfferCrossSelf",
35456            Self::UnderDestmin => "UnderDestmin",
35457        }
35458    }
35459
35460    #[must_use]
35461    pub const fn variants() -> [PathPaymentStrictSendResultCode; 13] {
35462        Self::VARIANTS
35463    }
35464}
35465
35466impl Name for PathPaymentStrictSendResultCode {
35467    #[must_use]
35468    fn name(&self) -> &'static str {
35469        Self::name(self)
35470    }
35471}
35472
35473impl Variants<PathPaymentStrictSendResultCode> for PathPaymentStrictSendResultCode {
35474    fn variants() -> slice::Iter<'static, PathPaymentStrictSendResultCode> {
35475        Self::VARIANTS.iter()
35476    }
35477}
35478
35479impl Enum for PathPaymentStrictSendResultCode {}
35480
35481impl fmt::Display for PathPaymentStrictSendResultCode {
35482    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
35483        f.write_str(self.name())
35484    }
35485}
35486
35487impl TryFrom<i32> for PathPaymentStrictSendResultCode {
35488    type Error = Error;
35489
35490    fn try_from(i: i32) -> Result<Self> {
35491        let e = match i {
35492            0 => PathPaymentStrictSendResultCode::Success,
35493            -1 => PathPaymentStrictSendResultCode::Malformed,
35494            -2 => PathPaymentStrictSendResultCode::Underfunded,
35495            -3 => PathPaymentStrictSendResultCode::SrcNoTrust,
35496            -4 => PathPaymentStrictSendResultCode::SrcNotAuthorized,
35497            -5 => PathPaymentStrictSendResultCode::NoDestination,
35498            -6 => PathPaymentStrictSendResultCode::NoTrust,
35499            -7 => PathPaymentStrictSendResultCode::NotAuthorized,
35500            -8 => PathPaymentStrictSendResultCode::LineFull,
35501            -9 => PathPaymentStrictSendResultCode::NoIssuer,
35502            -10 => PathPaymentStrictSendResultCode::TooFewOffers,
35503            -11 => PathPaymentStrictSendResultCode::OfferCrossSelf,
35504            -12 => PathPaymentStrictSendResultCode::UnderDestmin,
35505            #[allow(unreachable_patterns)]
35506            _ => return Err(Error::Invalid),
35507        };
35508        Ok(e)
35509    }
35510}
35511
35512impl From<PathPaymentStrictSendResultCode> for i32 {
35513    #[must_use]
35514    fn from(e: PathPaymentStrictSendResultCode) -> Self {
35515        e as Self
35516    }
35517}
35518
35519impl ReadXdr for PathPaymentStrictSendResultCode {
35520    #[cfg(feature = "std")]
35521    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
35522        r.with_limited_depth(|r| {
35523            let e = i32::read_xdr(r)?;
35524            let v: Self = e.try_into()?;
35525            Ok(v)
35526        })
35527    }
35528}
35529
35530impl WriteXdr for PathPaymentStrictSendResultCode {
35531    #[cfg(feature = "std")]
35532    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
35533        w.with_limited_depth(|w| {
35534            let i: i32 = (*self).into();
35535            i.write_xdr(w)
35536        })
35537    }
35538}
35539
35540/// PathPaymentStrictSendResultSuccess is an XDR NestedStruct defines as:
35541///
35542/// ```text
35543/// struct
35544///     {
35545///         ClaimAtom offers<>;
35546///         SimplePaymentResult last;
35547///     }
35548/// ```
35549///
35550#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
35551#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
35552#[cfg_attr(
35553    all(feature = "serde", feature = "alloc"),
35554    derive(serde::Serialize, serde::Deserialize),
35555    serde(rename_all = "snake_case")
35556)]
35557#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
35558pub struct PathPaymentStrictSendResultSuccess {
35559    pub offers: VecM<ClaimAtom>,
35560    pub last: SimplePaymentResult,
35561}
35562
35563impl ReadXdr for PathPaymentStrictSendResultSuccess {
35564    #[cfg(feature = "std")]
35565    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
35566        r.with_limited_depth(|r| {
35567            Ok(Self {
35568                offers: VecM::<ClaimAtom>::read_xdr(r)?,
35569                last: SimplePaymentResult::read_xdr(r)?,
35570            })
35571        })
35572    }
35573}
35574
35575impl WriteXdr for PathPaymentStrictSendResultSuccess {
35576    #[cfg(feature = "std")]
35577    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
35578        w.with_limited_depth(|w| {
35579            self.offers.write_xdr(w)?;
35580            self.last.write_xdr(w)?;
35581            Ok(())
35582        })
35583    }
35584}
35585
35586/// PathPaymentStrictSendResult is an XDR Union defines as:
35587///
35588/// ```text
35589/// union PathPaymentStrictSendResult switch (PathPaymentStrictSendResultCode code)
35590/// {
35591/// case PATH_PAYMENT_STRICT_SEND_SUCCESS:
35592///     struct
35593///     {
35594///         ClaimAtom offers<>;
35595///         SimplePaymentResult last;
35596///     } success;
35597/// case PATH_PAYMENT_STRICT_SEND_MALFORMED:
35598/// case PATH_PAYMENT_STRICT_SEND_UNDERFUNDED:
35599/// case PATH_PAYMENT_STRICT_SEND_SRC_NO_TRUST:
35600/// case PATH_PAYMENT_STRICT_SEND_SRC_NOT_AUTHORIZED:
35601/// case PATH_PAYMENT_STRICT_SEND_NO_DESTINATION:
35602/// case PATH_PAYMENT_STRICT_SEND_NO_TRUST:
35603/// case PATH_PAYMENT_STRICT_SEND_NOT_AUTHORIZED:
35604/// case PATH_PAYMENT_STRICT_SEND_LINE_FULL:
35605///     void;
35606/// case PATH_PAYMENT_STRICT_SEND_NO_ISSUER:
35607///     Asset noIssuer; // the asset that caused the error
35608/// case PATH_PAYMENT_STRICT_SEND_TOO_FEW_OFFERS:
35609/// case PATH_PAYMENT_STRICT_SEND_OFFER_CROSS_SELF:
35610/// case PATH_PAYMENT_STRICT_SEND_UNDER_DESTMIN:
35611///     void;
35612/// };
35613/// ```
35614///
35615// union with discriminant PathPaymentStrictSendResultCode
35616#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
35617#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
35618#[cfg_attr(
35619    all(feature = "serde", feature = "alloc"),
35620    derive(serde::Serialize, serde::Deserialize),
35621    serde(rename_all = "snake_case")
35622)]
35623#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
35624#[allow(clippy::large_enum_variant)]
35625pub enum PathPaymentStrictSendResult {
35626    Success(PathPaymentStrictSendResultSuccess),
35627    Malformed,
35628    Underfunded,
35629    SrcNoTrust,
35630    SrcNotAuthorized,
35631    NoDestination,
35632    NoTrust,
35633    NotAuthorized,
35634    LineFull,
35635    NoIssuer(Asset),
35636    TooFewOffers,
35637    OfferCrossSelf,
35638    UnderDestmin,
35639}
35640
35641impl PathPaymentStrictSendResult {
35642    pub const VARIANTS: [PathPaymentStrictSendResultCode; 13] = [
35643        PathPaymentStrictSendResultCode::Success,
35644        PathPaymentStrictSendResultCode::Malformed,
35645        PathPaymentStrictSendResultCode::Underfunded,
35646        PathPaymentStrictSendResultCode::SrcNoTrust,
35647        PathPaymentStrictSendResultCode::SrcNotAuthorized,
35648        PathPaymentStrictSendResultCode::NoDestination,
35649        PathPaymentStrictSendResultCode::NoTrust,
35650        PathPaymentStrictSendResultCode::NotAuthorized,
35651        PathPaymentStrictSendResultCode::LineFull,
35652        PathPaymentStrictSendResultCode::NoIssuer,
35653        PathPaymentStrictSendResultCode::TooFewOffers,
35654        PathPaymentStrictSendResultCode::OfferCrossSelf,
35655        PathPaymentStrictSendResultCode::UnderDestmin,
35656    ];
35657    pub const VARIANTS_STR: [&'static str; 13] = [
35658        "Success",
35659        "Malformed",
35660        "Underfunded",
35661        "SrcNoTrust",
35662        "SrcNotAuthorized",
35663        "NoDestination",
35664        "NoTrust",
35665        "NotAuthorized",
35666        "LineFull",
35667        "NoIssuer",
35668        "TooFewOffers",
35669        "OfferCrossSelf",
35670        "UnderDestmin",
35671    ];
35672
35673    #[must_use]
35674    pub const fn name(&self) -> &'static str {
35675        match self {
35676            Self::Success(_) => "Success",
35677            Self::Malformed => "Malformed",
35678            Self::Underfunded => "Underfunded",
35679            Self::SrcNoTrust => "SrcNoTrust",
35680            Self::SrcNotAuthorized => "SrcNotAuthorized",
35681            Self::NoDestination => "NoDestination",
35682            Self::NoTrust => "NoTrust",
35683            Self::NotAuthorized => "NotAuthorized",
35684            Self::LineFull => "LineFull",
35685            Self::NoIssuer(_) => "NoIssuer",
35686            Self::TooFewOffers => "TooFewOffers",
35687            Self::OfferCrossSelf => "OfferCrossSelf",
35688            Self::UnderDestmin => "UnderDestmin",
35689        }
35690    }
35691
35692    #[must_use]
35693    pub const fn discriminant(&self) -> PathPaymentStrictSendResultCode {
35694        #[allow(clippy::match_same_arms)]
35695        match self {
35696            Self::Success(_) => PathPaymentStrictSendResultCode::Success,
35697            Self::Malformed => PathPaymentStrictSendResultCode::Malformed,
35698            Self::Underfunded => PathPaymentStrictSendResultCode::Underfunded,
35699            Self::SrcNoTrust => PathPaymentStrictSendResultCode::SrcNoTrust,
35700            Self::SrcNotAuthorized => PathPaymentStrictSendResultCode::SrcNotAuthorized,
35701            Self::NoDestination => PathPaymentStrictSendResultCode::NoDestination,
35702            Self::NoTrust => PathPaymentStrictSendResultCode::NoTrust,
35703            Self::NotAuthorized => PathPaymentStrictSendResultCode::NotAuthorized,
35704            Self::LineFull => PathPaymentStrictSendResultCode::LineFull,
35705            Self::NoIssuer(_) => PathPaymentStrictSendResultCode::NoIssuer,
35706            Self::TooFewOffers => PathPaymentStrictSendResultCode::TooFewOffers,
35707            Self::OfferCrossSelf => PathPaymentStrictSendResultCode::OfferCrossSelf,
35708            Self::UnderDestmin => PathPaymentStrictSendResultCode::UnderDestmin,
35709        }
35710    }
35711
35712    #[must_use]
35713    pub const fn variants() -> [PathPaymentStrictSendResultCode; 13] {
35714        Self::VARIANTS
35715    }
35716}
35717
35718impl Name for PathPaymentStrictSendResult {
35719    #[must_use]
35720    fn name(&self) -> &'static str {
35721        Self::name(self)
35722    }
35723}
35724
35725impl Discriminant<PathPaymentStrictSendResultCode> for PathPaymentStrictSendResult {
35726    #[must_use]
35727    fn discriminant(&self) -> PathPaymentStrictSendResultCode {
35728        Self::discriminant(self)
35729    }
35730}
35731
35732impl Variants<PathPaymentStrictSendResultCode> for PathPaymentStrictSendResult {
35733    fn variants() -> slice::Iter<'static, PathPaymentStrictSendResultCode> {
35734        Self::VARIANTS.iter()
35735    }
35736}
35737
35738impl Union<PathPaymentStrictSendResultCode> for PathPaymentStrictSendResult {}
35739
35740impl ReadXdr for PathPaymentStrictSendResult {
35741    #[cfg(feature = "std")]
35742    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
35743        r.with_limited_depth(|r| {
35744            let dv: PathPaymentStrictSendResultCode =
35745                <PathPaymentStrictSendResultCode as ReadXdr>::read_xdr(r)?;
35746            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
35747            let v = match dv {
35748                PathPaymentStrictSendResultCode::Success => {
35749                    Self::Success(PathPaymentStrictSendResultSuccess::read_xdr(r)?)
35750                }
35751                PathPaymentStrictSendResultCode::Malformed => Self::Malformed,
35752                PathPaymentStrictSendResultCode::Underfunded => Self::Underfunded,
35753                PathPaymentStrictSendResultCode::SrcNoTrust => Self::SrcNoTrust,
35754                PathPaymentStrictSendResultCode::SrcNotAuthorized => Self::SrcNotAuthorized,
35755                PathPaymentStrictSendResultCode::NoDestination => Self::NoDestination,
35756                PathPaymentStrictSendResultCode::NoTrust => Self::NoTrust,
35757                PathPaymentStrictSendResultCode::NotAuthorized => Self::NotAuthorized,
35758                PathPaymentStrictSendResultCode::LineFull => Self::LineFull,
35759                PathPaymentStrictSendResultCode::NoIssuer => Self::NoIssuer(Asset::read_xdr(r)?),
35760                PathPaymentStrictSendResultCode::TooFewOffers => Self::TooFewOffers,
35761                PathPaymentStrictSendResultCode::OfferCrossSelf => Self::OfferCrossSelf,
35762                PathPaymentStrictSendResultCode::UnderDestmin => Self::UnderDestmin,
35763                #[allow(unreachable_patterns)]
35764                _ => return Err(Error::Invalid),
35765            };
35766            Ok(v)
35767        })
35768    }
35769}
35770
35771impl WriteXdr for PathPaymentStrictSendResult {
35772    #[cfg(feature = "std")]
35773    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
35774        w.with_limited_depth(|w| {
35775            self.discriminant().write_xdr(w)?;
35776            #[allow(clippy::match_same_arms)]
35777            match self {
35778                Self::Success(v) => v.write_xdr(w)?,
35779                Self::Malformed => ().write_xdr(w)?,
35780                Self::Underfunded => ().write_xdr(w)?,
35781                Self::SrcNoTrust => ().write_xdr(w)?,
35782                Self::SrcNotAuthorized => ().write_xdr(w)?,
35783                Self::NoDestination => ().write_xdr(w)?,
35784                Self::NoTrust => ().write_xdr(w)?,
35785                Self::NotAuthorized => ().write_xdr(w)?,
35786                Self::LineFull => ().write_xdr(w)?,
35787                Self::NoIssuer(v) => v.write_xdr(w)?,
35788                Self::TooFewOffers => ().write_xdr(w)?,
35789                Self::OfferCrossSelf => ().write_xdr(w)?,
35790                Self::UnderDestmin => ().write_xdr(w)?,
35791            };
35792            Ok(())
35793        })
35794    }
35795}
35796
35797/// ManageSellOfferResultCode is an XDR Enum defines as:
35798///
35799/// ```text
35800/// enum ManageSellOfferResultCode
35801/// {
35802///     // codes considered as "success" for the operation
35803///     MANAGE_SELL_OFFER_SUCCESS = 0,
35804///
35805///     // codes considered as "failure" for the operation
35806///     MANAGE_SELL_OFFER_MALFORMED = -1, // generated offer would be invalid
35807///     MANAGE_SELL_OFFER_SELL_NO_TRUST =
35808///         -2,                              // no trust line for what we're selling
35809///     MANAGE_SELL_OFFER_BUY_NO_TRUST = -3, // no trust line for what we're buying
35810///     MANAGE_SELL_OFFER_SELL_NOT_AUTHORIZED = -4, // not authorized to sell
35811///     MANAGE_SELL_OFFER_BUY_NOT_AUTHORIZED = -5,  // not authorized to buy
35812///     MANAGE_SELL_OFFER_LINE_FULL = -6, // can't receive more of what it's buying
35813///     MANAGE_SELL_OFFER_UNDERFUNDED = -7, // doesn't hold what it's trying to sell
35814///     MANAGE_SELL_OFFER_CROSS_SELF =
35815///         -8, // would cross an offer from the same user
35816///     MANAGE_SELL_OFFER_SELL_NO_ISSUER = -9, // no issuer for what we're selling
35817///     MANAGE_SELL_OFFER_BUY_NO_ISSUER = -10, // no issuer for what we're buying
35818///
35819///     // update errors
35820///     MANAGE_SELL_OFFER_NOT_FOUND =
35821///         -11, // offerID does not match an existing offer
35822///
35823///     MANAGE_SELL_OFFER_LOW_RESERVE =
35824///         -12 // not enough funds to create a new Offer
35825/// };
35826/// ```
35827///
35828// enum
35829#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
35830#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
35831#[cfg_attr(
35832    all(feature = "serde", feature = "alloc"),
35833    derive(serde::Serialize, serde::Deserialize),
35834    serde(rename_all = "snake_case")
35835)]
35836#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
35837#[repr(i32)]
35838pub enum ManageSellOfferResultCode {
35839    Success = 0,
35840    Malformed = -1,
35841    SellNoTrust = -2,
35842    BuyNoTrust = -3,
35843    SellNotAuthorized = -4,
35844    BuyNotAuthorized = -5,
35845    LineFull = -6,
35846    Underfunded = -7,
35847    CrossSelf = -8,
35848    SellNoIssuer = -9,
35849    BuyNoIssuer = -10,
35850    NotFound = -11,
35851    LowReserve = -12,
35852}
35853
35854impl ManageSellOfferResultCode {
35855    pub const VARIANTS: [ManageSellOfferResultCode; 13] = [
35856        ManageSellOfferResultCode::Success,
35857        ManageSellOfferResultCode::Malformed,
35858        ManageSellOfferResultCode::SellNoTrust,
35859        ManageSellOfferResultCode::BuyNoTrust,
35860        ManageSellOfferResultCode::SellNotAuthorized,
35861        ManageSellOfferResultCode::BuyNotAuthorized,
35862        ManageSellOfferResultCode::LineFull,
35863        ManageSellOfferResultCode::Underfunded,
35864        ManageSellOfferResultCode::CrossSelf,
35865        ManageSellOfferResultCode::SellNoIssuer,
35866        ManageSellOfferResultCode::BuyNoIssuer,
35867        ManageSellOfferResultCode::NotFound,
35868        ManageSellOfferResultCode::LowReserve,
35869    ];
35870    pub const VARIANTS_STR: [&'static str; 13] = [
35871        "Success",
35872        "Malformed",
35873        "SellNoTrust",
35874        "BuyNoTrust",
35875        "SellNotAuthorized",
35876        "BuyNotAuthorized",
35877        "LineFull",
35878        "Underfunded",
35879        "CrossSelf",
35880        "SellNoIssuer",
35881        "BuyNoIssuer",
35882        "NotFound",
35883        "LowReserve",
35884    ];
35885
35886    #[must_use]
35887    pub const fn name(&self) -> &'static str {
35888        match self {
35889            Self::Success => "Success",
35890            Self::Malformed => "Malformed",
35891            Self::SellNoTrust => "SellNoTrust",
35892            Self::BuyNoTrust => "BuyNoTrust",
35893            Self::SellNotAuthorized => "SellNotAuthorized",
35894            Self::BuyNotAuthorized => "BuyNotAuthorized",
35895            Self::LineFull => "LineFull",
35896            Self::Underfunded => "Underfunded",
35897            Self::CrossSelf => "CrossSelf",
35898            Self::SellNoIssuer => "SellNoIssuer",
35899            Self::BuyNoIssuer => "BuyNoIssuer",
35900            Self::NotFound => "NotFound",
35901            Self::LowReserve => "LowReserve",
35902        }
35903    }
35904
35905    #[must_use]
35906    pub const fn variants() -> [ManageSellOfferResultCode; 13] {
35907        Self::VARIANTS
35908    }
35909}
35910
35911impl Name for ManageSellOfferResultCode {
35912    #[must_use]
35913    fn name(&self) -> &'static str {
35914        Self::name(self)
35915    }
35916}
35917
35918impl Variants<ManageSellOfferResultCode> for ManageSellOfferResultCode {
35919    fn variants() -> slice::Iter<'static, ManageSellOfferResultCode> {
35920        Self::VARIANTS.iter()
35921    }
35922}
35923
35924impl Enum for ManageSellOfferResultCode {}
35925
35926impl fmt::Display for ManageSellOfferResultCode {
35927    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
35928        f.write_str(self.name())
35929    }
35930}
35931
35932impl TryFrom<i32> for ManageSellOfferResultCode {
35933    type Error = Error;
35934
35935    fn try_from(i: i32) -> Result<Self> {
35936        let e = match i {
35937            0 => ManageSellOfferResultCode::Success,
35938            -1 => ManageSellOfferResultCode::Malformed,
35939            -2 => ManageSellOfferResultCode::SellNoTrust,
35940            -3 => ManageSellOfferResultCode::BuyNoTrust,
35941            -4 => ManageSellOfferResultCode::SellNotAuthorized,
35942            -5 => ManageSellOfferResultCode::BuyNotAuthorized,
35943            -6 => ManageSellOfferResultCode::LineFull,
35944            -7 => ManageSellOfferResultCode::Underfunded,
35945            -8 => ManageSellOfferResultCode::CrossSelf,
35946            -9 => ManageSellOfferResultCode::SellNoIssuer,
35947            -10 => ManageSellOfferResultCode::BuyNoIssuer,
35948            -11 => ManageSellOfferResultCode::NotFound,
35949            -12 => ManageSellOfferResultCode::LowReserve,
35950            #[allow(unreachable_patterns)]
35951            _ => return Err(Error::Invalid),
35952        };
35953        Ok(e)
35954    }
35955}
35956
35957impl From<ManageSellOfferResultCode> for i32 {
35958    #[must_use]
35959    fn from(e: ManageSellOfferResultCode) -> Self {
35960        e as Self
35961    }
35962}
35963
35964impl ReadXdr for ManageSellOfferResultCode {
35965    #[cfg(feature = "std")]
35966    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
35967        r.with_limited_depth(|r| {
35968            let e = i32::read_xdr(r)?;
35969            let v: Self = e.try_into()?;
35970            Ok(v)
35971        })
35972    }
35973}
35974
35975impl WriteXdr for ManageSellOfferResultCode {
35976    #[cfg(feature = "std")]
35977    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
35978        w.with_limited_depth(|w| {
35979            let i: i32 = (*self).into();
35980            i.write_xdr(w)
35981        })
35982    }
35983}
35984
35985/// ManageOfferEffect is an XDR Enum defines as:
35986///
35987/// ```text
35988/// enum ManageOfferEffect
35989/// {
35990///     MANAGE_OFFER_CREATED = 0,
35991///     MANAGE_OFFER_UPDATED = 1,
35992///     MANAGE_OFFER_DELETED = 2
35993/// };
35994/// ```
35995///
35996// enum
35997#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
35998#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
35999#[cfg_attr(
36000    all(feature = "serde", feature = "alloc"),
36001    derive(serde::Serialize, serde::Deserialize),
36002    serde(rename_all = "snake_case")
36003)]
36004#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
36005#[repr(i32)]
36006pub enum ManageOfferEffect {
36007    Created = 0,
36008    Updated = 1,
36009    Deleted = 2,
36010}
36011
36012impl ManageOfferEffect {
36013    pub const VARIANTS: [ManageOfferEffect; 3] = [
36014        ManageOfferEffect::Created,
36015        ManageOfferEffect::Updated,
36016        ManageOfferEffect::Deleted,
36017    ];
36018    pub const VARIANTS_STR: [&'static str; 3] = ["Created", "Updated", "Deleted"];
36019
36020    #[must_use]
36021    pub const fn name(&self) -> &'static str {
36022        match self {
36023            Self::Created => "Created",
36024            Self::Updated => "Updated",
36025            Self::Deleted => "Deleted",
36026        }
36027    }
36028
36029    #[must_use]
36030    pub const fn variants() -> [ManageOfferEffect; 3] {
36031        Self::VARIANTS
36032    }
36033}
36034
36035impl Name for ManageOfferEffect {
36036    #[must_use]
36037    fn name(&self) -> &'static str {
36038        Self::name(self)
36039    }
36040}
36041
36042impl Variants<ManageOfferEffect> for ManageOfferEffect {
36043    fn variants() -> slice::Iter<'static, ManageOfferEffect> {
36044        Self::VARIANTS.iter()
36045    }
36046}
36047
36048impl Enum for ManageOfferEffect {}
36049
36050impl fmt::Display for ManageOfferEffect {
36051    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
36052        f.write_str(self.name())
36053    }
36054}
36055
36056impl TryFrom<i32> for ManageOfferEffect {
36057    type Error = Error;
36058
36059    fn try_from(i: i32) -> Result<Self> {
36060        let e = match i {
36061            0 => ManageOfferEffect::Created,
36062            1 => ManageOfferEffect::Updated,
36063            2 => ManageOfferEffect::Deleted,
36064            #[allow(unreachable_patterns)]
36065            _ => return Err(Error::Invalid),
36066        };
36067        Ok(e)
36068    }
36069}
36070
36071impl From<ManageOfferEffect> for i32 {
36072    #[must_use]
36073    fn from(e: ManageOfferEffect) -> Self {
36074        e as Self
36075    }
36076}
36077
36078impl ReadXdr for ManageOfferEffect {
36079    #[cfg(feature = "std")]
36080    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
36081        r.with_limited_depth(|r| {
36082            let e = i32::read_xdr(r)?;
36083            let v: Self = e.try_into()?;
36084            Ok(v)
36085        })
36086    }
36087}
36088
36089impl WriteXdr for ManageOfferEffect {
36090    #[cfg(feature = "std")]
36091    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
36092        w.with_limited_depth(|w| {
36093            let i: i32 = (*self).into();
36094            i.write_xdr(w)
36095        })
36096    }
36097}
36098
36099/// ManageOfferSuccessResultOffer is an XDR NestedUnion defines as:
36100///
36101/// ```text
36102/// union switch (ManageOfferEffect effect)
36103///     {
36104///     case MANAGE_OFFER_CREATED:
36105///     case MANAGE_OFFER_UPDATED:
36106///         OfferEntry offer;
36107///     case MANAGE_OFFER_DELETED:
36108///         void;
36109///     }
36110/// ```
36111///
36112// union with discriminant ManageOfferEffect
36113#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
36114#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
36115#[cfg_attr(
36116    all(feature = "serde", feature = "alloc"),
36117    derive(serde::Serialize, serde::Deserialize),
36118    serde(rename_all = "snake_case")
36119)]
36120#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
36121#[allow(clippy::large_enum_variant)]
36122pub enum ManageOfferSuccessResultOffer {
36123    Created(OfferEntry),
36124    Updated(OfferEntry),
36125    Deleted,
36126}
36127
36128impl ManageOfferSuccessResultOffer {
36129    pub const VARIANTS: [ManageOfferEffect; 3] = [
36130        ManageOfferEffect::Created,
36131        ManageOfferEffect::Updated,
36132        ManageOfferEffect::Deleted,
36133    ];
36134    pub const VARIANTS_STR: [&'static str; 3] = ["Created", "Updated", "Deleted"];
36135
36136    #[must_use]
36137    pub const fn name(&self) -> &'static str {
36138        match self {
36139            Self::Created(_) => "Created",
36140            Self::Updated(_) => "Updated",
36141            Self::Deleted => "Deleted",
36142        }
36143    }
36144
36145    #[must_use]
36146    pub const fn discriminant(&self) -> ManageOfferEffect {
36147        #[allow(clippy::match_same_arms)]
36148        match self {
36149            Self::Created(_) => ManageOfferEffect::Created,
36150            Self::Updated(_) => ManageOfferEffect::Updated,
36151            Self::Deleted => ManageOfferEffect::Deleted,
36152        }
36153    }
36154
36155    #[must_use]
36156    pub const fn variants() -> [ManageOfferEffect; 3] {
36157        Self::VARIANTS
36158    }
36159}
36160
36161impl Name for ManageOfferSuccessResultOffer {
36162    #[must_use]
36163    fn name(&self) -> &'static str {
36164        Self::name(self)
36165    }
36166}
36167
36168impl Discriminant<ManageOfferEffect> for ManageOfferSuccessResultOffer {
36169    #[must_use]
36170    fn discriminant(&self) -> ManageOfferEffect {
36171        Self::discriminant(self)
36172    }
36173}
36174
36175impl Variants<ManageOfferEffect> for ManageOfferSuccessResultOffer {
36176    fn variants() -> slice::Iter<'static, ManageOfferEffect> {
36177        Self::VARIANTS.iter()
36178    }
36179}
36180
36181impl Union<ManageOfferEffect> for ManageOfferSuccessResultOffer {}
36182
36183impl ReadXdr for ManageOfferSuccessResultOffer {
36184    #[cfg(feature = "std")]
36185    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
36186        r.with_limited_depth(|r| {
36187            let dv: ManageOfferEffect = <ManageOfferEffect as ReadXdr>::read_xdr(r)?;
36188            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
36189            let v = match dv {
36190                ManageOfferEffect::Created => Self::Created(OfferEntry::read_xdr(r)?),
36191                ManageOfferEffect::Updated => Self::Updated(OfferEntry::read_xdr(r)?),
36192                ManageOfferEffect::Deleted => Self::Deleted,
36193                #[allow(unreachable_patterns)]
36194                _ => return Err(Error::Invalid),
36195            };
36196            Ok(v)
36197        })
36198    }
36199}
36200
36201impl WriteXdr for ManageOfferSuccessResultOffer {
36202    #[cfg(feature = "std")]
36203    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
36204        w.with_limited_depth(|w| {
36205            self.discriminant().write_xdr(w)?;
36206            #[allow(clippy::match_same_arms)]
36207            match self {
36208                Self::Created(v) => v.write_xdr(w)?,
36209                Self::Updated(v) => v.write_xdr(w)?,
36210                Self::Deleted => ().write_xdr(w)?,
36211            };
36212            Ok(())
36213        })
36214    }
36215}
36216
36217/// ManageOfferSuccessResult is an XDR Struct defines as:
36218///
36219/// ```text
36220/// struct ManageOfferSuccessResult
36221/// {
36222///     // offers that got claimed while creating this offer
36223///     ClaimAtom offersClaimed<>;
36224///
36225///     union switch (ManageOfferEffect effect)
36226///     {
36227///     case MANAGE_OFFER_CREATED:
36228///     case MANAGE_OFFER_UPDATED:
36229///         OfferEntry offer;
36230///     case MANAGE_OFFER_DELETED:
36231///         void;
36232///     }
36233///     offer;
36234/// };
36235/// ```
36236///
36237#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
36238#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
36239#[cfg_attr(
36240    all(feature = "serde", feature = "alloc"),
36241    derive(serde::Serialize, serde::Deserialize),
36242    serde(rename_all = "snake_case")
36243)]
36244#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
36245pub struct ManageOfferSuccessResult {
36246    pub offers_claimed: VecM<ClaimAtom>,
36247    pub offer: ManageOfferSuccessResultOffer,
36248}
36249
36250impl ReadXdr for ManageOfferSuccessResult {
36251    #[cfg(feature = "std")]
36252    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
36253        r.with_limited_depth(|r| {
36254            Ok(Self {
36255                offers_claimed: VecM::<ClaimAtom>::read_xdr(r)?,
36256                offer: ManageOfferSuccessResultOffer::read_xdr(r)?,
36257            })
36258        })
36259    }
36260}
36261
36262impl WriteXdr for ManageOfferSuccessResult {
36263    #[cfg(feature = "std")]
36264    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
36265        w.with_limited_depth(|w| {
36266            self.offers_claimed.write_xdr(w)?;
36267            self.offer.write_xdr(w)?;
36268            Ok(())
36269        })
36270    }
36271}
36272
36273/// ManageSellOfferResult is an XDR Union defines as:
36274///
36275/// ```text
36276/// union ManageSellOfferResult switch (ManageSellOfferResultCode code)
36277/// {
36278/// case MANAGE_SELL_OFFER_SUCCESS:
36279///     ManageOfferSuccessResult success;
36280/// case MANAGE_SELL_OFFER_MALFORMED:
36281/// case MANAGE_SELL_OFFER_SELL_NO_TRUST:
36282/// case MANAGE_SELL_OFFER_BUY_NO_TRUST:
36283/// case MANAGE_SELL_OFFER_SELL_NOT_AUTHORIZED:
36284/// case MANAGE_SELL_OFFER_BUY_NOT_AUTHORIZED:
36285/// case MANAGE_SELL_OFFER_LINE_FULL:
36286/// case MANAGE_SELL_OFFER_UNDERFUNDED:
36287/// case MANAGE_SELL_OFFER_CROSS_SELF:
36288/// case MANAGE_SELL_OFFER_SELL_NO_ISSUER:
36289/// case MANAGE_SELL_OFFER_BUY_NO_ISSUER:
36290/// case MANAGE_SELL_OFFER_NOT_FOUND:
36291/// case MANAGE_SELL_OFFER_LOW_RESERVE:
36292///     void;
36293/// };
36294/// ```
36295///
36296// union with discriminant ManageSellOfferResultCode
36297#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
36298#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
36299#[cfg_attr(
36300    all(feature = "serde", feature = "alloc"),
36301    derive(serde::Serialize, serde::Deserialize),
36302    serde(rename_all = "snake_case")
36303)]
36304#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
36305#[allow(clippy::large_enum_variant)]
36306pub enum ManageSellOfferResult {
36307    Success(ManageOfferSuccessResult),
36308    Malformed,
36309    SellNoTrust,
36310    BuyNoTrust,
36311    SellNotAuthorized,
36312    BuyNotAuthorized,
36313    LineFull,
36314    Underfunded,
36315    CrossSelf,
36316    SellNoIssuer,
36317    BuyNoIssuer,
36318    NotFound,
36319    LowReserve,
36320}
36321
36322impl ManageSellOfferResult {
36323    pub const VARIANTS: [ManageSellOfferResultCode; 13] = [
36324        ManageSellOfferResultCode::Success,
36325        ManageSellOfferResultCode::Malformed,
36326        ManageSellOfferResultCode::SellNoTrust,
36327        ManageSellOfferResultCode::BuyNoTrust,
36328        ManageSellOfferResultCode::SellNotAuthorized,
36329        ManageSellOfferResultCode::BuyNotAuthorized,
36330        ManageSellOfferResultCode::LineFull,
36331        ManageSellOfferResultCode::Underfunded,
36332        ManageSellOfferResultCode::CrossSelf,
36333        ManageSellOfferResultCode::SellNoIssuer,
36334        ManageSellOfferResultCode::BuyNoIssuer,
36335        ManageSellOfferResultCode::NotFound,
36336        ManageSellOfferResultCode::LowReserve,
36337    ];
36338    pub const VARIANTS_STR: [&'static str; 13] = [
36339        "Success",
36340        "Malformed",
36341        "SellNoTrust",
36342        "BuyNoTrust",
36343        "SellNotAuthorized",
36344        "BuyNotAuthorized",
36345        "LineFull",
36346        "Underfunded",
36347        "CrossSelf",
36348        "SellNoIssuer",
36349        "BuyNoIssuer",
36350        "NotFound",
36351        "LowReserve",
36352    ];
36353
36354    #[must_use]
36355    pub const fn name(&self) -> &'static str {
36356        match self {
36357            Self::Success(_) => "Success",
36358            Self::Malformed => "Malformed",
36359            Self::SellNoTrust => "SellNoTrust",
36360            Self::BuyNoTrust => "BuyNoTrust",
36361            Self::SellNotAuthorized => "SellNotAuthorized",
36362            Self::BuyNotAuthorized => "BuyNotAuthorized",
36363            Self::LineFull => "LineFull",
36364            Self::Underfunded => "Underfunded",
36365            Self::CrossSelf => "CrossSelf",
36366            Self::SellNoIssuer => "SellNoIssuer",
36367            Self::BuyNoIssuer => "BuyNoIssuer",
36368            Self::NotFound => "NotFound",
36369            Self::LowReserve => "LowReserve",
36370        }
36371    }
36372
36373    #[must_use]
36374    pub const fn discriminant(&self) -> ManageSellOfferResultCode {
36375        #[allow(clippy::match_same_arms)]
36376        match self {
36377            Self::Success(_) => ManageSellOfferResultCode::Success,
36378            Self::Malformed => ManageSellOfferResultCode::Malformed,
36379            Self::SellNoTrust => ManageSellOfferResultCode::SellNoTrust,
36380            Self::BuyNoTrust => ManageSellOfferResultCode::BuyNoTrust,
36381            Self::SellNotAuthorized => ManageSellOfferResultCode::SellNotAuthorized,
36382            Self::BuyNotAuthorized => ManageSellOfferResultCode::BuyNotAuthorized,
36383            Self::LineFull => ManageSellOfferResultCode::LineFull,
36384            Self::Underfunded => ManageSellOfferResultCode::Underfunded,
36385            Self::CrossSelf => ManageSellOfferResultCode::CrossSelf,
36386            Self::SellNoIssuer => ManageSellOfferResultCode::SellNoIssuer,
36387            Self::BuyNoIssuer => ManageSellOfferResultCode::BuyNoIssuer,
36388            Self::NotFound => ManageSellOfferResultCode::NotFound,
36389            Self::LowReserve => ManageSellOfferResultCode::LowReserve,
36390        }
36391    }
36392
36393    #[must_use]
36394    pub const fn variants() -> [ManageSellOfferResultCode; 13] {
36395        Self::VARIANTS
36396    }
36397}
36398
36399impl Name for ManageSellOfferResult {
36400    #[must_use]
36401    fn name(&self) -> &'static str {
36402        Self::name(self)
36403    }
36404}
36405
36406impl Discriminant<ManageSellOfferResultCode> for ManageSellOfferResult {
36407    #[must_use]
36408    fn discriminant(&self) -> ManageSellOfferResultCode {
36409        Self::discriminant(self)
36410    }
36411}
36412
36413impl Variants<ManageSellOfferResultCode> for ManageSellOfferResult {
36414    fn variants() -> slice::Iter<'static, ManageSellOfferResultCode> {
36415        Self::VARIANTS.iter()
36416    }
36417}
36418
36419impl Union<ManageSellOfferResultCode> for ManageSellOfferResult {}
36420
36421impl ReadXdr for ManageSellOfferResult {
36422    #[cfg(feature = "std")]
36423    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
36424        r.with_limited_depth(|r| {
36425            let dv: ManageSellOfferResultCode =
36426                <ManageSellOfferResultCode as ReadXdr>::read_xdr(r)?;
36427            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
36428            let v = match dv {
36429                ManageSellOfferResultCode::Success => {
36430                    Self::Success(ManageOfferSuccessResult::read_xdr(r)?)
36431                }
36432                ManageSellOfferResultCode::Malformed => Self::Malformed,
36433                ManageSellOfferResultCode::SellNoTrust => Self::SellNoTrust,
36434                ManageSellOfferResultCode::BuyNoTrust => Self::BuyNoTrust,
36435                ManageSellOfferResultCode::SellNotAuthorized => Self::SellNotAuthorized,
36436                ManageSellOfferResultCode::BuyNotAuthorized => Self::BuyNotAuthorized,
36437                ManageSellOfferResultCode::LineFull => Self::LineFull,
36438                ManageSellOfferResultCode::Underfunded => Self::Underfunded,
36439                ManageSellOfferResultCode::CrossSelf => Self::CrossSelf,
36440                ManageSellOfferResultCode::SellNoIssuer => Self::SellNoIssuer,
36441                ManageSellOfferResultCode::BuyNoIssuer => Self::BuyNoIssuer,
36442                ManageSellOfferResultCode::NotFound => Self::NotFound,
36443                ManageSellOfferResultCode::LowReserve => Self::LowReserve,
36444                #[allow(unreachable_patterns)]
36445                _ => return Err(Error::Invalid),
36446            };
36447            Ok(v)
36448        })
36449    }
36450}
36451
36452impl WriteXdr for ManageSellOfferResult {
36453    #[cfg(feature = "std")]
36454    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
36455        w.with_limited_depth(|w| {
36456            self.discriminant().write_xdr(w)?;
36457            #[allow(clippy::match_same_arms)]
36458            match self {
36459                Self::Success(v) => v.write_xdr(w)?,
36460                Self::Malformed => ().write_xdr(w)?,
36461                Self::SellNoTrust => ().write_xdr(w)?,
36462                Self::BuyNoTrust => ().write_xdr(w)?,
36463                Self::SellNotAuthorized => ().write_xdr(w)?,
36464                Self::BuyNotAuthorized => ().write_xdr(w)?,
36465                Self::LineFull => ().write_xdr(w)?,
36466                Self::Underfunded => ().write_xdr(w)?,
36467                Self::CrossSelf => ().write_xdr(w)?,
36468                Self::SellNoIssuer => ().write_xdr(w)?,
36469                Self::BuyNoIssuer => ().write_xdr(w)?,
36470                Self::NotFound => ().write_xdr(w)?,
36471                Self::LowReserve => ().write_xdr(w)?,
36472            };
36473            Ok(())
36474        })
36475    }
36476}
36477
36478/// ManageBuyOfferResultCode is an XDR Enum defines as:
36479///
36480/// ```text
36481/// enum ManageBuyOfferResultCode
36482/// {
36483///     // codes considered as "success" for the operation
36484///     MANAGE_BUY_OFFER_SUCCESS = 0,
36485///
36486///     // codes considered as "failure" for the operation
36487///     MANAGE_BUY_OFFER_MALFORMED = -1,     // generated offer would be invalid
36488///     MANAGE_BUY_OFFER_SELL_NO_TRUST = -2, // no trust line for what we're selling
36489///     MANAGE_BUY_OFFER_BUY_NO_TRUST = -3,  // no trust line for what we're buying
36490///     MANAGE_BUY_OFFER_SELL_NOT_AUTHORIZED = -4, // not authorized to sell
36491///     MANAGE_BUY_OFFER_BUY_NOT_AUTHORIZED = -5,  // not authorized to buy
36492///     MANAGE_BUY_OFFER_LINE_FULL = -6,   // can't receive more of what it's buying
36493///     MANAGE_BUY_OFFER_UNDERFUNDED = -7, // doesn't hold what it's trying to sell
36494///     MANAGE_BUY_OFFER_CROSS_SELF = -8, // would cross an offer from the same user
36495///     MANAGE_BUY_OFFER_SELL_NO_ISSUER = -9, // no issuer for what we're selling
36496///     MANAGE_BUY_OFFER_BUY_NO_ISSUER = -10, // no issuer for what we're buying
36497///
36498///     // update errors
36499///     MANAGE_BUY_OFFER_NOT_FOUND =
36500///         -11, // offerID does not match an existing offer
36501///
36502///     MANAGE_BUY_OFFER_LOW_RESERVE = -12 // not enough funds to create a new Offer
36503/// };
36504/// ```
36505///
36506// enum
36507#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
36508#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
36509#[cfg_attr(
36510    all(feature = "serde", feature = "alloc"),
36511    derive(serde::Serialize, serde::Deserialize),
36512    serde(rename_all = "snake_case")
36513)]
36514#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
36515#[repr(i32)]
36516pub enum ManageBuyOfferResultCode {
36517    Success = 0,
36518    Malformed = -1,
36519    SellNoTrust = -2,
36520    BuyNoTrust = -3,
36521    SellNotAuthorized = -4,
36522    BuyNotAuthorized = -5,
36523    LineFull = -6,
36524    Underfunded = -7,
36525    CrossSelf = -8,
36526    SellNoIssuer = -9,
36527    BuyNoIssuer = -10,
36528    NotFound = -11,
36529    LowReserve = -12,
36530}
36531
36532impl ManageBuyOfferResultCode {
36533    pub const VARIANTS: [ManageBuyOfferResultCode; 13] = [
36534        ManageBuyOfferResultCode::Success,
36535        ManageBuyOfferResultCode::Malformed,
36536        ManageBuyOfferResultCode::SellNoTrust,
36537        ManageBuyOfferResultCode::BuyNoTrust,
36538        ManageBuyOfferResultCode::SellNotAuthorized,
36539        ManageBuyOfferResultCode::BuyNotAuthorized,
36540        ManageBuyOfferResultCode::LineFull,
36541        ManageBuyOfferResultCode::Underfunded,
36542        ManageBuyOfferResultCode::CrossSelf,
36543        ManageBuyOfferResultCode::SellNoIssuer,
36544        ManageBuyOfferResultCode::BuyNoIssuer,
36545        ManageBuyOfferResultCode::NotFound,
36546        ManageBuyOfferResultCode::LowReserve,
36547    ];
36548    pub const VARIANTS_STR: [&'static str; 13] = [
36549        "Success",
36550        "Malformed",
36551        "SellNoTrust",
36552        "BuyNoTrust",
36553        "SellNotAuthorized",
36554        "BuyNotAuthorized",
36555        "LineFull",
36556        "Underfunded",
36557        "CrossSelf",
36558        "SellNoIssuer",
36559        "BuyNoIssuer",
36560        "NotFound",
36561        "LowReserve",
36562    ];
36563
36564    #[must_use]
36565    pub const fn name(&self) -> &'static str {
36566        match self {
36567            Self::Success => "Success",
36568            Self::Malformed => "Malformed",
36569            Self::SellNoTrust => "SellNoTrust",
36570            Self::BuyNoTrust => "BuyNoTrust",
36571            Self::SellNotAuthorized => "SellNotAuthorized",
36572            Self::BuyNotAuthorized => "BuyNotAuthorized",
36573            Self::LineFull => "LineFull",
36574            Self::Underfunded => "Underfunded",
36575            Self::CrossSelf => "CrossSelf",
36576            Self::SellNoIssuer => "SellNoIssuer",
36577            Self::BuyNoIssuer => "BuyNoIssuer",
36578            Self::NotFound => "NotFound",
36579            Self::LowReserve => "LowReserve",
36580        }
36581    }
36582
36583    #[must_use]
36584    pub const fn variants() -> [ManageBuyOfferResultCode; 13] {
36585        Self::VARIANTS
36586    }
36587}
36588
36589impl Name for ManageBuyOfferResultCode {
36590    #[must_use]
36591    fn name(&self) -> &'static str {
36592        Self::name(self)
36593    }
36594}
36595
36596impl Variants<ManageBuyOfferResultCode> for ManageBuyOfferResultCode {
36597    fn variants() -> slice::Iter<'static, ManageBuyOfferResultCode> {
36598        Self::VARIANTS.iter()
36599    }
36600}
36601
36602impl Enum for ManageBuyOfferResultCode {}
36603
36604impl fmt::Display for ManageBuyOfferResultCode {
36605    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
36606        f.write_str(self.name())
36607    }
36608}
36609
36610impl TryFrom<i32> for ManageBuyOfferResultCode {
36611    type Error = Error;
36612
36613    fn try_from(i: i32) -> Result<Self> {
36614        let e = match i {
36615            0 => ManageBuyOfferResultCode::Success,
36616            -1 => ManageBuyOfferResultCode::Malformed,
36617            -2 => ManageBuyOfferResultCode::SellNoTrust,
36618            -3 => ManageBuyOfferResultCode::BuyNoTrust,
36619            -4 => ManageBuyOfferResultCode::SellNotAuthorized,
36620            -5 => ManageBuyOfferResultCode::BuyNotAuthorized,
36621            -6 => ManageBuyOfferResultCode::LineFull,
36622            -7 => ManageBuyOfferResultCode::Underfunded,
36623            -8 => ManageBuyOfferResultCode::CrossSelf,
36624            -9 => ManageBuyOfferResultCode::SellNoIssuer,
36625            -10 => ManageBuyOfferResultCode::BuyNoIssuer,
36626            -11 => ManageBuyOfferResultCode::NotFound,
36627            -12 => ManageBuyOfferResultCode::LowReserve,
36628            #[allow(unreachable_patterns)]
36629            _ => return Err(Error::Invalid),
36630        };
36631        Ok(e)
36632    }
36633}
36634
36635impl From<ManageBuyOfferResultCode> for i32 {
36636    #[must_use]
36637    fn from(e: ManageBuyOfferResultCode) -> Self {
36638        e as Self
36639    }
36640}
36641
36642impl ReadXdr for ManageBuyOfferResultCode {
36643    #[cfg(feature = "std")]
36644    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
36645        r.with_limited_depth(|r| {
36646            let e = i32::read_xdr(r)?;
36647            let v: Self = e.try_into()?;
36648            Ok(v)
36649        })
36650    }
36651}
36652
36653impl WriteXdr for ManageBuyOfferResultCode {
36654    #[cfg(feature = "std")]
36655    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
36656        w.with_limited_depth(|w| {
36657            let i: i32 = (*self).into();
36658            i.write_xdr(w)
36659        })
36660    }
36661}
36662
36663/// ManageBuyOfferResult is an XDR Union defines as:
36664///
36665/// ```text
36666/// union ManageBuyOfferResult switch (ManageBuyOfferResultCode code)
36667/// {
36668/// case MANAGE_BUY_OFFER_SUCCESS:
36669///     ManageOfferSuccessResult success;
36670/// case MANAGE_BUY_OFFER_MALFORMED:
36671/// case MANAGE_BUY_OFFER_SELL_NO_TRUST:
36672/// case MANAGE_BUY_OFFER_BUY_NO_TRUST:
36673/// case MANAGE_BUY_OFFER_SELL_NOT_AUTHORIZED:
36674/// case MANAGE_BUY_OFFER_BUY_NOT_AUTHORIZED:
36675/// case MANAGE_BUY_OFFER_LINE_FULL:
36676/// case MANAGE_BUY_OFFER_UNDERFUNDED:
36677/// case MANAGE_BUY_OFFER_CROSS_SELF:
36678/// case MANAGE_BUY_OFFER_SELL_NO_ISSUER:
36679/// case MANAGE_BUY_OFFER_BUY_NO_ISSUER:
36680/// case MANAGE_BUY_OFFER_NOT_FOUND:
36681/// case MANAGE_BUY_OFFER_LOW_RESERVE:
36682///     void;
36683/// };
36684/// ```
36685///
36686// union with discriminant ManageBuyOfferResultCode
36687#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
36688#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
36689#[cfg_attr(
36690    all(feature = "serde", feature = "alloc"),
36691    derive(serde::Serialize, serde::Deserialize),
36692    serde(rename_all = "snake_case")
36693)]
36694#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
36695#[allow(clippy::large_enum_variant)]
36696pub enum ManageBuyOfferResult {
36697    Success(ManageOfferSuccessResult),
36698    Malformed,
36699    SellNoTrust,
36700    BuyNoTrust,
36701    SellNotAuthorized,
36702    BuyNotAuthorized,
36703    LineFull,
36704    Underfunded,
36705    CrossSelf,
36706    SellNoIssuer,
36707    BuyNoIssuer,
36708    NotFound,
36709    LowReserve,
36710}
36711
36712impl ManageBuyOfferResult {
36713    pub const VARIANTS: [ManageBuyOfferResultCode; 13] = [
36714        ManageBuyOfferResultCode::Success,
36715        ManageBuyOfferResultCode::Malformed,
36716        ManageBuyOfferResultCode::SellNoTrust,
36717        ManageBuyOfferResultCode::BuyNoTrust,
36718        ManageBuyOfferResultCode::SellNotAuthorized,
36719        ManageBuyOfferResultCode::BuyNotAuthorized,
36720        ManageBuyOfferResultCode::LineFull,
36721        ManageBuyOfferResultCode::Underfunded,
36722        ManageBuyOfferResultCode::CrossSelf,
36723        ManageBuyOfferResultCode::SellNoIssuer,
36724        ManageBuyOfferResultCode::BuyNoIssuer,
36725        ManageBuyOfferResultCode::NotFound,
36726        ManageBuyOfferResultCode::LowReserve,
36727    ];
36728    pub const VARIANTS_STR: [&'static str; 13] = [
36729        "Success",
36730        "Malformed",
36731        "SellNoTrust",
36732        "BuyNoTrust",
36733        "SellNotAuthorized",
36734        "BuyNotAuthorized",
36735        "LineFull",
36736        "Underfunded",
36737        "CrossSelf",
36738        "SellNoIssuer",
36739        "BuyNoIssuer",
36740        "NotFound",
36741        "LowReserve",
36742    ];
36743
36744    #[must_use]
36745    pub const fn name(&self) -> &'static str {
36746        match self {
36747            Self::Success(_) => "Success",
36748            Self::Malformed => "Malformed",
36749            Self::SellNoTrust => "SellNoTrust",
36750            Self::BuyNoTrust => "BuyNoTrust",
36751            Self::SellNotAuthorized => "SellNotAuthorized",
36752            Self::BuyNotAuthorized => "BuyNotAuthorized",
36753            Self::LineFull => "LineFull",
36754            Self::Underfunded => "Underfunded",
36755            Self::CrossSelf => "CrossSelf",
36756            Self::SellNoIssuer => "SellNoIssuer",
36757            Self::BuyNoIssuer => "BuyNoIssuer",
36758            Self::NotFound => "NotFound",
36759            Self::LowReserve => "LowReserve",
36760        }
36761    }
36762
36763    #[must_use]
36764    pub const fn discriminant(&self) -> ManageBuyOfferResultCode {
36765        #[allow(clippy::match_same_arms)]
36766        match self {
36767            Self::Success(_) => ManageBuyOfferResultCode::Success,
36768            Self::Malformed => ManageBuyOfferResultCode::Malformed,
36769            Self::SellNoTrust => ManageBuyOfferResultCode::SellNoTrust,
36770            Self::BuyNoTrust => ManageBuyOfferResultCode::BuyNoTrust,
36771            Self::SellNotAuthorized => ManageBuyOfferResultCode::SellNotAuthorized,
36772            Self::BuyNotAuthorized => ManageBuyOfferResultCode::BuyNotAuthorized,
36773            Self::LineFull => ManageBuyOfferResultCode::LineFull,
36774            Self::Underfunded => ManageBuyOfferResultCode::Underfunded,
36775            Self::CrossSelf => ManageBuyOfferResultCode::CrossSelf,
36776            Self::SellNoIssuer => ManageBuyOfferResultCode::SellNoIssuer,
36777            Self::BuyNoIssuer => ManageBuyOfferResultCode::BuyNoIssuer,
36778            Self::NotFound => ManageBuyOfferResultCode::NotFound,
36779            Self::LowReserve => ManageBuyOfferResultCode::LowReserve,
36780        }
36781    }
36782
36783    #[must_use]
36784    pub const fn variants() -> [ManageBuyOfferResultCode; 13] {
36785        Self::VARIANTS
36786    }
36787}
36788
36789impl Name for ManageBuyOfferResult {
36790    #[must_use]
36791    fn name(&self) -> &'static str {
36792        Self::name(self)
36793    }
36794}
36795
36796impl Discriminant<ManageBuyOfferResultCode> for ManageBuyOfferResult {
36797    #[must_use]
36798    fn discriminant(&self) -> ManageBuyOfferResultCode {
36799        Self::discriminant(self)
36800    }
36801}
36802
36803impl Variants<ManageBuyOfferResultCode> for ManageBuyOfferResult {
36804    fn variants() -> slice::Iter<'static, ManageBuyOfferResultCode> {
36805        Self::VARIANTS.iter()
36806    }
36807}
36808
36809impl Union<ManageBuyOfferResultCode> for ManageBuyOfferResult {}
36810
36811impl ReadXdr for ManageBuyOfferResult {
36812    #[cfg(feature = "std")]
36813    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
36814        r.with_limited_depth(|r| {
36815            let dv: ManageBuyOfferResultCode = <ManageBuyOfferResultCode as ReadXdr>::read_xdr(r)?;
36816            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
36817            let v = match dv {
36818                ManageBuyOfferResultCode::Success => {
36819                    Self::Success(ManageOfferSuccessResult::read_xdr(r)?)
36820                }
36821                ManageBuyOfferResultCode::Malformed => Self::Malformed,
36822                ManageBuyOfferResultCode::SellNoTrust => Self::SellNoTrust,
36823                ManageBuyOfferResultCode::BuyNoTrust => Self::BuyNoTrust,
36824                ManageBuyOfferResultCode::SellNotAuthorized => Self::SellNotAuthorized,
36825                ManageBuyOfferResultCode::BuyNotAuthorized => Self::BuyNotAuthorized,
36826                ManageBuyOfferResultCode::LineFull => Self::LineFull,
36827                ManageBuyOfferResultCode::Underfunded => Self::Underfunded,
36828                ManageBuyOfferResultCode::CrossSelf => Self::CrossSelf,
36829                ManageBuyOfferResultCode::SellNoIssuer => Self::SellNoIssuer,
36830                ManageBuyOfferResultCode::BuyNoIssuer => Self::BuyNoIssuer,
36831                ManageBuyOfferResultCode::NotFound => Self::NotFound,
36832                ManageBuyOfferResultCode::LowReserve => Self::LowReserve,
36833                #[allow(unreachable_patterns)]
36834                _ => return Err(Error::Invalid),
36835            };
36836            Ok(v)
36837        })
36838    }
36839}
36840
36841impl WriteXdr for ManageBuyOfferResult {
36842    #[cfg(feature = "std")]
36843    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
36844        w.with_limited_depth(|w| {
36845            self.discriminant().write_xdr(w)?;
36846            #[allow(clippy::match_same_arms)]
36847            match self {
36848                Self::Success(v) => v.write_xdr(w)?,
36849                Self::Malformed => ().write_xdr(w)?,
36850                Self::SellNoTrust => ().write_xdr(w)?,
36851                Self::BuyNoTrust => ().write_xdr(w)?,
36852                Self::SellNotAuthorized => ().write_xdr(w)?,
36853                Self::BuyNotAuthorized => ().write_xdr(w)?,
36854                Self::LineFull => ().write_xdr(w)?,
36855                Self::Underfunded => ().write_xdr(w)?,
36856                Self::CrossSelf => ().write_xdr(w)?,
36857                Self::SellNoIssuer => ().write_xdr(w)?,
36858                Self::BuyNoIssuer => ().write_xdr(w)?,
36859                Self::NotFound => ().write_xdr(w)?,
36860                Self::LowReserve => ().write_xdr(w)?,
36861            };
36862            Ok(())
36863        })
36864    }
36865}
36866
36867/// SetOptionsResultCode is an XDR Enum defines as:
36868///
36869/// ```text
36870/// enum SetOptionsResultCode
36871/// {
36872///     // codes considered as "success" for the operation
36873///     SET_OPTIONS_SUCCESS = 0,
36874///     // codes considered as "failure" for the operation
36875///     SET_OPTIONS_LOW_RESERVE = -1,      // not enough funds to add a signer
36876///     SET_OPTIONS_TOO_MANY_SIGNERS = -2, // max number of signers already reached
36877///     SET_OPTIONS_BAD_FLAGS = -3,        // invalid combination of clear/set flags
36878///     SET_OPTIONS_INVALID_INFLATION = -4,      // inflation account does not exist
36879///     SET_OPTIONS_CANT_CHANGE = -5,            // can no longer change this option
36880///     SET_OPTIONS_UNKNOWN_FLAG = -6,           // can't set an unknown flag
36881///     SET_OPTIONS_THRESHOLD_OUT_OF_RANGE = -7, // bad value for weight/threshold
36882///     SET_OPTIONS_BAD_SIGNER = -8,             // signer cannot be masterkey
36883///     SET_OPTIONS_INVALID_HOME_DOMAIN = -9,    // malformed home domain
36884///     SET_OPTIONS_AUTH_REVOCABLE_REQUIRED =
36885///         -10 // auth revocable is required for clawback
36886/// };
36887/// ```
36888///
36889// enum
36890#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
36891#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
36892#[cfg_attr(
36893    all(feature = "serde", feature = "alloc"),
36894    derive(serde::Serialize, serde::Deserialize),
36895    serde(rename_all = "snake_case")
36896)]
36897#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
36898#[repr(i32)]
36899pub enum SetOptionsResultCode {
36900    Success = 0,
36901    LowReserve = -1,
36902    TooManySigners = -2,
36903    BadFlags = -3,
36904    InvalidInflation = -4,
36905    CantChange = -5,
36906    UnknownFlag = -6,
36907    ThresholdOutOfRange = -7,
36908    BadSigner = -8,
36909    InvalidHomeDomain = -9,
36910    AuthRevocableRequired = -10,
36911}
36912
36913impl SetOptionsResultCode {
36914    pub const VARIANTS: [SetOptionsResultCode; 11] = [
36915        SetOptionsResultCode::Success,
36916        SetOptionsResultCode::LowReserve,
36917        SetOptionsResultCode::TooManySigners,
36918        SetOptionsResultCode::BadFlags,
36919        SetOptionsResultCode::InvalidInflation,
36920        SetOptionsResultCode::CantChange,
36921        SetOptionsResultCode::UnknownFlag,
36922        SetOptionsResultCode::ThresholdOutOfRange,
36923        SetOptionsResultCode::BadSigner,
36924        SetOptionsResultCode::InvalidHomeDomain,
36925        SetOptionsResultCode::AuthRevocableRequired,
36926    ];
36927    pub const VARIANTS_STR: [&'static str; 11] = [
36928        "Success",
36929        "LowReserve",
36930        "TooManySigners",
36931        "BadFlags",
36932        "InvalidInflation",
36933        "CantChange",
36934        "UnknownFlag",
36935        "ThresholdOutOfRange",
36936        "BadSigner",
36937        "InvalidHomeDomain",
36938        "AuthRevocableRequired",
36939    ];
36940
36941    #[must_use]
36942    pub const fn name(&self) -> &'static str {
36943        match self {
36944            Self::Success => "Success",
36945            Self::LowReserve => "LowReserve",
36946            Self::TooManySigners => "TooManySigners",
36947            Self::BadFlags => "BadFlags",
36948            Self::InvalidInflation => "InvalidInflation",
36949            Self::CantChange => "CantChange",
36950            Self::UnknownFlag => "UnknownFlag",
36951            Self::ThresholdOutOfRange => "ThresholdOutOfRange",
36952            Self::BadSigner => "BadSigner",
36953            Self::InvalidHomeDomain => "InvalidHomeDomain",
36954            Self::AuthRevocableRequired => "AuthRevocableRequired",
36955        }
36956    }
36957
36958    #[must_use]
36959    pub const fn variants() -> [SetOptionsResultCode; 11] {
36960        Self::VARIANTS
36961    }
36962}
36963
36964impl Name for SetOptionsResultCode {
36965    #[must_use]
36966    fn name(&self) -> &'static str {
36967        Self::name(self)
36968    }
36969}
36970
36971impl Variants<SetOptionsResultCode> for SetOptionsResultCode {
36972    fn variants() -> slice::Iter<'static, SetOptionsResultCode> {
36973        Self::VARIANTS.iter()
36974    }
36975}
36976
36977impl Enum for SetOptionsResultCode {}
36978
36979impl fmt::Display for SetOptionsResultCode {
36980    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
36981        f.write_str(self.name())
36982    }
36983}
36984
36985impl TryFrom<i32> for SetOptionsResultCode {
36986    type Error = Error;
36987
36988    fn try_from(i: i32) -> Result<Self> {
36989        let e = match i {
36990            0 => SetOptionsResultCode::Success,
36991            -1 => SetOptionsResultCode::LowReserve,
36992            -2 => SetOptionsResultCode::TooManySigners,
36993            -3 => SetOptionsResultCode::BadFlags,
36994            -4 => SetOptionsResultCode::InvalidInflation,
36995            -5 => SetOptionsResultCode::CantChange,
36996            -6 => SetOptionsResultCode::UnknownFlag,
36997            -7 => SetOptionsResultCode::ThresholdOutOfRange,
36998            -8 => SetOptionsResultCode::BadSigner,
36999            -9 => SetOptionsResultCode::InvalidHomeDomain,
37000            -10 => SetOptionsResultCode::AuthRevocableRequired,
37001            #[allow(unreachable_patterns)]
37002            _ => return Err(Error::Invalid),
37003        };
37004        Ok(e)
37005    }
37006}
37007
37008impl From<SetOptionsResultCode> for i32 {
37009    #[must_use]
37010    fn from(e: SetOptionsResultCode) -> Self {
37011        e as Self
37012    }
37013}
37014
37015impl ReadXdr for SetOptionsResultCode {
37016    #[cfg(feature = "std")]
37017    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
37018        r.with_limited_depth(|r| {
37019            let e = i32::read_xdr(r)?;
37020            let v: Self = e.try_into()?;
37021            Ok(v)
37022        })
37023    }
37024}
37025
37026impl WriteXdr for SetOptionsResultCode {
37027    #[cfg(feature = "std")]
37028    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
37029        w.with_limited_depth(|w| {
37030            let i: i32 = (*self).into();
37031            i.write_xdr(w)
37032        })
37033    }
37034}
37035
37036/// SetOptionsResult is an XDR Union defines as:
37037///
37038/// ```text
37039/// union SetOptionsResult switch (SetOptionsResultCode code)
37040/// {
37041/// case SET_OPTIONS_SUCCESS:
37042///     void;
37043/// case SET_OPTIONS_LOW_RESERVE:
37044/// case SET_OPTIONS_TOO_MANY_SIGNERS:
37045/// case SET_OPTIONS_BAD_FLAGS:
37046/// case SET_OPTIONS_INVALID_INFLATION:
37047/// case SET_OPTIONS_CANT_CHANGE:
37048/// case SET_OPTIONS_UNKNOWN_FLAG:
37049/// case SET_OPTIONS_THRESHOLD_OUT_OF_RANGE:
37050/// case SET_OPTIONS_BAD_SIGNER:
37051/// case SET_OPTIONS_INVALID_HOME_DOMAIN:
37052/// case SET_OPTIONS_AUTH_REVOCABLE_REQUIRED:
37053///     void;
37054/// };
37055/// ```
37056///
37057// union with discriminant SetOptionsResultCode
37058#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
37059#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
37060#[cfg_attr(
37061    all(feature = "serde", feature = "alloc"),
37062    derive(serde::Serialize, serde::Deserialize),
37063    serde(rename_all = "snake_case")
37064)]
37065#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
37066#[allow(clippy::large_enum_variant)]
37067pub enum SetOptionsResult {
37068    Success,
37069    LowReserve,
37070    TooManySigners,
37071    BadFlags,
37072    InvalidInflation,
37073    CantChange,
37074    UnknownFlag,
37075    ThresholdOutOfRange,
37076    BadSigner,
37077    InvalidHomeDomain,
37078    AuthRevocableRequired,
37079}
37080
37081impl SetOptionsResult {
37082    pub const VARIANTS: [SetOptionsResultCode; 11] = [
37083        SetOptionsResultCode::Success,
37084        SetOptionsResultCode::LowReserve,
37085        SetOptionsResultCode::TooManySigners,
37086        SetOptionsResultCode::BadFlags,
37087        SetOptionsResultCode::InvalidInflation,
37088        SetOptionsResultCode::CantChange,
37089        SetOptionsResultCode::UnknownFlag,
37090        SetOptionsResultCode::ThresholdOutOfRange,
37091        SetOptionsResultCode::BadSigner,
37092        SetOptionsResultCode::InvalidHomeDomain,
37093        SetOptionsResultCode::AuthRevocableRequired,
37094    ];
37095    pub const VARIANTS_STR: [&'static str; 11] = [
37096        "Success",
37097        "LowReserve",
37098        "TooManySigners",
37099        "BadFlags",
37100        "InvalidInflation",
37101        "CantChange",
37102        "UnknownFlag",
37103        "ThresholdOutOfRange",
37104        "BadSigner",
37105        "InvalidHomeDomain",
37106        "AuthRevocableRequired",
37107    ];
37108
37109    #[must_use]
37110    pub const fn name(&self) -> &'static str {
37111        match self {
37112            Self::Success => "Success",
37113            Self::LowReserve => "LowReserve",
37114            Self::TooManySigners => "TooManySigners",
37115            Self::BadFlags => "BadFlags",
37116            Self::InvalidInflation => "InvalidInflation",
37117            Self::CantChange => "CantChange",
37118            Self::UnknownFlag => "UnknownFlag",
37119            Self::ThresholdOutOfRange => "ThresholdOutOfRange",
37120            Self::BadSigner => "BadSigner",
37121            Self::InvalidHomeDomain => "InvalidHomeDomain",
37122            Self::AuthRevocableRequired => "AuthRevocableRequired",
37123        }
37124    }
37125
37126    #[must_use]
37127    pub const fn discriminant(&self) -> SetOptionsResultCode {
37128        #[allow(clippy::match_same_arms)]
37129        match self {
37130            Self::Success => SetOptionsResultCode::Success,
37131            Self::LowReserve => SetOptionsResultCode::LowReserve,
37132            Self::TooManySigners => SetOptionsResultCode::TooManySigners,
37133            Self::BadFlags => SetOptionsResultCode::BadFlags,
37134            Self::InvalidInflation => SetOptionsResultCode::InvalidInflation,
37135            Self::CantChange => SetOptionsResultCode::CantChange,
37136            Self::UnknownFlag => SetOptionsResultCode::UnknownFlag,
37137            Self::ThresholdOutOfRange => SetOptionsResultCode::ThresholdOutOfRange,
37138            Self::BadSigner => SetOptionsResultCode::BadSigner,
37139            Self::InvalidHomeDomain => SetOptionsResultCode::InvalidHomeDomain,
37140            Self::AuthRevocableRequired => SetOptionsResultCode::AuthRevocableRequired,
37141        }
37142    }
37143
37144    #[must_use]
37145    pub const fn variants() -> [SetOptionsResultCode; 11] {
37146        Self::VARIANTS
37147    }
37148}
37149
37150impl Name for SetOptionsResult {
37151    #[must_use]
37152    fn name(&self) -> &'static str {
37153        Self::name(self)
37154    }
37155}
37156
37157impl Discriminant<SetOptionsResultCode> for SetOptionsResult {
37158    #[must_use]
37159    fn discriminant(&self) -> SetOptionsResultCode {
37160        Self::discriminant(self)
37161    }
37162}
37163
37164impl Variants<SetOptionsResultCode> for SetOptionsResult {
37165    fn variants() -> slice::Iter<'static, SetOptionsResultCode> {
37166        Self::VARIANTS.iter()
37167    }
37168}
37169
37170impl Union<SetOptionsResultCode> for SetOptionsResult {}
37171
37172impl ReadXdr for SetOptionsResult {
37173    #[cfg(feature = "std")]
37174    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
37175        r.with_limited_depth(|r| {
37176            let dv: SetOptionsResultCode = <SetOptionsResultCode as ReadXdr>::read_xdr(r)?;
37177            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
37178            let v = match dv {
37179                SetOptionsResultCode::Success => Self::Success,
37180                SetOptionsResultCode::LowReserve => Self::LowReserve,
37181                SetOptionsResultCode::TooManySigners => Self::TooManySigners,
37182                SetOptionsResultCode::BadFlags => Self::BadFlags,
37183                SetOptionsResultCode::InvalidInflation => Self::InvalidInflation,
37184                SetOptionsResultCode::CantChange => Self::CantChange,
37185                SetOptionsResultCode::UnknownFlag => Self::UnknownFlag,
37186                SetOptionsResultCode::ThresholdOutOfRange => Self::ThresholdOutOfRange,
37187                SetOptionsResultCode::BadSigner => Self::BadSigner,
37188                SetOptionsResultCode::InvalidHomeDomain => Self::InvalidHomeDomain,
37189                SetOptionsResultCode::AuthRevocableRequired => Self::AuthRevocableRequired,
37190                #[allow(unreachable_patterns)]
37191                _ => return Err(Error::Invalid),
37192            };
37193            Ok(v)
37194        })
37195    }
37196}
37197
37198impl WriteXdr for SetOptionsResult {
37199    #[cfg(feature = "std")]
37200    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
37201        w.with_limited_depth(|w| {
37202            self.discriminant().write_xdr(w)?;
37203            #[allow(clippy::match_same_arms)]
37204            match self {
37205                Self::Success => ().write_xdr(w)?,
37206                Self::LowReserve => ().write_xdr(w)?,
37207                Self::TooManySigners => ().write_xdr(w)?,
37208                Self::BadFlags => ().write_xdr(w)?,
37209                Self::InvalidInflation => ().write_xdr(w)?,
37210                Self::CantChange => ().write_xdr(w)?,
37211                Self::UnknownFlag => ().write_xdr(w)?,
37212                Self::ThresholdOutOfRange => ().write_xdr(w)?,
37213                Self::BadSigner => ().write_xdr(w)?,
37214                Self::InvalidHomeDomain => ().write_xdr(w)?,
37215                Self::AuthRevocableRequired => ().write_xdr(w)?,
37216            };
37217            Ok(())
37218        })
37219    }
37220}
37221
37222/// ChangeTrustResultCode is an XDR Enum defines as:
37223///
37224/// ```text
37225/// enum ChangeTrustResultCode
37226/// {
37227///     // codes considered as "success" for the operation
37228///     CHANGE_TRUST_SUCCESS = 0,
37229///     // codes considered as "failure" for the operation
37230///     CHANGE_TRUST_MALFORMED = -1,     // bad input
37231///     CHANGE_TRUST_NO_ISSUER = -2,     // could not find issuer
37232///     CHANGE_TRUST_INVALID_LIMIT = -3, // cannot drop limit below balance
37233///                                      // cannot create with a limit of 0
37234///     CHANGE_TRUST_LOW_RESERVE =
37235///         -4, // not enough funds to create a new trust line,
37236///     CHANGE_TRUST_SELF_NOT_ALLOWED = -5,   // trusting self is not allowed
37237///     CHANGE_TRUST_TRUST_LINE_MISSING = -6, // Asset trustline is missing for pool
37238///     CHANGE_TRUST_CANNOT_DELETE =
37239///         -7, // Asset trustline is still referenced in a pool
37240///     CHANGE_TRUST_NOT_AUTH_MAINTAIN_LIABILITIES =
37241///         -8 // Asset trustline is deauthorized
37242/// };
37243/// ```
37244///
37245// enum
37246#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
37247#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
37248#[cfg_attr(
37249    all(feature = "serde", feature = "alloc"),
37250    derive(serde::Serialize, serde::Deserialize),
37251    serde(rename_all = "snake_case")
37252)]
37253#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
37254#[repr(i32)]
37255pub enum ChangeTrustResultCode {
37256    Success = 0,
37257    Malformed = -1,
37258    NoIssuer = -2,
37259    InvalidLimit = -3,
37260    LowReserve = -4,
37261    SelfNotAllowed = -5,
37262    TrustLineMissing = -6,
37263    CannotDelete = -7,
37264    NotAuthMaintainLiabilities = -8,
37265}
37266
37267impl ChangeTrustResultCode {
37268    pub const VARIANTS: [ChangeTrustResultCode; 9] = [
37269        ChangeTrustResultCode::Success,
37270        ChangeTrustResultCode::Malformed,
37271        ChangeTrustResultCode::NoIssuer,
37272        ChangeTrustResultCode::InvalidLimit,
37273        ChangeTrustResultCode::LowReserve,
37274        ChangeTrustResultCode::SelfNotAllowed,
37275        ChangeTrustResultCode::TrustLineMissing,
37276        ChangeTrustResultCode::CannotDelete,
37277        ChangeTrustResultCode::NotAuthMaintainLiabilities,
37278    ];
37279    pub const VARIANTS_STR: [&'static str; 9] = [
37280        "Success",
37281        "Malformed",
37282        "NoIssuer",
37283        "InvalidLimit",
37284        "LowReserve",
37285        "SelfNotAllowed",
37286        "TrustLineMissing",
37287        "CannotDelete",
37288        "NotAuthMaintainLiabilities",
37289    ];
37290
37291    #[must_use]
37292    pub const fn name(&self) -> &'static str {
37293        match self {
37294            Self::Success => "Success",
37295            Self::Malformed => "Malformed",
37296            Self::NoIssuer => "NoIssuer",
37297            Self::InvalidLimit => "InvalidLimit",
37298            Self::LowReserve => "LowReserve",
37299            Self::SelfNotAllowed => "SelfNotAllowed",
37300            Self::TrustLineMissing => "TrustLineMissing",
37301            Self::CannotDelete => "CannotDelete",
37302            Self::NotAuthMaintainLiabilities => "NotAuthMaintainLiabilities",
37303        }
37304    }
37305
37306    #[must_use]
37307    pub const fn variants() -> [ChangeTrustResultCode; 9] {
37308        Self::VARIANTS
37309    }
37310}
37311
37312impl Name for ChangeTrustResultCode {
37313    #[must_use]
37314    fn name(&self) -> &'static str {
37315        Self::name(self)
37316    }
37317}
37318
37319impl Variants<ChangeTrustResultCode> for ChangeTrustResultCode {
37320    fn variants() -> slice::Iter<'static, ChangeTrustResultCode> {
37321        Self::VARIANTS.iter()
37322    }
37323}
37324
37325impl Enum for ChangeTrustResultCode {}
37326
37327impl fmt::Display for ChangeTrustResultCode {
37328    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
37329        f.write_str(self.name())
37330    }
37331}
37332
37333impl TryFrom<i32> for ChangeTrustResultCode {
37334    type Error = Error;
37335
37336    fn try_from(i: i32) -> Result<Self> {
37337        let e = match i {
37338            0 => ChangeTrustResultCode::Success,
37339            -1 => ChangeTrustResultCode::Malformed,
37340            -2 => ChangeTrustResultCode::NoIssuer,
37341            -3 => ChangeTrustResultCode::InvalidLimit,
37342            -4 => ChangeTrustResultCode::LowReserve,
37343            -5 => ChangeTrustResultCode::SelfNotAllowed,
37344            -6 => ChangeTrustResultCode::TrustLineMissing,
37345            -7 => ChangeTrustResultCode::CannotDelete,
37346            -8 => ChangeTrustResultCode::NotAuthMaintainLiabilities,
37347            #[allow(unreachable_patterns)]
37348            _ => return Err(Error::Invalid),
37349        };
37350        Ok(e)
37351    }
37352}
37353
37354impl From<ChangeTrustResultCode> for i32 {
37355    #[must_use]
37356    fn from(e: ChangeTrustResultCode) -> Self {
37357        e as Self
37358    }
37359}
37360
37361impl ReadXdr for ChangeTrustResultCode {
37362    #[cfg(feature = "std")]
37363    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
37364        r.with_limited_depth(|r| {
37365            let e = i32::read_xdr(r)?;
37366            let v: Self = e.try_into()?;
37367            Ok(v)
37368        })
37369    }
37370}
37371
37372impl WriteXdr for ChangeTrustResultCode {
37373    #[cfg(feature = "std")]
37374    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
37375        w.with_limited_depth(|w| {
37376            let i: i32 = (*self).into();
37377            i.write_xdr(w)
37378        })
37379    }
37380}
37381
37382/// ChangeTrustResult is an XDR Union defines as:
37383///
37384/// ```text
37385/// union ChangeTrustResult switch (ChangeTrustResultCode code)
37386/// {
37387/// case CHANGE_TRUST_SUCCESS:
37388///     void;
37389/// case CHANGE_TRUST_MALFORMED:
37390/// case CHANGE_TRUST_NO_ISSUER:
37391/// case CHANGE_TRUST_INVALID_LIMIT:
37392/// case CHANGE_TRUST_LOW_RESERVE:
37393/// case CHANGE_TRUST_SELF_NOT_ALLOWED:
37394/// case CHANGE_TRUST_TRUST_LINE_MISSING:
37395/// case CHANGE_TRUST_CANNOT_DELETE:
37396/// case CHANGE_TRUST_NOT_AUTH_MAINTAIN_LIABILITIES:
37397///     void;
37398/// };
37399/// ```
37400///
37401// union with discriminant ChangeTrustResultCode
37402#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
37403#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
37404#[cfg_attr(
37405    all(feature = "serde", feature = "alloc"),
37406    derive(serde::Serialize, serde::Deserialize),
37407    serde(rename_all = "snake_case")
37408)]
37409#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
37410#[allow(clippy::large_enum_variant)]
37411pub enum ChangeTrustResult {
37412    Success,
37413    Malformed,
37414    NoIssuer,
37415    InvalidLimit,
37416    LowReserve,
37417    SelfNotAllowed,
37418    TrustLineMissing,
37419    CannotDelete,
37420    NotAuthMaintainLiabilities,
37421}
37422
37423impl ChangeTrustResult {
37424    pub const VARIANTS: [ChangeTrustResultCode; 9] = [
37425        ChangeTrustResultCode::Success,
37426        ChangeTrustResultCode::Malformed,
37427        ChangeTrustResultCode::NoIssuer,
37428        ChangeTrustResultCode::InvalidLimit,
37429        ChangeTrustResultCode::LowReserve,
37430        ChangeTrustResultCode::SelfNotAllowed,
37431        ChangeTrustResultCode::TrustLineMissing,
37432        ChangeTrustResultCode::CannotDelete,
37433        ChangeTrustResultCode::NotAuthMaintainLiabilities,
37434    ];
37435    pub const VARIANTS_STR: [&'static str; 9] = [
37436        "Success",
37437        "Malformed",
37438        "NoIssuer",
37439        "InvalidLimit",
37440        "LowReserve",
37441        "SelfNotAllowed",
37442        "TrustLineMissing",
37443        "CannotDelete",
37444        "NotAuthMaintainLiabilities",
37445    ];
37446
37447    #[must_use]
37448    pub const fn name(&self) -> &'static str {
37449        match self {
37450            Self::Success => "Success",
37451            Self::Malformed => "Malformed",
37452            Self::NoIssuer => "NoIssuer",
37453            Self::InvalidLimit => "InvalidLimit",
37454            Self::LowReserve => "LowReserve",
37455            Self::SelfNotAllowed => "SelfNotAllowed",
37456            Self::TrustLineMissing => "TrustLineMissing",
37457            Self::CannotDelete => "CannotDelete",
37458            Self::NotAuthMaintainLiabilities => "NotAuthMaintainLiabilities",
37459        }
37460    }
37461
37462    #[must_use]
37463    pub const fn discriminant(&self) -> ChangeTrustResultCode {
37464        #[allow(clippy::match_same_arms)]
37465        match self {
37466            Self::Success => ChangeTrustResultCode::Success,
37467            Self::Malformed => ChangeTrustResultCode::Malformed,
37468            Self::NoIssuer => ChangeTrustResultCode::NoIssuer,
37469            Self::InvalidLimit => ChangeTrustResultCode::InvalidLimit,
37470            Self::LowReserve => ChangeTrustResultCode::LowReserve,
37471            Self::SelfNotAllowed => ChangeTrustResultCode::SelfNotAllowed,
37472            Self::TrustLineMissing => ChangeTrustResultCode::TrustLineMissing,
37473            Self::CannotDelete => ChangeTrustResultCode::CannotDelete,
37474            Self::NotAuthMaintainLiabilities => ChangeTrustResultCode::NotAuthMaintainLiabilities,
37475        }
37476    }
37477
37478    #[must_use]
37479    pub const fn variants() -> [ChangeTrustResultCode; 9] {
37480        Self::VARIANTS
37481    }
37482}
37483
37484impl Name for ChangeTrustResult {
37485    #[must_use]
37486    fn name(&self) -> &'static str {
37487        Self::name(self)
37488    }
37489}
37490
37491impl Discriminant<ChangeTrustResultCode> for ChangeTrustResult {
37492    #[must_use]
37493    fn discriminant(&self) -> ChangeTrustResultCode {
37494        Self::discriminant(self)
37495    }
37496}
37497
37498impl Variants<ChangeTrustResultCode> for ChangeTrustResult {
37499    fn variants() -> slice::Iter<'static, ChangeTrustResultCode> {
37500        Self::VARIANTS.iter()
37501    }
37502}
37503
37504impl Union<ChangeTrustResultCode> for ChangeTrustResult {}
37505
37506impl ReadXdr for ChangeTrustResult {
37507    #[cfg(feature = "std")]
37508    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
37509        r.with_limited_depth(|r| {
37510            let dv: ChangeTrustResultCode = <ChangeTrustResultCode as ReadXdr>::read_xdr(r)?;
37511            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
37512            let v = match dv {
37513                ChangeTrustResultCode::Success => Self::Success,
37514                ChangeTrustResultCode::Malformed => Self::Malformed,
37515                ChangeTrustResultCode::NoIssuer => Self::NoIssuer,
37516                ChangeTrustResultCode::InvalidLimit => Self::InvalidLimit,
37517                ChangeTrustResultCode::LowReserve => Self::LowReserve,
37518                ChangeTrustResultCode::SelfNotAllowed => Self::SelfNotAllowed,
37519                ChangeTrustResultCode::TrustLineMissing => Self::TrustLineMissing,
37520                ChangeTrustResultCode::CannotDelete => Self::CannotDelete,
37521                ChangeTrustResultCode::NotAuthMaintainLiabilities => {
37522                    Self::NotAuthMaintainLiabilities
37523                }
37524                #[allow(unreachable_patterns)]
37525                _ => return Err(Error::Invalid),
37526            };
37527            Ok(v)
37528        })
37529    }
37530}
37531
37532impl WriteXdr for ChangeTrustResult {
37533    #[cfg(feature = "std")]
37534    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
37535        w.with_limited_depth(|w| {
37536            self.discriminant().write_xdr(w)?;
37537            #[allow(clippy::match_same_arms)]
37538            match self {
37539                Self::Success => ().write_xdr(w)?,
37540                Self::Malformed => ().write_xdr(w)?,
37541                Self::NoIssuer => ().write_xdr(w)?,
37542                Self::InvalidLimit => ().write_xdr(w)?,
37543                Self::LowReserve => ().write_xdr(w)?,
37544                Self::SelfNotAllowed => ().write_xdr(w)?,
37545                Self::TrustLineMissing => ().write_xdr(w)?,
37546                Self::CannotDelete => ().write_xdr(w)?,
37547                Self::NotAuthMaintainLiabilities => ().write_xdr(w)?,
37548            };
37549            Ok(())
37550        })
37551    }
37552}
37553
37554/// AllowTrustResultCode is an XDR Enum defines as:
37555///
37556/// ```text
37557/// enum AllowTrustResultCode
37558/// {
37559///     // codes considered as "success" for the operation
37560///     ALLOW_TRUST_SUCCESS = 0,
37561///     // codes considered as "failure" for the operation
37562///     ALLOW_TRUST_MALFORMED = -1,     // asset is not ASSET_TYPE_ALPHANUM
37563///     ALLOW_TRUST_NO_TRUST_LINE = -2, // trustor does not have a trustline
37564///                                     // source account does not require trust
37565///     ALLOW_TRUST_TRUST_NOT_REQUIRED = -3,
37566///     ALLOW_TRUST_CANT_REVOKE = -4,      // source account can't revoke trust,
37567///     ALLOW_TRUST_SELF_NOT_ALLOWED = -5, // trusting self is not allowed
37568///     ALLOW_TRUST_LOW_RESERVE = -6       // claimable balances can't be created
37569///                                        // on revoke due to low reserves
37570/// };
37571/// ```
37572///
37573// enum
37574#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
37575#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
37576#[cfg_attr(
37577    all(feature = "serde", feature = "alloc"),
37578    derive(serde::Serialize, serde::Deserialize),
37579    serde(rename_all = "snake_case")
37580)]
37581#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
37582#[repr(i32)]
37583pub enum AllowTrustResultCode {
37584    Success = 0,
37585    Malformed = -1,
37586    NoTrustLine = -2,
37587    TrustNotRequired = -3,
37588    CantRevoke = -4,
37589    SelfNotAllowed = -5,
37590    LowReserve = -6,
37591}
37592
37593impl AllowTrustResultCode {
37594    pub const VARIANTS: [AllowTrustResultCode; 7] = [
37595        AllowTrustResultCode::Success,
37596        AllowTrustResultCode::Malformed,
37597        AllowTrustResultCode::NoTrustLine,
37598        AllowTrustResultCode::TrustNotRequired,
37599        AllowTrustResultCode::CantRevoke,
37600        AllowTrustResultCode::SelfNotAllowed,
37601        AllowTrustResultCode::LowReserve,
37602    ];
37603    pub const VARIANTS_STR: [&'static str; 7] = [
37604        "Success",
37605        "Malformed",
37606        "NoTrustLine",
37607        "TrustNotRequired",
37608        "CantRevoke",
37609        "SelfNotAllowed",
37610        "LowReserve",
37611    ];
37612
37613    #[must_use]
37614    pub const fn name(&self) -> &'static str {
37615        match self {
37616            Self::Success => "Success",
37617            Self::Malformed => "Malformed",
37618            Self::NoTrustLine => "NoTrustLine",
37619            Self::TrustNotRequired => "TrustNotRequired",
37620            Self::CantRevoke => "CantRevoke",
37621            Self::SelfNotAllowed => "SelfNotAllowed",
37622            Self::LowReserve => "LowReserve",
37623        }
37624    }
37625
37626    #[must_use]
37627    pub const fn variants() -> [AllowTrustResultCode; 7] {
37628        Self::VARIANTS
37629    }
37630}
37631
37632impl Name for AllowTrustResultCode {
37633    #[must_use]
37634    fn name(&self) -> &'static str {
37635        Self::name(self)
37636    }
37637}
37638
37639impl Variants<AllowTrustResultCode> for AllowTrustResultCode {
37640    fn variants() -> slice::Iter<'static, AllowTrustResultCode> {
37641        Self::VARIANTS.iter()
37642    }
37643}
37644
37645impl Enum for AllowTrustResultCode {}
37646
37647impl fmt::Display for AllowTrustResultCode {
37648    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
37649        f.write_str(self.name())
37650    }
37651}
37652
37653impl TryFrom<i32> for AllowTrustResultCode {
37654    type Error = Error;
37655
37656    fn try_from(i: i32) -> Result<Self> {
37657        let e = match i {
37658            0 => AllowTrustResultCode::Success,
37659            -1 => AllowTrustResultCode::Malformed,
37660            -2 => AllowTrustResultCode::NoTrustLine,
37661            -3 => AllowTrustResultCode::TrustNotRequired,
37662            -4 => AllowTrustResultCode::CantRevoke,
37663            -5 => AllowTrustResultCode::SelfNotAllowed,
37664            -6 => AllowTrustResultCode::LowReserve,
37665            #[allow(unreachable_patterns)]
37666            _ => return Err(Error::Invalid),
37667        };
37668        Ok(e)
37669    }
37670}
37671
37672impl From<AllowTrustResultCode> for i32 {
37673    #[must_use]
37674    fn from(e: AllowTrustResultCode) -> Self {
37675        e as Self
37676    }
37677}
37678
37679impl ReadXdr for AllowTrustResultCode {
37680    #[cfg(feature = "std")]
37681    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
37682        r.with_limited_depth(|r| {
37683            let e = i32::read_xdr(r)?;
37684            let v: Self = e.try_into()?;
37685            Ok(v)
37686        })
37687    }
37688}
37689
37690impl WriteXdr for AllowTrustResultCode {
37691    #[cfg(feature = "std")]
37692    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
37693        w.with_limited_depth(|w| {
37694            let i: i32 = (*self).into();
37695            i.write_xdr(w)
37696        })
37697    }
37698}
37699
37700/// AllowTrustResult is an XDR Union defines as:
37701///
37702/// ```text
37703/// union AllowTrustResult switch (AllowTrustResultCode code)
37704/// {
37705/// case ALLOW_TRUST_SUCCESS:
37706///     void;
37707/// case ALLOW_TRUST_MALFORMED:
37708/// case ALLOW_TRUST_NO_TRUST_LINE:
37709/// case ALLOW_TRUST_TRUST_NOT_REQUIRED:
37710/// case ALLOW_TRUST_CANT_REVOKE:
37711/// case ALLOW_TRUST_SELF_NOT_ALLOWED:
37712/// case ALLOW_TRUST_LOW_RESERVE:
37713///     void;
37714/// };
37715/// ```
37716///
37717// union with discriminant AllowTrustResultCode
37718#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
37719#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
37720#[cfg_attr(
37721    all(feature = "serde", feature = "alloc"),
37722    derive(serde::Serialize, serde::Deserialize),
37723    serde(rename_all = "snake_case")
37724)]
37725#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
37726#[allow(clippy::large_enum_variant)]
37727pub enum AllowTrustResult {
37728    Success,
37729    Malformed,
37730    NoTrustLine,
37731    TrustNotRequired,
37732    CantRevoke,
37733    SelfNotAllowed,
37734    LowReserve,
37735}
37736
37737impl AllowTrustResult {
37738    pub const VARIANTS: [AllowTrustResultCode; 7] = [
37739        AllowTrustResultCode::Success,
37740        AllowTrustResultCode::Malformed,
37741        AllowTrustResultCode::NoTrustLine,
37742        AllowTrustResultCode::TrustNotRequired,
37743        AllowTrustResultCode::CantRevoke,
37744        AllowTrustResultCode::SelfNotAllowed,
37745        AllowTrustResultCode::LowReserve,
37746    ];
37747    pub const VARIANTS_STR: [&'static str; 7] = [
37748        "Success",
37749        "Malformed",
37750        "NoTrustLine",
37751        "TrustNotRequired",
37752        "CantRevoke",
37753        "SelfNotAllowed",
37754        "LowReserve",
37755    ];
37756
37757    #[must_use]
37758    pub const fn name(&self) -> &'static str {
37759        match self {
37760            Self::Success => "Success",
37761            Self::Malformed => "Malformed",
37762            Self::NoTrustLine => "NoTrustLine",
37763            Self::TrustNotRequired => "TrustNotRequired",
37764            Self::CantRevoke => "CantRevoke",
37765            Self::SelfNotAllowed => "SelfNotAllowed",
37766            Self::LowReserve => "LowReserve",
37767        }
37768    }
37769
37770    #[must_use]
37771    pub const fn discriminant(&self) -> AllowTrustResultCode {
37772        #[allow(clippy::match_same_arms)]
37773        match self {
37774            Self::Success => AllowTrustResultCode::Success,
37775            Self::Malformed => AllowTrustResultCode::Malformed,
37776            Self::NoTrustLine => AllowTrustResultCode::NoTrustLine,
37777            Self::TrustNotRequired => AllowTrustResultCode::TrustNotRequired,
37778            Self::CantRevoke => AllowTrustResultCode::CantRevoke,
37779            Self::SelfNotAllowed => AllowTrustResultCode::SelfNotAllowed,
37780            Self::LowReserve => AllowTrustResultCode::LowReserve,
37781        }
37782    }
37783
37784    #[must_use]
37785    pub const fn variants() -> [AllowTrustResultCode; 7] {
37786        Self::VARIANTS
37787    }
37788}
37789
37790impl Name for AllowTrustResult {
37791    #[must_use]
37792    fn name(&self) -> &'static str {
37793        Self::name(self)
37794    }
37795}
37796
37797impl Discriminant<AllowTrustResultCode> for AllowTrustResult {
37798    #[must_use]
37799    fn discriminant(&self) -> AllowTrustResultCode {
37800        Self::discriminant(self)
37801    }
37802}
37803
37804impl Variants<AllowTrustResultCode> for AllowTrustResult {
37805    fn variants() -> slice::Iter<'static, AllowTrustResultCode> {
37806        Self::VARIANTS.iter()
37807    }
37808}
37809
37810impl Union<AllowTrustResultCode> for AllowTrustResult {}
37811
37812impl ReadXdr for AllowTrustResult {
37813    #[cfg(feature = "std")]
37814    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
37815        r.with_limited_depth(|r| {
37816            let dv: AllowTrustResultCode = <AllowTrustResultCode as ReadXdr>::read_xdr(r)?;
37817            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
37818            let v = match dv {
37819                AllowTrustResultCode::Success => Self::Success,
37820                AllowTrustResultCode::Malformed => Self::Malformed,
37821                AllowTrustResultCode::NoTrustLine => Self::NoTrustLine,
37822                AllowTrustResultCode::TrustNotRequired => Self::TrustNotRequired,
37823                AllowTrustResultCode::CantRevoke => Self::CantRevoke,
37824                AllowTrustResultCode::SelfNotAllowed => Self::SelfNotAllowed,
37825                AllowTrustResultCode::LowReserve => Self::LowReserve,
37826                #[allow(unreachable_patterns)]
37827                _ => return Err(Error::Invalid),
37828            };
37829            Ok(v)
37830        })
37831    }
37832}
37833
37834impl WriteXdr for AllowTrustResult {
37835    #[cfg(feature = "std")]
37836    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
37837        w.with_limited_depth(|w| {
37838            self.discriminant().write_xdr(w)?;
37839            #[allow(clippy::match_same_arms)]
37840            match self {
37841                Self::Success => ().write_xdr(w)?,
37842                Self::Malformed => ().write_xdr(w)?,
37843                Self::NoTrustLine => ().write_xdr(w)?,
37844                Self::TrustNotRequired => ().write_xdr(w)?,
37845                Self::CantRevoke => ().write_xdr(w)?,
37846                Self::SelfNotAllowed => ().write_xdr(w)?,
37847                Self::LowReserve => ().write_xdr(w)?,
37848            };
37849            Ok(())
37850        })
37851    }
37852}
37853
37854/// AccountMergeResultCode is an XDR Enum defines as:
37855///
37856/// ```text
37857/// enum AccountMergeResultCode
37858/// {
37859///     // codes considered as "success" for the operation
37860///     ACCOUNT_MERGE_SUCCESS = 0,
37861///     // codes considered as "failure" for the operation
37862///     ACCOUNT_MERGE_MALFORMED = -1,       // can't merge onto itself
37863///     ACCOUNT_MERGE_NO_ACCOUNT = -2,      // destination does not exist
37864///     ACCOUNT_MERGE_IMMUTABLE_SET = -3,   // source account has AUTH_IMMUTABLE set
37865///     ACCOUNT_MERGE_HAS_SUB_ENTRIES = -4, // account has trust lines/offers
37866///     ACCOUNT_MERGE_SEQNUM_TOO_FAR = -5,  // sequence number is over max allowed
37867///     ACCOUNT_MERGE_DEST_FULL = -6,       // can't add source balance to
37868///                                         // destination balance
37869///     ACCOUNT_MERGE_IS_SPONSOR = -7       // can't merge account that is a sponsor
37870/// };
37871/// ```
37872///
37873// enum
37874#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
37875#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
37876#[cfg_attr(
37877    all(feature = "serde", feature = "alloc"),
37878    derive(serde::Serialize, serde::Deserialize),
37879    serde(rename_all = "snake_case")
37880)]
37881#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
37882#[repr(i32)]
37883pub enum AccountMergeResultCode {
37884    Success = 0,
37885    Malformed = -1,
37886    NoAccount = -2,
37887    ImmutableSet = -3,
37888    HasSubEntries = -4,
37889    SeqnumTooFar = -5,
37890    DestFull = -6,
37891    IsSponsor = -7,
37892}
37893
37894impl AccountMergeResultCode {
37895    pub const VARIANTS: [AccountMergeResultCode; 8] = [
37896        AccountMergeResultCode::Success,
37897        AccountMergeResultCode::Malformed,
37898        AccountMergeResultCode::NoAccount,
37899        AccountMergeResultCode::ImmutableSet,
37900        AccountMergeResultCode::HasSubEntries,
37901        AccountMergeResultCode::SeqnumTooFar,
37902        AccountMergeResultCode::DestFull,
37903        AccountMergeResultCode::IsSponsor,
37904    ];
37905    pub const VARIANTS_STR: [&'static str; 8] = [
37906        "Success",
37907        "Malformed",
37908        "NoAccount",
37909        "ImmutableSet",
37910        "HasSubEntries",
37911        "SeqnumTooFar",
37912        "DestFull",
37913        "IsSponsor",
37914    ];
37915
37916    #[must_use]
37917    pub const fn name(&self) -> &'static str {
37918        match self {
37919            Self::Success => "Success",
37920            Self::Malformed => "Malformed",
37921            Self::NoAccount => "NoAccount",
37922            Self::ImmutableSet => "ImmutableSet",
37923            Self::HasSubEntries => "HasSubEntries",
37924            Self::SeqnumTooFar => "SeqnumTooFar",
37925            Self::DestFull => "DestFull",
37926            Self::IsSponsor => "IsSponsor",
37927        }
37928    }
37929
37930    #[must_use]
37931    pub const fn variants() -> [AccountMergeResultCode; 8] {
37932        Self::VARIANTS
37933    }
37934}
37935
37936impl Name for AccountMergeResultCode {
37937    #[must_use]
37938    fn name(&self) -> &'static str {
37939        Self::name(self)
37940    }
37941}
37942
37943impl Variants<AccountMergeResultCode> for AccountMergeResultCode {
37944    fn variants() -> slice::Iter<'static, AccountMergeResultCode> {
37945        Self::VARIANTS.iter()
37946    }
37947}
37948
37949impl Enum for AccountMergeResultCode {}
37950
37951impl fmt::Display for AccountMergeResultCode {
37952    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
37953        f.write_str(self.name())
37954    }
37955}
37956
37957impl TryFrom<i32> for AccountMergeResultCode {
37958    type Error = Error;
37959
37960    fn try_from(i: i32) -> Result<Self> {
37961        let e = match i {
37962            0 => AccountMergeResultCode::Success,
37963            -1 => AccountMergeResultCode::Malformed,
37964            -2 => AccountMergeResultCode::NoAccount,
37965            -3 => AccountMergeResultCode::ImmutableSet,
37966            -4 => AccountMergeResultCode::HasSubEntries,
37967            -5 => AccountMergeResultCode::SeqnumTooFar,
37968            -6 => AccountMergeResultCode::DestFull,
37969            -7 => AccountMergeResultCode::IsSponsor,
37970            #[allow(unreachable_patterns)]
37971            _ => return Err(Error::Invalid),
37972        };
37973        Ok(e)
37974    }
37975}
37976
37977impl From<AccountMergeResultCode> for i32 {
37978    #[must_use]
37979    fn from(e: AccountMergeResultCode) -> Self {
37980        e as Self
37981    }
37982}
37983
37984impl ReadXdr for AccountMergeResultCode {
37985    #[cfg(feature = "std")]
37986    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
37987        r.with_limited_depth(|r| {
37988            let e = i32::read_xdr(r)?;
37989            let v: Self = e.try_into()?;
37990            Ok(v)
37991        })
37992    }
37993}
37994
37995impl WriteXdr for AccountMergeResultCode {
37996    #[cfg(feature = "std")]
37997    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
37998        w.with_limited_depth(|w| {
37999            let i: i32 = (*self).into();
38000            i.write_xdr(w)
38001        })
38002    }
38003}
38004
38005/// AccountMergeResult is an XDR Union defines as:
38006///
38007/// ```text
38008/// union AccountMergeResult switch (AccountMergeResultCode code)
38009/// {
38010/// case ACCOUNT_MERGE_SUCCESS:
38011///     int64 sourceAccountBalance; // how much got transferred from source account
38012/// case ACCOUNT_MERGE_MALFORMED:
38013/// case ACCOUNT_MERGE_NO_ACCOUNT:
38014/// case ACCOUNT_MERGE_IMMUTABLE_SET:
38015/// case ACCOUNT_MERGE_HAS_SUB_ENTRIES:
38016/// case ACCOUNT_MERGE_SEQNUM_TOO_FAR:
38017/// case ACCOUNT_MERGE_DEST_FULL:
38018/// case ACCOUNT_MERGE_IS_SPONSOR:
38019///     void;
38020/// };
38021/// ```
38022///
38023// union with discriminant AccountMergeResultCode
38024#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
38025#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
38026#[cfg_attr(
38027    all(feature = "serde", feature = "alloc"),
38028    derive(serde::Serialize, serde::Deserialize),
38029    serde(rename_all = "snake_case")
38030)]
38031#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
38032#[allow(clippy::large_enum_variant)]
38033pub enum AccountMergeResult {
38034    Success(i64),
38035    Malformed,
38036    NoAccount,
38037    ImmutableSet,
38038    HasSubEntries,
38039    SeqnumTooFar,
38040    DestFull,
38041    IsSponsor,
38042}
38043
38044impl AccountMergeResult {
38045    pub const VARIANTS: [AccountMergeResultCode; 8] = [
38046        AccountMergeResultCode::Success,
38047        AccountMergeResultCode::Malformed,
38048        AccountMergeResultCode::NoAccount,
38049        AccountMergeResultCode::ImmutableSet,
38050        AccountMergeResultCode::HasSubEntries,
38051        AccountMergeResultCode::SeqnumTooFar,
38052        AccountMergeResultCode::DestFull,
38053        AccountMergeResultCode::IsSponsor,
38054    ];
38055    pub const VARIANTS_STR: [&'static str; 8] = [
38056        "Success",
38057        "Malformed",
38058        "NoAccount",
38059        "ImmutableSet",
38060        "HasSubEntries",
38061        "SeqnumTooFar",
38062        "DestFull",
38063        "IsSponsor",
38064    ];
38065
38066    #[must_use]
38067    pub const fn name(&self) -> &'static str {
38068        match self {
38069            Self::Success(_) => "Success",
38070            Self::Malformed => "Malformed",
38071            Self::NoAccount => "NoAccount",
38072            Self::ImmutableSet => "ImmutableSet",
38073            Self::HasSubEntries => "HasSubEntries",
38074            Self::SeqnumTooFar => "SeqnumTooFar",
38075            Self::DestFull => "DestFull",
38076            Self::IsSponsor => "IsSponsor",
38077        }
38078    }
38079
38080    #[must_use]
38081    pub const fn discriminant(&self) -> AccountMergeResultCode {
38082        #[allow(clippy::match_same_arms)]
38083        match self {
38084            Self::Success(_) => AccountMergeResultCode::Success,
38085            Self::Malformed => AccountMergeResultCode::Malformed,
38086            Self::NoAccount => AccountMergeResultCode::NoAccount,
38087            Self::ImmutableSet => AccountMergeResultCode::ImmutableSet,
38088            Self::HasSubEntries => AccountMergeResultCode::HasSubEntries,
38089            Self::SeqnumTooFar => AccountMergeResultCode::SeqnumTooFar,
38090            Self::DestFull => AccountMergeResultCode::DestFull,
38091            Self::IsSponsor => AccountMergeResultCode::IsSponsor,
38092        }
38093    }
38094
38095    #[must_use]
38096    pub const fn variants() -> [AccountMergeResultCode; 8] {
38097        Self::VARIANTS
38098    }
38099}
38100
38101impl Name for AccountMergeResult {
38102    #[must_use]
38103    fn name(&self) -> &'static str {
38104        Self::name(self)
38105    }
38106}
38107
38108impl Discriminant<AccountMergeResultCode> for AccountMergeResult {
38109    #[must_use]
38110    fn discriminant(&self) -> AccountMergeResultCode {
38111        Self::discriminant(self)
38112    }
38113}
38114
38115impl Variants<AccountMergeResultCode> for AccountMergeResult {
38116    fn variants() -> slice::Iter<'static, AccountMergeResultCode> {
38117        Self::VARIANTS.iter()
38118    }
38119}
38120
38121impl Union<AccountMergeResultCode> for AccountMergeResult {}
38122
38123impl ReadXdr for AccountMergeResult {
38124    #[cfg(feature = "std")]
38125    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
38126        r.with_limited_depth(|r| {
38127            let dv: AccountMergeResultCode = <AccountMergeResultCode as ReadXdr>::read_xdr(r)?;
38128            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
38129            let v = match dv {
38130                AccountMergeResultCode::Success => Self::Success(i64::read_xdr(r)?),
38131                AccountMergeResultCode::Malformed => Self::Malformed,
38132                AccountMergeResultCode::NoAccount => Self::NoAccount,
38133                AccountMergeResultCode::ImmutableSet => Self::ImmutableSet,
38134                AccountMergeResultCode::HasSubEntries => Self::HasSubEntries,
38135                AccountMergeResultCode::SeqnumTooFar => Self::SeqnumTooFar,
38136                AccountMergeResultCode::DestFull => Self::DestFull,
38137                AccountMergeResultCode::IsSponsor => Self::IsSponsor,
38138                #[allow(unreachable_patterns)]
38139                _ => return Err(Error::Invalid),
38140            };
38141            Ok(v)
38142        })
38143    }
38144}
38145
38146impl WriteXdr for AccountMergeResult {
38147    #[cfg(feature = "std")]
38148    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
38149        w.with_limited_depth(|w| {
38150            self.discriminant().write_xdr(w)?;
38151            #[allow(clippy::match_same_arms)]
38152            match self {
38153                Self::Success(v) => v.write_xdr(w)?,
38154                Self::Malformed => ().write_xdr(w)?,
38155                Self::NoAccount => ().write_xdr(w)?,
38156                Self::ImmutableSet => ().write_xdr(w)?,
38157                Self::HasSubEntries => ().write_xdr(w)?,
38158                Self::SeqnumTooFar => ().write_xdr(w)?,
38159                Self::DestFull => ().write_xdr(w)?,
38160                Self::IsSponsor => ().write_xdr(w)?,
38161            };
38162            Ok(())
38163        })
38164    }
38165}
38166
38167/// InflationResultCode is an XDR Enum defines as:
38168///
38169/// ```text
38170/// enum InflationResultCode
38171/// {
38172///     // codes considered as "success" for the operation
38173///     INFLATION_SUCCESS = 0,
38174///     // codes considered as "failure" for the operation
38175///     INFLATION_NOT_TIME = -1
38176/// };
38177/// ```
38178///
38179// enum
38180#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
38181#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
38182#[cfg_attr(
38183    all(feature = "serde", feature = "alloc"),
38184    derive(serde::Serialize, serde::Deserialize),
38185    serde(rename_all = "snake_case")
38186)]
38187#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
38188#[repr(i32)]
38189pub enum InflationResultCode {
38190    Success = 0,
38191    NotTime = -1,
38192}
38193
38194impl InflationResultCode {
38195    pub const VARIANTS: [InflationResultCode; 2] =
38196        [InflationResultCode::Success, InflationResultCode::NotTime];
38197    pub const VARIANTS_STR: [&'static str; 2] = ["Success", "NotTime"];
38198
38199    #[must_use]
38200    pub const fn name(&self) -> &'static str {
38201        match self {
38202            Self::Success => "Success",
38203            Self::NotTime => "NotTime",
38204        }
38205    }
38206
38207    #[must_use]
38208    pub const fn variants() -> [InflationResultCode; 2] {
38209        Self::VARIANTS
38210    }
38211}
38212
38213impl Name for InflationResultCode {
38214    #[must_use]
38215    fn name(&self) -> &'static str {
38216        Self::name(self)
38217    }
38218}
38219
38220impl Variants<InflationResultCode> for InflationResultCode {
38221    fn variants() -> slice::Iter<'static, InflationResultCode> {
38222        Self::VARIANTS.iter()
38223    }
38224}
38225
38226impl Enum for InflationResultCode {}
38227
38228impl fmt::Display for InflationResultCode {
38229    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
38230        f.write_str(self.name())
38231    }
38232}
38233
38234impl TryFrom<i32> for InflationResultCode {
38235    type Error = Error;
38236
38237    fn try_from(i: i32) -> Result<Self> {
38238        let e = match i {
38239            0 => InflationResultCode::Success,
38240            -1 => InflationResultCode::NotTime,
38241            #[allow(unreachable_patterns)]
38242            _ => return Err(Error::Invalid),
38243        };
38244        Ok(e)
38245    }
38246}
38247
38248impl From<InflationResultCode> for i32 {
38249    #[must_use]
38250    fn from(e: InflationResultCode) -> Self {
38251        e as Self
38252    }
38253}
38254
38255impl ReadXdr for InflationResultCode {
38256    #[cfg(feature = "std")]
38257    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
38258        r.with_limited_depth(|r| {
38259            let e = i32::read_xdr(r)?;
38260            let v: Self = e.try_into()?;
38261            Ok(v)
38262        })
38263    }
38264}
38265
38266impl WriteXdr for InflationResultCode {
38267    #[cfg(feature = "std")]
38268    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
38269        w.with_limited_depth(|w| {
38270            let i: i32 = (*self).into();
38271            i.write_xdr(w)
38272        })
38273    }
38274}
38275
38276/// InflationPayout is an XDR Struct defines as:
38277///
38278/// ```text
38279/// struct InflationPayout // or use PaymentResultAtom to limit types?
38280/// {
38281///     AccountID destination;
38282///     int64 amount;
38283/// };
38284/// ```
38285///
38286#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
38287#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
38288#[cfg_attr(
38289    all(feature = "serde", feature = "alloc"),
38290    derive(serde::Serialize, serde::Deserialize),
38291    serde(rename_all = "snake_case")
38292)]
38293#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
38294pub struct InflationPayout {
38295    pub destination: AccountId,
38296    pub amount: i64,
38297}
38298
38299impl ReadXdr for InflationPayout {
38300    #[cfg(feature = "std")]
38301    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
38302        r.with_limited_depth(|r| {
38303            Ok(Self {
38304                destination: AccountId::read_xdr(r)?,
38305                amount: i64::read_xdr(r)?,
38306            })
38307        })
38308    }
38309}
38310
38311impl WriteXdr for InflationPayout {
38312    #[cfg(feature = "std")]
38313    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
38314        w.with_limited_depth(|w| {
38315            self.destination.write_xdr(w)?;
38316            self.amount.write_xdr(w)?;
38317            Ok(())
38318        })
38319    }
38320}
38321
38322/// InflationResult is an XDR Union defines as:
38323///
38324/// ```text
38325/// union InflationResult switch (InflationResultCode code)
38326/// {
38327/// case INFLATION_SUCCESS:
38328///     InflationPayout payouts<>;
38329/// case INFLATION_NOT_TIME:
38330///     void;
38331/// };
38332/// ```
38333///
38334// union with discriminant InflationResultCode
38335#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
38336#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
38337#[cfg_attr(
38338    all(feature = "serde", feature = "alloc"),
38339    derive(serde::Serialize, serde::Deserialize),
38340    serde(rename_all = "snake_case")
38341)]
38342#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
38343#[allow(clippy::large_enum_variant)]
38344pub enum InflationResult {
38345    Success(VecM<InflationPayout>),
38346    NotTime,
38347}
38348
38349impl InflationResult {
38350    pub const VARIANTS: [InflationResultCode; 2] =
38351        [InflationResultCode::Success, InflationResultCode::NotTime];
38352    pub const VARIANTS_STR: [&'static str; 2] = ["Success", "NotTime"];
38353
38354    #[must_use]
38355    pub const fn name(&self) -> &'static str {
38356        match self {
38357            Self::Success(_) => "Success",
38358            Self::NotTime => "NotTime",
38359        }
38360    }
38361
38362    #[must_use]
38363    pub const fn discriminant(&self) -> InflationResultCode {
38364        #[allow(clippy::match_same_arms)]
38365        match self {
38366            Self::Success(_) => InflationResultCode::Success,
38367            Self::NotTime => InflationResultCode::NotTime,
38368        }
38369    }
38370
38371    #[must_use]
38372    pub const fn variants() -> [InflationResultCode; 2] {
38373        Self::VARIANTS
38374    }
38375}
38376
38377impl Name for InflationResult {
38378    #[must_use]
38379    fn name(&self) -> &'static str {
38380        Self::name(self)
38381    }
38382}
38383
38384impl Discriminant<InflationResultCode> for InflationResult {
38385    #[must_use]
38386    fn discriminant(&self) -> InflationResultCode {
38387        Self::discriminant(self)
38388    }
38389}
38390
38391impl Variants<InflationResultCode> for InflationResult {
38392    fn variants() -> slice::Iter<'static, InflationResultCode> {
38393        Self::VARIANTS.iter()
38394    }
38395}
38396
38397impl Union<InflationResultCode> for InflationResult {}
38398
38399impl ReadXdr for InflationResult {
38400    #[cfg(feature = "std")]
38401    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
38402        r.with_limited_depth(|r| {
38403            let dv: InflationResultCode = <InflationResultCode as ReadXdr>::read_xdr(r)?;
38404            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
38405            let v = match dv {
38406                InflationResultCode::Success => {
38407                    Self::Success(VecM::<InflationPayout>::read_xdr(r)?)
38408                }
38409                InflationResultCode::NotTime => Self::NotTime,
38410                #[allow(unreachable_patterns)]
38411                _ => return Err(Error::Invalid),
38412            };
38413            Ok(v)
38414        })
38415    }
38416}
38417
38418impl WriteXdr for InflationResult {
38419    #[cfg(feature = "std")]
38420    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
38421        w.with_limited_depth(|w| {
38422            self.discriminant().write_xdr(w)?;
38423            #[allow(clippy::match_same_arms)]
38424            match self {
38425                Self::Success(v) => v.write_xdr(w)?,
38426                Self::NotTime => ().write_xdr(w)?,
38427            };
38428            Ok(())
38429        })
38430    }
38431}
38432
38433/// ManageDataResultCode is an XDR Enum defines as:
38434///
38435/// ```text
38436/// enum ManageDataResultCode
38437/// {
38438///     // codes considered as "success" for the operation
38439///     MANAGE_DATA_SUCCESS = 0,
38440///     // codes considered as "failure" for the operation
38441///     MANAGE_DATA_NOT_SUPPORTED_YET =
38442///         -1, // The network hasn't moved to this protocol change yet
38443///     MANAGE_DATA_NAME_NOT_FOUND =
38444///         -2, // Trying to remove a Data Entry that isn't there
38445///     MANAGE_DATA_LOW_RESERVE = -3, // not enough funds to create a new Data Entry
38446///     MANAGE_DATA_INVALID_NAME = -4 // Name not a valid string
38447/// };
38448/// ```
38449///
38450// enum
38451#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
38452#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
38453#[cfg_attr(
38454    all(feature = "serde", feature = "alloc"),
38455    derive(serde::Serialize, serde::Deserialize),
38456    serde(rename_all = "snake_case")
38457)]
38458#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
38459#[repr(i32)]
38460pub enum ManageDataResultCode {
38461    Success = 0,
38462    NotSupportedYet = -1,
38463    NameNotFound = -2,
38464    LowReserve = -3,
38465    InvalidName = -4,
38466}
38467
38468impl ManageDataResultCode {
38469    pub const VARIANTS: [ManageDataResultCode; 5] = [
38470        ManageDataResultCode::Success,
38471        ManageDataResultCode::NotSupportedYet,
38472        ManageDataResultCode::NameNotFound,
38473        ManageDataResultCode::LowReserve,
38474        ManageDataResultCode::InvalidName,
38475    ];
38476    pub const VARIANTS_STR: [&'static str; 5] = [
38477        "Success",
38478        "NotSupportedYet",
38479        "NameNotFound",
38480        "LowReserve",
38481        "InvalidName",
38482    ];
38483
38484    #[must_use]
38485    pub const fn name(&self) -> &'static str {
38486        match self {
38487            Self::Success => "Success",
38488            Self::NotSupportedYet => "NotSupportedYet",
38489            Self::NameNotFound => "NameNotFound",
38490            Self::LowReserve => "LowReserve",
38491            Self::InvalidName => "InvalidName",
38492        }
38493    }
38494
38495    #[must_use]
38496    pub const fn variants() -> [ManageDataResultCode; 5] {
38497        Self::VARIANTS
38498    }
38499}
38500
38501impl Name for ManageDataResultCode {
38502    #[must_use]
38503    fn name(&self) -> &'static str {
38504        Self::name(self)
38505    }
38506}
38507
38508impl Variants<ManageDataResultCode> for ManageDataResultCode {
38509    fn variants() -> slice::Iter<'static, ManageDataResultCode> {
38510        Self::VARIANTS.iter()
38511    }
38512}
38513
38514impl Enum for ManageDataResultCode {}
38515
38516impl fmt::Display for ManageDataResultCode {
38517    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
38518        f.write_str(self.name())
38519    }
38520}
38521
38522impl TryFrom<i32> for ManageDataResultCode {
38523    type Error = Error;
38524
38525    fn try_from(i: i32) -> Result<Self> {
38526        let e = match i {
38527            0 => ManageDataResultCode::Success,
38528            -1 => ManageDataResultCode::NotSupportedYet,
38529            -2 => ManageDataResultCode::NameNotFound,
38530            -3 => ManageDataResultCode::LowReserve,
38531            -4 => ManageDataResultCode::InvalidName,
38532            #[allow(unreachable_patterns)]
38533            _ => return Err(Error::Invalid),
38534        };
38535        Ok(e)
38536    }
38537}
38538
38539impl From<ManageDataResultCode> for i32 {
38540    #[must_use]
38541    fn from(e: ManageDataResultCode) -> Self {
38542        e as Self
38543    }
38544}
38545
38546impl ReadXdr for ManageDataResultCode {
38547    #[cfg(feature = "std")]
38548    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
38549        r.with_limited_depth(|r| {
38550            let e = i32::read_xdr(r)?;
38551            let v: Self = e.try_into()?;
38552            Ok(v)
38553        })
38554    }
38555}
38556
38557impl WriteXdr for ManageDataResultCode {
38558    #[cfg(feature = "std")]
38559    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
38560        w.with_limited_depth(|w| {
38561            let i: i32 = (*self).into();
38562            i.write_xdr(w)
38563        })
38564    }
38565}
38566
38567/// ManageDataResult is an XDR Union defines as:
38568///
38569/// ```text
38570/// union ManageDataResult switch (ManageDataResultCode code)
38571/// {
38572/// case MANAGE_DATA_SUCCESS:
38573///     void;
38574/// case MANAGE_DATA_NOT_SUPPORTED_YET:
38575/// case MANAGE_DATA_NAME_NOT_FOUND:
38576/// case MANAGE_DATA_LOW_RESERVE:
38577/// case MANAGE_DATA_INVALID_NAME:
38578///     void;
38579/// };
38580/// ```
38581///
38582// union with discriminant ManageDataResultCode
38583#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
38584#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
38585#[cfg_attr(
38586    all(feature = "serde", feature = "alloc"),
38587    derive(serde::Serialize, serde::Deserialize),
38588    serde(rename_all = "snake_case")
38589)]
38590#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
38591#[allow(clippy::large_enum_variant)]
38592pub enum ManageDataResult {
38593    Success,
38594    NotSupportedYet,
38595    NameNotFound,
38596    LowReserve,
38597    InvalidName,
38598}
38599
38600impl ManageDataResult {
38601    pub const VARIANTS: [ManageDataResultCode; 5] = [
38602        ManageDataResultCode::Success,
38603        ManageDataResultCode::NotSupportedYet,
38604        ManageDataResultCode::NameNotFound,
38605        ManageDataResultCode::LowReserve,
38606        ManageDataResultCode::InvalidName,
38607    ];
38608    pub const VARIANTS_STR: [&'static str; 5] = [
38609        "Success",
38610        "NotSupportedYet",
38611        "NameNotFound",
38612        "LowReserve",
38613        "InvalidName",
38614    ];
38615
38616    #[must_use]
38617    pub const fn name(&self) -> &'static str {
38618        match self {
38619            Self::Success => "Success",
38620            Self::NotSupportedYet => "NotSupportedYet",
38621            Self::NameNotFound => "NameNotFound",
38622            Self::LowReserve => "LowReserve",
38623            Self::InvalidName => "InvalidName",
38624        }
38625    }
38626
38627    #[must_use]
38628    pub const fn discriminant(&self) -> ManageDataResultCode {
38629        #[allow(clippy::match_same_arms)]
38630        match self {
38631            Self::Success => ManageDataResultCode::Success,
38632            Self::NotSupportedYet => ManageDataResultCode::NotSupportedYet,
38633            Self::NameNotFound => ManageDataResultCode::NameNotFound,
38634            Self::LowReserve => ManageDataResultCode::LowReserve,
38635            Self::InvalidName => ManageDataResultCode::InvalidName,
38636        }
38637    }
38638
38639    #[must_use]
38640    pub const fn variants() -> [ManageDataResultCode; 5] {
38641        Self::VARIANTS
38642    }
38643}
38644
38645impl Name for ManageDataResult {
38646    #[must_use]
38647    fn name(&self) -> &'static str {
38648        Self::name(self)
38649    }
38650}
38651
38652impl Discriminant<ManageDataResultCode> for ManageDataResult {
38653    #[must_use]
38654    fn discriminant(&self) -> ManageDataResultCode {
38655        Self::discriminant(self)
38656    }
38657}
38658
38659impl Variants<ManageDataResultCode> for ManageDataResult {
38660    fn variants() -> slice::Iter<'static, ManageDataResultCode> {
38661        Self::VARIANTS.iter()
38662    }
38663}
38664
38665impl Union<ManageDataResultCode> for ManageDataResult {}
38666
38667impl ReadXdr for ManageDataResult {
38668    #[cfg(feature = "std")]
38669    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
38670        r.with_limited_depth(|r| {
38671            let dv: ManageDataResultCode = <ManageDataResultCode as ReadXdr>::read_xdr(r)?;
38672            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
38673            let v = match dv {
38674                ManageDataResultCode::Success => Self::Success,
38675                ManageDataResultCode::NotSupportedYet => Self::NotSupportedYet,
38676                ManageDataResultCode::NameNotFound => Self::NameNotFound,
38677                ManageDataResultCode::LowReserve => Self::LowReserve,
38678                ManageDataResultCode::InvalidName => Self::InvalidName,
38679                #[allow(unreachable_patterns)]
38680                _ => return Err(Error::Invalid),
38681            };
38682            Ok(v)
38683        })
38684    }
38685}
38686
38687impl WriteXdr for ManageDataResult {
38688    #[cfg(feature = "std")]
38689    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
38690        w.with_limited_depth(|w| {
38691            self.discriminant().write_xdr(w)?;
38692            #[allow(clippy::match_same_arms)]
38693            match self {
38694                Self::Success => ().write_xdr(w)?,
38695                Self::NotSupportedYet => ().write_xdr(w)?,
38696                Self::NameNotFound => ().write_xdr(w)?,
38697                Self::LowReserve => ().write_xdr(w)?,
38698                Self::InvalidName => ().write_xdr(w)?,
38699            };
38700            Ok(())
38701        })
38702    }
38703}
38704
38705/// BumpSequenceResultCode is an XDR Enum defines as:
38706///
38707/// ```text
38708/// enum BumpSequenceResultCode
38709/// {
38710///     // codes considered as "success" for the operation
38711///     BUMP_SEQUENCE_SUCCESS = 0,
38712///     // codes considered as "failure" for the operation
38713///     BUMP_SEQUENCE_BAD_SEQ = -1 // `bumpTo` is not within bounds
38714/// };
38715/// ```
38716///
38717// enum
38718#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
38719#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
38720#[cfg_attr(
38721    all(feature = "serde", feature = "alloc"),
38722    derive(serde::Serialize, serde::Deserialize),
38723    serde(rename_all = "snake_case")
38724)]
38725#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
38726#[repr(i32)]
38727pub enum BumpSequenceResultCode {
38728    Success = 0,
38729    BadSeq = -1,
38730}
38731
38732impl BumpSequenceResultCode {
38733    pub const VARIANTS: [BumpSequenceResultCode; 2] = [
38734        BumpSequenceResultCode::Success,
38735        BumpSequenceResultCode::BadSeq,
38736    ];
38737    pub const VARIANTS_STR: [&'static str; 2] = ["Success", "BadSeq"];
38738
38739    #[must_use]
38740    pub const fn name(&self) -> &'static str {
38741        match self {
38742            Self::Success => "Success",
38743            Self::BadSeq => "BadSeq",
38744        }
38745    }
38746
38747    #[must_use]
38748    pub const fn variants() -> [BumpSequenceResultCode; 2] {
38749        Self::VARIANTS
38750    }
38751}
38752
38753impl Name for BumpSequenceResultCode {
38754    #[must_use]
38755    fn name(&self) -> &'static str {
38756        Self::name(self)
38757    }
38758}
38759
38760impl Variants<BumpSequenceResultCode> for BumpSequenceResultCode {
38761    fn variants() -> slice::Iter<'static, BumpSequenceResultCode> {
38762        Self::VARIANTS.iter()
38763    }
38764}
38765
38766impl Enum for BumpSequenceResultCode {}
38767
38768impl fmt::Display for BumpSequenceResultCode {
38769    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
38770        f.write_str(self.name())
38771    }
38772}
38773
38774impl TryFrom<i32> for BumpSequenceResultCode {
38775    type Error = Error;
38776
38777    fn try_from(i: i32) -> Result<Self> {
38778        let e = match i {
38779            0 => BumpSequenceResultCode::Success,
38780            -1 => BumpSequenceResultCode::BadSeq,
38781            #[allow(unreachable_patterns)]
38782            _ => return Err(Error::Invalid),
38783        };
38784        Ok(e)
38785    }
38786}
38787
38788impl From<BumpSequenceResultCode> for i32 {
38789    #[must_use]
38790    fn from(e: BumpSequenceResultCode) -> Self {
38791        e as Self
38792    }
38793}
38794
38795impl ReadXdr for BumpSequenceResultCode {
38796    #[cfg(feature = "std")]
38797    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
38798        r.with_limited_depth(|r| {
38799            let e = i32::read_xdr(r)?;
38800            let v: Self = e.try_into()?;
38801            Ok(v)
38802        })
38803    }
38804}
38805
38806impl WriteXdr for BumpSequenceResultCode {
38807    #[cfg(feature = "std")]
38808    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
38809        w.with_limited_depth(|w| {
38810            let i: i32 = (*self).into();
38811            i.write_xdr(w)
38812        })
38813    }
38814}
38815
38816/// BumpSequenceResult is an XDR Union defines as:
38817///
38818/// ```text
38819/// union BumpSequenceResult switch (BumpSequenceResultCode code)
38820/// {
38821/// case BUMP_SEQUENCE_SUCCESS:
38822///     void;
38823/// case BUMP_SEQUENCE_BAD_SEQ:
38824///     void;
38825/// };
38826/// ```
38827///
38828// union with discriminant BumpSequenceResultCode
38829#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
38830#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
38831#[cfg_attr(
38832    all(feature = "serde", feature = "alloc"),
38833    derive(serde::Serialize, serde::Deserialize),
38834    serde(rename_all = "snake_case")
38835)]
38836#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
38837#[allow(clippy::large_enum_variant)]
38838pub enum BumpSequenceResult {
38839    Success,
38840    BadSeq,
38841}
38842
38843impl BumpSequenceResult {
38844    pub const VARIANTS: [BumpSequenceResultCode; 2] = [
38845        BumpSequenceResultCode::Success,
38846        BumpSequenceResultCode::BadSeq,
38847    ];
38848    pub const VARIANTS_STR: [&'static str; 2] = ["Success", "BadSeq"];
38849
38850    #[must_use]
38851    pub const fn name(&self) -> &'static str {
38852        match self {
38853            Self::Success => "Success",
38854            Self::BadSeq => "BadSeq",
38855        }
38856    }
38857
38858    #[must_use]
38859    pub const fn discriminant(&self) -> BumpSequenceResultCode {
38860        #[allow(clippy::match_same_arms)]
38861        match self {
38862            Self::Success => BumpSequenceResultCode::Success,
38863            Self::BadSeq => BumpSequenceResultCode::BadSeq,
38864        }
38865    }
38866
38867    #[must_use]
38868    pub const fn variants() -> [BumpSequenceResultCode; 2] {
38869        Self::VARIANTS
38870    }
38871}
38872
38873impl Name for BumpSequenceResult {
38874    #[must_use]
38875    fn name(&self) -> &'static str {
38876        Self::name(self)
38877    }
38878}
38879
38880impl Discriminant<BumpSequenceResultCode> for BumpSequenceResult {
38881    #[must_use]
38882    fn discriminant(&self) -> BumpSequenceResultCode {
38883        Self::discriminant(self)
38884    }
38885}
38886
38887impl Variants<BumpSequenceResultCode> for BumpSequenceResult {
38888    fn variants() -> slice::Iter<'static, BumpSequenceResultCode> {
38889        Self::VARIANTS.iter()
38890    }
38891}
38892
38893impl Union<BumpSequenceResultCode> for BumpSequenceResult {}
38894
38895impl ReadXdr for BumpSequenceResult {
38896    #[cfg(feature = "std")]
38897    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
38898        r.with_limited_depth(|r| {
38899            let dv: BumpSequenceResultCode = <BumpSequenceResultCode as ReadXdr>::read_xdr(r)?;
38900            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
38901            let v = match dv {
38902                BumpSequenceResultCode::Success => Self::Success,
38903                BumpSequenceResultCode::BadSeq => Self::BadSeq,
38904                #[allow(unreachable_patterns)]
38905                _ => return Err(Error::Invalid),
38906            };
38907            Ok(v)
38908        })
38909    }
38910}
38911
38912impl WriteXdr for BumpSequenceResult {
38913    #[cfg(feature = "std")]
38914    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
38915        w.with_limited_depth(|w| {
38916            self.discriminant().write_xdr(w)?;
38917            #[allow(clippy::match_same_arms)]
38918            match self {
38919                Self::Success => ().write_xdr(w)?,
38920                Self::BadSeq => ().write_xdr(w)?,
38921            };
38922            Ok(())
38923        })
38924    }
38925}
38926
38927/// CreateClaimableBalanceResultCode is an XDR Enum defines as:
38928///
38929/// ```text
38930/// enum CreateClaimableBalanceResultCode
38931/// {
38932///     CREATE_CLAIMABLE_BALANCE_SUCCESS = 0,
38933///     CREATE_CLAIMABLE_BALANCE_MALFORMED = -1,
38934///     CREATE_CLAIMABLE_BALANCE_LOW_RESERVE = -2,
38935///     CREATE_CLAIMABLE_BALANCE_NO_TRUST = -3,
38936///     CREATE_CLAIMABLE_BALANCE_NOT_AUTHORIZED = -4,
38937///     CREATE_CLAIMABLE_BALANCE_UNDERFUNDED = -5
38938/// };
38939/// ```
38940///
38941// enum
38942#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
38943#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
38944#[cfg_attr(
38945    all(feature = "serde", feature = "alloc"),
38946    derive(serde::Serialize, serde::Deserialize),
38947    serde(rename_all = "snake_case")
38948)]
38949#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
38950#[repr(i32)]
38951pub enum CreateClaimableBalanceResultCode {
38952    Success = 0,
38953    Malformed = -1,
38954    LowReserve = -2,
38955    NoTrust = -3,
38956    NotAuthorized = -4,
38957    Underfunded = -5,
38958}
38959
38960impl CreateClaimableBalanceResultCode {
38961    pub const VARIANTS: [CreateClaimableBalanceResultCode; 6] = [
38962        CreateClaimableBalanceResultCode::Success,
38963        CreateClaimableBalanceResultCode::Malformed,
38964        CreateClaimableBalanceResultCode::LowReserve,
38965        CreateClaimableBalanceResultCode::NoTrust,
38966        CreateClaimableBalanceResultCode::NotAuthorized,
38967        CreateClaimableBalanceResultCode::Underfunded,
38968    ];
38969    pub const VARIANTS_STR: [&'static str; 6] = [
38970        "Success",
38971        "Malformed",
38972        "LowReserve",
38973        "NoTrust",
38974        "NotAuthorized",
38975        "Underfunded",
38976    ];
38977
38978    #[must_use]
38979    pub const fn name(&self) -> &'static str {
38980        match self {
38981            Self::Success => "Success",
38982            Self::Malformed => "Malformed",
38983            Self::LowReserve => "LowReserve",
38984            Self::NoTrust => "NoTrust",
38985            Self::NotAuthorized => "NotAuthorized",
38986            Self::Underfunded => "Underfunded",
38987        }
38988    }
38989
38990    #[must_use]
38991    pub const fn variants() -> [CreateClaimableBalanceResultCode; 6] {
38992        Self::VARIANTS
38993    }
38994}
38995
38996impl Name for CreateClaimableBalanceResultCode {
38997    #[must_use]
38998    fn name(&self) -> &'static str {
38999        Self::name(self)
39000    }
39001}
39002
39003impl Variants<CreateClaimableBalanceResultCode> for CreateClaimableBalanceResultCode {
39004    fn variants() -> slice::Iter<'static, CreateClaimableBalanceResultCode> {
39005        Self::VARIANTS.iter()
39006    }
39007}
39008
39009impl Enum for CreateClaimableBalanceResultCode {}
39010
39011impl fmt::Display for CreateClaimableBalanceResultCode {
39012    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
39013        f.write_str(self.name())
39014    }
39015}
39016
39017impl TryFrom<i32> for CreateClaimableBalanceResultCode {
39018    type Error = Error;
39019
39020    fn try_from(i: i32) -> Result<Self> {
39021        let e = match i {
39022            0 => CreateClaimableBalanceResultCode::Success,
39023            -1 => CreateClaimableBalanceResultCode::Malformed,
39024            -2 => CreateClaimableBalanceResultCode::LowReserve,
39025            -3 => CreateClaimableBalanceResultCode::NoTrust,
39026            -4 => CreateClaimableBalanceResultCode::NotAuthorized,
39027            -5 => CreateClaimableBalanceResultCode::Underfunded,
39028            #[allow(unreachable_patterns)]
39029            _ => return Err(Error::Invalid),
39030        };
39031        Ok(e)
39032    }
39033}
39034
39035impl From<CreateClaimableBalanceResultCode> for i32 {
39036    #[must_use]
39037    fn from(e: CreateClaimableBalanceResultCode) -> Self {
39038        e as Self
39039    }
39040}
39041
39042impl ReadXdr for CreateClaimableBalanceResultCode {
39043    #[cfg(feature = "std")]
39044    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
39045        r.with_limited_depth(|r| {
39046            let e = i32::read_xdr(r)?;
39047            let v: Self = e.try_into()?;
39048            Ok(v)
39049        })
39050    }
39051}
39052
39053impl WriteXdr for CreateClaimableBalanceResultCode {
39054    #[cfg(feature = "std")]
39055    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
39056        w.with_limited_depth(|w| {
39057            let i: i32 = (*self).into();
39058            i.write_xdr(w)
39059        })
39060    }
39061}
39062
39063/// CreateClaimableBalanceResult is an XDR Union defines as:
39064///
39065/// ```text
39066/// union CreateClaimableBalanceResult switch (
39067///     CreateClaimableBalanceResultCode code)
39068/// {
39069/// case CREATE_CLAIMABLE_BALANCE_SUCCESS:
39070///     ClaimableBalanceID balanceID;
39071/// case CREATE_CLAIMABLE_BALANCE_MALFORMED:
39072/// case CREATE_CLAIMABLE_BALANCE_LOW_RESERVE:
39073/// case CREATE_CLAIMABLE_BALANCE_NO_TRUST:
39074/// case CREATE_CLAIMABLE_BALANCE_NOT_AUTHORIZED:
39075/// case CREATE_CLAIMABLE_BALANCE_UNDERFUNDED:
39076///     void;
39077/// };
39078/// ```
39079///
39080// union with discriminant CreateClaimableBalanceResultCode
39081#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
39082#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
39083#[cfg_attr(
39084    all(feature = "serde", feature = "alloc"),
39085    derive(serde::Serialize, serde::Deserialize),
39086    serde(rename_all = "snake_case")
39087)]
39088#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
39089#[allow(clippy::large_enum_variant)]
39090pub enum CreateClaimableBalanceResult {
39091    Success(ClaimableBalanceId),
39092    Malformed,
39093    LowReserve,
39094    NoTrust,
39095    NotAuthorized,
39096    Underfunded,
39097}
39098
39099impl CreateClaimableBalanceResult {
39100    pub const VARIANTS: [CreateClaimableBalanceResultCode; 6] = [
39101        CreateClaimableBalanceResultCode::Success,
39102        CreateClaimableBalanceResultCode::Malformed,
39103        CreateClaimableBalanceResultCode::LowReserve,
39104        CreateClaimableBalanceResultCode::NoTrust,
39105        CreateClaimableBalanceResultCode::NotAuthorized,
39106        CreateClaimableBalanceResultCode::Underfunded,
39107    ];
39108    pub const VARIANTS_STR: [&'static str; 6] = [
39109        "Success",
39110        "Malformed",
39111        "LowReserve",
39112        "NoTrust",
39113        "NotAuthorized",
39114        "Underfunded",
39115    ];
39116
39117    #[must_use]
39118    pub const fn name(&self) -> &'static str {
39119        match self {
39120            Self::Success(_) => "Success",
39121            Self::Malformed => "Malformed",
39122            Self::LowReserve => "LowReserve",
39123            Self::NoTrust => "NoTrust",
39124            Self::NotAuthorized => "NotAuthorized",
39125            Self::Underfunded => "Underfunded",
39126        }
39127    }
39128
39129    #[must_use]
39130    pub const fn discriminant(&self) -> CreateClaimableBalanceResultCode {
39131        #[allow(clippy::match_same_arms)]
39132        match self {
39133            Self::Success(_) => CreateClaimableBalanceResultCode::Success,
39134            Self::Malformed => CreateClaimableBalanceResultCode::Malformed,
39135            Self::LowReserve => CreateClaimableBalanceResultCode::LowReserve,
39136            Self::NoTrust => CreateClaimableBalanceResultCode::NoTrust,
39137            Self::NotAuthorized => CreateClaimableBalanceResultCode::NotAuthorized,
39138            Self::Underfunded => CreateClaimableBalanceResultCode::Underfunded,
39139        }
39140    }
39141
39142    #[must_use]
39143    pub const fn variants() -> [CreateClaimableBalanceResultCode; 6] {
39144        Self::VARIANTS
39145    }
39146}
39147
39148impl Name for CreateClaimableBalanceResult {
39149    #[must_use]
39150    fn name(&self) -> &'static str {
39151        Self::name(self)
39152    }
39153}
39154
39155impl Discriminant<CreateClaimableBalanceResultCode> for CreateClaimableBalanceResult {
39156    #[must_use]
39157    fn discriminant(&self) -> CreateClaimableBalanceResultCode {
39158        Self::discriminant(self)
39159    }
39160}
39161
39162impl Variants<CreateClaimableBalanceResultCode> for CreateClaimableBalanceResult {
39163    fn variants() -> slice::Iter<'static, CreateClaimableBalanceResultCode> {
39164        Self::VARIANTS.iter()
39165    }
39166}
39167
39168impl Union<CreateClaimableBalanceResultCode> for CreateClaimableBalanceResult {}
39169
39170impl ReadXdr for CreateClaimableBalanceResult {
39171    #[cfg(feature = "std")]
39172    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
39173        r.with_limited_depth(|r| {
39174            let dv: CreateClaimableBalanceResultCode =
39175                <CreateClaimableBalanceResultCode as ReadXdr>::read_xdr(r)?;
39176            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
39177            let v = match dv {
39178                CreateClaimableBalanceResultCode::Success => {
39179                    Self::Success(ClaimableBalanceId::read_xdr(r)?)
39180                }
39181                CreateClaimableBalanceResultCode::Malformed => Self::Malformed,
39182                CreateClaimableBalanceResultCode::LowReserve => Self::LowReserve,
39183                CreateClaimableBalanceResultCode::NoTrust => Self::NoTrust,
39184                CreateClaimableBalanceResultCode::NotAuthorized => Self::NotAuthorized,
39185                CreateClaimableBalanceResultCode::Underfunded => Self::Underfunded,
39186                #[allow(unreachable_patterns)]
39187                _ => return Err(Error::Invalid),
39188            };
39189            Ok(v)
39190        })
39191    }
39192}
39193
39194impl WriteXdr for CreateClaimableBalanceResult {
39195    #[cfg(feature = "std")]
39196    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
39197        w.with_limited_depth(|w| {
39198            self.discriminant().write_xdr(w)?;
39199            #[allow(clippy::match_same_arms)]
39200            match self {
39201                Self::Success(v) => v.write_xdr(w)?,
39202                Self::Malformed => ().write_xdr(w)?,
39203                Self::LowReserve => ().write_xdr(w)?,
39204                Self::NoTrust => ().write_xdr(w)?,
39205                Self::NotAuthorized => ().write_xdr(w)?,
39206                Self::Underfunded => ().write_xdr(w)?,
39207            };
39208            Ok(())
39209        })
39210    }
39211}
39212
39213/// ClaimClaimableBalanceResultCode is an XDR Enum defines as:
39214///
39215/// ```text
39216/// enum ClaimClaimableBalanceResultCode
39217/// {
39218///     CLAIM_CLAIMABLE_BALANCE_SUCCESS = 0,
39219///     CLAIM_CLAIMABLE_BALANCE_DOES_NOT_EXIST = -1,
39220///     CLAIM_CLAIMABLE_BALANCE_CANNOT_CLAIM = -2,
39221///     CLAIM_CLAIMABLE_BALANCE_LINE_FULL = -3,
39222///     CLAIM_CLAIMABLE_BALANCE_NO_TRUST = -4,
39223///     CLAIM_CLAIMABLE_BALANCE_NOT_AUTHORIZED = -5
39224/// };
39225/// ```
39226///
39227// enum
39228#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
39229#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
39230#[cfg_attr(
39231    all(feature = "serde", feature = "alloc"),
39232    derive(serde::Serialize, serde::Deserialize),
39233    serde(rename_all = "snake_case")
39234)]
39235#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
39236#[repr(i32)]
39237pub enum ClaimClaimableBalanceResultCode {
39238    Success = 0,
39239    DoesNotExist = -1,
39240    CannotClaim = -2,
39241    LineFull = -3,
39242    NoTrust = -4,
39243    NotAuthorized = -5,
39244}
39245
39246impl ClaimClaimableBalanceResultCode {
39247    pub const VARIANTS: [ClaimClaimableBalanceResultCode; 6] = [
39248        ClaimClaimableBalanceResultCode::Success,
39249        ClaimClaimableBalanceResultCode::DoesNotExist,
39250        ClaimClaimableBalanceResultCode::CannotClaim,
39251        ClaimClaimableBalanceResultCode::LineFull,
39252        ClaimClaimableBalanceResultCode::NoTrust,
39253        ClaimClaimableBalanceResultCode::NotAuthorized,
39254    ];
39255    pub const VARIANTS_STR: [&'static str; 6] = [
39256        "Success",
39257        "DoesNotExist",
39258        "CannotClaim",
39259        "LineFull",
39260        "NoTrust",
39261        "NotAuthorized",
39262    ];
39263
39264    #[must_use]
39265    pub const fn name(&self) -> &'static str {
39266        match self {
39267            Self::Success => "Success",
39268            Self::DoesNotExist => "DoesNotExist",
39269            Self::CannotClaim => "CannotClaim",
39270            Self::LineFull => "LineFull",
39271            Self::NoTrust => "NoTrust",
39272            Self::NotAuthorized => "NotAuthorized",
39273        }
39274    }
39275
39276    #[must_use]
39277    pub const fn variants() -> [ClaimClaimableBalanceResultCode; 6] {
39278        Self::VARIANTS
39279    }
39280}
39281
39282impl Name for ClaimClaimableBalanceResultCode {
39283    #[must_use]
39284    fn name(&self) -> &'static str {
39285        Self::name(self)
39286    }
39287}
39288
39289impl Variants<ClaimClaimableBalanceResultCode> for ClaimClaimableBalanceResultCode {
39290    fn variants() -> slice::Iter<'static, ClaimClaimableBalanceResultCode> {
39291        Self::VARIANTS.iter()
39292    }
39293}
39294
39295impl Enum for ClaimClaimableBalanceResultCode {}
39296
39297impl fmt::Display for ClaimClaimableBalanceResultCode {
39298    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
39299        f.write_str(self.name())
39300    }
39301}
39302
39303impl TryFrom<i32> for ClaimClaimableBalanceResultCode {
39304    type Error = Error;
39305
39306    fn try_from(i: i32) -> Result<Self> {
39307        let e = match i {
39308            0 => ClaimClaimableBalanceResultCode::Success,
39309            -1 => ClaimClaimableBalanceResultCode::DoesNotExist,
39310            -2 => ClaimClaimableBalanceResultCode::CannotClaim,
39311            -3 => ClaimClaimableBalanceResultCode::LineFull,
39312            -4 => ClaimClaimableBalanceResultCode::NoTrust,
39313            -5 => ClaimClaimableBalanceResultCode::NotAuthorized,
39314            #[allow(unreachable_patterns)]
39315            _ => return Err(Error::Invalid),
39316        };
39317        Ok(e)
39318    }
39319}
39320
39321impl From<ClaimClaimableBalanceResultCode> for i32 {
39322    #[must_use]
39323    fn from(e: ClaimClaimableBalanceResultCode) -> Self {
39324        e as Self
39325    }
39326}
39327
39328impl ReadXdr for ClaimClaimableBalanceResultCode {
39329    #[cfg(feature = "std")]
39330    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
39331        r.with_limited_depth(|r| {
39332            let e = i32::read_xdr(r)?;
39333            let v: Self = e.try_into()?;
39334            Ok(v)
39335        })
39336    }
39337}
39338
39339impl WriteXdr for ClaimClaimableBalanceResultCode {
39340    #[cfg(feature = "std")]
39341    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
39342        w.with_limited_depth(|w| {
39343            let i: i32 = (*self).into();
39344            i.write_xdr(w)
39345        })
39346    }
39347}
39348
39349/// ClaimClaimableBalanceResult is an XDR Union defines as:
39350///
39351/// ```text
39352/// union ClaimClaimableBalanceResult switch (ClaimClaimableBalanceResultCode code)
39353/// {
39354/// case CLAIM_CLAIMABLE_BALANCE_SUCCESS:
39355///     void;
39356/// case CLAIM_CLAIMABLE_BALANCE_DOES_NOT_EXIST:
39357/// case CLAIM_CLAIMABLE_BALANCE_CANNOT_CLAIM:
39358/// case CLAIM_CLAIMABLE_BALANCE_LINE_FULL:
39359/// case CLAIM_CLAIMABLE_BALANCE_NO_TRUST:
39360/// case CLAIM_CLAIMABLE_BALANCE_NOT_AUTHORIZED:
39361///     void;
39362/// };
39363/// ```
39364///
39365// union with discriminant ClaimClaimableBalanceResultCode
39366#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
39367#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
39368#[cfg_attr(
39369    all(feature = "serde", feature = "alloc"),
39370    derive(serde::Serialize, serde::Deserialize),
39371    serde(rename_all = "snake_case")
39372)]
39373#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
39374#[allow(clippy::large_enum_variant)]
39375pub enum ClaimClaimableBalanceResult {
39376    Success,
39377    DoesNotExist,
39378    CannotClaim,
39379    LineFull,
39380    NoTrust,
39381    NotAuthorized,
39382}
39383
39384impl ClaimClaimableBalanceResult {
39385    pub const VARIANTS: [ClaimClaimableBalanceResultCode; 6] = [
39386        ClaimClaimableBalanceResultCode::Success,
39387        ClaimClaimableBalanceResultCode::DoesNotExist,
39388        ClaimClaimableBalanceResultCode::CannotClaim,
39389        ClaimClaimableBalanceResultCode::LineFull,
39390        ClaimClaimableBalanceResultCode::NoTrust,
39391        ClaimClaimableBalanceResultCode::NotAuthorized,
39392    ];
39393    pub const VARIANTS_STR: [&'static str; 6] = [
39394        "Success",
39395        "DoesNotExist",
39396        "CannotClaim",
39397        "LineFull",
39398        "NoTrust",
39399        "NotAuthorized",
39400    ];
39401
39402    #[must_use]
39403    pub const fn name(&self) -> &'static str {
39404        match self {
39405            Self::Success => "Success",
39406            Self::DoesNotExist => "DoesNotExist",
39407            Self::CannotClaim => "CannotClaim",
39408            Self::LineFull => "LineFull",
39409            Self::NoTrust => "NoTrust",
39410            Self::NotAuthorized => "NotAuthorized",
39411        }
39412    }
39413
39414    #[must_use]
39415    pub const fn discriminant(&self) -> ClaimClaimableBalanceResultCode {
39416        #[allow(clippy::match_same_arms)]
39417        match self {
39418            Self::Success => ClaimClaimableBalanceResultCode::Success,
39419            Self::DoesNotExist => ClaimClaimableBalanceResultCode::DoesNotExist,
39420            Self::CannotClaim => ClaimClaimableBalanceResultCode::CannotClaim,
39421            Self::LineFull => ClaimClaimableBalanceResultCode::LineFull,
39422            Self::NoTrust => ClaimClaimableBalanceResultCode::NoTrust,
39423            Self::NotAuthorized => ClaimClaimableBalanceResultCode::NotAuthorized,
39424        }
39425    }
39426
39427    #[must_use]
39428    pub const fn variants() -> [ClaimClaimableBalanceResultCode; 6] {
39429        Self::VARIANTS
39430    }
39431}
39432
39433impl Name for ClaimClaimableBalanceResult {
39434    #[must_use]
39435    fn name(&self) -> &'static str {
39436        Self::name(self)
39437    }
39438}
39439
39440impl Discriminant<ClaimClaimableBalanceResultCode> for ClaimClaimableBalanceResult {
39441    #[must_use]
39442    fn discriminant(&self) -> ClaimClaimableBalanceResultCode {
39443        Self::discriminant(self)
39444    }
39445}
39446
39447impl Variants<ClaimClaimableBalanceResultCode> for ClaimClaimableBalanceResult {
39448    fn variants() -> slice::Iter<'static, ClaimClaimableBalanceResultCode> {
39449        Self::VARIANTS.iter()
39450    }
39451}
39452
39453impl Union<ClaimClaimableBalanceResultCode> for ClaimClaimableBalanceResult {}
39454
39455impl ReadXdr for ClaimClaimableBalanceResult {
39456    #[cfg(feature = "std")]
39457    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
39458        r.with_limited_depth(|r| {
39459            let dv: ClaimClaimableBalanceResultCode =
39460                <ClaimClaimableBalanceResultCode as ReadXdr>::read_xdr(r)?;
39461            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
39462            let v = match dv {
39463                ClaimClaimableBalanceResultCode::Success => Self::Success,
39464                ClaimClaimableBalanceResultCode::DoesNotExist => Self::DoesNotExist,
39465                ClaimClaimableBalanceResultCode::CannotClaim => Self::CannotClaim,
39466                ClaimClaimableBalanceResultCode::LineFull => Self::LineFull,
39467                ClaimClaimableBalanceResultCode::NoTrust => Self::NoTrust,
39468                ClaimClaimableBalanceResultCode::NotAuthorized => Self::NotAuthorized,
39469                #[allow(unreachable_patterns)]
39470                _ => return Err(Error::Invalid),
39471            };
39472            Ok(v)
39473        })
39474    }
39475}
39476
39477impl WriteXdr for ClaimClaimableBalanceResult {
39478    #[cfg(feature = "std")]
39479    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
39480        w.with_limited_depth(|w| {
39481            self.discriminant().write_xdr(w)?;
39482            #[allow(clippy::match_same_arms)]
39483            match self {
39484                Self::Success => ().write_xdr(w)?,
39485                Self::DoesNotExist => ().write_xdr(w)?,
39486                Self::CannotClaim => ().write_xdr(w)?,
39487                Self::LineFull => ().write_xdr(w)?,
39488                Self::NoTrust => ().write_xdr(w)?,
39489                Self::NotAuthorized => ().write_xdr(w)?,
39490            };
39491            Ok(())
39492        })
39493    }
39494}
39495
39496/// BeginSponsoringFutureReservesResultCode is an XDR Enum defines as:
39497///
39498/// ```text
39499/// enum BeginSponsoringFutureReservesResultCode
39500/// {
39501///     // codes considered as "success" for the operation
39502///     BEGIN_SPONSORING_FUTURE_RESERVES_SUCCESS = 0,
39503///
39504///     // codes considered as "failure" for the operation
39505///     BEGIN_SPONSORING_FUTURE_RESERVES_MALFORMED = -1,
39506///     BEGIN_SPONSORING_FUTURE_RESERVES_ALREADY_SPONSORED = -2,
39507///     BEGIN_SPONSORING_FUTURE_RESERVES_RECURSIVE = -3
39508/// };
39509/// ```
39510///
39511// enum
39512#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
39513#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
39514#[cfg_attr(
39515    all(feature = "serde", feature = "alloc"),
39516    derive(serde::Serialize, serde::Deserialize),
39517    serde(rename_all = "snake_case")
39518)]
39519#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
39520#[repr(i32)]
39521pub enum BeginSponsoringFutureReservesResultCode {
39522    Success = 0,
39523    Malformed = -1,
39524    AlreadySponsored = -2,
39525    Recursive = -3,
39526}
39527
39528impl BeginSponsoringFutureReservesResultCode {
39529    pub const VARIANTS: [BeginSponsoringFutureReservesResultCode; 4] = [
39530        BeginSponsoringFutureReservesResultCode::Success,
39531        BeginSponsoringFutureReservesResultCode::Malformed,
39532        BeginSponsoringFutureReservesResultCode::AlreadySponsored,
39533        BeginSponsoringFutureReservesResultCode::Recursive,
39534    ];
39535    pub const VARIANTS_STR: [&'static str; 4] =
39536        ["Success", "Malformed", "AlreadySponsored", "Recursive"];
39537
39538    #[must_use]
39539    pub const fn name(&self) -> &'static str {
39540        match self {
39541            Self::Success => "Success",
39542            Self::Malformed => "Malformed",
39543            Self::AlreadySponsored => "AlreadySponsored",
39544            Self::Recursive => "Recursive",
39545        }
39546    }
39547
39548    #[must_use]
39549    pub const fn variants() -> [BeginSponsoringFutureReservesResultCode; 4] {
39550        Self::VARIANTS
39551    }
39552}
39553
39554impl Name for BeginSponsoringFutureReservesResultCode {
39555    #[must_use]
39556    fn name(&self) -> &'static str {
39557        Self::name(self)
39558    }
39559}
39560
39561impl Variants<BeginSponsoringFutureReservesResultCode> for BeginSponsoringFutureReservesResultCode {
39562    fn variants() -> slice::Iter<'static, BeginSponsoringFutureReservesResultCode> {
39563        Self::VARIANTS.iter()
39564    }
39565}
39566
39567impl Enum for BeginSponsoringFutureReservesResultCode {}
39568
39569impl fmt::Display for BeginSponsoringFutureReservesResultCode {
39570    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
39571        f.write_str(self.name())
39572    }
39573}
39574
39575impl TryFrom<i32> for BeginSponsoringFutureReservesResultCode {
39576    type Error = Error;
39577
39578    fn try_from(i: i32) -> Result<Self> {
39579        let e = match i {
39580            0 => BeginSponsoringFutureReservesResultCode::Success,
39581            -1 => BeginSponsoringFutureReservesResultCode::Malformed,
39582            -2 => BeginSponsoringFutureReservesResultCode::AlreadySponsored,
39583            -3 => BeginSponsoringFutureReservesResultCode::Recursive,
39584            #[allow(unreachable_patterns)]
39585            _ => return Err(Error::Invalid),
39586        };
39587        Ok(e)
39588    }
39589}
39590
39591impl From<BeginSponsoringFutureReservesResultCode> for i32 {
39592    #[must_use]
39593    fn from(e: BeginSponsoringFutureReservesResultCode) -> Self {
39594        e as Self
39595    }
39596}
39597
39598impl ReadXdr for BeginSponsoringFutureReservesResultCode {
39599    #[cfg(feature = "std")]
39600    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
39601        r.with_limited_depth(|r| {
39602            let e = i32::read_xdr(r)?;
39603            let v: Self = e.try_into()?;
39604            Ok(v)
39605        })
39606    }
39607}
39608
39609impl WriteXdr for BeginSponsoringFutureReservesResultCode {
39610    #[cfg(feature = "std")]
39611    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
39612        w.with_limited_depth(|w| {
39613            let i: i32 = (*self).into();
39614            i.write_xdr(w)
39615        })
39616    }
39617}
39618
39619/// BeginSponsoringFutureReservesResult is an XDR Union defines as:
39620///
39621/// ```text
39622/// union BeginSponsoringFutureReservesResult switch (
39623///     BeginSponsoringFutureReservesResultCode code)
39624/// {
39625/// case BEGIN_SPONSORING_FUTURE_RESERVES_SUCCESS:
39626///     void;
39627/// case BEGIN_SPONSORING_FUTURE_RESERVES_MALFORMED:
39628/// case BEGIN_SPONSORING_FUTURE_RESERVES_ALREADY_SPONSORED:
39629/// case BEGIN_SPONSORING_FUTURE_RESERVES_RECURSIVE:
39630///     void;
39631/// };
39632/// ```
39633///
39634// union with discriminant BeginSponsoringFutureReservesResultCode
39635#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
39636#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
39637#[cfg_attr(
39638    all(feature = "serde", feature = "alloc"),
39639    derive(serde::Serialize, serde::Deserialize),
39640    serde(rename_all = "snake_case")
39641)]
39642#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
39643#[allow(clippy::large_enum_variant)]
39644pub enum BeginSponsoringFutureReservesResult {
39645    Success,
39646    Malformed,
39647    AlreadySponsored,
39648    Recursive,
39649}
39650
39651impl BeginSponsoringFutureReservesResult {
39652    pub const VARIANTS: [BeginSponsoringFutureReservesResultCode; 4] = [
39653        BeginSponsoringFutureReservesResultCode::Success,
39654        BeginSponsoringFutureReservesResultCode::Malformed,
39655        BeginSponsoringFutureReservesResultCode::AlreadySponsored,
39656        BeginSponsoringFutureReservesResultCode::Recursive,
39657    ];
39658    pub const VARIANTS_STR: [&'static str; 4] =
39659        ["Success", "Malformed", "AlreadySponsored", "Recursive"];
39660
39661    #[must_use]
39662    pub const fn name(&self) -> &'static str {
39663        match self {
39664            Self::Success => "Success",
39665            Self::Malformed => "Malformed",
39666            Self::AlreadySponsored => "AlreadySponsored",
39667            Self::Recursive => "Recursive",
39668        }
39669    }
39670
39671    #[must_use]
39672    pub const fn discriminant(&self) -> BeginSponsoringFutureReservesResultCode {
39673        #[allow(clippy::match_same_arms)]
39674        match self {
39675            Self::Success => BeginSponsoringFutureReservesResultCode::Success,
39676            Self::Malformed => BeginSponsoringFutureReservesResultCode::Malformed,
39677            Self::AlreadySponsored => BeginSponsoringFutureReservesResultCode::AlreadySponsored,
39678            Self::Recursive => BeginSponsoringFutureReservesResultCode::Recursive,
39679        }
39680    }
39681
39682    #[must_use]
39683    pub const fn variants() -> [BeginSponsoringFutureReservesResultCode; 4] {
39684        Self::VARIANTS
39685    }
39686}
39687
39688impl Name for BeginSponsoringFutureReservesResult {
39689    #[must_use]
39690    fn name(&self) -> &'static str {
39691        Self::name(self)
39692    }
39693}
39694
39695impl Discriminant<BeginSponsoringFutureReservesResultCode> for BeginSponsoringFutureReservesResult {
39696    #[must_use]
39697    fn discriminant(&self) -> BeginSponsoringFutureReservesResultCode {
39698        Self::discriminant(self)
39699    }
39700}
39701
39702impl Variants<BeginSponsoringFutureReservesResultCode> for BeginSponsoringFutureReservesResult {
39703    fn variants() -> slice::Iter<'static, BeginSponsoringFutureReservesResultCode> {
39704        Self::VARIANTS.iter()
39705    }
39706}
39707
39708impl Union<BeginSponsoringFutureReservesResultCode> for BeginSponsoringFutureReservesResult {}
39709
39710impl ReadXdr for BeginSponsoringFutureReservesResult {
39711    #[cfg(feature = "std")]
39712    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
39713        r.with_limited_depth(|r| {
39714            let dv: BeginSponsoringFutureReservesResultCode =
39715                <BeginSponsoringFutureReservesResultCode as ReadXdr>::read_xdr(r)?;
39716            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
39717            let v = match dv {
39718                BeginSponsoringFutureReservesResultCode::Success => Self::Success,
39719                BeginSponsoringFutureReservesResultCode::Malformed => Self::Malformed,
39720                BeginSponsoringFutureReservesResultCode::AlreadySponsored => Self::AlreadySponsored,
39721                BeginSponsoringFutureReservesResultCode::Recursive => Self::Recursive,
39722                #[allow(unreachable_patterns)]
39723                _ => return Err(Error::Invalid),
39724            };
39725            Ok(v)
39726        })
39727    }
39728}
39729
39730impl WriteXdr for BeginSponsoringFutureReservesResult {
39731    #[cfg(feature = "std")]
39732    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
39733        w.with_limited_depth(|w| {
39734            self.discriminant().write_xdr(w)?;
39735            #[allow(clippy::match_same_arms)]
39736            match self {
39737                Self::Success => ().write_xdr(w)?,
39738                Self::Malformed => ().write_xdr(w)?,
39739                Self::AlreadySponsored => ().write_xdr(w)?,
39740                Self::Recursive => ().write_xdr(w)?,
39741            };
39742            Ok(())
39743        })
39744    }
39745}
39746
39747/// EndSponsoringFutureReservesResultCode is an XDR Enum defines as:
39748///
39749/// ```text
39750/// enum EndSponsoringFutureReservesResultCode
39751/// {
39752///     // codes considered as "success" for the operation
39753///     END_SPONSORING_FUTURE_RESERVES_SUCCESS = 0,
39754///
39755///     // codes considered as "failure" for the operation
39756///     END_SPONSORING_FUTURE_RESERVES_NOT_SPONSORED = -1
39757/// };
39758/// ```
39759///
39760// enum
39761#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
39762#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
39763#[cfg_attr(
39764    all(feature = "serde", feature = "alloc"),
39765    derive(serde::Serialize, serde::Deserialize),
39766    serde(rename_all = "snake_case")
39767)]
39768#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
39769#[repr(i32)]
39770pub enum EndSponsoringFutureReservesResultCode {
39771    Success = 0,
39772    NotSponsored = -1,
39773}
39774
39775impl EndSponsoringFutureReservesResultCode {
39776    pub const VARIANTS: [EndSponsoringFutureReservesResultCode; 2] = [
39777        EndSponsoringFutureReservesResultCode::Success,
39778        EndSponsoringFutureReservesResultCode::NotSponsored,
39779    ];
39780    pub const VARIANTS_STR: [&'static str; 2] = ["Success", "NotSponsored"];
39781
39782    #[must_use]
39783    pub const fn name(&self) -> &'static str {
39784        match self {
39785            Self::Success => "Success",
39786            Self::NotSponsored => "NotSponsored",
39787        }
39788    }
39789
39790    #[must_use]
39791    pub const fn variants() -> [EndSponsoringFutureReservesResultCode; 2] {
39792        Self::VARIANTS
39793    }
39794}
39795
39796impl Name for EndSponsoringFutureReservesResultCode {
39797    #[must_use]
39798    fn name(&self) -> &'static str {
39799        Self::name(self)
39800    }
39801}
39802
39803impl Variants<EndSponsoringFutureReservesResultCode> for EndSponsoringFutureReservesResultCode {
39804    fn variants() -> slice::Iter<'static, EndSponsoringFutureReservesResultCode> {
39805        Self::VARIANTS.iter()
39806    }
39807}
39808
39809impl Enum for EndSponsoringFutureReservesResultCode {}
39810
39811impl fmt::Display for EndSponsoringFutureReservesResultCode {
39812    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
39813        f.write_str(self.name())
39814    }
39815}
39816
39817impl TryFrom<i32> for EndSponsoringFutureReservesResultCode {
39818    type Error = Error;
39819
39820    fn try_from(i: i32) -> Result<Self> {
39821        let e = match i {
39822            0 => EndSponsoringFutureReservesResultCode::Success,
39823            -1 => EndSponsoringFutureReservesResultCode::NotSponsored,
39824            #[allow(unreachable_patterns)]
39825            _ => return Err(Error::Invalid),
39826        };
39827        Ok(e)
39828    }
39829}
39830
39831impl From<EndSponsoringFutureReservesResultCode> for i32 {
39832    #[must_use]
39833    fn from(e: EndSponsoringFutureReservesResultCode) -> Self {
39834        e as Self
39835    }
39836}
39837
39838impl ReadXdr for EndSponsoringFutureReservesResultCode {
39839    #[cfg(feature = "std")]
39840    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
39841        r.with_limited_depth(|r| {
39842            let e = i32::read_xdr(r)?;
39843            let v: Self = e.try_into()?;
39844            Ok(v)
39845        })
39846    }
39847}
39848
39849impl WriteXdr for EndSponsoringFutureReservesResultCode {
39850    #[cfg(feature = "std")]
39851    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
39852        w.with_limited_depth(|w| {
39853            let i: i32 = (*self).into();
39854            i.write_xdr(w)
39855        })
39856    }
39857}
39858
39859/// EndSponsoringFutureReservesResult is an XDR Union defines as:
39860///
39861/// ```text
39862/// union EndSponsoringFutureReservesResult switch (
39863///     EndSponsoringFutureReservesResultCode code)
39864/// {
39865/// case END_SPONSORING_FUTURE_RESERVES_SUCCESS:
39866///     void;
39867/// case END_SPONSORING_FUTURE_RESERVES_NOT_SPONSORED:
39868///     void;
39869/// };
39870/// ```
39871///
39872// union with discriminant EndSponsoringFutureReservesResultCode
39873#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
39874#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
39875#[cfg_attr(
39876    all(feature = "serde", feature = "alloc"),
39877    derive(serde::Serialize, serde::Deserialize),
39878    serde(rename_all = "snake_case")
39879)]
39880#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
39881#[allow(clippy::large_enum_variant)]
39882pub enum EndSponsoringFutureReservesResult {
39883    Success,
39884    NotSponsored,
39885}
39886
39887impl EndSponsoringFutureReservesResult {
39888    pub const VARIANTS: [EndSponsoringFutureReservesResultCode; 2] = [
39889        EndSponsoringFutureReservesResultCode::Success,
39890        EndSponsoringFutureReservesResultCode::NotSponsored,
39891    ];
39892    pub const VARIANTS_STR: [&'static str; 2] = ["Success", "NotSponsored"];
39893
39894    #[must_use]
39895    pub const fn name(&self) -> &'static str {
39896        match self {
39897            Self::Success => "Success",
39898            Self::NotSponsored => "NotSponsored",
39899        }
39900    }
39901
39902    #[must_use]
39903    pub const fn discriminant(&self) -> EndSponsoringFutureReservesResultCode {
39904        #[allow(clippy::match_same_arms)]
39905        match self {
39906            Self::Success => EndSponsoringFutureReservesResultCode::Success,
39907            Self::NotSponsored => EndSponsoringFutureReservesResultCode::NotSponsored,
39908        }
39909    }
39910
39911    #[must_use]
39912    pub const fn variants() -> [EndSponsoringFutureReservesResultCode; 2] {
39913        Self::VARIANTS
39914    }
39915}
39916
39917impl Name for EndSponsoringFutureReservesResult {
39918    #[must_use]
39919    fn name(&self) -> &'static str {
39920        Self::name(self)
39921    }
39922}
39923
39924impl Discriminant<EndSponsoringFutureReservesResultCode> for EndSponsoringFutureReservesResult {
39925    #[must_use]
39926    fn discriminant(&self) -> EndSponsoringFutureReservesResultCode {
39927        Self::discriminant(self)
39928    }
39929}
39930
39931impl Variants<EndSponsoringFutureReservesResultCode> for EndSponsoringFutureReservesResult {
39932    fn variants() -> slice::Iter<'static, EndSponsoringFutureReservesResultCode> {
39933        Self::VARIANTS.iter()
39934    }
39935}
39936
39937impl Union<EndSponsoringFutureReservesResultCode> for EndSponsoringFutureReservesResult {}
39938
39939impl ReadXdr for EndSponsoringFutureReservesResult {
39940    #[cfg(feature = "std")]
39941    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
39942        r.with_limited_depth(|r| {
39943            let dv: EndSponsoringFutureReservesResultCode =
39944                <EndSponsoringFutureReservesResultCode as ReadXdr>::read_xdr(r)?;
39945            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
39946            let v = match dv {
39947                EndSponsoringFutureReservesResultCode::Success => Self::Success,
39948                EndSponsoringFutureReservesResultCode::NotSponsored => Self::NotSponsored,
39949                #[allow(unreachable_patterns)]
39950                _ => return Err(Error::Invalid),
39951            };
39952            Ok(v)
39953        })
39954    }
39955}
39956
39957impl WriteXdr for EndSponsoringFutureReservesResult {
39958    #[cfg(feature = "std")]
39959    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
39960        w.with_limited_depth(|w| {
39961            self.discriminant().write_xdr(w)?;
39962            #[allow(clippy::match_same_arms)]
39963            match self {
39964                Self::Success => ().write_xdr(w)?,
39965                Self::NotSponsored => ().write_xdr(w)?,
39966            };
39967            Ok(())
39968        })
39969    }
39970}
39971
39972/// RevokeSponsorshipResultCode is an XDR Enum defines as:
39973///
39974/// ```text
39975/// enum RevokeSponsorshipResultCode
39976/// {
39977///     // codes considered as "success" for the operation
39978///     REVOKE_SPONSORSHIP_SUCCESS = 0,
39979///
39980///     // codes considered as "failure" for the operation
39981///     REVOKE_SPONSORSHIP_DOES_NOT_EXIST = -1,
39982///     REVOKE_SPONSORSHIP_NOT_SPONSOR = -2,
39983///     REVOKE_SPONSORSHIP_LOW_RESERVE = -3,
39984///     REVOKE_SPONSORSHIP_ONLY_TRANSFERABLE = -4,
39985///     REVOKE_SPONSORSHIP_MALFORMED = -5
39986/// };
39987/// ```
39988///
39989// enum
39990#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
39991#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
39992#[cfg_attr(
39993    all(feature = "serde", feature = "alloc"),
39994    derive(serde::Serialize, serde::Deserialize),
39995    serde(rename_all = "snake_case")
39996)]
39997#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
39998#[repr(i32)]
39999pub enum RevokeSponsorshipResultCode {
40000    Success = 0,
40001    DoesNotExist = -1,
40002    NotSponsor = -2,
40003    LowReserve = -3,
40004    OnlyTransferable = -4,
40005    Malformed = -5,
40006}
40007
40008impl RevokeSponsorshipResultCode {
40009    pub const VARIANTS: [RevokeSponsorshipResultCode; 6] = [
40010        RevokeSponsorshipResultCode::Success,
40011        RevokeSponsorshipResultCode::DoesNotExist,
40012        RevokeSponsorshipResultCode::NotSponsor,
40013        RevokeSponsorshipResultCode::LowReserve,
40014        RevokeSponsorshipResultCode::OnlyTransferable,
40015        RevokeSponsorshipResultCode::Malformed,
40016    ];
40017    pub const VARIANTS_STR: [&'static str; 6] = [
40018        "Success",
40019        "DoesNotExist",
40020        "NotSponsor",
40021        "LowReserve",
40022        "OnlyTransferable",
40023        "Malformed",
40024    ];
40025
40026    #[must_use]
40027    pub const fn name(&self) -> &'static str {
40028        match self {
40029            Self::Success => "Success",
40030            Self::DoesNotExist => "DoesNotExist",
40031            Self::NotSponsor => "NotSponsor",
40032            Self::LowReserve => "LowReserve",
40033            Self::OnlyTransferable => "OnlyTransferable",
40034            Self::Malformed => "Malformed",
40035        }
40036    }
40037
40038    #[must_use]
40039    pub const fn variants() -> [RevokeSponsorshipResultCode; 6] {
40040        Self::VARIANTS
40041    }
40042}
40043
40044impl Name for RevokeSponsorshipResultCode {
40045    #[must_use]
40046    fn name(&self) -> &'static str {
40047        Self::name(self)
40048    }
40049}
40050
40051impl Variants<RevokeSponsorshipResultCode> for RevokeSponsorshipResultCode {
40052    fn variants() -> slice::Iter<'static, RevokeSponsorshipResultCode> {
40053        Self::VARIANTS.iter()
40054    }
40055}
40056
40057impl Enum for RevokeSponsorshipResultCode {}
40058
40059impl fmt::Display for RevokeSponsorshipResultCode {
40060    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
40061        f.write_str(self.name())
40062    }
40063}
40064
40065impl TryFrom<i32> for RevokeSponsorshipResultCode {
40066    type Error = Error;
40067
40068    fn try_from(i: i32) -> Result<Self> {
40069        let e = match i {
40070            0 => RevokeSponsorshipResultCode::Success,
40071            -1 => RevokeSponsorshipResultCode::DoesNotExist,
40072            -2 => RevokeSponsorshipResultCode::NotSponsor,
40073            -3 => RevokeSponsorshipResultCode::LowReserve,
40074            -4 => RevokeSponsorshipResultCode::OnlyTransferable,
40075            -5 => RevokeSponsorshipResultCode::Malformed,
40076            #[allow(unreachable_patterns)]
40077            _ => return Err(Error::Invalid),
40078        };
40079        Ok(e)
40080    }
40081}
40082
40083impl From<RevokeSponsorshipResultCode> for i32 {
40084    #[must_use]
40085    fn from(e: RevokeSponsorshipResultCode) -> Self {
40086        e as Self
40087    }
40088}
40089
40090impl ReadXdr for RevokeSponsorshipResultCode {
40091    #[cfg(feature = "std")]
40092    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
40093        r.with_limited_depth(|r| {
40094            let e = i32::read_xdr(r)?;
40095            let v: Self = e.try_into()?;
40096            Ok(v)
40097        })
40098    }
40099}
40100
40101impl WriteXdr for RevokeSponsorshipResultCode {
40102    #[cfg(feature = "std")]
40103    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
40104        w.with_limited_depth(|w| {
40105            let i: i32 = (*self).into();
40106            i.write_xdr(w)
40107        })
40108    }
40109}
40110
40111/// RevokeSponsorshipResult is an XDR Union defines as:
40112///
40113/// ```text
40114/// union RevokeSponsorshipResult switch (RevokeSponsorshipResultCode code)
40115/// {
40116/// case REVOKE_SPONSORSHIP_SUCCESS:
40117///     void;
40118/// case REVOKE_SPONSORSHIP_DOES_NOT_EXIST:
40119/// case REVOKE_SPONSORSHIP_NOT_SPONSOR:
40120/// case REVOKE_SPONSORSHIP_LOW_RESERVE:
40121/// case REVOKE_SPONSORSHIP_ONLY_TRANSFERABLE:
40122/// case REVOKE_SPONSORSHIP_MALFORMED:
40123///     void;
40124/// };
40125/// ```
40126///
40127// union with discriminant RevokeSponsorshipResultCode
40128#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
40129#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
40130#[cfg_attr(
40131    all(feature = "serde", feature = "alloc"),
40132    derive(serde::Serialize, serde::Deserialize),
40133    serde(rename_all = "snake_case")
40134)]
40135#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
40136#[allow(clippy::large_enum_variant)]
40137pub enum RevokeSponsorshipResult {
40138    Success,
40139    DoesNotExist,
40140    NotSponsor,
40141    LowReserve,
40142    OnlyTransferable,
40143    Malformed,
40144}
40145
40146impl RevokeSponsorshipResult {
40147    pub const VARIANTS: [RevokeSponsorshipResultCode; 6] = [
40148        RevokeSponsorshipResultCode::Success,
40149        RevokeSponsorshipResultCode::DoesNotExist,
40150        RevokeSponsorshipResultCode::NotSponsor,
40151        RevokeSponsorshipResultCode::LowReserve,
40152        RevokeSponsorshipResultCode::OnlyTransferable,
40153        RevokeSponsorshipResultCode::Malformed,
40154    ];
40155    pub const VARIANTS_STR: [&'static str; 6] = [
40156        "Success",
40157        "DoesNotExist",
40158        "NotSponsor",
40159        "LowReserve",
40160        "OnlyTransferable",
40161        "Malformed",
40162    ];
40163
40164    #[must_use]
40165    pub const fn name(&self) -> &'static str {
40166        match self {
40167            Self::Success => "Success",
40168            Self::DoesNotExist => "DoesNotExist",
40169            Self::NotSponsor => "NotSponsor",
40170            Self::LowReserve => "LowReserve",
40171            Self::OnlyTransferable => "OnlyTransferable",
40172            Self::Malformed => "Malformed",
40173        }
40174    }
40175
40176    #[must_use]
40177    pub const fn discriminant(&self) -> RevokeSponsorshipResultCode {
40178        #[allow(clippy::match_same_arms)]
40179        match self {
40180            Self::Success => RevokeSponsorshipResultCode::Success,
40181            Self::DoesNotExist => RevokeSponsorshipResultCode::DoesNotExist,
40182            Self::NotSponsor => RevokeSponsorshipResultCode::NotSponsor,
40183            Self::LowReserve => RevokeSponsorshipResultCode::LowReserve,
40184            Self::OnlyTransferable => RevokeSponsorshipResultCode::OnlyTransferable,
40185            Self::Malformed => RevokeSponsorshipResultCode::Malformed,
40186        }
40187    }
40188
40189    #[must_use]
40190    pub const fn variants() -> [RevokeSponsorshipResultCode; 6] {
40191        Self::VARIANTS
40192    }
40193}
40194
40195impl Name for RevokeSponsorshipResult {
40196    #[must_use]
40197    fn name(&self) -> &'static str {
40198        Self::name(self)
40199    }
40200}
40201
40202impl Discriminant<RevokeSponsorshipResultCode> for RevokeSponsorshipResult {
40203    #[must_use]
40204    fn discriminant(&self) -> RevokeSponsorshipResultCode {
40205        Self::discriminant(self)
40206    }
40207}
40208
40209impl Variants<RevokeSponsorshipResultCode> for RevokeSponsorshipResult {
40210    fn variants() -> slice::Iter<'static, RevokeSponsorshipResultCode> {
40211        Self::VARIANTS.iter()
40212    }
40213}
40214
40215impl Union<RevokeSponsorshipResultCode> for RevokeSponsorshipResult {}
40216
40217impl ReadXdr for RevokeSponsorshipResult {
40218    #[cfg(feature = "std")]
40219    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
40220        r.with_limited_depth(|r| {
40221            let dv: RevokeSponsorshipResultCode =
40222                <RevokeSponsorshipResultCode as ReadXdr>::read_xdr(r)?;
40223            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
40224            let v = match dv {
40225                RevokeSponsorshipResultCode::Success => Self::Success,
40226                RevokeSponsorshipResultCode::DoesNotExist => Self::DoesNotExist,
40227                RevokeSponsorshipResultCode::NotSponsor => Self::NotSponsor,
40228                RevokeSponsorshipResultCode::LowReserve => Self::LowReserve,
40229                RevokeSponsorshipResultCode::OnlyTransferable => Self::OnlyTransferable,
40230                RevokeSponsorshipResultCode::Malformed => Self::Malformed,
40231                #[allow(unreachable_patterns)]
40232                _ => return Err(Error::Invalid),
40233            };
40234            Ok(v)
40235        })
40236    }
40237}
40238
40239impl WriteXdr for RevokeSponsorshipResult {
40240    #[cfg(feature = "std")]
40241    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
40242        w.with_limited_depth(|w| {
40243            self.discriminant().write_xdr(w)?;
40244            #[allow(clippy::match_same_arms)]
40245            match self {
40246                Self::Success => ().write_xdr(w)?,
40247                Self::DoesNotExist => ().write_xdr(w)?,
40248                Self::NotSponsor => ().write_xdr(w)?,
40249                Self::LowReserve => ().write_xdr(w)?,
40250                Self::OnlyTransferable => ().write_xdr(w)?,
40251                Self::Malformed => ().write_xdr(w)?,
40252            };
40253            Ok(())
40254        })
40255    }
40256}
40257
40258/// ClawbackResultCode is an XDR Enum defines as:
40259///
40260/// ```text
40261/// enum ClawbackResultCode
40262/// {
40263///     // codes considered as "success" for the operation
40264///     CLAWBACK_SUCCESS = 0,
40265///
40266///     // codes considered as "failure" for the operation
40267///     CLAWBACK_MALFORMED = -1,
40268///     CLAWBACK_NOT_CLAWBACK_ENABLED = -2,
40269///     CLAWBACK_NO_TRUST = -3,
40270///     CLAWBACK_UNDERFUNDED = -4
40271/// };
40272/// ```
40273///
40274// enum
40275#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
40276#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
40277#[cfg_attr(
40278    all(feature = "serde", feature = "alloc"),
40279    derive(serde::Serialize, serde::Deserialize),
40280    serde(rename_all = "snake_case")
40281)]
40282#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
40283#[repr(i32)]
40284pub enum ClawbackResultCode {
40285    Success = 0,
40286    Malformed = -1,
40287    NotClawbackEnabled = -2,
40288    NoTrust = -3,
40289    Underfunded = -4,
40290}
40291
40292impl ClawbackResultCode {
40293    pub const VARIANTS: [ClawbackResultCode; 5] = [
40294        ClawbackResultCode::Success,
40295        ClawbackResultCode::Malformed,
40296        ClawbackResultCode::NotClawbackEnabled,
40297        ClawbackResultCode::NoTrust,
40298        ClawbackResultCode::Underfunded,
40299    ];
40300    pub const VARIANTS_STR: [&'static str; 5] = [
40301        "Success",
40302        "Malformed",
40303        "NotClawbackEnabled",
40304        "NoTrust",
40305        "Underfunded",
40306    ];
40307
40308    #[must_use]
40309    pub const fn name(&self) -> &'static str {
40310        match self {
40311            Self::Success => "Success",
40312            Self::Malformed => "Malformed",
40313            Self::NotClawbackEnabled => "NotClawbackEnabled",
40314            Self::NoTrust => "NoTrust",
40315            Self::Underfunded => "Underfunded",
40316        }
40317    }
40318
40319    #[must_use]
40320    pub const fn variants() -> [ClawbackResultCode; 5] {
40321        Self::VARIANTS
40322    }
40323}
40324
40325impl Name for ClawbackResultCode {
40326    #[must_use]
40327    fn name(&self) -> &'static str {
40328        Self::name(self)
40329    }
40330}
40331
40332impl Variants<ClawbackResultCode> for ClawbackResultCode {
40333    fn variants() -> slice::Iter<'static, ClawbackResultCode> {
40334        Self::VARIANTS.iter()
40335    }
40336}
40337
40338impl Enum for ClawbackResultCode {}
40339
40340impl fmt::Display for ClawbackResultCode {
40341    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
40342        f.write_str(self.name())
40343    }
40344}
40345
40346impl TryFrom<i32> for ClawbackResultCode {
40347    type Error = Error;
40348
40349    fn try_from(i: i32) -> Result<Self> {
40350        let e = match i {
40351            0 => ClawbackResultCode::Success,
40352            -1 => ClawbackResultCode::Malformed,
40353            -2 => ClawbackResultCode::NotClawbackEnabled,
40354            -3 => ClawbackResultCode::NoTrust,
40355            -4 => ClawbackResultCode::Underfunded,
40356            #[allow(unreachable_patterns)]
40357            _ => return Err(Error::Invalid),
40358        };
40359        Ok(e)
40360    }
40361}
40362
40363impl From<ClawbackResultCode> for i32 {
40364    #[must_use]
40365    fn from(e: ClawbackResultCode) -> Self {
40366        e as Self
40367    }
40368}
40369
40370impl ReadXdr for ClawbackResultCode {
40371    #[cfg(feature = "std")]
40372    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
40373        r.with_limited_depth(|r| {
40374            let e = i32::read_xdr(r)?;
40375            let v: Self = e.try_into()?;
40376            Ok(v)
40377        })
40378    }
40379}
40380
40381impl WriteXdr for ClawbackResultCode {
40382    #[cfg(feature = "std")]
40383    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
40384        w.with_limited_depth(|w| {
40385            let i: i32 = (*self).into();
40386            i.write_xdr(w)
40387        })
40388    }
40389}
40390
40391/// ClawbackResult is an XDR Union defines as:
40392///
40393/// ```text
40394/// union ClawbackResult switch (ClawbackResultCode code)
40395/// {
40396/// case CLAWBACK_SUCCESS:
40397///     void;
40398/// case CLAWBACK_MALFORMED:
40399/// case CLAWBACK_NOT_CLAWBACK_ENABLED:
40400/// case CLAWBACK_NO_TRUST:
40401/// case CLAWBACK_UNDERFUNDED:
40402///     void;
40403/// };
40404/// ```
40405///
40406// union with discriminant ClawbackResultCode
40407#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
40408#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
40409#[cfg_attr(
40410    all(feature = "serde", feature = "alloc"),
40411    derive(serde::Serialize, serde::Deserialize),
40412    serde(rename_all = "snake_case")
40413)]
40414#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
40415#[allow(clippy::large_enum_variant)]
40416pub enum ClawbackResult {
40417    Success,
40418    Malformed,
40419    NotClawbackEnabled,
40420    NoTrust,
40421    Underfunded,
40422}
40423
40424impl ClawbackResult {
40425    pub const VARIANTS: [ClawbackResultCode; 5] = [
40426        ClawbackResultCode::Success,
40427        ClawbackResultCode::Malformed,
40428        ClawbackResultCode::NotClawbackEnabled,
40429        ClawbackResultCode::NoTrust,
40430        ClawbackResultCode::Underfunded,
40431    ];
40432    pub const VARIANTS_STR: [&'static str; 5] = [
40433        "Success",
40434        "Malformed",
40435        "NotClawbackEnabled",
40436        "NoTrust",
40437        "Underfunded",
40438    ];
40439
40440    #[must_use]
40441    pub const fn name(&self) -> &'static str {
40442        match self {
40443            Self::Success => "Success",
40444            Self::Malformed => "Malformed",
40445            Self::NotClawbackEnabled => "NotClawbackEnabled",
40446            Self::NoTrust => "NoTrust",
40447            Self::Underfunded => "Underfunded",
40448        }
40449    }
40450
40451    #[must_use]
40452    pub const fn discriminant(&self) -> ClawbackResultCode {
40453        #[allow(clippy::match_same_arms)]
40454        match self {
40455            Self::Success => ClawbackResultCode::Success,
40456            Self::Malformed => ClawbackResultCode::Malformed,
40457            Self::NotClawbackEnabled => ClawbackResultCode::NotClawbackEnabled,
40458            Self::NoTrust => ClawbackResultCode::NoTrust,
40459            Self::Underfunded => ClawbackResultCode::Underfunded,
40460        }
40461    }
40462
40463    #[must_use]
40464    pub const fn variants() -> [ClawbackResultCode; 5] {
40465        Self::VARIANTS
40466    }
40467}
40468
40469impl Name for ClawbackResult {
40470    #[must_use]
40471    fn name(&self) -> &'static str {
40472        Self::name(self)
40473    }
40474}
40475
40476impl Discriminant<ClawbackResultCode> for ClawbackResult {
40477    #[must_use]
40478    fn discriminant(&self) -> ClawbackResultCode {
40479        Self::discriminant(self)
40480    }
40481}
40482
40483impl Variants<ClawbackResultCode> for ClawbackResult {
40484    fn variants() -> slice::Iter<'static, ClawbackResultCode> {
40485        Self::VARIANTS.iter()
40486    }
40487}
40488
40489impl Union<ClawbackResultCode> for ClawbackResult {}
40490
40491impl ReadXdr for ClawbackResult {
40492    #[cfg(feature = "std")]
40493    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
40494        r.with_limited_depth(|r| {
40495            let dv: ClawbackResultCode = <ClawbackResultCode as ReadXdr>::read_xdr(r)?;
40496            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
40497            let v = match dv {
40498                ClawbackResultCode::Success => Self::Success,
40499                ClawbackResultCode::Malformed => Self::Malformed,
40500                ClawbackResultCode::NotClawbackEnabled => Self::NotClawbackEnabled,
40501                ClawbackResultCode::NoTrust => Self::NoTrust,
40502                ClawbackResultCode::Underfunded => Self::Underfunded,
40503                #[allow(unreachable_patterns)]
40504                _ => return Err(Error::Invalid),
40505            };
40506            Ok(v)
40507        })
40508    }
40509}
40510
40511impl WriteXdr for ClawbackResult {
40512    #[cfg(feature = "std")]
40513    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
40514        w.with_limited_depth(|w| {
40515            self.discriminant().write_xdr(w)?;
40516            #[allow(clippy::match_same_arms)]
40517            match self {
40518                Self::Success => ().write_xdr(w)?,
40519                Self::Malformed => ().write_xdr(w)?,
40520                Self::NotClawbackEnabled => ().write_xdr(w)?,
40521                Self::NoTrust => ().write_xdr(w)?,
40522                Self::Underfunded => ().write_xdr(w)?,
40523            };
40524            Ok(())
40525        })
40526    }
40527}
40528
40529/// ClawbackClaimableBalanceResultCode is an XDR Enum defines as:
40530///
40531/// ```text
40532/// enum ClawbackClaimableBalanceResultCode
40533/// {
40534///     // codes considered as "success" for the operation
40535///     CLAWBACK_CLAIMABLE_BALANCE_SUCCESS = 0,
40536///
40537///     // codes considered as "failure" for the operation
40538///     CLAWBACK_CLAIMABLE_BALANCE_DOES_NOT_EXIST = -1,
40539///     CLAWBACK_CLAIMABLE_BALANCE_NOT_ISSUER = -2,
40540///     CLAWBACK_CLAIMABLE_BALANCE_NOT_CLAWBACK_ENABLED = -3
40541/// };
40542/// ```
40543///
40544// enum
40545#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
40546#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
40547#[cfg_attr(
40548    all(feature = "serde", feature = "alloc"),
40549    derive(serde::Serialize, serde::Deserialize),
40550    serde(rename_all = "snake_case")
40551)]
40552#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
40553#[repr(i32)]
40554pub enum ClawbackClaimableBalanceResultCode {
40555    Success = 0,
40556    DoesNotExist = -1,
40557    NotIssuer = -2,
40558    NotClawbackEnabled = -3,
40559}
40560
40561impl ClawbackClaimableBalanceResultCode {
40562    pub const VARIANTS: [ClawbackClaimableBalanceResultCode; 4] = [
40563        ClawbackClaimableBalanceResultCode::Success,
40564        ClawbackClaimableBalanceResultCode::DoesNotExist,
40565        ClawbackClaimableBalanceResultCode::NotIssuer,
40566        ClawbackClaimableBalanceResultCode::NotClawbackEnabled,
40567    ];
40568    pub const VARIANTS_STR: [&'static str; 4] =
40569        ["Success", "DoesNotExist", "NotIssuer", "NotClawbackEnabled"];
40570
40571    #[must_use]
40572    pub const fn name(&self) -> &'static str {
40573        match self {
40574            Self::Success => "Success",
40575            Self::DoesNotExist => "DoesNotExist",
40576            Self::NotIssuer => "NotIssuer",
40577            Self::NotClawbackEnabled => "NotClawbackEnabled",
40578        }
40579    }
40580
40581    #[must_use]
40582    pub const fn variants() -> [ClawbackClaimableBalanceResultCode; 4] {
40583        Self::VARIANTS
40584    }
40585}
40586
40587impl Name for ClawbackClaimableBalanceResultCode {
40588    #[must_use]
40589    fn name(&self) -> &'static str {
40590        Self::name(self)
40591    }
40592}
40593
40594impl Variants<ClawbackClaimableBalanceResultCode> for ClawbackClaimableBalanceResultCode {
40595    fn variants() -> slice::Iter<'static, ClawbackClaimableBalanceResultCode> {
40596        Self::VARIANTS.iter()
40597    }
40598}
40599
40600impl Enum for ClawbackClaimableBalanceResultCode {}
40601
40602impl fmt::Display for ClawbackClaimableBalanceResultCode {
40603    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
40604        f.write_str(self.name())
40605    }
40606}
40607
40608impl TryFrom<i32> for ClawbackClaimableBalanceResultCode {
40609    type Error = Error;
40610
40611    fn try_from(i: i32) -> Result<Self> {
40612        let e = match i {
40613            0 => ClawbackClaimableBalanceResultCode::Success,
40614            -1 => ClawbackClaimableBalanceResultCode::DoesNotExist,
40615            -2 => ClawbackClaimableBalanceResultCode::NotIssuer,
40616            -3 => ClawbackClaimableBalanceResultCode::NotClawbackEnabled,
40617            #[allow(unreachable_patterns)]
40618            _ => return Err(Error::Invalid),
40619        };
40620        Ok(e)
40621    }
40622}
40623
40624impl From<ClawbackClaimableBalanceResultCode> for i32 {
40625    #[must_use]
40626    fn from(e: ClawbackClaimableBalanceResultCode) -> Self {
40627        e as Self
40628    }
40629}
40630
40631impl ReadXdr for ClawbackClaimableBalanceResultCode {
40632    #[cfg(feature = "std")]
40633    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
40634        r.with_limited_depth(|r| {
40635            let e = i32::read_xdr(r)?;
40636            let v: Self = e.try_into()?;
40637            Ok(v)
40638        })
40639    }
40640}
40641
40642impl WriteXdr for ClawbackClaimableBalanceResultCode {
40643    #[cfg(feature = "std")]
40644    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
40645        w.with_limited_depth(|w| {
40646            let i: i32 = (*self).into();
40647            i.write_xdr(w)
40648        })
40649    }
40650}
40651
40652/// ClawbackClaimableBalanceResult is an XDR Union defines as:
40653///
40654/// ```text
40655/// union ClawbackClaimableBalanceResult switch (
40656///     ClawbackClaimableBalanceResultCode code)
40657/// {
40658/// case CLAWBACK_CLAIMABLE_BALANCE_SUCCESS:
40659///     void;
40660/// case CLAWBACK_CLAIMABLE_BALANCE_DOES_NOT_EXIST:
40661/// case CLAWBACK_CLAIMABLE_BALANCE_NOT_ISSUER:
40662/// case CLAWBACK_CLAIMABLE_BALANCE_NOT_CLAWBACK_ENABLED:
40663///     void;
40664/// };
40665/// ```
40666///
40667// union with discriminant ClawbackClaimableBalanceResultCode
40668#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
40669#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
40670#[cfg_attr(
40671    all(feature = "serde", feature = "alloc"),
40672    derive(serde::Serialize, serde::Deserialize),
40673    serde(rename_all = "snake_case")
40674)]
40675#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
40676#[allow(clippy::large_enum_variant)]
40677pub enum ClawbackClaimableBalanceResult {
40678    Success,
40679    DoesNotExist,
40680    NotIssuer,
40681    NotClawbackEnabled,
40682}
40683
40684impl ClawbackClaimableBalanceResult {
40685    pub const VARIANTS: [ClawbackClaimableBalanceResultCode; 4] = [
40686        ClawbackClaimableBalanceResultCode::Success,
40687        ClawbackClaimableBalanceResultCode::DoesNotExist,
40688        ClawbackClaimableBalanceResultCode::NotIssuer,
40689        ClawbackClaimableBalanceResultCode::NotClawbackEnabled,
40690    ];
40691    pub const VARIANTS_STR: [&'static str; 4] =
40692        ["Success", "DoesNotExist", "NotIssuer", "NotClawbackEnabled"];
40693
40694    #[must_use]
40695    pub const fn name(&self) -> &'static str {
40696        match self {
40697            Self::Success => "Success",
40698            Self::DoesNotExist => "DoesNotExist",
40699            Self::NotIssuer => "NotIssuer",
40700            Self::NotClawbackEnabled => "NotClawbackEnabled",
40701        }
40702    }
40703
40704    #[must_use]
40705    pub const fn discriminant(&self) -> ClawbackClaimableBalanceResultCode {
40706        #[allow(clippy::match_same_arms)]
40707        match self {
40708            Self::Success => ClawbackClaimableBalanceResultCode::Success,
40709            Self::DoesNotExist => ClawbackClaimableBalanceResultCode::DoesNotExist,
40710            Self::NotIssuer => ClawbackClaimableBalanceResultCode::NotIssuer,
40711            Self::NotClawbackEnabled => ClawbackClaimableBalanceResultCode::NotClawbackEnabled,
40712        }
40713    }
40714
40715    #[must_use]
40716    pub const fn variants() -> [ClawbackClaimableBalanceResultCode; 4] {
40717        Self::VARIANTS
40718    }
40719}
40720
40721impl Name for ClawbackClaimableBalanceResult {
40722    #[must_use]
40723    fn name(&self) -> &'static str {
40724        Self::name(self)
40725    }
40726}
40727
40728impl Discriminant<ClawbackClaimableBalanceResultCode> for ClawbackClaimableBalanceResult {
40729    #[must_use]
40730    fn discriminant(&self) -> ClawbackClaimableBalanceResultCode {
40731        Self::discriminant(self)
40732    }
40733}
40734
40735impl Variants<ClawbackClaimableBalanceResultCode> for ClawbackClaimableBalanceResult {
40736    fn variants() -> slice::Iter<'static, ClawbackClaimableBalanceResultCode> {
40737        Self::VARIANTS.iter()
40738    }
40739}
40740
40741impl Union<ClawbackClaimableBalanceResultCode> for ClawbackClaimableBalanceResult {}
40742
40743impl ReadXdr for ClawbackClaimableBalanceResult {
40744    #[cfg(feature = "std")]
40745    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
40746        r.with_limited_depth(|r| {
40747            let dv: ClawbackClaimableBalanceResultCode =
40748                <ClawbackClaimableBalanceResultCode as ReadXdr>::read_xdr(r)?;
40749            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
40750            let v = match dv {
40751                ClawbackClaimableBalanceResultCode::Success => Self::Success,
40752                ClawbackClaimableBalanceResultCode::DoesNotExist => Self::DoesNotExist,
40753                ClawbackClaimableBalanceResultCode::NotIssuer => Self::NotIssuer,
40754                ClawbackClaimableBalanceResultCode::NotClawbackEnabled => Self::NotClawbackEnabled,
40755                #[allow(unreachable_patterns)]
40756                _ => return Err(Error::Invalid),
40757            };
40758            Ok(v)
40759        })
40760    }
40761}
40762
40763impl WriteXdr for ClawbackClaimableBalanceResult {
40764    #[cfg(feature = "std")]
40765    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
40766        w.with_limited_depth(|w| {
40767            self.discriminant().write_xdr(w)?;
40768            #[allow(clippy::match_same_arms)]
40769            match self {
40770                Self::Success => ().write_xdr(w)?,
40771                Self::DoesNotExist => ().write_xdr(w)?,
40772                Self::NotIssuer => ().write_xdr(w)?,
40773                Self::NotClawbackEnabled => ().write_xdr(w)?,
40774            };
40775            Ok(())
40776        })
40777    }
40778}
40779
40780/// SetTrustLineFlagsResultCode is an XDR Enum defines as:
40781///
40782/// ```text
40783/// enum SetTrustLineFlagsResultCode
40784/// {
40785///     // codes considered as "success" for the operation
40786///     SET_TRUST_LINE_FLAGS_SUCCESS = 0,
40787///
40788///     // codes considered as "failure" for the operation
40789///     SET_TRUST_LINE_FLAGS_MALFORMED = -1,
40790///     SET_TRUST_LINE_FLAGS_NO_TRUST_LINE = -2,
40791///     SET_TRUST_LINE_FLAGS_CANT_REVOKE = -3,
40792///     SET_TRUST_LINE_FLAGS_INVALID_STATE = -4,
40793///     SET_TRUST_LINE_FLAGS_LOW_RESERVE = -5 // claimable balances can't be created
40794///                                           // on revoke due to low reserves
40795/// };
40796/// ```
40797///
40798// enum
40799#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
40800#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
40801#[cfg_attr(
40802    all(feature = "serde", feature = "alloc"),
40803    derive(serde::Serialize, serde::Deserialize),
40804    serde(rename_all = "snake_case")
40805)]
40806#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
40807#[repr(i32)]
40808pub enum SetTrustLineFlagsResultCode {
40809    Success = 0,
40810    Malformed = -1,
40811    NoTrustLine = -2,
40812    CantRevoke = -3,
40813    InvalidState = -4,
40814    LowReserve = -5,
40815}
40816
40817impl SetTrustLineFlagsResultCode {
40818    pub const VARIANTS: [SetTrustLineFlagsResultCode; 6] = [
40819        SetTrustLineFlagsResultCode::Success,
40820        SetTrustLineFlagsResultCode::Malformed,
40821        SetTrustLineFlagsResultCode::NoTrustLine,
40822        SetTrustLineFlagsResultCode::CantRevoke,
40823        SetTrustLineFlagsResultCode::InvalidState,
40824        SetTrustLineFlagsResultCode::LowReserve,
40825    ];
40826    pub const VARIANTS_STR: [&'static str; 6] = [
40827        "Success",
40828        "Malformed",
40829        "NoTrustLine",
40830        "CantRevoke",
40831        "InvalidState",
40832        "LowReserve",
40833    ];
40834
40835    #[must_use]
40836    pub const fn name(&self) -> &'static str {
40837        match self {
40838            Self::Success => "Success",
40839            Self::Malformed => "Malformed",
40840            Self::NoTrustLine => "NoTrustLine",
40841            Self::CantRevoke => "CantRevoke",
40842            Self::InvalidState => "InvalidState",
40843            Self::LowReserve => "LowReserve",
40844        }
40845    }
40846
40847    #[must_use]
40848    pub const fn variants() -> [SetTrustLineFlagsResultCode; 6] {
40849        Self::VARIANTS
40850    }
40851}
40852
40853impl Name for SetTrustLineFlagsResultCode {
40854    #[must_use]
40855    fn name(&self) -> &'static str {
40856        Self::name(self)
40857    }
40858}
40859
40860impl Variants<SetTrustLineFlagsResultCode> for SetTrustLineFlagsResultCode {
40861    fn variants() -> slice::Iter<'static, SetTrustLineFlagsResultCode> {
40862        Self::VARIANTS.iter()
40863    }
40864}
40865
40866impl Enum for SetTrustLineFlagsResultCode {}
40867
40868impl fmt::Display for SetTrustLineFlagsResultCode {
40869    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
40870        f.write_str(self.name())
40871    }
40872}
40873
40874impl TryFrom<i32> for SetTrustLineFlagsResultCode {
40875    type Error = Error;
40876
40877    fn try_from(i: i32) -> Result<Self> {
40878        let e = match i {
40879            0 => SetTrustLineFlagsResultCode::Success,
40880            -1 => SetTrustLineFlagsResultCode::Malformed,
40881            -2 => SetTrustLineFlagsResultCode::NoTrustLine,
40882            -3 => SetTrustLineFlagsResultCode::CantRevoke,
40883            -4 => SetTrustLineFlagsResultCode::InvalidState,
40884            -5 => SetTrustLineFlagsResultCode::LowReserve,
40885            #[allow(unreachable_patterns)]
40886            _ => return Err(Error::Invalid),
40887        };
40888        Ok(e)
40889    }
40890}
40891
40892impl From<SetTrustLineFlagsResultCode> for i32 {
40893    #[must_use]
40894    fn from(e: SetTrustLineFlagsResultCode) -> Self {
40895        e as Self
40896    }
40897}
40898
40899impl ReadXdr for SetTrustLineFlagsResultCode {
40900    #[cfg(feature = "std")]
40901    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
40902        r.with_limited_depth(|r| {
40903            let e = i32::read_xdr(r)?;
40904            let v: Self = e.try_into()?;
40905            Ok(v)
40906        })
40907    }
40908}
40909
40910impl WriteXdr for SetTrustLineFlagsResultCode {
40911    #[cfg(feature = "std")]
40912    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
40913        w.with_limited_depth(|w| {
40914            let i: i32 = (*self).into();
40915            i.write_xdr(w)
40916        })
40917    }
40918}
40919
40920/// SetTrustLineFlagsResult is an XDR Union defines as:
40921///
40922/// ```text
40923/// union SetTrustLineFlagsResult switch (SetTrustLineFlagsResultCode code)
40924/// {
40925/// case SET_TRUST_LINE_FLAGS_SUCCESS:
40926///     void;
40927/// case SET_TRUST_LINE_FLAGS_MALFORMED:
40928/// case SET_TRUST_LINE_FLAGS_NO_TRUST_LINE:
40929/// case SET_TRUST_LINE_FLAGS_CANT_REVOKE:
40930/// case SET_TRUST_LINE_FLAGS_INVALID_STATE:
40931/// case SET_TRUST_LINE_FLAGS_LOW_RESERVE:
40932///     void;
40933/// };
40934/// ```
40935///
40936// union with discriminant SetTrustLineFlagsResultCode
40937#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
40938#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
40939#[cfg_attr(
40940    all(feature = "serde", feature = "alloc"),
40941    derive(serde::Serialize, serde::Deserialize),
40942    serde(rename_all = "snake_case")
40943)]
40944#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
40945#[allow(clippy::large_enum_variant)]
40946pub enum SetTrustLineFlagsResult {
40947    Success,
40948    Malformed,
40949    NoTrustLine,
40950    CantRevoke,
40951    InvalidState,
40952    LowReserve,
40953}
40954
40955impl SetTrustLineFlagsResult {
40956    pub const VARIANTS: [SetTrustLineFlagsResultCode; 6] = [
40957        SetTrustLineFlagsResultCode::Success,
40958        SetTrustLineFlagsResultCode::Malformed,
40959        SetTrustLineFlagsResultCode::NoTrustLine,
40960        SetTrustLineFlagsResultCode::CantRevoke,
40961        SetTrustLineFlagsResultCode::InvalidState,
40962        SetTrustLineFlagsResultCode::LowReserve,
40963    ];
40964    pub const VARIANTS_STR: [&'static str; 6] = [
40965        "Success",
40966        "Malformed",
40967        "NoTrustLine",
40968        "CantRevoke",
40969        "InvalidState",
40970        "LowReserve",
40971    ];
40972
40973    #[must_use]
40974    pub const fn name(&self) -> &'static str {
40975        match self {
40976            Self::Success => "Success",
40977            Self::Malformed => "Malformed",
40978            Self::NoTrustLine => "NoTrustLine",
40979            Self::CantRevoke => "CantRevoke",
40980            Self::InvalidState => "InvalidState",
40981            Self::LowReserve => "LowReserve",
40982        }
40983    }
40984
40985    #[must_use]
40986    pub const fn discriminant(&self) -> SetTrustLineFlagsResultCode {
40987        #[allow(clippy::match_same_arms)]
40988        match self {
40989            Self::Success => SetTrustLineFlagsResultCode::Success,
40990            Self::Malformed => SetTrustLineFlagsResultCode::Malformed,
40991            Self::NoTrustLine => SetTrustLineFlagsResultCode::NoTrustLine,
40992            Self::CantRevoke => SetTrustLineFlagsResultCode::CantRevoke,
40993            Self::InvalidState => SetTrustLineFlagsResultCode::InvalidState,
40994            Self::LowReserve => SetTrustLineFlagsResultCode::LowReserve,
40995        }
40996    }
40997
40998    #[must_use]
40999    pub const fn variants() -> [SetTrustLineFlagsResultCode; 6] {
41000        Self::VARIANTS
41001    }
41002}
41003
41004impl Name for SetTrustLineFlagsResult {
41005    #[must_use]
41006    fn name(&self) -> &'static str {
41007        Self::name(self)
41008    }
41009}
41010
41011impl Discriminant<SetTrustLineFlagsResultCode> for SetTrustLineFlagsResult {
41012    #[must_use]
41013    fn discriminant(&self) -> SetTrustLineFlagsResultCode {
41014        Self::discriminant(self)
41015    }
41016}
41017
41018impl Variants<SetTrustLineFlagsResultCode> for SetTrustLineFlagsResult {
41019    fn variants() -> slice::Iter<'static, SetTrustLineFlagsResultCode> {
41020        Self::VARIANTS.iter()
41021    }
41022}
41023
41024impl Union<SetTrustLineFlagsResultCode> for SetTrustLineFlagsResult {}
41025
41026impl ReadXdr for SetTrustLineFlagsResult {
41027    #[cfg(feature = "std")]
41028    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
41029        r.with_limited_depth(|r| {
41030            let dv: SetTrustLineFlagsResultCode =
41031                <SetTrustLineFlagsResultCode as ReadXdr>::read_xdr(r)?;
41032            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
41033            let v = match dv {
41034                SetTrustLineFlagsResultCode::Success => Self::Success,
41035                SetTrustLineFlagsResultCode::Malformed => Self::Malformed,
41036                SetTrustLineFlagsResultCode::NoTrustLine => Self::NoTrustLine,
41037                SetTrustLineFlagsResultCode::CantRevoke => Self::CantRevoke,
41038                SetTrustLineFlagsResultCode::InvalidState => Self::InvalidState,
41039                SetTrustLineFlagsResultCode::LowReserve => Self::LowReserve,
41040                #[allow(unreachable_patterns)]
41041                _ => return Err(Error::Invalid),
41042            };
41043            Ok(v)
41044        })
41045    }
41046}
41047
41048impl WriteXdr for SetTrustLineFlagsResult {
41049    #[cfg(feature = "std")]
41050    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
41051        w.with_limited_depth(|w| {
41052            self.discriminant().write_xdr(w)?;
41053            #[allow(clippy::match_same_arms)]
41054            match self {
41055                Self::Success => ().write_xdr(w)?,
41056                Self::Malformed => ().write_xdr(w)?,
41057                Self::NoTrustLine => ().write_xdr(w)?,
41058                Self::CantRevoke => ().write_xdr(w)?,
41059                Self::InvalidState => ().write_xdr(w)?,
41060                Self::LowReserve => ().write_xdr(w)?,
41061            };
41062            Ok(())
41063        })
41064    }
41065}
41066
41067/// LiquidityPoolDepositResultCode is an XDR Enum defines as:
41068///
41069/// ```text
41070/// enum LiquidityPoolDepositResultCode
41071/// {
41072///     // codes considered as "success" for the operation
41073///     LIQUIDITY_POOL_DEPOSIT_SUCCESS = 0,
41074///
41075///     // codes considered as "failure" for the operation
41076///     LIQUIDITY_POOL_DEPOSIT_MALFORMED = -1,      // bad input
41077///     LIQUIDITY_POOL_DEPOSIT_NO_TRUST = -2,       // no trust line for one of the
41078///                                                 // assets
41079///     LIQUIDITY_POOL_DEPOSIT_NOT_AUTHORIZED = -3, // not authorized for one of the
41080///                                                 // assets
41081///     LIQUIDITY_POOL_DEPOSIT_UNDERFUNDED = -4,    // not enough balance for one of
41082///                                                 // the assets
41083///     LIQUIDITY_POOL_DEPOSIT_LINE_FULL = -5,      // pool share trust line doesn't
41084///                                                 // have sufficient limit
41085///     LIQUIDITY_POOL_DEPOSIT_BAD_PRICE = -6,      // deposit price outside bounds
41086///     LIQUIDITY_POOL_DEPOSIT_POOL_FULL = -7       // pool reserves are full
41087/// };
41088/// ```
41089///
41090// enum
41091#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
41092#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
41093#[cfg_attr(
41094    all(feature = "serde", feature = "alloc"),
41095    derive(serde::Serialize, serde::Deserialize),
41096    serde(rename_all = "snake_case")
41097)]
41098#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
41099#[repr(i32)]
41100pub enum LiquidityPoolDepositResultCode {
41101    Success = 0,
41102    Malformed = -1,
41103    NoTrust = -2,
41104    NotAuthorized = -3,
41105    Underfunded = -4,
41106    LineFull = -5,
41107    BadPrice = -6,
41108    PoolFull = -7,
41109}
41110
41111impl LiquidityPoolDepositResultCode {
41112    pub const VARIANTS: [LiquidityPoolDepositResultCode; 8] = [
41113        LiquidityPoolDepositResultCode::Success,
41114        LiquidityPoolDepositResultCode::Malformed,
41115        LiquidityPoolDepositResultCode::NoTrust,
41116        LiquidityPoolDepositResultCode::NotAuthorized,
41117        LiquidityPoolDepositResultCode::Underfunded,
41118        LiquidityPoolDepositResultCode::LineFull,
41119        LiquidityPoolDepositResultCode::BadPrice,
41120        LiquidityPoolDepositResultCode::PoolFull,
41121    ];
41122    pub const VARIANTS_STR: [&'static str; 8] = [
41123        "Success",
41124        "Malformed",
41125        "NoTrust",
41126        "NotAuthorized",
41127        "Underfunded",
41128        "LineFull",
41129        "BadPrice",
41130        "PoolFull",
41131    ];
41132
41133    #[must_use]
41134    pub const fn name(&self) -> &'static str {
41135        match self {
41136            Self::Success => "Success",
41137            Self::Malformed => "Malformed",
41138            Self::NoTrust => "NoTrust",
41139            Self::NotAuthorized => "NotAuthorized",
41140            Self::Underfunded => "Underfunded",
41141            Self::LineFull => "LineFull",
41142            Self::BadPrice => "BadPrice",
41143            Self::PoolFull => "PoolFull",
41144        }
41145    }
41146
41147    #[must_use]
41148    pub const fn variants() -> [LiquidityPoolDepositResultCode; 8] {
41149        Self::VARIANTS
41150    }
41151}
41152
41153impl Name for LiquidityPoolDepositResultCode {
41154    #[must_use]
41155    fn name(&self) -> &'static str {
41156        Self::name(self)
41157    }
41158}
41159
41160impl Variants<LiquidityPoolDepositResultCode> for LiquidityPoolDepositResultCode {
41161    fn variants() -> slice::Iter<'static, LiquidityPoolDepositResultCode> {
41162        Self::VARIANTS.iter()
41163    }
41164}
41165
41166impl Enum for LiquidityPoolDepositResultCode {}
41167
41168impl fmt::Display for LiquidityPoolDepositResultCode {
41169    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
41170        f.write_str(self.name())
41171    }
41172}
41173
41174impl TryFrom<i32> for LiquidityPoolDepositResultCode {
41175    type Error = Error;
41176
41177    fn try_from(i: i32) -> Result<Self> {
41178        let e = match i {
41179            0 => LiquidityPoolDepositResultCode::Success,
41180            -1 => LiquidityPoolDepositResultCode::Malformed,
41181            -2 => LiquidityPoolDepositResultCode::NoTrust,
41182            -3 => LiquidityPoolDepositResultCode::NotAuthorized,
41183            -4 => LiquidityPoolDepositResultCode::Underfunded,
41184            -5 => LiquidityPoolDepositResultCode::LineFull,
41185            -6 => LiquidityPoolDepositResultCode::BadPrice,
41186            -7 => LiquidityPoolDepositResultCode::PoolFull,
41187            #[allow(unreachable_patterns)]
41188            _ => return Err(Error::Invalid),
41189        };
41190        Ok(e)
41191    }
41192}
41193
41194impl From<LiquidityPoolDepositResultCode> for i32 {
41195    #[must_use]
41196    fn from(e: LiquidityPoolDepositResultCode) -> Self {
41197        e as Self
41198    }
41199}
41200
41201impl ReadXdr for LiquidityPoolDepositResultCode {
41202    #[cfg(feature = "std")]
41203    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
41204        r.with_limited_depth(|r| {
41205            let e = i32::read_xdr(r)?;
41206            let v: Self = e.try_into()?;
41207            Ok(v)
41208        })
41209    }
41210}
41211
41212impl WriteXdr for LiquidityPoolDepositResultCode {
41213    #[cfg(feature = "std")]
41214    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
41215        w.with_limited_depth(|w| {
41216            let i: i32 = (*self).into();
41217            i.write_xdr(w)
41218        })
41219    }
41220}
41221
41222/// LiquidityPoolDepositResult is an XDR Union defines as:
41223///
41224/// ```text
41225/// union LiquidityPoolDepositResult switch (LiquidityPoolDepositResultCode code)
41226/// {
41227/// case LIQUIDITY_POOL_DEPOSIT_SUCCESS:
41228///     void;
41229/// case LIQUIDITY_POOL_DEPOSIT_MALFORMED:
41230/// case LIQUIDITY_POOL_DEPOSIT_NO_TRUST:
41231/// case LIQUIDITY_POOL_DEPOSIT_NOT_AUTHORIZED:
41232/// case LIQUIDITY_POOL_DEPOSIT_UNDERFUNDED:
41233/// case LIQUIDITY_POOL_DEPOSIT_LINE_FULL:
41234/// case LIQUIDITY_POOL_DEPOSIT_BAD_PRICE:
41235/// case LIQUIDITY_POOL_DEPOSIT_POOL_FULL:
41236///     void;
41237/// };
41238/// ```
41239///
41240// union with discriminant LiquidityPoolDepositResultCode
41241#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
41242#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
41243#[cfg_attr(
41244    all(feature = "serde", feature = "alloc"),
41245    derive(serde::Serialize, serde::Deserialize),
41246    serde(rename_all = "snake_case")
41247)]
41248#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
41249#[allow(clippy::large_enum_variant)]
41250pub enum LiquidityPoolDepositResult {
41251    Success,
41252    Malformed,
41253    NoTrust,
41254    NotAuthorized,
41255    Underfunded,
41256    LineFull,
41257    BadPrice,
41258    PoolFull,
41259}
41260
41261impl LiquidityPoolDepositResult {
41262    pub const VARIANTS: [LiquidityPoolDepositResultCode; 8] = [
41263        LiquidityPoolDepositResultCode::Success,
41264        LiquidityPoolDepositResultCode::Malformed,
41265        LiquidityPoolDepositResultCode::NoTrust,
41266        LiquidityPoolDepositResultCode::NotAuthorized,
41267        LiquidityPoolDepositResultCode::Underfunded,
41268        LiquidityPoolDepositResultCode::LineFull,
41269        LiquidityPoolDepositResultCode::BadPrice,
41270        LiquidityPoolDepositResultCode::PoolFull,
41271    ];
41272    pub const VARIANTS_STR: [&'static str; 8] = [
41273        "Success",
41274        "Malformed",
41275        "NoTrust",
41276        "NotAuthorized",
41277        "Underfunded",
41278        "LineFull",
41279        "BadPrice",
41280        "PoolFull",
41281    ];
41282
41283    #[must_use]
41284    pub const fn name(&self) -> &'static str {
41285        match self {
41286            Self::Success => "Success",
41287            Self::Malformed => "Malformed",
41288            Self::NoTrust => "NoTrust",
41289            Self::NotAuthorized => "NotAuthorized",
41290            Self::Underfunded => "Underfunded",
41291            Self::LineFull => "LineFull",
41292            Self::BadPrice => "BadPrice",
41293            Self::PoolFull => "PoolFull",
41294        }
41295    }
41296
41297    #[must_use]
41298    pub const fn discriminant(&self) -> LiquidityPoolDepositResultCode {
41299        #[allow(clippy::match_same_arms)]
41300        match self {
41301            Self::Success => LiquidityPoolDepositResultCode::Success,
41302            Self::Malformed => LiquidityPoolDepositResultCode::Malformed,
41303            Self::NoTrust => LiquidityPoolDepositResultCode::NoTrust,
41304            Self::NotAuthorized => LiquidityPoolDepositResultCode::NotAuthorized,
41305            Self::Underfunded => LiquidityPoolDepositResultCode::Underfunded,
41306            Self::LineFull => LiquidityPoolDepositResultCode::LineFull,
41307            Self::BadPrice => LiquidityPoolDepositResultCode::BadPrice,
41308            Self::PoolFull => LiquidityPoolDepositResultCode::PoolFull,
41309        }
41310    }
41311
41312    #[must_use]
41313    pub const fn variants() -> [LiquidityPoolDepositResultCode; 8] {
41314        Self::VARIANTS
41315    }
41316}
41317
41318impl Name for LiquidityPoolDepositResult {
41319    #[must_use]
41320    fn name(&self) -> &'static str {
41321        Self::name(self)
41322    }
41323}
41324
41325impl Discriminant<LiquidityPoolDepositResultCode> for LiquidityPoolDepositResult {
41326    #[must_use]
41327    fn discriminant(&self) -> LiquidityPoolDepositResultCode {
41328        Self::discriminant(self)
41329    }
41330}
41331
41332impl Variants<LiquidityPoolDepositResultCode> for LiquidityPoolDepositResult {
41333    fn variants() -> slice::Iter<'static, LiquidityPoolDepositResultCode> {
41334        Self::VARIANTS.iter()
41335    }
41336}
41337
41338impl Union<LiquidityPoolDepositResultCode> for LiquidityPoolDepositResult {}
41339
41340impl ReadXdr for LiquidityPoolDepositResult {
41341    #[cfg(feature = "std")]
41342    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
41343        r.with_limited_depth(|r| {
41344            let dv: LiquidityPoolDepositResultCode =
41345                <LiquidityPoolDepositResultCode as ReadXdr>::read_xdr(r)?;
41346            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
41347            let v = match dv {
41348                LiquidityPoolDepositResultCode::Success => Self::Success,
41349                LiquidityPoolDepositResultCode::Malformed => Self::Malformed,
41350                LiquidityPoolDepositResultCode::NoTrust => Self::NoTrust,
41351                LiquidityPoolDepositResultCode::NotAuthorized => Self::NotAuthorized,
41352                LiquidityPoolDepositResultCode::Underfunded => Self::Underfunded,
41353                LiquidityPoolDepositResultCode::LineFull => Self::LineFull,
41354                LiquidityPoolDepositResultCode::BadPrice => Self::BadPrice,
41355                LiquidityPoolDepositResultCode::PoolFull => Self::PoolFull,
41356                #[allow(unreachable_patterns)]
41357                _ => return Err(Error::Invalid),
41358            };
41359            Ok(v)
41360        })
41361    }
41362}
41363
41364impl WriteXdr for LiquidityPoolDepositResult {
41365    #[cfg(feature = "std")]
41366    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
41367        w.with_limited_depth(|w| {
41368            self.discriminant().write_xdr(w)?;
41369            #[allow(clippy::match_same_arms)]
41370            match self {
41371                Self::Success => ().write_xdr(w)?,
41372                Self::Malformed => ().write_xdr(w)?,
41373                Self::NoTrust => ().write_xdr(w)?,
41374                Self::NotAuthorized => ().write_xdr(w)?,
41375                Self::Underfunded => ().write_xdr(w)?,
41376                Self::LineFull => ().write_xdr(w)?,
41377                Self::BadPrice => ().write_xdr(w)?,
41378                Self::PoolFull => ().write_xdr(w)?,
41379            };
41380            Ok(())
41381        })
41382    }
41383}
41384
41385/// LiquidityPoolWithdrawResultCode is an XDR Enum defines as:
41386///
41387/// ```text
41388/// enum LiquidityPoolWithdrawResultCode
41389/// {
41390///     // codes considered as "success" for the operation
41391///     LIQUIDITY_POOL_WITHDRAW_SUCCESS = 0,
41392///
41393///     // codes considered as "failure" for the operation
41394///     LIQUIDITY_POOL_WITHDRAW_MALFORMED = -1,    // bad input
41395///     LIQUIDITY_POOL_WITHDRAW_NO_TRUST = -2,     // no trust line for one of the
41396///                                                // assets
41397///     LIQUIDITY_POOL_WITHDRAW_UNDERFUNDED = -3,  // not enough balance of the
41398///                                                // pool share
41399///     LIQUIDITY_POOL_WITHDRAW_LINE_FULL = -4,    // would go above limit for one
41400///                                                // of the assets
41401///     LIQUIDITY_POOL_WITHDRAW_UNDER_MINIMUM = -5 // didn't withdraw enough
41402/// };
41403/// ```
41404///
41405// enum
41406#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
41407#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
41408#[cfg_attr(
41409    all(feature = "serde", feature = "alloc"),
41410    derive(serde::Serialize, serde::Deserialize),
41411    serde(rename_all = "snake_case")
41412)]
41413#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
41414#[repr(i32)]
41415pub enum LiquidityPoolWithdrawResultCode {
41416    Success = 0,
41417    Malformed = -1,
41418    NoTrust = -2,
41419    Underfunded = -3,
41420    LineFull = -4,
41421    UnderMinimum = -5,
41422}
41423
41424impl LiquidityPoolWithdrawResultCode {
41425    pub const VARIANTS: [LiquidityPoolWithdrawResultCode; 6] = [
41426        LiquidityPoolWithdrawResultCode::Success,
41427        LiquidityPoolWithdrawResultCode::Malformed,
41428        LiquidityPoolWithdrawResultCode::NoTrust,
41429        LiquidityPoolWithdrawResultCode::Underfunded,
41430        LiquidityPoolWithdrawResultCode::LineFull,
41431        LiquidityPoolWithdrawResultCode::UnderMinimum,
41432    ];
41433    pub const VARIANTS_STR: [&'static str; 6] = [
41434        "Success",
41435        "Malformed",
41436        "NoTrust",
41437        "Underfunded",
41438        "LineFull",
41439        "UnderMinimum",
41440    ];
41441
41442    #[must_use]
41443    pub const fn name(&self) -> &'static str {
41444        match self {
41445            Self::Success => "Success",
41446            Self::Malformed => "Malformed",
41447            Self::NoTrust => "NoTrust",
41448            Self::Underfunded => "Underfunded",
41449            Self::LineFull => "LineFull",
41450            Self::UnderMinimum => "UnderMinimum",
41451        }
41452    }
41453
41454    #[must_use]
41455    pub const fn variants() -> [LiquidityPoolWithdrawResultCode; 6] {
41456        Self::VARIANTS
41457    }
41458}
41459
41460impl Name for LiquidityPoolWithdrawResultCode {
41461    #[must_use]
41462    fn name(&self) -> &'static str {
41463        Self::name(self)
41464    }
41465}
41466
41467impl Variants<LiquidityPoolWithdrawResultCode> for LiquidityPoolWithdrawResultCode {
41468    fn variants() -> slice::Iter<'static, LiquidityPoolWithdrawResultCode> {
41469        Self::VARIANTS.iter()
41470    }
41471}
41472
41473impl Enum for LiquidityPoolWithdrawResultCode {}
41474
41475impl fmt::Display for LiquidityPoolWithdrawResultCode {
41476    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
41477        f.write_str(self.name())
41478    }
41479}
41480
41481impl TryFrom<i32> for LiquidityPoolWithdrawResultCode {
41482    type Error = Error;
41483
41484    fn try_from(i: i32) -> Result<Self> {
41485        let e = match i {
41486            0 => LiquidityPoolWithdrawResultCode::Success,
41487            -1 => LiquidityPoolWithdrawResultCode::Malformed,
41488            -2 => LiquidityPoolWithdrawResultCode::NoTrust,
41489            -3 => LiquidityPoolWithdrawResultCode::Underfunded,
41490            -4 => LiquidityPoolWithdrawResultCode::LineFull,
41491            -5 => LiquidityPoolWithdrawResultCode::UnderMinimum,
41492            #[allow(unreachable_patterns)]
41493            _ => return Err(Error::Invalid),
41494        };
41495        Ok(e)
41496    }
41497}
41498
41499impl From<LiquidityPoolWithdrawResultCode> for i32 {
41500    #[must_use]
41501    fn from(e: LiquidityPoolWithdrawResultCode) -> Self {
41502        e as Self
41503    }
41504}
41505
41506impl ReadXdr for LiquidityPoolWithdrawResultCode {
41507    #[cfg(feature = "std")]
41508    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
41509        r.with_limited_depth(|r| {
41510            let e = i32::read_xdr(r)?;
41511            let v: Self = e.try_into()?;
41512            Ok(v)
41513        })
41514    }
41515}
41516
41517impl WriteXdr for LiquidityPoolWithdrawResultCode {
41518    #[cfg(feature = "std")]
41519    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
41520        w.with_limited_depth(|w| {
41521            let i: i32 = (*self).into();
41522            i.write_xdr(w)
41523        })
41524    }
41525}
41526
41527/// LiquidityPoolWithdrawResult is an XDR Union defines as:
41528///
41529/// ```text
41530/// union LiquidityPoolWithdrawResult switch (LiquidityPoolWithdrawResultCode code)
41531/// {
41532/// case LIQUIDITY_POOL_WITHDRAW_SUCCESS:
41533///     void;
41534/// case LIQUIDITY_POOL_WITHDRAW_MALFORMED:
41535/// case LIQUIDITY_POOL_WITHDRAW_NO_TRUST:
41536/// case LIQUIDITY_POOL_WITHDRAW_UNDERFUNDED:
41537/// case LIQUIDITY_POOL_WITHDRAW_LINE_FULL:
41538/// case LIQUIDITY_POOL_WITHDRAW_UNDER_MINIMUM:
41539///     void;
41540/// };
41541/// ```
41542///
41543// union with discriminant LiquidityPoolWithdrawResultCode
41544#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
41545#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
41546#[cfg_attr(
41547    all(feature = "serde", feature = "alloc"),
41548    derive(serde::Serialize, serde::Deserialize),
41549    serde(rename_all = "snake_case")
41550)]
41551#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
41552#[allow(clippy::large_enum_variant)]
41553pub enum LiquidityPoolWithdrawResult {
41554    Success,
41555    Malformed,
41556    NoTrust,
41557    Underfunded,
41558    LineFull,
41559    UnderMinimum,
41560}
41561
41562impl LiquidityPoolWithdrawResult {
41563    pub const VARIANTS: [LiquidityPoolWithdrawResultCode; 6] = [
41564        LiquidityPoolWithdrawResultCode::Success,
41565        LiquidityPoolWithdrawResultCode::Malformed,
41566        LiquidityPoolWithdrawResultCode::NoTrust,
41567        LiquidityPoolWithdrawResultCode::Underfunded,
41568        LiquidityPoolWithdrawResultCode::LineFull,
41569        LiquidityPoolWithdrawResultCode::UnderMinimum,
41570    ];
41571    pub const VARIANTS_STR: [&'static str; 6] = [
41572        "Success",
41573        "Malformed",
41574        "NoTrust",
41575        "Underfunded",
41576        "LineFull",
41577        "UnderMinimum",
41578    ];
41579
41580    #[must_use]
41581    pub const fn name(&self) -> &'static str {
41582        match self {
41583            Self::Success => "Success",
41584            Self::Malformed => "Malformed",
41585            Self::NoTrust => "NoTrust",
41586            Self::Underfunded => "Underfunded",
41587            Self::LineFull => "LineFull",
41588            Self::UnderMinimum => "UnderMinimum",
41589        }
41590    }
41591
41592    #[must_use]
41593    pub const fn discriminant(&self) -> LiquidityPoolWithdrawResultCode {
41594        #[allow(clippy::match_same_arms)]
41595        match self {
41596            Self::Success => LiquidityPoolWithdrawResultCode::Success,
41597            Self::Malformed => LiquidityPoolWithdrawResultCode::Malformed,
41598            Self::NoTrust => LiquidityPoolWithdrawResultCode::NoTrust,
41599            Self::Underfunded => LiquidityPoolWithdrawResultCode::Underfunded,
41600            Self::LineFull => LiquidityPoolWithdrawResultCode::LineFull,
41601            Self::UnderMinimum => LiquidityPoolWithdrawResultCode::UnderMinimum,
41602        }
41603    }
41604
41605    #[must_use]
41606    pub const fn variants() -> [LiquidityPoolWithdrawResultCode; 6] {
41607        Self::VARIANTS
41608    }
41609}
41610
41611impl Name for LiquidityPoolWithdrawResult {
41612    #[must_use]
41613    fn name(&self) -> &'static str {
41614        Self::name(self)
41615    }
41616}
41617
41618impl Discriminant<LiquidityPoolWithdrawResultCode> for LiquidityPoolWithdrawResult {
41619    #[must_use]
41620    fn discriminant(&self) -> LiquidityPoolWithdrawResultCode {
41621        Self::discriminant(self)
41622    }
41623}
41624
41625impl Variants<LiquidityPoolWithdrawResultCode> for LiquidityPoolWithdrawResult {
41626    fn variants() -> slice::Iter<'static, LiquidityPoolWithdrawResultCode> {
41627        Self::VARIANTS.iter()
41628    }
41629}
41630
41631impl Union<LiquidityPoolWithdrawResultCode> for LiquidityPoolWithdrawResult {}
41632
41633impl ReadXdr for LiquidityPoolWithdrawResult {
41634    #[cfg(feature = "std")]
41635    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
41636        r.with_limited_depth(|r| {
41637            let dv: LiquidityPoolWithdrawResultCode =
41638                <LiquidityPoolWithdrawResultCode as ReadXdr>::read_xdr(r)?;
41639            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
41640            let v = match dv {
41641                LiquidityPoolWithdrawResultCode::Success => Self::Success,
41642                LiquidityPoolWithdrawResultCode::Malformed => Self::Malformed,
41643                LiquidityPoolWithdrawResultCode::NoTrust => Self::NoTrust,
41644                LiquidityPoolWithdrawResultCode::Underfunded => Self::Underfunded,
41645                LiquidityPoolWithdrawResultCode::LineFull => Self::LineFull,
41646                LiquidityPoolWithdrawResultCode::UnderMinimum => Self::UnderMinimum,
41647                #[allow(unreachable_patterns)]
41648                _ => return Err(Error::Invalid),
41649            };
41650            Ok(v)
41651        })
41652    }
41653}
41654
41655impl WriteXdr for LiquidityPoolWithdrawResult {
41656    #[cfg(feature = "std")]
41657    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
41658        w.with_limited_depth(|w| {
41659            self.discriminant().write_xdr(w)?;
41660            #[allow(clippy::match_same_arms)]
41661            match self {
41662                Self::Success => ().write_xdr(w)?,
41663                Self::Malformed => ().write_xdr(w)?,
41664                Self::NoTrust => ().write_xdr(w)?,
41665                Self::Underfunded => ().write_xdr(w)?,
41666                Self::LineFull => ().write_xdr(w)?,
41667                Self::UnderMinimum => ().write_xdr(w)?,
41668            };
41669            Ok(())
41670        })
41671    }
41672}
41673
41674/// InvokeHostFunctionResultCode is an XDR Enum defines as:
41675///
41676/// ```text
41677/// enum InvokeHostFunctionResultCode
41678/// {
41679///     // codes considered as "success" for the operation
41680///     INVOKE_HOST_FUNCTION_SUCCESS = 0,
41681///
41682///     // codes considered as "failure" for the operation
41683///     INVOKE_HOST_FUNCTION_MALFORMED = -1,
41684///     INVOKE_HOST_FUNCTION_TRAPPED = -2,
41685///     INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED = -3,
41686///     INVOKE_HOST_FUNCTION_ENTRY_ARCHIVED = -4,
41687///     INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE = -5
41688/// };
41689/// ```
41690///
41691// enum
41692#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
41693#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
41694#[cfg_attr(
41695    all(feature = "serde", feature = "alloc"),
41696    derive(serde::Serialize, serde::Deserialize),
41697    serde(rename_all = "snake_case")
41698)]
41699#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
41700#[repr(i32)]
41701pub enum InvokeHostFunctionResultCode {
41702    Success = 0,
41703    Malformed = -1,
41704    Trapped = -2,
41705    ResourceLimitExceeded = -3,
41706    EntryArchived = -4,
41707    InsufficientRefundableFee = -5,
41708}
41709
41710impl InvokeHostFunctionResultCode {
41711    pub const VARIANTS: [InvokeHostFunctionResultCode; 6] = [
41712        InvokeHostFunctionResultCode::Success,
41713        InvokeHostFunctionResultCode::Malformed,
41714        InvokeHostFunctionResultCode::Trapped,
41715        InvokeHostFunctionResultCode::ResourceLimitExceeded,
41716        InvokeHostFunctionResultCode::EntryArchived,
41717        InvokeHostFunctionResultCode::InsufficientRefundableFee,
41718    ];
41719    pub const VARIANTS_STR: [&'static str; 6] = [
41720        "Success",
41721        "Malformed",
41722        "Trapped",
41723        "ResourceLimitExceeded",
41724        "EntryArchived",
41725        "InsufficientRefundableFee",
41726    ];
41727
41728    #[must_use]
41729    pub const fn name(&self) -> &'static str {
41730        match self {
41731            Self::Success => "Success",
41732            Self::Malformed => "Malformed",
41733            Self::Trapped => "Trapped",
41734            Self::ResourceLimitExceeded => "ResourceLimitExceeded",
41735            Self::EntryArchived => "EntryArchived",
41736            Self::InsufficientRefundableFee => "InsufficientRefundableFee",
41737        }
41738    }
41739
41740    #[must_use]
41741    pub const fn variants() -> [InvokeHostFunctionResultCode; 6] {
41742        Self::VARIANTS
41743    }
41744}
41745
41746impl Name for InvokeHostFunctionResultCode {
41747    #[must_use]
41748    fn name(&self) -> &'static str {
41749        Self::name(self)
41750    }
41751}
41752
41753impl Variants<InvokeHostFunctionResultCode> for InvokeHostFunctionResultCode {
41754    fn variants() -> slice::Iter<'static, InvokeHostFunctionResultCode> {
41755        Self::VARIANTS.iter()
41756    }
41757}
41758
41759impl Enum for InvokeHostFunctionResultCode {}
41760
41761impl fmt::Display for InvokeHostFunctionResultCode {
41762    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
41763        f.write_str(self.name())
41764    }
41765}
41766
41767impl TryFrom<i32> for InvokeHostFunctionResultCode {
41768    type Error = Error;
41769
41770    fn try_from(i: i32) -> Result<Self> {
41771        let e = match i {
41772            0 => InvokeHostFunctionResultCode::Success,
41773            -1 => InvokeHostFunctionResultCode::Malformed,
41774            -2 => InvokeHostFunctionResultCode::Trapped,
41775            -3 => InvokeHostFunctionResultCode::ResourceLimitExceeded,
41776            -4 => InvokeHostFunctionResultCode::EntryArchived,
41777            -5 => InvokeHostFunctionResultCode::InsufficientRefundableFee,
41778            #[allow(unreachable_patterns)]
41779            _ => return Err(Error::Invalid),
41780        };
41781        Ok(e)
41782    }
41783}
41784
41785impl From<InvokeHostFunctionResultCode> for i32 {
41786    #[must_use]
41787    fn from(e: InvokeHostFunctionResultCode) -> Self {
41788        e as Self
41789    }
41790}
41791
41792impl ReadXdr for InvokeHostFunctionResultCode {
41793    #[cfg(feature = "std")]
41794    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
41795        r.with_limited_depth(|r| {
41796            let e = i32::read_xdr(r)?;
41797            let v: Self = e.try_into()?;
41798            Ok(v)
41799        })
41800    }
41801}
41802
41803impl WriteXdr for InvokeHostFunctionResultCode {
41804    #[cfg(feature = "std")]
41805    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
41806        w.with_limited_depth(|w| {
41807            let i: i32 = (*self).into();
41808            i.write_xdr(w)
41809        })
41810    }
41811}
41812
41813/// InvokeHostFunctionResult is an XDR Union defines as:
41814///
41815/// ```text
41816/// union InvokeHostFunctionResult switch (InvokeHostFunctionResultCode code)
41817/// {
41818/// case INVOKE_HOST_FUNCTION_SUCCESS:
41819///     Hash success; // sha256(InvokeHostFunctionSuccessPreImage)
41820/// case INVOKE_HOST_FUNCTION_MALFORMED:
41821/// case INVOKE_HOST_FUNCTION_TRAPPED:
41822/// case INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED:
41823/// case INVOKE_HOST_FUNCTION_ENTRY_ARCHIVED:
41824/// case INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE:
41825///     void;
41826/// };
41827/// ```
41828///
41829// union with discriminant InvokeHostFunctionResultCode
41830#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
41831#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
41832#[cfg_attr(
41833    all(feature = "serde", feature = "alloc"),
41834    derive(serde::Serialize, serde::Deserialize),
41835    serde(rename_all = "snake_case")
41836)]
41837#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
41838#[allow(clippy::large_enum_variant)]
41839pub enum InvokeHostFunctionResult {
41840    Success(Hash),
41841    Malformed,
41842    Trapped,
41843    ResourceLimitExceeded,
41844    EntryArchived,
41845    InsufficientRefundableFee,
41846}
41847
41848impl InvokeHostFunctionResult {
41849    pub const VARIANTS: [InvokeHostFunctionResultCode; 6] = [
41850        InvokeHostFunctionResultCode::Success,
41851        InvokeHostFunctionResultCode::Malformed,
41852        InvokeHostFunctionResultCode::Trapped,
41853        InvokeHostFunctionResultCode::ResourceLimitExceeded,
41854        InvokeHostFunctionResultCode::EntryArchived,
41855        InvokeHostFunctionResultCode::InsufficientRefundableFee,
41856    ];
41857    pub const VARIANTS_STR: [&'static str; 6] = [
41858        "Success",
41859        "Malformed",
41860        "Trapped",
41861        "ResourceLimitExceeded",
41862        "EntryArchived",
41863        "InsufficientRefundableFee",
41864    ];
41865
41866    #[must_use]
41867    pub const fn name(&self) -> &'static str {
41868        match self {
41869            Self::Success(_) => "Success",
41870            Self::Malformed => "Malformed",
41871            Self::Trapped => "Trapped",
41872            Self::ResourceLimitExceeded => "ResourceLimitExceeded",
41873            Self::EntryArchived => "EntryArchived",
41874            Self::InsufficientRefundableFee => "InsufficientRefundableFee",
41875        }
41876    }
41877
41878    #[must_use]
41879    pub const fn discriminant(&self) -> InvokeHostFunctionResultCode {
41880        #[allow(clippy::match_same_arms)]
41881        match self {
41882            Self::Success(_) => InvokeHostFunctionResultCode::Success,
41883            Self::Malformed => InvokeHostFunctionResultCode::Malformed,
41884            Self::Trapped => InvokeHostFunctionResultCode::Trapped,
41885            Self::ResourceLimitExceeded => InvokeHostFunctionResultCode::ResourceLimitExceeded,
41886            Self::EntryArchived => InvokeHostFunctionResultCode::EntryArchived,
41887            Self::InsufficientRefundableFee => {
41888                InvokeHostFunctionResultCode::InsufficientRefundableFee
41889            }
41890        }
41891    }
41892
41893    #[must_use]
41894    pub const fn variants() -> [InvokeHostFunctionResultCode; 6] {
41895        Self::VARIANTS
41896    }
41897}
41898
41899impl Name for InvokeHostFunctionResult {
41900    #[must_use]
41901    fn name(&self) -> &'static str {
41902        Self::name(self)
41903    }
41904}
41905
41906impl Discriminant<InvokeHostFunctionResultCode> for InvokeHostFunctionResult {
41907    #[must_use]
41908    fn discriminant(&self) -> InvokeHostFunctionResultCode {
41909        Self::discriminant(self)
41910    }
41911}
41912
41913impl Variants<InvokeHostFunctionResultCode> for InvokeHostFunctionResult {
41914    fn variants() -> slice::Iter<'static, InvokeHostFunctionResultCode> {
41915        Self::VARIANTS.iter()
41916    }
41917}
41918
41919impl Union<InvokeHostFunctionResultCode> for InvokeHostFunctionResult {}
41920
41921impl ReadXdr for InvokeHostFunctionResult {
41922    #[cfg(feature = "std")]
41923    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
41924        r.with_limited_depth(|r| {
41925            let dv: InvokeHostFunctionResultCode =
41926                <InvokeHostFunctionResultCode as ReadXdr>::read_xdr(r)?;
41927            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
41928            let v = match dv {
41929                InvokeHostFunctionResultCode::Success => Self::Success(Hash::read_xdr(r)?),
41930                InvokeHostFunctionResultCode::Malformed => Self::Malformed,
41931                InvokeHostFunctionResultCode::Trapped => Self::Trapped,
41932                InvokeHostFunctionResultCode::ResourceLimitExceeded => Self::ResourceLimitExceeded,
41933                InvokeHostFunctionResultCode::EntryArchived => Self::EntryArchived,
41934                InvokeHostFunctionResultCode::InsufficientRefundableFee => {
41935                    Self::InsufficientRefundableFee
41936                }
41937                #[allow(unreachable_patterns)]
41938                _ => return Err(Error::Invalid),
41939            };
41940            Ok(v)
41941        })
41942    }
41943}
41944
41945impl WriteXdr for InvokeHostFunctionResult {
41946    #[cfg(feature = "std")]
41947    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
41948        w.with_limited_depth(|w| {
41949            self.discriminant().write_xdr(w)?;
41950            #[allow(clippy::match_same_arms)]
41951            match self {
41952                Self::Success(v) => v.write_xdr(w)?,
41953                Self::Malformed => ().write_xdr(w)?,
41954                Self::Trapped => ().write_xdr(w)?,
41955                Self::ResourceLimitExceeded => ().write_xdr(w)?,
41956                Self::EntryArchived => ().write_xdr(w)?,
41957                Self::InsufficientRefundableFee => ().write_xdr(w)?,
41958            };
41959            Ok(())
41960        })
41961    }
41962}
41963
41964/// ExtendFootprintTtlResultCode is an XDR Enum defines as:
41965///
41966/// ```text
41967/// enum ExtendFootprintTTLResultCode
41968/// {
41969///     // codes considered as "success" for the operation
41970///     EXTEND_FOOTPRINT_TTL_SUCCESS = 0,
41971///
41972///     // codes considered as "failure" for the operation
41973///     EXTEND_FOOTPRINT_TTL_MALFORMED = -1,
41974///     EXTEND_FOOTPRINT_TTL_RESOURCE_LIMIT_EXCEEDED = -2,
41975///     EXTEND_FOOTPRINT_TTL_INSUFFICIENT_REFUNDABLE_FEE = -3
41976/// };
41977/// ```
41978///
41979// enum
41980#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
41981#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
41982#[cfg_attr(
41983    all(feature = "serde", feature = "alloc"),
41984    derive(serde::Serialize, serde::Deserialize),
41985    serde(rename_all = "snake_case")
41986)]
41987#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
41988#[repr(i32)]
41989pub enum ExtendFootprintTtlResultCode {
41990    Success = 0,
41991    Malformed = -1,
41992    ResourceLimitExceeded = -2,
41993    InsufficientRefundableFee = -3,
41994}
41995
41996impl ExtendFootprintTtlResultCode {
41997    pub const VARIANTS: [ExtendFootprintTtlResultCode; 4] = [
41998        ExtendFootprintTtlResultCode::Success,
41999        ExtendFootprintTtlResultCode::Malformed,
42000        ExtendFootprintTtlResultCode::ResourceLimitExceeded,
42001        ExtendFootprintTtlResultCode::InsufficientRefundableFee,
42002    ];
42003    pub const VARIANTS_STR: [&'static str; 4] = [
42004        "Success",
42005        "Malformed",
42006        "ResourceLimitExceeded",
42007        "InsufficientRefundableFee",
42008    ];
42009
42010    #[must_use]
42011    pub const fn name(&self) -> &'static str {
42012        match self {
42013            Self::Success => "Success",
42014            Self::Malformed => "Malformed",
42015            Self::ResourceLimitExceeded => "ResourceLimitExceeded",
42016            Self::InsufficientRefundableFee => "InsufficientRefundableFee",
42017        }
42018    }
42019
42020    #[must_use]
42021    pub const fn variants() -> [ExtendFootprintTtlResultCode; 4] {
42022        Self::VARIANTS
42023    }
42024}
42025
42026impl Name for ExtendFootprintTtlResultCode {
42027    #[must_use]
42028    fn name(&self) -> &'static str {
42029        Self::name(self)
42030    }
42031}
42032
42033impl Variants<ExtendFootprintTtlResultCode> for ExtendFootprintTtlResultCode {
42034    fn variants() -> slice::Iter<'static, ExtendFootprintTtlResultCode> {
42035        Self::VARIANTS.iter()
42036    }
42037}
42038
42039impl Enum for ExtendFootprintTtlResultCode {}
42040
42041impl fmt::Display for ExtendFootprintTtlResultCode {
42042    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
42043        f.write_str(self.name())
42044    }
42045}
42046
42047impl TryFrom<i32> for ExtendFootprintTtlResultCode {
42048    type Error = Error;
42049
42050    fn try_from(i: i32) -> Result<Self> {
42051        let e = match i {
42052            0 => ExtendFootprintTtlResultCode::Success,
42053            -1 => ExtendFootprintTtlResultCode::Malformed,
42054            -2 => ExtendFootprintTtlResultCode::ResourceLimitExceeded,
42055            -3 => ExtendFootprintTtlResultCode::InsufficientRefundableFee,
42056            #[allow(unreachable_patterns)]
42057            _ => return Err(Error::Invalid),
42058        };
42059        Ok(e)
42060    }
42061}
42062
42063impl From<ExtendFootprintTtlResultCode> for i32 {
42064    #[must_use]
42065    fn from(e: ExtendFootprintTtlResultCode) -> Self {
42066        e as Self
42067    }
42068}
42069
42070impl ReadXdr for ExtendFootprintTtlResultCode {
42071    #[cfg(feature = "std")]
42072    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
42073        r.with_limited_depth(|r| {
42074            let e = i32::read_xdr(r)?;
42075            let v: Self = e.try_into()?;
42076            Ok(v)
42077        })
42078    }
42079}
42080
42081impl WriteXdr for ExtendFootprintTtlResultCode {
42082    #[cfg(feature = "std")]
42083    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
42084        w.with_limited_depth(|w| {
42085            let i: i32 = (*self).into();
42086            i.write_xdr(w)
42087        })
42088    }
42089}
42090
42091/// ExtendFootprintTtlResult is an XDR Union defines as:
42092///
42093/// ```text
42094/// union ExtendFootprintTTLResult switch (ExtendFootprintTTLResultCode code)
42095/// {
42096/// case EXTEND_FOOTPRINT_TTL_SUCCESS:
42097///     void;
42098/// case EXTEND_FOOTPRINT_TTL_MALFORMED:
42099/// case EXTEND_FOOTPRINT_TTL_RESOURCE_LIMIT_EXCEEDED:
42100/// case EXTEND_FOOTPRINT_TTL_INSUFFICIENT_REFUNDABLE_FEE:
42101///     void;
42102/// };
42103/// ```
42104///
42105// union with discriminant ExtendFootprintTtlResultCode
42106#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
42107#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
42108#[cfg_attr(
42109    all(feature = "serde", feature = "alloc"),
42110    derive(serde::Serialize, serde::Deserialize),
42111    serde(rename_all = "snake_case")
42112)]
42113#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
42114#[allow(clippy::large_enum_variant)]
42115pub enum ExtendFootprintTtlResult {
42116    Success,
42117    Malformed,
42118    ResourceLimitExceeded,
42119    InsufficientRefundableFee,
42120}
42121
42122impl ExtendFootprintTtlResult {
42123    pub const VARIANTS: [ExtendFootprintTtlResultCode; 4] = [
42124        ExtendFootprintTtlResultCode::Success,
42125        ExtendFootprintTtlResultCode::Malformed,
42126        ExtendFootprintTtlResultCode::ResourceLimitExceeded,
42127        ExtendFootprintTtlResultCode::InsufficientRefundableFee,
42128    ];
42129    pub const VARIANTS_STR: [&'static str; 4] = [
42130        "Success",
42131        "Malformed",
42132        "ResourceLimitExceeded",
42133        "InsufficientRefundableFee",
42134    ];
42135
42136    #[must_use]
42137    pub const fn name(&self) -> &'static str {
42138        match self {
42139            Self::Success => "Success",
42140            Self::Malformed => "Malformed",
42141            Self::ResourceLimitExceeded => "ResourceLimitExceeded",
42142            Self::InsufficientRefundableFee => "InsufficientRefundableFee",
42143        }
42144    }
42145
42146    #[must_use]
42147    pub const fn discriminant(&self) -> ExtendFootprintTtlResultCode {
42148        #[allow(clippy::match_same_arms)]
42149        match self {
42150            Self::Success => ExtendFootprintTtlResultCode::Success,
42151            Self::Malformed => ExtendFootprintTtlResultCode::Malformed,
42152            Self::ResourceLimitExceeded => ExtendFootprintTtlResultCode::ResourceLimitExceeded,
42153            Self::InsufficientRefundableFee => {
42154                ExtendFootprintTtlResultCode::InsufficientRefundableFee
42155            }
42156        }
42157    }
42158
42159    #[must_use]
42160    pub const fn variants() -> [ExtendFootprintTtlResultCode; 4] {
42161        Self::VARIANTS
42162    }
42163}
42164
42165impl Name for ExtendFootprintTtlResult {
42166    #[must_use]
42167    fn name(&self) -> &'static str {
42168        Self::name(self)
42169    }
42170}
42171
42172impl Discriminant<ExtendFootprintTtlResultCode> for ExtendFootprintTtlResult {
42173    #[must_use]
42174    fn discriminant(&self) -> ExtendFootprintTtlResultCode {
42175        Self::discriminant(self)
42176    }
42177}
42178
42179impl Variants<ExtendFootprintTtlResultCode> for ExtendFootprintTtlResult {
42180    fn variants() -> slice::Iter<'static, ExtendFootprintTtlResultCode> {
42181        Self::VARIANTS.iter()
42182    }
42183}
42184
42185impl Union<ExtendFootprintTtlResultCode> for ExtendFootprintTtlResult {}
42186
42187impl ReadXdr for ExtendFootprintTtlResult {
42188    #[cfg(feature = "std")]
42189    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
42190        r.with_limited_depth(|r| {
42191            let dv: ExtendFootprintTtlResultCode =
42192                <ExtendFootprintTtlResultCode as ReadXdr>::read_xdr(r)?;
42193            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
42194            let v = match dv {
42195                ExtendFootprintTtlResultCode::Success => Self::Success,
42196                ExtendFootprintTtlResultCode::Malformed => Self::Malformed,
42197                ExtendFootprintTtlResultCode::ResourceLimitExceeded => Self::ResourceLimitExceeded,
42198                ExtendFootprintTtlResultCode::InsufficientRefundableFee => {
42199                    Self::InsufficientRefundableFee
42200                }
42201                #[allow(unreachable_patterns)]
42202                _ => return Err(Error::Invalid),
42203            };
42204            Ok(v)
42205        })
42206    }
42207}
42208
42209impl WriteXdr for ExtendFootprintTtlResult {
42210    #[cfg(feature = "std")]
42211    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
42212        w.with_limited_depth(|w| {
42213            self.discriminant().write_xdr(w)?;
42214            #[allow(clippy::match_same_arms)]
42215            match self {
42216                Self::Success => ().write_xdr(w)?,
42217                Self::Malformed => ().write_xdr(w)?,
42218                Self::ResourceLimitExceeded => ().write_xdr(w)?,
42219                Self::InsufficientRefundableFee => ().write_xdr(w)?,
42220            };
42221            Ok(())
42222        })
42223    }
42224}
42225
42226/// RestoreFootprintResultCode is an XDR Enum defines as:
42227///
42228/// ```text
42229/// enum RestoreFootprintResultCode
42230/// {
42231///     // codes considered as "success" for the operation
42232///     RESTORE_FOOTPRINT_SUCCESS = 0,
42233///
42234///     // codes considered as "failure" for the operation
42235///     RESTORE_FOOTPRINT_MALFORMED = -1,
42236///     RESTORE_FOOTPRINT_RESOURCE_LIMIT_EXCEEDED = -2,
42237///     RESTORE_FOOTPRINT_INSUFFICIENT_REFUNDABLE_FEE = -3
42238/// };
42239/// ```
42240///
42241// enum
42242#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
42243#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
42244#[cfg_attr(
42245    all(feature = "serde", feature = "alloc"),
42246    derive(serde::Serialize, serde::Deserialize),
42247    serde(rename_all = "snake_case")
42248)]
42249#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
42250#[repr(i32)]
42251pub enum RestoreFootprintResultCode {
42252    Success = 0,
42253    Malformed = -1,
42254    ResourceLimitExceeded = -2,
42255    InsufficientRefundableFee = -3,
42256}
42257
42258impl RestoreFootprintResultCode {
42259    pub const VARIANTS: [RestoreFootprintResultCode; 4] = [
42260        RestoreFootprintResultCode::Success,
42261        RestoreFootprintResultCode::Malformed,
42262        RestoreFootprintResultCode::ResourceLimitExceeded,
42263        RestoreFootprintResultCode::InsufficientRefundableFee,
42264    ];
42265    pub const VARIANTS_STR: [&'static str; 4] = [
42266        "Success",
42267        "Malformed",
42268        "ResourceLimitExceeded",
42269        "InsufficientRefundableFee",
42270    ];
42271
42272    #[must_use]
42273    pub const fn name(&self) -> &'static str {
42274        match self {
42275            Self::Success => "Success",
42276            Self::Malformed => "Malformed",
42277            Self::ResourceLimitExceeded => "ResourceLimitExceeded",
42278            Self::InsufficientRefundableFee => "InsufficientRefundableFee",
42279        }
42280    }
42281
42282    #[must_use]
42283    pub const fn variants() -> [RestoreFootprintResultCode; 4] {
42284        Self::VARIANTS
42285    }
42286}
42287
42288impl Name for RestoreFootprintResultCode {
42289    #[must_use]
42290    fn name(&self) -> &'static str {
42291        Self::name(self)
42292    }
42293}
42294
42295impl Variants<RestoreFootprintResultCode> for RestoreFootprintResultCode {
42296    fn variants() -> slice::Iter<'static, RestoreFootprintResultCode> {
42297        Self::VARIANTS.iter()
42298    }
42299}
42300
42301impl Enum for RestoreFootprintResultCode {}
42302
42303impl fmt::Display for RestoreFootprintResultCode {
42304    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
42305        f.write_str(self.name())
42306    }
42307}
42308
42309impl TryFrom<i32> for RestoreFootprintResultCode {
42310    type Error = Error;
42311
42312    fn try_from(i: i32) -> Result<Self> {
42313        let e = match i {
42314            0 => RestoreFootprintResultCode::Success,
42315            -1 => RestoreFootprintResultCode::Malformed,
42316            -2 => RestoreFootprintResultCode::ResourceLimitExceeded,
42317            -3 => RestoreFootprintResultCode::InsufficientRefundableFee,
42318            #[allow(unreachable_patterns)]
42319            _ => return Err(Error::Invalid),
42320        };
42321        Ok(e)
42322    }
42323}
42324
42325impl From<RestoreFootprintResultCode> for i32 {
42326    #[must_use]
42327    fn from(e: RestoreFootprintResultCode) -> Self {
42328        e as Self
42329    }
42330}
42331
42332impl ReadXdr for RestoreFootprintResultCode {
42333    #[cfg(feature = "std")]
42334    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
42335        r.with_limited_depth(|r| {
42336            let e = i32::read_xdr(r)?;
42337            let v: Self = e.try_into()?;
42338            Ok(v)
42339        })
42340    }
42341}
42342
42343impl WriteXdr for RestoreFootprintResultCode {
42344    #[cfg(feature = "std")]
42345    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
42346        w.with_limited_depth(|w| {
42347            let i: i32 = (*self).into();
42348            i.write_xdr(w)
42349        })
42350    }
42351}
42352
42353/// RestoreFootprintResult is an XDR Union defines as:
42354///
42355/// ```text
42356/// union RestoreFootprintResult switch (RestoreFootprintResultCode code)
42357/// {
42358/// case RESTORE_FOOTPRINT_SUCCESS:
42359///     void;
42360/// case RESTORE_FOOTPRINT_MALFORMED:
42361/// case RESTORE_FOOTPRINT_RESOURCE_LIMIT_EXCEEDED:
42362/// case RESTORE_FOOTPRINT_INSUFFICIENT_REFUNDABLE_FEE:
42363///     void;
42364/// };
42365/// ```
42366///
42367// union with discriminant RestoreFootprintResultCode
42368#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
42369#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
42370#[cfg_attr(
42371    all(feature = "serde", feature = "alloc"),
42372    derive(serde::Serialize, serde::Deserialize),
42373    serde(rename_all = "snake_case")
42374)]
42375#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
42376#[allow(clippy::large_enum_variant)]
42377pub enum RestoreFootprintResult {
42378    Success,
42379    Malformed,
42380    ResourceLimitExceeded,
42381    InsufficientRefundableFee,
42382}
42383
42384impl RestoreFootprintResult {
42385    pub const VARIANTS: [RestoreFootprintResultCode; 4] = [
42386        RestoreFootprintResultCode::Success,
42387        RestoreFootprintResultCode::Malformed,
42388        RestoreFootprintResultCode::ResourceLimitExceeded,
42389        RestoreFootprintResultCode::InsufficientRefundableFee,
42390    ];
42391    pub const VARIANTS_STR: [&'static str; 4] = [
42392        "Success",
42393        "Malformed",
42394        "ResourceLimitExceeded",
42395        "InsufficientRefundableFee",
42396    ];
42397
42398    #[must_use]
42399    pub const fn name(&self) -> &'static str {
42400        match self {
42401            Self::Success => "Success",
42402            Self::Malformed => "Malformed",
42403            Self::ResourceLimitExceeded => "ResourceLimitExceeded",
42404            Self::InsufficientRefundableFee => "InsufficientRefundableFee",
42405        }
42406    }
42407
42408    #[must_use]
42409    pub const fn discriminant(&self) -> RestoreFootprintResultCode {
42410        #[allow(clippy::match_same_arms)]
42411        match self {
42412            Self::Success => RestoreFootprintResultCode::Success,
42413            Self::Malformed => RestoreFootprintResultCode::Malformed,
42414            Self::ResourceLimitExceeded => RestoreFootprintResultCode::ResourceLimitExceeded,
42415            Self::InsufficientRefundableFee => {
42416                RestoreFootprintResultCode::InsufficientRefundableFee
42417            }
42418        }
42419    }
42420
42421    #[must_use]
42422    pub const fn variants() -> [RestoreFootprintResultCode; 4] {
42423        Self::VARIANTS
42424    }
42425}
42426
42427impl Name for RestoreFootprintResult {
42428    #[must_use]
42429    fn name(&self) -> &'static str {
42430        Self::name(self)
42431    }
42432}
42433
42434impl Discriminant<RestoreFootprintResultCode> for RestoreFootprintResult {
42435    #[must_use]
42436    fn discriminant(&self) -> RestoreFootprintResultCode {
42437        Self::discriminant(self)
42438    }
42439}
42440
42441impl Variants<RestoreFootprintResultCode> for RestoreFootprintResult {
42442    fn variants() -> slice::Iter<'static, RestoreFootprintResultCode> {
42443        Self::VARIANTS.iter()
42444    }
42445}
42446
42447impl Union<RestoreFootprintResultCode> for RestoreFootprintResult {}
42448
42449impl ReadXdr for RestoreFootprintResult {
42450    #[cfg(feature = "std")]
42451    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
42452        r.with_limited_depth(|r| {
42453            let dv: RestoreFootprintResultCode =
42454                <RestoreFootprintResultCode as ReadXdr>::read_xdr(r)?;
42455            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
42456            let v = match dv {
42457                RestoreFootprintResultCode::Success => Self::Success,
42458                RestoreFootprintResultCode::Malformed => Self::Malformed,
42459                RestoreFootprintResultCode::ResourceLimitExceeded => Self::ResourceLimitExceeded,
42460                RestoreFootprintResultCode::InsufficientRefundableFee => {
42461                    Self::InsufficientRefundableFee
42462                }
42463                #[allow(unreachable_patterns)]
42464                _ => return Err(Error::Invalid),
42465            };
42466            Ok(v)
42467        })
42468    }
42469}
42470
42471impl WriteXdr for RestoreFootprintResult {
42472    #[cfg(feature = "std")]
42473    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
42474        w.with_limited_depth(|w| {
42475            self.discriminant().write_xdr(w)?;
42476            #[allow(clippy::match_same_arms)]
42477            match self {
42478                Self::Success => ().write_xdr(w)?,
42479                Self::Malformed => ().write_xdr(w)?,
42480                Self::ResourceLimitExceeded => ().write_xdr(w)?,
42481                Self::InsufficientRefundableFee => ().write_xdr(w)?,
42482            };
42483            Ok(())
42484        })
42485    }
42486}
42487
42488/// OperationResultCode is an XDR Enum defines as:
42489///
42490/// ```text
42491/// enum OperationResultCode
42492/// {
42493///     opINNER = 0, // inner object result is valid
42494///
42495///     opBAD_AUTH = -1,            // too few valid signatures / wrong network
42496///     opNO_ACCOUNT = -2,          // source account was not found
42497///     opNOT_SUPPORTED = -3,       // operation not supported at this time
42498///     opTOO_MANY_SUBENTRIES = -4, // max number of subentries already reached
42499///     opEXCEEDED_WORK_LIMIT = -5, // operation did too much work
42500///     opTOO_MANY_SPONSORING = -6  // account is sponsoring too many entries
42501/// };
42502/// ```
42503///
42504// enum
42505#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
42506#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
42507#[cfg_attr(
42508    all(feature = "serde", feature = "alloc"),
42509    derive(serde::Serialize, serde::Deserialize),
42510    serde(rename_all = "snake_case")
42511)]
42512#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
42513#[repr(i32)]
42514pub enum OperationResultCode {
42515    OpInner = 0,
42516    OpBadAuth = -1,
42517    OpNoAccount = -2,
42518    OpNotSupported = -3,
42519    OpTooManySubentries = -4,
42520    OpExceededWorkLimit = -5,
42521    OpTooManySponsoring = -6,
42522}
42523
42524impl OperationResultCode {
42525    pub const VARIANTS: [OperationResultCode; 7] = [
42526        OperationResultCode::OpInner,
42527        OperationResultCode::OpBadAuth,
42528        OperationResultCode::OpNoAccount,
42529        OperationResultCode::OpNotSupported,
42530        OperationResultCode::OpTooManySubentries,
42531        OperationResultCode::OpExceededWorkLimit,
42532        OperationResultCode::OpTooManySponsoring,
42533    ];
42534    pub const VARIANTS_STR: [&'static str; 7] = [
42535        "OpInner",
42536        "OpBadAuth",
42537        "OpNoAccount",
42538        "OpNotSupported",
42539        "OpTooManySubentries",
42540        "OpExceededWorkLimit",
42541        "OpTooManySponsoring",
42542    ];
42543
42544    #[must_use]
42545    pub const fn name(&self) -> &'static str {
42546        match self {
42547            Self::OpInner => "OpInner",
42548            Self::OpBadAuth => "OpBadAuth",
42549            Self::OpNoAccount => "OpNoAccount",
42550            Self::OpNotSupported => "OpNotSupported",
42551            Self::OpTooManySubentries => "OpTooManySubentries",
42552            Self::OpExceededWorkLimit => "OpExceededWorkLimit",
42553            Self::OpTooManySponsoring => "OpTooManySponsoring",
42554        }
42555    }
42556
42557    #[must_use]
42558    pub const fn variants() -> [OperationResultCode; 7] {
42559        Self::VARIANTS
42560    }
42561}
42562
42563impl Name for OperationResultCode {
42564    #[must_use]
42565    fn name(&self) -> &'static str {
42566        Self::name(self)
42567    }
42568}
42569
42570impl Variants<OperationResultCode> for OperationResultCode {
42571    fn variants() -> slice::Iter<'static, OperationResultCode> {
42572        Self::VARIANTS.iter()
42573    }
42574}
42575
42576impl Enum for OperationResultCode {}
42577
42578impl fmt::Display for OperationResultCode {
42579    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
42580        f.write_str(self.name())
42581    }
42582}
42583
42584impl TryFrom<i32> for OperationResultCode {
42585    type Error = Error;
42586
42587    fn try_from(i: i32) -> Result<Self> {
42588        let e = match i {
42589            0 => OperationResultCode::OpInner,
42590            -1 => OperationResultCode::OpBadAuth,
42591            -2 => OperationResultCode::OpNoAccount,
42592            -3 => OperationResultCode::OpNotSupported,
42593            -4 => OperationResultCode::OpTooManySubentries,
42594            -5 => OperationResultCode::OpExceededWorkLimit,
42595            -6 => OperationResultCode::OpTooManySponsoring,
42596            #[allow(unreachable_patterns)]
42597            _ => return Err(Error::Invalid),
42598        };
42599        Ok(e)
42600    }
42601}
42602
42603impl From<OperationResultCode> for i32 {
42604    #[must_use]
42605    fn from(e: OperationResultCode) -> Self {
42606        e as Self
42607    }
42608}
42609
42610impl ReadXdr for OperationResultCode {
42611    #[cfg(feature = "std")]
42612    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
42613        r.with_limited_depth(|r| {
42614            let e = i32::read_xdr(r)?;
42615            let v: Self = e.try_into()?;
42616            Ok(v)
42617        })
42618    }
42619}
42620
42621impl WriteXdr for OperationResultCode {
42622    #[cfg(feature = "std")]
42623    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
42624        w.with_limited_depth(|w| {
42625            let i: i32 = (*self).into();
42626            i.write_xdr(w)
42627        })
42628    }
42629}
42630
42631/// OperationResultTr is an XDR NestedUnion defines as:
42632///
42633/// ```text
42634/// union switch (OperationType type)
42635///     {
42636///     case CREATE_ACCOUNT:
42637///         CreateAccountResult createAccountResult;
42638///     case PAYMENT:
42639///         PaymentResult paymentResult;
42640///     case PATH_PAYMENT_STRICT_RECEIVE:
42641///         PathPaymentStrictReceiveResult pathPaymentStrictReceiveResult;
42642///     case MANAGE_SELL_OFFER:
42643///         ManageSellOfferResult manageSellOfferResult;
42644///     case CREATE_PASSIVE_SELL_OFFER:
42645///         ManageSellOfferResult createPassiveSellOfferResult;
42646///     case SET_OPTIONS:
42647///         SetOptionsResult setOptionsResult;
42648///     case CHANGE_TRUST:
42649///         ChangeTrustResult changeTrustResult;
42650///     case ALLOW_TRUST:
42651///         AllowTrustResult allowTrustResult;
42652///     case ACCOUNT_MERGE:
42653///         AccountMergeResult accountMergeResult;
42654///     case INFLATION:
42655///         InflationResult inflationResult;
42656///     case MANAGE_DATA:
42657///         ManageDataResult manageDataResult;
42658///     case BUMP_SEQUENCE:
42659///         BumpSequenceResult bumpSeqResult;
42660///     case MANAGE_BUY_OFFER:
42661///         ManageBuyOfferResult manageBuyOfferResult;
42662///     case PATH_PAYMENT_STRICT_SEND:
42663///         PathPaymentStrictSendResult pathPaymentStrictSendResult;
42664///     case CREATE_CLAIMABLE_BALANCE:
42665///         CreateClaimableBalanceResult createClaimableBalanceResult;
42666///     case CLAIM_CLAIMABLE_BALANCE:
42667///         ClaimClaimableBalanceResult claimClaimableBalanceResult;
42668///     case BEGIN_SPONSORING_FUTURE_RESERVES:
42669///         BeginSponsoringFutureReservesResult beginSponsoringFutureReservesResult;
42670///     case END_SPONSORING_FUTURE_RESERVES:
42671///         EndSponsoringFutureReservesResult endSponsoringFutureReservesResult;
42672///     case REVOKE_SPONSORSHIP:
42673///         RevokeSponsorshipResult revokeSponsorshipResult;
42674///     case CLAWBACK:
42675///         ClawbackResult clawbackResult;
42676///     case CLAWBACK_CLAIMABLE_BALANCE:
42677///         ClawbackClaimableBalanceResult clawbackClaimableBalanceResult;
42678///     case SET_TRUST_LINE_FLAGS:
42679///         SetTrustLineFlagsResult setTrustLineFlagsResult;
42680///     case LIQUIDITY_POOL_DEPOSIT:
42681///         LiquidityPoolDepositResult liquidityPoolDepositResult;
42682///     case LIQUIDITY_POOL_WITHDRAW:
42683///         LiquidityPoolWithdrawResult liquidityPoolWithdrawResult;
42684///     case INVOKE_HOST_FUNCTION:
42685///         InvokeHostFunctionResult invokeHostFunctionResult;
42686///     case EXTEND_FOOTPRINT_TTL:
42687///         ExtendFootprintTTLResult extendFootprintTTLResult;
42688///     case RESTORE_FOOTPRINT:
42689///         RestoreFootprintResult restoreFootprintResult;
42690///     }
42691/// ```
42692///
42693// union with discriminant OperationType
42694#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
42695#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
42696#[cfg_attr(
42697    all(feature = "serde", feature = "alloc"),
42698    derive(serde::Serialize, serde::Deserialize),
42699    serde(rename_all = "snake_case")
42700)]
42701#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
42702#[allow(clippy::large_enum_variant)]
42703pub enum OperationResultTr {
42704    CreateAccount(CreateAccountResult),
42705    Payment(PaymentResult),
42706    PathPaymentStrictReceive(PathPaymentStrictReceiveResult),
42707    ManageSellOffer(ManageSellOfferResult),
42708    CreatePassiveSellOffer(ManageSellOfferResult),
42709    SetOptions(SetOptionsResult),
42710    ChangeTrust(ChangeTrustResult),
42711    AllowTrust(AllowTrustResult),
42712    AccountMerge(AccountMergeResult),
42713    Inflation(InflationResult),
42714    ManageData(ManageDataResult),
42715    BumpSequence(BumpSequenceResult),
42716    ManageBuyOffer(ManageBuyOfferResult),
42717    PathPaymentStrictSend(PathPaymentStrictSendResult),
42718    CreateClaimableBalance(CreateClaimableBalanceResult),
42719    ClaimClaimableBalance(ClaimClaimableBalanceResult),
42720    BeginSponsoringFutureReserves(BeginSponsoringFutureReservesResult),
42721    EndSponsoringFutureReserves(EndSponsoringFutureReservesResult),
42722    RevokeSponsorship(RevokeSponsorshipResult),
42723    Clawback(ClawbackResult),
42724    ClawbackClaimableBalance(ClawbackClaimableBalanceResult),
42725    SetTrustLineFlags(SetTrustLineFlagsResult),
42726    LiquidityPoolDeposit(LiquidityPoolDepositResult),
42727    LiquidityPoolWithdraw(LiquidityPoolWithdrawResult),
42728    InvokeHostFunction(InvokeHostFunctionResult),
42729    ExtendFootprintTtl(ExtendFootprintTtlResult),
42730    RestoreFootprint(RestoreFootprintResult),
42731}
42732
42733impl OperationResultTr {
42734    pub const VARIANTS: [OperationType; 27] = [
42735        OperationType::CreateAccount,
42736        OperationType::Payment,
42737        OperationType::PathPaymentStrictReceive,
42738        OperationType::ManageSellOffer,
42739        OperationType::CreatePassiveSellOffer,
42740        OperationType::SetOptions,
42741        OperationType::ChangeTrust,
42742        OperationType::AllowTrust,
42743        OperationType::AccountMerge,
42744        OperationType::Inflation,
42745        OperationType::ManageData,
42746        OperationType::BumpSequence,
42747        OperationType::ManageBuyOffer,
42748        OperationType::PathPaymentStrictSend,
42749        OperationType::CreateClaimableBalance,
42750        OperationType::ClaimClaimableBalance,
42751        OperationType::BeginSponsoringFutureReserves,
42752        OperationType::EndSponsoringFutureReserves,
42753        OperationType::RevokeSponsorship,
42754        OperationType::Clawback,
42755        OperationType::ClawbackClaimableBalance,
42756        OperationType::SetTrustLineFlags,
42757        OperationType::LiquidityPoolDeposit,
42758        OperationType::LiquidityPoolWithdraw,
42759        OperationType::InvokeHostFunction,
42760        OperationType::ExtendFootprintTtl,
42761        OperationType::RestoreFootprint,
42762    ];
42763    pub const VARIANTS_STR: [&'static str; 27] = [
42764        "CreateAccount",
42765        "Payment",
42766        "PathPaymentStrictReceive",
42767        "ManageSellOffer",
42768        "CreatePassiveSellOffer",
42769        "SetOptions",
42770        "ChangeTrust",
42771        "AllowTrust",
42772        "AccountMerge",
42773        "Inflation",
42774        "ManageData",
42775        "BumpSequence",
42776        "ManageBuyOffer",
42777        "PathPaymentStrictSend",
42778        "CreateClaimableBalance",
42779        "ClaimClaimableBalance",
42780        "BeginSponsoringFutureReserves",
42781        "EndSponsoringFutureReserves",
42782        "RevokeSponsorship",
42783        "Clawback",
42784        "ClawbackClaimableBalance",
42785        "SetTrustLineFlags",
42786        "LiquidityPoolDeposit",
42787        "LiquidityPoolWithdraw",
42788        "InvokeHostFunction",
42789        "ExtendFootprintTtl",
42790        "RestoreFootprint",
42791    ];
42792
42793    #[must_use]
42794    pub const fn name(&self) -> &'static str {
42795        match self {
42796            Self::CreateAccount(_) => "CreateAccount",
42797            Self::Payment(_) => "Payment",
42798            Self::PathPaymentStrictReceive(_) => "PathPaymentStrictReceive",
42799            Self::ManageSellOffer(_) => "ManageSellOffer",
42800            Self::CreatePassiveSellOffer(_) => "CreatePassiveSellOffer",
42801            Self::SetOptions(_) => "SetOptions",
42802            Self::ChangeTrust(_) => "ChangeTrust",
42803            Self::AllowTrust(_) => "AllowTrust",
42804            Self::AccountMerge(_) => "AccountMerge",
42805            Self::Inflation(_) => "Inflation",
42806            Self::ManageData(_) => "ManageData",
42807            Self::BumpSequence(_) => "BumpSequence",
42808            Self::ManageBuyOffer(_) => "ManageBuyOffer",
42809            Self::PathPaymentStrictSend(_) => "PathPaymentStrictSend",
42810            Self::CreateClaimableBalance(_) => "CreateClaimableBalance",
42811            Self::ClaimClaimableBalance(_) => "ClaimClaimableBalance",
42812            Self::BeginSponsoringFutureReserves(_) => "BeginSponsoringFutureReserves",
42813            Self::EndSponsoringFutureReserves(_) => "EndSponsoringFutureReserves",
42814            Self::RevokeSponsorship(_) => "RevokeSponsorship",
42815            Self::Clawback(_) => "Clawback",
42816            Self::ClawbackClaimableBalance(_) => "ClawbackClaimableBalance",
42817            Self::SetTrustLineFlags(_) => "SetTrustLineFlags",
42818            Self::LiquidityPoolDeposit(_) => "LiquidityPoolDeposit",
42819            Self::LiquidityPoolWithdraw(_) => "LiquidityPoolWithdraw",
42820            Self::InvokeHostFunction(_) => "InvokeHostFunction",
42821            Self::ExtendFootprintTtl(_) => "ExtendFootprintTtl",
42822            Self::RestoreFootprint(_) => "RestoreFootprint",
42823        }
42824    }
42825
42826    #[must_use]
42827    pub const fn discriminant(&self) -> OperationType {
42828        #[allow(clippy::match_same_arms)]
42829        match self {
42830            Self::CreateAccount(_) => OperationType::CreateAccount,
42831            Self::Payment(_) => OperationType::Payment,
42832            Self::PathPaymentStrictReceive(_) => OperationType::PathPaymentStrictReceive,
42833            Self::ManageSellOffer(_) => OperationType::ManageSellOffer,
42834            Self::CreatePassiveSellOffer(_) => OperationType::CreatePassiveSellOffer,
42835            Self::SetOptions(_) => OperationType::SetOptions,
42836            Self::ChangeTrust(_) => OperationType::ChangeTrust,
42837            Self::AllowTrust(_) => OperationType::AllowTrust,
42838            Self::AccountMerge(_) => OperationType::AccountMerge,
42839            Self::Inflation(_) => OperationType::Inflation,
42840            Self::ManageData(_) => OperationType::ManageData,
42841            Self::BumpSequence(_) => OperationType::BumpSequence,
42842            Self::ManageBuyOffer(_) => OperationType::ManageBuyOffer,
42843            Self::PathPaymentStrictSend(_) => OperationType::PathPaymentStrictSend,
42844            Self::CreateClaimableBalance(_) => OperationType::CreateClaimableBalance,
42845            Self::ClaimClaimableBalance(_) => OperationType::ClaimClaimableBalance,
42846            Self::BeginSponsoringFutureReserves(_) => OperationType::BeginSponsoringFutureReserves,
42847            Self::EndSponsoringFutureReserves(_) => OperationType::EndSponsoringFutureReserves,
42848            Self::RevokeSponsorship(_) => OperationType::RevokeSponsorship,
42849            Self::Clawback(_) => OperationType::Clawback,
42850            Self::ClawbackClaimableBalance(_) => OperationType::ClawbackClaimableBalance,
42851            Self::SetTrustLineFlags(_) => OperationType::SetTrustLineFlags,
42852            Self::LiquidityPoolDeposit(_) => OperationType::LiquidityPoolDeposit,
42853            Self::LiquidityPoolWithdraw(_) => OperationType::LiquidityPoolWithdraw,
42854            Self::InvokeHostFunction(_) => OperationType::InvokeHostFunction,
42855            Self::ExtendFootprintTtl(_) => OperationType::ExtendFootprintTtl,
42856            Self::RestoreFootprint(_) => OperationType::RestoreFootprint,
42857        }
42858    }
42859
42860    #[must_use]
42861    pub const fn variants() -> [OperationType; 27] {
42862        Self::VARIANTS
42863    }
42864}
42865
42866impl Name for OperationResultTr {
42867    #[must_use]
42868    fn name(&self) -> &'static str {
42869        Self::name(self)
42870    }
42871}
42872
42873impl Discriminant<OperationType> for OperationResultTr {
42874    #[must_use]
42875    fn discriminant(&self) -> OperationType {
42876        Self::discriminant(self)
42877    }
42878}
42879
42880impl Variants<OperationType> for OperationResultTr {
42881    fn variants() -> slice::Iter<'static, OperationType> {
42882        Self::VARIANTS.iter()
42883    }
42884}
42885
42886impl Union<OperationType> for OperationResultTr {}
42887
42888impl ReadXdr for OperationResultTr {
42889    #[cfg(feature = "std")]
42890    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
42891        r.with_limited_depth(|r| {
42892            let dv: OperationType = <OperationType as ReadXdr>::read_xdr(r)?;
42893            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
42894            let v = match dv {
42895                OperationType::CreateAccount => {
42896                    Self::CreateAccount(CreateAccountResult::read_xdr(r)?)
42897                }
42898                OperationType::Payment => Self::Payment(PaymentResult::read_xdr(r)?),
42899                OperationType::PathPaymentStrictReceive => {
42900                    Self::PathPaymentStrictReceive(PathPaymentStrictReceiveResult::read_xdr(r)?)
42901                }
42902                OperationType::ManageSellOffer => {
42903                    Self::ManageSellOffer(ManageSellOfferResult::read_xdr(r)?)
42904                }
42905                OperationType::CreatePassiveSellOffer => {
42906                    Self::CreatePassiveSellOffer(ManageSellOfferResult::read_xdr(r)?)
42907                }
42908                OperationType::SetOptions => Self::SetOptions(SetOptionsResult::read_xdr(r)?),
42909                OperationType::ChangeTrust => Self::ChangeTrust(ChangeTrustResult::read_xdr(r)?),
42910                OperationType::AllowTrust => Self::AllowTrust(AllowTrustResult::read_xdr(r)?),
42911                OperationType::AccountMerge => Self::AccountMerge(AccountMergeResult::read_xdr(r)?),
42912                OperationType::Inflation => Self::Inflation(InflationResult::read_xdr(r)?),
42913                OperationType::ManageData => Self::ManageData(ManageDataResult::read_xdr(r)?),
42914                OperationType::BumpSequence => Self::BumpSequence(BumpSequenceResult::read_xdr(r)?),
42915                OperationType::ManageBuyOffer => {
42916                    Self::ManageBuyOffer(ManageBuyOfferResult::read_xdr(r)?)
42917                }
42918                OperationType::PathPaymentStrictSend => {
42919                    Self::PathPaymentStrictSend(PathPaymentStrictSendResult::read_xdr(r)?)
42920                }
42921                OperationType::CreateClaimableBalance => {
42922                    Self::CreateClaimableBalance(CreateClaimableBalanceResult::read_xdr(r)?)
42923                }
42924                OperationType::ClaimClaimableBalance => {
42925                    Self::ClaimClaimableBalance(ClaimClaimableBalanceResult::read_xdr(r)?)
42926                }
42927                OperationType::BeginSponsoringFutureReserves => {
42928                    Self::BeginSponsoringFutureReserves(
42929                        BeginSponsoringFutureReservesResult::read_xdr(r)?,
42930                    )
42931                }
42932                OperationType::EndSponsoringFutureReserves => Self::EndSponsoringFutureReserves(
42933                    EndSponsoringFutureReservesResult::read_xdr(r)?,
42934                ),
42935                OperationType::RevokeSponsorship => {
42936                    Self::RevokeSponsorship(RevokeSponsorshipResult::read_xdr(r)?)
42937                }
42938                OperationType::Clawback => Self::Clawback(ClawbackResult::read_xdr(r)?),
42939                OperationType::ClawbackClaimableBalance => {
42940                    Self::ClawbackClaimableBalance(ClawbackClaimableBalanceResult::read_xdr(r)?)
42941                }
42942                OperationType::SetTrustLineFlags => {
42943                    Self::SetTrustLineFlags(SetTrustLineFlagsResult::read_xdr(r)?)
42944                }
42945                OperationType::LiquidityPoolDeposit => {
42946                    Self::LiquidityPoolDeposit(LiquidityPoolDepositResult::read_xdr(r)?)
42947                }
42948                OperationType::LiquidityPoolWithdraw => {
42949                    Self::LiquidityPoolWithdraw(LiquidityPoolWithdrawResult::read_xdr(r)?)
42950                }
42951                OperationType::InvokeHostFunction => {
42952                    Self::InvokeHostFunction(InvokeHostFunctionResult::read_xdr(r)?)
42953                }
42954                OperationType::ExtendFootprintTtl => {
42955                    Self::ExtendFootprintTtl(ExtendFootprintTtlResult::read_xdr(r)?)
42956                }
42957                OperationType::RestoreFootprint => {
42958                    Self::RestoreFootprint(RestoreFootprintResult::read_xdr(r)?)
42959                }
42960                #[allow(unreachable_patterns)]
42961                _ => return Err(Error::Invalid),
42962            };
42963            Ok(v)
42964        })
42965    }
42966}
42967
42968impl WriteXdr for OperationResultTr {
42969    #[cfg(feature = "std")]
42970    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
42971        w.with_limited_depth(|w| {
42972            self.discriminant().write_xdr(w)?;
42973            #[allow(clippy::match_same_arms)]
42974            match self {
42975                Self::CreateAccount(v) => v.write_xdr(w)?,
42976                Self::Payment(v) => v.write_xdr(w)?,
42977                Self::PathPaymentStrictReceive(v) => v.write_xdr(w)?,
42978                Self::ManageSellOffer(v) => v.write_xdr(w)?,
42979                Self::CreatePassiveSellOffer(v) => v.write_xdr(w)?,
42980                Self::SetOptions(v) => v.write_xdr(w)?,
42981                Self::ChangeTrust(v) => v.write_xdr(w)?,
42982                Self::AllowTrust(v) => v.write_xdr(w)?,
42983                Self::AccountMerge(v) => v.write_xdr(w)?,
42984                Self::Inflation(v) => v.write_xdr(w)?,
42985                Self::ManageData(v) => v.write_xdr(w)?,
42986                Self::BumpSequence(v) => v.write_xdr(w)?,
42987                Self::ManageBuyOffer(v) => v.write_xdr(w)?,
42988                Self::PathPaymentStrictSend(v) => v.write_xdr(w)?,
42989                Self::CreateClaimableBalance(v) => v.write_xdr(w)?,
42990                Self::ClaimClaimableBalance(v) => v.write_xdr(w)?,
42991                Self::BeginSponsoringFutureReserves(v) => v.write_xdr(w)?,
42992                Self::EndSponsoringFutureReserves(v) => v.write_xdr(w)?,
42993                Self::RevokeSponsorship(v) => v.write_xdr(w)?,
42994                Self::Clawback(v) => v.write_xdr(w)?,
42995                Self::ClawbackClaimableBalance(v) => v.write_xdr(w)?,
42996                Self::SetTrustLineFlags(v) => v.write_xdr(w)?,
42997                Self::LiquidityPoolDeposit(v) => v.write_xdr(w)?,
42998                Self::LiquidityPoolWithdraw(v) => v.write_xdr(w)?,
42999                Self::InvokeHostFunction(v) => v.write_xdr(w)?,
43000                Self::ExtendFootprintTtl(v) => v.write_xdr(w)?,
43001                Self::RestoreFootprint(v) => v.write_xdr(w)?,
43002            };
43003            Ok(())
43004        })
43005    }
43006}
43007
43008/// OperationResult is an XDR Union defines as:
43009///
43010/// ```text
43011/// union OperationResult switch (OperationResultCode code)
43012/// {
43013/// case opINNER:
43014///     union switch (OperationType type)
43015///     {
43016///     case CREATE_ACCOUNT:
43017///         CreateAccountResult createAccountResult;
43018///     case PAYMENT:
43019///         PaymentResult paymentResult;
43020///     case PATH_PAYMENT_STRICT_RECEIVE:
43021///         PathPaymentStrictReceiveResult pathPaymentStrictReceiveResult;
43022///     case MANAGE_SELL_OFFER:
43023///         ManageSellOfferResult manageSellOfferResult;
43024///     case CREATE_PASSIVE_SELL_OFFER:
43025///         ManageSellOfferResult createPassiveSellOfferResult;
43026///     case SET_OPTIONS:
43027///         SetOptionsResult setOptionsResult;
43028///     case CHANGE_TRUST:
43029///         ChangeTrustResult changeTrustResult;
43030///     case ALLOW_TRUST:
43031///         AllowTrustResult allowTrustResult;
43032///     case ACCOUNT_MERGE:
43033///         AccountMergeResult accountMergeResult;
43034///     case INFLATION:
43035///         InflationResult inflationResult;
43036///     case MANAGE_DATA:
43037///         ManageDataResult manageDataResult;
43038///     case BUMP_SEQUENCE:
43039///         BumpSequenceResult bumpSeqResult;
43040///     case MANAGE_BUY_OFFER:
43041///         ManageBuyOfferResult manageBuyOfferResult;
43042///     case PATH_PAYMENT_STRICT_SEND:
43043///         PathPaymentStrictSendResult pathPaymentStrictSendResult;
43044///     case CREATE_CLAIMABLE_BALANCE:
43045///         CreateClaimableBalanceResult createClaimableBalanceResult;
43046///     case CLAIM_CLAIMABLE_BALANCE:
43047///         ClaimClaimableBalanceResult claimClaimableBalanceResult;
43048///     case BEGIN_SPONSORING_FUTURE_RESERVES:
43049///         BeginSponsoringFutureReservesResult beginSponsoringFutureReservesResult;
43050///     case END_SPONSORING_FUTURE_RESERVES:
43051///         EndSponsoringFutureReservesResult endSponsoringFutureReservesResult;
43052///     case REVOKE_SPONSORSHIP:
43053///         RevokeSponsorshipResult revokeSponsorshipResult;
43054///     case CLAWBACK:
43055///         ClawbackResult clawbackResult;
43056///     case CLAWBACK_CLAIMABLE_BALANCE:
43057///         ClawbackClaimableBalanceResult clawbackClaimableBalanceResult;
43058///     case SET_TRUST_LINE_FLAGS:
43059///         SetTrustLineFlagsResult setTrustLineFlagsResult;
43060///     case LIQUIDITY_POOL_DEPOSIT:
43061///         LiquidityPoolDepositResult liquidityPoolDepositResult;
43062///     case LIQUIDITY_POOL_WITHDRAW:
43063///         LiquidityPoolWithdrawResult liquidityPoolWithdrawResult;
43064///     case INVOKE_HOST_FUNCTION:
43065///         InvokeHostFunctionResult invokeHostFunctionResult;
43066///     case EXTEND_FOOTPRINT_TTL:
43067///         ExtendFootprintTTLResult extendFootprintTTLResult;
43068///     case RESTORE_FOOTPRINT:
43069///         RestoreFootprintResult restoreFootprintResult;
43070///     }
43071///     tr;
43072/// case opBAD_AUTH:
43073/// case opNO_ACCOUNT:
43074/// case opNOT_SUPPORTED:
43075/// case opTOO_MANY_SUBENTRIES:
43076/// case opEXCEEDED_WORK_LIMIT:
43077/// case opTOO_MANY_SPONSORING:
43078///     void;
43079/// };
43080/// ```
43081///
43082// union with discriminant OperationResultCode
43083#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
43084#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
43085#[cfg_attr(
43086    all(feature = "serde", feature = "alloc"),
43087    derive(serde::Serialize, serde::Deserialize),
43088    serde(rename_all = "snake_case")
43089)]
43090#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
43091#[allow(clippy::large_enum_variant)]
43092pub enum OperationResult {
43093    OpInner(OperationResultTr),
43094    OpBadAuth,
43095    OpNoAccount,
43096    OpNotSupported,
43097    OpTooManySubentries,
43098    OpExceededWorkLimit,
43099    OpTooManySponsoring,
43100}
43101
43102impl OperationResult {
43103    pub const VARIANTS: [OperationResultCode; 7] = [
43104        OperationResultCode::OpInner,
43105        OperationResultCode::OpBadAuth,
43106        OperationResultCode::OpNoAccount,
43107        OperationResultCode::OpNotSupported,
43108        OperationResultCode::OpTooManySubentries,
43109        OperationResultCode::OpExceededWorkLimit,
43110        OperationResultCode::OpTooManySponsoring,
43111    ];
43112    pub const VARIANTS_STR: [&'static str; 7] = [
43113        "OpInner",
43114        "OpBadAuth",
43115        "OpNoAccount",
43116        "OpNotSupported",
43117        "OpTooManySubentries",
43118        "OpExceededWorkLimit",
43119        "OpTooManySponsoring",
43120    ];
43121
43122    #[must_use]
43123    pub const fn name(&self) -> &'static str {
43124        match self {
43125            Self::OpInner(_) => "OpInner",
43126            Self::OpBadAuth => "OpBadAuth",
43127            Self::OpNoAccount => "OpNoAccount",
43128            Self::OpNotSupported => "OpNotSupported",
43129            Self::OpTooManySubentries => "OpTooManySubentries",
43130            Self::OpExceededWorkLimit => "OpExceededWorkLimit",
43131            Self::OpTooManySponsoring => "OpTooManySponsoring",
43132        }
43133    }
43134
43135    #[must_use]
43136    pub const fn discriminant(&self) -> OperationResultCode {
43137        #[allow(clippy::match_same_arms)]
43138        match self {
43139            Self::OpInner(_) => OperationResultCode::OpInner,
43140            Self::OpBadAuth => OperationResultCode::OpBadAuth,
43141            Self::OpNoAccount => OperationResultCode::OpNoAccount,
43142            Self::OpNotSupported => OperationResultCode::OpNotSupported,
43143            Self::OpTooManySubentries => OperationResultCode::OpTooManySubentries,
43144            Self::OpExceededWorkLimit => OperationResultCode::OpExceededWorkLimit,
43145            Self::OpTooManySponsoring => OperationResultCode::OpTooManySponsoring,
43146        }
43147    }
43148
43149    #[must_use]
43150    pub const fn variants() -> [OperationResultCode; 7] {
43151        Self::VARIANTS
43152    }
43153}
43154
43155impl Name for OperationResult {
43156    #[must_use]
43157    fn name(&self) -> &'static str {
43158        Self::name(self)
43159    }
43160}
43161
43162impl Discriminant<OperationResultCode> for OperationResult {
43163    #[must_use]
43164    fn discriminant(&self) -> OperationResultCode {
43165        Self::discriminant(self)
43166    }
43167}
43168
43169impl Variants<OperationResultCode> for OperationResult {
43170    fn variants() -> slice::Iter<'static, OperationResultCode> {
43171        Self::VARIANTS.iter()
43172    }
43173}
43174
43175impl Union<OperationResultCode> for OperationResult {}
43176
43177impl ReadXdr for OperationResult {
43178    #[cfg(feature = "std")]
43179    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
43180        r.with_limited_depth(|r| {
43181            let dv: OperationResultCode = <OperationResultCode as ReadXdr>::read_xdr(r)?;
43182            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
43183            let v = match dv {
43184                OperationResultCode::OpInner => Self::OpInner(OperationResultTr::read_xdr(r)?),
43185                OperationResultCode::OpBadAuth => Self::OpBadAuth,
43186                OperationResultCode::OpNoAccount => Self::OpNoAccount,
43187                OperationResultCode::OpNotSupported => Self::OpNotSupported,
43188                OperationResultCode::OpTooManySubentries => Self::OpTooManySubentries,
43189                OperationResultCode::OpExceededWorkLimit => Self::OpExceededWorkLimit,
43190                OperationResultCode::OpTooManySponsoring => Self::OpTooManySponsoring,
43191                #[allow(unreachable_patterns)]
43192                _ => return Err(Error::Invalid),
43193            };
43194            Ok(v)
43195        })
43196    }
43197}
43198
43199impl WriteXdr for OperationResult {
43200    #[cfg(feature = "std")]
43201    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
43202        w.with_limited_depth(|w| {
43203            self.discriminant().write_xdr(w)?;
43204            #[allow(clippy::match_same_arms)]
43205            match self {
43206                Self::OpInner(v) => v.write_xdr(w)?,
43207                Self::OpBadAuth => ().write_xdr(w)?,
43208                Self::OpNoAccount => ().write_xdr(w)?,
43209                Self::OpNotSupported => ().write_xdr(w)?,
43210                Self::OpTooManySubentries => ().write_xdr(w)?,
43211                Self::OpExceededWorkLimit => ().write_xdr(w)?,
43212                Self::OpTooManySponsoring => ().write_xdr(w)?,
43213            };
43214            Ok(())
43215        })
43216    }
43217}
43218
43219/// TransactionResultCode is an XDR Enum defines as:
43220///
43221/// ```text
43222/// enum TransactionResultCode
43223/// {
43224///     txFEE_BUMP_INNER_SUCCESS = 1, // fee bump inner transaction succeeded
43225///     txSUCCESS = 0,                // all operations succeeded
43226///
43227///     txFAILED = -1, // one of the operations failed (none were applied)
43228///
43229///     txTOO_EARLY = -2,         // ledger closeTime before minTime
43230///     txTOO_LATE = -3,          // ledger closeTime after maxTime
43231///     txMISSING_OPERATION = -4, // no operation was specified
43232///     txBAD_SEQ = -5,           // sequence number does not match source account
43233///
43234///     txBAD_AUTH = -6,             // too few valid signatures / wrong network
43235///     txINSUFFICIENT_BALANCE = -7, // fee would bring account below reserve
43236///     txNO_ACCOUNT = -8,           // source account not found
43237///     txINSUFFICIENT_FEE = -9,     // fee is too small
43238///     txBAD_AUTH_EXTRA = -10,      // unused signatures attached to transaction
43239///     txINTERNAL_ERROR = -11,      // an unknown error occurred
43240///
43241///     txNOT_SUPPORTED = -12,          // transaction type not supported
43242///     txFEE_BUMP_INNER_FAILED = -13,  // fee bump inner transaction failed
43243///     txBAD_SPONSORSHIP = -14,        // sponsorship not confirmed
43244///     txBAD_MIN_SEQ_AGE_OR_GAP = -15, // minSeqAge or minSeqLedgerGap conditions not met
43245///     txMALFORMED = -16,              // precondition is invalid
43246///     txSOROBAN_INVALID = -17         // soroban-specific preconditions were not met
43247/// };
43248/// ```
43249///
43250// enum
43251#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
43252#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
43253#[cfg_attr(
43254    all(feature = "serde", feature = "alloc"),
43255    derive(serde::Serialize, serde::Deserialize),
43256    serde(rename_all = "snake_case")
43257)]
43258#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
43259#[repr(i32)]
43260pub enum TransactionResultCode {
43261    TxFeeBumpInnerSuccess = 1,
43262    TxSuccess = 0,
43263    TxFailed = -1,
43264    TxTooEarly = -2,
43265    TxTooLate = -3,
43266    TxMissingOperation = -4,
43267    TxBadSeq = -5,
43268    TxBadAuth = -6,
43269    TxInsufficientBalance = -7,
43270    TxNoAccount = -8,
43271    TxInsufficientFee = -9,
43272    TxBadAuthExtra = -10,
43273    TxInternalError = -11,
43274    TxNotSupported = -12,
43275    TxFeeBumpInnerFailed = -13,
43276    TxBadSponsorship = -14,
43277    TxBadMinSeqAgeOrGap = -15,
43278    TxMalformed = -16,
43279    TxSorobanInvalid = -17,
43280}
43281
43282impl TransactionResultCode {
43283    pub const VARIANTS: [TransactionResultCode; 19] = [
43284        TransactionResultCode::TxFeeBumpInnerSuccess,
43285        TransactionResultCode::TxSuccess,
43286        TransactionResultCode::TxFailed,
43287        TransactionResultCode::TxTooEarly,
43288        TransactionResultCode::TxTooLate,
43289        TransactionResultCode::TxMissingOperation,
43290        TransactionResultCode::TxBadSeq,
43291        TransactionResultCode::TxBadAuth,
43292        TransactionResultCode::TxInsufficientBalance,
43293        TransactionResultCode::TxNoAccount,
43294        TransactionResultCode::TxInsufficientFee,
43295        TransactionResultCode::TxBadAuthExtra,
43296        TransactionResultCode::TxInternalError,
43297        TransactionResultCode::TxNotSupported,
43298        TransactionResultCode::TxFeeBumpInnerFailed,
43299        TransactionResultCode::TxBadSponsorship,
43300        TransactionResultCode::TxBadMinSeqAgeOrGap,
43301        TransactionResultCode::TxMalformed,
43302        TransactionResultCode::TxSorobanInvalid,
43303    ];
43304    pub const VARIANTS_STR: [&'static str; 19] = [
43305        "TxFeeBumpInnerSuccess",
43306        "TxSuccess",
43307        "TxFailed",
43308        "TxTooEarly",
43309        "TxTooLate",
43310        "TxMissingOperation",
43311        "TxBadSeq",
43312        "TxBadAuth",
43313        "TxInsufficientBalance",
43314        "TxNoAccount",
43315        "TxInsufficientFee",
43316        "TxBadAuthExtra",
43317        "TxInternalError",
43318        "TxNotSupported",
43319        "TxFeeBumpInnerFailed",
43320        "TxBadSponsorship",
43321        "TxBadMinSeqAgeOrGap",
43322        "TxMalformed",
43323        "TxSorobanInvalid",
43324    ];
43325
43326    #[must_use]
43327    pub const fn name(&self) -> &'static str {
43328        match self {
43329            Self::TxFeeBumpInnerSuccess => "TxFeeBumpInnerSuccess",
43330            Self::TxSuccess => "TxSuccess",
43331            Self::TxFailed => "TxFailed",
43332            Self::TxTooEarly => "TxTooEarly",
43333            Self::TxTooLate => "TxTooLate",
43334            Self::TxMissingOperation => "TxMissingOperation",
43335            Self::TxBadSeq => "TxBadSeq",
43336            Self::TxBadAuth => "TxBadAuth",
43337            Self::TxInsufficientBalance => "TxInsufficientBalance",
43338            Self::TxNoAccount => "TxNoAccount",
43339            Self::TxInsufficientFee => "TxInsufficientFee",
43340            Self::TxBadAuthExtra => "TxBadAuthExtra",
43341            Self::TxInternalError => "TxInternalError",
43342            Self::TxNotSupported => "TxNotSupported",
43343            Self::TxFeeBumpInnerFailed => "TxFeeBumpInnerFailed",
43344            Self::TxBadSponsorship => "TxBadSponsorship",
43345            Self::TxBadMinSeqAgeOrGap => "TxBadMinSeqAgeOrGap",
43346            Self::TxMalformed => "TxMalformed",
43347            Self::TxSorobanInvalid => "TxSorobanInvalid",
43348        }
43349    }
43350
43351    #[must_use]
43352    pub const fn variants() -> [TransactionResultCode; 19] {
43353        Self::VARIANTS
43354    }
43355}
43356
43357impl Name for TransactionResultCode {
43358    #[must_use]
43359    fn name(&self) -> &'static str {
43360        Self::name(self)
43361    }
43362}
43363
43364impl Variants<TransactionResultCode> for TransactionResultCode {
43365    fn variants() -> slice::Iter<'static, TransactionResultCode> {
43366        Self::VARIANTS.iter()
43367    }
43368}
43369
43370impl Enum for TransactionResultCode {}
43371
43372impl fmt::Display for TransactionResultCode {
43373    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
43374        f.write_str(self.name())
43375    }
43376}
43377
43378impl TryFrom<i32> for TransactionResultCode {
43379    type Error = Error;
43380
43381    fn try_from(i: i32) -> Result<Self> {
43382        let e = match i {
43383            1 => TransactionResultCode::TxFeeBumpInnerSuccess,
43384            0 => TransactionResultCode::TxSuccess,
43385            -1 => TransactionResultCode::TxFailed,
43386            -2 => TransactionResultCode::TxTooEarly,
43387            -3 => TransactionResultCode::TxTooLate,
43388            -4 => TransactionResultCode::TxMissingOperation,
43389            -5 => TransactionResultCode::TxBadSeq,
43390            -6 => TransactionResultCode::TxBadAuth,
43391            -7 => TransactionResultCode::TxInsufficientBalance,
43392            -8 => TransactionResultCode::TxNoAccount,
43393            -9 => TransactionResultCode::TxInsufficientFee,
43394            -10 => TransactionResultCode::TxBadAuthExtra,
43395            -11 => TransactionResultCode::TxInternalError,
43396            -12 => TransactionResultCode::TxNotSupported,
43397            -13 => TransactionResultCode::TxFeeBumpInnerFailed,
43398            -14 => TransactionResultCode::TxBadSponsorship,
43399            -15 => TransactionResultCode::TxBadMinSeqAgeOrGap,
43400            -16 => TransactionResultCode::TxMalformed,
43401            -17 => TransactionResultCode::TxSorobanInvalid,
43402            #[allow(unreachable_patterns)]
43403            _ => return Err(Error::Invalid),
43404        };
43405        Ok(e)
43406    }
43407}
43408
43409impl From<TransactionResultCode> for i32 {
43410    #[must_use]
43411    fn from(e: TransactionResultCode) -> Self {
43412        e as Self
43413    }
43414}
43415
43416impl ReadXdr for TransactionResultCode {
43417    #[cfg(feature = "std")]
43418    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
43419        r.with_limited_depth(|r| {
43420            let e = i32::read_xdr(r)?;
43421            let v: Self = e.try_into()?;
43422            Ok(v)
43423        })
43424    }
43425}
43426
43427impl WriteXdr for TransactionResultCode {
43428    #[cfg(feature = "std")]
43429    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
43430        w.with_limited_depth(|w| {
43431            let i: i32 = (*self).into();
43432            i.write_xdr(w)
43433        })
43434    }
43435}
43436
43437/// InnerTransactionResultResult is an XDR NestedUnion defines as:
43438///
43439/// ```text
43440/// union switch (TransactionResultCode code)
43441///     {
43442///     // txFEE_BUMP_INNER_SUCCESS is not included
43443///     case txSUCCESS:
43444///     case txFAILED:
43445///         OperationResult results<>;
43446///     case txTOO_EARLY:
43447///     case txTOO_LATE:
43448///     case txMISSING_OPERATION:
43449///     case txBAD_SEQ:
43450///     case txBAD_AUTH:
43451///     case txINSUFFICIENT_BALANCE:
43452///     case txNO_ACCOUNT:
43453///     case txINSUFFICIENT_FEE:
43454///     case txBAD_AUTH_EXTRA:
43455///     case txINTERNAL_ERROR:
43456///     case txNOT_SUPPORTED:
43457///     // txFEE_BUMP_INNER_FAILED is not included
43458///     case txBAD_SPONSORSHIP:
43459///     case txBAD_MIN_SEQ_AGE_OR_GAP:
43460///     case txMALFORMED:
43461///     case txSOROBAN_INVALID:
43462///         void;
43463///     }
43464/// ```
43465///
43466// union with discriminant TransactionResultCode
43467#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
43468#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
43469#[cfg_attr(
43470    all(feature = "serde", feature = "alloc"),
43471    derive(serde::Serialize, serde::Deserialize),
43472    serde(rename_all = "snake_case")
43473)]
43474#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
43475#[allow(clippy::large_enum_variant)]
43476pub enum InnerTransactionResultResult {
43477    TxSuccess(VecM<OperationResult>),
43478    TxFailed(VecM<OperationResult>),
43479    TxTooEarly,
43480    TxTooLate,
43481    TxMissingOperation,
43482    TxBadSeq,
43483    TxBadAuth,
43484    TxInsufficientBalance,
43485    TxNoAccount,
43486    TxInsufficientFee,
43487    TxBadAuthExtra,
43488    TxInternalError,
43489    TxNotSupported,
43490    TxBadSponsorship,
43491    TxBadMinSeqAgeOrGap,
43492    TxMalformed,
43493    TxSorobanInvalid,
43494}
43495
43496impl InnerTransactionResultResult {
43497    pub const VARIANTS: [TransactionResultCode; 17] = [
43498        TransactionResultCode::TxSuccess,
43499        TransactionResultCode::TxFailed,
43500        TransactionResultCode::TxTooEarly,
43501        TransactionResultCode::TxTooLate,
43502        TransactionResultCode::TxMissingOperation,
43503        TransactionResultCode::TxBadSeq,
43504        TransactionResultCode::TxBadAuth,
43505        TransactionResultCode::TxInsufficientBalance,
43506        TransactionResultCode::TxNoAccount,
43507        TransactionResultCode::TxInsufficientFee,
43508        TransactionResultCode::TxBadAuthExtra,
43509        TransactionResultCode::TxInternalError,
43510        TransactionResultCode::TxNotSupported,
43511        TransactionResultCode::TxBadSponsorship,
43512        TransactionResultCode::TxBadMinSeqAgeOrGap,
43513        TransactionResultCode::TxMalformed,
43514        TransactionResultCode::TxSorobanInvalid,
43515    ];
43516    pub const VARIANTS_STR: [&'static str; 17] = [
43517        "TxSuccess",
43518        "TxFailed",
43519        "TxTooEarly",
43520        "TxTooLate",
43521        "TxMissingOperation",
43522        "TxBadSeq",
43523        "TxBadAuth",
43524        "TxInsufficientBalance",
43525        "TxNoAccount",
43526        "TxInsufficientFee",
43527        "TxBadAuthExtra",
43528        "TxInternalError",
43529        "TxNotSupported",
43530        "TxBadSponsorship",
43531        "TxBadMinSeqAgeOrGap",
43532        "TxMalformed",
43533        "TxSorobanInvalid",
43534    ];
43535
43536    #[must_use]
43537    pub const fn name(&self) -> &'static str {
43538        match self {
43539            Self::TxSuccess(_) => "TxSuccess",
43540            Self::TxFailed(_) => "TxFailed",
43541            Self::TxTooEarly => "TxTooEarly",
43542            Self::TxTooLate => "TxTooLate",
43543            Self::TxMissingOperation => "TxMissingOperation",
43544            Self::TxBadSeq => "TxBadSeq",
43545            Self::TxBadAuth => "TxBadAuth",
43546            Self::TxInsufficientBalance => "TxInsufficientBalance",
43547            Self::TxNoAccount => "TxNoAccount",
43548            Self::TxInsufficientFee => "TxInsufficientFee",
43549            Self::TxBadAuthExtra => "TxBadAuthExtra",
43550            Self::TxInternalError => "TxInternalError",
43551            Self::TxNotSupported => "TxNotSupported",
43552            Self::TxBadSponsorship => "TxBadSponsorship",
43553            Self::TxBadMinSeqAgeOrGap => "TxBadMinSeqAgeOrGap",
43554            Self::TxMalformed => "TxMalformed",
43555            Self::TxSorobanInvalid => "TxSorobanInvalid",
43556        }
43557    }
43558
43559    #[must_use]
43560    pub const fn discriminant(&self) -> TransactionResultCode {
43561        #[allow(clippy::match_same_arms)]
43562        match self {
43563            Self::TxSuccess(_) => TransactionResultCode::TxSuccess,
43564            Self::TxFailed(_) => TransactionResultCode::TxFailed,
43565            Self::TxTooEarly => TransactionResultCode::TxTooEarly,
43566            Self::TxTooLate => TransactionResultCode::TxTooLate,
43567            Self::TxMissingOperation => TransactionResultCode::TxMissingOperation,
43568            Self::TxBadSeq => TransactionResultCode::TxBadSeq,
43569            Self::TxBadAuth => TransactionResultCode::TxBadAuth,
43570            Self::TxInsufficientBalance => TransactionResultCode::TxInsufficientBalance,
43571            Self::TxNoAccount => TransactionResultCode::TxNoAccount,
43572            Self::TxInsufficientFee => TransactionResultCode::TxInsufficientFee,
43573            Self::TxBadAuthExtra => TransactionResultCode::TxBadAuthExtra,
43574            Self::TxInternalError => TransactionResultCode::TxInternalError,
43575            Self::TxNotSupported => TransactionResultCode::TxNotSupported,
43576            Self::TxBadSponsorship => TransactionResultCode::TxBadSponsorship,
43577            Self::TxBadMinSeqAgeOrGap => TransactionResultCode::TxBadMinSeqAgeOrGap,
43578            Self::TxMalformed => TransactionResultCode::TxMalformed,
43579            Self::TxSorobanInvalid => TransactionResultCode::TxSorobanInvalid,
43580        }
43581    }
43582
43583    #[must_use]
43584    pub const fn variants() -> [TransactionResultCode; 17] {
43585        Self::VARIANTS
43586    }
43587}
43588
43589impl Name for InnerTransactionResultResult {
43590    #[must_use]
43591    fn name(&self) -> &'static str {
43592        Self::name(self)
43593    }
43594}
43595
43596impl Discriminant<TransactionResultCode> for InnerTransactionResultResult {
43597    #[must_use]
43598    fn discriminant(&self) -> TransactionResultCode {
43599        Self::discriminant(self)
43600    }
43601}
43602
43603impl Variants<TransactionResultCode> for InnerTransactionResultResult {
43604    fn variants() -> slice::Iter<'static, TransactionResultCode> {
43605        Self::VARIANTS.iter()
43606    }
43607}
43608
43609impl Union<TransactionResultCode> for InnerTransactionResultResult {}
43610
43611impl ReadXdr for InnerTransactionResultResult {
43612    #[cfg(feature = "std")]
43613    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
43614        r.with_limited_depth(|r| {
43615            let dv: TransactionResultCode = <TransactionResultCode as ReadXdr>::read_xdr(r)?;
43616            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
43617            let v = match dv {
43618                TransactionResultCode::TxSuccess => {
43619                    Self::TxSuccess(VecM::<OperationResult>::read_xdr(r)?)
43620                }
43621                TransactionResultCode::TxFailed => {
43622                    Self::TxFailed(VecM::<OperationResult>::read_xdr(r)?)
43623                }
43624                TransactionResultCode::TxTooEarly => Self::TxTooEarly,
43625                TransactionResultCode::TxTooLate => Self::TxTooLate,
43626                TransactionResultCode::TxMissingOperation => Self::TxMissingOperation,
43627                TransactionResultCode::TxBadSeq => Self::TxBadSeq,
43628                TransactionResultCode::TxBadAuth => Self::TxBadAuth,
43629                TransactionResultCode::TxInsufficientBalance => Self::TxInsufficientBalance,
43630                TransactionResultCode::TxNoAccount => Self::TxNoAccount,
43631                TransactionResultCode::TxInsufficientFee => Self::TxInsufficientFee,
43632                TransactionResultCode::TxBadAuthExtra => Self::TxBadAuthExtra,
43633                TransactionResultCode::TxInternalError => Self::TxInternalError,
43634                TransactionResultCode::TxNotSupported => Self::TxNotSupported,
43635                TransactionResultCode::TxBadSponsorship => Self::TxBadSponsorship,
43636                TransactionResultCode::TxBadMinSeqAgeOrGap => Self::TxBadMinSeqAgeOrGap,
43637                TransactionResultCode::TxMalformed => Self::TxMalformed,
43638                TransactionResultCode::TxSorobanInvalid => Self::TxSorobanInvalid,
43639                #[allow(unreachable_patterns)]
43640                _ => return Err(Error::Invalid),
43641            };
43642            Ok(v)
43643        })
43644    }
43645}
43646
43647impl WriteXdr for InnerTransactionResultResult {
43648    #[cfg(feature = "std")]
43649    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
43650        w.with_limited_depth(|w| {
43651            self.discriminant().write_xdr(w)?;
43652            #[allow(clippy::match_same_arms)]
43653            match self {
43654                Self::TxSuccess(v) => v.write_xdr(w)?,
43655                Self::TxFailed(v) => v.write_xdr(w)?,
43656                Self::TxTooEarly => ().write_xdr(w)?,
43657                Self::TxTooLate => ().write_xdr(w)?,
43658                Self::TxMissingOperation => ().write_xdr(w)?,
43659                Self::TxBadSeq => ().write_xdr(w)?,
43660                Self::TxBadAuth => ().write_xdr(w)?,
43661                Self::TxInsufficientBalance => ().write_xdr(w)?,
43662                Self::TxNoAccount => ().write_xdr(w)?,
43663                Self::TxInsufficientFee => ().write_xdr(w)?,
43664                Self::TxBadAuthExtra => ().write_xdr(w)?,
43665                Self::TxInternalError => ().write_xdr(w)?,
43666                Self::TxNotSupported => ().write_xdr(w)?,
43667                Self::TxBadSponsorship => ().write_xdr(w)?,
43668                Self::TxBadMinSeqAgeOrGap => ().write_xdr(w)?,
43669                Self::TxMalformed => ().write_xdr(w)?,
43670                Self::TxSorobanInvalid => ().write_xdr(w)?,
43671            };
43672            Ok(())
43673        })
43674    }
43675}
43676
43677/// InnerTransactionResultExt is an XDR NestedUnion defines as:
43678///
43679/// ```text
43680/// union switch (int v)
43681///     {
43682///     case 0:
43683///         void;
43684///     }
43685/// ```
43686///
43687// union with discriminant i32
43688#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
43689#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
43690#[cfg_attr(
43691    all(feature = "serde", feature = "alloc"),
43692    derive(serde::Serialize, serde::Deserialize),
43693    serde(rename_all = "snake_case")
43694)]
43695#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
43696#[allow(clippy::large_enum_variant)]
43697pub enum InnerTransactionResultExt {
43698    V0,
43699}
43700
43701impl InnerTransactionResultExt {
43702    pub const VARIANTS: [i32; 1] = [0];
43703    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
43704
43705    #[must_use]
43706    pub const fn name(&self) -> &'static str {
43707        match self {
43708            Self::V0 => "V0",
43709        }
43710    }
43711
43712    #[must_use]
43713    pub const fn discriminant(&self) -> i32 {
43714        #[allow(clippy::match_same_arms)]
43715        match self {
43716            Self::V0 => 0,
43717        }
43718    }
43719
43720    #[must_use]
43721    pub const fn variants() -> [i32; 1] {
43722        Self::VARIANTS
43723    }
43724}
43725
43726impl Name for InnerTransactionResultExt {
43727    #[must_use]
43728    fn name(&self) -> &'static str {
43729        Self::name(self)
43730    }
43731}
43732
43733impl Discriminant<i32> for InnerTransactionResultExt {
43734    #[must_use]
43735    fn discriminant(&self) -> i32 {
43736        Self::discriminant(self)
43737    }
43738}
43739
43740impl Variants<i32> for InnerTransactionResultExt {
43741    fn variants() -> slice::Iter<'static, i32> {
43742        Self::VARIANTS.iter()
43743    }
43744}
43745
43746impl Union<i32> for InnerTransactionResultExt {}
43747
43748impl ReadXdr for InnerTransactionResultExt {
43749    #[cfg(feature = "std")]
43750    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
43751        r.with_limited_depth(|r| {
43752            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
43753            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
43754            let v = match dv {
43755                0 => Self::V0,
43756                #[allow(unreachable_patterns)]
43757                _ => return Err(Error::Invalid),
43758            };
43759            Ok(v)
43760        })
43761    }
43762}
43763
43764impl WriteXdr for InnerTransactionResultExt {
43765    #[cfg(feature = "std")]
43766    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
43767        w.with_limited_depth(|w| {
43768            self.discriminant().write_xdr(w)?;
43769            #[allow(clippy::match_same_arms)]
43770            match self {
43771                Self::V0 => ().write_xdr(w)?,
43772            };
43773            Ok(())
43774        })
43775    }
43776}
43777
43778/// InnerTransactionResult is an XDR Struct defines as:
43779///
43780/// ```text
43781/// struct InnerTransactionResult
43782/// {
43783///     // Always 0. Here for binary compatibility.
43784///     int64 feeCharged;
43785///
43786///     union switch (TransactionResultCode code)
43787///     {
43788///     // txFEE_BUMP_INNER_SUCCESS is not included
43789///     case txSUCCESS:
43790///     case txFAILED:
43791///         OperationResult results<>;
43792///     case txTOO_EARLY:
43793///     case txTOO_LATE:
43794///     case txMISSING_OPERATION:
43795///     case txBAD_SEQ:
43796///     case txBAD_AUTH:
43797///     case txINSUFFICIENT_BALANCE:
43798///     case txNO_ACCOUNT:
43799///     case txINSUFFICIENT_FEE:
43800///     case txBAD_AUTH_EXTRA:
43801///     case txINTERNAL_ERROR:
43802///     case txNOT_SUPPORTED:
43803///     // txFEE_BUMP_INNER_FAILED is not included
43804///     case txBAD_SPONSORSHIP:
43805///     case txBAD_MIN_SEQ_AGE_OR_GAP:
43806///     case txMALFORMED:
43807///     case txSOROBAN_INVALID:
43808///         void;
43809///     }
43810///     result;
43811///
43812///     // reserved for future use
43813///     union switch (int v)
43814///     {
43815///     case 0:
43816///         void;
43817///     }
43818///     ext;
43819/// };
43820/// ```
43821///
43822#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
43823#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
43824#[cfg_attr(
43825    all(feature = "serde", feature = "alloc"),
43826    derive(serde::Serialize, serde::Deserialize),
43827    serde(rename_all = "snake_case")
43828)]
43829#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
43830pub struct InnerTransactionResult {
43831    pub fee_charged: i64,
43832    pub result: InnerTransactionResultResult,
43833    pub ext: InnerTransactionResultExt,
43834}
43835
43836impl ReadXdr for InnerTransactionResult {
43837    #[cfg(feature = "std")]
43838    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
43839        r.with_limited_depth(|r| {
43840            Ok(Self {
43841                fee_charged: i64::read_xdr(r)?,
43842                result: InnerTransactionResultResult::read_xdr(r)?,
43843                ext: InnerTransactionResultExt::read_xdr(r)?,
43844            })
43845        })
43846    }
43847}
43848
43849impl WriteXdr for InnerTransactionResult {
43850    #[cfg(feature = "std")]
43851    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
43852        w.with_limited_depth(|w| {
43853            self.fee_charged.write_xdr(w)?;
43854            self.result.write_xdr(w)?;
43855            self.ext.write_xdr(w)?;
43856            Ok(())
43857        })
43858    }
43859}
43860
43861/// InnerTransactionResultPair is an XDR Struct defines as:
43862///
43863/// ```text
43864/// struct InnerTransactionResultPair
43865/// {
43866///     Hash transactionHash;          // hash of the inner transaction
43867///     InnerTransactionResult result; // result for the inner transaction
43868/// };
43869/// ```
43870///
43871#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
43872#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
43873#[cfg_attr(
43874    all(feature = "serde", feature = "alloc"),
43875    derive(serde::Serialize, serde::Deserialize),
43876    serde(rename_all = "snake_case")
43877)]
43878#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
43879pub struct InnerTransactionResultPair {
43880    pub transaction_hash: Hash,
43881    pub result: InnerTransactionResult,
43882}
43883
43884impl ReadXdr for InnerTransactionResultPair {
43885    #[cfg(feature = "std")]
43886    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
43887        r.with_limited_depth(|r| {
43888            Ok(Self {
43889                transaction_hash: Hash::read_xdr(r)?,
43890                result: InnerTransactionResult::read_xdr(r)?,
43891            })
43892        })
43893    }
43894}
43895
43896impl WriteXdr for InnerTransactionResultPair {
43897    #[cfg(feature = "std")]
43898    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
43899        w.with_limited_depth(|w| {
43900            self.transaction_hash.write_xdr(w)?;
43901            self.result.write_xdr(w)?;
43902            Ok(())
43903        })
43904    }
43905}
43906
43907/// TransactionResultResult is an XDR NestedUnion defines as:
43908///
43909/// ```text
43910/// union switch (TransactionResultCode code)
43911///     {
43912///     case txFEE_BUMP_INNER_SUCCESS:
43913///     case txFEE_BUMP_INNER_FAILED:
43914///         InnerTransactionResultPair innerResultPair;
43915///     case txSUCCESS:
43916///     case txFAILED:
43917///         OperationResult results<>;
43918///     case txTOO_EARLY:
43919///     case txTOO_LATE:
43920///     case txMISSING_OPERATION:
43921///     case txBAD_SEQ:
43922///     case txBAD_AUTH:
43923///     case txINSUFFICIENT_BALANCE:
43924///     case txNO_ACCOUNT:
43925///     case txINSUFFICIENT_FEE:
43926///     case txBAD_AUTH_EXTRA:
43927///     case txINTERNAL_ERROR:
43928///     case txNOT_SUPPORTED:
43929///     // case txFEE_BUMP_INNER_FAILED: handled above
43930///     case txBAD_SPONSORSHIP:
43931///     case txBAD_MIN_SEQ_AGE_OR_GAP:
43932///     case txMALFORMED:
43933///     case txSOROBAN_INVALID:
43934///         void;
43935///     }
43936/// ```
43937///
43938// union with discriminant TransactionResultCode
43939#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
43940#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
43941#[cfg_attr(
43942    all(feature = "serde", feature = "alloc"),
43943    derive(serde::Serialize, serde::Deserialize),
43944    serde(rename_all = "snake_case")
43945)]
43946#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
43947#[allow(clippy::large_enum_variant)]
43948pub enum TransactionResultResult {
43949    TxFeeBumpInnerSuccess(InnerTransactionResultPair),
43950    TxFeeBumpInnerFailed(InnerTransactionResultPair),
43951    TxSuccess(VecM<OperationResult>),
43952    TxFailed(VecM<OperationResult>),
43953    TxTooEarly,
43954    TxTooLate,
43955    TxMissingOperation,
43956    TxBadSeq,
43957    TxBadAuth,
43958    TxInsufficientBalance,
43959    TxNoAccount,
43960    TxInsufficientFee,
43961    TxBadAuthExtra,
43962    TxInternalError,
43963    TxNotSupported,
43964    TxBadSponsorship,
43965    TxBadMinSeqAgeOrGap,
43966    TxMalformed,
43967    TxSorobanInvalid,
43968}
43969
43970impl TransactionResultResult {
43971    pub const VARIANTS: [TransactionResultCode; 19] = [
43972        TransactionResultCode::TxFeeBumpInnerSuccess,
43973        TransactionResultCode::TxFeeBumpInnerFailed,
43974        TransactionResultCode::TxSuccess,
43975        TransactionResultCode::TxFailed,
43976        TransactionResultCode::TxTooEarly,
43977        TransactionResultCode::TxTooLate,
43978        TransactionResultCode::TxMissingOperation,
43979        TransactionResultCode::TxBadSeq,
43980        TransactionResultCode::TxBadAuth,
43981        TransactionResultCode::TxInsufficientBalance,
43982        TransactionResultCode::TxNoAccount,
43983        TransactionResultCode::TxInsufficientFee,
43984        TransactionResultCode::TxBadAuthExtra,
43985        TransactionResultCode::TxInternalError,
43986        TransactionResultCode::TxNotSupported,
43987        TransactionResultCode::TxBadSponsorship,
43988        TransactionResultCode::TxBadMinSeqAgeOrGap,
43989        TransactionResultCode::TxMalformed,
43990        TransactionResultCode::TxSorobanInvalid,
43991    ];
43992    pub const VARIANTS_STR: [&'static str; 19] = [
43993        "TxFeeBumpInnerSuccess",
43994        "TxFeeBumpInnerFailed",
43995        "TxSuccess",
43996        "TxFailed",
43997        "TxTooEarly",
43998        "TxTooLate",
43999        "TxMissingOperation",
44000        "TxBadSeq",
44001        "TxBadAuth",
44002        "TxInsufficientBalance",
44003        "TxNoAccount",
44004        "TxInsufficientFee",
44005        "TxBadAuthExtra",
44006        "TxInternalError",
44007        "TxNotSupported",
44008        "TxBadSponsorship",
44009        "TxBadMinSeqAgeOrGap",
44010        "TxMalformed",
44011        "TxSorobanInvalid",
44012    ];
44013
44014    #[must_use]
44015    pub const fn name(&self) -> &'static str {
44016        match self {
44017            Self::TxFeeBumpInnerSuccess(_) => "TxFeeBumpInnerSuccess",
44018            Self::TxFeeBumpInnerFailed(_) => "TxFeeBumpInnerFailed",
44019            Self::TxSuccess(_) => "TxSuccess",
44020            Self::TxFailed(_) => "TxFailed",
44021            Self::TxTooEarly => "TxTooEarly",
44022            Self::TxTooLate => "TxTooLate",
44023            Self::TxMissingOperation => "TxMissingOperation",
44024            Self::TxBadSeq => "TxBadSeq",
44025            Self::TxBadAuth => "TxBadAuth",
44026            Self::TxInsufficientBalance => "TxInsufficientBalance",
44027            Self::TxNoAccount => "TxNoAccount",
44028            Self::TxInsufficientFee => "TxInsufficientFee",
44029            Self::TxBadAuthExtra => "TxBadAuthExtra",
44030            Self::TxInternalError => "TxInternalError",
44031            Self::TxNotSupported => "TxNotSupported",
44032            Self::TxBadSponsorship => "TxBadSponsorship",
44033            Self::TxBadMinSeqAgeOrGap => "TxBadMinSeqAgeOrGap",
44034            Self::TxMalformed => "TxMalformed",
44035            Self::TxSorobanInvalid => "TxSorobanInvalid",
44036        }
44037    }
44038
44039    #[must_use]
44040    pub const fn discriminant(&self) -> TransactionResultCode {
44041        #[allow(clippy::match_same_arms)]
44042        match self {
44043            Self::TxFeeBumpInnerSuccess(_) => TransactionResultCode::TxFeeBumpInnerSuccess,
44044            Self::TxFeeBumpInnerFailed(_) => TransactionResultCode::TxFeeBumpInnerFailed,
44045            Self::TxSuccess(_) => TransactionResultCode::TxSuccess,
44046            Self::TxFailed(_) => TransactionResultCode::TxFailed,
44047            Self::TxTooEarly => TransactionResultCode::TxTooEarly,
44048            Self::TxTooLate => TransactionResultCode::TxTooLate,
44049            Self::TxMissingOperation => TransactionResultCode::TxMissingOperation,
44050            Self::TxBadSeq => TransactionResultCode::TxBadSeq,
44051            Self::TxBadAuth => TransactionResultCode::TxBadAuth,
44052            Self::TxInsufficientBalance => TransactionResultCode::TxInsufficientBalance,
44053            Self::TxNoAccount => TransactionResultCode::TxNoAccount,
44054            Self::TxInsufficientFee => TransactionResultCode::TxInsufficientFee,
44055            Self::TxBadAuthExtra => TransactionResultCode::TxBadAuthExtra,
44056            Self::TxInternalError => TransactionResultCode::TxInternalError,
44057            Self::TxNotSupported => TransactionResultCode::TxNotSupported,
44058            Self::TxBadSponsorship => TransactionResultCode::TxBadSponsorship,
44059            Self::TxBadMinSeqAgeOrGap => TransactionResultCode::TxBadMinSeqAgeOrGap,
44060            Self::TxMalformed => TransactionResultCode::TxMalformed,
44061            Self::TxSorobanInvalid => TransactionResultCode::TxSorobanInvalid,
44062        }
44063    }
44064
44065    #[must_use]
44066    pub const fn variants() -> [TransactionResultCode; 19] {
44067        Self::VARIANTS
44068    }
44069}
44070
44071impl Name for TransactionResultResult {
44072    #[must_use]
44073    fn name(&self) -> &'static str {
44074        Self::name(self)
44075    }
44076}
44077
44078impl Discriminant<TransactionResultCode> for TransactionResultResult {
44079    #[must_use]
44080    fn discriminant(&self) -> TransactionResultCode {
44081        Self::discriminant(self)
44082    }
44083}
44084
44085impl Variants<TransactionResultCode> for TransactionResultResult {
44086    fn variants() -> slice::Iter<'static, TransactionResultCode> {
44087        Self::VARIANTS.iter()
44088    }
44089}
44090
44091impl Union<TransactionResultCode> for TransactionResultResult {}
44092
44093impl ReadXdr for TransactionResultResult {
44094    #[cfg(feature = "std")]
44095    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
44096        r.with_limited_depth(|r| {
44097            let dv: TransactionResultCode = <TransactionResultCode as ReadXdr>::read_xdr(r)?;
44098            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
44099            let v = match dv {
44100                TransactionResultCode::TxFeeBumpInnerSuccess => {
44101                    Self::TxFeeBumpInnerSuccess(InnerTransactionResultPair::read_xdr(r)?)
44102                }
44103                TransactionResultCode::TxFeeBumpInnerFailed => {
44104                    Self::TxFeeBumpInnerFailed(InnerTransactionResultPair::read_xdr(r)?)
44105                }
44106                TransactionResultCode::TxSuccess => {
44107                    Self::TxSuccess(VecM::<OperationResult>::read_xdr(r)?)
44108                }
44109                TransactionResultCode::TxFailed => {
44110                    Self::TxFailed(VecM::<OperationResult>::read_xdr(r)?)
44111                }
44112                TransactionResultCode::TxTooEarly => Self::TxTooEarly,
44113                TransactionResultCode::TxTooLate => Self::TxTooLate,
44114                TransactionResultCode::TxMissingOperation => Self::TxMissingOperation,
44115                TransactionResultCode::TxBadSeq => Self::TxBadSeq,
44116                TransactionResultCode::TxBadAuth => Self::TxBadAuth,
44117                TransactionResultCode::TxInsufficientBalance => Self::TxInsufficientBalance,
44118                TransactionResultCode::TxNoAccount => Self::TxNoAccount,
44119                TransactionResultCode::TxInsufficientFee => Self::TxInsufficientFee,
44120                TransactionResultCode::TxBadAuthExtra => Self::TxBadAuthExtra,
44121                TransactionResultCode::TxInternalError => Self::TxInternalError,
44122                TransactionResultCode::TxNotSupported => Self::TxNotSupported,
44123                TransactionResultCode::TxBadSponsorship => Self::TxBadSponsorship,
44124                TransactionResultCode::TxBadMinSeqAgeOrGap => Self::TxBadMinSeqAgeOrGap,
44125                TransactionResultCode::TxMalformed => Self::TxMalformed,
44126                TransactionResultCode::TxSorobanInvalid => Self::TxSorobanInvalid,
44127                #[allow(unreachable_patterns)]
44128                _ => return Err(Error::Invalid),
44129            };
44130            Ok(v)
44131        })
44132    }
44133}
44134
44135impl WriteXdr for TransactionResultResult {
44136    #[cfg(feature = "std")]
44137    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
44138        w.with_limited_depth(|w| {
44139            self.discriminant().write_xdr(w)?;
44140            #[allow(clippy::match_same_arms)]
44141            match self {
44142                Self::TxFeeBumpInnerSuccess(v) => v.write_xdr(w)?,
44143                Self::TxFeeBumpInnerFailed(v) => v.write_xdr(w)?,
44144                Self::TxSuccess(v) => v.write_xdr(w)?,
44145                Self::TxFailed(v) => v.write_xdr(w)?,
44146                Self::TxTooEarly => ().write_xdr(w)?,
44147                Self::TxTooLate => ().write_xdr(w)?,
44148                Self::TxMissingOperation => ().write_xdr(w)?,
44149                Self::TxBadSeq => ().write_xdr(w)?,
44150                Self::TxBadAuth => ().write_xdr(w)?,
44151                Self::TxInsufficientBalance => ().write_xdr(w)?,
44152                Self::TxNoAccount => ().write_xdr(w)?,
44153                Self::TxInsufficientFee => ().write_xdr(w)?,
44154                Self::TxBadAuthExtra => ().write_xdr(w)?,
44155                Self::TxInternalError => ().write_xdr(w)?,
44156                Self::TxNotSupported => ().write_xdr(w)?,
44157                Self::TxBadSponsorship => ().write_xdr(w)?,
44158                Self::TxBadMinSeqAgeOrGap => ().write_xdr(w)?,
44159                Self::TxMalformed => ().write_xdr(w)?,
44160                Self::TxSorobanInvalid => ().write_xdr(w)?,
44161            };
44162            Ok(())
44163        })
44164    }
44165}
44166
44167/// TransactionResultExt is an XDR NestedUnion defines as:
44168///
44169/// ```text
44170/// union switch (int v)
44171///     {
44172///     case 0:
44173///         void;
44174///     }
44175/// ```
44176///
44177// union with discriminant i32
44178#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
44179#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
44180#[cfg_attr(
44181    all(feature = "serde", feature = "alloc"),
44182    derive(serde::Serialize, serde::Deserialize),
44183    serde(rename_all = "snake_case")
44184)]
44185#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
44186#[allow(clippy::large_enum_variant)]
44187pub enum TransactionResultExt {
44188    V0,
44189}
44190
44191impl TransactionResultExt {
44192    pub const VARIANTS: [i32; 1] = [0];
44193    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
44194
44195    #[must_use]
44196    pub const fn name(&self) -> &'static str {
44197        match self {
44198            Self::V0 => "V0",
44199        }
44200    }
44201
44202    #[must_use]
44203    pub const fn discriminant(&self) -> i32 {
44204        #[allow(clippy::match_same_arms)]
44205        match self {
44206            Self::V0 => 0,
44207        }
44208    }
44209
44210    #[must_use]
44211    pub const fn variants() -> [i32; 1] {
44212        Self::VARIANTS
44213    }
44214}
44215
44216impl Name for TransactionResultExt {
44217    #[must_use]
44218    fn name(&self) -> &'static str {
44219        Self::name(self)
44220    }
44221}
44222
44223impl Discriminant<i32> for TransactionResultExt {
44224    #[must_use]
44225    fn discriminant(&self) -> i32 {
44226        Self::discriminant(self)
44227    }
44228}
44229
44230impl Variants<i32> for TransactionResultExt {
44231    fn variants() -> slice::Iter<'static, i32> {
44232        Self::VARIANTS.iter()
44233    }
44234}
44235
44236impl Union<i32> for TransactionResultExt {}
44237
44238impl ReadXdr for TransactionResultExt {
44239    #[cfg(feature = "std")]
44240    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
44241        r.with_limited_depth(|r| {
44242            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
44243            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
44244            let v = match dv {
44245                0 => Self::V0,
44246                #[allow(unreachable_patterns)]
44247                _ => return Err(Error::Invalid),
44248            };
44249            Ok(v)
44250        })
44251    }
44252}
44253
44254impl WriteXdr for TransactionResultExt {
44255    #[cfg(feature = "std")]
44256    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
44257        w.with_limited_depth(|w| {
44258            self.discriminant().write_xdr(w)?;
44259            #[allow(clippy::match_same_arms)]
44260            match self {
44261                Self::V0 => ().write_xdr(w)?,
44262            };
44263            Ok(())
44264        })
44265    }
44266}
44267
44268/// TransactionResult is an XDR Struct defines as:
44269///
44270/// ```text
44271/// struct TransactionResult
44272/// {
44273///     int64 feeCharged; // actual fee charged for the transaction
44274///
44275///     union switch (TransactionResultCode code)
44276///     {
44277///     case txFEE_BUMP_INNER_SUCCESS:
44278///     case txFEE_BUMP_INNER_FAILED:
44279///         InnerTransactionResultPair innerResultPair;
44280///     case txSUCCESS:
44281///     case txFAILED:
44282///         OperationResult results<>;
44283///     case txTOO_EARLY:
44284///     case txTOO_LATE:
44285///     case txMISSING_OPERATION:
44286///     case txBAD_SEQ:
44287///     case txBAD_AUTH:
44288///     case txINSUFFICIENT_BALANCE:
44289///     case txNO_ACCOUNT:
44290///     case txINSUFFICIENT_FEE:
44291///     case txBAD_AUTH_EXTRA:
44292///     case txINTERNAL_ERROR:
44293///     case txNOT_SUPPORTED:
44294///     // case txFEE_BUMP_INNER_FAILED: handled above
44295///     case txBAD_SPONSORSHIP:
44296///     case txBAD_MIN_SEQ_AGE_OR_GAP:
44297///     case txMALFORMED:
44298///     case txSOROBAN_INVALID:
44299///         void;
44300///     }
44301///     result;
44302///
44303///     // reserved for future use
44304///     union switch (int v)
44305///     {
44306///     case 0:
44307///         void;
44308///     }
44309///     ext;
44310/// };
44311/// ```
44312///
44313#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
44314#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
44315#[cfg_attr(
44316    all(feature = "serde", feature = "alloc"),
44317    derive(serde::Serialize, serde::Deserialize),
44318    serde(rename_all = "snake_case")
44319)]
44320#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
44321pub struct TransactionResult {
44322    pub fee_charged: i64,
44323    pub result: TransactionResultResult,
44324    pub ext: TransactionResultExt,
44325}
44326
44327impl ReadXdr for TransactionResult {
44328    #[cfg(feature = "std")]
44329    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
44330        r.with_limited_depth(|r| {
44331            Ok(Self {
44332                fee_charged: i64::read_xdr(r)?,
44333                result: TransactionResultResult::read_xdr(r)?,
44334                ext: TransactionResultExt::read_xdr(r)?,
44335            })
44336        })
44337    }
44338}
44339
44340impl WriteXdr for TransactionResult {
44341    #[cfg(feature = "std")]
44342    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
44343        w.with_limited_depth(|w| {
44344            self.fee_charged.write_xdr(w)?;
44345            self.result.write_xdr(w)?;
44346            self.ext.write_xdr(w)?;
44347            Ok(())
44348        })
44349    }
44350}
44351
44352/// Hash is an XDR Typedef defines as:
44353///
44354/// ```text
44355/// typedef opaque Hash[32];
44356/// ```
44357///
44358#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
44359#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
44360#[cfg_attr(
44361    all(feature = "serde", feature = "alloc"),
44362    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
44363)]
44364pub struct Hash(pub [u8; 32]);
44365
44366impl core::fmt::Debug for Hash {
44367    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
44368        let v = &self.0;
44369        write!(f, "Hash(")?;
44370        for b in v {
44371            write!(f, "{b:02x}")?;
44372        }
44373        write!(f, ")")?;
44374        Ok(())
44375    }
44376}
44377impl core::fmt::Display for Hash {
44378    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
44379        let v = &self.0;
44380        for b in v {
44381            write!(f, "{b:02x}")?;
44382        }
44383        Ok(())
44384    }
44385}
44386
44387#[cfg(feature = "alloc")]
44388impl core::str::FromStr for Hash {
44389    type Err = Error;
44390    fn from_str(s: &str) -> core::result::Result<Self, Self::Err> {
44391        hex::decode(s).map_err(|_| Error::InvalidHex)?.try_into()
44392    }
44393}
44394#[cfg(feature = "schemars")]
44395impl schemars::JsonSchema for Hash {
44396    fn schema_name() -> String {
44397        "Hash".to_string()
44398    }
44399
44400    fn is_referenceable() -> bool {
44401        false
44402    }
44403
44404    fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
44405        let schema = String::json_schema(gen);
44406        if let schemars::schema::Schema::Object(mut schema) = schema {
44407            schema.extensions.insert(
44408                "contentEncoding".to_owned(),
44409                serde_json::Value::String("hex".to_string()),
44410            );
44411            schema.extensions.insert(
44412                "contentMediaType".to_owned(),
44413                serde_json::Value::String("application/binary".to_string()),
44414            );
44415            let string = *schema.string.unwrap_or_default().clone();
44416            schema.string = Some(Box::new(schemars::schema::StringValidation {
44417                max_length: 32_u32.checked_mul(2).map(Some).unwrap_or_default(),
44418                min_length: 32_u32.checked_mul(2).map(Some).unwrap_or_default(),
44419                ..string
44420            }));
44421            schema.into()
44422        } else {
44423            schema
44424        }
44425    }
44426}
44427impl From<Hash> for [u8; 32] {
44428    #[must_use]
44429    fn from(x: Hash) -> Self {
44430        x.0
44431    }
44432}
44433
44434impl From<[u8; 32]> for Hash {
44435    #[must_use]
44436    fn from(x: [u8; 32]) -> Self {
44437        Hash(x)
44438    }
44439}
44440
44441impl AsRef<[u8; 32]> for Hash {
44442    #[must_use]
44443    fn as_ref(&self) -> &[u8; 32] {
44444        &self.0
44445    }
44446}
44447
44448impl ReadXdr for Hash {
44449    #[cfg(feature = "std")]
44450    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
44451        r.with_limited_depth(|r| {
44452            let i = <[u8; 32]>::read_xdr(r)?;
44453            let v = Hash(i);
44454            Ok(v)
44455        })
44456    }
44457}
44458
44459impl WriteXdr for Hash {
44460    #[cfg(feature = "std")]
44461    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
44462        w.with_limited_depth(|w| self.0.write_xdr(w))
44463    }
44464}
44465
44466impl Hash {
44467    #[must_use]
44468    pub fn as_slice(&self) -> &[u8] {
44469        &self.0
44470    }
44471}
44472
44473#[cfg(feature = "alloc")]
44474impl TryFrom<Vec<u8>> for Hash {
44475    type Error = Error;
44476    fn try_from(x: Vec<u8>) -> Result<Self> {
44477        x.as_slice().try_into()
44478    }
44479}
44480
44481#[cfg(feature = "alloc")]
44482impl TryFrom<&Vec<u8>> for Hash {
44483    type Error = Error;
44484    fn try_from(x: &Vec<u8>) -> Result<Self> {
44485        x.as_slice().try_into()
44486    }
44487}
44488
44489impl TryFrom<&[u8]> for Hash {
44490    type Error = Error;
44491    fn try_from(x: &[u8]) -> Result<Self> {
44492        Ok(Hash(x.try_into()?))
44493    }
44494}
44495
44496impl AsRef<[u8]> for Hash {
44497    #[must_use]
44498    fn as_ref(&self) -> &[u8] {
44499        &self.0
44500    }
44501}
44502
44503/// Uint256 is an XDR Typedef defines as:
44504///
44505/// ```text
44506/// typedef opaque uint256[32];
44507/// ```
44508///
44509#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
44510#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
44511#[cfg_attr(
44512    all(feature = "serde", feature = "alloc"),
44513    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
44514)]
44515pub struct Uint256(pub [u8; 32]);
44516
44517impl core::fmt::Debug for Uint256 {
44518    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
44519        let v = &self.0;
44520        write!(f, "Uint256(")?;
44521        for b in v {
44522            write!(f, "{b:02x}")?;
44523        }
44524        write!(f, ")")?;
44525        Ok(())
44526    }
44527}
44528impl core::fmt::Display for Uint256 {
44529    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
44530        let v = &self.0;
44531        for b in v {
44532            write!(f, "{b:02x}")?;
44533        }
44534        Ok(())
44535    }
44536}
44537
44538#[cfg(feature = "alloc")]
44539impl core::str::FromStr for Uint256 {
44540    type Err = Error;
44541    fn from_str(s: &str) -> core::result::Result<Self, Self::Err> {
44542        hex::decode(s).map_err(|_| Error::InvalidHex)?.try_into()
44543    }
44544}
44545#[cfg(feature = "schemars")]
44546impl schemars::JsonSchema for Uint256 {
44547    fn schema_name() -> String {
44548        "Uint256".to_string()
44549    }
44550
44551    fn is_referenceable() -> bool {
44552        false
44553    }
44554
44555    fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
44556        let schema = String::json_schema(gen);
44557        if let schemars::schema::Schema::Object(mut schema) = schema {
44558            schema.extensions.insert(
44559                "contentEncoding".to_owned(),
44560                serde_json::Value::String("hex".to_string()),
44561            );
44562            schema.extensions.insert(
44563                "contentMediaType".to_owned(),
44564                serde_json::Value::String("application/binary".to_string()),
44565            );
44566            let string = *schema.string.unwrap_or_default().clone();
44567            schema.string = Some(Box::new(schemars::schema::StringValidation {
44568                max_length: 32_u32.checked_mul(2).map(Some).unwrap_or_default(),
44569                min_length: 32_u32.checked_mul(2).map(Some).unwrap_or_default(),
44570                ..string
44571            }));
44572            schema.into()
44573        } else {
44574            schema
44575        }
44576    }
44577}
44578impl From<Uint256> for [u8; 32] {
44579    #[must_use]
44580    fn from(x: Uint256) -> Self {
44581        x.0
44582    }
44583}
44584
44585impl From<[u8; 32]> for Uint256 {
44586    #[must_use]
44587    fn from(x: [u8; 32]) -> Self {
44588        Uint256(x)
44589    }
44590}
44591
44592impl AsRef<[u8; 32]> for Uint256 {
44593    #[must_use]
44594    fn as_ref(&self) -> &[u8; 32] {
44595        &self.0
44596    }
44597}
44598
44599impl ReadXdr for Uint256 {
44600    #[cfg(feature = "std")]
44601    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
44602        r.with_limited_depth(|r| {
44603            let i = <[u8; 32]>::read_xdr(r)?;
44604            let v = Uint256(i);
44605            Ok(v)
44606        })
44607    }
44608}
44609
44610impl WriteXdr for Uint256 {
44611    #[cfg(feature = "std")]
44612    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
44613        w.with_limited_depth(|w| self.0.write_xdr(w))
44614    }
44615}
44616
44617impl Uint256 {
44618    #[must_use]
44619    pub fn as_slice(&self) -> &[u8] {
44620        &self.0
44621    }
44622}
44623
44624#[cfg(feature = "alloc")]
44625impl TryFrom<Vec<u8>> for Uint256 {
44626    type Error = Error;
44627    fn try_from(x: Vec<u8>) -> Result<Self> {
44628        x.as_slice().try_into()
44629    }
44630}
44631
44632#[cfg(feature = "alloc")]
44633impl TryFrom<&Vec<u8>> for Uint256 {
44634    type Error = Error;
44635    fn try_from(x: &Vec<u8>) -> Result<Self> {
44636        x.as_slice().try_into()
44637    }
44638}
44639
44640impl TryFrom<&[u8]> for Uint256 {
44641    type Error = Error;
44642    fn try_from(x: &[u8]) -> Result<Self> {
44643        Ok(Uint256(x.try_into()?))
44644    }
44645}
44646
44647impl AsRef<[u8]> for Uint256 {
44648    #[must_use]
44649    fn as_ref(&self) -> &[u8] {
44650        &self.0
44651    }
44652}
44653
44654/// Uint32 is an XDR Typedef defines as:
44655///
44656/// ```text
44657/// typedef unsigned int uint32;
44658/// ```
44659///
44660pub type Uint32 = u32;
44661
44662/// Int32 is an XDR Typedef defines as:
44663///
44664/// ```text
44665/// typedef int int32;
44666/// ```
44667///
44668pub type Int32 = i32;
44669
44670/// Uint64 is an XDR Typedef defines as:
44671///
44672/// ```text
44673/// typedef unsigned hyper uint64;
44674/// ```
44675///
44676pub type Uint64 = u64;
44677
44678/// Int64 is an XDR Typedef defines as:
44679///
44680/// ```text
44681/// typedef hyper int64;
44682/// ```
44683///
44684pub type Int64 = i64;
44685
44686/// TimePoint is an XDR Typedef defines as:
44687///
44688/// ```text
44689/// typedef uint64 TimePoint;
44690/// ```
44691///
44692#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
44693#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
44694#[cfg_attr(
44695    all(feature = "serde", feature = "alloc"),
44696    derive(serde::Serialize, serde::Deserialize),
44697    serde(rename_all = "snake_case")
44698)]
44699#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
44700#[derive(Debug)]
44701pub struct TimePoint(pub u64);
44702
44703impl From<TimePoint> for u64 {
44704    #[must_use]
44705    fn from(x: TimePoint) -> Self {
44706        x.0
44707    }
44708}
44709
44710impl From<u64> for TimePoint {
44711    #[must_use]
44712    fn from(x: u64) -> Self {
44713        TimePoint(x)
44714    }
44715}
44716
44717impl AsRef<u64> for TimePoint {
44718    #[must_use]
44719    fn as_ref(&self) -> &u64 {
44720        &self.0
44721    }
44722}
44723
44724impl ReadXdr for TimePoint {
44725    #[cfg(feature = "std")]
44726    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
44727        r.with_limited_depth(|r| {
44728            let i = u64::read_xdr(r)?;
44729            let v = TimePoint(i);
44730            Ok(v)
44731        })
44732    }
44733}
44734
44735impl WriteXdr for TimePoint {
44736    #[cfg(feature = "std")]
44737    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
44738        w.with_limited_depth(|w| self.0.write_xdr(w))
44739    }
44740}
44741
44742/// Duration is an XDR Typedef defines as:
44743///
44744/// ```text
44745/// typedef uint64 Duration;
44746/// ```
44747///
44748#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
44749#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
44750#[cfg_attr(
44751    all(feature = "serde", feature = "alloc"),
44752    derive(serde::Serialize, serde::Deserialize),
44753    serde(rename_all = "snake_case")
44754)]
44755#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
44756#[derive(Debug)]
44757pub struct Duration(pub u64);
44758
44759impl From<Duration> for u64 {
44760    #[must_use]
44761    fn from(x: Duration) -> Self {
44762        x.0
44763    }
44764}
44765
44766impl From<u64> for Duration {
44767    #[must_use]
44768    fn from(x: u64) -> Self {
44769        Duration(x)
44770    }
44771}
44772
44773impl AsRef<u64> for Duration {
44774    #[must_use]
44775    fn as_ref(&self) -> &u64 {
44776        &self.0
44777    }
44778}
44779
44780impl ReadXdr for Duration {
44781    #[cfg(feature = "std")]
44782    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
44783        r.with_limited_depth(|r| {
44784            let i = u64::read_xdr(r)?;
44785            let v = Duration(i);
44786            Ok(v)
44787        })
44788    }
44789}
44790
44791impl WriteXdr for Duration {
44792    #[cfg(feature = "std")]
44793    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
44794        w.with_limited_depth(|w| self.0.write_xdr(w))
44795    }
44796}
44797
44798/// ExtensionPoint is an XDR Union defines as:
44799///
44800/// ```text
44801/// union ExtensionPoint switch (int v)
44802/// {
44803/// case 0:
44804///     void;
44805/// };
44806/// ```
44807///
44808// union with discriminant i32
44809#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
44810#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
44811#[cfg_attr(
44812    all(feature = "serde", feature = "alloc"),
44813    derive(serde::Serialize, serde::Deserialize),
44814    serde(rename_all = "snake_case")
44815)]
44816#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
44817#[allow(clippy::large_enum_variant)]
44818pub enum ExtensionPoint {
44819    V0,
44820}
44821
44822impl ExtensionPoint {
44823    pub const VARIANTS: [i32; 1] = [0];
44824    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
44825
44826    #[must_use]
44827    pub const fn name(&self) -> &'static str {
44828        match self {
44829            Self::V0 => "V0",
44830        }
44831    }
44832
44833    #[must_use]
44834    pub const fn discriminant(&self) -> i32 {
44835        #[allow(clippy::match_same_arms)]
44836        match self {
44837            Self::V0 => 0,
44838        }
44839    }
44840
44841    #[must_use]
44842    pub const fn variants() -> [i32; 1] {
44843        Self::VARIANTS
44844    }
44845}
44846
44847impl Name for ExtensionPoint {
44848    #[must_use]
44849    fn name(&self) -> &'static str {
44850        Self::name(self)
44851    }
44852}
44853
44854impl Discriminant<i32> for ExtensionPoint {
44855    #[must_use]
44856    fn discriminant(&self) -> i32 {
44857        Self::discriminant(self)
44858    }
44859}
44860
44861impl Variants<i32> for ExtensionPoint {
44862    fn variants() -> slice::Iter<'static, i32> {
44863        Self::VARIANTS.iter()
44864    }
44865}
44866
44867impl Union<i32> for ExtensionPoint {}
44868
44869impl ReadXdr for ExtensionPoint {
44870    #[cfg(feature = "std")]
44871    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
44872        r.with_limited_depth(|r| {
44873            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
44874            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
44875            let v = match dv {
44876                0 => Self::V0,
44877                #[allow(unreachable_patterns)]
44878                _ => return Err(Error::Invalid),
44879            };
44880            Ok(v)
44881        })
44882    }
44883}
44884
44885impl WriteXdr for ExtensionPoint {
44886    #[cfg(feature = "std")]
44887    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
44888        w.with_limited_depth(|w| {
44889            self.discriminant().write_xdr(w)?;
44890            #[allow(clippy::match_same_arms)]
44891            match self {
44892                Self::V0 => ().write_xdr(w)?,
44893            };
44894            Ok(())
44895        })
44896    }
44897}
44898
44899/// CryptoKeyType is an XDR Enum defines as:
44900///
44901/// ```text
44902/// enum CryptoKeyType
44903/// {
44904///     KEY_TYPE_ED25519 = 0,
44905///     KEY_TYPE_PRE_AUTH_TX = 1,
44906///     KEY_TYPE_HASH_X = 2,
44907///     KEY_TYPE_ED25519_SIGNED_PAYLOAD = 3,
44908///     // MUXED enum values for supported type are derived from the enum values
44909///     // above by ORing them with 0x100
44910///     KEY_TYPE_MUXED_ED25519 = 0x100
44911/// };
44912/// ```
44913///
44914// enum
44915#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
44916#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
44917#[cfg_attr(
44918    all(feature = "serde", feature = "alloc"),
44919    derive(serde::Serialize, serde::Deserialize),
44920    serde(rename_all = "snake_case")
44921)]
44922#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
44923#[repr(i32)]
44924pub enum CryptoKeyType {
44925    Ed25519 = 0,
44926    PreAuthTx = 1,
44927    HashX = 2,
44928    Ed25519SignedPayload = 3,
44929    MuxedEd25519 = 256,
44930}
44931
44932impl CryptoKeyType {
44933    pub const VARIANTS: [CryptoKeyType; 5] = [
44934        CryptoKeyType::Ed25519,
44935        CryptoKeyType::PreAuthTx,
44936        CryptoKeyType::HashX,
44937        CryptoKeyType::Ed25519SignedPayload,
44938        CryptoKeyType::MuxedEd25519,
44939    ];
44940    pub const VARIANTS_STR: [&'static str; 5] = [
44941        "Ed25519",
44942        "PreAuthTx",
44943        "HashX",
44944        "Ed25519SignedPayload",
44945        "MuxedEd25519",
44946    ];
44947
44948    #[must_use]
44949    pub const fn name(&self) -> &'static str {
44950        match self {
44951            Self::Ed25519 => "Ed25519",
44952            Self::PreAuthTx => "PreAuthTx",
44953            Self::HashX => "HashX",
44954            Self::Ed25519SignedPayload => "Ed25519SignedPayload",
44955            Self::MuxedEd25519 => "MuxedEd25519",
44956        }
44957    }
44958
44959    #[must_use]
44960    pub const fn variants() -> [CryptoKeyType; 5] {
44961        Self::VARIANTS
44962    }
44963}
44964
44965impl Name for CryptoKeyType {
44966    #[must_use]
44967    fn name(&self) -> &'static str {
44968        Self::name(self)
44969    }
44970}
44971
44972impl Variants<CryptoKeyType> for CryptoKeyType {
44973    fn variants() -> slice::Iter<'static, CryptoKeyType> {
44974        Self::VARIANTS.iter()
44975    }
44976}
44977
44978impl Enum for CryptoKeyType {}
44979
44980impl fmt::Display for CryptoKeyType {
44981    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
44982        f.write_str(self.name())
44983    }
44984}
44985
44986impl TryFrom<i32> for CryptoKeyType {
44987    type Error = Error;
44988
44989    fn try_from(i: i32) -> Result<Self> {
44990        let e = match i {
44991            0 => CryptoKeyType::Ed25519,
44992            1 => CryptoKeyType::PreAuthTx,
44993            2 => CryptoKeyType::HashX,
44994            3 => CryptoKeyType::Ed25519SignedPayload,
44995            256 => CryptoKeyType::MuxedEd25519,
44996            #[allow(unreachable_patterns)]
44997            _ => return Err(Error::Invalid),
44998        };
44999        Ok(e)
45000    }
45001}
45002
45003impl From<CryptoKeyType> for i32 {
45004    #[must_use]
45005    fn from(e: CryptoKeyType) -> Self {
45006        e as Self
45007    }
45008}
45009
45010impl ReadXdr for CryptoKeyType {
45011    #[cfg(feature = "std")]
45012    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
45013        r.with_limited_depth(|r| {
45014            let e = i32::read_xdr(r)?;
45015            let v: Self = e.try_into()?;
45016            Ok(v)
45017        })
45018    }
45019}
45020
45021impl WriteXdr for CryptoKeyType {
45022    #[cfg(feature = "std")]
45023    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
45024        w.with_limited_depth(|w| {
45025            let i: i32 = (*self).into();
45026            i.write_xdr(w)
45027        })
45028    }
45029}
45030
45031/// PublicKeyType is an XDR Enum defines as:
45032///
45033/// ```text
45034/// enum PublicKeyType
45035/// {
45036///     PUBLIC_KEY_TYPE_ED25519 = KEY_TYPE_ED25519
45037/// };
45038/// ```
45039///
45040// enum
45041#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
45042#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
45043#[cfg_attr(
45044    all(feature = "serde", feature = "alloc"),
45045    derive(serde::Serialize, serde::Deserialize),
45046    serde(rename_all = "snake_case")
45047)]
45048#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
45049#[repr(i32)]
45050pub enum PublicKeyType {
45051    PublicKeyTypeEd25519 = 0,
45052}
45053
45054impl PublicKeyType {
45055    pub const VARIANTS: [PublicKeyType; 1] = [PublicKeyType::PublicKeyTypeEd25519];
45056    pub const VARIANTS_STR: [&'static str; 1] = ["PublicKeyTypeEd25519"];
45057
45058    #[must_use]
45059    pub const fn name(&self) -> &'static str {
45060        match self {
45061            Self::PublicKeyTypeEd25519 => "PublicKeyTypeEd25519",
45062        }
45063    }
45064
45065    #[must_use]
45066    pub const fn variants() -> [PublicKeyType; 1] {
45067        Self::VARIANTS
45068    }
45069}
45070
45071impl Name for PublicKeyType {
45072    #[must_use]
45073    fn name(&self) -> &'static str {
45074        Self::name(self)
45075    }
45076}
45077
45078impl Variants<PublicKeyType> for PublicKeyType {
45079    fn variants() -> slice::Iter<'static, PublicKeyType> {
45080        Self::VARIANTS.iter()
45081    }
45082}
45083
45084impl Enum for PublicKeyType {}
45085
45086impl fmt::Display for PublicKeyType {
45087    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
45088        f.write_str(self.name())
45089    }
45090}
45091
45092impl TryFrom<i32> for PublicKeyType {
45093    type Error = Error;
45094
45095    fn try_from(i: i32) -> Result<Self> {
45096        let e = match i {
45097            0 => PublicKeyType::PublicKeyTypeEd25519,
45098            #[allow(unreachable_patterns)]
45099            _ => return Err(Error::Invalid),
45100        };
45101        Ok(e)
45102    }
45103}
45104
45105impl From<PublicKeyType> for i32 {
45106    #[must_use]
45107    fn from(e: PublicKeyType) -> Self {
45108        e as Self
45109    }
45110}
45111
45112impl ReadXdr for PublicKeyType {
45113    #[cfg(feature = "std")]
45114    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
45115        r.with_limited_depth(|r| {
45116            let e = i32::read_xdr(r)?;
45117            let v: Self = e.try_into()?;
45118            Ok(v)
45119        })
45120    }
45121}
45122
45123impl WriteXdr for PublicKeyType {
45124    #[cfg(feature = "std")]
45125    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
45126        w.with_limited_depth(|w| {
45127            let i: i32 = (*self).into();
45128            i.write_xdr(w)
45129        })
45130    }
45131}
45132
45133/// SignerKeyType is an XDR Enum defines as:
45134///
45135/// ```text
45136/// enum SignerKeyType
45137/// {
45138///     SIGNER_KEY_TYPE_ED25519 = KEY_TYPE_ED25519,
45139///     SIGNER_KEY_TYPE_PRE_AUTH_TX = KEY_TYPE_PRE_AUTH_TX,
45140///     SIGNER_KEY_TYPE_HASH_X = KEY_TYPE_HASH_X,
45141///     SIGNER_KEY_TYPE_ED25519_SIGNED_PAYLOAD = KEY_TYPE_ED25519_SIGNED_PAYLOAD
45142/// };
45143/// ```
45144///
45145// enum
45146#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
45147#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
45148#[cfg_attr(
45149    all(feature = "serde", feature = "alloc"),
45150    derive(serde::Serialize, serde::Deserialize),
45151    serde(rename_all = "snake_case")
45152)]
45153#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
45154#[repr(i32)]
45155pub enum SignerKeyType {
45156    Ed25519 = 0,
45157    PreAuthTx = 1,
45158    HashX = 2,
45159    Ed25519SignedPayload = 3,
45160}
45161
45162impl SignerKeyType {
45163    pub const VARIANTS: [SignerKeyType; 4] = [
45164        SignerKeyType::Ed25519,
45165        SignerKeyType::PreAuthTx,
45166        SignerKeyType::HashX,
45167        SignerKeyType::Ed25519SignedPayload,
45168    ];
45169    pub const VARIANTS_STR: [&'static str; 4] =
45170        ["Ed25519", "PreAuthTx", "HashX", "Ed25519SignedPayload"];
45171
45172    #[must_use]
45173    pub const fn name(&self) -> &'static str {
45174        match self {
45175            Self::Ed25519 => "Ed25519",
45176            Self::PreAuthTx => "PreAuthTx",
45177            Self::HashX => "HashX",
45178            Self::Ed25519SignedPayload => "Ed25519SignedPayload",
45179        }
45180    }
45181
45182    #[must_use]
45183    pub const fn variants() -> [SignerKeyType; 4] {
45184        Self::VARIANTS
45185    }
45186}
45187
45188impl Name for SignerKeyType {
45189    #[must_use]
45190    fn name(&self) -> &'static str {
45191        Self::name(self)
45192    }
45193}
45194
45195impl Variants<SignerKeyType> for SignerKeyType {
45196    fn variants() -> slice::Iter<'static, SignerKeyType> {
45197        Self::VARIANTS.iter()
45198    }
45199}
45200
45201impl Enum for SignerKeyType {}
45202
45203impl fmt::Display for SignerKeyType {
45204    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
45205        f.write_str(self.name())
45206    }
45207}
45208
45209impl TryFrom<i32> for SignerKeyType {
45210    type Error = Error;
45211
45212    fn try_from(i: i32) -> Result<Self> {
45213        let e = match i {
45214            0 => SignerKeyType::Ed25519,
45215            1 => SignerKeyType::PreAuthTx,
45216            2 => SignerKeyType::HashX,
45217            3 => SignerKeyType::Ed25519SignedPayload,
45218            #[allow(unreachable_patterns)]
45219            _ => return Err(Error::Invalid),
45220        };
45221        Ok(e)
45222    }
45223}
45224
45225impl From<SignerKeyType> for i32 {
45226    #[must_use]
45227    fn from(e: SignerKeyType) -> Self {
45228        e as Self
45229    }
45230}
45231
45232impl ReadXdr for SignerKeyType {
45233    #[cfg(feature = "std")]
45234    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
45235        r.with_limited_depth(|r| {
45236            let e = i32::read_xdr(r)?;
45237            let v: Self = e.try_into()?;
45238            Ok(v)
45239        })
45240    }
45241}
45242
45243impl WriteXdr for SignerKeyType {
45244    #[cfg(feature = "std")]
45245    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
45246        w.with_limited_depth(|w| {
45247            let i: i32 = (*self).into();
45248            i.write_xdr(w)
45249        })
45250    }
45251}
45252
45253/// PublicKey is an XDR Union defines as:
45254///
45255/// ```text
45256/// union PublicKey switch (PublicKeyType type)
45257/// {
45258/// case PUBLIC_KEY_TYPE_ED25519:
45259///     uint256 ed25519;
45260/// };
45261/// ```
45262///
45263// union with discriminant PublicKeyType
45264#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
45265#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
45266#[cfg_attr(
45267    all(feature = "serde", feature = "alloc"),
45268    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
45269)]
45270#[allow(clippy::large_enum_variant)]
45271pub enum PublicKey {
45272    PublicKeyTypeEd25519(Uint256),
45273}
45274
45275impl PublicKey {
45276    pub const VARIANTS: [PublicKeyType; 1] = [PublicKeyType::PublicKeyTypeEd25519];
45277    pub const VARIANTS_STR: [&'static str; 1] = ["PublicKeyTypeEd25519"];
45278
45279    #[must_use]
45280    pub const fn name(&self) -> &'static str {
45281        match self {
45282            Self::PublicKeyTypeEd25519(_) => "PublicKeyTypeEd25519",
45283        }
45284    }
45285
45286    #[must_use]
45287    pub const fn discriminant(&self) -> PublicKeyType {
45288        #[allow(clippy::match_same_arms)]
45289        match self {
45290            Self::PublicKeyTypeEd25519(_) => PublicKeyType::PublicKeyTypeEd25519,
45291        }
45292    }
45293
45294    #[must_use]
45295    pub const fn variants() -> [PublicKeyType; 1] {
45296        Self::VARIANTS
45297    }
45298}
45299
45300impl Name for PublicKey {
45301    #[must_use]
45302    fn name(&self) -> &'static str {
45303        Self::name(self)
45304    }
45305}
45306
45307impl Discriminant<PublicKeyType> for PublicKey {
45308    #[must_use]
45309    fn discriminant(&self) -> PublicKeyType {
45310        Self::discriminant(self)
45311    }
45312}
45313
45314impl Variants<PublicKeyType> for PublicKey {
45315    fn variants() -> slice::Iter<'static, PublicKeyType> {
45316        Self::VARIANTS.iter()
45317    }
45318}
45319
45320impl Union<PublicKeyType> for PublicKey {}
45321
45322impl ReadXdr for PublicKey {
45323    #[cfg(feature = "std")]
45324    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
45325        r.with_limited_depth(|r| {
45326            let dv: PublicKeyType = <PublicKeyType as ReadXdr>::read_xdr(r)?;
45327            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
45328            let v = match dv {
45329                PublicKeyType::PublicKeyTypeEd25519 => {
45330                    Self::PublicKeyTypeEd25519(Uint256::read_xdr(r)?)
45331                }
45332                #[allow(unreachable_patterns)]
45333                _ => return Err(Error::Invalid),
45334            };
45335            Ok(v)
45336        })
45337    }
45338}
45339
45340impl WriteXdr for PublicKey {
45341    #[cfg(feature = "std")]
45342    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
45343        w.with_limited_depth(|w| {
45344            self.discriminant().write_xdr(w)?;
45345            #[allow(clippy::match_same_arms)]
45346            match self {
45347                Self::PublicKeyTypeEd25519(v) => v.write_xdr(w)?,
45348            };
45349            Ok(())
45350        })
45351    }
45352}
45353
45354/// SignerKeyEd25519SignedPayload is an XDR NestedStruct defines as:
45355///
45356/// ```text
45357/// struct
45358///     {
45359///         /* Public key that must sign the payload. */
45360///         uint256 ed25519;
45361///         /* Payload to be raw signed by ed25519. */
45362///         opaque payload<64>;
45363///     }
45364/// ```
45365///
45366#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
45367#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
45368#[cfg_attr(
45369    all(feature = "serde", feature = "alloc"),
45370    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
45371)]
45372pub struct SignerKeyEd25519SignedPayload {
45373    pub ed25519: Uint256,
45374    pub payload: BytesM<64>,
45375}
45376
45377impl ReadXdr for SignerKeyEd25519SignedPayload {
45378    #[cfg(feature = "std")]
45379    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
45380        r.with_limited_depth(|r| {
45381            Ok(Self {
45382                ed25519: Uint256::read_xdr(r)?,
45383                payload: BytesM::<64>::read_xdr(r)?,
45384            })
45385        })
45386    }
45387}
45388
45389impl WriteXdr for SignerKeyEd25519SignedPayload {
45390    #[cfg(feature = "std")]
45391    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
45392        w.with_limited_depth(|w| {
45393            self.ed25519.write_xdr(w)?;
45394            self.payload.write_xdr(w)?;
45395            Ok(())
45396        })
45397    }
45398}
45399
45400/// SignerKey is an XDR Union defines as:
45401///
45402/// ```text
45403/// union SignerKey switch (SignerKeyType type)
45404/// {
45405/// case SIGNER_KEY_TYPE_ED25519:
45406///     uint256 ed25519;
45407/// case SIGNER_KEY_TYPE_PRE_AUTH_TX:
45408///     /* SHA-256 Hash of TransactionSignaturePayload structure */
45409///     uint256 preAuthTx;
45410/// case SIGNER_KEY_TYPE_HASH_X:
45411///     /* Hash of random 256 bit preimage X */
45412///     uint256 hashX;
45413/// case SIGNER_KEY_TYPE_ED25519_SIGNED_PAYLOAD:
45414///     struct
45415///     {
45416///         /* Public key that must sign the payload. */
45417///         uint256 ed25519;
45418///         /* Payload to be raw signed by ed25519. */
45419///         opaque payload<64>;
45420///     } ed25519SignedPayload;
45421/// };
45422/// ```
45423///
45424// union with discriminant SignerKeyType
45425#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
45426#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
45427#[cfg_attr(
45428    all(feature = "serde", feature = "alloc"),
45429    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
45430)]
45431#[allow(clippy::large_enum_variant)]
45432pub enum SignerKey {
45433    Ed25519(Uint256),
45434    PreAuthTx(Uint256),
45435    HashX(Uint256),
45436    Ed25519SignedPayload(SignerKeyEd25519SignedPayload),
45437}
45438
45439impl SignerKey {
45440    pub const VARIANTS: [SignerKeyType; 4] = [
45441        SignerKeyType::Ed25519,
45442        SignerKeyType::PreAuthTx,
45443        SignerKeyType::HashX,
45444        SignerKeyType::Ed25519SignedPayload,
45445    ];
45446    pub const VARIANTS_STR: [&'static str; 4] =
45447        ["Ed25519", "PreAuthTx", "HashX", "Ed25519SignedPayload"];
45448
45449    #[must_use]
45450    pub const fn name(&self) -> &'static str {
45451        match self {
45452            Self::Ed25519(_) => "Ed25519",
45453            Self::PreAuthTx(_) => "PreAuthTx",
45454            Self::HashX(_) => "HashX",
45455            Self::Ed25519SignedPayload(_) => "Ed25519SignedPayload",
45456        }
45457    }
45458
45459    #[must_use]
45460    pub const fn discriminant(&self) -> SignerKeyType {
45461        #[allow(clippy::match_same_arms)]
45462        match self {
45463            Self::Ed25519(_) => SignerKeyType::Ed25519,
45464            Self::PreAuthTx(_) => SignerKeyType::PreAuthTx,
45465            Self::HashX(_) => SignerKeyType::HashX,
45466            Self::Ed25519SignedPayload(_) => SignerKeyType::Ed25519SignedPayload,
45467        }
45468    }
45469
45470    #[must_use]
45471    pub const fn variants() -> [SignerKeyType; 4] {
45472        Self::VARIANTS
45473    }
45474}
45475
45476impl Name for SignerKey {
45477    #[must_use]
45478    fn name(&self) -> &'static str {
45479        Self::name(self)
45480    }
45481}
45482
45483impl Discriminant<SignerKeyType> for SignerKey {
45484    #[must_use]
45485    fn discriminant(&self) -> SignerKeyType {
45486        Self::discriminant(self)
45487    }
45488}
45489
45490impl Variants<SignerKeyType> for SignerKey {
45491    fn variants() -> slice::Iter<'static, SignerKeyType> {
45492        Self::VARIANTS.iter()
45493    }
45494}
45495
45496impl Union<SignerKeyType> for SignerKey {}
45497
45498impl ReadXdr for SignerKey {
45499    #[cfg(feature = "std")]
45500    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
45501        r.with_limited_depth(|r| {
45502            let dv: SignerKeyType = <SignerKeyType as ReadXdr>::read_xdr(r)?;
45503            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
45504            let v = match dv {
45505                SignerKeyType::Ed25519 => Self::Ed25519(Uint256::read_xdr(r)?),
45506                SignerKeyType::PreAuthTx => Self::PreAuthTx(Uint256::read_xdr(r)?),
45507                SignerKeyType::HashX => Self::HashX(Uint256::read_xdr(r)?),
45508                SignerKeyType::Ed25519SignedPayload => {
45509                    Self::Ed25519SignedPayload(SignerKeyEd25519SignedPayload::read_xdr(r)?)
45510                }
45511                #[allow(unreachable_patterns)]
45512                _ => return Err(Error::Invalid),
45513            };
45514            Ok(v)
45515        })
45516    }
45517}
45518
45519impl WriteXdr for SignerKey {
45520    #[cfg(feature = "std")]
45521    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
45522        w.with_limited_depth(|w| {
45523            self.discriminant().write_xdr(w)?;
45524            #[allow(clippy::match_same_arms)]
45525            match self {
45526                Self::Ed25519(v) => v.write_xdr(w)?,
45527                Self::PreAuthTx(v) => v.write_xdr(w)?,
45528                Self::HashX(v) => v.write_xdr(w)?,
45529                Self::Ed25519SignedPayload(v) => v.write_xdr(w)?,
45530            };
45531            Ok(())
45532        })
45533    }
45534}
45535
45536/// Signature is an XDR Typedef defines as:
45537///
45538/// ```text
45539/// typedef opaque Signature<64>;
45540/// ```
45541///
45542#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
45543#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
45544#[derive(Default)]
45545#[cfg_attr(
45546    all(feature = "serde", feature = "alloc"),
45547    derive(serde::Serialize, serde::Deserialize),
45548    serde(rename_all = "snake_case")
45549)]
45550#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
45551#[derive(Debug)]
45552pub struct Signature(pub BytesM<64>);
45553
45554impl From<Signature> for BytesM<64> {
45555    #[must_use]
45556    fn from(x: Signature) -> Self {
45557        x.0
45558    }
45559}
45560
45561impl From<BytesM<64>> for Signature {
45562    #[must_use]
45563    fn from(x: BytesM<64>) -> Self {
45564        Signature(x)
45565    }
45566}
45567
45568impl AsRef<BytesM<64>> for Signature {
45569    #[must_use]
45570    fn as_ref(&self) -> &BytesM<64> {
45571        &self.0
45572    }
45573}
45574
45575impl ReadXdr for Signature {
45576    #[cfg(feature = "std")]
45577    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
45578        r.with_limited_depth(|r| {
45579            let i = BytesM::<64>::read_xdr(r)?;
45580            let v = Signature(i);
45581            Ok(v)
45582        })
45583    }
45584}
45585
45586impl WriteXdr for Signature {
45587    #[cfg(feature = "std")]
45588    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
45589        w.with_limited_depth(|w| self.0.write_xdr(w))
45590    }
45591}
45592
45593impl Deref for Signature {
45594    type Target = BytesM<64>;
45595    fn deref(&self) -> &Self::Target {
45596        &self.0
45597    }
45598}
45599
45600impl From<Signature> for Vec<u8> {
45601    #[must_use]
45602    fn from(x: Signature) -> Self {
45603        x.0 .0
45604    }
45605}
45606
45607impl TryFrom<Vec<u8>> for Signature {
45608    type Error = Error;
45609    fn try_from(x: Vec<u8>) -> Result<Self> {
45610        Ok(Signature(x.try_into()?))
45611    }
45612}
45613
45614#[cfg(feature = "alloc")]
45615impl TryFrom<&Vec<u8>> for Signature {
45616    type Error = Error;
45617    fn try_from(x: &Vec<u8>) -> Result<Self> {
45618        Ok(Signature(x.try_into()?))
45619    }
45620}
45621
45622impl AsRef<Vec<u8>> for Signature {
45623    #[must_use]
45624    fn as_ref(&self) -> &Vec<u8> {
45625        &self.0 .0
45626    }
45627}
45628
45629impl AsRef<[u8]> for Signature {
45630    #[cfg(feature = "alloc")]
45631    #[must_use]
45632    fn as_ref(&self) -> &[u8] {
45633        &self.0 .0
45634    }
45635    #[cfg(not(feature = "alloc"))]
45636    #[must_use]
45637    fn as_ref(&self) -> &[u8] {
45638        self.0 .0
45639    }
45640}
45641
45642/// SignatureHint is an XDR Typedef defines as:
45643///
45644/// ```text
45645/// typedef opaque SignatureHint[4];
45646/// ```
45647///
45648#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
45649#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
45650#[cfg_attr(
45651    all(feature = "serde", feature = "alloc"),
45652    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
45653)]
45654pub struct SignatureHint(pub [u8; 4]);
45655
45656impl core::fmt::Debug for SignatureHint {
45657    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
45658        let v = &self.0;
45659        write!(f, "SignatureHint(")?;
45660        for b in v {
45661            write!(f, "{b:02x}")?;
45662        }
45663        write!(f, ")")?;
45664        Ok(())
45665    }
45666}
45667impl core::fmt::Display for SignatureHint {
45668    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
45669        let v = &self.0;
45670        for b in v {
45671            write!(f, "{b:02x}")?;
45672        }
45673        Ok(())
45674    }
45675}
45676
45677#[cfg(feature = "alloc")]
45678impl core::str::FromStr for SignatureHint {
45679    type Err = Error;
45680    fn from_str(s: &str) -> core::result::Result<Self, Self::Err> {
45681        hex::decode(s).map_err(|_| Error::InvalidHex)?.try_into()
45682    }
45683}
45684#[cfg(feature = "schemars")]
45685impl schemars::JsonSchema for SignatureHint {
45686    fn schema_name() -> String {
45687        "SignatureHint".to_string()
45688    }
45689
45690    fn is_referenceable() -> bool {
45691        false
45692    }
45693
45694    fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
45695        let schema = String::json_schema(gen);
45696        if let schemars::schema::Schema::Object(mut schema) = schema {
45697            schema.extensions.insert(
45698                "contentEncoding".to_owned(),
45699                serde_json::Value::String("hex".to_string()),
45700            );
45701            schema.extensions.insert(
45702                "contentMediaType".to_owned(),
45703                serde_json::Value::String("application/binary".to_string()),
45704            );
45705            let string = *schema.string.unwrap_or_default().clone();
45706            schema.string = Some(Box::new(schemars::schema::StringValidation {
45707                max_length: 4_u32.checked_mul(2).map(Some).unwrap_or_default(),
45708                min_length: 4_u32.checked_mul(2).map(Some).unwrap_or_default(),
45709                ..string
45710            }));
45711            schema.into()
45712        } else {
45713            schema
45714        }
45715    }
45716}
45717impl From<SignatureHint> for [u8; 4] {
45718    #[must_use]
45719    fn from(x: SignatureHint) -> Self {
45720        x.0
45721    }
45722}
45723
45724impl From<[u8; 4]> for SignatureHint {
45725    #[must_use]
45726    fn from(x: [u8; 4]) -> Self {
45727        SignatureHint(x)
45728    }
45729}
45730
45731impl AsRef<[u8; 4]> for SignatureHint {
45732    #[must_use]
45733    fn as_ref(&self) -> &[u8; 4] {
45734        &self.0
45735    }
45736}
45737
45738impl ReadXdr for SignatureHint {
45739    #[cfg(feature = "std")]
45740    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
45741        r.with_limited_depth(|r| {
45742            let i = <[u8; 4]>::read_xdr(r)?;
45743            let v = SignatureHint(i);
45744            Ok(v)
45745        })
45746    }
45747}
45748
45749impl WriteXdr for SignatureHint {
45750    #[cfg(feature = "std")]
45751    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
45752        w.with_limited_depth(|w| self.0.write_xdr(w))
45753    }
45754}
45755
45756impl SignatureHint {
45757    #[must_use]
45758    pub fn as_slice(&self) -> &[u8] {
45759        &self.0
45760    }
45761}
45762
45763#[cfg(feature = "alloc")]
45764impl TryFrom<Vec<u8>> for SignatureHint {
45765    type Error = Error;
45766    fn try_from(x: Vec<u8>) -> Result<Self> {
45767        x.as_slice().try_into()
45768    }
45769}
45770
45771#[cfg(feature = "alloc")]
45772impl TryFrom<&Vec<u8>> for SignatureHint {
45773    type Error = Error;
45774    fn try_from(x: &Vec<u8>) -> Result<Self> {
45775        x.as_slice().try_into()
45776    }
45777}
45778
45779impl TryFrom<&[u8]> for SignatureHint {
45780    type Error = Error;
45781    fn try_from(x: &[u8]) -> Result<Self> {
45782        Ok(SignatureHint(x.try_into()?))
45783    }
45784}
45785
45786impl AsRef<[u8]> for SignatureHint {
45787    #[must_use]
45788    fn as_ref(&self) -> &[u8] {
45789        &self.0
45790    }
45791}
45792
45793/// NodeId is an XDR Typedef defines as:
45794///
45795/// ```text
45796/// typedef PublicKey NodeID;
45797/// ```
45798///
45799#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
45800#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
45801#[cfg_attr(
45802    all(feature = "serde", feature = "alloc"),
45803    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
45804)]
45805#[derive(Debug)]
45806pub struct NodeId(pub PublicKey);
45807
45808impl From<NodeId> for PublicKey {
45809    #[must_use]
45810    fn from(x: NodeId) -> Self {
45811        x.0
45812    }
45813}
45814
45815impl From<PublicKey> for NodeId {
45816    #[must_use]
45817    fn from(x: PublicKey) -> Self {
45818        NodeId(x)
45819    }
45820}
45821
45822impl AsRef<PublicKey> for NodeId {
45823    #[must_use]
45824    fn as_ref(&self) -> &PublicKey {
45825        &self.0
45826    }
45827}
45828
45829impl ReadXdr for NodeId {
45830    #[cfg(feature = "std")]
45831    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
45832        r.with_limited_depth(|r| {
45833            let i = PublicKey::read_xdr(r)?;
45834            let v = NodeId(i);
45835            Ok(v)
45836        })
45837    }
45838}
45839
45840impl WriteXdr for NodeId {
45841    #[cfg(feature = "std")]
45842    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
45843        w.with_limited_depth(|w| self.0.write_xdr(w))
45844    }
45845}
45846
45847/// AccountId is an XDR Typedef defines as:
45848///
45849/// ```text
45850/// typedef PublicKey AccountID;
45851/// ```
45852///
45853#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
45854#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
45855#[cfg_attr(
45856    all(feature = "serde", feature = "alloc"),
45857    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
45858)]
45859#[derive(Debug)]
45860pub struct AccountId(pub PublicKey);
45861
45862impl From<AccountId> for PublicKey {
45863    #[must_use]
45864    fn from(x: AccountId) -> Self {
45865        x.0
45866    }
45867}
45868
45869impl From<PublicKey> for AccountId {
45870    #[must_use]
45871    fn from(x: PublicKey) -> Self {
45872        AccountId(x)
45873    }
45874}
45875
45876impl AsRef<PublicKey> for AccountId {
45877    #[must_use]
45878    fn as_ref(&self) -> &PublicKey {
45879        &self.0
45880    }
45881}
45882
45883impl ReadXdr for AccountId {
45884    #[cfg(feature = "std")]
45885    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
45886        r.with_limited_depth(|r| {
45887            let i = PublicKey::read_xdr(r)?;
45888            let v = AccountId(i);
45889            Ok(v)
45890        })
45891    }
45892}
45893
45894impl WriteXdr for AccountId {
45895    #[cfg(feature = "std")]
45896    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
45897        w.with_limited_depth(|w| self.0.write_xdr(w))
45898    }
45899}
45900
45901/// Curve25519Secret is an XDR Struct defines as:
45902///
45903/// ```text
45904/// struct Curve25519Secret
45905/// {
45906///     opaque key[32];
45907/// };
45908/// ```
45909///
45910#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
45911#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
45912#[cfg_attr(
45913    all(feature = "serde", feature = "alloc"),
45914    derive(serde::Serialize, serde::Deserialize),
45915    serde(rename_all = "snake_case")
45916)]
45917#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
45918pub struct Curve25519Secret {
45919    pub key: [u8; 32],
45920}
45921
45922impl ReadXdr for Curve25519Secret {
45923    #[cfg(feature = "std")]
45924    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
45925        r.with_limited_depth(|r| {
45926            Ok(Self {
45927                key: <[u8; 32]>::read_xdr(r)?,
45928            })
45929        })
45930    }
45931}
45932
45933impl WriteXdr for Curve25519Secret {
45934    #[cfg(feature = "std")]
45935    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
45936        w.with_limited_depth(|w| {
45937            self.key.write_xdr(w)?;
45938            Ok(())
45939        })
45940    }
45941}
45942
45943/// Curve25519Public is an XDR Struct defines as:
45944///
45945/// ```text
45946/// struct Curve25519Public
45947/// {
45948///     opaque key[32];
45949/// };
45950/// ```
45951///
45952#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
45953#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
45954#[cfg_attr(
45955    all(feature = "serde", feature = "alloc"),
45956    derive(serde::Serialize, serde::Deserialize),
45957    serde(rename_all = "snake_case")
45958)]
45959#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
45960pub struct Curve25519Public {
45961    pub key: [u8; 32],
45962}
45963
45964impl ReadXdr for Curve25519Public {
45965    #[cfg(feature = "std")]
45966    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
45967        r.with_limited_depth(|r| {
45968            Ok(Self {
45969                key: <[u8; 32]>::read_xdr(r)?,
45970            })
45971        })
45972    }
45973}
45974
45975impl WriteXdr for Curve25519Public {
45976    #[cfg(feature = "std")]
45977    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
45978        w.with_limited_depth(|w| {
45979            self.key.write_xdr(w)?;
45980            Ok(())
45981        })
45982    }
45983}
45984
45985/// HmacSha256Key is an XDR Struct defines as:
45986///
45987/// ```text
45988/// struct HmacSha256Key
45989/// {
45990///     opaque key[32];
45991/// };
45992/// ```
45993///
45994#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
45995#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
45996#[cfg_attr(
45997    all(feature = "serde", feature = "alloc"),
45998    derive(serde::Serialize, serde::Deserialize),
45999    serde(rename_all = "snake_case")
46000)]
46001#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
46002pub struct HmacSha256Key {
46003    pub key: [u8; 32],
46004}
46005
46006impl ReadXdr for HmacSha256Key {
46007    #[cfg(feature = "std")]
46008    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
46009        r.with_limited_depth(|r| {
46010            Ok(Self {
46011                key: <[u8; 32]>::read_xdr(r)?,
46012            })
46013        })
46014    }
46015}
46016
46017impl WriteXdr for HmacSha256Key {
46018    #[cfg(feature = "std")]
46019    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
46020        w.with_limited_depth(|w| {
46021            self.key.write_xdr(w)?;
46022            Ok(())
46023        })
46024    }
46025}
46026
46027/// HmacSha256Mac is an XDR Struct defines as:
46028///
46029/// ```text
46030/// struct HmacSha256Mac
46031/// {
46032///     opaque mac[32];
46033/// };
46034/// ```
46035///
46036#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
46037#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
46038#[cfg_attr(
46039    all(feature = "serde", feature = "alloc"),
46040    derive(serde::Serialize, serde::Deserialize),
46041    serde(rename_all = "snake_case")
46042)]
46043#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
46044pub struct HmacSha256Mac {
46045    pub mac: [u8; 32],
46046}
46047
46048impl ReadXdr for HmacSha256Mac {
46049    #[cfg(feature = "std")]
46050    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
46051        r.with_limited_depth(|r| {
46052            Ok(Self {
46053                mac: <[u8; 32]>::read_xdr(r)?,
46054            })
46055        })
46056    }
46057}
46058
46059impl WriteXdr for HmacSha256Mac {
46060    #[cfg(feature = "std")]
46061    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
46062        w.with_limited_depth(|w| {
46063            self.mac.write_xdr(w)?;
46064            Ok(())
46065        })
46066    }
46067}
46068
46069/// ShortHashSeed is an XDR Struct defines as:
46070///
46071/// ```text
46072/// struct ShortHashSeed
46073/// {
46074///     opaque seed[16];
46075/// };
46076/// ```
46077///
46078#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
46079#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
46080#[cfg_attr(
46081    all(feature = "serde", feature = "alloc"),
46082    derive(serde::Serialize, serde::Deserialize),
46083    serde(rename_all = "snake_case")
46084)]
46085#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
46086pub struct ShortHashSeed {
46087    pub seed: [u8; 16],
46088}
46089
46090impl ReadXdr for ShortHashSeed {
46091    #[cfg(feature = "std")]
46092    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
46093        r.with_limited_depth(|r| {
46094            Ok(Self {
46095                seed: <[u8; 16]>::read_xdr(r)?,
46096            })
46097        })
46098    }
46099}
46100
46101impl WriteXdr for ShortHashSeed {
46102    #[cfg(feature = "std")]
46103    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
46104        w.with_limited_depth(|w| {
46105            self.seed.write_xdr(w)?;
46106            Ok(())
46107        })
46108    }
46109}
46110
46111/// BinaryFuseFilterType is an XDR Enum defines as:
46112///
46113/// ```text
46114/// enum BinaryFuseFilterType
46115/// {
46116///     BINARY_FUSE_FILTER_8_BIT = 0,
46117///     BINARY_FUSE_FILTER_16_BIT = 1,
46118///     BINARY_FUSE_FILTER_32_BIT = 2
46119/// };
46120/// ```
46121///
46122// enum
46123#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
46124#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
46125#[cfg_attr(
46126    all(feature = "serde", feature = "alloc"),
46127    derive(serde::Serialize, serde::Deserialize),
46128    serde(rename_all = "snake_case")
46129)]
46130#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
46131#[repr(i32)]
46132pub enum BinaryFuseFilterType {
46133    B8Bit = 0,
46134    B16Bit = 1,
46135    B32Bit = 2,
46136}
46137
46138impl BinaryFuseFilterType {
46139    pub const VARIANTS: [BinaryFuseFilterType; 3] = [
46140        BinaryFuseFilterType::B8Bit,
46141        BinaryFuseFilterType::B16Bit,
46142        BinaryFuseFilterType::B32Bit,
46143    ];
46144    pub const VARIANTS_STR: [&'static str; 3] = ["B8Bit", "B16Bit", "B32Bit"];
46145
46146    #[must_use]
46147    pub const fn name(&self) -> &'static str {
46148        match self {
46149            Self::B8Bit => "B8Bit",
46150            Self::B16Bit => "B16Bit",
46151            Self::B32Bit => "B32Bit",
46152        }
46153    }
46154
46155    #[must_use]
46156    pub const fn variants() -> [BinaryFuseFilterType; 3] {
46157        Self::VARIANTS
46158    }
46159}
46160
46161impl Name for BinaryFuseFilterType {
46162    #[must_use]
46163    fn name(&self) -> &'static str {
46164        Self::name(self)
46165    }
46166}
46167
46168impl Variants<BinaryFuseFilterType> for BinaryFuseFilterType {
46169    fn variants() -> slice::Iter<'static, BinaryFuseFilterType> {
46170        Self::VARIANTS.iter()
46171    }
46172}
46173
46174impl Enum for BinaryFuseFilterType {}
46175
46176impl fmt::Display for BinaryFuseFilterType {
46177    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
46178        f.write_str(self.name())
46179    }
46180}
46181
46182impl TryFrom<i32> for BinaryFuseFilterType {
46183    type Error = Error;
46184
46185    fn try_from(i: i32) -> Result<Self> {
46186        let e = match i {
46187            0 => BinaryFuseFilterType::B8Bit,
46188            1 => BinaryFuseFilterType::B16Bit,
46189            2 => BinaryFuseFilterType::B32Bit,
46190            #[allow(unreachable_patterns)]
46191            _ => return Err(Error::Invalid),
46192        };
46193        Ok(e)
46194    }
46195}
46196
46197impl From<BinaryFuseFilterType> for i32 {
46198    #[must_use]
46199    fn from(e: BinaryFuseFilterType) -> Self {
46200        e as Self
46201    }
46202}
46203
46204impl ReadXdr for BinaryFuseFilterType {
46205    #[cfg(feature = "std")]
46206    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
46207        r.with_limited_depth(|r| {
46208            let e = i32::read_xdr(r)?;
46209            let v: Self = e.try_into()?;
46210            Ok(v)
46211        })
46212    }
46213}
46214
46215impl WriteXdr for BinaryFuseFilterType {
46216    #[cfg(feature = "std")]
46217    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
46218        w.with_limited_depth(|w| {
46219            let i: i32 = (*self).into();
46220            i.write_xdr(w)
46221        })
46222    }
46223}
46224
46225/// SerializedBinaryFuseFilter is an XDR Struct defines as:
46226///
46227/// ```text
46228/// struct SerializedBinaryFuseFilter
46229/// {
46230///     BinaryFuseFilterType type;
46231///
46232///     // Seed used to hash input to filter
46233///     ShortHashSeed inputHashSeed;
46234///
46235///     // Seed used for internal filter hash operations
46236///     ShortHashSeed filterSeed;
46237///     uint32 segmentLength;
46238///     uint32 segementLengthMask;
46239///     uint32 segmentCount;
46240///     uint32 segmentCountLength;
46241///     uint32 fingerprintLength; // Length in terms of element count, not bytes
46242///
46243///     // Array of uint8_t, uint16_t, or uint32_t depending on filter type
46244///     opaque fingerprints<>;
46245/// };
46246/// ```
46247///
46248#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
46249#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
46250#[cfg_attr(
46251    all(feature = "serde", feature = "alloc"),
46252    derive(serde::Serialize, serde::Deserialize),
46253    serde(rename_all = "snake_case")
46254)]
46255#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
46256pub struct SerializedBinaryFuseFilter {
46257    pub type_: BinaryFuseFilterType,
46258    pub input_hash_seed: ShortHashSeed,
46259    pub filter_seed: ShortHashSeed,
46260    pub segment_length: u32,
46261    pub segement_length_mask: u32,
46262    pub segment_count: u32,
46263    pub segment_count_length: u32,
46264    pub fingerprint_length: u32,
46265    pub fingerprints: BytesM,
46266}
46267
46268impl ReadXdr for SerializedBinaryFuseFilter {
46269    #[cfg(feature = "std")]
46270    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
46271        r.with_limited_depth(|r| {
46272            Ok(Self {
46273                type_: BinaryFuseFilterType::read_xdr(r)?,
46274                input_hash_seed: ShortHashSeed::read_xdr(r)?,
46275                filter_seed: ShortHashSeed::read_xdr(r)?,
46276                segment_length: u32::read_xdr(r)?,
46277                segement_length_mask: u32::read_xdr(r)?,
46278                segment_count: u32::read_xdr(r)?,
46279                segment_count_length: u32::read_xdr(r)?,
46280                fingerprint_length: u32::read_xdr(r)?,
46281                fingerprints: BytesM::read_xdr(r)?,
46282            })
46283        })
46284    }
46285}
46286
46287impl WriteXdr for SerializedBinaryFuseFilter {
46288    #[cfg(feature = "std")]
46289    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
46290        w.with_limited_depth(|w| {
46291            self.type_.write_xdr(w)?;
46292            self.input_hash_seed.write_xdr(w)?;
46293            self.filter_seed.write_xdr(w)?;
46294            self.segment_length.write_xdr(w)?;
46295            self.segement_length_mask.write_xdr(w)?;
46296            self.segment_count.write_xdr(w)?;
46297            self.segment_count_length.write_xdr(w)?;
46298            self.fingerprint_length.write_xdr(w)?;
46299            self.fingerprints.write_xdr(w)?;
46300            Ok(())
46301        })
46302    }
46303}
46304
46305#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
46306#[cfg_attr(
46307    all(feature = "serde", feature = "alloc"),
46308    derive(serde::Serialize, serde::Deserialize),
46309    serde(rename_all = "snake_case")
46310)]
46311#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
46312pub enum TypeVariant {
46313    Value,
46314    ScpBallot,
46315    ScpStatementType,
46316    ScpNomination,
46317    ScpStatement,
46318    ScpStatementPledges,
46319    ScpStatementPrepare,
46320    ScpStatementConfirm,
46321    ScpStatementExternalize,
46322    ScpEnvelope,
46323    ScpQuorumSet,
46324    ConfigSettingContractExecutionLanesV0,
46325    ConfigSettingContractComputeV0,
46326    ConfigSettingContractLedgerCostV0,
46327    ConfigSettingContractHistoricalDataV0,
46328    ConfigSettingContractEventsV0,
46329    ConfigSettingContractBandwidthV0,
46330    ContractCostType,
46331    ContractCostParamEntry,
46332    StateArchivalSettings,
46333    EvictionIterator,
46334    ContractCostParams,
46335    ConfigSettingId,
46336    ConfigSettingEntry,
46337    ScEnvMetaKind,
46338    ScEnvMetaEntry,
46339    ScEnvMetaEntryInterfaceVersion,
46340    ScMetaV0,
46341    ScMetaKind,
46342    ScMetaEntry,
46343    ScSpecType,
46344    ScSpecTypeOption,
46345    ScSpecTypeResult,
46346    ScSpecTypeVec,
46347    ScSpecTypeMap,
46348    ScSpecTypeTuple,
46349    ScSpecTypeBytesN,
46350    ScSpecTypeUdt,
46351    ScSpecTypeDef,
46352    ScSpecUdtStructFieldV0,
46353    ScSpecUdtStructV0,
46354    ScSpecUdtUnionCaseVoidV0,
46355    ScSpecUdtUnionCaseTupleV0,
46356    ScSpecUdtUnionCaseV0Kind,
46357    ScSpecUdtUnionCaseV0,
46358    ScSpecUdtUnionV0,
46359    ScSpecUdtEnumCaseV0,
46360    ScSpecUdtEnumV0,
46361    ScSpecUdtErrorEnumCaseV0,
46362    ScSpecUdtErrorEnumV0,
46363    ScSpecFunctionInputV0,
46364    ScSpecFunctionV0,
46365    ScSpecEntryKind,
46366    ScSpecEntry,
46367    ScValType,
46368    ScErrorType,
46369    ScErrorCode,
46370    ScError,
46371    UInt128Parts,
46372    Int128Parts,
46373    UInt256Parts,
46374    Int256Parts,
46375    ContractExecutableType,
46376    ContractExecutable,
46377    ScAddressType,
46378    ScAddress,
46379    ScVec,
46380    ScMap,
46381    ScBytes,
46382    ScString,
46383    ScSymbol,
46384    ScNonceKey,
46385    ScContractInstance,
46386    ScVal,
46387    ScMapEntry,
46388    StoredTransactionSet,
46389    StoredDebugTransactionSet,
46390    PersistedScpStateV0,
46391    PersistedScpStateV1,
46392    PersistedScpState,
46393    Thresholds,
46394    String32,
46395    String64,
46396    SequenceNumber,
46397    DataValue,
46398    PoolId,
46399    AssetCode4,
46400    AssetCode12,
46401    AssetType,
46402    AssetCode,
46403    AlphaNum4,
46404    AlphaNum12,
46405    Asset,
46406    Price,
46407    Liabilities,
46408    ThresholdIndexes,
46409    LedgerEntryType,
46410    Signer,
46411    AccountFlags,
46412    SponsorshipDescriptor,
46413    AccountEntryExtensionV3,
46414    AccountEntryExtensionV2,
46415    AccountEntryExtensionV2Ext,
46416    AccountEntryExtensionV1,
46417    AccountEntryExtensionV1Ext,
46418    AccountEntry,
46419    AccountEntryExt,
46420    TrustLineFlags,
46421    LiquidityPoolType,
46422    TrustLineAsset,
46423    TrustLineEntryExtensionV2,
46424    TrustLineEntryExtensionV2Ext,
46425    TrustLineEntry,
46426    TrustLineEntryExt,
46427    TrustLineEntryV1,
46428    TrustLineEntryV1Ext,
46429    OfferEntryFlags,
46430    OfferEntry,
46431    OfferEntryExt,
46432    DataEntry,
46433    DataEntryExt,
46434    ClaimPredicateType,
46435    ClaimPredicate,
46436    ClaimantType,
46437    Claimant,
46438    ClaimantV0,
46439    ClaimableBalanceIdType,
46440    ClaimableBalanceId,
46441    ClaimableBalanceFlags,
46442    ClaimableBalanceEntryExtensionV1,
46443    ClaimableBalanceEntryExtensionV1Ext,
46444    ClaimableBalanceEntry,
46445    ClaimableBalanceEntryExt,
46446    LiquidityPoolConstantProductParameters,
46447    LiquidityPoolEntry,
46448    LiquidityPoolEntryBody,
46449    LiquidityPoolEntryConstantProduct,
46450    ContractDataDurability,
46451    ContractDataEntry,
46452    ContractCodeCostInputs,
46453    ContractCodeEntry,
46454    ContractCodeEntryExt,
46455    ContractCodeEntryV1,
46456    TtlEntry,
46457    LedgerEntryExtensionV1,
46458    LedgerEntryExtensionV1Ext,
46459    LedgerEntry,
46460    LedgerEntryData,
46461    LedgerEntryExt,
46462    LedgerKey,
46463    LedgerKeyAccount,
46464    LedgerKeyTrustLine,
46465    LedgerKeyOffer,
46466    LedgerKeyData,
46467    LedgerKeyClaimableBalance,
46468    LedgerKeyLiquidityPool,
46469    LedgerKeyContractData,
46470    LedgerKeyContractCode,
46471    LedgerKeyConfigSetting,
46472    LedgerKeyTtl,
46473    EnvelopeType,
46474    BucketListType,
46475    BucketEntryType,
46476    HotArchiveBucketEntryType,
46477    ColdArchiveBucketEntryType,
46478    BucketMetadata,
46479    BucketMetadataExt,
46480    BucketEntry,
46481    HotArchiveBucketEntry,
46482    ColdArchiveArchivedLeaf,
46483    ColdArchiveDeletedLeaf,
46484    ColdArchiveBoundaryLeaf,
46485    ColdArchiveHashEntry,
46486    ColdArchiveBucketEntry,
46487    UpgradeType,
46488    StellarValueType,
46489    LedgerCloseValueSignature,
46490    StellarValue,
46491    StellarValueExt,
46492    LedgerHeaderFlags,
46493    LedgerHeaderExtensionV1,
46494    LedgerHeaderExtensionV1Ext,
46495    LedgerHeader,
46496    LedgerHeaderExt,
46497    LedgerUpgradeType,
46498    ConfigUpgradeSetKey,
46499    LedgerUpgrade,
46500    ConfigUpgradeSet,
46501    TxSetComponentType,
46502    TxSetComponent,
46503    TxSetComponentTxsMaybeDiscountedFee,
46504    TransactionPhase,
46505    TransactionSet,
46506    TransactionSetV1,
46507    GeneralizedTransactionSet,
46508    TransactionResultPair,
46509    TransactionResultSet,
46510    TransactionHistoryEntry,
46511    TransactionHistoryEntryExt,
46512    TransactionHistoryResultEntry,
46513    TransactionHistoryResultEntryExt,
46514    LedgerHeaderHistoryEntry,
46515    LedgerHeaderHistoryEntryExt,
46516    LedgerScpMessages,
46517    ScpHistoryEntryV0,
46518    ScpHistoryEntry,
46519    LedgerEntryChangeType,
46520    LedgerEntryChange,
46521    LedgerEntryChanges,
46522    OperationMeta,
46523    TransactionMetaV1,
46524    TransactionMetaV2,
46525    ContractEventType,
46526    ContractEvent,
46527    ContractEventBody,
46528    ContractEventV0,
46529    DiagnosticEvent,
46530    DiagnosticEvents,
46531    SorobanTransactionMetaExtV1,
46532    SorobanTransactionMetaExt,
46533    SorobanTransactionMeta,
46534    TransactionMetaV3,
46535    InvokeHostFunctionSuccessPreImage,
46536    TransactionMeta,
46537    TransactionResultMeta,
46538    UpgradeEntryMeta,
46539    LedgerCloseMetaV0,
46540    LedgerCloseMetaExtV1,
46541    LedgerCloseMetaExt,
46542    LedgerCloseMetaV1,
46543    LedgerCloseMeta,
46544    ErrorCode,
46545    SError,
46546    SendMore,
46547    SendMoreExtended,
46548    AuthCert,
46549    Hello,
46550    Auth,
46551    IpAddrType,
46552    PeerAddress,
46553    PeerAddressIp,
46554    MessageType,
46555    DontHave,
46556    SurveyMessageCommandType,
46557    SurveyMessageResponseType,
46558    TimeSlicedSurveyStartCollectingMessage,
46559    SignedTimeSlicedSurveyStartCollectingMessage,
46560    TimeSlicedSurveyStopCollectingMessage,
46561    SignedTimeSlicedSurveyStopCollectingMessage,
46562    SurveyRequestMessage,
46563    TimeSlicedSurveyRequestMessage,
46564    SignedSurveyRequestMessage,
46565    SignedTimeSlicedSurveyRequestMessage,
46566    EncryptedBody,
46567    SurveyResponseMessage,
46568    TimeSlicedSurveyResponseMessage,
46569    SignedSurveyResponseMessage,
46570    SignedTimeSlicedSurveyResponseMessage,
46571    PeerStats,
46572    PeerStatList,
46573    TimeSlicedNodeData,
46574    TimeSlicedPeerData,
46575    TimeSlicedPeerDataList,
46576    TopologyResponseBodyV0,
46577    TopologyResponseBodyV1,
46578    TopologyResponseBodyV2,
46579    SurveyResponseBody,
46580    TxAdvertVector,
46581    FloodAdvert,
46582    TxDemandVector,
46583    FloodDemand,
46584    StellarMessage,
46585    AuthenticatedMessage,
46586    AuthenticatedMessageV0,
46587    LiquidityPoolParameters,
46588    MuxedAccount,
46589    MuxedAccountMed25519,
46590    DecoratedSignature,
46591    OperationType,
46592    CreateAccountOp,
46593    PaymentOp,
46594    PathPaymentStrictReceiveOp,
46595    PathPaymentStrictSendOp,
46596    ManageSellOfferOp,
46597    ManageBuyOfferOp,
46598    CreatePassiveSellOfferOp,
46599    SetOptionsOp,
46600    ChangeTrustAsset,
46601    ChangeTrustOp,
46602    AllowTrustOp,
46603    ManageDataOp,
46604    BumpSequenceOp,
46605    CreateClaimableBalanceOp,
46606    ClaimClaimableBalanceOp,
46607    BeginSponsoringFutureReservesOp,
46608    RevokeSponsorshipType,
46609    RevokeSponsorshipOp,
46610    RevokeSponsorshipOpSigner,
46611    ClawbackOp,
46612    ClawbackClaimableBalanceOp,
46613    SetTrustLineFlagsOp,
46614    LiquidityPoolDepositOp,
46615    LiquidityPoolWithdrawOp,
46616    HostFunctionType,
46617    ContractIdPreimageType,
46618    ContractIdPreimage,
46619    ContractIdPreimageFromAddress,
46620    CreateContractArgs,
46621    CreateContractArgsV2,
46622    InvokeContractArgs,
46623    HostFunction,
46624    SorobanAuthorizedFunctionType,
46625    SorobanAuthorizedFunction,
46626    SorobanAuthorizedInvocation,
46627    SorobanAddressCredentials,
46628    SorobanCredentialsType,
46629    SorobanCredentials,
46630    SorobanAuthorizationEntry,
46631    InvokeHostFunctionOp,
46632    ExtendFootprintTtlOp,
46633    RestoreFootprintOp,
46634    Operation,
46635    OperationBody,
46636    HashIdPreimage,
46637    HashIdPreimageOperationId,
46638    HashIdPreimageRevokeId,
46639    HashIdPreimageContractId,
46640    HashIdPreimageSorobanAuthorization,
46641    MemoType,
46642    Memo,
46643    TimeBounds,
46644    LedgerBounds,
46645    PreconditionsV2,
46646    PreconditionType,
46647    Preconditions,
46648    LedgerFootprint,
46649    ArchivalProofType,
46650    ArchivalProofNode,
46651    ProofLevel,
46652    NonexistenceProofBody,
46653    ExistenceProofBody,
46654    ArchivalProof,
46655    ArchivalProofBody,
46656    SorobanResources,
46657    SorobanTransactionData,
46658    TransactionV0,
46659    TransactionV0Ext,
46660    TransactionV0Envelope,
46661    Transaction,
46662    TransactionExt,
46663    TransactionV1Envelope,
46664    FeeBumpTransaction,
46665    FeeBumpTransactionInnerTx,
46666    FeeBumpTransactionExt,
46667    FeeBumpTransactionEnvelope,
46668    TransactionEnvelope,
46669    TransactionSignaturePayload,
46670    TransactionSignaturePayloadTaggedTransaction,
46671    ClaimAtomType,
46672    ClaimOfferAtomV0,
46673    ClaimOfferAtom,
46674    ClaimLiquidityAtom,
46675    ClaimAtom,
46676    CreateAccountResultCode,
46677    CreateAccountResult,
46678    PaymentResultCode,
46679    PaymentResult,
46680    PathPaymentStrictReceiveResultCode,
46681    SimplePaymentResult,
46682    PathPaymentStrictReceiveResult,
46683    PathPaymentStrictReceiveResultSuccess,
46684    PathPaymentStrictSendResultCode,
46685    PathPaymentStrictSendResult,
46686    PathPaymentStrictSendResultSuccess,
46687    ManageSellOfferResultCode,
46688    ManageOfferEffect,
46689    ManageOfferSuccessResult,
46690    ManageOfferSuccessResultOffer,
46691    ManageSellOfferResult,
46692    ManageBuyOfferResultCode,
46693    ManageBuyOfferResult,
46694    SetOptionsResultCode,
46695    SetOptionsResult,
46696    ChangeTrustResultCode,
46697    ChangeTrustResult,
46698    AllowTrustResultCode,
46699    AllowTrustResult,
46700    AccountMergeResultCode,
46701    AccountMergeResult,
46702    InflationResultCode,
46703    InflationPayout,
46704    InflationResult,
46705    ManageDataResultCode,
46706    ManageDataResult,
46707    BumpSequenceResultCode,
46708    BumpSequenceResult,
46709    CreateClaimableBalanceResultCode,
46710    CreateClaimableBalanceResult,
46711    ClaimClaimableBalanceResultCode,
46712    ClaimClaimableBalanceResult,
46713    BeginSponsoringFutureReservesResultCode,
46714    BeginSponsoringFutureReservesResult,
46715    EndSponsoringFutureReservesResultCode,
46716    EndSponsoringFutureReservesResult,
46717    RevokeSponsorshipResultCode,
46718    RevokeSponsorshipResult,
46719    ClawbackResultCode,
46720    ClawbackResult,
46721    ClawbackClaimableBalanceResultCode,
46722    ClawbackClaimableBalanceResult,
46723    SetTrustLineFlagsResultCode,
46724    SetTrustLineFlagsResult,
46725    LiquidityPoolDepositResultCode,
46726    LiquidityPoolDepositResult,
46727    LiquidityPoolWithdrawResultCode,
46728    LiquidityPoolWithdrawResult,
46729    InvokeHostFunctionResultCode,
46730    InvokeHostFunctionResult,
46731    ExtendFootprintTtlResultCode,
46732    ExtendFootprintTtlResult,
46733    RestoreFootprintResultCode,
46734    RestoreFootprintResult,
46735    OperationResultCode,
46736    OperationResult,
46737    OperationResultTr,
46738    TransactionResultCode,
46739    InnerTransactionResult,
46740    InnerTransactionResultResult,
46741    InnerTransactionResultExt,
46742    InnerTransactionResultPair,
46743    TransactionResult,
46744    TransactionResultResult,
46745    TransactionResultExt,
46746    Hash,
46747    Uint256,
46748    Uint32,
46749    Int32,
46750    Uint64,
46751    Int64,
46752    TimePoint,
46753    Duration,
46754    ExtensionPoint,
46755    CryptoKeyType,
46756    PublicKeyType,
46757    SignerKeyType,
46758    PublicKey,
46759    SignerKey,
46760    SignerKeyEd25519SignedPayload,
46761    Signature,
46762    SignatureHint,
46763    NodeId,
46764    AccountId,
46765    Curve25519Secret,
46766    Curve25519Public,
46767    HmacSha256Key,
46768    HmacSha256Mac,
46769    ShortHashSeed,
46770    BinaryFuseFilterType,
46771    SerializedBinaryFuseFilter,
46772}
46773
46774impl TypeVariant {
46775    pub const VARIANTS: [TypeVariant; 459] = [
46776        TypeVariant::Value,
46777        TypeVariant::ScpBallot,
46778        TypeVariant::ScpStatementType,
46779        TypeVariant::ScpNomination,
46780        TypeVariant::ScpStatement,
46781        TypeVariant::ScpStatementPledges,
46782        TypeVariant::ScpStatementPrepare,
46783        TypeVariant::ScpStatementConfirm,
46784        TypeVariant::ScpStatementExternalize,
46785        TypeVariant::ScpEnvelope,
46786        TypeVariant::ScpQuorumSet,
46787        TypeVariant::ConfigSettingContractExecutionLanesV0,
46788        TypeVariant::ConfigSettingContractComputeV0,
46789        TypeVariant::ConfigSettingContractLedgerCostV0,
46790        TypeVariant::ConfigSettingContractHistoricalDataV0,
46791        TypeVariant::ConfigSettingContractEventsV0,
46792        TypeVariant::ConfigSettingContractBandwidthV0,
46793        TypeVariant::ContractCostType,
46794        TypeVariant::ContractCostParamEntry,
46795        TypeVariant::StateArchivalSettings,
46796        TypeVariant::EvictionIterator,
46797        TypeVariant::ContractCostParams,
46798        TypeVariant::ConfigSettingId,
46799        TypeVariant::ConfigSettingEntry,
46800        TypeVariant::ScEnvMetaKind,
46801        TypeVariant::ScEnvMetaEntry,
46802        TypeVariant::ScEnvMetaEntryInterfaceVersion,
46803        TypeVariant::ScMetaV0,
46804        TypeVariant::ScMetaKind,
46805        TypeVariant::ScMetaEntry,
46806        TypeVariant::ScSpecType,
46807        TypeVariant::ScSpecTypeOption,
46808        TypeVariant::ScSpecTypeResult,
46809        TypeVariant::ScSpecTypeVec,
46810        TypeVariant::ScSpecTypeMap,
46811        TypeVariant::ScSpecTypeTuple,
46812        TypeVariant::ScSpecTypeBytesN,
46813        TypeVariant::ScSpecTypeUdt,
46814        TypeVariant::ScSpecTypeDef,
46815        TypeVariant::ScSpecUdtStructFieldV0,
46816        TypeVariant::ScSpecUdtStructV0,
46817        TypeVariant::ScSpecUdtUnionCaseVoidV0,
46818        TypeVariant::ScSpecUdtUnionCaseTupleV0,
46819        TypeVariant::ScSpecUdtUnionCaseV0Kind,
46820        TypeVariant::ScSpecUdtUnionCaseV0,
46821        TypeVariant::ScSpecUdtUnionV0,
46822        TypeVariant::ScSpecUdtEnumCaseV0,
46823        TypeVariant::ScSpecUdtEnumV0,
46824        TypeVariant::ScSpecUdtErrorEnumCaseV0,
46825        TypeVariant::ScSpecUdtErrorEnumV0,
46826        TypeVariant::ScSpecFunctionInputV0,
46827        TypeVariant::ScSpecFunctionV0,
46828        TypeVariant::ScSpecEntryKind,
46829        TypeVariant::ScSpecEntry,
46830        TypeVariant::ScValType,
46831        TypeVariant::ScErrorType,
46832        TypeVariant::ScErrorCode,
46833        TypeVariant::ScError,
46834        TypeVariant::UInt128Parts,
46835        TypeVariant::Int128Parts,
46836        TypeVariant::UInt256Parts,
46837        TypeVariant::Int256Parts,
46838        TypeVariant::ContractExecutableType,
46839        TypeVariant::ContractExecutable,
46840        TypeVariant::ScAddressType,
46841        TypeVariant::ScAddress,
46842        TypeVariant::ScVec,
46843        TypeVariant::ScMap,
46844        TypeVariant::ScBytes,
46845        TypeVariant::ScString,
46846        TypeVariant::ScSymbol,
46847        TypeVariant::ScNonceKey,
46848        TypeVariant::ScContractInstance,
46849        TypeVariant::ScVal,
46850        TypeVariant::ScMapEntry,
46851        TypeVariant::StoredTransactionSet,
46852        TypeVariant::StoredDebugTransactionSet,
46853        TypeVariant::PersistedScpStateV0,
46854        TypeVariant::PersistedScpStateV1,
46855        TypeVariant::PersistedScpState,
46856        TypeVariant::Thresholds,
46857        TypeVariant::String32,
46858        TypeVariant::String64,
46859        TypeVariant::SequenceNumber,
46860        TypeVariant::DataValue,
46861        TypeVariant::PoolId,
46862        TypeVariant::AssetCode4,
46863        TypeVariant::AssetCode12,
46864        TypeVariant::AssetType,
46865        TypeVariant::AssetCode,
46866        TypeVariant::AlphaNum4,
46867        TypeVariant::AlphaNum12,
46868        TypeVariant::Asset,
46869        TypeVariant::Price,
46870        TypeVariant::Liabilities,
46871        TypeVariant::ThresholdIndexes,
46872        TypeVariant::LedgerEntryType,
46873        TypeVariant::Signer,
46874        TypeVariant::AccountFlags,
46875        TypeVariant::SponsorshipDescriptor,
46876        TypeVariant::AccountEntryExtensionV3,
46877        TypeVariant::AccountEntryExtensionV2,
46878        TypeVariant::AccountEntryExtensionV2Ext,
46879        TypeVariant::AccountEntryExtensionV1,
46880        TypeVariant::AccountEntryExtensionV1Ext,
46881        TypeVariant::AccountEntry,
46882        TypeVariant::AccountEntryExt,
46883        TypeVariant::TrustLineFlags,
46884        TypeVariant::LiquidityPoolType,
46885        TypeVariant::TrustLineAsset,
46886        TypeVariant::TrustLineEntryExtensionV2,
46887        TypeVariant::TrustLineEntryExtensionV2Ext,
46888        TypeVariant::TrustLineEntry,
46889        TypeVariant::TrustLineEntryExt,
46890        TypeVariant::TrustLineEntryV1,
46891        TypeVariant::TrustLineEntryV1Ext,
46892        TypeVariant::OfferEntryFlags,
46893        TypeVariant::OfferEntry,
46894        TypeVariant::OfferEntryExt,
46895        TypeVariant::DataEntry,
46896        TypeVariant::DataEntryExt,
46897        TypeVariant::ClaimPredicateType,
46898        TypeVariant::ClaimPredicate,
46899        TypeVariant::ClaimantType,
46900        TypeVariant::Claimant,
46901        TypeVariant::ClaimantV0,
46902        TypeVariant::ClaimableBalanceIdType,
46903        TypeVariant::ClaimableBalanceId,
46904        TypeVariant::ClaimableBalanceFlags,
46905        TypeVariant::ClaimableBalanceEntryExtensionV1,
46906        TypeVariant::ClaimableBalanceEntryExtensionV1Ext,
46907        TypeVariant::ClaimableBalanceEntry,
46908        TypeVariant::ClaimableBalanceEntryExt,
46909        TypeVariant::LiquidityPoolConstantProductParameters,
46910        TypeVariant::LiquidityPoolEntry,
46911        TypeVariant::LiquidityPoolEntryBody,
46912        TypeVariant::LiquidityPoolEntryConstantProduct,
46913        TypeVariant::ContractDataDurability,
46914        TypeVariant::ContractDataEntry,
46915        TypeVariant::ContractCodeCostInputs,
46916        TypeVariant::ContractCodeEntry,
46917        TypeVariant::ContractCodeEntryExt,
46918        TypeVariant::ContractCodeEntryV1,
46919        TypeVariant::TtlEntry,
46920        TypeVariant::LedgerEntryExtensionV1,
46921        TypeVariant::LedgerEntryExtensionV1Ext,
46922        TypeVariant::LedgerEntry,
46923        TypeVariant::LedgerEntryData,
46924        TypeVariant::LedgerEntryExt,
46925        TypeVariant::LedgerKey,
46926        TypeVariant::LedgerKeyAccount,
46927        TypeVariant::LedgerKeyTrustLine,
46928        TypeVariant::LedgerKeyOffer,
46929        TypeVariant::LedgerKeyData,
46930        TypeVariant::LedgerKeyClaimableBalance,
46931        TypeVariant::LedgerKeyLiquidityPool,
46932        TypeVariant::LedgerKeyContractData,
46933        TypeVariant::LedgerKeyContractCode,
46934        TypeVariant::LedgerKeyConfigSetting,
46935        TypeVariant::LedgerKeyTtl,
46936        TypeVariant::EnvelopeType,
46937        TypeVariant::BucketListType,
46938        TypeVariant::BucketEntryType,
46939        TypeVariant::HotArchiveBucketEntryType,
46940        TypeVariant::ColdArchiveBucketEntryType,
46941        TypeVariant::BucketMetadata,
46942        TypeVariant::BucketMetadataExt,
46943        TypeVariant::BucketEntry,
46944        TypeVariant::HotArchiveBucketEntry,
46945        TypeVariant::ColdArchiveArchivedLeaf,
46946        TypeVariant::ColdArchiveDeletedLeaf,
46947        TypeVariant::ColdArchiveBoundaryLeaf,
46948        TypeVariant::ColdArchiveHashEntry,
46949        TypeVariant::ColdArchiveBucketEntry,
46950        TypeVariant::UpgradeType,
46951        TypeVariant::StellarValueType,
46952        TypeVariant::LedgerCloseValueSignature,
46953        TypeVariant::StellarValue,
46954        TypeVariant::StellarValueExt,
46955        TypeVariant::LedgerHeaderFlags,
46956        TypeVariant::LedgerHeaderExtensionV1,
46957        TypeVariant::LedgerHeaderExtensionV1Ext,
46958        TypeVariant::LedgerHeader,
46959        TypeVariant::LedgerHeaderExt,
46960        TypeVariant::LedgerUpgradeType,
46961        TypeVariant::ConfigUpgradeSetKey,
46962        TypeVariant::LedgerUpgrade,
46963        TypeVariant::ConfigUpgradeSet,
46964        TypeVariant::TxSetComponentType,
46965        TypeVariant::TxSetComponent,
46966        TypeVariant::TxSetComponentTxsMaybeDiscountedFee,
46967        TypeVariant::TransactionPhase,
46968        TypeVariant::TransactionSet,
46969        TypeVariant::TransactionSetV1,
46970        TypeVariant::GeneralizedTransactionSet,
46971        TypeVariant::TransactionResultPair,
46972        TypeVariant::TransactionResultSet,
46973        TypeVariant::TransactionHistoryEntry,
46974        TypeVariant::TransactionHistoryEntryExt,
46975        TypeVariant::TransactionHistoryResultEntry,
46976        TypeVariant::TransactionHistoryResultEntryExt,
46977        TypeVariant::LedgerHeaderHistoryEntry,
46978        TypeVariant::LedgerHeaderHistoryEntryExt,
46979        TypeVariant::LedgerScpMessages,
46980        TypeVariant::ScpHistoryEntryV0,
46981        TypeVariant::ScpHistoryEntry,
46982        TypeVariant::LedgerEntryChangeType,
46983        TypeVariant::LedgerEntryChange,
46984        TypeVariant::LedgerEntryChanges,
46985        TypeVariant::OperationMeta,
46986        TypeVariant::TransactionMetaV1,
46987        TypeVariant::TransactionMetaV2,
46988        TypeVariant::ContractEventType,
46989        TypeVariant::ContractEvent,
46990        TypeVariant::ContractEventBody,
46991        TypeVariant::ContractEventV0,
46992        TypeVariant::DiagnosticEvent,
46993        TypeVariant::DiagnosticEvents,
46994        TypeVariant::SorobanTransactionMetaExtV1,
46995        TypeVariant::SorobanTransactionMetaExt,
46996        TypeVariant::SorobanTransactionMeta,
46997        TypeVariant::TransactionMetaV3,
46998        TypeVariant::InvokeHostFunctionSuccessPreImage,
46999        TypeVariant::TransactionMeta,
47000        TypeVariant::TransactionResultMeta,
47001        TypeVariant::UpgradeEntryMeta,
47002        TypeVariant::LedgerCloseMetaV0,
47003        TypeVariant::LedgerCloseMetaExtV1,
47004        TypeVariant::LedgerCloseMetaExt,
47005        TypeVariant::LedgerCloseMetaV1,
47006        TypeVariant::LedgerCloseMeta,
47007        TypeVariant::ErrorCode,
47008        TypeVariant::SError,
47009        TypeVariant::SendMore,
47010        TypeVariant::SendMoreExtended,
47011        TypeVariant::AuthCert,
47012        TypeVariant::Hello,
47013        TypeVariant::Auth,
47014        TypeVariant::IpAddrType,
47015        TypeVariant::PeerAddress,
47016        TypeVariant::PeerAddressIp,
47017        TypeVariant::MessageType,
47018        TypeVariant::DontHave,
47019        TypeVariant::SurveyMessageCommandType,
47020        TypeVariant::SurveyMessageResponseType,
47021        TypeVariant::TimeSlicedSurveyStartCollectingMessage,
47022        TypeVariant::SignedTimeSlicedSurveyStartCollectingMessage,
47023        TypeVariant::TimeSlicedSurveyStopCollectingMessage,
47024        TypeVariant::SignedTimeSlicedSurveyStopCollectingMessage,
47025        TypeVariant::SurveyRequestMessage,
47026        TypeVariant::TimeSlicedSurveyRequestMessage,
47027        TypeVariant::SignedSurveyRequestMessage,
47028        TypeVariant::SignedTimeSlicedSurveyRequestMessage,
47029        TypeVariant::EncryptedBody,
47030        TypeVariant::SurveyResponseMessage,
47031        TypeVariant::TimeSlicedSurveyResponseMessage,
47032        TypeVariant::SignedSurveyResponseMessage,
47033        TypeVariant::SignedTimeSlicedSurveyResponseMessage,
47034        TypeVariant::PeerStats,
47035        TypeVariant::PeerStatList,
47036        TypeVariant::TimeSlicedNodeData,
47037        TypeVariant::TimeSlicedPeerData,
47038        TypeVariant::TimeSlicedPeerDataList,
47039        TypeVariant::TopologyResponseBodyV0,
47040        TypeVariant::TopologyResponseBodyV1,
47041        TypeVariant::TopologyResponseBodyV2,
47042        TypeVariant::SurveyResponseBody,
47043        TypeVariant::TxAdvertVector,
47044        TypeVariant::FloodAdvert,
47045        TypeVariant::TxDemandVector,
47046        TypeVariant::FloodDemand,
47047        TypeVariant::StellarMessage,
47048        TypeVariant::AuthenticatedMessage,
47049        TypeVariant::AuthenticatedMessageV0,
47050        TypeVariant::LiquidityPoolParameters,
47051        TypeVariant::MuxedAccount,
47052        TypeVariant::MuxedAccountMed25519,
47053        TypeVariant::DecoratedSignature,
47054        TypeVariant::OperationType,
47055        TypeVariant::CreateAccountOp,
47056        TypeVariant::PaymentOp,
47057        TypeVariant::PathPaymentStrictReceiveOp,
47058        TypeVariant::PathPaymentStrictSendOp,
47059        TypeVariant::ManageSellOfferOp,
47060        TypeVariant::ManageBuyOfferOp,
47061        TypeVariant::CreatePassiveSellOfferOp,
47062        TypeVariant::SetOptionsOp,
47063        TypeVariant::ChangeTrustAsset,
47064        TypeVariant::ChangeTrustOp,
47065        TypeVariant::AllowTrustOp,
47066        TypeVariant::ManageDataOp,
47067        TypeVariant::BumpSequenceOp,
47068        TypeVariant::CreateClaimableBalanceOp,
47069        TypeVariant::ClaimClaimableBalanceOp,
47070        TypeVariant::BeginSponsoringFutureReservesOp,
47071        TypeVariant::RevokeSponsorshipType,
47072        TypeVariant::RevokeSponsorshipOp,
47073        TypeVariant::RevokeSponsorshipOpSigner,
47074        TypeVariant::ClawbackOp,
47075        TypeVariant::ClawbackClaimableBalanceOp,
47076        TypeVariant::SetTrustLineFlagsOp,
47077        TypeVariant::LiquidityPoolDepositOp,
47078        TypeVariant::LiquidityPoolWithdrawOp,
47079        TypeVariant::HostFunctionType,
47080        TypeVariant::ContractIdPreimageType,
47081        TypeVariant::ContractIdPreimage,
47082        TypeVariant::ContractIdPreimageFromAddress,
47083        TypeVariant::CreateContractArgs,
47084        TypeVariant::CreateContractArgsV2,
47085        TypeVariant::InvokeContractArgs,
47086        TypeVariant::HostFunction,
47087        TypeVariant::SorobanAuthorizedFunctionType,
47088        TypeVariant::SorobanAuthorizedFunction,
47089        TypeVariant::SorobanAuthorizedInvocation,
47090        TypeVariant::SorobanAddressCredentials,
47091        TypeVariant::SorobanCredentialsType,
47092        TypeVariant::SorobanCredentials,
47093        TypeVariant::SorobanAuthorizationEntry,
47094        TypeVariant::InvokeHostFunctionOp,
47095        TypeVariant::ExtendFootprintTtlOp,
47096        TypeVariant::RestoreFootprintOp,
47097        TypeVariant::Operation,
47098        TypeVariant::OperationBody,
47099        TypeVariant::HashIdPreimage,
47100        TypeVariant::HashIdPreimageOperationId,
47101        TypeVariant::HashIdPreimageRevokeId,
47102        TypeVariant::HashIdPreimageContractId,
47103        TypeVariant::HashIdPreimageSorobanAuthorization,
47104        TypeVariant::MemoType,
47105        TypeVariant::Memo,
47106        TypeVariant::TimeBounds,
47107        TypeVariant::LedgerBounds,
47108        TypeVariant::PreconditionsV2,
47109        TypeVariant::PreconditionType,
47110        TypeVariant::Preconditions,
47111        TypeVariant::LedgerFootprint,
47112        TypeVariant::ArchivalProofType,
47113        TypeVariant::ArchivalProofNode,
47114        TypeVariant::ProofLevel,
47115        TypeVariant::NonexistenceProofBody,
47116        TypeVariant::ExistenceProofBody,
47117        TypeVariant::ArchivalProof,
47118        TypeVariant::ArchivalProofBody,
47119        TypeVariant::SorobanResources,
47120        TypeVariant::SorobanTransactionData,
47121        TypeVariant::TransactionV0,
47122        TypeVariant::TransactionV0Ext,
47123        TypeVariant::TransactionV0Envelope,
47124        TypeVariant::Transaction,
47125        TypeVariant::TransactionExt,
47126        TypeVariant::TransactionV1Envelope,
47127        TypeVariant::FeeBumpTransaction,
47128        TypeVariant::FeeBumpTransactionInnerTx,
47129        TypeVariant::FeeBumpTransactionExt,
47130        TypeVariant::FeeBumpTransactionEnvelope,
47131        TypeVariant::TransactionEnvelope,
47132        TypeVariant::TransactionSignaturePayload,
47133        TypeVariant::TransactionSignaturePayloadTaggedTransaction,
47134        TypeVariant::ClaimAtomType,
47135        TypeVariant::ClaimOfferAtomV0,
47136        TypeVariant::ClaimOfferAtom,
47137        TypeVariant::ClaimLiquidityAtom,
47138        TypeVariant::ClaimAtom,
47139        TypeVariant::CreateAccountResultCode,
47140        TypeVariant::CreateAccountResult,
47141        TypeVariant::PaymentResultCode,
47142        TypeVariant::PaymentResult,
47143        TypeVariant::PathPaymentStrictReceiveResultCode,
47144        TypeVariant::SimplePaymentResult,
47145        TypeVariant::PathPaymentStrictReceiveResult,
47146        TypeVariant::PathPaymentStrictReceiveResultSuccess,
47147        TypeVariant::PathPaymentStrictSendResultCode,
47148        TypeVariant::PathPaymentStrictSendResult,
47149        TypeVariant::PathPaymentStrictSendResultSuccess,
47150        TypeVariant::ManageSellOfferResultCode,
47151        TypeVariant::ManageOfferEffect,
47152        TypeVariant::ManageOfferSuccessResult,
47153        TypeVariant::ManageOfferSuccessResultOffer,
47154        TypeVariant::ManageSellOfferResult,
47155        TypeVariant::ManageBuyOfferResultCode,
47156        TypeVariant::ManageBuyOfferResult,
47157        TypeVariant::SetOptionsResultCode,
47158        TypeVariant::SetOptionsResult,
47159        TypeVariant::ChangeTrustResultCode,
47160        TypeVariant::ChangeTrustResult,
47161        TypeVariant::AllowTrustResultCode,
47162        TypeVariant::AllowTrustResult,
47163        TypeVariant::AccountMergeResultCode,
47164        TypeVariant::AccountMergeResult,
47165        TypeVariant::InflationResultCode,
47166        TypeVariant::InflationPayout,
47167        TypeVariant::InflationResult,
47168        TypeVariant::ManageDataResultCode,
47169        TypeVariant::ManageDataResult,
47170        TypeVariant::BumpSequenceResultCode,
47171        TypeVariant::BumpSequenceResult,
47172        TypeVariant::CreateClaimableBalanceResultCode,
47173        TypeVariant::CreateClaimableBalanceResult,
47174        TypeVariant::ClaimClaimableBalanceResultCode,
47175        TypeVariant::ClaimClaimableBalanceResult,
47176        TypeVariant::BeginSponsoringFutureReservesResultCode,
47177        TypeVariant::BeginSponsoringFutureReservesResult,
47178        TypeVariant::EndSponsoringFutureReservesResultCode,
47179        TypeVariant::EndSponsoringFutureReservesResult,
47180        TypeVariant::RevokeSponsorshipResultCode,
47181        TypeVariant::RevokeSponsorshipResult,
47182        TypeVariant::ClawbackResultCode,
47183        TypeVariant::ClawbackResult,
47184        TypeVariant::ClawbackClaimableBalanceResultCode,
47185        TypeVariant::ClawbackClaimableBalanceResult,
47186        TypeVariant::SetTrustLineFlagsResultCode,
47187        TypeVariant::SetTrustLineFlagsResult,
47188        TypeVariant::LiquidityPoolDepositResultCode,
47189        TypeVariant::LiquidityPoolDepositResult,
47190        TypeVariant::LiquidityPoolWithdrawResultCode,
47191        TypeVariant::LiquidityPoolWithdrawResult,
47192        TypeVariant::InvokeHostFunctionResultCode,
47193        TypeVariant::InvokeHostFunctionResult,
47194        TypeVariant::ExtendFootprintTtlResultCode,
47195        TypeVariant::ExtendFootprintTtlResult,
47196        TypeVariant::RestoreFootprintResultCode,
47197        TypeVariant::RestoreFootprintResult,
47198        TypeVariant::OperationResultCode,
47199        TypeVariant::OperationResult,
47200        TypeVariant::OperationResultTr,
47201        TypeVariant::TransactionResultCode,
47202        TypeVariant::InnerTransactionResult,
47203        TypeVariant::InnerTransactionResultResult,
47204        TypeVariant::InnerTransactionResultExt,
47205        TypeVariant::InnerTransactionResultPair,
47206        TypeVariant::TransactionResult,
47207        TypeVariant::TransactionResultResult,
47208        TypeVariant::TransactionResultExt,
47209        TypeVariant::Hash,
47210        TypeVariant::Uint256,
47211        TypeVariant::Uint32,
47212        TypeVariant::Int32,
47213        TypeVariant::Uint64,
47214        TypeVariant::Int64,
47215        TypeVariant::TimePoint,
47216        TypeVariant::Duration,
47217        TypeVariant::ExtensionPoint,
47218        TypeVariant::CryptoKeyType,
47219        TypeVariant::PublicKeyType,
47220        TypeVariant::SignerKeyType,
47221        TypeVariant::PublicKey,
47222        TypeVariant::SignerKey,
47223        TypeVariant::SignerKeyEd25519SignedPayload,
47224        TypeVariant::Signature,
47225        TypeVariant::SignatureHint,
47226        TypeVariant::NodeId,
47227        TypeVariant::AccountId,
47228        TypeVariant::Curve25519Secret,
47229        TypeVariant::Curve25519Public,
47230        TypeVariant::HmacSha256Key,
47231        TypeVariant::HmacSha256Mac,
47232        TypeVariant::ShortHashSeed,
47233        TypeVariant::BinaryFuseFilterType,
47234        TypeVariant::SerializedBinaryFuseFilter,
47235    ];
47236    pub const VARIANTS_STR: [&'static str; 459] = [
47237        "Value",
47238        "ScpBallot",
47239        "ScpStatementType",
47240        "ScpNomination",
47241        "ScpStatement",
47242        "ScpStatementPledges",
47243        "ScpStatementPrepare",
47244        "ScpStatementConfirm",
47245        "ScpStatementExternalize",
47246        "ScpEnvelope",
47247        "ScpQuorumSet",
47248        "ConfigSettingContractExecutionLanesV0",
47249        "ConfigSettingContractComputeV0",
47250        "ConfigSettingContractLedgerCostV0",
47251        "ConfigSettingContractHistoricalDataV0",
47252        "ConfigSettingContractEventsV0",
47253        "ConfigSettingContractBandwidthV0",
47254        "ContractCostType",
47255        "ContractCostParamEntry",
47256        "StateArchivalSettings",
47257        "EvictionIterator",
47258        "ContractCostParams",
47259        "ConfigSettingId",
47260        "ConfigSettingEntry",
47261        "ScEnvMetaKind",
47262        "ScEnvMetaEntry",
47263        "ScEnvMetaEntryInterfaceVersion",
47264        "ScMetaV0",
47265        "ScMetaKind",
47266        "ScMetaEntry",
47267        "ScSpecType",
47268        "ScSpecTypeOption",
47269        "ScSpecTypeResult",
47270        "ScSpecTypeVec",
47271        "ScSpecTypeMap",
47272        "ScSpecTypeTuple",
47273        "ScSpecTypeBytesN",
47274        "ScSpecTypeUdt",
47275        "ScSpecTypeDef",
47276        "ScSpecUdtStructFieldV0",
47277        "ScSpecUdtStructV0",
47278        "ScSpecUdtUnionCaseVoidV0",
47279        "ScSpecUdtUnionCaseTupleV0",
47280        "ScSpecUdtUnionCaseV0Kind",
47281        "ScSpecUdtUnionCaseV0",
47282        "ScSpecUdtUnionV0",
47283        "ScSpecUdtEnumCaseV0",
47284        "ScSpecUdtEnumV0",
47285        "ScSpecUdtErrorEnumCaseV0",
47286        "ScSpecUdtErrorEnumV0",
47287        "ScSpecFunctionInputV0",
47288        "ScSpecFunctionV0",
47289        "ScSpecEntryKind",
47290        "ScSpecEntry",
47291        "ScValType",
47292        "ScErrorType",
47293        "ScErrorCode",
47294        "ScError",
47295        "UInt128Parts",
47296        "Int128Parts",
47297        "UInt256Parts",
47298        "Int256Parts",
47299        "ContractExecutableType",
47300        "ContractExecutable",
47301        "ScAddressType",
47302        "ScAddress",
47303        "ScVec",
47304        "ScMap",
47305        "ScBytes",
47306        "ScString",
47307        "ScSymbol",
47308        "ScNonceKey",
47309        "ScContractInstance",
47310        "ScVal",
47311        "ScMapEntry",
47312        "StoredTransactionSet",
47313        "StoredDebugTransactionSet",
47314        "PersistedScpStateV0",
47315        "PersistedScpStateV1",
47316        "PersistedScpState",
47317        "Thresholds",
47318        "String32",
47319        "String64",
47320        "SequenceNumber",
47321        "DataValue",
47322        "PoolId",
47323        "AssetCode4",
47324        "AssetCode12",
47325        "AssetType",
47326        "AssetCode",
47327        "AlphaNum4",
47328        "AlphaNum12",
47329        "Asset",
47330        "Price",
47331        "Liabilities",
47332        "ThresholdIndexes",
47333        "LedgerEntryType",
47334        "Signer",
47335        "AccountFlags",
47336        "SponsorshipDescriptor",
47337        "AccountEntryExtensionV3",
47338        "AccountEntryExtensionV2",
47339        "AccountEntryExtensionV2Ext",
47340        "AccountEntryExtensionV1",
47341        "AccountEntryExtensionV1Ext",
47342        "AccountEntry",
47343        "AccountEntryExt",
47344        "TrustLineFlags",
47345        "LiquidityPoolType",
47346        "TrustLineAsset",
47347        "TrustLineEntryExtensionV2",
47348        "TrustLineEntryExtensionV2Ext",
47349        "TrustLineEntry",
47350        "TrustLineEntryExt",
47351        "TrustLineEntryV1",
47352        "TrustLineEntryV1Ext",
47353        "OfferEntryFlags",
47354        "OfferEntry",
47355        "OfferEntryExt",
47356        "DataEntry",
47357        "DataEntryExt",
47358        "ClaimPredicateType",
47359        "ClaimPredicate",
47360        "ClaimantType",
47361        "Claimant",
47362        "ClaimantV0",
47363        "ClaimableBalanceIdType",
47364        "ClaimableBalanceId",
47365        "ClaimableBalanceFlags",
47366        "ClaimableBalanceEntryExtensionV1",
47367        "ClaimableBalanceEntryExtensionV1Ext",
47368        "ClaimableBalanceEntry",
47369        "ClaimableBalanceEntryExt",
47370        "LiquidityPoolConstantProductParameters",
47371        "LiquidityPoolEntry",
47372        "LiquidityPoolEntryBody",
47373        "LiquidityPoolEntryConstantProduct",
47374        "ContractDataDurability",
47375        "ContractDataEntry",
47376        "ContractCodeCostInputs",
47377        "ContractCodeEntry",
47378        "ContractCodeEntryExt",
47379        "ContractCodeEntryV1",
47380        "TtlEntry",
47381        "LedgerEntryExtensionV1",
47382        "LedgerEntryExtensionV1Ext",
47383        "LedgerEntry",
47384        "LedgerEntryData",
47385        "LedgerEntryExt",
47386        "LedgerKey",
47387        "LedgerKeyAccount",
47388        "LedgerKeyTrustLine",
47389        "LedgerKeyOffer",
47390        "LedgerKeyData",
47391        "LedgerKeyClaimableBalance",
47392        "LedgerKeyLiquidityPool",
47393        "LedgerKeyContractData",
47394        "LedgerKeyContractCode",
47395        "LedgerKeyConfigSetting",
47396        "LedgerKeyTtl",
47397        "EnvelopeType",
47398        "BucketListType",
47399        "BucketEntryType",
47400        "HotArchiveBucketEntryType",
47401        "ColdArchiveBucketEntryType",
47402        "BucketMetadata",
47403        "BucketMetadataExt",
47404        "BucketEntry",
47405        "HotArchiveBucketEntry",
47406        "ColdArchiveArchivedLeaf",
47407        "ColdArchiveDeletedLeaf",
47408        "ColdArchiveBoundaryLeaf",
47409        "ColdArchiveHashEntry",
47410        "ColdArchiveBucketEntry",
47411        "UpgradeType",
47412        "StellarValueType",
47413        "LedgerCloseValueSignature",
47414        "StellarValue",
47415        "StellarValueExt",
47416        "LedgerHeaderFlags",
47417        "LedgerHeaderExtensionV1",
47418        "LedgerHeaderExtensionV1Ext",
47419        "LedgerHeader",
47420        "LedgerHeaderExt",
47421        "LedgerUpgradeType",
47422        "ConfigUpgradeSetKey",
47423        "LedgerUpgrade",
47424        "ConfigUpgradeSet",
47425        "TxSetComponentType",
47426        "TxSetComponent",
47427        "TxSetComponentTxsMaybeDiscountedFee",
47428        "TransactionPhase",
47429        "TransactionSet",
47430        "TransactionSetV1",
47431        "GeneralizedTransactionSet",
47432        "TransactionResultPair",
47433        "TransactionResultSet",
47434        "TransactionHistoryEntry",
47435        "TransactionHistoryEntryExt",
47436        "TransactionHistoryResultEntry",
47437        "TransactionHistoryResultEntryExt",
47438        "LedgerHeaderHistoryEntry",
47439        "LedgerHeaderHistoryEntryExt",
47440        "LedgerScpMessages",
47441        "ScpHistoryEntryV0",
47442        "ScpHistoryEntry",
47443        "LedgerEntryChangeType",
47444        "LedgerEntryChange",
47445        "LedgerEntryChanges",
47446        "OperationMeta",
47447        "TransactionMetaV1",
47448        "TransactionMetaV2",
47449        "ContractEventType",
47450        "ContractEvent",
47451        "ContractEventBody",
47452        "ContractEventV0",
47453        "DiagnosticEvent",
47454        "DiagnosticEvents",
47455        "SorobanTransactionMetaExtV1",
47456        "SorobanTransactionMetaExt",
47457        "SorobanTransactionMeta",
47458        "TransactionMetaV3",
47459        "InvokeHostFunctionSuccessPreImage",
47460        "TransactionMeta",
47461        "TransactionResultMeta",
47462        "UpgradeEntryMeta",
47463        "LedgerCloseMetaV0",
47464        "LedgerCloseMetaExtV1",
47465        "LedgerCloseMetaExt",
47466        "LedgerCloseMetaV1",
47467        "LedgerCloseMeta",
47468        "ErrorCode",
47469        "SError",
47470        "SendMore",
47471        "SendMoreExtended",
47472        "AuthCert",
47473        "Hello",
47474        "Auth",
47475        "IpAddrType",
47476        "PeerAddress",
47477        "PeerAddressIp",
47478        "MessageType",
47479        "DontHave",
47480        "SurveyMessageCommandType",
47481        "SurveyMessageResponseType",
47482        "TimeSlicedSurveyStartCollectingMessage",
47483        "SignedTimeSlicedSurveyStartCollectingMessage",
47484        "TimeSlicedSurveyStopCollectingMessage",
47485        "SignedTimeSlicedSurveyStopCollectingMessage",
47486        "SurveyRequestMessage",
47487        "TimeSlicedSurveyRequestMessage",
47488        "SignedSurveyRequestMessage",
47489        "SignedTimeSlicedSurveyRequestMessage",
47490        "EncryptedBody",
47491        "SurveyResponseMessage",
47492        "TimeSlicedSurveyResponseMessage",
47493        "SignedSurveyResponseMessage",
47494        "SignedTimeSlicedSurveyResponseMessage",
47495        "PeerStats",
47496        "PeerStatList",
47497        "TimeSlicedNodeData",
47498        "TimeSlicedPeerData",
47499        "TimeSlicedPeerDataList",
47500        "TopologyResponseBodyV0",
47501        "TopologyResponseBodyV1",
47502        "TopologyResponseBodyV2",
47503        "SurveyResponseBody",
47504        "TxAdvertVector",
47505        "FloodAdvert",
47506        "TxDemandVector",
47507        "FloodDemand",
47508        "StellarMessage",
47509        "AuthenticatedMessage",
47510        "AuthenticatedMessageV0",
47511        "LiquidityPoolParameters",
47512        "MuxedAccount",
47513        "MuxedAccountMed25519",
47514        "DecoratedSignature",
47515        "OperationType",
47516        "CreateAccountOp",
47517        "PaymentOp",
47518        "PathPaymentStrictReceiveOp",
47519        "PathPaymentStrictSendOp",
47520        "ManageSellOfferOp",
47521        "ManageBuyOfferOp",
47522        "CreatePassiveSellOfferOp",
47523        "SetOptionsOp",
47524        "ChangeTrustAsset",
47525        "ChangeTrustOp",
47526        "AllowTrustOp",
47527        "ManageDataOp",
47528        "BumpSequenceOp",
47529        "CreateClaimableBalanceOp",
47530        "ClaimClaimableBalanceOp",
47531        "BeginSponsoringFutureReservesOp",
47532        "RevokeSponsorshipType",
47533        "RevokeSponsorshipOp",
47534        "RevokeSponsorshipOpSigner",
47535        "ClawbackOp",
47536        "ClawbackClaimableBalanceOp",
47537        "SetTrustLineFlagsOp",
47538        "LiquidityPoolDepositOp",
47539        "LiquidityPoolWithdrawOp",
47540        "HostFunctionType",
47541        "ContractIdPreimageType",
47542        "ContractIdPreimage",
47543        "ContractIdPreimageFromAddress",
47544        "CreateContractArgs",
47545        "CreateContractArgsV2",
47546        "InvokeContractArgs",
47547        "HostFunction",
47548        "SorobanAuthorizedFunctionType",
47549        "SorobanAuthorizedFunction",
47550        "SorobanAuthorizedInvocation",
47551        "SorobanAddressCredentials",
47552        "SorobanCredentialsType",
47553        "SorobanCredentials",
47554        "SorobanAuthorizationEntry",
47555        "InvokeHostFunctionOp",
47556        "ExtendFootprintTtlOp",
47557        "RestoreFootprintOp",
47558        "Operation",
47559        "OperationBody",
47560        "HashIdPreimage",
47561        "HashIdPreimageOperationId",
47562        "HashIdPreimageRevokeId",
47563        "HashIdPreimageContractId",
47564        "HashIdPreimageSorobanAuthorization",
47565        "MemoType",
47566        "Memo",
47567        "TimeBounds",
47568        "LedgerBounds",
47569        "PreconditionsV2",
47570        "PreconditionType",
47571        "Preconditions",
47572        "LedgerFootprint",
47573        "ArchivalProofType",
47574        "ArchivalProofNode",
47575        "ProofLevel",
47576        "NonexistenceProofBody",
47577        "ExistenceProofBody",
47578        "ArchivalProof",
47579        "ArchivalProofBody",
47580        "SorobanResources",
47581        "SorobanTransactionData",
47582        "TransactionV0",
47583        "TransactionV0Ext",
47584        "TransactionV0Envelope",
47585        "Transaction",
47586        "TransactionExt",
47587        "TransactionV1Envelope",
47588        "FeeBumpTransaction",
47589        "FeeBumpTransactionInnerTx",
47590        "FeeBumpTransactionExt",
47591        "FeeBumpTransactionEnvelope",
47592        "TransactionEnvelope",
47593        "TransactionSignaturePayload",
47594        "TransactionSignaturePayloadTaggedTransaction",
47595        "ClaimAtomType",
47596        "ClaimOfferAtomV0",
47597        "ClaimOfferAtom",
47598        "ClaimLiquidityAtom",
47599        "ClaimAtom",
47600        "CreateAccountResultCode",
47601        "CreateAccountResult",
47602        "PaymentResultCode",
47603        "PaymentResult",
47604        "PathPaymentStrictReceiveResultCode",
47605        "SimplePaymentResult",
47606        "PathPaymentStrictReceiveResult",
47607        "PathPaymentStrictReceiveResultSuccess",
47608        "PathPaymentStrictSendResultCode",
47609        "PathPaymentStrictSendResult",
47610        "PathPaymentStrictSendResultSuccess",
47611        "ManageSellOfferResultCode",
47612        "ManageOfferEffect",
47613        "ManageOfferSuccessResult",
47614        "ManageOfferSuccessResultOffer",
47615        "ManageSellOfferResult",
47616        "ManageBuyOfferResultCode",
47617        "ManageBuyOfferResult",
47618        "SetOptionsResultCode",
47619        "SetOptionsResult",
47620        "ChangeTrustResultCode",
47621        "ChangeTrustResult",
47622        "AllowTrustResultCode",
47623        "AllowTrustResult",
47624        "AccountMergeResultCode",
47625        "AccountMergeResult",
47626        "InflationResultCode",
47627        "InflationPayout",
47628        "InflationResult",
47629        "ManageDataResultCode",
47630        "ManageDataResult",
47631        "BumpSequenceResultCode",
47632        "BumpSequenceResult",
47633        "CreateClaimableBalanceResultCode",
47634        "CreateClaimableBalanceResult",
47635        "ClaimClaimableBalanceResultCode",
47636        "ClaimClaimableBalanceResult",
47637        "BeginSponsoringFutureReservesResultCode",
47638        "BeginSponsoringFutureReservesResult",
47639        "EndSponsoringFutureReservesResultCode",
47640        "EndSponsoringFutureReservesResult",
47641        "RevokeSponsorshipResultCode",
47642        "RevokeSponsorshipResult",
47643        "ClawbackResultCode",
47644        "ClawbackResult",
47645        "ClawbackClaimableBalanceResultCode",
47646        "ClawbackClaimableBalanceResult",
47647        "SetTrustLineFlagsResultCode",
47648        "SetTrustLineFlagsResult",
47649        "LiquidityPoolDepositResultCode",
47650        "LiquidityPoolDepositResult",
47651        "LiquidityPoolWithdrawResultCode",
47652        "LiquidityPoolWithdrawResult",
47653        "InvokeHostFunctionResultCode",
47654        "InvokeHostFunctionResult",
47655        "ExtendFootprintTtlResultCode",
47656        "ExtendFootprintTtlResult",
47657        "RestoreFootprintResultCode",
47658        "RestoreFootprintResult",
47659        "OperationResultCode",
47660        "OperationResult",
47661        "OperationResultTr",
47662        "TransactionResultCode",
47663        "InnerTransactionResult",
47664        "InnerTransactionResultResult",
47665        "InnerTransactionResultExt",
47666        "InnerTransactionResultPair",
47667        "TransactionResult",
47668        "TransactionResultResult",
47669        "TransactionResultExt",
47670        "Hash",
47671        "Uint256",
47672        "Uint32",
47673        "Int32",
47674        "Uint64",
47675        "Int64",
47676        "TimePoint",
47677        "Duration",
47678        "ExtensionPoint",
47679        "CryptoKeyType",
47680        "PublicKeyType",
47681        "SignerKeyType",
47682        "PublicKey",
47683        "SignerKey",
47684        "SignerKeyEd25519SignedPayload",
47685        "Signature",
47686        "SignatureHint",
47687        "NodeId",
47688        "AccountId",
47689        "Curve25519Secret",
47690        "Curve25519Public",
47691        "HmacSha256Key",
47692        "HmacSha256Mac",
47693        "ShortHashSeed",
47694        "BinaryFuseFilterType",
47695        "SerializedBinaryFuseFilter",
47696    ];
47697
47698    #[must_use]
47699    #[allow(clippy::too_many_lines)]
47700    pub const fn name(&self) -> &'static str {
47701        match self {
47702            Self::Value => "Value",
47703            Self::ScpBallot => "ScpBallot",
47704            Self::ScpStatementType => "ScpStatementType",
47705            Self::ScpNomination => "ScpNomination",
47706            Self::ScpStatement => "ScpStatement",
47707            Self::ScpStatementPledges => "ScpStatementPledges",
47708            Self::ScpStatementPrepare => "ScpStatementPrepare",
47709            Self::ScpStatementConfirm => "ScpStatementConfirm",
47710            Self::ScpStatementExternalize => "ScpStatementExternalize",
47711            Self::ScpEnvelope => "ScpEnvelope",
47712            Self::ScpQuorumSet => "ScpQuorumSet",
47713            Self::ConfigSettingContractExecutionLanesV0 => "ConfigSettingContractExecutionLanesV0",
47714            Self::ConfigSettingContractComputeV0 => "ConfigSettingContractComputeV0",
47715            Self::ConfigSettingContractLedgerCostV0 => "ConfigSettingContractLedgerCostV0",
47716            Self::ConfigSettingContractHistoricalDataV0 => "ConfigSettingContractHistoricalDataV0",
47717            Self::ConfigSettingContractEventsV0 => "ConfigSettingContractEventsV0",
47718            Self::ConfigSettingContractBandwidthV0 => "ConfigSettingContractBandwidthV0",
47719            Self::ContractCostType => "ContractCostType",
47720            Self::ContractCostParamEntry => "ContractCostParamEntry",
47721            Self::StateArchivalSettings => "StateArchivalSettings",
47722            Self::EvictionIterator => "EvictionIterator",
47723            Self::ContractCostParams => "ContractCostParams",
47724            Self::ConfigSettingId => "ConfigSettingId",
47725            Self::ConfigSettingEntry => "ConfigSettingEntry",
47726            Self::ScEnvMetaKind => "ScEnvMetaKind",
47727            Self::ScEnvMetaEntry => "ScEnvMetaEntry",
47728            Self::ScEnvMetaEntryInterfaceVersion => "ScEnvMetaEntryInterfaceVersion",
47729            Self::ScMetaV0 => "ScMetaV0",
47730            Self::ScMetaKind => "ScMetaKind",
47731            Self::ScMetaEntry => "ScMetaEntry",
47732            Self::ScSpecType => "ScSpecType",
47733            Self::ScSpecTypeOption => "ScSpecTypeOption",
47734            Self::ScSpecTypeResult => "ScSpecTypeResult",
47735            Self::ScSpecTypeVec => "ScSpecTypeVec",
47736            Self::ScSpecTypeMap => "ScSpecTypeMap",
47737            Self::ScSpecTypeTuple => "ScSpecTypeTuple",
47738            Self::ScSpecTypeBytesN => "ScSpecTypeBytesN",
47739            Self::ScSpecTypeUdt => "ScSpecTypeUdt",
47740            Self::ScSpecTypeDef => "ScSpecTypeDef",
47741            Self::ScSpecUdtStructFieldV0 => "ScSpecUdtStructFieldV0",
47742            Self::ScSpecUdtStructV0 => "ScSpecUdtStructV0",
47743            Self::ScSpecUdtUnionCaseVoidV0 => "ScSpecUdtUnionCaseVoidV0",
47744            Self::ScSpecUdtUnionCaseTupleV0 => "ScSpecUdtUnionCaseTupleV0",
47745            Self::ScSpecUdtUnionCaseV0Kind => "ScSpecUdtUnionCaseV0Kind",
47746            Self::ScSpecUdtUnionCaseV0 => "ScSpecUdtUnionCaseV0",
47747            Self::ScSpecUdtUnionV0 => "ScSpecUdtUnionV0",
47748            Self::ScSpecUdtEnumCaseV0 => "ScSpecUdtEnumCaseV0",
47749            Self::ScSpecUdtEnumV0 => "ScSpecUdtEnumV0",
47750            Self::ScSpecUdtErrorEnumCaseV0 => "ScSpecUdtErrorEnumCaseV0",
47751            Self::ScSpecUdtErrorEnumV0 => "ScSpecUdtErrorEnumV0",
47752            Self::ScSpecFunctionInputV0 => "ScSpecFunctionInputV0",
47753            Self::ScSpecFunctionV0 => "ScSpecFunctionV0",
47754            Self::ScSpecEntryKind => "ScSpecEntryKind",
47755            Self::ScSpecEntry => "ScSpecEntry",
47756            Self::ScValType => "ScValType",
47757            Self::ScErrorType => "ScErrorType",
47758            Self::ScErrorCode => "ScErrorCode",
47759            Self::ScError => "ScError",
47760            Self::UInt128Parts => "UInt128Parts",
47761            Self::Int128Parts => "Int128Parts",
47762            Self::UInt256Parts => "UInt256Parts",
47763            Self::Int256Parts => "Int256Parts",
47764            Self::ContractExecutableType => "ContractExecutableType",
47765            Self::ContractExecutable => "ContractExecutable",
47766            Self::ScAddressType => "ScAddressType",
47767            Self::ScAddress => "ScAddress",
47768            Self::ScVec => "ScVec",
47769            Self::ScMap => "ScMap",
47770            Self::ScBytes => "ScBytes",
47771            Self::ScString => "ScString",
47772            Self::ScSymbol => "ScSymbol",
47773            Self::ScNonceKey => "ScNonceKey",
47774            Self::ScContractInstance => "ScContractInstance",
47775            Self::ScVal => "ScVal",
47776            Self::ScMapEntry => "ScMapEntry",
47777            Self::StoredTransactionSet => "StoredTransactionSet",
47778            Self::StoredDebugTransactionSet => "StoredDebugTransactionSet",
47779            Self::PersistedScpStateV0 => "PersistedScpStateV0",
47780            Self::PersistedScpStateV1 => "PersistedScpStateV1",
47781            Self::PersistedScpState => "PersistedScpState",
47782            Self::Thresholds => "Thresholds",
47783            Self::String32 => "String32",
47784            Self::String64 => "String64",
47785            Self::SequenceNumber => "SequenceNumber",
47786            Self::DataValue => "DataValue",
47787            Self::PoolId => "PoolId",
47788            Self::AssetCode4 => "AssetCode4",
47789            Self::AssetCode12 => "AssetCode12",
47790            Self::AssetType => "AssetType",
47791            Self::AssetCode => "AssetCode",
47792            Self::AlphaNum4 => "AlphaNum4",
47793            Self::AlphaNum12 => "AlphaNum12",
47794            Self::Asset => "Asset",
47795            Self::Price => "Price",
47796            Self::Liabilities => "Liabilities",
47797            Self::ThresholdIndexes => "ThresholdIndexes",
47798            Self::LedgerEntryType => "LedgerEntryType",
47799            Self::Signer => "Signer",
47800            Self::AccountFlags => "AccountFlags",
47801            Self::SponsorshipDescriptor => "SponsorshipDescriptor",
47802            Self::AccountEntryExtensionV3 => "AccountEntryExtensionV3",
47803            Self::AccountEntryExtensionV2 => "AccountEntryExtensionV2",
47804            Self::AccountEntryExtensionV2Ext => "AccountEntryExtensionV2Ext",
47805            Self::AccountEntryExtensionV1 => "AccountEntryExtensionV1",
47806            Self::AccountEntryExtensionV1Ext => "AccountEntryExtensionV1Ext",
47807            Self::AccountEntry => "AccountEntry",
47808            Self::AccountEntryExt => "AccountEntryExt",
47809            Self::TrustLineFlags => "TrustLineFlags",
47810            Self::LiquidityPoolType => "LiquidityPoolType",
47811            Self::TrustLineAsset => "TrustLineAsset",
47812            Self::TrustLineEntryExtensionV2 => "TrustLineEntryExtensionV2",
47813            Self::TrustLineEntryExtensionV2Ext => "TrustLineEntryExtensionV2Ext",
47814            Self::TrustLineEntry => "TrustLineEntry",
47815            Self::TrustLineEntryExt => "TrustLineEntryExt",
47816            Self::TrustLineEntryV1 => "TrustLineEntryV1",
47817            Self::TrustLineEntryV1Ext => "TrustLineEntryV1Ext",
47818            Self::OfferEntryFlags => "OfferEntryFlags",
47819            Self::OfferEntry => "OfferEntry",
47820            Self::OfferEntryExt => "OfferEntryExt",
47821            Self::DataEntry => "DataEntry",
47822            Self::DataEntryExt => "DataEntryExt",
47823            Self::ClaimPredicateType => "ClaimPredicateType",
47824            Self::ClaimPredicate => "ClaimPredicate",
47825            Self::ClaimantType => "ClaimantType",
47826            Self::Claimant => "Claimant",
47827            Self::ClaimantV0 => "ClaimantV0",
47828            Self::ClaimableBalanceIdType => "ClaimableBalanceIdType",
47829            Self::ClaimableBalanceId => "ClaimableBalanceId",
47830            Self::ClaimableBalanceFlags => "ClaimableBalanceFlags",
47831            Self::ClaimableBalanceEntryExtensionV1 => "ClaimableBalanceEntryExtensionV1",
47832            Self::ClaimableBalanceEntryExtensionV1Ext => "ClaimableBalanceEntryExtensionV1Ext",
47833            Self::ClaimableBalanceEntry => "ClaimableBalanceEntry",
47834            Self::ClaimableBalanceEntryExt => "ClaimableBalanceEntryExt",
47835            Self::LiquidityPoolConstantProductParameters => {
47836                "LiquidityPoolConstantProductParameters"
47837            }
47838            Self::LiquidityPoolEntry => "LiquidityPoolEntry",
47839            Self::LiquidityPoolEntryBody => "LiquidityPoolEntryBody",
47840            Self::LiquidityPoolEntryConstantProduct => "LiquidityPoolEntryConstantProduct",
47841            Self::ContractDataDurability => "ContractDataDurability",
47842            Self::ContractDataEntry => "ContractDataEntry",
47843            Self::ContractCodeCostInputs => "ContractCodeCostInputs",
47844            Self::ContractCodeEntry => "ContractCodeEntry",
47845            Self::ContractCodeEntryExt => "ContractCodeEntryExt",
47846            Self::ContractCodeEntryV1 => "ContractCodeEntryV1",
47847            Self::TtlEntry => "TtlEntry",
47848            Self::LedgerEntryExtensionV1 => "LedgerEntryExtensionV1",
47849            Self::LedgerEntryExtensionV1Ext => "LedgerEntryExtensionV1Ext",
47850            Self::LedgerEntry => "LedgerEntry",
47851            Self::LedgerEntryData => "LedgerEntryData",
47852            Self::LedgerEntryExt => "LedgerEntryExt",
47853            Self::LedgerKey => "LedgerKey",
47854            Self::LedgerKeyAccount => "LedgerKeyAccount",
47855            Self::LedgerKeyTrustLine => "LedgerKeyTrustLine",
47856            Self::LedgerKeyOffer => "LedgerKeyOffer",
47857            Self::LedgerKeyData => "LedgerKeyData",
47858            Self::LedgerKeyClaimableBalance => "LedgerKeyClaimableBalance",
47859            Self::LedgerKeyLiquidityPool => "LedgerKeyLiquidityPool",
47860            Self::LedgerKeyContractData => "LedgerKeyContractData",
47861            Self::LedgerKeyContractCode => "LedgerKeyContractCode",
47862            Self::LedgerKeyConfigSetting => "LedgerKeyConfigSetting",
47863            Self::LedgerKeyTtl => "LedgerKeyTtl",
47864            Self::EnvelopeType => "EnvelopeType",
47865            Self::BucketListType => "BucketListType",
47866            Self::BucketEntryType => "BucketEntryType",
47867            Self::HotArchiveBucketEntryType => "HotArchiveBucketEntryType",
47868            Self::ColdArchiveBucketEntryType => "ColdArchiveBucketEntryType",
47869            Self::BucketMetadata => "BucketMetadata",
47870            Self::BucketMetadataExt => "BucketMetadataExt",
47871            Self::BucketEntry => "BucketEntry",
47872            Self::HotArchiveBucketEntry => "HotArchiveBucketEntry",
47873            Self::ColdArchiveArchivedLeaf => "ColdArchiveArchivedLeaf",
47874            Self::ColdArchiveDeletedLeaf => "ColdArchiveDeletedLeaf",
47875            Self::ColdArchiveBoundaryLeaf => "ColdArchiveBoundaryLeaf",
47876            Self::ColdArchiveHashEntry => "ColdArchiveHashEntry",
47877            Self::ColdArchiveBucketEntry => "ColdArchiveBucketEntry",
47878            Self::UpgradeType => "UpgradeType",
47879            Self::StellarValueType => "StellarValueType",
47880            Self::LedgerCloseValueSignature => "LedgerCloseValueSignature",
47881            Self::StellarValue => "StellarValue",
47882            Self::StellarValueExt => "StellarValueExt",
47883            Self::LedgerHeaderFlags => "LedgerHeaderFlags",
47884            Self::LedgerHeaderExtensionV1 => "LedgerHeaderExtensionV1",
47885            Self::LedgerHeaderExtensionV1Ext => "LedgerHeaderExtensionV1Ext",
47886            Self::LedgerHeader => "LedgerHeader",
47887            Self::LedgerHeaderExt => "LedgerHeaderExt",
47888            Self::LedgerUpgradeType => "LedgerUpgradeType",
47889            Self::ConfigUpgradeSetKey => "ConfigUpgradeSetKey",
47890            Self::LedgerUpgrade => "LedgerUpgrade",
47891            Self::ConfigUpgradeSet => "ConfigUpgradeSet",
47892            Self::TxSetComponentType => "TxSetComponentType",
47893            Self::TxSetComponent => "TxSetComponent",
47894            Self::TxSetComponentTxsMaybeDiscountedFee => "TxSetComponentTxsMaybeDiscountedFee",
47895            Self::TransactionPhase => "TransactionPhase",
47896            Self::TransactionSet => "TransactionSet",
47897            Self::TransactionSetV1 => "TransactionSetV1",
47898            Self::GeneralizedTransactionSet => "GeneralizedTransactionSet",
47899            Self::TransactionResultPair => "TransactionResultPair",
47900            Self::TransactionResultSet => "TransactionResultSet",
47901            Self::TransactionHistoryEntry => "TransactionHistoryEntry",
47902            Self::TransactionHistoryEntryExt => "TransactionHistoryEntryExt",
47903            Self::TransactionHistoryResultEntry => "TransactionHistoryResultEntry",
47904            Self::TransactionHistoryResultEntryExt => "TransactionHistoryResultEntryExt",
47905            Self::LedgerHeaderHistoryEntry => "LedgerHeaderHistoryEntry",
47906            Self::LedgerHeaderHistoryEntryExt => "LedgerHeaderHistoryEntryExt",
47907            Self::LedgerScpMessages => "LedgerScpMessages",
47908            Self::ScpHistoryEntryV0 => "ScpHistoryEntryV0",
47909            Self::ScpHistoryEntry => "ScpHistoryEntry",
47910            Self::LedgerEntryChangeType => "LedgerEntryChangeType",
47911            Self::LedgerEntryChange => "LedgerEntryChange",
47912            Self::LedgerEntryChanges => "LedgerEntryChanges",
47913            Self::OperationMeta => "OperationMeta",
47914            Self::TransactionMetaV1 => "TransactionMetaV1",
47915            Self::TransactionMetaV2 => "TransactionMetaV2",
47916            Self::ContractEventType => "ContractEventType",
47917            Self::ContractEvent => "ContractEvent",
47918            Self::ContractEventBody => "ContractEventBody",
47919            Self::ContractEventV0 => "ContractEventV0",
47920            Self::DiagnosticEvent => "DiagnosticEvent",
47921            Self::DiagnosticEvents => "DiagnosticEvents",
47922            Self::SorobanTransactionMetaExtV1 => "SorobanTransactionMetaExtV1",
47923            Self::SorobanTransactionMetaExt => "SorobanTransactionMetaExt",
47924            Self::SorobanTransactionMeta => "SorobanTransactionMeta",
47925            Self::TransactionMetaV3 => "TransactionMetaV3",
47926            Self::InvokeHostFunctionSuccessPreImage => "InvokeHostFunctionSuccessPreImage",
47927            Self::TransactionMeta => "TransactionMeta",
47928            Self::TransactionResultMeta => "TransactionResultMeta",
47929            Self::UpgradeEntryMeta => "UpgradeEntryMeta",
47930            Self::LedgerCloseMetaV0 => "LedgerCloseMetaV0",
47931            Self::LedgerCloseMetaExtV1 => "LedgerCloseMetaExtV1",
47932            Self::LedgerCloseMetaExt => "LedgerCloseMetaExt",
47933            Self::LedgerCloseMetaV1 => "LedgerCloseMetaV1",
47934            Self::LedgerCloseMeta => "LedgerCloseMeta",
47935            Self::ErrorCode => "ErrorCode",
47936            Self::SError => "SError",
47937            Self::SendMore => "SendMore",
47938            Self::SendMoreExtended => "SendMoreExtended",
47939            Self::AuthCert => "AuthCert",
47940            Self::Hello => "Hello",
47941            Self::Auth => "Auth",
47942            Self::IpAddrType => "IpAddrType",
47943            Self::PeerAddress => "PeerAddress",
47944            Self::PeerAddressIp => "PeerAddressIp",
47945            Self::MessageType => "MessageType",
47946            Self::DontHave => "DontHave",
47947            Self::SurveyMessageCommandType => "SurveyMessageCommandType",
47948            Self::SurveyMessageResponseType => "SurveyMessageResponseType",
47949            Self::TimeSlicedSurveyStartCollectingMessage => {
47950                "TimeSlicedSurveyStartCollectingMessage"
47951            }
47952            Self::SignedTimeSlicedSurveyStartCollectingMessage => {
47953                "SignedTimeSlicedSurveyStartCollectingMessage"
47954            }
47955            Self::TimeSlicedSurveyStopCollectingMessage => "TimeSlicedSurveyStopCollectingMessage",
47956            Self::SignedTimeSlicedSurveyStopCollectingMessage => {
47957                "SignedTimeSlicedSurveyStopCollectingMessage"
47958            }
47959            Self::SurveyRequestMessage => "SurveyRequestMessage",
47960            Self::TimeSlicedSurveyRequestMessage => "TimeSlicedSurveyRequestMessage",
47961            Self::SignedSurveyRequestMessage => "SignedSurveyRequestMessage",
47962            Self::SignedTimeSlicedSurveyRequestMessage => "SignedTimeSlicedSurveyRequestMessage",
47963            Self::EncryptedBody => "EncryptedBody",
47964            Self::SurveyResponseMessage => "SurveyResponseMessage",
47965            Self::TimeSlicedSurveyResponseMessage => "TimeSlicedSurveyResponseMessage",
47966            Self::SignedSurveyResponseMessage => "SignedSurveyResponseMessage",
47967            Self::SignedTimeSlicedSurveyResponseMessage => "SignedTimeSlicedSurveyResponseMessage",
47968            Self::PeerStats => "PeerStats",
47969            Self::PeerStatList => "PeerStatList",
47970            Self::TimeSlicedNodeData => "TimeSlicedNodeData",
47971            Self::TimeSlicedPeerData => "TimeSlicedPeerData",
47972            Self::TimeSlicedPeerDataList => "TimeSlicedPeerDataList",
47973            Self::TopologyResponseBodyV0 => "TopologyResponseBodyV0",
47974            Self::TopologyResponseBodyV1 => "TopologyResponseBodyV1",
47975            Self::TopologyResponseBodyV2 => "TopologyResponseBodyV2",
47976            Self::SurveyResponseBody => "SurveyResponseBody",
47977            Self::TxAdvertVector => "TxAdvertVector",
47978            Self::FloodAdvert => "FloodAdvert",
47979            Self::TxDemandVector => "TxDemandVector",
47980            Self::FloodDemand => "FloodDemand",
47981            Self::StellarMessage => "StellarMessage",
47982            Self::AuthenticatedMessage => "AuthenticatedMessage",
47983            Self::AuthenticatedMessageV0 => "AuthenticatedMessageV0",
47984            Self::LiquidityPoolParameters => "LiquidityPoolParameters",
47985            Self::MuxedAccount => "MuxedAccount",
47986            Self::MuxedAccountMed25519 => "MuxedAccountMed25519",
47987            Self::DecoratedSignature => "DecoratedSignature",
47988            Self::OperationType => "OperationType",
47989            Self::CreateAccountOp => "CreateAccountOp",
47990            Self::PaymentOp => "PaymentOp",
47991            Self::PathPaymentStrictReceiveOp => "PathPaymentStrictReceiveOp",
47992            Self::PathPaymentStrictSendOp => "PathPaymentStrictSendOp",
47993            Self::ManageSellOfferOp => "ManageSellOfferOp",
47994            Self::ManageBuyOfferOp => "ManageBuyOfferOp",
47995            Self::CreatePassiveSellOfferOp => "CreatePassiveSellOfferOp",
47996            Self::SetOptionsOp => "SetOptionsOp",
47997            Self::ChangeTrustAsset => "ChangeTrustAsset",
47998            Self::ChangeTrustOp => "ChangeTrustOp",
47999            Self::AllowTrustOp => "AllowTrustOp",
48000            Self::ManageDataOp => "ManageDataOp",
48001            Self::BumpSequenceOp => "BumpSequenceOp",
48002            Self::CreateClaimableBalanceOp => "CreateClaimableBalanceOp",
48003            Self::ClaimClaimableBalanceOp => "ClaimClaimableBalanceOp",
48004            Self::BeginSponsoringFutureReservesOp => "BeginSponsoringFutureReservesOp",
48005            Self::RevokeSponsorshipType => "RevokeSponsorshipType",
48006            Self::RevokeSponsorshipOp => "RevokeSponsorshipOp",
48007            Self::RevokeSponsorshipOpSigner => "RevokeSponsorshipOpSigner",
48008            Self::ClawbackOp => "ClawbackOp",
48009            Self::ClawbackClaimableBalanceOp => "ClawbackClaimableBalanceOp",
48010            Self::SetTrustLineFlagsOp => "SetTrustLineFlagsOp",
48011            Self::LiquidityPoolDepositOp => "LiquidityPoolDepositOp",
48012            Self::LiquidityPoolWithdrawOp => "LiquidityPoolWithdrawOp",
48013            Self::HostFunctionType => "HostFunctionType",
48014            Self::ContractIdPreimageType => "ContractIdPreimageType",
48015            Self::ContractIdPreimage => "ContractIdPreimage",
48016            Self::ContractIdPreimageFromAddress => "ContractIdPreimageFromAddress",
48017            Self::CreateContractArgs => "CreateContractArgs",
48018            Self::CreateContractArgsV2 => "CreateContractArgsV2",
48019            Self::InvokeContractArgs => "InvokeContractArgs",
48020            Self::HostFunction => "HostFunction",
48021            Self::SorobanAuthorizedFunctionType => "SorobanAuthorizedFunctionType",
48022            Self::SorobanAuthorizedFunction => "SorobanAuthorizedFunction",
48023            Self::SorobanAuthorizedInvocation => "SorobanAuthorizedInvocation",
48024            Self::SorobanAddressCredentials => "SorobanAddressCredentials",
48025            Self::SorobanCredentialsType => "SorobanCredentialsType",
48026            Self::SorobanCredentials => "SorobanCredentials",
48027            Self::SorobanAuthorizationEntry => "SorobanAuthorizationEntry",
48028            Self::InvokeHostFunctionOp => "InvokeHostFunctionOp",
48029            Self::ExtendFootprintTtlOp => "ExtendFootprintTtlOp",
48030            Self::RestoreFootprintOp => "RestoreFootprintOp",
48031            Self::Operation => "Operation",
48032            Self::OperationBody => "OperationBody",
48033            Self::HashIdPreimage => "HashIdPreimage",
48034            Self::HashIdPreimageOperationId => "HashIdPreimageOperationId",
48035            Self::HashIdPreimageRevokeId => "HashIdPreimageRevokeId",
48036            Self::HashIdPreimageContractId => "HashIdPreimageContractId",
48037            Self::HashIdPreimageSorobanAuthorization => "HashIdPreimageSorobanAuthorization",
48038            Self::MemoType => "MemoType",
48039            Self::Memo => "Memo",
48040            Self::TimeBounds => "TimeBounds",
48041            Self::LedgerBounds => "LedgerBounds",
48042            Self::PreconditionsV2 => "PreconditionsV2",
48043            Self::PreconditionType => "PreconditionType",
48044            Self::Preconditions => "Preconditions",
48045            Self::LedgerFootprint => "LedgerFootprint",
48046            Self::ArchivalProofType => "ArchivalProofType",
48047            Self::ArchivalProofNode => "ArchivalProofNode",
48048            Self::ProofLevel => "ProofLevel",
48049            Self::NonexistenceProofBody => "NonexistenceProofBody",
48050            Self::ExistenceProofBody => "ExistenceProofBody",
48051            Self::ArchivalProof => "ArchivalProof",
48052            Self::ArchivalProofBody => "ArchivalProofBody",
48053            Self::SorobanResources => "SorobanResources",
48054            Self::SorobanTransactionData => "SorobanTransactionData",
48055            Self::TransactionV0 => "TransactionV0",
48056            Self::TransactionV0Ext => "TransactionV0Ext",
48057            Self::TransactionV0Envelope => "TransactionV0Envelope",
48058            Self::Transaction => "Transaction",
48059            Self::TransactionExt => "TransactionExt",
48060            Self::TransactionV1Envelope => "TransactionV1Envelope",
48061            Self::FeeBumpTransaction => "FeeBumpTransaction",
48062            Self::FeeBumpTransactionInnerTx => "FeeBumpTransactionInnerTx",
48063            Self::FeeBumpTransactionExt => "FeeBumpTransactionExt",
48064            Self::FeeBumpTransactionEnvelope => "FeeBumpTransactionEnvelope",
48065            Self::TransactionEnvelope => "TransactionEnvelope",
48066            Self::TransactionSignaturePayload => "TransactionSignaturePayload",
48067            Self::TransactionSignaturePayloadTaggedTransaction => {
48068                "TransactionSignaturePayloadTaggedTransaction"
48069            }
48070            Self::ClaimAtomType => "ClaimAtomType",
48071            Self::ClaimOfferAtomV0 => "ClaimOfferAtomV0",
48072            Self::ClaimOfferAtom => "ClaimOfferAtom",
48073            Self::ClaimLiquidityAtom => "ClaimLiquidityAtom",
48074            Self::ClaimAtom => "ClaimAtom",
48075            Self::CreateAccountResultCode => "CreateAccountResultCode",
48076            Self::CreateAccountResult => "CreateAccountResult",
48077            Self::PaymentResultCode => "PaymentResultCode",
48078            Self::PaymentResult => "PaymentResult",
48079            Self::PathPaymentStrictReceiveResultCode => "PathPaymentStrictReceiveResultCode",
48080            Self::SimplePaymentResult => "SimplePaymentResult",
48081            Self::PathPaymentStrictReceiveResult => "PathPaymentStrictReceiveResult",
48082            Self::PathPaymentStrictReceiveResultSuccess => "PathPaymentStrictReceiveResultSuccess",
48083            Self::PathPaymentStrictSendResultCode => "PathPaymentStrictSendResultCode",
48084            Self::PathPaymentStrictSendResult => "PathPaymentStrictSendResult",
48085            Self::PathPaymentStrictSendResultSuccess => "PathPaymentStrictSendResultSuccess",
48086            Self::ManageSellOfferResultCode => "ManageSellOfferResultCode",
48087            Self::ManageOfferEffect => "ManageOfferEffect",
48088            Self::ManageOfferSuccessResult => "ManageOfferSuccessResult",
48089            Self::ManageOfferSuccessResultOffer => "ManageOfferSuccessResultOffer",
48090            Self::ManageSellOfferResult => "ManageSellOfferResult",
48091            Self::ManageBuyOfferResultCode => "ManageBuyOfferResultCode",
48092            Self::ManageBuyOfferResult => "ManageBuyOfferResult",
48093            Self::SetOptionsResultCode => "SetOptionsResultCode",
48094            Self::SetOptionsResult => "SetOptionsResult",
48095            Self::ChangeTrustResultCode => "ChangeTrustResultCode",
48096            Self::ChangeTrustResult => "ChangeTrustResult",
48097            Self::AllowTrustResultCode => "AllowTrustResultCode",
48098            Self::AllowTrustResult => "AllowTrustResult",
48099            Self::AccountMergeResultCode => "AccountMergeResultCode",
48100            Self::AccountMergeResult => "AccountMergeResult",
48101            Self::InflationResultCode => "InflationResultCode",
48102            Self::InflationPayout => "InflationPayout",
48103            Self::InflationResult => "InflationResult",
48104            Self::ManageDataResultCode => "ManageDataResultCode",
48105            Self::ManageDataResult => "ManageDataResult",
48106            Self::BumpSequenceResultCode => "BumpSequenceResultCode",
48107            Self::BumpSequenceResult => "BumpSequenceResult",
48108            Self::CreateClaimableBalanceResultCode => "CreateClaimableBalanceResultCode",
48109            Self::CreateClaimableBalanceResult => "CreateClaimableBalanceResult",
48110            Self::ClaimClaimableBalanceResultCode => "ClaimClaimableBalanceResultCode",
48111            Self::ClaimClaimableBalanceResult => "ClaimClaimableBalanceResult",
48112            Self::BeginSponsoringFutureReservesResultCode => {
48113                "BeginSponsoringFutureReservesResultCode"
48114            }
48115            Self::BeginSponsoringFutureReservesResult => "BeginSponsoringFutureReservesResult",
48116            Self::EndSponsoringFutureReservesResultCode => "EndSponsoringFutureReservesResultCode",
48117            Self::EndSponsoringFutureReservesResult => "EndSponsoringFutureReservesResult",
48118            Self::RevokeSponsorshipResultCode => "RevokeSponsorshipResultCode",
48119            Self::RevokeSponsorshipResult => "RevokeSponsorshipResult",
48120            Self::ClawbackResultCode => "ClawbackResultCode",
48121            Self::ClawbackResult => "ClawbackResult",
48122            Self::ClawbackClaimableBalanceResultCode => "ClawbackClaimableBalanceResultCode",
48123            Self::ClawbackClaimableBalanceResult => "ClawbackClaimableBalanceResult",
48124            Self::SetTrustLineFlagsResultCode => "SetTrustLineFlagsResultCode",
48125            Self::SetTrustLineFlagsResult => "SetTrustLineFlagsResult",
48126            Self::LiquidityPoolDepositResultCode => "LiquidityPoolDepositResultCode",
48127            Self::LiquidityPoolDepositResult => "LiquidityPoolDepositResult",
48128            Self::LiquidityPoolWithdrawResultCode => "LiquidityPoolWithdrawResultCode",
48129            Self::LiquidityPoolWithdrawResult => "LiquidityPoolWithdrawResult",
48130            Self::InvokeHostFunctionResultCode => "InvokeHostFunctionResultCode",
48131            Self::InvokeHostFunctionResult => "InvokeHostFunctionResult",
48132            Self::ExtendFootprintTtlResultCode => "ExtendFootprintTtlResultCode",
48133            Self::ExtendFootprintTtlResult => "ExtendFootprintTtlResult",
48134            Self::RestoreFootprintResultCode => "RestoreFootprintResultCode",
48135            Self::RestoreFootprintResult => "RestoreFootprintResult",
48136            Self::OperationResultCode => "OperationResultCode",
48137            Self::OperationResult => "OperationResult",
48138            Self::OperationResultTr => "OperationResultTr",
48139            Self::TransactionResultCode => "TransactionResultCode",
48140            Self::InnerTransactionResult => "InnerTransactionResult",
48141            Self::InnerTransactionResultResult => "InnerTransactionResultResult",
48142            Self::InnerTransactionResultExt => "InnerTransactionResultExt",
48143            Self::InnerTransactionResultPair => "InnerTransactionResultPair",
48144            Self::TransactionResult => "TransactionResult",
48145            Self::TransactionResultResult => "TransactionResultResult",
48146            Self::TransactionResultExt => "TransactionResultExt",
48147            Self::Hash => "Hash",
48148            Self::Uint256 => "Uint256",
48149            Self::Uint32 => "Uint32",
48150            Self::Int32 => "Int32",
48151            Self::Uint64 => "Uint64",
48152            Self::Int64 => "Int64",
48153            Self::TimePoint => "TimePoint",
48154            Self::Duration => "Duration",
48155            Self::ExtensionPoint => "ExtensionPoint",
48156            Self::CryptoKeyType => "CryptoKeyType",
48157            Self::PublicKeyType => "PublicKeyType",
48158            Self::SignerKeyType => "SignerKeyType",
48159            Self::PublicKey => "PublicKey",
48160            Self::SignerKey => "SignerKey",
48161            Self::SignerKeyEd25519SignedPayload => "SignerKeyEd25519SignedPayload",
48162            Self::Signature => "Signature",
48163            Self::SignatureHint => "SignatureHint",
48164            Self::NodeId => "NodeId",
48165            Self::AccountId => "AccountId",
48166            Self::Curve25519Secret => "Curve25519Secret",
48167            Self::Curve25519Public => "Curve25519Public",
48168            Self::HmacSha256Key => "HmacSha256Key",
48169            Self::HmacSha256Mac => "HmacSha256Mac",
48170            Self::ShortHashSeed => "ShortHashSeed",
48171            Self::BinaryFuseFilterType => "BinaryFuseFilterType",
48172            Self::SerializedBinaryFuseFilter => "SerializedBinaryFuseFilter",
48173        }
48174    }
48175
48176    #[must_use]
48177    #[allow(clippy::too_many_lines)]
48178    pub const fn variants() -> [TypeVariant; 459] {
48179        Self::VARIANTS
48180    }
48181
48182    #[cfg(feature = "schemars")]
48183    #[must_use]
48184    #[allow(clippy::too_many_lines)]
48185    pub fn json_schema(&self, gen: schemars::gen::SchemaGenerator) -> schemars::schema::RootSchema {
48186        match self {
48187            Self::Value => gen.into_root_schema_for::<Value>(),
48188            Self::ScpBallot => gen.into_root_schema_for::<ScpBallot>(),
48189            Self::ScpStatementType => gen.into_root_schema_for::<ScpStatementType>(),
48190            Self::ScpNomination => gen.into_root_schema_for::<ScpNomination>(),
48191            Self::ScpStatement => gen.into_root_schema_for::<ScpStatement>(),
48192            Self::ScpStatementPledges => gen.into_root_schema_for::<ScpStatementPledges>(),
48193            Self::ScpStatementPrepare => gen.into_root_schema_for::<ScpStatementPrepare>(),
48194            Self::ScpStatementConfirm => gen.into_root_schema_for::<ScpStatementConfirm>(),
48195            Self::ScpStatementExternalize => gen.into_root_schema_for::<ScpStatementExternalize>(),
48196            Self::ScpEnvelope => gen.into_root_schema_for::<ScpEnvelope>(),
48197            Self::ScpQuorumSet => gen.into_root_schema_for::<ScpQuorumSet>(),
48198            Self::ConfigSettingContractExecutionLanesV0 => {
48199                gen.into_root_schema_for::<ConfigSettingContractExecutionLanesV0>()
48200            }
48201            Self::ConfigSettingContractComputeV0 => {
48202                gen.into_root_schema_for::<ConfigSettingContractComputeV0>()
48203            }
48204            Self::ConfigSettingContractLedgerCostV0 => {
48205                gen.into_root_schema_for::<ConfigSettingContractLedgerCostV0>()
48206            }
48207            Self::ConfigSettingContractHistoricalDataV0 => {
48208                gen.into_root_schema_for::<ConfigSettingContractHistoricalDataV0>()
48209            }
48210            Self::ConfigSettingContractEventsV0 => {
48211                gen.into_root_schema_for::<ConfigSettingContractEventsV0>()
48212            }
48213            Self::ConfigSettingContractBandwidthV0 => {
48214                gen.into_root_schema_for::<ConfigSettingContractBandwidthV0>()
48215            }
48216            Self::ContractCostType => gen.into_root_schema_for::<ContractCostType>(),
48217            Self::ContractCostParamEntry => gen.into_root_schema_for::<ContractCostParamEntry>(),
48218            Self::StateArchivalSettings => gen.into_root_schema_for::<StateArchivalSettings>(),
48219            Self::EvictionIterator => gen.into_root_schema_for::<EvictionIterator>(),
48220            Self::ContractCostParams => gen.into_root_schema_for::<ContractCostParams>(),
48221            Self::ConfigSettingId => gen.into_root_schema_for::<ConfigSettingId>(),
48222            Self::ConfigSettingEntry => gen.into_root_schema_for::<ConfigSettingEntry>(),
48223            Self::ScEnvMetaKind => gen.into_root_schema_for::<ScEnvMetaKind>(),
48224            Self::ScEnvMetaEntry => gen.into_root_schema_for::<ScEnvMetaEntry>(),
48225            Self::ScEnvMetaEntryInterfaceVersion => {
48226                gen.into_root_schema_for::<ScEnvMetaEntryInterfaceVersion>()
48227            }
48228            Self::ScMetaV0 => gen.into_root_schema_for::<ScMetaV0>(),
48229            Self::ScMetaKind => gen.into_root_schema_for::<ScMetaKind>(),
48230            Self::ScMetaEntry => gen.into_root_schema_for::<ScMetaEntry>(),
48231            Self::ScSpecType => gen.into_root_schema_for::<ScSpecType>(),
48232            Self::ScSpecTypeOption => gen.into_root_schema_for::<ScSpecTypeOption>(),
48233            Self::ScSpecTypeResult => gen.into_root_schema_for::<ScSpecTypeResult>(),
48234            Self::ScSpecTypeVec => gen.into_root_schema_for::<ScSpecTypeVec>(),
48235            Self::ScSpecTypeMap => gen.into_root_schema_for::<ScSpecTypeMap>(),
48236            Self::ScSpecTypeTuple => gen.into_root_schema_for::<ScSpecTypeTuple>(),
48237            Self::ScSpecTypeBytesN => gen.into_root_schema_for::<ScSpecTypeBytesN>(),
48238            Self::ScSpecTypeUdt => gen.into_root_schema_for::<ScSpecTypeUdt>(),
48239            Self::ScSpecTypeDef => gen.into_root_schema_for::<ScSpecTypeDef>(),
48240            Self::ScSpecUdtStructFieldV0 => gen.into_root_schema_for::<ScSpecUdtStructFieldV0>(),
48241            Self::ScSpecUdtStructV0 => gen.into_root_schema_for::<ScSpecUdtStructV0>(),
48242            Self::ScSpecUdtUnionCaseVoidV0 => {
48243                gen.into_root_schema_for::<ScSpecUdtUnionCaseVoidV0>()
48244            }
48245            Self::ScSpecUdtUnionCaseTupleV0 => {
48246                gen.into_root_schema_for::<ScSpecUdtUnionCaseTupleV0>()
48247            }
48248            Self::ScSpecUdtUnionCaseV0Kind => {
48249                gen.into_root_schema_for::<ScSpecUdtUnionCaseV0Kind>()
48250            }
48251            Self::ScSpecUdtUnionCaseV0 => gen.into_root_schema_for::<ScSpecUdtUnionCaseV0>(),
48252            Self::ScSpecUdtUnionV0 => gen.into_root_schema_for::<ScSpecUdtUnionV0>(),
48253            Self::ScSpecUdtEnumCaseV0 => gen.into_root_schema_for::<ScSpecUdtEnumCaseV0>(),
48254            Self::ScSpecUdtEnumV0 => gen.into_root_schema_for::<ScSpecUdtEnumV0>(),
48255            Self::ScSpecUdtErrorEnumCaseV0 => {
48256                gen.into_root_schema_for::<ScSpecUdtErrorEnumCaseV0>()
48257            }
48258            Self::ScSpecUdtErrorEnumV0 => gen.into_root_schema_for::<ScSpecUdtErrorEnumV0>(),
48259            Self::ScSpecFunctionInputV0 => gen.into_root_schema_for::<ScSpecFunctionInputV0>(),
48260            Self::ScSpecFunctionV0 => gen.into_root_schema_for::<ScSpecFunctionV0>(),
48261            Self::ScSpecEntryKind => gen.into_root_schema_for::<ScSpecEntryKind>(),
48262            Self::ScSpecEntry => gen.into_root_schema_for::<ScSpecEntry>(),
48263            Self::ScValType => gen.into_root_schema_for::<ScValType>(),
48264            Self::ScErrorType => gen.into_root_schema_for::<ScErrorType>(),
48265            Self::ScErrorCode => gen.into_root_schema_for::<ScErrorCode>(),
48266            Self::ScError => gen.into_root_schema_for::<ScError>(),
48267            Self::UInt128Parts => gen.into_root_schema_for::<UInt128Parts>(),
48268            Self::Int128Parts => gen.into_root_schema_for::<Int128Parts>(),
48269            Self::UInt256Parts => gen.into_root_schema_for::<UInt256Parts>(),
48270            Self::Int256Parts => gen.into_root_schema_for::<Int256Parts>(),
48271            Self::ContractExecutableType => gen.into_root_schema_for::<ContractExecutableType>(),
48272            Self::ContractExecutable => gen.into_root_schema_for::<ContractExecutable>(),
48273            Self::ScAddressType => gen.into_root_schema_for::<ScAddressType>(),
48274            Self::ScAddress => gen.into_root_schema_for::<ScAddress>(),
48275            Self::ScVec => gen.into_root_schema_for::<ScVec>(),
48276            Self::ScMap => gen.into_root_schema_for::<ScMap>(),
48277            Self::ScBytes => gen.into_root_schema_for::<ScBytes>(),
48278            Self::ScString => gen.into_root_schema_for::<ScString>(),
48279            Self::ScSymbol => gen.into_root_schema_for::<ScSymbol>(),
48280            Self::ScNonceKey => gen.into_root_schema_for::<ScNonceKey>(),
48281            Self::ScContractInstance => gen.into_root_schema_for::<ScContractInstance>(),
48282            Self::ScVal => gen.into_root_schema_for::<ScVal>(),
48283            Self::ScMapEntry => gen.into_root_schema_for::<ScMapEntry>(),
48284            Self::StoredTransactionSet => gen.into_root_schema_for::<StoredTransactionSet>(),
48285            Self::StoredDebugTransactionSet => {
48286                gen.into_root_schema_for::<StoredDebugTransactionSet>()
48287            }
48288            Self::PersistedScpStateV0 => gen.into_root_schema_for::<PersistedScpStateV0>(),
48289            Self::PersistedScpStateV1 => gen.into_root_schema_for::<PersistedScpStateV1>(),
48290            Self::PersistedScpState => gen.into_root_schema_for::<PersistedScpState>(),
48291            Self::Thresholds => gen.into_root_schema_for::<Thresholds>(),
48292            Self::String32 => gen.into_root_schema_for::<String32>(),
48293            Self::String64 => gen.into_root_schema_for::<String64>(),
48294            Self::SequenceNumber => gen.into_root_schema_for::<SequenceNumber>(),
48295            Self::DataValue => gen.into_root_schema_for::<DataValue>(),
48296            Self::PoolId => gen.into_root_schema_for::<PoolId>(),
48297            Self::AssetCode4 => gen.into_root_schema_for::<AssetCode4>(),
48298            Self::AssetCode12 => gen.into_root_schema_for::<AssetCode12>(),
48299            Self::AssetType => gen.into_root_schema_for::<AssetType>(),
48300            Self::AssetCode => gen.into_root_schema_for::<AssetCode>(),
48301            Self::AlphaNum4 => gen.into_root_schema_for::<AlphaNum4>(),
48302            Self::AlphaNum12 => gen.into_root_schema_for::<AlphaNum12>(),
48303            Self::Asset => gen.into_root_schema_for::<Asset>(),
48304            Self::Price => gen.into_root_schema_for::<Price>(),
48305            Self::Liabilities => gen.into_root_schema_for::<Liabilities>(),
48306            Self::ThresholdIndexes => gen.into_root_schema_for::<ThresholdIndexes>(),
48307            Self::LedgerEntryType => gen.into_root_schema_for::<LedgerEntryType>(),
48308            Self::Signer => gen.into_root_schema_for::<Signer>(),
48309            Self::AccountFlags => gen.into_root_schema_for::<AccountFlags>(),
48310            Self::SponsorshipDescriptor => gen.into_root_schema_for::<SponsorshipDescriptor>(),
48311            Self::AccountEntryExtensionV3 => gen.into_root_schema_for::<AccountEntryExtensionV3>(),
48312            Self::AccountEntryExtensionV2 => gen.into_root_schema_for::<AccountEntryExtensionV2>(),
48313            Self::AccountEntryExtensionV2Ext => {
48314                gen.into_root_schema_for::<AccountEntryExtensionV2Ext>()
48315            }
48316            Self::AccountEntryExtensionV1 => gen.into_root_schema_for::<AccountEntryExtensionV1>(),
48317            Self::AccountEntryExtensionV1Ext => {
48318                gen.into_root_schema_for::<AccountEntryExtensionV1Ext>()
48319            }
48320            Self::AccountEntry => gen.into_root_schema_for::<AccountEntry>(),
48321            Self::AccountEntryExt => gen.into_root_schema_for::<AccountEntryExt>(),
48322            Self::TrustLineFlags => gen.into_root_schema_for::<TrustLineFlags>(),
48323            Self::LiquidityPoolType => gen.into_root_schema_for::<LiquidityPoolType>(),
48324            Self::TrustLineAsset => gen.into_root_schema_for::<TrustLineAsset>(),
48325            Self::TrustLineEntryExtensionV2 => {
48326                gen.into_root_schema_for::<TrustLineEntryExtensionV2>()
48327            }
48328            Self::TrustLineEntryExtensionV2Ext => {
48329                gen.into_root_schema_for::<TrustLineEntryExtensionV2Ext>()
48330            }
48331            Self::TrustLineEntry => gen.into_root_schema_for::<TrustLineEntry>(),
48332            Self::TrustLineEntryExt => gen.into_root_schema_for::<TrustLineEntryExt>(),
48333            Self::TrustLineEntryV1 => gen.into_root_schema_for::<TrustLineEntryV1>(),
48334            Self::TrustLineEntryV1Ext => gen.into_root_schema_for::<TrustLineEntryV1Ext>(),
48335            Self::OfferEntryFlags => gen.into_root_schema_for::<OfferEntryFlags>(),
48336            Self::OfferEntry => gen.into_root_schema_for::<OfferEntry>(),
48337            Self::OfferEntryExt => gen.into_root_schema_for::<OfferEntryExt>(),
48338            Self::DataEntry => gen.into_root_schema_for::<DataEntry>(),
48339            Self::DataEntryExt => gen.into_root_schema_for::<DataEntryExt>(),
48340            Self::ClaimPredicateType => gen.into_root_schema_for::<ClaimPredicateType>(),
48341            Self::ClaimPredicate => gen.into_root_schema_for::<ClaimPredicate>(),
48342            Self::ClaimantType => gen.into_root_schema_for::<ClaimantType>(),
48343            Self::Claimant => gen.into_root_schema_for::<Claimant>(),
48344            Self::ClaimantV0 => gen.into_root_schema_for::<ClaimantV0>(),
48345            Self::ClaimableBalanceIdType => gen.into_root_schema_for::<ClaimableBalanceIdType>(),
48346            Self::ClaimableBalanceId => gen.into_root_schema_for::<ClaimableBalanceId>(),
48347            Self::ClaimableBalanceFlags => gen.into_root_schema_for::<ClaimableBalanceFlags>(),
48348            Self::ClaimableBalanceEntryExtensionV1 => {
48349                gen.into_root_schema_for::<ClaimableBalanceEntryExtensionV1>()
48350            }
48351            Self::ClaimableBalanceEntryExtensionV1Ext => {
48352                gen.into_root_schema_for::<ClaimableBalanceEntryExtensionV1Ext>()
48353            }
48354            Self::ClaimableBalanceEntry => gen.into_root_schema_for::<ClaimableBalanceEntry>(),
48355            Self::ClaimableBalanceEntryExt => {
48356                gen.into_root_schema_for::<ClaimableBalanceEntryExt>()
48357            }
48358            Self::LiquidityPoolConstantProductParameters => {
48359                gen.into_root_schema_for::<LiquidityPoolConstantProductParameters>()
48360            }
48361            Self::LiquidityPoolEntry => gen.into_root_schema_for::<LiquidityPoolEntry>(),
48362            Self::LiquidityPoolEntryBody => gen.into_root_schema_for::<LiquidityPoolEntryBody>(),
48363            Self::LiquidityPoolEntryConstantProduct => {
48364                gen.into_root_schema_for::<LiquidityPoolEntryConstantProduct>()
48365            }
48366            Self::ContractDataDurability => gen.into_root_schema_for::<ContractDataDurability>(),
48367            Self::ContractDataEntry => gen.into_root_schema_for::<ContractDataEntry>(),
48368            Self::ContractCodeCostInputs => gen.into_root_schema_for::<ContractCodeCostInputs>(),
48369            Self::ContractCodeEntry => gen.into_root_schema_for::<ContractCodeEntry>(),
48370            Self::ContractCodeEntryExt => gen.into_root_schema_for::<ContractCodeEntryExt>(),
48371            Self::ContractCodeEntryV1 => gen.into_root_schema_for::<ContractCodeEntryV1>(),
48372            Self::TtlEntry => gen.into_root_schema_for::<TtlEntry>(),
48373            Self::LedgerEntryExtensionV1 => gen.into_root_schema_for::<LedgerEntryExtensionV1>(),
48374            Self::LedgerEntryExtensionV1Ext => {
48375                gen.into_root_schema_for::<LedgerEntryExtensionV1Ext>()
48376            }
48377            Self::LedgerEntry => gen.into_root_schema_for::<LedgerEntry>(),
48378            Self::LedgerEntryData => gen.into_root_schema_for::<LedgerEntryData>(),
48379            Self::LedgerEntryExt => gen.into_root_schema_for::<LedgerEntryExt>(),
48380            Self::LedgerKey => gen.into_root_schema_for::<LedgerKey>(),
48381            Self::LedgerKeyAccount => gen.into_root_schema_for::<LedgerKeyAccount>(),
48382            Self::LedgerKeyTrustLine => gen.into_root_schema_for::<LedgerKeyTrustLine>(),
48383            Self::LedgerKeyOffer => gen.into_root_schema_for::<LedgerKeyOffer>(),
48384            Self::LedgerKeyData => gen.into_root_schema_for::<LedgerKeyData>(),
48385            Self::LedgerKeyClaimableBalance => {
48386                gen.into_root_schema_for::<LedgerKeyClaimableBalance>()
48387            }
48388            Self::LedgerKeyLiquidityPool => gen.into_root_schema_for::<LedgerKeyLiquidityPool>(),
48389            Self::LedgerKeyContractData => gen.into_root_schema_for::<LedgerKeyContractData>(),
48390            Self::LedgerKeyContractCode => gen.into_root_schema_for::<LedgerKeyContractCode>(),
48391            Self::LedgerKeyConfigSetting => gen.into_root_schema_for::<LedgerKeyConfigSetting>(),
48392            Self::LedgerKeyTtl => gen.into_root_schema_for::<LedgerKeyTtl>(),
48393            Self::EnvelopeType => gen.into_root_schema_for::<EnvelopeType>(),
48394            Self::BucketListType => gen.into_root_schema_for::<BucketListType>(),
48395            Self::BucketEntryType => gen.into_root_schema_for::<BucketEntryType>(),
48396            Self::HotArchiveBucketEntryType => {
48397                gen.into_root_schema_for::<HotArchiveBucketEntryType>()
48398            }
48399            Self::ColdArchiveBucketEntryType => {
48400                gen.into_root_schema_for::<ColdArchiveBucketEntryType>()
48401            }
48402            Self::BucketMetadata => gen.into_root_schema_for::<BucketMetadata>(),
48403            Self::BucketMetadataExt => gen.into_root_schema_for::<BucketMetadataExt>(),
48404            Self::BucketEntry => gen.into_root_schema_for::<BucketEntry>(),
48405            Self::HotArchiveBucketEntry => gen.into_root_schema_for::<HotArchiveBucketEntry>(),
48406            Self::ColdArchiveArchivedLeaf => gen.into_root_schema_for::<ColdArchiveArchivedLeaf>(),
48407            Self::ColdArchiveDeletedLeaf => gen.into_root_schema_for::<ColdArchiveDeletedLeaf>(),
48408            Self::ColdArchiveBoundaryLeaf => gen.into_root_schema_for::<ColdArchiveBoundaryLeaf>(),
48409            Self::ColdArchiveHashEntry => gen.into_root_schema_for::<ColdArchiveHashEntry>(),
48410            Self::ColdArchiveBucketEntry => gen.into_root_schema_for::<ColdArchiveBucketEntry>(),
48411            Self::UpgradeType => gen.into_root_schema_for::<UpgradeType>(),
48412            Self::StellarValueType => gen.into_root_schema_for::<StellarValueType>(),
48413            Self::LedgerCloseValueSignature => {
48414                gen.into_root_schema_for::<LedgerCloseValueSignature>()
48415            }
48416            Self::StellarValue => gen.into_root_schema_for::<StellarValue>(),
48417            Self::StellarValueExt => gen.into_root_schema_for::<StellarValueExt>(),
48418            Self::LedgerHeaderFlags => gen.into_root_schema_for::<LedgerHeaderFlags>(),
48419            Self::LedgerHeaderExtensionV1 => gen.into_root_schema_for::<LedgerHeaderExtensionV1>(),
48420            Self::LedgerHeaderExtensionV1Ext => {
48421                gen.into_root_schema_for::<LedgerHeaderExtensionV1Ext>()
48422            }
48423            Self::LedgerHeader => gen.into_root_schema_for::<LedgerHeader>(),
48424            Self::LedgerHeaderExt => gen.into_root_schema_for::<LedgerHeaderExt>(),
48425            Self::LedgerUpgradeType => gen.into_root_schema_for::<LedgerUpgradeType>(),
48426            Self::ConfigUpgradeSetKey => gen.into_root_schema_for::<ConfigUpgradeSetKey>(),
48427            Self::LedgerUpgrade => gen.into_root_schema_for::<LedgerUpgrade>(),
48428            Self::ConfigUpgradeSet => gen.into_root_schema_for::<ConfigUpgradeSet>(),
48429            Self::TxSetComponentType => gen.into_root_schema_for::<TxSetComponentType>(),
48430            Self::TxSetComponent => gen.into_root_schema_for::<TxSetComponent>(),
48431            Self::TxSetComponentTxsMaybeDiscountedFee => {
48432                gen.into_root_schema_for::<TxSetComponentTxsMaybeDiscountedFee>()
48433            }
48434            Self::TransactionPhase => gen.into_root_schema_for::<TransactionPhase>(),
48435            Self::TransactionSet => gen.into_root_schema_for::<TransactionSet>(),
48436            Self::TransactionSetV1 => gen.into_root_schema_for::<TransactionSetV1>(),
48437            Self::GeneralizedTransactionSet => {
48438                gen.into_root_schema_for::<GeneralizedTransactionSet>()
48439            }
48440            Self::TransactionResultPair => gen.into_root_schema_for::<TransactionResultPair>(),
48441            Self::TransactionResultSet => gen.into_root_schema_for::<TransactionResultSet>(),
48442            Self::TransactionHistoryEntry => gen.into_root_schema_for::<TransactionHistoryEntry>(),
48443            Self::TransactionHistoryEntryExt => {
48444                gen.into_root_schema_for::<TransactionHistoryEntryExt>()
48445            }
48446            Self::TransactionHistoryResultEntry => {
48447                gen.into_root_schema_for::<TransactionHistoryResultEntry>()
48448            }
48449            Self::TransactionHistoryResultEntryExt => {
48450                gen.into_root_schema_for::<TransactionHistoryResultEntryExt>()
48451            }
48452            Self::LedgerHeaderHistoryEntry => {
48453                gen.into_root_schema_for::<LedgerHeaderHistoryEntry>()
48454            }
48455            Self::LedgerHeaderHistoryEntryExt => {
48456                gen.into_root_schema_for::<LedgerHeaderHistoryEntryExt>()
48457            }
48458            Self::LedgerScpMessages => gen.into_root_schema_for::<LedgerScpMessages>(),
48459            Self::ScpHistoryEntryV0 => gen.into_root_schema_for::<ScpHistoryEntryV0>(),
48460            Self::ScpHistoryEntry => gen.into_root_schema_for::<ScpHistoryEntry>(),
48461            Self::LedgerEntryChangeType => gen.into_root_schema_for::<LedgerEntryChangeType>(),
48462            Self::LedgerEntryChange => gen.into_root_schema_for::<LedgerEntryChange>(),
48463            Self::LedgerEntryChanges => gen.into_root_schema_for::<LedgerEntryChanges>(),
48464            Self::OperationMeta => gen.into_root_schema_for::<OperationMeta>(),
48465            Self::TransactionMetaV1 => gen.into_root_schema_for::<TransactionMetaV1>(),
48466            Self::TransactionMetaV2 => gen.into_root_schema_for::<TransactionMetaV2>(),
48467            Self::ContractEventType => gen.into_root_schema_for::<ContractEventType>(),
48468            Self::ContractEvent => gen.into_root_schema_for::<ContractEvent>(),
48469            Self::ContractEventBody => gen.into_root_schema_for::<ContractEventBody>(),
48470            Self::ContractEventV0 => gen.into_root_schema_for::<ContractEventV0>(),
48471            Self::DiagnosticEvent => gen.into_root_schema_for::<DiagnosticEvent>(),
48472            Self::DiagnosticEvents => gen.into_root_schema_for::<DiagnosticEvents>(),
48473            Self::SorobanTransactionMetaExtV1 => {
48474                gen.into_root_schema_for::<SorobanTransactionMetaExtV1>()
48475            }
48476            Self::SorobanTransactionMetaExt => {
48477                gen.into_root_schema_for::<SorobanTransactionMetaExt>()
48478            }
48479            Self::SorobanTransactionMeta => gen.into_root_schema_for::<SorobanTransactionMeta>(),
48480            Self::TransactionMetaV3 => gen.into_root_schema_for::<TransactionMetaV3>(),
48481            Self::InvokeHostFunctionSuccessPreImage => {
48482                gen.into_root_schema_for::<InvokeHostFunctionSuccessPreImage>()
48483            }
48484            Self::TransactionMeta => gen.into_root_schema_for::<TransactionMeta>(),
48485            Self::TransactionResultMeta => gen.into_root_schema_for::<TransactionResultMeta>(),
48486            Self::UpgradeEntryMeta => gen.into_root_schema_for::<UpgradeEntryMeta>(),
48487            Self::LedgerCloseMetaV0 => gen.into_root_schema_for::<LedgerCloseMetaV0>(),
48488            Self::LedgerCloseMetaExtV1 => gen.into_root_schema_for::<LedgerCloseMetaExtV1>(),
48489            Self::LedgerCloseMetaExt => gen.into_root_schema_for::<LedgerCloseMetaExt>(),
48490            Self::LedgerCloseMetaV1 => gen.into_root_schema_for::<LedgerCloseMetaV1>(),
48491            Self::LedgerCloseMeta => gen.into_root_schema_for::<LedgerCloseMeta>(),
48492            Self::ErrorCode => gen.into_root_schema_for::<ErrorCode>(),
48493            Self::SError => gen.into_root_schema_for::<SError>(),
48494            Self::SendMore => gen.into_root_schema_for::<SendMore>(),
48495            Self::SendMoreExtended => gen.into_root_schema_for::<SendMoreExtended>(),
48496            Self::AuthCert => gen.into_root_schema_for::<AuthCert>(),
48497            Self::Hello => gen.into_root_schema_for::<Hello>(),
48498            Self::Auth => gen.into_root_schema_for::<Auth>(),
48499            Self::IpAddrType => gen.into_root_schema_for::<IpAddrType>(),
48500            Self::PeerAddress => gen.into_root_schema_for::<PeerAddress>(),
48501            Self::PeerAddressIp => gen.into_root_schema_for::<PeerAddressIp>(),
48502            Self::MessageType => gen.into_root_schema_for::<MessageType>(),
48503            Self::DontHave => gen.into_root_schema_for::<DontHave>(),
48504            Self::SurveyMessageCommandType => {
48505                gen.into_root_schema_for::<SurveyMessageCommandType>()
48506            }
48507            Self::SurveyMessageResponseType => {
48508                gen.into_root_schema_for::<SurveyMessageResponseType>()
48509            }
48510            Self::TimeSlicedSurveyStartCollectingMessage => {
48511                gen.into_root_schema_for::<TimeSlicedSurveyStartCollectingMessage>()
48512            }
48513            Self::SignedTimeSlicedSurveyStartCollectingMessage => {
48514                gen.into_root_schema_for::<SignedTimeSlicedSurveyStartCollectingMessage>()
48515            }
48516            Self::TimeSlicedSurveyStopCollectingMessage => {
48517                gen.into_root_schema_for::<TimeSlicedSurveyStopCollectingMessage>()
48518            }
48519            Self::SignedTimeSlicedSurveyStopCollectingMessage => {
48520                gen.into_root_schema_for::<SignedTimeSlicedSurveyStopCollectingMessage>()
48521            }
48522            Self::SurveyRequestMessage => gen.into_root_schema_for::<SurveyRequestMessage>(),
48523            Self::TimeSlicedSurveyRequestMessage => {
48524                gen.into_root_schema_for::<TimeSlicedSurveyRequestMessage>()
48525            }
48526            Self::SignedSurveyRequestMessage => {
48527                gen.into_root_schema_for::<SignedSurveyRequestMessage>()
48528            }
48529            Self::SignedTimeSlicedSurveyRequestMessage => {
48530                gen.into_root_schema_for::<SignedTimeSlicedSurveyRequestMessage>()
48531            }
48532            Self::EncryptedBody => gen.into_root_schema_for::<EncryptedBody>(),
48533            Self::SurveyResponseMessage => gen.into_root_schema_for::<SurveyResponseMessage>(),
48534            Self::TimeSlicedSurveyResponseMessage => {
48535                gen.into_root_schema_for::<TimeSlicedSurveyResponseMessage>()
48536            }
48537            Self::SignedSurveyResponseMessage => {
48538                gen.into_root_schema_for::<SignedSurveyResponseMessage>()
48539            }
48540            Self::SignedTimeSlicedSurveyResponseMessage => {
48541                gen.into_root_schema_for::<SignedTimeSlicedSurveyResponseMessage>()
48542            }
48543            Self::PeerStats => gen.into_root_schema_for::<PeerStats>(),
48544            Self::PeerStatList => gen.into_root_schema_for::<PeerStatList>(),
48545            Self::TimeSlicedNodeData => gen.into_root_schema_for::<TimeSlicedNodeData>(),
48546            Self::TimeSlicedPeerData => gen.into_root_schema_for::<TimeSlicedPeerData>(),
48547            Self::TimeSlicedPeerDataList => gen.into_root_schema_for::<TimeSlicedPeerDataList>(),
48548            Self::TopologyResponseBodyV0 => gen.into_root_schema_for::<TopologyResponseBodyV0>(),
48549            Self::TopologyResponseBodyV1 => gen.into_root_schema_for::<TopologyResponseBodyV1>(),
48550            Self::TopologyResponseBodyV2 => gen.into_root_schema_for::<TopologyResponseBodyV2>(),
48551            Self::SurveyResponseBody => gen.into_root_schema_for::<SurveyResponseBody>(),
48552            Self::TxAdvertVector => gen.into_root_schema_for::<TxAdvertVector>(),
48553            Self::FloodAdvert => gen.into_root_schema_for::<FloodAdvert>(),
48554            Self::TxDemandVector => gen.into_root_schema_for::<TxDemandVector>(),
48555            Self::FloodDemand => gen.into_root_schema_for::<FloodDemand>(),
48556            Self::StellarMessage => gen.into_root_schema_for::<StellarMessage>(),
48557            Self::AuthenticatedMessage => gen.into_root_schema_for::<AuthenticatedMessage>(),
48558            Self::AuthenticatedMessageV0 => gen.into_root_schema_for::<AuthenticatedMessageV0>(),
48559            Self::LiquidityPoolParameters => gen.into_root_schema_for::<LiquidityPoolParameters>(),
48560            Self::MuxedAccount => gen.into_root_schema_for::<MuxedAccount>(),
48561            Self::MuxedAccountMed25519 => gen.into_root_schema_for::<MuxedAccountMed25519>(),
48562            Self::DecoratedSignature => gen.into_root_schema_for::<DecoratedSignature>(),
48563            Self::OperationType => gen.into_root_schema_for::<OperationType>(),
48564            Self::CreateAccountOp => gen.into_root_schema_for::<CreateAccountOp>(),
48565            Self::PaymentOp => gen.into_root_schema_for::<PaymentOp>(),
48566            Self::PathPaymentStrictReceiveOp => {
48567                gen.into_root_schema_for::<PathPaymentStrictReceiveOp>()
48568            }
48569            Self::PathPaymentStrictSendOp => gen.into_root_schema_for::<PathPaymentStrictSendOp>(),
48570            Self::ManageSellOfferOp => gen.into_root_schema_for::<ManageSellOfferOp>(),
48571            Self::ManageBuyOfferOp => gen.into_root_schema_for::<ManageBuyOfferOp>(),
48572            Self::CreatePassiveSellOfferOp => {
48573                gen.into_root_schema_for::<CreatePassiveSellOfferOp>()
48574            }
48575            Self::SetOptionsOp => gen.into_root_schema_for::<SetOptionsOp>(),
48576            Self::ChangeTrustAsset => gen.into_root_schema_for::<ChangeTrustAsset>(),
48577            Self::ChangeTrustOp => gen.into_root_schema_for::<ChangeTrustOp>(),
48578            Self::AllowTrustOp => gen.into_root_schema_for::<AllowTrustOp>(),
48579            Self::ManageDataOp => gen.into_root_schema_for::<ManageDataOp>(),
48580            Self::BumpSequenceOp => gen.into_root_schema_for::<BumpSequenceOp>(),
48581            Self::CreateClaimableBalanceOp => {
48582                gen.into_root_schema_for::<CreateClaimableBalanceOp>()
48583            }
48584            Self::ClaimClaimableBalanceOp => gen.into_root_schema_for::<ClaimClaimableBalanceOp>(),
48585            Self::BeginSponsoringFutureReservesOp => {
48586                gen.into_root_schema_for::<BeginSponsoringFutureReservesOp>()
48587            }
48588            Self::RevokeSponsorshipType => gen.into_root_schema_for::<RevokeSponsorshipType>(),
48589            Self::RevokeSponsorshipOp => gen.into_root_schema_for::<RevokeSponsorshipOp>(),
48590            Self::RevokeSponsorshipOpSigner => {
48591                gen.into_root_schema_for::<RevokeSponsorshipOpSigner>()
48592            }
48593            Self::ClawbackOp => gen.into_root_schema_for::<ClawbackOp>(),
48594            Self::ClawbackClaimableBalanceOp => {
48595                gen.into_root_schema_for::<ClawbackClaimableBalanceOp>()
48596            }
48597            Self::SetTrustLineFlagsOp => gen.into_root_schema_for::<SetTrustLineFlagsOp>(),
48598            Self::LiquidityPoolDepositOp => gen.into_root_schema_for::<LiquidityPoolDepositOp>(),
48599            Self::LiquidityPoolWithdrawOp => gen.into_root_schema_for::<LiquidityPoolWithdrawOp>(),
48600            Self::HostFunctionType => gen.into_root_schema_for::<HostFunctionType>(),
48601            Self::ContractIdPreimageType => gen.into_root_schema_for::<ContractIdPreimageType>(),
48602            Self::ContractIdPreimage => gen.into_root_schema_for::<ContractIdPreimage>(),
48603            Self::ContractIdPreimageFromAddress => {
48604                gen.into_root_schema_for::<ContractIdPreimageFromAddress>()
48605            }
48606            Self::CreateContractArgs => gen.into_root_schema_for::<CreateContractArgs>(),
48607            Self::CreateContractArgsV2 => gen.into_root_schema_for::<CreateContractArgsV2>(),
48608            Self::InvokeContractArgs => gen.into_root_schema_for::<InvokeContractArgs>(),
48609            Self::HostFunction => gen.into_root_schema_for::<HostFunction>(),
48610            Self::SorobanAuthorizedFunctionType => {
48611                gen.into_root_schema_for::<SorobanAuthorizedFunctionType>()
48612            }
48613            Self::SorobanAuthorizedFunction => {
48614                gen.into_root_schema_for::<SorobanAuthorizedFunction>()
48615            }
48616            Self::SorobanAuthorizedInvocation => {
48617                gen.into_root_schema_for::<SorobanAuthorizedInvocation>()
48618            }
48619            Self::SorobanAddressCredentials => {
48620                gen.into_root_schema_for::<SorobanAddressCredentials>()
48621            }
48622            Self::SorobanCredentialsType => gen.into_root_schema_for::<SorobanCredentialsType>(),
48623            Self::SorobanCredentials => gen.into_root_schema_for::<SorobanCredentials>(),
48624            Self::SorobanAuthorizationEntry => {
48625                gen.into_root_schema_for::<SorobanAuthorizationEntry>()
48626            }
48627            Self::InvokeHostFunctionOp => gen.into_root_schema_for::<InvokeHostFunctionOp>(),
48628            Self::ExtendFootprintTtlOp => gen.into_root_schema_for::<ExtendFootprintTtlOp>(),
48629            Self::RestoreFootprintOp => gen.into_root_schema_for::<RestoreFootprintOp>(),
48630            Self::Operation => gen.into_root_schema_for::<Operation>(),
48631            Self::OperationBody => gen.into_root_schema_for::<OperationBody>(),
48632            Self::HashIdPreimage => gen.into_root_schema_for::<HashIdPreimage>(),
48633            Self::HashIdPreimageOperationId => {
48634                gen.into_root_schema_for::<HashIdPreimageOperationId>()
48635            }
48636            Self::HashIdPreimageRevokeId => gen.into_root_schema_for::<HashIdPreimageRevokeId>(),
48637            Self::HashIdPreimageContractId => {
48638                gen.into_root_schema_for::<HashIdPreimageContractId>()
48639            }
48640            Self::HashIdPreimageSorobanAuthorization => {
48641                gen.into_root_schema_for::<HashIdPreimageSorobanAuthorization>()
48642            }
48643            Self::MemoType => gen.into_root_schema_for::<MemoType>(),
48644            Self::Memo => gen.into_root_schema_for::<Memo>(),
48645            Self::TimeBounds => gen.into_root_schema_for::<TimeBounds>(),
48646            Self::LedgerBounds => gen.into_root_schema_for::<LedgerBounds>(),
48647            Self::PreconditionsV2 => gen.into_root_schema_for::<PreconditionsV2>(),
48648            Self::PreconditionType => gen.into_root_schema_for::<PreconditionType>(),
48649            Self::Preconditions => gen.into_root_schema_for::<Preconditions>(),
48650            Self::LedgerFootprint => gen.into_root_schema_for::<LedgerFootprint>(),
48651            Self::ArchivalProofType => gen.into_root_schema_for::<ArchivalProofType>(),
48652            Self::ArchivalProofNode => gen.into_root_schema_for::<ArchivalProofNode>(),
48653            Self::ProofLevel => gen.into_root_schema_for::<ProofLevel>(),
48654            Self::NonexistenceProofBody => gen.into_root_schema_for::<NonexistenceProofBody>(),
48655            Self::ExistenceProofBody => gen.into_root_schema_for::<ExistenceProofBody>(),
48656            Self::ArchivalProof => gen.into_root_schema_for::<ArchivalProof>(),
48657            Self::ArchivalProofBody => gen.into_root_schema_for::<ArchivalProofBody>(),
48658            Self::SorobanResources => gen.into_root_schema_for::<SorobanResources>(),
48659            Self::SorobanTransactionData => gen.into_root_schema_for::<SorobanTransactionData>(),
48660            Self::TransactionV0 => gen.into_root_schema_for::<TransactionV0>(),
48661            Self::TransactionV0Ext => gen.into_root_schema_for::<TransactionV0Ext>(),
48662            Self::TransactionV0Envelope => gen.into_root_schema_for::<TransactionV0Envelope>(),
48663            Self::Transaction => gen.into_root_schema_for::<Transaction>(),
48664            Self::TransactionExt => gen.into_root_schema_for::<TransactionExt>(),
48665            Self::TransactionV1Envelope => gen.into_root_schema_for::<TransactionV1Envelope>(),
48666            Self::FeeBumpTransaction => gen.into_root_schema_for::<FeeBumpTransaction>(),
48667            Self::FeeBumpTransactionInnerTx => {
48668                gen.into_root_schema_for::<FeeBumpTransactionInnerTx>()
48669            }
48670            Self::FeeBumpTransactionExt => gen.into_root_schema_for::<FeeBumpTransactionExt>(),
48671            Self::FeeBumpTransactionEnvelope => {
48672                gen.into_root_schema_for::<FeeBumpTransactionEnvelope>()
48673            }
48674            Self::TransactionEnvelope => gen.into_root_schema_for::<TransactionEnvelope>(),
48675            Self::TransactionSignaturePayload => {
48676                gen.into_root_schema_for::<TransactionSignaturePayload>()
48677            }
48678            Self::TransactionSignaturePayloadTaggedTransaction => {
48679                gen.into_root_schema_for::<TransactionSignaturePayloadTaggedTransaction>()
48680            }
48681            Self::ClaimAtomType => gen.into_root_schema_for::<ClaimAtomType>(),
48682            Self::ClaimOfferAtomV0 => gen.into_root_schema_for::<ClaimOfferAtomV0>(),
48683            Self::ClaimOfferAtom => gen.into_root_schema_for::<ClaimOfferAtom>(),
48684            Self::ClaimLiquidityAtom => gen.into_root_schema_for::<ClaimLiquidityAtom>(),
48685            Self::ClaimAtom => gen.into_root_schema_for::<ClaimAtom>(),
48686            Self::CreateAccountResultCode => gen.into_root_schema_for::<CreateAccountResultCode>(),
48687            Self::CreateAccountResult => gen.into_root_schema_for::<CreateAccountResult>(),
48688            Self::PaymentResultCode => gen.into_root_schema_for::<PaymentResultCode>(),
48689            Self::PaymentResult => gen.into_root_schema_for::<PaymentResult>(),
48690            Self::PathPaymentStrictReceiveResultCode => {
48691                gen.into_root_schema_for::<PathPaymentStrictReceiveResultCode>()
48692            }
48693            Self::SimplePaymentResult => gen.into_root_schema_for::<SimplePaymentResult>(),
48694            Self::PathPaymentStrictReceiveResult => {
48695                gen.into_root_schema_for::<PathPaymentStrictReceiveResult>()
48696            }
48697            Self::PathPaymentStrictReceiveResultSuccess => {
48698                gen.into_root_schema_for::<PathPaymentStrictReceiveResultSuccess>()
48699            }
48700            Self::PathPaymentStrictSendResultCode => {
48701                gen.into_root_schema_for::<PathPaymentStrictSendResultCode>()
48702            }
48703            Self::PathPaymentStrictSendResult => {
48704                gen.into_root_schema_for::<PathPaymentStrictSendResult>()
48705            }
48706            Self::PathPaymentStrictSendResultSuccess => {
48707                gen.into_root_schema_for::<PathPaymentStrictSendResultSuccess>()
48708            }
48709            Self::ManageSellOfferResultCode => {
48710                gen.into_root_schema_for::<ManageSellOfferResultCode>()
48711            }
48712            Self::ManageOfferEffect => gen.into_root_schema_for::<ManageOfferEffect>(),
48713            Self::ManageOfferSuccessResult => {
48714                gen.into_root_schema_for::<ManageOfferSuccessResult>()
48715            }
48716            Self::ManageOfferSuccessResultOffer => {
48717                gen.into_root_schema_for::<ManageOfferSuccessResultOffer>()
48718            }
48719            Self::ManageSellOfferResult => gen.into_root_schema_for::<ManageSellOfferResult>(),
48720            Self::ManageBuyOfferResultCode => {
48721                gen.into_root_schema_for::<ManageBuyOfferResultCode>()
48722            }
48723            Self::ManageBuyOfferResult => gen.into_root_schema_for::<ManageBuyOfferResult>(),
48724            Self::SetOptionsResultCode => gen.into_root_schema_for::<SetOptionsResultCode>(),
48725            Self::SetOptionsResult => gen.into_root_schema_for::<SetOptionsResult>(),
48726            Self::ChangeTrustResultCode => gen.into_root_schema_for::<ChangeTrustResultCode>(),
48727            Self::ChangeTrustResult => gen.into_root_schema_for::<ChangeTrustResult>(),
48728            Self::AllowTrustResultCode => gen.into_root_schema_for::<AllowTrustResultCode>(),
48729            Self::AllowTrustResult => gen.into_root_schema_for::<AllowTrustResult>(),
48730            Self::AccountMergeResultCode => gen.into_root_schema_for::<AccountMergeResultCode>(),
48731            Self::AccountMergeResult => gen.into_root_schema_for::<AccountMergeResult>(),
48732            Self::InflationResultCode => gen.into_root_schema_for::<InflationResultCode>(),
48733            Self::InflationPayout => gen.into_root_schema_for::<InflationPayout>(),
48734            Self::InflationResult => gen.into_root_schema_for::<InflationResult>(),
48735            Self::ManageDataResultCode => gen.into_root_schema_for::<ManageDataResultCode>(),
48736            Self::ManageDataResult => gen.into_root_schema_for::<ManageDataResult>(),
48737            Self::BumpSequenceResultCode => gen.into_root_schema_for::<BumpSequenceResultCode>(),
48738            Self::BumpSequenceResult => gen.into_root_schema_for::<BumpSequenceResult>(),
48739            Self::CreateClaimableBalanceResultCode => {
48740                gen.into_root_schema_for::<CreateClaimableBalanceResultCode>()
48741            }
48742            Self::CreateClaimableBalanceResult => {
48743                gen.into_root_schema_for::<CreateClaimableBalanceResult>()
48744            }
48745            Self::ClaimClaimableBalanceResultCode => {
48746                gen.into_root_schema_for::<ClaimClaimableBalanceResultCode>()
48747            }
48748            Self::ClaimClaimableBalanceResult => {
48749                gen.into_root_schema_for::<ClaimClaimableBalanceResult>()
48750            }
48751            Self::BeginSponsoringFutureReservesResultCode => {
48752                gen.into_root_schema_for::<BeginSponsoringFutureReservesResultCode>()
48753            }
48754            Self::BeginSponsoringFutureReservesResult => {
48755                gen.into_root_schema_for::<BeginSponsoringFutureReservesResult>()
48756            }
48757            Self::EndSponsoringFutureReservesResultCode => {
48758                gen.into_root_schema_for::<EndSponsoringFutureReservesResultCode>()
48759            }
48760            Self::EndSponsoringFutureReservesResult => {
48761                gen.into_root_schema_for::<EndSponsoringFutureReservesResult>()
48762            }
48763            Self::RevokeSponsorshipResultCode => {
48764                gen.into_root_schema_for::<RevokeSponsorshipResultCode>()
48765            }
48766            Self::RevokeSponsorshipResult => gen.into_root_schema_for::<RevokeSponsorshipResult>(),
48767            Self::ClawbackResultCode => gen.into_root_schema_for::<ClawbackResultCode>(),
48768            Self::ClawbackResult => gen.into_root_schema_for::<ClawbackResult>(),
48769            Self::ClawbackClaimableBalanceResultCode => {
48770                gen.into_root_schema_for::<ClawbackClaimableBalanceResultCode>()
48771            }
48772            Self::ClawbackClaimableBalanceResult => {
48773                gen.into_root_schema_for::<ClawbackClaimableBalanceResult>()
48774            }
48775            Self::SetTrustLineFlagsResultCode => {
48776                gen.into_root_schema_for::<SetTrustLineFlagsResultCode>()
48777            }
48778            Self::SetTrustLineFlagsResult => gen.into_root_schema_for::<SetTrustLineFlagsResult>(),
48779            Self::LiquidityPoolDepositResultCode => {
48780                gen.into_root_schema_for::<LiquidityPoolDepositResultCode>()
48781            }
48782            Self::LiquidityPoolDepositResult => {
48783                gen.into_root_schema_for::<LiquidityPoolDepositResult>()
48784            }
48785            Self::LiquidityPoolWithdrawResultCode => {
48786                gen.into_root_schema_for::<LiquidityPoolWithdrawResultCode>()
48787            }
48788            Self::LiquidityPoolWithdrawResult => {
48789                gen.into_root_schema_for::<LiquidityPoolWithdrawResult>()
48790            }
48791            Self::InvokeHostFunctionResultCode => {
48792                gen.into_root_schema_for::<InvokeHostFunctionResultCode>()
48793            }
48794            Self::InvokeHostFunctionResult => {
48795                gen.into_root_schema_for::<InvokeHostFunctionResult>()
48796            }
48797            Self::ExtendFootprintTtlResultCode => {
48798                gen.into_root_schema_for::<ExtendFootprintTtlResultCode>()
48799            }
48800            Self::ExtendFootprintTtlResult => {
48801                gen.into_root_schema_for::<ExtendFootprintTtlResult>()
48802            }
48803            Self::RestoreFootprintResultCode => {
48804                gen.into_root_schema_for::<RestoreFootprintResultCode>()
48805            }
48806            Self::RestoreFootprintResult => gen.into_root_schema_for::<RestoreFootprintResult>(),
48807            Self::OperationResultCode => gen.into_root_schema_for::<OperationResultCode>(),
48808            Self::OperationResult => gen.into_root_schema_for::<OperationResult>(),
48809            Self::OperationResultTr => gen.into_root_schema_for::<OperationResultTr>(),
48810            Self::TransactionResultCode => gen.into_root_schema_for::<TransactionResultCode>(),
48811            Self::InnerTransactionResult => gen.into_root_schema_for::<InnerTransactionResult>(),
48812            Self::InnerTransactionResultResult => {
48813                gen.into_root_schema_for::<InnerTransactionResultResult>()
48814            }
48815            Self::InnerTransactionResultExt => {
48816                gen.into_root_schema_for::<InnerTransactionResultExt>()
48817            }
48818            Self::InnerTransactionResultPair => {
48819                gen.into_root_schema_for::<InnerTransactionResultPair>()
48820            }
48821            Self::TransactionResult => gen.into_root_schema_for::<TransactionResult>(),
48822            Self::TransactionResultResult => gen.into_root_schema_for::<TransactionResultResult>(),
48823            Self::TransactionResultExt => gen.into_root_schema_for::<TransactionResultExt>(),
48824            Self::Hash => gen.into_root_schema_for::<Hash>(),
48825            Self::Uint256 => gen.into_root_schema_for::<Uint256>(),
48826            Self::Uint32 => gen.into_root_schema_for::<Uint32>(),
48827            Self::Int32 => gen.into_root_schema_for::<Int32>(),
48828            Self::Uint64 => gen.into_root_schema_for::<Uint64>(),
48829            Self::Int64 => gen.into_root_schema_for::<Int64>(),
48830            Self::TimePoint => gen.into_root_schema_for::<TimePoint>(),
48831            Self::Duration => gen.into_root_schema_for::<Duration>(),
48832            Self::ExtensionPoint => gen.into_root_schema_for::<ExtensionPoint>(),
48833            Self::CryptoKeyType => gen.into_root_schema_for::<CryptoKeyType>(),
48834            Self::PublicKeyType => gen.into_root_schema_for::<PublicKeyType>(),
48835            Self::SignerKeyType => gen.into_root_schema_for::<SignerKeyType>(),
48836            Self::PublicKey => gen.into_root_schema_for::<PublicKey>(),
48837            Self::SignerKey => gen.into_root_schema_for::<SignerKey>(),
48838            Self::SignerKeyEd25519SignedPayload => {
48839                gen.into_root_schema_for::<SignerKeyEd25519SignedPayload>()
48840            }
48841            Self::Signature => gen.into_root_schema_for::<Signature>(),
48842            Self::SignatureHint => gen.into_root_schema_for::<SignatureHint>(),
48843            Self::NodeId => gen.into_root_schema_for::<NodeId>(),
48844            Self::AccountId => gen.into_root_schema_for::<AccountId>(),
48845            Self::Curve25519Secret => gen.into_root_schema_for::<Curve25519Secret>(),
48846            Self::Curve25519Public => gen.into_root_schema_for::<Curve25519Public>(),
48847            Self::HmacSha256Key => gen.into_root_schema_for::<HmacSha256Key>(),
48848            Self::HmacSha256Mac => gen.into_root_schema_for::<HmacSha256Mac>(),
48849            Self::ShortHashSeed => gen.into_root_schema_for::<ShortHashSeed>(),
48850            Self::BinaryFuseFilterType => gen.into_root_schema_for::<BinaryFuseFilterType>(),
48851            Self::SerializedBinaryFuseFilter => {
48852                gen.into_root_schema_for::<SerializedBinaryFuseFilter>()
48853            }
48854        }
48855    }
48856}
48857
48858impl Name for TypeVariant {
48859    #[must_use]
48860    fn name(&self) -> &'static str {
48861        Self::name(self)
48862    }
48863}
48864
48865impl Variants<TypeVariant> for TypeVariant {
48866    fn variants() -> slice::Iter<'static, TypeVariant> {
48867        Self::VARIANTS.iter()
48868    }
48869}
48870
48871impl core::str::FromStr for TypeVariant {
48872    type Err = Error;
48873    #[allow(clippy::too_many_lines)]
48874    fn from_str(s: &str) -> Result<Self> {
48875        match s {
48876            "Value" => Ok(Self::Value),
48877            "ScpBallot" => Ok(Self::ScpBallot),
48878            "ScpStatementType" => Ok(Self::ScpStatementType),
48879            "ScpNomination" => Ok(Self::ScpNomination),
48880            "ScpStatement" => Ok(Self::ScpStatement),
48881            "ScpStatementPledges" => Ok(Self::ScpStatementPledges),
48882            "ScpStatementPrepare" => Ok(Self::ScpStatementPrepare),
48883            "ScpStatementConfirm" => Ok(Self::ScpStatementConfirm),
48884            "ScpStatementExternalize" => Ok(Self::ScpStatementExternalize),
48885            "ScpEnvelope" => Ok(Self::ScpEnvelope),
48886            "ScpQuorumSet" => Ok(Self::ScpQuorumSet),
48887            "ConfigSettingContractExecutionLanesV0" => {
48888                Ok(Self::ConfigSettingContractExecutionLanesV0)
48889            }
48890            "ConfigSettingContractComputeV0" => Ok(Self::ConfigSettingContractComputeV0),
48891            "ConfigSettingContractLedgerCostV0" => Ok(Self::ConfigSettingContractLedgerCostV0),
48892            "ConfigSettingContractHistoricalDataV0" => {
48893                Ok(Self::ConfigSettingContractHistoricalDataV0)
48894            }
48895            "ConfigSettingContractEventsV0" => Ok(Self::ConfigSettingContractEventsV0),
48896            "ConfigSettingContractBandwidthV0" => Ok(Self::ConfigSettingContractBandwidthV0),
48897            "ContractCostType" => Ok(Self::ContractCostType),
48898            "ContractCostParamEntry" => Ok(Self::ContractCostParamEntry),
48899            "StateArchivalSettings" => Ok(Self::StateArchivalSettings),
48900            "EvictionIterator" => Ok(Self::EvictionIterator),
48901            "ContractCostParams" => Ok(Self::ContractCostParams),
48902            "ConfigSettingId" => Ok(Self::ConfigSettingId),
48903            "ConfigSettingEntry" => Ok(Self::ConfigSettingEntry),
48904            "ScEnvMetaKind" => Ok(Self::ScEnvMetaKind),
48905            "ScEnvMetaEntry" => Ok(Self::ScEnvMetaEntry),
48906            "ScEnvMetaEntryInterfaceVersion" => Ok(Self::ScEnvMetaEntryInterfaceVersion),
48907            "ScMetaV0" => Ok(Self::ScMetaV0),
48908            "ScMetaKind" => Ok(Self::ScMetaKind),
48909            "ScMetaEntry" => Ok(Self::ScMetaEntry),
48910            "ScSpecType" => Ok(Self::ScSpecType),
48911            "ScSpecTypeOption" => Ok(Self::ScSpecTypeOption),
48912            "ScSpecTypeResult" => Ok(Self::ScSpecTypeResult),
48913            "ScSpecTypeVec" => Ok(Self::ScSpecTypeVec),
48914            "ScSpecTypeMap" => Ok(Self::ScSpecTypeMap),
48915            "ScSpecTypeTuple" => Ok(Self::ScSpecTypeTuple),
48916            "ScSpecTypeBytesN" => Ok(Self::ScSpecTypeBytesN),
48917            "ScSpecTypeUdt" => Ok(Self::ScSpecTypeUdt),
48918            "ScSpecTypeDef" => Ok(Self::ScSpecTypeDef),
48919            "ScSpecUdtStructFieldV0" => Ok(Self::ScSpecUdtStructFieldV0),
48920            "ScSpecUdtStructV0" => Ok(Self::ScSpecUdtStructV0),
48921            "ScSpecUdtUnionCaseVoidV0" => Ok(Self::ScSpecUdtUnionCaseVoidV0),
48922            "ScSpecUdtUnionCaseTupleV0" => Ok(Self::ScSpecUdtUnionCaseTupleV0),
48923            "ScSpecUdtUnionCaseV0Kind" => Ok(Self::ScSpecUdtUnionCaseV0Kind),
48924            "ScSpecUdtUnionCaseV0" => Ok(Self::ScSpecUdtUnionCaseV0),
48925            "ScSpecUdtUnionV0" => Ok(Self::ScSpecUdtUnionV0),
48926            "ScSpecUdtEnumCaseV0" => Ok(Self::ScSpecUdtEnumCaseV0),
48927            "ScSpecUdtEnumV0" => Ok(Self::ScSpecUdtEnumV0),
48928            "ScSpecUdtErrorEnumCaseV0" => Ok(Self::ScSpecUdtErrorEnumCaseV0),
48929            "ScSpecUdtErrorEnumV0" => Ok(Self::ScSpecUdtErrorEnumV0),
48930            "ScSpecFunctionInputV0" => Ok(Self::ScSpecFunctionInputV0),
48931            "ScSpecFunctionV0" => Ok(Self::ScSpecFunctionV0),
48932            "ScSpecEntryKind" => Ok(Self::ScSpecEntryKind),
48933            "ScSpecEntry" => Ok(Self::ScSpecEntry),
48934            "ScValType" => Ok(Self::ScValType),
48935            "ScErrorType" => Ok(Self::ScErrorType),
48936            "ScErrorCode" => Ok(Self::ScErrorCode),
48937            "ScError" => Ok(Self::ScError),
48938            "UInt128Parts" => Ok(Self::UInt128Parts),
48939            "Int128Parts" => Ok(Self::Int128Parts),
48940            "UInt256Parts" => Ok(Self::UInt256Parts),
48941            "Int256Parts" => Ok(Self::Int256Parts),
48942            "ContractExecutableType" => Ok(Self::ContractExecutableType),
48943            "ContractExecutable" => Ok(Self::ContractExecutable),
48944            "ScAddressType" => Ok(Self::ScAddressType),
48945            "ScAddress" => Ok(Self::ScAddress),
48946            "ScVec" => Ok(Self::ScVec),
48947            "ScMap" => Ok(Self::ScMap),
48948            "ScBytes" => Ok(Self::ScBytes),
48949            "ScString" => Ok(Self::ScString),
48950            "ScSymbol" => Ok(Self::ScSymbol),
48951            "ScNonceKey" => Ok(Self::ScNonceKey),
48952            "ScContractInstance" => Ok(Self::ScContractInstance),
48953            "ScVal" => Ok(Self::ScVal),
48954            "ScMapEntry" => Ok(Self::ScMapEntry),
48955            "StoredTransactionSet" => Ok(Self::StoredTransactionSet),
48956            "StoredDebugTransactionSet" => Ok(Self::StoredDebugTransactionSet),
48957            "PersistedScpStateV0" => Ok(Self::PersistedScpStateV0),
48958            "PersistedScpStateV1" => Ok(Self::PersistedScpStateV1),
48959            "PersistedScpState" => Ok(Self::PersistedScpState),
48960            "Thresholds" => Ok(Self::Thresholds),
48961            "String32" => Ok(Self::String32),
48962            "String64" => Ok(Self::String64),
48963            "SequenceNumber" => Ok(Self::SequenceNumber),
48964            "DataValue" => Ok(Self::DataValue),
48965            "PoolId" => Ok(Self::PoolId),
48966            "AssetCode4" => Ok(Self::AssetCode4),
48967            "AssetCode12" => Ok(Self::AssetCode12),
48968            "AssetType" => Ok(Self::AssetType),
48969            "AssetCode" => Ok(Self::AssetCode),
48970            "AlphaNum4" => Ok(Self::AlphaNum4),
48971            "AlphaNum12" => Ok(Self::AlphaNum12),
48972            "Asset" => Ok(Self::Asset),
48973            "Price" => Ok(Self::Price),
48974            "Liabilities" => Ok(Self::Liabilities),
48975            "ThresholdIndexes" => Ok(Self::ThresholdIndexes),
48976            "LedgerEntryType" => Ok(Self::LedgerEntryType),
48977            "Signer" => Ok(Self::Signer),
48978            "AccountFlags" => Ok(Self::AccountFlags),
48979            "SponsorshipDescriptor" => Ok(Self::SponsorshipDescriptor),
48980            "AccountEntryExtensionV3" => Ok(Self::AccountEntryExtensionV3),
48981            "AccountEntryExtensionV2" => Ok(Self::AccountEntryExtensionV2),
48982            "AccountEntryExtensionV2Ext" => Ok(Self::AccountEntryExtensionV2Ext),
48983            "AccountEntryExtensionV1" => Ok(Self::AccountEntryExtensionV1),
48984            "AccountEntryExtensionV1Ext" => Ok(Self::AccountEntryExtensionV1Ext),
48985            "AccountEntry" => Ok(Self::AccountEntry),
48986            "AccountEntryExt" => Ok(Self::AccountEntryExt),
48987            "TrustLineFlags" => Ok(Self::TrustLineFlags),
48988            "LiquidityPoolType" => Ok(Self::LiquidityPoolType),
48989            "TrustLineAsset" => Ok(Self::TrustLineAsset),
48990            "TrustLineEntryExtensionV2" => Ok(Self::TrustLineEntryExtensionV2),
48991            "TrustLineEntryExtensionV2Ext" => Ok(Self::TrustLineEntryExtensionV2Ext),
48992            "TrustLineEntry" => Ok(Self::TrustLineEntry),
48993            "TrustLineEntryExt" => Ok(Self::TrustLineEntryExt),
48994            "TrustLineEntryV1" => Ok(Self::TrustLineEntryV1),
48995            "TrustLineEntryV1Ext" => Ok(Self::TrustLineEntryV1Ext),
48996            "OfferEntryFlags" => Ok(Self::OfferEntryFlags),
48997            "OfferEntry" => Ok(Self::OfferEntry),
48998            "OfferEntryExt" => Ok(Self::OfferEntryExt),
48999            "DataEntry" => Ok(Self::DataEntry),
49000            "DataEntryExt" => Ok(Self::DataEntryExt),
49001            "ClaimPredicateType" => Ok(Self::ClaimPredicateType),
49002            "ClaimPredicate" => Ok(Self::ClaimPredicate),
49003            "ClaimantType" => Ok(Self::ClaimantType),
49004            "Claimant" => Ok(Self::Claimant),
49005            "ClaimantV0" => Ok(Self::ClaimantV0),
49006            "ClaimableBalanceIdType" => Ok(Self::ClaimableBalanceIdType),
49007            "ClaimableBalanceId" => Ok(Self::ClaimableBalanceId),
49008            "ClaimableBalanceFlags" => Ok(Self::ClaimableBalanceFlags),
49009            "ClaimableBalanceEntryExtensionV1" => Ok(Self::ClaimableBalanceEntryExtensionV1),
49010            "ClaimableBalanceEntryExtensionV1Ext" => Ok(Self::ClaimableBalanceEntryExtensionV1Ext),
49011            "ClaimableBalanceEntry" => Ok(Self::ClaimableBalanceEntry),
49012            "ClaimableBalanceEntryExt" => Ok(Self::ClaimableBalanceEntryExt),
49013            "LiquidityPoolConstantProductParameters" => {
49014                Ok(Self::LiquidityPoolConstantProductParameters)
49015            }
49016            "LiquidityPoolEntry" => Ok(Self::LiquidityPoolEntry),
49017            "LiquidityPoolEntryBody" => Ok(Self::LiquidityPoolEntryBody),
49018            "LiquidityPoolEntryConstantProduct" => Ok(Self::LiquidityPoolEntryConstantProduct),
49019            "ContractDataDurability" => Ok(Self::ContractDataDurability),
49020            "ContractDataEntry" => Ok(Self::ContractDataEntry),
49021            "ContractCodeCostInputs" => Ok(Self::ContractCodeCostInputs),
49022            "ContractCodeEntry" => Ok(Self::ContractCodeEntry),
49023            "ContractCodeEntryExt" => Ok(Self::ContractCodeEntryExt),
49024            "ContractCodeEntryV1" => Ok(Self::ContractCodeEntryV1),
49025            "TtlEntry" => Ok(Self::TtlEntry),
49026            "LedgerEntryExtensionV1" => Ok(Self::LedgerEntryExtensionV1),
49027            "LedgerEntryExtensionV1Ext" => Ok(Self::LedgerEntryExtensionV1Ext),
49028            "LedgerEntry" => Ok(Self::LedgerEntry),
49029            "LedgerEntryData" => Ok(Self::LedgerEntryData),
49030            "LedgerEntryExt" => Ok(Self::LedgerEntryExt),
49031            "LedgerKey" => Ok(Self::LedgerKey),
49032            "LedgerKeyAccount" => Ok(Self::LedgerKeyAccount),
49033            "LedgerKeyTrustLine" => Ok(Self::LedgerKeyTrustLine),
49034            "LedgerKeyOffer" => Ok(Self::LedgerKeyOffer),
49035            "LedgerKeyData" => Ok(Self::LedgerKeyData),
49036            "LedgerKeyClaimableBalance" => Ok(Self::LedgerKeyClaimableBalance),
49037            "LedgerKeyLiquidityPool" => Ok(Self::LedgerKeyLiquidityPool),
49038            "LedgerKeyContractData" => Ok(Self::LedgerKeyContractData),
49039            "LedgerKeyContractCode" => Ok(Self::LedgerKeyContractCode),
49040            "LedgerKeyConfigSetting" => Ok(Self::LedgerKeyConfigSetting),
49041            "LedgerKeyTtl" => Ok(Self::LedgerKeyTtl),
49042            "EnvelopeType" => Ok(Self::EnvelopeType),
49043            "BucketListType" => Ok(Self::BucketListType),
49044            "BucketEntryType" => Ok(Self::BucketEntryType),
49045            "HotArchiveBucketEntryType" => Ok(Self::HotArchiveBucketEntryType),
49046            "ColdArchiveBucketEntryType" => Ok(Self::ColdArchiveBucketEntryType),
49047            "BucketMetadata" => Ok(Self::BucketMetadata),
49048            "BucketMetadataExt" => Ok(Self::BucketMetadataExt),
49049            "BucketEntry" => Ok(Self::BucketEntry),
49050            "HotArchiveBucketEntry" => Ok(Self::HotArchiveBucketEntry),
49051            "ColdArchiveArchivedLeaf" => Ok(Self::ColdArchiveArchivedLeaf),
49052            "ColdArchiveDeletedLeaf" => Ok(Self::ColdArchiveDeletedLeaf),
49053            "ColdArchiveBoundaryLeaf" => Ok(Self::ColdArchiveBoundaryLeaf),
49054            "ColdArchiveHashEntry" => Ok(Self::ColdArchiveHashEntry),
49055            "ColdArchiveBucketEntry" => Ok(Self::ColdArchiveBucketEntry),
49056            "UpgradeType" => Ok(Self::UpgradeType),
49057            "StellarValueType" => Ok(Self::StellarValueType),
49058            "LedgerCloseValueSignature" => Ok(Self::LedgerCloseValueSignature),
49059            "StellarValue" => Ok(Self::StellarValue),
49060            "StellarValueExt" => Ok(Self::StellarValueExt),
49061            "LedgerHeaderFlags" => Ok(Self::LedgerHeaderFlags),
49062            "LedgerHeaderExtensionV1" => Ok(Self::LedgerHeaderExtensionV1),
49063            "LedgerHeaderExtensionV1Ext" => Ok(Self::LedgerHeaderExtensionV1Ext),
49064            "LedgerHeader" => Ok(Self::LedgerHeader),
49065            "LedgerHeaderExt" => Ok(Self::LedgerHeaderExt),
49066            "LedgerUpgradeType" => Ok(Self::LedgerUpgradeType),
49067            "ConfigUpgradeSetKey" => Ok(Self::ConfigUpgradeSetKey),
49068            "LedgerUpgrade" => Ok(Self::LedgerUpgrade),
49069            "ConfigUpgradeSet" => Ok(Self::ConfigUpgradeSet),
49070            "TxSetComponentType" => Ok(Self::TxSetComponentType),
49071            "TxSetComponent" => Ok(Self::TxSetComponent),
49072            "TxSetComponentTxsMaybeDiscountedFee" => Ok(Self::TxSetComponentTxsMaybeDiscountedFee),
49073            "TransactionPhase" => Ok(Self::TransactionPhase),
49074            "TransactionSet" => Ok(Self::TransactionSet),
49075            "TransactionSetV1" => Ok(Self::TransactionSetV1),
49076            "GeneralizedTransactionSet" => Ok(Self::GeneralizedTransactionSet),
49077            "TransactionResultPair" => Ok(Self::TransactionResultPair),
49078            "TransactionResultSet" => Ok(Self::TransactionResultSet),
49079            "TransactionHistoryEntry" => Ok(Self::TransactionHistoryEntry),
49080            "TransactionHistoryEntryExt" => Ok(Self::TransactionHistoryEntryExt),
49081            "TransactionHistoryResultEntry" => Ok(Self::TransactionHistoryResultEntry),
49082            "TransactionHistoryResultEntryExt" => Ok(Self::TransactionHistoryResultEntryExt),
49083            "LedgerHeaderHistoryEntry" => Ok(Self::LedgerHeaderHistoryEntry),
49084            "LedgerHeaderHistoryEntryExt" => Ok(Self::LedgerHeaderHistoryEntryExt),
49085            "LedgerScpMessages" => Ok(Self::LedgerScpMessages),
49086            "ScpHistoryEntryV0" => Ok(Self::ScpHistoryEntryV0),
49087            "ScpHistoryEntry" => Ok(Self::ScpHistoryEntry),
49088            "LedgerEntryChangeType" => Ok(Self::LedgerEntryChangeType),
49089            "LedgerEntryChange" => Ok(Self::LedgerEntryChange),
49090            "LedgerEntryChanges" => Ok(Self::LedgerEntryChanges),
49091            "OperationMeta" => Ok(Self::OperationMeta),
49092            "TransactionMetaV1" => Ok(Self::TransactionMetaV1),
49093            "TransactionMetaV2" => Ok(Self::TransactionMetaV2),
49094            "ContractEventType" => Ok(Self::ContractEventType),
49095            "ContractEvent" => Ok(Self::ContractEvent),
49096            "ContractEventBody" => Ok(Self::ContractEventBody),
49097            "ContractEventV0" => Ok(Self::ContractEventV0),
49098            "DiagnosticEvent" => Ok(Self::DiagnosticEvent),
49099            "DiagnosticEvents" => Ok(Self::DiagnosticEvents),
49100            "SorobanTransactionMetaExtV1" => Ok(Self::SorobanTransactionMetaExtV1),
49101            "SorobanTransactionMetaExt" => Ok(Self::SorobanTransactionMetaExt),
49102            "SorobanTransactionMeta" => Ok(Self::SorobanTransactionMeta),
49103            "TransactionMetaV3" => Ok(Self::TransactionMetaV3),
49104            "InvokeHostFunctionSuccessPreImage" => Ok(Self::InvokeHostFunctionSuccessPreImage),
49105            "TransactionMeta" => Ok(Self::TransactionMeta),
49106            "TransactionResultMeta" => Ok(Self::TransactionResultMeta),
49107            "UpgradeEntryMeta" => Ok(Self::UpgradeEntryMeta),
49108            "LedgerCloseMetaV0" => Ok(Self::LedgerCloseMetaV0),
49109            "LedgerCloseMetaExtV1" => Ok(Self::LedgerCloseMetaExtV1),
49110            "LedgerCloseMetaExt" => Ok(Self::LedgerCloseMetaExt),
49111            "LedgerCloseMetaV1" => Ok(Self::LedgerCloseMetaV1),
49112            "LedgerCloseMeta" => Ok(Self::LedgerCloseMeta),
49113            "ErrorCode" => Ok(Self::ErrorCode),
49114            "SError" => Ok(Self::SError),
49115            "SendMore" => Ok(Self::SendMore),
49116            "SendMoreExtended" => Ok(Self::SendMoreExtended),
49117            "AuthCert" => Ok(Self::AuthCert),
49118            "Hello" => Ok(Self::Hello),
49119            "Auth" => Ok(Self::Auth),
49120            "IpAddrType" => Ok(Self::IpAddrType),
49121            "PeerAddress" => Ok(Self::PeerAddress),
49122            "PeerAddressIp" => Ok(Self::PeerAddressIp),
49123            "MessageType" => Ok(Self::MessageType),
49124            "DontHave" => Ok(Self::DontHave),
49125            "SurveyMessageCommandType" => Ok(Self::SurveyMessageCommandType),
49126            "SurveyMessageResponseType" => Ok(Self::SurveyMessageResponseType),
49127            "TimeSlicedSurveyStartCollectingMessage" => {
49128                Ok(Self::TimeSlicedSurveyStartCollectingMessage)
49129            }
49130            "SignedTimeSlicedSurveyStartCollectingMessage" => {
49131                Ok(Self::SignedTimeSlicedSurveyStartCollectingMessage)
49132            }
49133            "TimeSlicedSurveyStopCollectingMessage" => {
49134                Ok(Self::TimeSlicedSurveyStopCollectingMessage)
49135            }
49136            "SignedTimeSlicedSurveyStopCollectingMessage" => {
49137                Ok(Self::SignedTimeSlicedSurveyStopCollectingMessage)
49138            }
49139            "SurveyRequestMessage" => Ok(Self::SurveyRequestMessage),
49140            "TimeSlicedSurveyRequestMessage" => Ok(Self::TimeSlicedSurveyRequestMessage),
49141            "SignedSurveyRequestMessage" => Ok(Self::SignedSurveyRequestMessage),
49142            "SignedTimeSlicedSurveyRequestMessage" => {
49143                Ok(Self::SignedTimeSlicedSurveyRequestMessage)
49144            }
49145            "EncryptedBody" => Ok(Self::EncryptedBody),
49146            "SurveyResponseMessage" => Ok(Self::SurveyResponseMessage),
49147            "TimeSlicedSurveyResponseMessage" => Ok(Self::TimeSlicedSurveyResponseMessage),
49148            "SignedSurveyResponseMessage" => Ok(Self::SignedSurveyResponseMessage),
49149            "SignedTimeSlicedSurveyResponseMessage" => {
49150                Ok(Self::SignedTimeSlicedSurveyResponseMessage)
49151            }
49152            "PeerStats" => Ok(Self::PeerStats),
49153            "PeerStatList" => Ok(Self::PeerStatList),
49154            "TimeSlicedNodeData" => Ok(Self::TimeSlicedNodeData),
49155            "TimeSlicedPeerData" => Ok(Self::TimeSlicedPeerData),
49156            "TimeSlicedPeerDataList" => Ok(Self::TimeSlicedPeerDataList),
49157            "TopologyResponseBodyV0" => Ok(Self::TopologyResponseBodyV0),
49158            "TopologyResponseBodyV1" => Ok(Self::TopologyResponseBodyV1),
49159            "TopologyResponseBodyV2" => Ok(Self::TopologyResponseBodyV2),
49160            "SurveyResponseBody" => Ok(Self::SurveyResponseBody),
49161            "TxAdvertVector" => Ok(Self::TxAdvertVector),
49162            "FloodAdvert" => Ok(Self::FloodAdvert),
49163            "TxDemandVector" => Ok(Self::TxDemandVector),
49164            "FloodDemand" => Ok(Self::FloodDemand),
49165            "StellarMessage" => Ok(Self::StellarMessage),
49166            "AuthenticatedMessage" => Ok(Self::AuthenticatedMessage),
49167            "AuthenticatedMessageV0" => Ok(Self::AuthenticatedMessageV0),
49168            "LiquidityPoolParameters" => Ok(Self::LiquidityPoolParameters),
49169            "MuxedAccount" => Ok(Self::MuxedAccount),
49170            "MuxedAccountMed25519" => Ok(Self::MuxedAccountMed25519),
49171            "DecoratedSignature" => Ok(Self::DecoratedSignature),
49172            "OperationType" => Ok(Self::OperationType),
49173            "CreateAccountOp" => Ok(Self::CreateAccountOp),
49174            "PaymentOp" => Ok(Self::PaymentOp),
49175            "PathPaymentStrictReceiveOp" => Ok(Self::PathPaymentStrictReceiveOp),
49176            "PathPaymentStrictSendOp" => Ok(Self::PathPaymentStrictSendOp),
49177            "ManageSellOfferOp" => Ok(Self::ManageSellOfferOp),
49178            "ManageBuyOfferOp" => Ok(Self::ManageBuyOfferOp),
49179            "CreatePassiveSellOfferOp" => Ok(Self::CreatePassiveSellOfferOp),
49180            "SetOptionsOp" => Ok(Self::SetOptionsOp),
49181            "ChangeTrustAsset" => Ok(Self::ChangeTrustAsset),
49182            "ChangeTrustOp" => Ok(Self::ChangeTrustOp),
49183            "AllowTrustOp" => Ok(Self::AllowTrustOp),
49184            "ManageDataOp" => Ok(Self::ManageDataOp),
49185            "BumpSequenceOp" => Ok(Self::BumpSequenceOp),
49186            "CreateClaimableBalanceOp" => Ok(Self::CreateClaimableBalanceOp),
49187            "ClaimClaimableBalanceOp" => Ok(Self::ClaimClaimableBalanceOp),
49188            "BeginSponsoringFutureReservesOp" => Ok(Self::BeginSponsoringFutureReservesOp),
49189            "RevokeSponsorshipType" => Ok(Self::RevokeSponsorshipType),
49190            "RevokeSponsorshipOp" => Ok(Self::RevokeSponsorshipOp),
49191            "RevokeSponsorshipOpSigner" => Ok(Self::RevokeSponsorshipOpSigner),
49192            "ClawbackOp" => Ok(Self::ClawbackOp),
49193            "ClawbackClaimableBalanceOp" => Ok(Self::ClawbackClaimableBalanceOp),
49194            "SetTrustLineFlagsOp" => Ok(Self::SetTrustLineFlagsOp),
49195            "LiquidityPoolDepositOp" => Ok(Self::LiquidityPoolDepositOp),
49196            "LiquidityPoolWithdrawOp" => Ok(Self::LiquidityPoolWithdrawOp),
49197            "HostFunctionType" => Ok(Self::HostFunctionType),
49198            "ContractIdPreimageType" => Ok(Self::ContractIdPreimageType),
49199            "ContractIdPreimage" => Ok(Self::ContractIdPreimage),
49200            "ContractIdPreimageFromAddress" => Ok(Self::ContractIdPreimageFromAddress),
49201            "CreateContractArgs" => Ok(Self::CreateContractArgs),
49202            "CreateContractArgsV2" => Ok(Self::CreateContractArgsV2),
49203            "InvokeContractArgs" => Ok(Self::InvokeContractArgs),
49204            "HostFunction" => Ok(Self::HostFunction),
49205            "SorobanAuthorizedFunctionType" => Ok(Self::SorobanAuthorizedFunctionType),
49206            "SorobanAuthorizedFunction" => Ok(Self::SorobanAuthorizedFunction),
49207            "SorobanAuthorizedInvocation" => Ok(Self::SorobanAuthorizedInvocation),
49208            "SorobanAddressCredentials" => Ok(Self::SorobanAddressCredentials),
49209            "SorobanCredentialsType" => Ok(Self::SorobanCredentialsType),
49210            "SorobanCredentials" => Ok(Self::SorobanCredentials),
49211            "SorobanAuthorizationEntry" => Ok(Self::SorobanAuthorizationEntry),
49212            "InvokeHostFunctionOp" => Ok(Self::InvokeHostFunctionOp),
49213            "ExtendFootprintTtlOp" => Ok(Self::ExtendFootprintTtlOp),
49214            "RestoreFootprintOp" => Ok(Self::RestoreFootprintOp),
49215            "Operation" => Ok(Self::Operation),
49216            "OperationBody" => Ok(Self::OperationBody),
49217            "HashIdPreimage" => Ok(Self::HashIdPreimage),
49218            "HashIdPreimageOperationId" => Ok(Self::HashIdPreimageOperationId),
49219            "HashIdPreimageRevokeId" => Ok(Self::HashIdPreimageRevokeId),
49220            "HashIdPreimageContractId" => Ok(Self::HashIdPreimageContractId),
49221            "HashIdPreimageSorobanAuthorization" => Ok(Self::HashIdPreimageSorobanAuthorization),
49222            "MemoType" => Ok(Self::MemoType),
49223            "Memo" => Ok(Self::Memo),
49224            "TimeBounds" => Ok(Self::TimeBounds),
49225            "LedgerBounds" => Ok(Self::LedgerBounds),
49226            "PreconditionsV2" => Ok(Self::PreconditionsV2),
49227            "PreconditionType" => Ok(Self::PreconditionType),
49228            "Preconditions" => Ok(Self::Preconditions),
49229            "LedgerFootprint" => Ok(Self::LedgerFootprint),
49230            "ArchivalProofType" => Ok(Self::ArchivalProofType),
49231            "ArchivalProofNode" => Ok(Self::ArchivalProofNode),
49232            "ProofLevel" => Ok(Self::ProofLevel),
49233            "NonexistenceProofBody" => Ok(Self::NonexistenceProofBody),
49234            "ExistenceProofBody" => Ok(Self::ExistenceProofBody),
49235            "ArchivalProof" => Ok(Self::ArchivalProof),
49236            "ArchivalProofBody" => Ok(Self::ArchivalProofBody),
49237            "SorobanResources" => Ok(Self::SorobanResources),
49238            "SorobanTransactionData" => Ok(Self::SorobanTransactionData),
49239            "TransactionV0" => Ok(Self::TransactionV0),
49240            "TransactionV0Ext" => Ok(Self::TransactionV0Ext),
49241            "TransactionV0Envelope" => Ok(Self::TransactionV0Envelope),
49242            "Transaction" => Ok(Self::Transaction),
49243            "TransactionExt" => Ok(Self::TransactionExt),
49244            "TransactionV1Envelope" => Ok(Self::TransactionV1Envelope),
49245            "FeeBumpTransaction" => Ok(Self::FeeBumpTransaction),
49246            "FeeBumpTransactionInnerTx" => Ok(Self::FeeBumpTransactionInnerTx),
49247            "FeeBumpTransactionExt" => Ok(Self::FeeBumpTransactionExt),
49248            "FeeBumpTransactionEnvelope" => Ok(Self::FeeBumpTransactionEnvelope),
49249            "TransactionEnvelope" => Ok(Self::TransactionEnvelope),
49250            "TransactionSignaturePayload" => Ok(Self::TransactionSignaturePayload),
49251            "TransactionSignaturePayloadTaggedTransaction" => {
49252                Ok(Self::TransactionSignaturePayloadTaggedTransaction)
49253            }
49254            "ClaimAtomType" => Ok(Self::ClaimAtomType),
49255            "ClaimOfferAtomV0" => Ok(Self::ClaimOfferAtomV0),
49256            "ClaimOfferAtom" => Ok(Self::ClaimOfferAtom),
49257            "ClaimLiquidityAtom" => Ok(Self::ClaimLiquidityAtom),
49258            "ClaimAtom" => Ok(Self::ClaimAtom),
49259            "CreateAccountResultCode" => Ok(Self::CreateAccountResultCode),
49260            "CreateAccountResult" => Ok(Self::CreateAccountResult),
49261            "PaymentResultCode" => Ok(Self::PaymentResultCode),
49262            "PaymentResult" => Ok(Self::PaymentResult),
49263            "PathPaymentStrictReceiveResultCode" => Ok(Self::PathPaymentStrictReceiveResultCode),
49264            "SimplePaymentResult" => Ok(Self::SimplePaymentResult),
49265            "PathPaymentStrictReceiveResult" => Ok(Self::PathPaymentStrictReceiveResult),
49266            "PathPaymentStrictReceiveResultSuccess" => {
49267                Ok(Self::PathPaymentStrictReceiveResultSuccess)
49268            }
49269            "PathPaymentStrictSendResultCode" => Ok(Self::PathPaymentStrictSendResultCode),
49270            "PathPaymentStrictSendResult" => Ok(Self::PathPaymentStrictSendResult),
49271            "PathPaymentStrictSendResultSuccess" => Ok(Self::PathPaymentStrictSendResultSuccess),
49272            "ManageSellOfferResultCode" => Ok(Self::ManageSellOfferResultCode),
49273            "ManageOfferEffect" => Ok(Self::ManageOfferEffect),
49274            "ManageOfferSuccessResult" => Ok(Self::ManageOfferSuccessResult),
49275            "ManageOfferSuccessResultOffer" => Ok(Self::ManageOfferSuccessResultOffer),
49276            "ManageSellOfferResult" => Ok(Self::ManageSellOfferResult),
49277            "ManageBuyOfferResultCode" => Ok(Self::ManageBuyOfferResultCode),
49278            "ManageBuyOfferResult" => Ok(Self::ManageBuyOfferResult),
49279            "SetOptionsResultCode" => Ok(Self::SetOptionsResultCode),
49280            "SetOptionsResult" => Ok(Self::SetOptionsResult),
49281            "ChangeTrustResultCode" => Ok(Self::ChangeTrustResultCode),
49282            "ChangeTrustResult" => Ok(Self::ChangeTrustResult),
49283            "AllowTrustResultCode" => Ok(Self::AllowTrustResultCode),
49284            "AllowTrustResult" => Ok(Self::AllowTrustResult),
49285            "AccountMergeResultCode" => Ok(Self::AccountMergeResultCode),
49286            "AccountMergeResult" => Ok(Self::AccountMergeResult),
49287            "InflationResultCode" => Ok(Self::InflationResultCode),
49288            "InflationPayout" => Ok(Self::InflationPayout),
49289            "InflationResult" => Ok(Self::InflationResult),
49290            "ManageDataResultCode" => Ok(Self::ManageDataResultCode),
49291            "ManageDataResult" => Ok(Self::ManageDataResult),
49292            "BumpSequenceResultCode" => Ok(Self::BumpSequenceResultCode),
49293            "BumpSequenceResult" => Ok(Self::BumpSequenceResult),
49294            "CreateClaimableBalanceResultCode" => Ok(Self::CreateClaimableBalanceResultCode),
49295            "CreateClaimableBalanceResult" => Ok(Self::CreateClaimableBalanceResult),
49296            "ClaimClaimableBalanceResultCode" => Ok(Self::ClaimClaimableBalanceResultCode),
49297            "ClaimClaimableBalanceResult" => Ok(Self::ClaimClaimableBalanceResult),
49298            "BeginSponsoringFutureReservesResultCode" => {
49299                Ok(Self::BeginSponsoringFutureReservesResultCode)
49300            }
49301            "BeginSponsoringFutureReservesResult" => Ok(Self::BeginSponsoringFutureReservesResult),
49302            "EndSponsoringFutureReservesResultCode" => {
49303                Ok(Self::EndSponsoringFutureReservesResultCode)
49304            }
49305            "EndSponsoringFutureReservesResult" => Ok(Self::EndSponsoringFutureReservesResult),
49306            "RevokeSponsorshipResultCode" => Ok(Self::RevokeSponsorshipResultCode),
49307            "RevokeSponsorshipResult" => Ok(Self::RevokeSponsorshipResult),
49308            "ClawbackResultCode" => Ok(Self::ClawbackResultCode),
49309            "ClawbackResult" => Ok(Self::ClawbackResult),
49310            "ClawbackClaimableBalanceResultCode" => Ok(Self::ClawbackClaimableBalanceResultCode),
49311            "ClawbackClaimableBalanceResult" => Ok(Self::ClawbackClaimableBalanceResult),
49312            "SetTrustLineFlagsResultCode" => Ok(Self::SetTrustLineFlagsResultCode),
49313            "SetTrustLineFlagsResult" => Ok(Self::SetTrustLineFlagsResult),
49314            "LiquidityPoolDepositResultCode" => Ok(Self::LiquidityPoolDepositResultCode),
49315            "LiquidityPoolDepositResult" => Ok(Self::LiquidityPoolDepositResult),
49316            "LiquidityPoolWithdrawResultCode" => Ok(Self::LiquidityPoolWithdrawResultCode),
49317            "LiquidityPoolWithdrawResult" => Ok(Self::LiquidityPoolWithdrawResult),
49318            "InvokeHostFunctionResultCode" => Ok(Self::InvokeHostFunctionResultCode),
49319            "InvokeHostFunctionResult" => Ok(Self::InvokeHostFunctionResult),
49320            "ExtendFootprintTtlResultCode" => Ok(Self::ExtendFootprintTtlResultCode),
49321            "ExtendFootprintTtlResult" => Ok(Self::ExtendFootprintTtlResult),
49322            "RestoreFootprintResultCode" => Ok(Self::RestoreFootprintResultCode),
49323            "RestoreFootprintResult" => Ok(Self::RestoreFootprintResult),
49324            "OperationResultCode" => Ok(Self::OperationResultCode),
49325            "OperationResult" => Ok(Self::OperationResult),
49326            "OperationResultTr" => Ok(Self::OperationResultTr),
49327            "TransactionResultCode" => Ok(Self::TransactionResultCode),
49328            "InnerTransactionResult" => Ok(Self::InnerTransactionResult),
49329            "InnerTransactionResultResult" => Ok(Self::InnerTransactionResultResult),
49330            "InnerTransactionResultExt" => Ok(Self::InnerTransactionResultExt),
49331            "InnerTransactionResultPair" => Ok(Self::InnerTransactionResultPair),
49332            "TransactionResult" => Ok(Self::TransactionResult),
49333            "TransactionResultResult" => Ok(Self::TransactionResultResult),
49334            "TransactionResultExt" => Ok(Self::TransactionResultExt),
49335            "Hash" => Ok(Self::Hash),
49336            "Uint256" => Ok(Self::Uint256),
49337            "Uint32" => Ok(Self::Uint32),
49338            "Int32" => Ok(Self::Int32),
49339            "Uint64" => Ok(Self::Uint64),
49340            "Int64" => Ok(Self::Int64),
49341            "TimePoint" => Ok(Self::TimePoint),
49342            "Duration" => Ok(Self::Duration),
49343            "ExtensionPoint" => Ok(Self::ExtensionPoint),
49344            "CryptoKeyType" => Ok(Self::CryptoKeyType),
49345            "PublicKeyType" => Ok(Self::PublicKeyType),
49346            "SignerKeyType" => Ok(Self::SignerKeyType),
49347            "PublicKey" => Ok(Self::PublicKey),
49348            "SignerKey" => Ok(Self::SignerKey),
49349            "SignerKeyEd25519SignedPayload" => Ok(Self::SignerKeyEd25519SignedPayload),
49350            "Signature" => Ok(Self::Signature),
49351            "SignatureHint" => Ok(Self::SignatureHint),
49352            "NodeId" => Ok(Self::NodeId),
49353            "AccountId" => Ok(Self::AccountId),
49354            "Curve25519Secret" => Ok(Self::Curve25519Secret),
49355            "Curve25519Public" => Ok(Self::Curve25519Public),
49356            "HmacSha256Key" => Ok(Self::HmacSha256Key),
49357            "HmacSha256Mac" => Ok(Self::HmacSha256Mac),
49358            "ShortHashSeed" => Ok(Self::ShortHashSeed),
49359            "BinaryFuseFilterType" => Ok(Self::BinaryFuseFilterType),
49360            "SerializedBinaryFuseFilter" => Ok(Self::SerializedBinaryFuseFilter),
49361            _ => Err(Error::Invalid),
49362        }
49363    }
49364}
49365
49366#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
49367#[cfg_attr(
49368    all(feature = "serde", feature = "alloc"),
49369    derive(serde::Serialize, serde::Deserialize),
49370    serde(rename_all = "snake_case"),
49371    serde(untagged)
49372)]
49373#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
49374pub enum Type {
49375    Value(Box<Value>),
49376    ScpBallot(Box<ScpBallot>),
49377    ScpStatementType(Box<ScpStatementType>),
49378    ScpNomination(Box<ScpNomination>),
49379    ScpStatement(Box<ScpStatement>),
49380    ScpStatementPledges(Box<ScpStatementPledges>),
49381    ScpStatementPrepare(Box<ScpStatementPrepare>),
49382    ScpStatementConfirm(Box<ScpStatementConfirm>),
49383    ScpStatementExternalize(Box<ScpStatementExternalize>),
49384    ScpEnvelope(Box<ScpEnvelope>),
49385    ScpQuorumSet(Box<ScpQuorumSet>),
49386    ConfigSettingContractExecutionLanesV0(Box<ConfigSettingContractExecutionLanesV0>),
49387    ConfigSettingContractComputeV0(Box<ConfigSettingContractComputeV0>),
49388    ConfigSettingContractLedgerCostV0(Box<ConfigSettingContractLedgerCostV0>),
49389    ConfigSettingContractHistoricalDataV0(Box<ConfigSettingContractHistoricalDataV0>),
49390    ConfigSettingContractEventsV0(Box<ConfigSettingContractEventsV0>),
49391    ConfigSettingContractBandwidthV0(Box<ConfigSettingContractBandwidthV0>),
49392    ContractCostType(Box<ContractCostType>),
49393    ContractCostParamEntry(Box<ContractCostParamEntry>),
49394    StateArchivalSettings(Box<StateArchivalSettings>),
49395    EvictionIterator(Box<EvictionIterator>),
49396    ContractCostParams(Box<ContractCostParams>),
49397    ConfigSettingId(Box<ConfigSettingId>),
49398    ConfigSettingEntry(Box<ConfigSettingEntry>),
49399    ScEnvMetaKind(Box<ScEnvMetaKind>),
49400    ScEnvMetaEntry(Box<ScEnvMetaEntry>),
49401    ScEnvMetaEntryInterfaceVersion(Box<ScEnvMetaEntryInterfaceVersion>),
49402    ScMetaV0(Box<ScMetaV0>),
49403    ScMetaKind(Box<ScMetaKind>),
49404    ScMetaEntry(Box<ScMetaEntry>),
49405    ScSpecType(Box<ScSpecType>),
49406    ScSpecTypeOption(Box<ScSpecTypeOption>),
49407    ScSpecTypeResult(Box<ScSpecTypeResult>),
49408    ScSpecTypeVec(Box<ScSpecTypeVec>),
49409    ScSpecTypeMap(Box<ScSpecTypeMap>),
49410    ScSpecTypeTuple(Box<ScSpecTypeTuple>),
49411    ScSpecTypeBytesN(Box<ScSpecTypeBytesN>),
49412    ScSpecTypeUdt(Box<ScSpecTypeUdt>),
49413    ScSpecTypeDef(Box<ScSpecTypeDef>),
49414    ScSpecUdtStructFieldV0(Box<ScSpecUdtStructFieldV0>),
49415    ScSpecUdtStructV0(Box<ScSpecUdtStructV0>),
49416    ScSpecUdtUnionCaseVoidV0(Box<ScSpecUdtUnionCaseVoidV0>),
49417    ScSpecUdtUnionCaseTupleV0(Box<ScSpecUdtUnionCaseTupleV0>),
49418    ScSpecUdtUnionCaseV0Kind(Box<ScSpecUdtUnionCaseV0Kind>),
49419    ScSpecUdtUnionCaseV0(Box<ScSpecUdtUnionCaseV0>),
49420    ScSpecUdtUnionV0(Box<ScSpecUdtUnionV0>),
49421    ScSpecUdtEnumCaseV0(Box<ScSpecUdtEnumCaseV0>),
49422    ScSpecUdtEnumV0(Box<ScSpecUdtEnumV0>),
49423    ScSpecUdtErrorEnumCaseV0(Box<ScSpecUdtErrorEnumCaseV0>),
49424    ScSpecUdtErrorEnumV0(Box<ScSpecUdtErrorEnumV0>),
49425    ScSpecFunctionInputV0(Box<ScSpecFunctionInputV0>),
49426    ScSpecFunctionV0(Box<ScSpecFunctionV0>),
49427    ScSpecEntryKind(Box<ScSpecEntryKind>),
49428    ScSpecEntry(Box<ScSpecEntry>),
49429    ScValType(Box<ScValType>),
49430    ScErrorType(Box<ScErrorType>),
49431    ScErrorCode(Box<ScErrorCode>),
49432    ScError(Box<ScError>),
49433    UInt128Parts(Box<UInt128Parts>),
49434    Int128Parts(Box<Int128Parts>),
49435    UInt256Parts(Box<UInt256Parts>),
49436    Int256Parts(Box<Int256Parts>),
49437    ContractExecutableType(Box<ContractExecutableType>),
49438    ContractExecutable(Box<ContractExecutable>),
49439    ScAddressType(Box<ScAddressType>),
49440    ScAddress(Box<ScAddress>),
49441    ScVec(Box<ScVec>),
49442    ScMap(Box<ScMap>),
49443    ScBytes(Box<ScBytes>),
49444    ScString(Box<ScString>),
49445    ScSymbol(Box<ScSymbol>),
49446    ScNonceKey(Box<ScNonceKey>),
49447    ScContractInstance(Box<ScContractInstance>),
49448    ScVal(Box<ScVal>),
49449    ScMapEntry(Box<ScMapEntry>),
49450    StoredTransactionSet(Box<StoredTransactionSet>),
49451    StoredDebugTransactionSet(Box<StoredDebugTransactionSet>),
49452    PersistedScpStateV0(Box<PersistedScpStateV0>),
49453    PersistedScpStateV1(Box<PersistedScpStateV1>),
49454    PersistedScpState(Box<PersistedScpState>),
49455    Thresholds(Box<Thresholds>),
49456    String32(Box<String32>),
49457    String64(Box<String64>),
49458    SequenceNumber(Box<SequenceNumber>),
49459    DataValue(Box<DataValue>),
49460    PoolId(Box<PoolId>),
49461    AssetCode4(Box<AssetCode4>),
49462    AssetCode12(Box<AssetCode12>),
49463    AssetType(Box<AssetType>),
49464    AssetCode(Box<AssetCode>),
49465    AlphaNum4(Box<AlphaNum4>),
49466    AlphaNum12(Box<AlphaNum12>),
49467    Asset(Box<Asset>),
49468    Price(Box<Price>),
49469    Liabilities(Box<Liabilities>),
49470    ThresholdIndexes(Box<ThresholdIndexes>),
49471    LedgerEntryType(Box<LedgerEntryType>),
49472    Signer(Box<Signer>),
49473    AccountFlags(Box<AccountFlags>),
49474    SponsorshipDescriptor(Box<SponsorshipDescriptor>),
49475    AccountEntryExtensionV3(Box<AccountEntryExtensionV3>),
49476    AccountEntryExtensionV2(Box<AccountEntryExtensionV2>),
49477    AccountEntryExtensionV2Ext(Box<AccountEntryExtensionV2Ext>),
49478    AccountEntryExtensionV1(Box<AccountEntryExtensionV1>),
49479    AccountEntryExtensionV1Ext(Box<AccountEntryExtensionV1Ext>),
49480    AccountEntry(Box<AccountEntry>),
49481    AccountEntryExt(Box<AccountEntryExt>),
49482    TrustLineFlags(Box<TrustLineFlags>),
49483    LiquidityPoolType(Box<LiquidityPoolType>),
49484    TrustLineAsset(Box<TrustLineAsset>),
49485    TrustLineEntryExtensionV2(Box<TrustLineEntryExtensionV2>),
49486    TrustLineEntryExtensionV2Ext(Box<TrustLineEntryExtensionV2Ext>),
49487    TrustLineEntry(Box<TrustLineEntry>),
49488    TrustLineEntryExt(Box<TrustLineEntryExt>),
49489    TrustLineEntryV1(Box<TrustLineEntryV1>),
49490    TrustLineEntryV1Ext(Box<TrustLineEntryV1Ext>),
49491    OfferEntryFlags(Box<OfferEntryFlags>),
49492    OfferEntry(Box<OfferEntry>),
49493    OfferEntryExt(Box<OfferEntryExt>),
49494    DataEntry(Box<DataEntry>),
49495    DataEntryExt(Box<DataEntryExt>),
49496    ClaimPredicateType(Box<ClaimPredicateType>),
49497    ClaimPredicate(Box<ClaimPredicate>),
49498    ClaimantType(Box<ClaimantType>),
49499    Claimant(Box<Claimant>),
49500    ClaimantV0(Box<ClaimantV0>),
49501    ClaimableBalanceIdType(Box<ClaimableBalanceIdType>),
49502    ClaimableBalanceId(Box<ClaimableBalanceId>),
49503    ClaimableBalanceFlags(Box<ClaimableBalanceFlags>),
49504    ClaimableBalanceEntryExtensionV1(Box<ClaimableBalanceEntryExtensionV1>),
49505    ClaimableBalanceEntryExtensionV1Ext(Box<ClaimableBalanceEntryExtensionV1Ext>),
49506    ClaimableBalanceEntry(Box<ClaimableBalanceEntry>),
49507    ClaimableBalanceEntryExt(Box<ClaimableBalanceEntryExt>),
49508    LiquidityPoolConstantProductParameters(Box<LiquidityPoolConstantProductParameters>),
49509    LiquidityPoolEntry(Box<LiquidityPoolEntry>),
49510    LiquidityPoolEntryBody(Box<LiquidityPoolEntryBody>),
49511    LiquidityPoolEntryConstantProduct(Box<LiquidityPoolEntryConstantProduct>),
49512    ContractDataDurability(Box<ContractDataDurability>),
49513    ContractDataEntry(Box<ContractDataEntry>),
49514    ContractCodeCostInputs(Box<ContractCodeCostInputs>),
49515    ContractCodeEntry(Box<ContractCodeEntry>),
49516    ContractCodeEntryExt(Box<ContractCodeEntryExt>),
49517    ContractCodeEntryV1(Box<ContractCodeEntryV1>),
49518    TtlEntry(Box<TtlEntry>),
49519    LedgerEntryExtensionV1(Box<LedgerEntryExtensionV1>),
49520    LedgerEntryExtensionV1Ext(Box<LedgerEntryExtensionV1Ext>),
49521    LedgerEntry(Box<LedgerEntry>),
49522    LedgerEntryData(Box<LedgerEntryData>),
49523    LedgerEntryExt(Box<LedgerEntryExt>),
49524    LedgerKey(Box<LedgerKey>),
49525    LedgerKeyAccount(Box<LedgerKeyAccount>),
49526    LedgerKeyTrustLine(Box<LedgerKeyTrustLine>),
49527    LedgerKeyOffer(Box<LedgerKeyOffer>),
49528    LedgerKeyData(Box<LedgerKeyData>),
49529    LedgerKeyClaimableBalance(Box<LedgerKeyClaimableBalance>),
49530    LedgerKeyLiquidityPool(Box<LedgerKeyLiquidityPool>),
49531    LedgerKeyContractData(Box<LedgerKeyContractData>),
49532    LedgerKeyContractCode(Box<LedgerKeyContractCode>),
49533    LedgerKeyConfigSetting(Box<LedgerKeyConfigSetting>),
49534    LedgerKeyTtl(Box<LedgerKeyTtl>),
49535    EnvelopeType(Box<EnvelopeType>),
49536    BucketListType(Box<BucketListType>),
49537    BucketEntryType(Box<BucketEntryType>),
49538    HotArchiveBucketEntryType(Box<HotArchiveBucketEntryType>),
49539    ColdArchiveBucketEntryType(Box<ColdArchiveBucketEntryType>),
49540    BucketMetadata(Box<BucketMetadata>),
49541    BucketMetadataExt(Box<BucketMetadataExt>),
49542    BucketEntry(Box<BucketEntry>),
49543    HotArchiveBucketEntry(Box<HotArchiveBucketEntry>),
49544    ColdArchiveArchivedLeaf(Box<ColdArchiveArchivedLeaf>),
49545    ColdArchiveDeletedLeaf(Box<ColdArchiveDeletedLeaf>),
49546    ColdArchiveBoundaryLeaf(Box<ColdArchiveBoundaryLeaf>),
49547    ColdArchiveHashEntry(Box<ColdArchiveHashEntry>),
49548    ColdArchiveBucketEntry(Box<ColdArchiveBucketEntry>),
49549    UpgradeType(Box<UpgradeType>),
49550    StellarValueType(Box<StellarValueType>),
49551    LedgerCloseValueSignature(Box<LedgerCloseValueSignature>),
49552    StellarValue(Box<StellarValue>),
49553    StellarValueExt(Box<StellarValueExt>),
49554    LedgerHeaderFlags(Box<LedgerHeaderFlags>),
49555    LedgerHeaderExtensionV1(Box<LedgerHeaderExtensionV1>),
49556    LedgerHeaderExtensionV1Ext(Box<LedgerHeaderExtensionV1Ext>),
49557    LedgerHeader(Box<LedgerHeader>),
49558    LedgerHeaderExt(Box<LedgerHeaderExt>),
49559    LedgerUpgradeType(Box<LedgerUpgradeType>),
49560    ConfigUpgradeSetKey(Box<ConfigUpgradeSetKey>),
49561    LedgerUpgrade(Box<LedgerUpgrade>),
49562    ConfigUpgradeSet(Box<ConfigUpgradeSet>),
49563    TxSetComponentType(Box<TxSetComponentType>),
49564    TxSetComponent(Box<TxSetComponent>),
49565    TxSetComponentTxsMaybeDiscountedFee(Box<TxSetComponentTxsMaybeDiscountedFee>),
49566    TransactionPhase(Box<TransactionPhase>),
49567    TransactionSet(Box<TransactionSet>),
49568    TransactionSetV1(Box<TransactionSetV1>),
49569    GeneralizedTransactionSet(Box<GeneralizedTransactionSet>),
49570    TransactionResultPair(Box<TransactionResultPair>),
49571    TransactionResultSet(Box<TransactionResultSet>),
49572    TransactionHistoryEntry(Box<TransactionHistoryEntry>),
49573    TransactionHistoryEntryExt(Box<TransactionHistoryEntryExt>),
49574    TransactionHistoryResultEntry(Box<TransactionHistoryResultEntry>),
49575    TransactionHistoryResultEntryExt(Box<TransactionHistoryResultEntryExt>),
49576    LedgerHeaderHistoryEntry(Box<LedgerHeaderHistoryEntry>),
49577    LedgerHeaderHistoryEntryExt(Box<LedgerHeaderHistoryEntryExt>),
49578    LedgerScpMessages(Box<LedgerScpMessages>),
49579    ScpHistoryEntryV0(Box<ScpHistoryEntryV0>),
49580    ScpHistoryEntry(Box<ScpHistoryEntry>),
49581    LedgerEntryChangeType(Box<LedgerEntryChangeType>),
49582    LedgerEntryChange(Box<LedgerEntryChange>),
49583    LedgerEntryChanges(Box<LedgerEntryChanges>),
49584    OperationMeta(Box<OperationMeta>),
49585    TransactionMetaV1(Box<TransactionMetaV1>),
49586    TransactionMetaV2(Box<TransactionMetaV2>),
49587    ContractEventType(Box<ContractEventType>),
49588    ContractEvent(Box<ContractEvent>),
49589    ContractEventBody(Box<ContractEventBody>),
49590    ContractEventV0(Box<ContractEventV0>),
49591    DiagnosticEvent(Box<DiagnosticEvent>),
49592    DiagnosticEvents(Box<DiagnosticEvents>),
49593    SorobanTransactionMetaExtV1(Box<SorobanTransactionMetaExtV1>),
49594    SorobanTransactionMetaExt(Box<SorobanTransactionMetaExt>),
49595    SorobanTransactionMeta(Box<SorobanTransactionMeta>),
49596    TransactionMetaV3(Box<TransactionMetaV3>),
49597    InvokeHostFunctionSuccessPreImage(Box<InvokeHostFunctionSuccessPreImage>),
49598    TransactionMeta(Box<TransactionMeta>),
49599    TransactionResultMeta(Box<TransactionResultMeta>),
49600    UpgradeEntryMeta(Box<UpgradeEntryMeta>),
49601    LedgerCloseMetaV0(Box<LedgerCloseMetaV0>),
49602    LedgerCloseMetaExtV1(Box<LedgerCloseMetaExtV1>),
49603    LedgerCloseMetaExt(Box<LedgerCloseMetaExt>),
49604    LedgerCloseMetaV1(Box<LedgerCloseMetaV1>),
49605    LedgerCloseMeta(Box<LedgerCloseMeta>),
49606    ErrorCode(Box<ErrorCode>),
49607    SError(Box<SError>),
49608    SendMore(Box<SendMore>),
49609    SendMoreExtended(Box<SendMoreExtended>),
49610    AuthCert(Box<AuthCert>),
49611    Hello(Box<Hello>),
49612    Auth(Box<Auth>),
49613    IpAddrType(Box<IpAddrType>),
49614    PeerAddress(Box<PeerAddress>),
49615    PeerAddressIp(Box<PeerAddressIp>),
49616    MessageType(Box<MessageType>),
49617    DontHave(Box<DontHave>),
49618    SurveyMessageCommandType(Box<SurveyMessageCommandType>),
49619    SurveyMessageResponseType(Box<SurveyMessageResponseType>),
49620    TimeSlicedSurveyStartCollectingMessage(Box<TimeSlicedSurveyStartCollectingMessage>),
49621    SignedTimeSlicedSurveyStartCollectingMessage(Box<SignedTimeSlicedSurveyStartCollectingMessage>),
49622    TimeSlicedSurveyStopCollectingMessage(Box<TimeSlicedSurveyStopCollectingMessage>),
49623    SignedTimeSlicedSurveyStopCollectingMessage(Box<SignedTimeSlicedSurveyStopCollectingMessage>),
49624    SurveyRequestMessage(Box<SurveyRequestMessage>),
49625    TimeSlicedSurveyRequestMessage(Box<TimeSlicedSurveyRequestMessage>),
49626    SignedSurveyRequestMessage(Box<SignedSurveyRequestMessage>),
49627    SignedTimeSlicedSurveyRequestMessage(Box<SignedTimeSlicedSurveyRequestMessage>),
49628    EncryptedBody(Box<EncryptedBody>),
49629    SurveyResponseMessage(Box<SurveyResponseMessage>),
49630    TimeSlicedSurveyResponseMessage(Box<TimeSlicedSurveyResponseMessage>),
49631    SignedSurveyResponseMessage(Box<SignedSurveyResponseMessage>),
49632    SignedTimeSlicedSurveyResponseMessage(Box<SignedTimeSlicedSurveyResponseMessage>),
49633    PeerStats(Box<PeerStats>),
49634    PeerStatList(Box<PeerStatList>),
49635    TimeSlicedNodeData(Box<TimeSlicedNodeData>),
49636    TimeSlicedPeerData(Box<TimeSlicedPeerData>),
49637    TimeSlicedPeerDataList(Box<TimeSlicedPeerDataList>),
49638    TopologyResponseBodyV0(Box<TopologyResponseBodyV0>),
49639    TopologyResponseBodyV1(Box<TopologyResponseBodyV1>),
49640    TopologyResponseBodyV2(Box<TopologyResponseBodyV2>),
49641    SurveyResponseBody(Box<SurveyResponseBody>),
49642    TxAdvertVector(Box<TxAdvertVector>),
49643    FloodAdvert(Box<FloodAdvert>),
49644    TxDemandVector(Box<TxDemandVector>),
49645    FloodDemand(Box<FloodDemand>),
49646    StellarMessage(Box<StellarMessage>),
49647    AuthenticatedMessage(Box<AuthenticatedMessage>),
49648    AuthenticatedMessageV0(Box<AuthenticatedMessageV0>),
49649    LiquidityPoolParameters(Box<LiquidityPoolParameters>),
49650    MuxedAccount(Box<MuxedAccount>),
49651    MuxedAccountMed25519(Box<MuxedAccountMed25519>),
49652    DecoratedSignature(Box<DecoratedSignature>),
49653    OperationType(Box<OperationType>),
49654    CreateAccountOp(Box<CreateAccountOp>),
49655    PaymentOp(Box<PaymentOp>),
49656    PathPaymentStrictReceiveOp(Box<PathPaymentStrictReceiveOp>),
49657    PathPaymentStrictSendOp(Box<PathPaymentStrictSendOp>),
49658    ManageSellOfferOp(Box<ManageSellOfferOp>),
49659    ManageBuyOfferOp(Box<ManageBuyOfferOp>),
49660    CreatePassiveSellOfferOp(Box<CreatePassiveSellOfferOp>),
49661    SetOptionsOp(Box<SetOptionsOp>),
49662    ChangeTrustAsset(Box<ChangeTrustAsset>),
49663    ChangeTrustOp(Box<ChangeTrustOp>),
49664    AllowTrustOp(Box<AllowTrustOp>),
49665    ManageDataOp(Box<ManageDataOp>),
49666    BumpSequenceOp(Box<BumpSequenceOp>),
49667    CreateClaimableBalanceOp(Box<CreateClaimableBalanceOp>),
49668    ClaimClaimableBalanceOp(Box<ClaimClaimableBalanceOp>),
49669    BeginSponsoringFutureReservesOp(Box<BeginSponsoringFutureReservesOp>),
49670    RevokeSponsorshipType(Box<RevokeSponsorshipType>),
49671    RevokeSponsorshipOp(Box<RevokeSponsorshipOp>),
49672    RevokeSponsorshipOpSigner(Box<RevokeSponsorshipOpSigner>),
49673    ClawbackOp(Box<ClawbackOp>),
49674    ClawbackClaimableBalanceOp(Box<ClawbackClaimableBalanceOp>),
49675    SetTrustLineFlagsOp(Box<SetTrustLineFlagsOp>),
49676    LiquidityPoolDepositOp(Box<LiquidityPoolDepositOp>),
49677    LiquidityPoolWithdrawOp(Box<LiquidityPoolWithdrawOp>),
49678    HostFunctionType(Box<HostFunctionType>),
49679    ContractIdPreimageType(Box<ContractIdPreimageType>),
49680    ContractIdPreimage(Box<ContractIdPreimage>),
49681    ContractIdPreimageFromAddress(Box<ContractIdPreimageFromAddress>),
49682    CreateContractArgs(Box<CreateContractArgs>),
49683    CreateContractArgsV2(Box<CreateContractArgsV2>),
49684    InvokeContractArgs(Box<InvokeContractArgs>),
49685    HostFunction(Box<HostFunction>),
49686    SorobanAuthorizedFunctionType(Box<SorobanAuthorizedFunctionType>),
49687    SorobanAuthorizedFunction(Box<SorobanAuthorizedFunction>),
49688    SorobanAuthorizedInvocation(Box<SorobanAuthorizedInvocation>),
49689    SorobanAddressCredentials(Box<SorobanAddressCredentials>),
49690    SorobanCredentialsType(Box<SorobanCredentialsType>),
49691    SorobanCredentials(Box<SorobanCredentials>),
49692    SorobanAuthorizationEntry(Box<SorobanAuthorizationEntry>),
49693    InvokeHostFunctionOp(Box<InvokeHostFunctionOp>),
49694    ExtendFootprintTtlOp(Box<ExtendFootprintTtlOp>),
49695    RestoreFootprintOp(Box<RestoreFootprintOp>),
49696    Operation(Box<Operation>),
49697    OperationBody(Box<OperationBody>),
49698    HashIdPreimage(Box<HashIdPreimage>),
49699    HashIdPreimageOperationId(Box<HashIdPreimageOperationId>),
49700    HashIdPreimageRevokeId(Box<HashIdPreimageRevokeId>),
49701    HashIdPreimageContractId(Box<HashIdPreimageContractId>),
49702    HashIdPreimageSorobanAuthorization(Box<HashIdPreimageSorobanAuthorization>),
49703    MemoType(Box<MemoType>),
49704    Memo(Box<Memo>),
49705    TimeBounds(Box<TimeBounds>),
49706    LedgerBounds(Box<LedgerBounds>),
49707    PreconditionsV2(Box<PreconditionsV2>),
49708    PreconditionType(Box<PreconditionType>),
49709    Preconditions(Box<Preconditions>),
49710    LedgerFootprint(Box<LedgerFootprint>),
49711    ArchivalProofType(Box<ArchivalProofType>),
49712    ArchivalProofNode(Box<ArchivalProofNode>),
49713    ProofLevel(Box<ProofLevel>),
49714    NonexistenceProofBody(Box<NonexistenceProofBody>),
49715    ExistenceProofBody(Box<ExistenceProofBody>),
49716    ArchivalProof(Box<ArchivalProof>),
49717    ArchivalProofBody(Box<ArchivalProofBody>),
49718    SorobanResources(Box<SorobanResources>),
49719    SorobanTransactionData(Box<SorobanTransactionData>),
49720    TransactionV0(Box<TransactionV0>),
49721    TransactionV0Ext(Box<TransactionV0Ext>),
49722    TransactionV0Envelope(Box<TransactionV0Envelope>),
49723    Transaction(Box<Transaction>),
49724    TransactionExt(Box<TransactionExt>),
49725    TransactionV1Envelope(Box<TransactionV1Envelope>),
49726    FeeBumpTransaction(Box<FeeBumpTransaction>),
49727    FeeBumpTransactionInnerTx(Box<FeeBumpTransactionInnerTx>),
49728    FeeBumpTransactionExt(Box<FeeBumpTransactionExt>),
49729    FeeBumpTransactionEnvelope(Box<FeeBumpTransactionEnvelope>),
49730    TransactionEnvelope(Box<TransactionEnvelope>),
49731    TransactionSignaturePayload(Box<TransactionSignaturePayload>),
49732    TransactionSignaturePayloadTaggedTransaction(Box<TransactionSignaturePayloadTaggedTransaction>),
49733    ClaimAtomType(Box<ClaimAtomType>),
49734    ClaimOfferAtomV0(Box<ClaimOfferAtomV0>),
49735    ClaimOfferAtom(Box<ClaimOfferAtom>),
49736    ClaimLiquidityAtom(Box<ClaimLiquidityAtom>),
49737    ClaimAtom(Box<ClaimAtom>),
49738    CreateAccountResultCode(Box<CreateAccountResultCode>),
49739    CreateAccountResult(Box<CreateAccountResult>),
49740    PaymentResultCode(Box<PaymentResultCode>),
49741    PaymentResult(Box<PaymentResult>),
49742    PathPaymentStrictReceiveResultCode(Box<PathPaymentStrictReceiveResultCode>),
49743    SimplePaymentResult(Box<SimplePaymentResult>),
49744    PathPaymentStrictReceiveResult(Box<PathPaymentStrictReceiveResult>),
49745    PathPaymentStrictReceiveResultSuccess(Box<PathPaymentStrictReceiveResultSuccess>),
49746    PathPaymentStrictSendResultCode(Box<PathPaymentStrictSendResultCode>),
49747    PathPaymentStrictSendResult(Box<PathPaymentStrictSendResult>),
49748    PathPaymentStrictSendResultSuccess(Box<PathPaymentStrictSendResultSuccess>),
49749    ManageSellOfferResultCode(Box<ManageSellOfferResultCode>),
49750    ManageOfferEffect(Box<ManageOfferEffect>),
49751    ManageOfferSuccessResult(Box<ManageOfferSuccessResult>),
49752    ManageOfferSuccessResultOffer(Box<ManageOfferSuccessResultOffer>),
49753    ManageSellOfferResult(Box<ManageSellOfferResult>),
49754    ManageBuyOfferResultCode(Box<ManageBuyOfferResultCode>),
49755    ManageBuyOfferResult(Box<ManageBuyOfferResult>),
49756    SetOptionsResultCode(Box<SetOptionsResultCode>),
49757    SetOptionsResult(Box<SetOptionsResult>),
49758    ChangeTrustResultCode(Box<ChangeTrustResultCode>),
49759    ChangeTrustResult(Box<ChangeTrustResult>),
49760    AllowTrustResultCode(Box<AllowTrustResultCode>),
49761    AllowTrustResult(Box<AllowTrustResult>),
49762    AccountMergeResultCode(Box<AccountMergeResultCode>),
49763    AccountMergeResult(Box<AccountMergeResult>),
49764    InflationResultCode(Box<InflationResultCode>),
49765    InflationPayout(Box<InflationPayout>),
49766    InflationResult(Box<InflationResult>),
49767    ManageDataResultCode(Box<ManageDataResultCode>),
49768    ManageDataResult(Box<ManageDataResult>),
49769    BumpSequenceResultCode(Box<BumpSequenceResultCode>),
49770    BumpSequenceResult(Box<BumpSequenceResult>),
49771    CreateClaimableBalanceResultCode(Box<CreateClaimableBalanceResultCode>),
49772    CreateClaimableBalanceResult(Box<CreateClaimableBalanceResult>),
49773    ClaimClaimableBalanceResultCode(Box<ClaimClaimableBalanceResultCode>),
49774    ClaimClaimableBalanceResult(Box<ClaimClaimableBalanceResult>),
49775    BeginSponsoringFutureReservesResultCode(Box<BeginSponsoringFutureReservesResultCode>),
49776    BeginSponsoringFutureReservesResult(Box<BeginSponsoringFutureReservesResult>),
49777    EndSponsoringFutureReservesResultCode(Box<EndSponsoringFutureReservesResultCode>),
49778    EndSponsoringFutureReservesResult(Box<EndSponsoringFutureReservesResult>),
49779    RevokeSponsorshipResultCode(Box<RevokeSponsorshipResultCode>),
49780    RevokeSponsorshipResult(Box<RevokeSponsorshipResult>),
49781    ClawbackResultCode(Box<ClawbackResultCode>),
49782    ClawbackResult(Box<ClawbackResult>),
49783    ClawbackClaimableBalanceResultCode(Box<ClawbackClaimableBalanceResultCode>),
49784    ClawbackClaimableBalanceResult(Box<ClawbackClaimableBalanceResult>),
49785    SetTrustLineFlagsResultCode(Box<SetTrustLineFlagsResultCode>),
49786    SetTrustLineFlagsResult(Box<SetTrustLineFlagsResult>),
49787    LiquidityPoolDepositResultCode(Box<LiquidityPoolDepositResultCode>),
49788    LiquidityPoolDepositResult(Box<LiquidityPoolDepositResult>),
49789    LiquidityPoolWithdrawResultCode(Box<LiquidityPoolWithdrawResultCode>),
49790    LiquidityPoolWithdrawResult(Box<LiquidityPoolWithdrawResult>),
49791    InvokeHostFunctionResultCode(Box<InvokeHostFunctionResultCode>),
49792    InvokeHostFunctionResult(Box<InvokeHostFunctionResult>),
49793    ExtendFootprintTtlResultCode(Box<ExtendFootprintTtlResultCode>),
49794    ExtendFootprintTtlResult(Box<ExtendFootprintTtlResult>),
49795    RestoreFootprintResultCode(Box<RestoreFootprintResultCode>),
49796    RestoreFootprintResult(Box<RestoreFootprintResult>),
49797    OperationResultCode(Box<OperationResultCode>),
49798    OperationResult(Box<OperationResult>),
49799    OperationResultTr(Box<OperationResultTr>),
49800    TransactionResultCode(Box<TransactionResultCode>),
49801    InnerTransactionResult(Box<InnerTransactionResult>),
49802    InnerTransactionResultResult(Box<InnerTransactionResultResult>),
49803    InnerTransactionResultExt(Box<InnerTransactionResultExt>),
49804    InnerTransactionResultPair(Box<InnerTransactionResultPair>),
49805    TransactionResult(Box<TransactionResult>),
49806    TransactionResultResult(Box<TransactionResultResult>),
49807    TransactionResultExt(Box<TransactionResultExt>),
49808    Hash(Box<Hash>),
49809    Uint256(Box<Uint256>),
49810    Uint32(Box<Uint32>),
49811    Int32(Box<Int32>),
49812    Uint64(Box<Uint64>),
49813    Int64(Box<Int64>),
49814    TimePoint(Box<TimePoint>),
49815    Duration(Box<Duration>),
49816    ExtensionPoint(Box<ExtensionPoint>),
49817    CryptoKeyType(Box<CryptoKeyType>),
49818    PublicKeyType(Box<PublicKeyType>),
49819    SignerKeyType(Box<SignerKeyType>),
49820    PublicKey(Box<PublicKey>),
49821    SignerKey(Box<SignerKey>),
49822    SignerKeyEd25519SignedPayload(Box<SignerKeyEd25519SignedPayload>),
49823    Signature(Box<Signature>),
49824    SignatureHint(Box<SignatureHint>),
49825    NodeId(Box<NodeId>),
49826    AccountId(Box<AccountId>),
49827    Curve25519Secret(Box<Curve25519Secret>),
49828    Curve25519Public(Box<Curve25519Public>),
49829    HmacSha256Key(Box<HmacSha256Key>),
49830    HmacSha256Mac(Box<HmacSha256Mac>),
49831    ShortHashSeed(Box<ShortHashSeed>),
49832    BinaryFuseFilterType(Box<BinaryFuseFilterType>),
49833    SerializedBinaryFuseFilter(Box<SerializedBinaryFuseFilter>),
49834}
49835
49836impl Type {
49837    pub const VARIANTS: [TypeVariant; 459] = [
49838        TypeVariant::Value,
49839        TypeVariant::ScpBallot,
49840        TypeVariant::ScpStatementType,
49841        TypeVariant::ScpNomination,
49842        TypeVariant::ScpStatement,
49843        TypeVariant::ScpStatementPledges,
49844        TypeVariant::ScpStatementPrepare,
49845        TypeVariant::ScpStatementConfirm,
49846        TypeVariant::ScpStatementExternalize,
49847        TypeVariant::ScpEnvelope,
49848        TypeVariant::ScpQuorumSet,
49849        TypeVariant::ConfigSettingContractExecutionLanesV0,
49850        TypeVariant::ConfigSettingContractComputeV0,
49851        TypeVariant::ConfigSettingContractLedgerCostV0,
49852        TypeVariant::ConfigSettingContractHistoricalDataV0,
49853        TypeVariant::ConfigSettingContractEventsV0,
49854        TypeVariant::ConfigSettingContractBandwidthV0,
49855        TypeVariant::ContractCostType,
49856        TypeVariant::ContractCostParamEntry,
49857        TypeVariant::StateArchivalSettings,
49858        TypeVariant::EvictionIterator,
49859        TypeVariant::ContractCostParams,
49860        TypeVariant::ConfigSettingId,
49861        TypeVariant::ConfigSettingEntry,
49862        TypeVariant::ScEnvMetaKind,
49863        TypeVariant::ScEnvMetaEntry,
49864        TypeVariant::ScEnvMetaEntryInterfaceVersion,
49865        TypeVariant::ScMetaV0,
49866        TypeVariant::ScMetaKind,
49867        TypeVariant::ScMetaEntry,
49868        TypeVariant::ScSpecType,
49869        TypeVariant::ScSpecTypeOption,
49870        TypeVariant::ScSpecTypeResult,
49871        TypeVariant::ScSpecTypeVec,
49872        TypeVariant::ScSpecTypeMap,
49873        TypeVariant::ScSpecTypeTuple,
49874        TypeVariant::ScSpecTypeBytesN,
49875        TypeVariant::ScSpecTypeUdt,
49876        TypeVariant::ScSpecTypeDef,
49877        TypeVariant::ScSpecUdtStructFieldV0,
49878        TypeVariant::ScSpecUdtStructV0,
49879        TypeVariant::ScSpecUdtUnionCaseVoidV0,
49880        TypeVariant::ScSpecUdtUnionCaseTupleV0,
49881        TypeVariant::ScSpecUdtUnionCaseV0Kind,
49882        TypeVariant::ScSpecUdtUnionCaseV0,
49883        TypeVariant::ScSpecUdtUnionV0,
49884        TypeVariant::ScSpecUdtEnumCaseV0,
49885        TypeVariant::ScSpecUdtEnumV0,
49886        TypeVariant::ScSpecUdtErrorEnumCaseV0,
49887        TypeVariant::ScSpecUdtErrorEnumV0,
49888        TypeVariant::ScSpecFunctionInputV0,
49889        TypeVariant::ScSpecFunctionV0,
49890        TypeVariant::ScSpecEntryKind,
49891        TypeVariant::ScSpecEntry,
49892        TypeVariant::ScValType,
49893        TypeVariant::ScErrorType,
49894        TypeVariant::ScErrorCode,
49895        TypeVariant::ScError,
49896        TypeVariant::UInt128Parts,
49897        TypeVariant::Int128Parts,
49898        TypeVariant::UInt256Parts,
49899        TypeVariant::Int256Parts,
49900        TypeVariant::ContractExecutableType,
49901        TypeVariant::ContractExecutable,
49902        TypeVariant::ScAddressType,
49903        TypeVariant::ScAddress,
49904        TypeVariant::ScVec,
49905        TypeVariant::ScMap,
49906        TypeVariant::ScBytes,
49907        TypeVariant::ScString,
49908        TypeVariant::ScSymbol,
49909        TypeVariant::ScNonceKey,
49910        TypeVariant::ScContractInstance,
49911        TypeVariant::ScVal,
49912        TypeVariant::ScMapEntry,
49913        TypeVariant::StoredTransactionSet,
49914        TypeVariant::StoredDebugTransactionSet,
49915        TypeVariant::PersistedScpStateV0,
49916        TypeVariant::PersistedScpStateV1,
49917        TypeVariant::PersistedScpState,
49918        TypeVariant::Thresholds,
49919        TypeVariant::String32,
49920        TypeVariant::String64,
49921        TypeVariant::SequenceNumber,
49922        TypeVariant::DataValue,
49923        TypeVariant::PoolId,
49924        TypeVariant::AssetCode4,
49925        TypeVariant::AssetCode12,
49926        TypeVariant::AssetType,
49927        TypeVariant::AssetCode,
49928        TypeVariant::AlphaNum4,
49929        TypeVariant::AlphaNum12,
49930        TypeVariant::Asset,
49931        TypeVariant::Price,
49932        TypeVariant::Liabilities,
49933        TypeVariant::ThresholdIndexes,
49934        TypeVariant::LedgerEntryType,
49935        TypeVariant::Signer,
49936        TypeVariant::AccountFlags,
49937        TypeVariant::SponsorshipDescriptor,
49938        TypeVariant::AccountEntryExtensionV3,
49939        TypeVariant::AccountEntryExtensionV2,
49940        TypeVariant::AccountEntryExtensionV2Ext,
49941        TypeVariant::AccountEntryExtensionV1,
49942        TypeVariant::AccountEntryExtensionV1Ext,
49943        TypeVariant::AccountEntry,
49944        TypeVariant::AccountEntryExt,
49945        TypeVariant::TrustLineFlags,
49946        TypeVariant::LiquidityPoolType,
49947        TypeVariant::TrustLineAsset,
49948        TypeVariant::TrustLineEntryExtensionV2,
49949        TypeVariant::TrustLineEntryExtensionV2Ext,
49950        TypeVariant::TrustLineEntry,
49951        TypeVariant::TrustLineEntryExt,
49952        TypeVariant::TrustLineEntryV1,
49953        TypeVariant::TrustLineEntryV1Ext,
49954        TypeVariant::OfferEntryFlags,
49955        TypeVariant::OfferEntry,
49956        TypeVariant::OfferEntryExt,
49957        TypeVariant::DataEntry,
49958        TypeVariant::DataEntryExt,
49959        TypeVariant::ClaimPredicateType,
49960        TypeVariant::ClaimPredicate,
49961        TypeVariant::ClaimantType,
49962        TypeVariant::Claimant,
49963        TypeVariant::ClaimantV0,
49964        TypeVariant::ClaimableBalanceIdType,
49965        TypeVariant::ClaimableBalanceId,
49966        TypeVariant::ClaimableBalanceFlags,
49967        TypeVariant::ClaimableBalanceEntryExtensionV1,
49968        TypeVariant::ClaimableBalanceEntryExtensionV1Ext,
49969        TypeVariant::ClaimableBalanceEntry,
49970        TypeVariant::ClaimableBalanceEntryExt,
49971        TypeVariant::LiquidityPoolConstantProductParameters,
49972        TypeVariant::LiquidityPoolEntry,
49973        TypeVariant::LiquidityPoolEntryBody,
49974        TypeVariant::LiquidityPoolEntryConstantProduct,
49975        TypeVariant::ContractDataDurability,
49976        TypeVariant::ContractDataEntry,
49977        TypeVariant::ContractCodeCostInputs,
49978        TypeVariant::ContractCodeEntry,
49979        TypeVariant::ContractCodeEntryExt,
49980        TypeVariant::ContractCodeEntryV1,
49981        TypeVariant::TtlEntry,
49982        TypeVariant::LedgerEntryExtensionV1,
49983        TypeVariant::LedgerEntryExtensionV1Ext,
49984        TypeVariant::LedgerEntry,
49985        TypeVariant::LedgerEntryData,
49986        TypeVariant::LedgerEntryExt,
49987        TypeVariant::LedgerKey,
49988        TypeVariant::LedgerKeyAccount,
49989        TypeVariant::LedgerKeyTrustLine,
49990        TypeVariant::LedgerKeyOffer,
49991        TypeVariant::LedgerKeyData,
49992        TypeVariant::LedgerKeyClaimableBalance,
49993        TypeVariant::LedgerKeyLiquidityPool,
49994        TypeVariant::LedgerKeyContractData,
49995        TypeVariant::LedgerKeyContractCode,
49996        TypeVariant::LedgerKeyConfigSetting,
49997        TypeVariant::LedgerKeyTtl,
49998        TypeVariant::EnvelopeType,
49999        TypeVariant::BucketListType,
50000        TypeVariant::BucketEntryType,
50001        TypeVariant::HotArchiveBucketEntryType,
50002        TypeVariant::ColdArchiveBucketEntryType,
50003        TypeVariant::BucketMetadata,
50004        TypeVariant::BucketMetadataExt,
50005        TypeVariant::BucketEntry,
50006        TypeVariant::HotArchiveBucketEntry,
50007        TypeVariant::ColdArchiveArchivedLeaf,
50008        TypeVariant::ColdArchiveDeletedLeaf,
50009        TypeVariant::ColdArchiveBoundaryLeaf,
50010        TypeVariant::ColdArchiveHashEntry,
50011        TypeVariant::ColdArchiveBucketEntry,
50012        TypeVariant::UpgradeType,
50013        TypeVariant::StellarValueType,
50014        TypeVariant::LedgerCloseValueSignature,
50015        TypeVariant::StellarValue,
50016        TypeVariant::StellarValueExt,
50017        TypeVariant::LedgerHeaderFlags,
50018        TypeVariant::LedgerHeaderExtensionV1,
50019        TypeVariant::LedgerHeaderExtensionV1Ext,
50020        TypeVariant::LedgerHeader,
50021        TypeVariant::LedgerHeaderExt,
50022        TypeVariant::LedgerUpgradeType,
50023        TypeVariant::ConfigUpgradeSetKey,
50024        TypeVariant::LedgerUpgrade,
50025        TypeVariant::ConfigUpgradeSet,
50026        TypeVariant::TxSetComponentType,
50027        TypeVariant::TxSetComponent,
50028        TypeVariant::TxSetComponentTxsMaybeDiscountedFee,
50029        TypeVariant::TransactionPhase,
50030        TypeVariant::TransactionSet,
50031        TypeVariant::TransactionSetV1,
50032        TypeVariant::GeneralizedTransactionSet,
50033        TypeVariant::TransactionResultPair,
50034        TypeVariant::TransactionResultSet,
50035        TypeVariant::TransactionHistoryEntry,
50036        TypeVariant::TransactionHistoryEntryExt,
50037        TypeVariant::TransactionHistoryResultEntry,
50038        TypeVariant::TransactionHistoryResultEntryExt,
50039        TypeVariant::LedgerHeaderHistoryEntry,
50040        TypeVariant::LedgerHeaderHistoryEntryExt,
50041        TypeVariant::LedgerScpMessages,
50042        TypeVariant::ScpHistoryEntryV0,
50043        TypeVariant::ScpHistoryEntry,
50044        TypeVariant::LedgerEntryChangeType,
50045        TypeVariant::LedgerEntryChange,
50046        TypeVariant::LedgerEntryChanges,
50047        TypeVariant::OperationMeta,
50048        TypeVariant::TransactionMetaV1,
50049        TypeVariant::TransactionMetaV2,
50050        TypeVariant::ContractEventType,
50051        TypeVariant::ContractEvent,
50052        TypeVariant::ContractEventBody,
50053        TypeVariant::ContractEventV0,
50054        TypeVariant::DiagnosticEvent,
50055        TypeVariant::DiagnosticEvents,
50056        TypeVariant::SorobanTransactionMetaExtV1,
50057        TypeVariant::SorobanTransactionMetaExt,
50058        TypeVariant::SorobanTransactionMeta,
50059        TypeVariant::TransactionMetaV3,
50060        TypeVariant::InvokeHostFunctionSuccessPreImage,
50061        TypeVariant::TransactionMeta,
50062        TypeVariant::TransactionResultMeta,
50063        TypeVariant::UpgradeEntryMeta,
50064        TypeVariant::LedgerCloseMetaV0,
50065        TypeVariant::LedgerCloseMetaExtV1,
50066        TypeVariant::LedgerCloseMetaExt,
50067        TypeVariant::LedgerCloseMetaV1,
50068        TypeVariant::LedgerCloseMeta,
50069        TypeVariant::ErrorCode,
50070        TypeVariant::SError,
50071        TypeVariant::SendMore,
50072        TypeVariant::SendMoreExtended,
50073        TypeVariant::AuthCert,
50074        TypeVariant::Hello,
50075        TypeVariant::Auth,
50076        TypeVariant::IpAddrType,
50077        TypeVariant::PeerAddress,
50078        TypeVariant::PeerAddressIp,
50079        TypeVariant::MessageType,
50080        TypeVariant::DontHave,
50081        TypeVariant::SurveyMessageCommandType,
50082        TypeVariant::SurveyMessageResponseType,
50083        TypeVariant::TimeSlicedSurveyStartCollectingMessage,
50084        TypeVariant::SignedTimeSlicedSurveyStartCollectingMessage,
50085        TypeVariant::TimeSlicedSurveyStopCollectingMessage,
50086        TypeVariant::SignedTimeSlicedSurveyStopCollectingMessage,
50087        TypeVariant::SurveyRequestMessage,
50088        TypeVariant::TimeSlicedSurveyRequestMessage,
50089        TypeVariant::SignedSurveyRequestMessage,
50090        TypeVariant::SignedTimeSlicedSurveyRequestMessage,
50091        TypeVariant::EncryptedBody,
50092        TypeVariant::SurveyResponseMessage,
50093        TypeVariant::TimeSlicedSurveyResponseMessage,
50094        TypeVariant::SignedSurveyResponseMessage,
50095        TypeVariant::SignedTimeSlicedSurveyResponseMessage,
50096        TypeVariant::PeerStats,
50097        TypeVariant::PeerStatList,
50098        TypeVariant::TimeSlicedNodeData,
50099        TypeVariant::TimeSlicedPeerData,
50100        TypeVariant::TimeSlicedPeerDataList,
50101        TypeVariant::TopologyResponseBodyV0,
50102        TypeVariant::TopologyResponseBodyV1,
50103        TypeVariant::TopologyResponseBodyV2,
50104        TypeVariant::SurveyResponseBody,
50105        TypeVariant::TxAdvertVector,
50106        TypeVariant::FloodAdvert,
50107        TypeVariant::TxDemandVector,
50108        TypeVariant::FloodDemand,
50109        TypeVariant::StellarMessage,
50110        TypeVariant::AuthenticatedMessage,
50111        TypeVariant::AuthenticatedMessageV0,
50112        TypeVariant::LiquidityPoolParameters,
50113        TypeVariant::MuxedAccount,
50114        TypeVariant::MuxedAccountMed25519,
50115        TypeVariant::DecoratedSignature,
50116        TypeVariant::OperationType,
50117        TypeVariant::CreateAccountOp,
50118        TypeVariant::PaymentOp,
50119        TypeVariant::PathPaymentStrictReceiveOp,
50120        TypeVariant::PathPaymentStrictSendOp,
50121        TypeVariant::ManageSellOfferOp,
50122        TypeVariant::ManageBuyOfferOp,
50123        TypeVariant::CreatePassiveSellOfferOp,
50124        TypeVariant::SetOptionsOp,
50125        TypeVariant::ChangeTrustAsset,
50126        TypeVariant::ChangeTrustOp,
50127        TypeVariant::AllowTrustOp,
50128        TypeVariant::ManageDataOp,
50129        TypeVariant::BumpSequenceOp,
50130        TypeVariant::CreateClaimableBalanceOp,
50131        TypeVariant::ClaimClaimableBalanceOp,
50132        TypeVariant::BeginSponsoringFutureReservesOp,
50133        TypeVariant::RevokeSponsorshipType,
50134        TypeVariant::RevokeSponsorshipOp,
50135        TypeVariant::RevokeSponsorshipOpSigner,
50136        TypeVariant::ClawbackOp,
50137        TypeVariant::ClawbackClaimableBalanceOp,
50138        TypeVariant::SetTrustLineFlagsOp,
50139        TypeVariant::LiquidityPoolDepositOp,
50140        TypeVariant::LiquidityPoolWithdrawOp,
50141        TypeVariant::HostFunctionType,
50142        TypeVariant::ContractIdPreimageType,
50143        TypeVariant::ContractIdPreimage,
50144        TypeVariant::ContractIdPreimageFromAddress,
50145        TypeVariant::CreateContractArgs,
50146        TypeVariant::CreateContractArgsV2,
50147        TypeVariant::InvokeContractArgs,
50148        TypeVariant::HostFunction,
50149        TypeVariant::SorobanAuthorizedFunctionType,
50150        TypeVariant::SorobanAuthorizedFunction,
50151        TypeVariant::SorobanAuthorizedInvocation,
50152        TypeVariant::SorobanAddressCredentials,
50153        TypeVariant::SorobanCredentialsType,
50154        TypeVariant::SorobanCredentials,
50155        TypeVariant::SorobanAuthorizationEntry,
50156        TypeVariant::InvokeHostFunctionOp,
50157        TypeVariant::ExtendFootprintTtlOp,
50158        TypeVariant::RestoreFootprintOp,
50159        TypeVariant::Operation,
50160        TypeVariant::OperationBody,
50161        TypeVariant::HashIdPreimage,
50162        TypeVariant::HashIdPreimageOperationId,
50163        TypeVariant::HashIdPreimageRevokeId,
50164        TypeVariant::HashIdPreimageContractId,
50165        TypeVariant::HashIdPreimageSorobanAuthorization,
50166        TypeVariant::MemoType,
50167        TypeVariant::Memo,
50168        TypeVariant::TimeBounds,
50169        TypeVariant::LedgerBounds,
50170        TypeVariant::PreconditionsV2,
50171        TypeVariant::PreconditionType,
50172        TypeVariant::Preconditions,
50173        TypeVariant::LedgerFootprint,
50174        TypeVariant::ArchivalProofType,
50175        TypeVariant::ArchivalProofNode,
50176        TypeVariant::ProofLevel,
50177        TypeVariant::NonexistenceProofBody,
50178        TypeVariant::ExistenceProofBody,
50179        TypeVariant::ArchivalProof,
50180        TypeVariant::ArchivalProofBody,
50181        TypeVariant::SorobanResources,
50182        TypeVariant::SorobanTransactionData,
50183        TypeVariant::TransactionV0,
50184        TypeVariant::TransactionV0Ext,
50185        TypeVariant::TransactionV0Envelope,
50186        TypeVariant::Transaction,
50187        TypeVariant::TransactionExt,
50188        TypeVariant::TransactionV1Envelope,
50189        TypeVariant::FeeBumpTransaction,
50190        TypeVariant::FeeBumpTransactionInnerTx,
50191        TypeVariant::FeeBumpTransactionExt,
50192        TypeVariant::FeeBumpTransactionEnvelope,
50193        TypeVariant::TransactionEnvelope,
50194        TypeVariant::TransactionSignaturePayload,
50195        TypeVariant::TransactionSignaturePayloadTaggedTransaction,
50196        TypeVariant::ClaimAtomType,
50197        TypeVariant::ClaimOfferAtomV0,
50198        TypeVariant::ClaimOfferAtom,
50199        TypeVariant::ClaimLiquidityAtom,
50200        TypeVariant::ClaimAtom,
50201        TypeVariant::CreateAccountResultCode,
50202        TypeVariant::CreateAccountResult,
50203        TypeVariant::PaymentResultCode,
50204        TypeVariant::PaymentResult,
50205        TypeVariant::PathPaymentStrictReceiveResultCode,
50206        TypeVariant::SimplePaymentResult,
50207        TypeVariant::PathPaymentStrictReceiveResult,
50208        TypeVariant::PathPaymentStrictReceiveResultSuccess,
50209        TypeVariant::PathPaymentStrictSendResultCode,
50210        TypeVariant::PathPaymentStrictSendResult,
50211        TypeVariant::PathPaymentStrictSendResultSuccess,
50212        TypeVariant::ManageSellOfferResultCode,
50213        TypeVariant::ManageOfferEffect,
50214        TypeVariant::ManageOfferSuccessResult,
50215        TypeVariant::ManageOfferSuccessResultOffer,
50216        TypeVariant::ManageSellOfferResult,
50217        TypeVariant::ManageBuyOfferResultCode,
50218        TypeVariant::ManageBuyOfferResult,
50219        TypeVariant::SetOptionsResultCode,
50220        TypeVariant::SetOptionsResult,
50221        TypeVariant::ChangeTrustResultCode,
50222        TypeVariant::ChangeTrustResult,
50223        TypeVariant::AllowTrustResultCode,
50224        TypeVariant::AllowTrustResult,
50225        TypeVariant::AccountMergeResultCode,
50226        TypeVariant::AccountMergeResult,
50227        TypeVariant::InflationResultCode,
50228        TypeVariant::InflationPayout,
50229        TypeVariant::InflationResult,
50230        TypeVariant::ManageDataResultCode,
50231        TypeVariant::ManageDataResult,
50232        TypeVariant::BumpSequenceResultCode,
50233        TypeVariant::BumpSequenceResult,
50234        TypeVariant::CreateClaimableBalanceResultCode,
50235        TypeVariant::CreateClaimableBalanceResult,
50236        TypeVariant::ClaimClaimableBalanceResultCode,
50237        TypeVariant::ClaimClaimableBalanceResult,
50238        TypeVariant::BeginSponsoringFutureReservesResultCode,
50239        TypeVariant::BeginSponsoringFutureReservesResult,
50240        TypeVariant::EndSponsoringFutureReservesResultCode,
50241        TypeVariant::EndSponsoringFutureReservesResult,
50242        TypeVariant::RevokeSponsorshipResultCode,
50243        TypeVariant::RevokeSponsorshipResult,
50244        TypeVariant::ClawbackResultCode,
50245        TypeVariant::ClawbackResult,
50246        TypeVariant::ClawbackClaimableBalanceResultCode,
50247        TypeVariant::ClawbackClaimableBalanceResult,
50248        TypeVariant::SetTrustLineFlagsResultCode,
50249        TypeVariant::SetTrustLineFlagsResult,
50250        TypeVariant::LiquidityPoolDepositResultCode,
50251        TypeVariant::LiquidityPoolDepositResult,
50252        TypeVariant::LiquidityPoolWithdrawResultCode,
50253        TypeVariant::LiquidityPoolWithdrawResult,
50254        TypeVariant::InvokeHostFunctionResultCode,
50255        TypeVariant::InvokeHostFunctionResult,
50256        TypeVariant::ExtendFootprintTtlResultCode,
50257        TypeVariant::ExtendFootprintTtlResult,
50258        TypeVariant::RestoreFootprintResultCode,
50259        TypeVariant::RestoreFootprintResult,
50260        TypeVariant::OperationResultCode,
50261        TypeVariant::OperationResult,
50262        TypeVariant::OperationResultTr,
50263        TypeVariant::TransactionResultCode,
50264        TypeVariant::InnerTransactionResult,
50265        TypeVariant::InnerTransactionResultResult,
50266        TypeVariant::InnerTransactionResultExt,
50267        TypeVariant::InnerTransactionResultPair,
50268        TypeVariant::TransactionResult,
50269        TypeVariant::TransactionResultResult,
50270        TypeVariant::TransactionResultExt,
50271        TypeVariant::Hash,
50272        TypeVariant::Uint256,
50273        TypeVariant::Uint32,
50274        TypeVariant::Int32,
50275        TypeVariant::Uint64,
50276        TypeVariant::Int64,
50277        TypeVariant::TimePoint,
50278        TypeVariant::Duration,
50279        TypeVariant::ExtensionPoint,
50280        TypeVariant::CryptoKeyType,
50281        TypeVariant::PublicKeyType,
50282        TypeVariant::SignerKeyType,
50283        TypeVariant::PublicKey,
50284        TypeVariant::SignerKey,
50285        TypeVariant::SignerKeyEd25519SignedPayload,
50286        TypeVariant::Signature,
50287        TypeVariant::SignatureHint,
50288        TypeVariant::NodeId,
50289        TypeVariant::AccountId,
50290        TypeVariant::Curve25519Secret,
50291        TypeVariant::Curve25519Public,
50292        TypeVariant::HmacSha256Key,
50293        TypeVariant::HmacSha256Mac,
50294        TypeVariant::ShortHashSeed,
50295        TypeVariant::BinaryFuseFilterType,
50296        TypeVariant::SerializedBinaryFuseFilter,
50297    ];
50298    pub const VARIANTS_STR: [&'static str; 459] = [
50299        "Value",
50300        "ScpBallot",
50301        "ScpStatementType",
50302        "ScpNomination",
50303        "ScpStatement",
50304        "ScpStatementPledges",
50305        "ScpStatementPrepare",
50306        "ScpStatementConfirm",
50307        "ScpStatementExternalize",
50308        "ScpEnvelope",
50309        "ScpQuorumSet",
50310        "ConfigSettingContractExecutionLanesV0",
50311        "ConfigSettingContractComputeV0",
50312        "ConfigSettingContractLedgerCostV0",
50313        "ConfigSettingContractHistoricalDataV0",
50314        "ConfigSettingContractEventsV0",
50315        "ConfigSettingContractBandwidthV0",
50316        "ContractCostType",
50317        "ContractCostParamEntry",
50318        "StateArchivalSettings",
50319        "EvictionIterator",
50320        "ContractCostParams",
50321        "ConfigSettingId",
50322        "ConfigSettingEntry",
50323        "ScEnvMetaKind",
50324        "ScEnvMetaEntry",
50325        "ScEnvMetaEntryInterfaceVersion",
50326        "ScMetaV0",
50327        "ScMetaKind",
50328        "ScMetaEntry",
50329        "ScSpecType",
50330        "ScSpecTypeOption",
50331        "ScSpecTypeResult",
50332        "ScSpecTypeVec",
50333        "ScSpecTypeMap",
50334        "ScSpecTypeTuple",
50335        "ScSpecTypeBytesN",
50336        "ScSpecTypeUdt",
50337        "ScSpecTypeDef",
50338        "ScSpecUdtStructFieldV0",
50339        "ScSpecUdtStructV0",
50340        "ScSpecUdtUnionCaseVoidV0",
50341        "ScSpecUdtUnionCaseTupleV0",
50342        "ScSpecUdtUnionCaseV0Kind",
50343        "ScSpecUdtUnionCaseV0",
50344        "ScSpecUdtUnionV0",
50345        "ScSpecUdtEnumCaseV0",
50346        "ScSpecUdtEnumV0",
50347        "ScSpecUdtErrorEnumCaseV0",
50348        "ScSpecUdtErrorEnumV0",
50349        "ScSpecFunctionInputV0",
50350        "ScSpecFunctionV0",
50351        "ScSpecEntryKind",
50352        "ScSpecEntry",
50353        "ScValType",
50354        "ScErrorType",
50355        "ScErrorCode",
50356        "ScError",
50357        "UInt128Parts",
50358        "Int128Parts",
50359        "UInt256Parts",
50360        "Int256Parts",
50361        "ContractExecutableType",
50362        "ContractExecutable",
50363        "ScAddressType",
50364        "ScAddress",
50365        "ScVec",
50366        "ScMap",
50367        "ScBytes",
50368        "ScString",
50369        "ScSymbol",
50370        "ScNonceKey",
50371        "ScContractInstance",
50372        "ScVal",
50373        "ScMapEntry",
50374        "StoredTransactionSet",
50375        "StoredDebugTransactionSet",
50376        "PersistedScpStateV0",
50377        "PersistedScpStateV1",
50378        "PersistedScpState",
50379        "Thresholds",
50380        "String32",
50381        "String64",
50382        "SequenceNumber",
50383        "DataValue",
50384        "PoolId",
50385        "AssetCode4",
50386        "AssetCode12",
50387        "AssetType",
50388        "AssetCode",
50389        "AlphaNum4",
50390        "AlphaNum12",
50391        "Asset",
50392        "Price",
50393        "Liabilities",
50394        "ThresholdIndexes",
50395        "LedgerEntryType",
50396        "Signer",
50397        "AccountFlags",
50398        "SponsorshipDescriptor",
50399        "AccountEntryExtensionV3",
50400        "AccountEntryExtensionV2",
50401        "AccountEntryExtensionV2Ext",
50402        "AccountEntryExtensionV1",
50403        "AccountEntryExtensionV1Ext",
50404        "AccountEntry",
50405        "AccountEntryExt",
50406        "TrustLineFlags",
50407        "LiquidityPoolType",
50408        "TrustLineAsset",
50409        "TrustLineEntryExtensionV2",
50410        "TrustLineEntryExtensionV2Ext",
50411        "TrustLineEntry",
50412        "TrustLineEntryExt",
50413        "TrustLineEntryV1",
50414        "TrustLineEntryV1Ext",
50415        "OfferEntryFlags",
50416        "OfferEntry",
50417        "OfferEntryExt",
50418        "DataEntry",
50419        "DataEntryExt",
50420        "ClaimPredicateType",
50421        "ClaimPredicate",
50422        "ClaimantType",
50423        "Claimant",
50424        "ClaimantV0",
50425        "ClaimableBalanceIdType",
50426        "ClaimableBalanceId",
50427        "ClaimableBalanceFlags",
50428        "ClaimableBalanceEntryExtensionV1",
50429        "ClaimableBalanceEntryExtensionV1Ext",
50430        "ClaimableBalanceEntry",
50431        "ClaimableBalanceEntryExt",
50432        "LiquidityPoolConstantProductParameters",
50433        "LiquidityPoolEntry",
50434        "LiquidityPoolEntryBody",
50435        "LiquidityPoolEntryConstantProduct",
50436        "ContractDataDurability",
50437        "ContractDataEntry",
50438        "ContractCodeCostInputs",
50439        "ContractCodeEntry",
50440        "ContractCodeEntryExt",
50441        "ContractCodeEntryV1",
50442        "TtlEntry",
50443        "LedgerEntryExtensionV1",
50444        "LedgerEntryExtensionV1Ext",
50445        "LedgerEntry",
50446        "LedgerEntryData",
50447        "LedgerEntryExt",
50448        "LedgerKey",
50449        "LedgerKeyAccount",
50450        "LedgerKeyTrustLine",
50451        "LedgerKeyOffer",
50452        "LedgerKeyData",
50453        "LedgerKeyClaimableBalance",
50454        "LedgerKeyLiquidityPool",
50455        "LedgerKeyContractData",
50456        "LedgerKeyContractCode",
50457        "LedgerKeyConfigSetting",
50458        "LedgerKeyTtl",
50459        "EnvelopeType",
50460        "BucketListType",
50461        "BucketEntryType",
50462        "HotArchiveBucketEntryType",
50463        "ColdArchiveBucketEntryType",
50464        "BucketMetadata",
50465        "BucketMetadataExt",
50466        "BucketEntry",
50467        "HotArchiveBucketEntry",
50468        "ColdArchiveArchivedLeaf",
50469        "ColdArchiveDeletedLeaf",
50470        "ColdArchiveBoundaryLeaf",
50471        "ColdArchiveHashEntry",
50472        "ColdArchiveBucketEntry",
50473        "UpgradeType",
50474        "StellarValueType",
50475        "LedgerCloseValueSignature",
50476        "StellarValue",
50477        "StellarValueExt",
50478        "LedgerHeaderFlags",
50479        "LedgerHeaderExtensionV1",
50480        "LedgerHeaderExtensionV1Ext",
50481        "LedgerHeader",
50482        "LedgerHeaderExt",
50483        "LedgerUpgradeType",
50484        "ConfigUpgradeSetKey",
50485        "LedgerUpgrade",
50486        "ConfigUpgradeSet",
50487        "TxSetComponentType",
50488        "TxSetComponent",
50489        "TxSetComponentTxsMaybeDiscountedFee",
50490        "TransactionPhase",
50491        "TransactionSet",
50492        "TransactionSetV1",
50493        "GeneralizedTransactionSet",
50494        "TransactionResultPair",
50495        "TransactionResultSet",
50496        "TransactionHistoryEntry",
50497        "TransactionHistoryEntryExt",
50498        "TransactionHistoryResultEntry",
50499        "TransactionHistoryResultEntryExt",
50500        "LedgerHeaderHistoryEntry",
50501        "LedgerHeaderHistoryEntryExt",
50502        "LedgerScpMessages",
50503        "ScpHistoryEntryV0",
50504        "ScpHistoryEntry",
50505        "LedgerEntryChangeType",
50506        "LedgerEntryChange",
50507        "LedgerEntryChanges",
50508        "OperationMeta",
50509        "TransactionMetaV1",
50510        "TransactionMetaV2",
50511        "ContractEventType",
50512        "ContractEvent",
50513        "ContractEventBody",
50514        "ContractEventV0",
50515        "DiagnosticEvent",
50516        "DiagnosticEvents",
50517        "SorobanTransactionMetaExtV1",
50518        "SorobanTransactionMetaExt",
50519        "SorobanTransactionMeta",
50520        "TransactionMetaV3",
50521        "InvokeHostFunctionSuccessPreImage",
50522        "TransactionMeta",
50523        "TransactionResultMeta",
50524        "UpgradeEntryMeta",
50525        "LedgerCloseMetaV0",
50526        "LedgerCloseMetaExtV1",
50527        "LedgerCloseMetaExt",
50528        "LedgerCloseMetaV1",
50529        "LedgerCloseMeta",
50530        "ErrorCode",
50531        "SError",
50532        "SendMore",
50533        "SendMoreExtended",
50534        "AuthCert",
50535        "Hello",
50536        "Auth",
50537        "IpAddrType",
50538        "PeerAddress",
50539        "PeerAddressIp",
50540        "MessageType",
50541        "DontHave",
50542        "SurveyMessageCommandType",
50543        "SurveyMessageResponseType",
50544        "TimeSlicedSurveyStartCollectingMessage",
50545        "SignedTimeSlicedSurveyStartCollectingMessage",
50546        "TimeSlicedSurveyStopCollectingMessage",
50547        "SignedTimeSlicedSurveyStopCollectingMessage",
50548        "SurveyRequestMessage",
50549        "TimeSlicedSurveyRequestMessage",
50550        "SignedSurveyRequestMessage",
50551        "SignedTimeSlicedSurveyRequestMessage",
50552        "EncryptedBody",
50553        "SurveyResponseMessage",
50554        "TimeSlicedSurveyResponseMessage",
50555        "SignedSurveyResponseMessage",
50556        "SignedTimeSlicedSurveyResponseMessage",
50557        "PeerStats",
50558        "PeerStatList",
50559        "TimeSlicedNodeData",
50560        "TimeSlicedPeerData",
50561        "TimeSlicedPeerDataList",
50562        "TopologyResponseBodyV0",
50563        "TopologyResponseBodyV1",
50564        "TopologyResponseBodyV2",
50565        "SurveyResponseBody",
50566        "TxAdvertVector",
50567        "FloodAdvert",
50568        "TxDemandVector",
50569        "FloodDemand",
50570        "StellarMessage",
50571        "AuthenticatedMessage",
50572        "AuthenticatedMessageV0",
50573        "LiquidityPoolParameters",
50574        "MuxedAccount",
50575        "MuxedAccountMed25519",
50576        "DecoratedSignature",
50577        "OperationType",
50578        "CreateAccountOp",
50579        "PaymentOp",
50580        "PathPaymentStrictReceiveOp",
50581        "PathPaymentStrictSendOp",
50582        "ManageSellOfferOp",
50583        "ManageBuyOfferOp",
50584        "CreatePassiveSellOfferOp",
50585        "SetOptionsOp",
50586        "ChangeTrustAsset",
50587        "ChangeTrustOp",
50588        "AllowTrustOp",
50589        "ManageDataOp",
50590        "BumpSequenceOp",
50591        "CreateClaimableBalanceOp",
50592        "ClaimClaimableBalanceOp",
50593        "BeginSponsoringFutureReservesOp",
50594        "RevokeSponsorshipType",
50595        "RevokeSponsorshipOp",
50596        "RevokeSponsorshipOpSigner",
50597        "ClawbackOp",
50598        "ClawbackClaimableBalanceOp",
50599        "SetTrustLineFlagsOp",
50600        "LiquidityPoolDepositOp",
50601        "LiquidityPoolWithdrawOp",
50602        "HostFunctionType",
50603        "ContractIdPreimageType",
50604        "ContractIdPreimage",
50605        "ContractIdPreimageFromAddress",
50606        "CreateContractArgs",
50607        "CreateContractArgsV2",
50608        "InvokeContractArgs",
50609        "HostFunction",
50610        "SorobanAuthorizedFunctionType",
50611        "SorobanAuthorizedFunction",
50612        "SorobanAuthorizedInvocation",
50613        "SorobanAddressCredentials",
50614        "SorobanCredentialsType",
50615        "SorobanCredentials",
50616        "SorobanAuthorizationEntry",
50617        "InvokeHostFunctionOp",
50618        "ExtendFootprintTtlOp",
50619        "RestoreFootprintOp",
50620        "Operation",
50621        "OperationBody",
50622        "HashIdPreimage",
50623        "HashIdPreimageOperationId",
50624        "HashIdPreimageRevokeId",
50625        "HashIdPreimageContractId",
50626        "HashIdPreimageSorobanAuthorization",
50627        "MemoType",
50628        "Memo",
50629        "TimeBounds",
50630        "LedgerBounds",
50631        "PreconditionsV2",
50632        "PreconditionType",
50633        "Preconditions",
50634        "LedgerFootprint",
50635        "ArchivalProofType",
50636        "ArchivalProofNode",
50637        "ProofLevel",
50638        "NonexistenceProofBody",
50639        "ExistenceProofBody",
50640        "ArchivalProof",
50641        "ArchivalProofBody",
50642        "SorobanResources",
50643        "SorobanTransactionData",
50644        "TransactionV0",
50645        "TransactionV0Ext",
50646        "TransactionV0Envelope",
50647        "Transaction",
50648        "TransactionExt",
50649        "TransactionV1Envelope",
50650        "FeeBumpTransaction",
50651        "FeeBumpTransactionInnerTx",
50652        "FeeBumpTransactionExt",
50653        "FeeBumpTransactionEnvelope",
50654        "TransactionEnvelope",
50655        "TransactionSignaturePayload",
50656        "TransactionSignaturePayloadTaggedTransaction",
50657        "ClaimAtomType",
50658        "ClaimOfferAtomV0",
50659        "ClaimOfferAtom",
50660        "ClaimLiquidityAtom",
50661        "ClaimAtom",
50662        "CreateAccountResultCode",
50663        "CreateAccountResult",
50664        "PaymentResultCode",
50665        "PaymentResult",
50666        "PathPaymentStrictReceiveResultCode",
50667        "SimplePaymentResult",
50668        "PathPaymentStrictReceiveResult",
50669        "PathPaymentStrictReceiveResultSuccess",
50670        "PathPaymentStrictSendResultCode",
50671        "PathPaymentStrictSendResult",
50672        "PathPaymentStrictSendResultSuccess",
50673        "ManageSellOfferResultCode",
50674        "ManageOfferEffect",
50675        "ManageOfferSuccessResult",
50676        "ManageOfferSuccessResultOffer",
50677        "ManageSellOfferResult",
50678        "ManageBuyOfferResultCode",
50679        "ManageBuyOfferResult",
50680        "SetOptionsResultCode",
50681        "SetOptionsResult",
50682        "ChangeTrustResultCode",
50683        "ChangeTrustResult",
50684        "AllowTrustResultCode",
50685        "AllowTrustResult",
50686        "AccountMergeResultCode",
50687        "AccountMergeResult",
50688        "InflationResultCode",
50689        "InflationPayout",
50690        "InflationResult",
50691        "ManageDataResultCode",
50692        "ManageDataResult",
50693        "BumpSequenceResultCode",
50694        "BumpSequenceResult",
50695        "CreateClaimableBalanceResultCode",
50696        "CreateClaimableBalanceResult",
50697        "ClaimClaimableBalanceResultCode",
50698        "ClaimClaimableBalanceResult",
50699        "BeginSponsoringFutureReservesResultCode",
50700        "BeginSponsoringFutureReservesResult",
50701        "EndSponsoringFutureReservesResultCode",
50702        "EndSponsoringFutureReservesResult",
50703        "RevokeSponsorshipResultCode",
50704        "RevokeSponsorshipResult",
50705        "ClawbackResultCode",
50706        "ClawbackResult",
50707        "ClawbackClaimableBalanceResultCode",
50708        "ClawbackClaimableBalanceResult",
50709        "SetTrustLineFlagsResultCode",
50710        "SetTrustLineFlagsResult",
50711        "LiquidityPoolDepositResultCode",
50712        "LiquidityPoolDepositResult",
50713        "LiquidityPoolWithdrawResultCode",
50714        "LiquidityPoolWithdrawResult",
50715        "InvokeHostFunctionResultCode",
50716        "InvokeHostFunctionResult",
50717        "ExtendFootprintTtlResultCode",
50718        "ExtendFootprintTtlResult",
50719        "RestoreFootprintResultCode",
50720        "RestoreFootprintResult",
50721        "OperationResultCode",
50722        "OperationResult",
50723        "OperationResultTr",
50724        "TransactionResultCode",
50725        "InnerTransactionResult",
50726        "InnerTransactionResultResult",
50727        "InnerTransactionResultExt",
50728        "InnerTransactionResultPair",
50729        "TransactionResult",
50730        "TransactionResultResult",
50731        "TransactionResultExt",
50732        "Hash",
50733        "Uint256",
50734        "Uint32",
50735        "Int32",
50736        "Uint64",
50737        "Int64",
50738        "TimePoint",
50739        "Duration",
50740        "ExtensionPoint",
50741        "CryptoKeyType",
50742        "PublicKeyType",
50743        "SignerKeyType",
50744        "PublicKey",
50745        "SignerKey",
50746        "SignerKeyEd25519SignedPayload",
50747        "Signature",
50748        "SignatureHint",
50749        "NodeId",
50750        "AccountId",
50751        "Curve25519Secret",
50752        "Curve25519Public",
50753        "HmacSha256Key",
50754        "HmacSha256Mac",
50755        "ShortHashSeed",
50756        "BinaryFuseFilterType",
50757        "SerializedBinaryFuseFilter",
50758    ];
50759
50760    #[cfg(feature = "std")]
50761    #[allow(clippy::too_many_lines)]
50762    pub fn read_xdr<R: Read>(v: TypeVariant, r: &mut Limited<R>) -> Result<Self> {
50763        match v {
50764            TypeVariant::Value => {
50765                r.with_limited_depth(|r| Ok(Self::Value(Box::new(Value::read_xdr(r)?))))
50766            }
50767            TypeVariant::ScpBallot => {
50768                r.with_limited_depth(|r| Ok(Self::ScpBallot(Box::new(ScpBallot::read_xdr(r)?))))
50769            }
50770            TypeVariant::ScpStatementType => r.with_limited_depth(|r| {
50771                Ok(Self::ScpStatementType(Box::new(
50772                    ScpStatementType::read_xdr(r)?,
50773                )))
50774            }),
50775            TypeVariant::ScpNomination => r.with_limited_depth(|r| {
50776                Ok(Self::ScpNomination(Box::new(ScpNomination::read_xdr(r)?)))
50777            }),
50778            TypeVariant::ScpStatement => r.with_limited_depth(|r| {
50779                Ok(Self::ScpStatement(Box::new(ScpStatement::read_xdr(r)?)))
50780            }),
50781            TypeVariant::ScpStatementPledges => r.with_limited_depth(|r| {
50782                Ok(Self::ScpStatementPledges(Box::new(
50783                    ScpStatementPledges::read_xdr(r)?,
50784                )))
50785            }),
50786            TypeVariant::ScpStatementPrepare => r.with_limited_depth(|r| {
50787                Ok(Self::ScpStatementPrepare(Box::new(
50788                    ScpStatementPrepare::read_xdr(r)?,
50789                )))
50790            }),
50791            TypeVariant::ScpStatementConfirm => r.with_limited_depth(|r| {
50792                Ok(Self::ScpStatementConfirm(Box::new(
50793                    ScpStatementConfirm::read_xdr(r)?,
50794                )))
50795            }),
50796            TypeVariant::ScpStatementExternalize => r.with_limited_depth(|r| {
50797                Ok(Self::ScpStatementExternalize(Box::new(
50798                    ScpStatementExternalize::read_xdr(r)?,
50799                )))
50800            }),
50801            TypeVariant::ScpEnvelope => {
50802                r.with_limited_depth(|r| Ok(Self::ScpEnvelope(Box::new(ScpEnvelope::read_xdr(r)?))))
50803            }
50804            TypeVariant::ScpQuorumSet => r.with_limited_depth(|r| {
50805                Ok(Self::ScpQuorumSet(Box::new(ScpQuorumSet::read_xdr(r)?)))
50806            }),
50807            TypeVariant::ConfigSettingContractExecutionLanesV0 => r.with_limited_depth(|r| {
50808                Ok(Self::ConfigSettingContractExecutionLanesV0(Box::new(
50809                    ConfigSettingContractExecutionLanesV0::read_xdr(r)?,
50810                )))
50811            }),
50812            TypeVariant::ConfigSettingContractComputeV0 => r.with_limited_depth(|r| {
50813                Ok(Self::ConfigSettingContractComputeV0(Box::new(
50814                    ConfigSettingContractComputeV0::read_xdr(r)?,
50815                )))
50816            }),
50817            TypeVariant::ConfigSettingContractLedgerCostV0 => r.with_limited_depth(|r| {
50818                Ok(Self::ConfigSettingContractLedgerCostV0(Box::new(
50819                    ConfigSettingContractLedgerCostV0::read_xdr(r)?,
50820                )))
50821            }),
50822            TypeVariant::ConfigSettingContractHistoricalDataV0 => r.with_limited_depth(|r| {
50823                Ok(Self::ConfigSettingContractHistoricalDataV0(Box::new(
50824                    ConfigSettingContractHistoricalDataV0::read_xdr(r)?,
50825                )))
50826            }),
50827            TypeVariant::ConfigSettingContractEventsV0 => r.with_limited_depth(|r| {
50828                Ok(Self::ConfigSettingContractEventsV0(Box::new(
50829                    ConfigSettingContractEventsV0::read_xdr(r)?,
50830                )))
50831            }),
50832            TypeVariant::ConfigSettingContractBandwidthV0 => r.with_limited_depth(|r| {
50833                Ok(Self::ConfigSettingContractBandwidthV0(Box::new(
50834                    ConfigSettingContractBandwidthV0::read_xdr(r)?,
50835                )))
50836            }),
50837            TypeVariant::ContractCostType => r.with_limited_depth(|r| {
50838                Ok(Self::ContractCostType(Box::new(
50839                    ContractCostType::read_xdr(r)?,
50840                )))
50841            }),
50842            TypeVariant::ContractCostParamEntry => r.with_limited_depth(|r| {
50843                Ok(Self::ContractCostParamEntry(Box::new(
50844                    ContractCostParamEntry::read_xdr(r)?,
50845                )))
50846            }),
50847            TypeVariant::StateArchivalSettings => r.with_limited_depth(|r| {
50848                Ok(Self::StateArchivalSettings(Box::new(
50849                    StateArchivalSettings::read_xdr(r)?,
50850                )))
50851            }),
50852            TypeVariant::EvictionIterator => r.with_limited_depth(|r| {
50853                Ok(Self::EvictionIterator(Box::new(
50854                    EvictionIterator::read_xdr(r)?,
50855                )))
50856            }),
50857            TypeVariant::ContractCostParams => r.with_limited_depth(|r| {
50858                Ok(Self::ContractCostParams(Box::new(
50859                    ContractCostParams::read_xdr(r)?,
50860                )))
50861            }),
50862            TypeVariant::ConfigSettingId => r.with_limited_depth(|r| {
50863                Ok(Self::ConfigSettingId(Box::new(ConfigSettingId::read_xdr(
50864                    r,
50865                )?)))
50866            }),
50867            TypeVariant::ConfigSettingEntry => r.with_limited_depth(|r| {
50868                Ok(Self::ConfigSettingEntry(Box::new(
50869                    ConfigSettingEntry::read_xdr(r)?,
50870                )))
50871            }),
50872            TypeVariant::ScEnvMetaKind => r.with_limited_depth(|r| {
50873                Ok(Self::ScEnvMetaKind(Box::new(ScEnvMetaKind::read_xdr(r)?)))
50874            }),
50875            TypeVariant::ScEnvMetaEntry => r.with_limited_depth(|r| {
50876                Ok(Self::ScEnvMetaEntry(Box::new(ScEnvMetaEntry::read_xdr(r)?)))
50877            }),
50878            TypeVariant::ScEnvMetaEntryInterfaceVersion => r.with_limited_depth(|r| {
50879                Ok(Self::ScEnvMetaEntryInterfaceVersion(Box::new(
50880                    ScEnvMetaEntryInterfaceVersion::read_xdr(r)?,
50881                )))
50882            }),
50883            TypeVariant::ScMetaV0 => {
50884                r.with_limited_depth(|r| Ok(Self::ScMetaV0(Box::new(ScMetaV0::read_xdr(r)?))))
50885            }
50886            TypeVariant::ScMetaKind => {
50887                r.with_limited_depth(|r| Ok(Self::ScMetaKind(Box::new(ScMetaKind::read_xdr(r)?))))
50888            }
50889            TypeVariant::ScMetaEntry => {
50890                r.with_limited_depth(|r| Ok(Self::ScMetaEntry(Box::new(ScMetaEntry::read_xdr(r)?))))
50891            }
50892            TypeVariant::ScSpecType => {
50893                r.with_limited_depth(|r| Ok(Self::ScSpecType(Box::new(ScSpecType::read_xdr(r)?))))
50894            }
50895            TypeVariant::ScSpecTypeOption => r.with_limited_depth(|r| {
50896                Ok(Self::ScSpecTypeOption(Box::new(
50897                    ScSpecTypeOption::read_xdr(r)?,
50898                )))
50899            }),
50900            TypeVariant::ScSpecTypeResult => r.with_limited_depth(|r| {
50901                Ok(Self::ScSpecTypeResult(Box::new(
50902                    ScSpecTypeResult::read_xdr(r)?,
50903                )))
50904            }),
50905            TypeVariant::ScSpecTypeVec => r.with_limited_depth(|r| {
50906                Ok(Self::ScSpecTypeVec(Box::new(ScSpecTypeVec::read_xdr(r)?)))
50907            }),
50908            TypeVariant::ScSpecTypeMap => r.with_limited_depth(|r| {
50909                Ok(Self::ScSpecTypeMap(Box::new(ScSpecTypeMap::read_xdr(r)?)))
50910            }),
50911            TypeVariant::ScSpecTypeTuple => r.with_limited_depth(|r| {
50912                Ok(Self::ScSpecTypeTuple(Box::new(ScSpecTypeTuple::read_xdr(
50913                    r,
50914                )?)))
50915            }),
50916            TypeVariant::ScSpecTypeBytesN => r.with_limited_depth(|r| {
50917                Ok(Self::ScSpecTypeBytesN(Box::new(
50918                    ScSpecTypeBytesN::read_xdr(r)?,
50919                )))
50920            }),
50921            TypeVariant::ScSpecTypeUdt => r.with_limited_depth(|r| {
50922                Ok(Self::ScSpecTypeUdt(Box::new(ScSpecTypeUdt::read_xdr(r)?)))
50923            }),
50924            TypeVariant::ScSpecTypeDef => r.with_limited_depth(|r| {
50925                Ok(Self::ScSpecTypeDef(Box::new(ScSpecTypeDef::read_xdr(r)?)))
50926            }),
50927            TypeVariant::ScSpecUdtStructFieldV0 => r.with_limited_depth(|r| {
50928                Ok(Self::ScSpecUdtStructFieldV0(Box::new(
50929                    ScSpecUdtStructFieldV0::read_xdr(r)?,
50930                )))
50931            }),
50932            TypeVariant::ScSpecUdtStructV0 => r.with_limited_depth(|r| {
50933                Ok(Self::ScSpecUdtStructV0(Box::new(
50934                    ScSpecUdtStructV0::read_xdr(r)?,
50935                )))
50936            }),
50937            TypeVariant::ScSpecUdtUnionCaseVoidV0 => r.with_limited_depth(|r| {
50938                Ok(Self::ScSpecUdtUnionCaseVoidV0(Box::new(
50939                    ScSpecUdtUnionCaseVoidV0::read_xdr(r)?,
50940                )))
50941            }),
50942            TypeVariant::ScSpecUdtUnionCaseTupleV0 => r.with_limited_depth(|r| {
50943                Ok(Self::ScSpecUdtUnionCaseTupleV0(Box::new(
50944                    ScSpecUdtUnionCaseTupleV0::read_xdr(r)?,
50945                )))
50946            }),
50947            TypeVariant::ScSpecUdtUnionCaseV0Kind => r.with_limited_depth(|r| {
50948                Ok(Self::ScSpecUdtUnionCaseV0Kind(Box::new(
50949                    ScSpecUdtUnionCaseV0Kind::read_xdr(r)?,
50950                )))
50951            }),
50952            TypeVariant::ScSpecUdtUnionCaseV0 => r.with_limited_depth(|r| {
50953                Ok(Self::ScSpecUdtUnionCaseV0(Box::new(
50954                    ScSpecUdtUnionCaseV0::read_xdr(r)?,
50955                )))
50956            }),
50957            TypeVariant::ScSpecUdtUnionV0 => r.with_limited_depth(|r| {
50958                Ok(Self::ScSpecUdtUnionV0(Box::new(
50959                    ScSpecUdtUnionV0::read_xdr(r)?,
50960                )))
50961            }),
50962            TypeVariant::ScSpecUdtEnumCaseV0 => r.with_limited_depth(|r| {
50963                Ok(Self::ScSpecUdtEnumCaseV0(Box::new(
50964                    ScSpecUdtEnumCaseV0::read_xdr(r)?,
50965                )))
50966            }),
50967            TypeVariant::ScSpecUdtEnumV0 => r.with_limited_depth(|r| {
50968                Ok(Self::ScSpecUdtEnumV0(Box::new(ScSpecUdtEnumV0::read_xdr(
50969                    r,
50970                )?)))
50971            }),
50972            TypeVariant::ScSpecUdtErrorEnumCaseV0 => r.with_limited_depth(|r| {
50973                Ok(Self::ScSpecUdtErrorEnumCaseV0(Box::new(
50974                    ScSpecUdtErrorEnumCaseV0::read_xdr(r)?,
50975                )))
50976            }),
50977            TypeVariant::ScSpecUdtErrorEnumV0 => r.with_limited_depth(|r| {
50978                Ok(Self::ScSpecUdtErrorEnumV0(Box::new(
50979                    ScSpecUdtErrorEnumV0::read_xdr(r)?,
50980                )))
50981            }),
50982            TypeVariant::ScSpecFunctionInputV0 => r.with_limited_depth(|r| {
50983                Ok(Self::ScSpecFunctionInputV0(Box::new(
50984                    ScSpecFunctionInputV0::read_xdr(r)?,
50985                )))
50986            }),
50987            TypeVariant::ScSpecFunctionV0 => r.with_limited_depth(|r| {
50988                Ok(Self::ScSpecFunctionV0(Box::new(
50989                    ScSpecFunctionV0::read_xdr(r)?,
50990                )))
50991            }),
50992            TypeVariant::ScSpecEntryKind => r.with_limited_depth(|r| {
50993                Ok(Self::ScSpecEntryKind(Box::new(ScSpecEntryKind::read_xdr(
50994                    r,
50995                )?)))
50996            }),
50997            TypeVariant::ScSpecEntry => {
50998                r.with_limited_depth(|r| Ok(Self::ScSpecEntry(Box::new(ScSpecEntry::read_xdr(r)?))))
50999            }
51000            TypeVariant::ScValType => {
51001                r.with_limited_depth(|r| Ok(Self::ScValType(Box::new(ScValType::read_xdr(r)?))))
51002            }
51003            TypeVariant::ScErrorType => {
51004                r.with_limited_depth(|r| Ok(Self::ScErrorType(Box::new(ScErrorType::read_xdr(r)?))))
51005            }
51006            TypeVariant::ScErrorCode => {
51007                r.with_limited_depth(|r| Ok(Self::ScErrorCode(Box::new(ScErrorCode::read_xdr(r)?))))
51008            }
51009            TypeVariant::ScError => {
51010                r.with_limited_depth(|r| Ok(Self::ScError(Box::new(ScError::read_xdr(r)?))))
51011            }
51012            TypeVariant::UInt128Parts => r.with_limited_depth(|r| {
51013                Ok(Self::UInt128Parts(Box::new(UInt128Parts::read_xdr(r)?)))
51014            }),
51015            TypeVariant::Int128Parts => {
51016                r.with_limited_depth(|r| Ok(Self::Int128Parts(Box::new(Int128Parts::read_xdr(r)?))))
51017            }
51018            TypeVariant::UInt256Parts => r.with_limited_depth(|r| {
51019                Ok(Self::UInt256Parts(Box::new(UInt256Parts::read_xdr(r)?)))
51020            }),
51021            TypeVariant::Int256Parts => {
51022                r.with_limited_depth(|r| Ok(Self::Int256Parts(Box::new(Int256Parts::read_xdr(r)?))))
51023            }
51024            TypeVariant::ContractExecutableType => r.with_limited_depth(|r| {
51025                Ok(Self::ContractExecutableType(Box::new(
51026                    ContractExecutableType::read_xdr(r)?,
51027                )))
51028            }),
51029            TypeVariant::ContractExecutable => r.with_limited_depth(|r| {
51030                Ok(Self::ContractExecutable(Box::new(
51031                    ContractExecutable::read_xdr(r)?,
51032                )))
51033            }),
51034            TypeVariant::ScAddressType => r.with_limited_depth(|r| {
51035                Ok(Self::ScAddressType(Box::new(ScAddressType::read_xdr(r)?)))
51036            }),
51037            TypeVariant::ScAddress => {
51038                r.with_limited_depth(|r| Ok(Self::ScAddress(Box::new(ScAddress::read_xdr(r)?))))
51039            }
51040            TypeVariant::ScVec => {
51041                r.with_limited_depth(|r| Ok(Self::ScVec(Box::new(ScVec::read_xdr(r)?))))
51042            }
51043            TypeVariant::ScMap => {
51044                r.with_limited_depth(|r| Ok(Self::ScMap(Box::new(ScMap::read_xdr(r)?))))
51045            }
51046            TypeVariant::ScBytes => {
51047                r.with_limited_depth(|r| Ok(Self::ScBytes(Box::new(ScBytes::read_xdr(r)?))))
51048            }
51049            TypeVariant::ScString => {
51050                r.with_limited_depth(|r| Ok(Self::ScString(Box::new(ScString::read_xdr(r)?))))
51051            }
51052            TypeVariant::ScSymbol => {
51053                r.with_limited_depth(|r| Ok(Self::ScSymbol(Box::new(ScSymbol::read_xdr(r)?))))
51054            }
51055            TypeVariant::ScNonceKey => {
51056                r.with_limited_depth(|r| Ok(Self::ScNonceKey(Box::new(ScNonceKey::read_xdr(r)?))))
51057            }
51058            TypeVariant::ScContractInstance => r.with_limited_depth(|r| {
51059                Ok(Self::ScContractInstance(Box::new(
51060                    ScContractInstance::read_xdr(r)?,
51061                )))
51062            }),
51063            TypeVariant::ScVal => {
51064                r.with_limited_depth(|r| Ok(Self::ScVal(Box::new(ScVal::read_xdr(r)?))))
51065            }
51066            TypeVariant::ScMapEntry => {
51067                r.with_limited_depth(|r| Ok(Self::ScMapEntry(Box::new(ScMapEntry::read_xdr(r)?))))
51068            }
51069            TypeVariant::StoredTransactionSet => r.with_limited_depth(|r| {
51070                Ok(Self::StoredTransactionSet(Box::new(
51071                    StoredTransactionSet::read_xdr(r)?,
51072                )))
51073            }),
51074            TypeVariant::StoredDebugTransactionSet => r.with_limited_depth(|r| {
51075                Ok(Self::StoredDebugTransactionSet(Box::new(
51076                    StoredDebugTransactionSet::read_xdr(r)?,
51077                )))
51078            }),
51079            TypeVariant::PersistedScpStateV0 => r.with_limited_depth(|r| {
51080                Ok(Self::PersistedScpStateV0(Box::new(
51081                    PersistedScpStateV0::read_xdr(r)?,
51082                )))
51083            }),
51084            TypeVariant::PersistedScpStateV1 => r.with_limited_depth(|r| {
51085                Ok(Self::PersistedScpStateV1(Box::new(
51086                    PersistedScpStateV1::read_xdr(r)?,
51087                )))
51088            }),
51089            TypeVariant::PersistedScpState => r.with_limited_depth(|r| {
51090                Ok(Self::PersistedScpState(Box::new(
51091                    PersistedScpState::read_xdr(r)?,
51092                )))
51093            }),
51094            TypeVariant::Thresholds => {
51095                r.with_limited_depth(|r| Ok(Self::Thresholds(Box::new(Thresholds::read_xdr(r)?))))
51096            }
51097            TypeVariant::String32 => {
51098                r.with_limited_depth(|r| Ok(Self::String32(Box::new(String32::read_xdr(r)?))))
51099            }
51100            TypeVariant::String64 => {
51101                r.with_limited_depth(|r| Ok(Self::String64(Box::new(String64::read_xdr(r)?))))
51102            }
51103            TypeVariant::SequenceNumber => r.with_limited_depth(|r| {
51104                Ok(Self::SequenceNumber(Box::new(SequenceNumber::read_xdr(r)?)))
51105            }),
51106            TypeVariant::DataValue => {
51107                r.with_limited_depth(|r| Ok(Self::DataValue(Box::new(DataValue::read_xdr(r)?))))
51108            }
51109            TypeVariant::PoolId => {
51110                r.with_limited_depth(|r| Ok(Self::PoolId(Box::new(PoolId::read_xdr(r)?))))
51111            }
51112            TypeVariant::AssetCode4 => {
51113                r.with_limited_depth(|r| Ok(Self::AssetCode4(Box::new(AssetCode4::read_xdr(r)?))))
51114            }
51115            TypeVariant::AssetCode12 => {
51116                r.with_limited_depth(|r| Ok(Self::AssetCode12(Box::new(AssetCode12::read_xdr(r)?))))
51117            }
51118            TypeVariant::AssetType => {
51119                r.with_limited_depth(|r| Ok(Self::AssetType(Box::new(AssetType::read_xdr(r)?))))
51120            }
51121            TypeVariant::AssetCode => {
51122                r.with_limited_depth(|r| Ok(Self::AssetCode(Box::new(AssetCode::read_xdr(r)?))))
51123            }
51124            TypeVariant::AlphaNum4 => {
51125                r.with_limited_depth(|r| Ok(Self::AlphaNum4(Box::new(AlphaNum4::read_xdr(r)?))))
51126            }
51127            TypeVariant::AlphaNum12 => {
51128                r.with_limited_depth(|r| Ok(Self::AlphaNum12(Box::new(AlphaNum12::read_xdr(r)?))))
51129            }
51130            TypeVariant::Asset => {
51131                r.with_limited_depth(|r| Ok(Self::Asset(Box::new(Asset::read_xdr(r)?))))
51132            }
51133            TypeVariant::Price => {
51134                r.with_limited_depth(|r| Ok(Self::Price(Box::new(Price::read_xdr(r)?))))
51135            }
51136            TypeVariant::Liabilities => {
51137                r.with_limited_depth(|r| Ok(Self::Liabilities(Box::new(Liabilities::read_xdr(r)?))))
51138            }
51139            TypeVariant::ThresholdIndexes => r.with_limited_depth(|r| {
51140                Ok(Self::ThresholdIndexes(Box::new(
51141                    ThresholdIndexes::read_xdr(r)?,
51142                )))
51143            }),
51144            TypeVariant::LedgerEntryType => r.with_limited_depth(|r| {
51145                Ok(Self::LedgerEntryType(Box::new(LedgerEntryType::read_xdr(
51146                    r,
51147                )?)))
51148            }),
51149            TypeVariant::Signer => {
51150                r.with_limited_depth(|r| Ok(Self::Signer(Box::new(Signer::read_xdr(r)?))))
51151            }
51152            TypeVariant::AccountFlags => r.with_limited_depth(|r| {
51153                Ok(Self::AccountFlags(Box::new(AccountFlags::read_xdr(r)?)))
51154            }),
51155            TypeVariant::SponsorshipDescriptor => r.with_limited_depth(|r| {
51156                Ok(Self::SponsorshipDescriptor(Box::new(
51157                    SponsorshipDescriptor::read_xdr(r)?,
51158                )))
51159            }),
51160            TypeVariant::AccountEntryExtensionV3 => r.with_limited_depth(|r| {
51161                Ok(Self::AccountEntryExtensionV3(Box::new(
51162                    AccountEntryExtensionV3::read_xdr(r)?,
51163                )))
51164            }),
51165            TypeVariant::AccountEntryExtensionV2 => r.with_limited_depth(|r| {
51166                Ok(Self::AccountEntryExtensionV2(Box::new(
51167                    AccountEntryExtensionV2::read_xdr(r)?,
51168                )))
51169            }),
51170            TypeVariant::AccountEntryExtensionV2Ext => r.with_limited_depth(|r| {
51171                Ok(Self::AccountEntryExtensionV2Ext(Box::new(
51172                    AccountEntryExtensionV2Ext::read_xdr(r)?,
51173                )))
51174            }),
51175            TypeVariant::AccountEntryExtensionV1 => r.with_limited_depth(|r| {
51176                Ok(Self::AccountEntryExtensionV1(Box::new(
51177                    AccountEntryExtensionV1::read_xdr(r)?,
51178                )))
51179            }),
51180            TypeVariant::AccountEntryExtensionV1Ext => r.with_limited_depth(|r| {
51181                Ok(Self::AccountEntryExtensionV1Ext(Box::new(
51182                    AccountEntryExtensionV1Ext::read_xdr(r)?,
51183                )))
51184            }),
51185            TypeVariant::AccountEntry => r.with_limited_depth(|r| {
51186                Ok(Self::AccountEntry(Box::new(AccountEntry::read_xdr(r)?)))
51187            }),
51188            TypeVariant::AccountEntryExt => r.with_limited_depth(|r| {
51189                Ok(Self::AccountEntryExt(Box::new(AccountEntryExt::read_xdr(
51190                    r,
51191                )?)))
51192            }),
51193            TypeVariant::TrustLineFlags => r.with_limited_depth(|r| {
51194                Ok(Self::TrustLineFlags(Box::new(TrustLineFlags::read_xdr(r)?)))
51195            }),
51196            TypeVariant::LiquidityPoolType => r.with_limited_depth(|r| {
51197                Ok(Self::LiquidityPoolType(Box::new(
51198                    LiquidityPoolType::read_xdr(r)?,
51199                )))
51200            }),
51201            TypeVariant::TrustLineAsset => r.with_limited_depth(|r| {
51202                Ok(Self::TrustLineAsset(Box::new(TrustLineAsset::read_xdr(r)?)))
51203            }),
51204            TypeVariant::TrustLineEntryExtensionV2 => r.with_limited_depth(|r| {
51205                Ok(Self::TrustLineEntryExtensionV2(Box::new(
51206                    TrustLineEntryExtensionV2::read_xdr(r)?,
51207                )))
51208            }),
51209            TypeVariant::TrustLineEntryExtensionV2Ext => r.with_limited_depth(|r| {
51210                Ok(Self::TrustLineEntryExtensionV2Ext(Box::new(
51211                    TrustLineEntryExtensionV2Ext::read_xdr(r)?,
51212                )))
51213            }),
51214            TypeVariant::TrustLineEntry => r.with_limited_depth(|r| {
51215                Ok(Self::TrustLineEntry(Box::new(TrustLineEntry::read_xdr(r)?)))
51216            }),
51217            TypeVariant::TrustLineEntryExt => r.with_limited_depth(|r| {
51218                Ok(Self::TrustLineEntryExt(Box::new(
51219                    TrustLineEntryExt::read_xdr(r)?,
51220                )))
51221            }),
51222            TypeVariant::TrustLineEntryV1 => r.with_limited_depth(|r| {
51223                Ok(Self::TrustLineEntryV1(Box::new(
51224                    TrustLineEntryV1::read_xdr(r)?,
51225                )))
51226            }),
51227            TypeVariant::TrustLineEntryV1Ext => r.with_limited_depth(|r| {
51228                Ok(Self::TrustLineEntryV1Ext(Box::new(
51229                    TrustLineEntryV1Ext::read_xdr(r)?,
51230                )))
51231            }),
51232            TypeVariant::OfferEntryFlags => r.with_limited_depth(|r| {
51233                Ok(Self::OfferEntryFlags(Box::new(OfferEntryFlags::read_xdr(
51234                    r,
51235                )?)))
51236            }),
51237            TypeVariant::OfferEntry => {
51238                r.with_limited_depth(|r| Ok(Self::OfferEntry(Box::new(OfferEntry::read_xdr(r)?))))
51239            }
51240            TypeVariant::OfferEntryExt => r.with_limited_depth(|r| {
51241                Ok(Self::OfferEntryExt(Box::new(OfferEntryExt::read_xdr(r)?)))
51242            }),
51243            TypeVariant::DataEntry => {
51244                r.with_limited_depth(|r| Ok(Self::DataEntry(Box::new(DataEntry::read_xdr(r)?))))
51245            }
51246            TypeVariant::DataEntryExt => r.with_limited_depth(|r| {
51247                Ok(Self::DataEntryExt(Box::new(DataEntryExt::read_xdr(r)?)))
51248            }),
51249            TypeVariant::ClaimPredicateType => r.with_limited_depth(|r| {
51250                Ok(Self::ClaimPredicateType(Box::new(
51251                    ClaimPredicateType::read_xdr(r)?,
51252                )))
51253            }),
51254            TypeVariant::ClaimPredicate => r.with_limited_depth(|r| {
51255                Ok(Self::ClaimPredicate(Box::new(ClaimPredicate::read_xdr(r)?)))
51256            }),
51257            TypeVariant::ClaimantType => r.with_limited_depth(|r| {
51258                Ok(Self::ClaimantType(Box::new(ClaimantType::read_xdr(r)?)))
51259            }),
51260            TypeVariant::Claimant => {
51261                r.with_limited_depth(|r| Ok(Self::Claimant(Box::new(Claimant::read_xdr(r)?))))
51262            }
51263            TypeVariant::ClaimantV0 => {
51264                r.with_limited_depth(|r| Ok(Self::ClaimantV0(Box::new(ClaimantV0::read_xdr(r)?))))
51265            }
51266            TypeVariant::ClaimableBalanceIdType => r.with_limited_depth(|r| {
51267                Ok(Self::ClaimableBalanceIdType(Box::new(
51268                    ClaimableBalanceIdType::read_xdr(r)?,
51269                )))
51270            }),
51271            TypeVariant::ClaimableBalanceId => r.with_limited_depth(|r| {
51272                Ok(Self::ClaimableBalanceId(Box::new(
51273                    ClaimableBalanceId::read_xdr(r)?,
51274                )))
51275            }),
51276            TypeVariant::ClaimableBalanceFlags => r.with_limited_depth(|r| {
51277                Ok(Self::ClaimableBalanceFlags(Box::new(
51278                    ClaimableBalanceFlags::read_xdr(r)?,
51279                )))
51280            }),
51281            TypeVariant::ClaimableBalanceEntryExtensionV1 => r.with_limited_depth(|r| {
51282                Ok(Self::ClaimableBalanceEntryExtensionV1(Box::new(
51283                    ClaimableBalanceEntryExtensionV1::read_xdr(r)?,
51284                )))
51285            }),
51286            TypeVariant::ClaimableBalanceEntryExtensionV1Ext => r.with_limited_depth(|r| {
51287                Ok(Self::ClaimableBalanceEntryExtensionV1Ext(Box::new(
51288                    ClaimableBalanceEntryExtensionV1Ext::read_xdr(r)?,
51289                )))
51290            }),
51291            TypeVariant::ClaimableBalanceEntry => r.with_limited_depth(|r| {
51292                Ok(Self::ClaimableBalanceEntry(Box::new(
51293                    ClaimableBalanceEntry::read_xdr(r)?,
51294                )))
51295            }),
51296            TypeVariant::ClaimableBalanceEntryExt => r.with_limited_depth(|r| {
51297                Ok(Self::ClaimableBalanceEntryExt(Box::new(
51298                    ClaimableBalanceEntryExt::read_xdr(r)?,
51299                )))
51300            }),
51301            TypeVariant::LiquidityPoolConstantProductParameters => r.with_limited_depth(|r| {
51302                Ok(Self::LiquidityPoolConstantProductParameters(Box::new(
51303                    LiquidityPoolConstantProductParameters::read_xdr(r)?,
51304                )))
51305            }),
51306            TypeVariant::LiquidityPoolEntry => r.with_limited_depth(|r| {
51307                Ok(Self::LiquidityPoolEntry(Box::new(
51308                    LiquidityPoolEntry::read_xdr(r)?,
51309                )))
51310            }),
51311            TypeVariant::LiquidityPoolEntryBody => r.with_limited_depth(|r| {
51312                Ok(Self::LiquidityPoolEntryBody(Box::new(
51313                    LiquidityPoolEntryBody::read_xdr(r)?,
51314                )))
51315            }),
51316            TypeVariant::LiquidityPoolEntryConstantProduct => r.with_limited_depth(|r| {
51317                Ok(Self::LiquidityPoolEntryConstantProduct(Box::new(
51318                    LiquidityPoolEntryConstantProduct::read_xdr(r)?,
51319                )))
51320            }),
51321            TypeVariant::ContractDataDurability => r.with_limited_depth(|r| {
51322                Ok(Self::ContractDataDurability(Box::new(
51323                    ContractDataDurability::read_xdr(r)?,
51324                )))
51325            }),
51326            TypeVariant::ContractDataEntry => r.with_limited_depth(|r| {
51327                Ok(Self::ContractDataEntry(Box::new(
51328                    ContractDataEntry::read_xdr(r)?,
51329                )))
51330            }),
51331            TypeVariant::ContractCodeCostInputs => r.with_limited_depth(|r| {
51332                Ok(Self::ContractCodeCostInputs(Box::new(
51333                    ContractCodeCostInputs::read_xdr(r)?,
51334                )))
51335            }),
51336            TypeVariant::ContractCodeEntry => r.with_limited_depth(|r| {
51337                Ok(Self::ContractCodeEntry(Box::new(
51338                    ContractCodeEntry::read_xdr(r)?,
51339                )))
51340            }),
51341            TypeVariant::ContractCodeEntryExt => r.with_limited_depth(|r| {
51342                Ok(Self::ContractCodeEntryExt(Box::new(
51343                    ContractCodeEntryExt::read_xdr(r)?,
51344                )))
51345            }),
51346            TypeVariant::ContractCodeEntryV1 => r.with_limited_depth(|r| {
51347                Ok(Self::ContractCodeEntryV1(Box::new(
51348                    ContractCodeEntryV1::read_xdr(r)?,
51349                )))
51350            }),
51351            TypeVariant::TtlEntry => {
51352                r.with_limited_depth(|r| Ok(Self::TtlEntry(Box::new(TtlEntry::read_xdr(r)?))))
51353            }
51354            TypeVariant::LedgerEntryExtensionV1 => r.with_limited_depth(|r| {
51355                Ok(Self::LedgerEntryExtensionV1(Box::new(
51356                    LedgerEntryExtensionV1::read_xdr(r)?,
51357                )))
51358            }),
51359            TypeVariant::LedgerEntryExtensionV1Ext => r.with_limited_depth(|r| {
51360                Ok(Self::LedgerEntryExtensionV1Ext(Box::new(
51361                    LedgerEntryExtensionV1Ext::read_xdr(r)?,
51362                )))
51363            }),
51364            TypeVariant::LedgerEntry => {
51365                r.with_limited_depth(|r| Ok(Self::LedgerEntry(Box::new(LedgerEntry::read_xdr(r)?))))
51366            }
51367            TypeVariant::LedgerEntryData => r.with_limited_depth(|r| {
51368                Ok(Self::LedgerEntryData(Box::new(LedgerEntryData::read_xdr(
51369                    r,
51370                )?)))
51371            }),
51372            TypeVariant::LedgerEntryExt => r.with_limited_depth(|r| {
51373                Ok(Self::LedgerEntryExt(Box::new(LedgerEntryExt::read_xdr(r)?)))
51374            }),
51375            TypeVariant::LedgerKey => {
51376                r.with_limited_depth(|r| Ok(Self::LedgerKey(Box::new(LedgerKey::read_xdr(r)?))))
51377            }
51378            TypeVariant::LedgerKeyAccount => r.with_limited_depth(|r| {
51379                Ok(Self::LedgerKeyAccount(Box::new(
51380                    LedgerKeyAccount::read_xdr(r)?,
51381                )))
51382            }),
51383            TypeVariant::LedgerKeyTrustLine => r.with_limited_depth(|r| {
51384                Ok(Self::LedgerKeyTrustLine(Box::new(
51385                    LedgerKeyTrustLine::read_xdr(r)?,
51386                )))
51387            }),
51388            TypeVariant::LedgerKeyOffer => r.with_limited_depth(|r| {
51389                Ok(Self::LedgerKeyOffer(Box::new(LedgerKeyOffer::read_xdr(r)?)))
51390            }),
51391            TypeVariant::LedgerKeyData => r.with_limited_depth(|r| {
51392                Ok(Self::LedgerKeyData(Box::new(LedgerKeyData::read_xdr(r)?)))
51393            }),
51394            TypeVariant::LedgerKeyClaimableBalance => r.with_limited_depth(|r| {
51395                Ok(Self::LedgerKeyClaimableBalance(Box::new(
51396                    LedgerKeyClaimableBalance::read_xdr(r)?,
51397                )))
51398            }),
51399            TypeVariant::LedgerKeyLiquidityPool => r.with_limited_depth(|r| {
51400                Ok(Self::LedgerKeyLiquidityPool(Box::new(
51401                    LedgerKeyLiquidityPool::read_xdr(r)?,
51402                )))
51403            }),
51404            TypeVariant::LedgerKeyContractData => r.with_limited_depth(|r| {
51405                Ok(Self::LedgerKeyContractData(Box::new(
51406                    LedgerKeyContractData::read_xdr(r)?,
51407                )))
51408            }),
51409            TypeVariant::LedgerKeyContractCode => r.with_limited_depth(|r| {
51410                Ok(Self::LedgerKeyContractCode(Box::new(
51411                    LedgerKeyContractCode::read_xdr(r)?,
51412                )))
51413            }),
51414            TypeVariant::LedgerKeyConfigSetting => r.with_limited_depth(|r| {
51415                Ok(Self::LedgerKeyConfigSetting(Box::new(
51416                    LedgerKeyConfigSetting::read_xdr(r)?,
51417                )))
51418            }),
51419            TypeVariant::LedgerKeyTtl => r.with_limited_depth(|r| {
51420                Ok(Self::LedgerKeyTtl(Box::new(LedgerKeyTtl::read_xdr(r)?)))
51421            }),
51422            TypeVariant::EnvelopeType => r.with_limited_depth(|r| {
51423                Ok(Self::EnvelopeType(Box::new(EnvelopeType::read_xdr(r)?)))
51424            }),
51425            TypeVariant::BucketListType => r.with_limited_depth(|r| {
51426                Ok(Self::BucketListType(Box::new(BucketListType::read_xdr(r)?)))
51427            }),
51428            TypeVariant::BucketEntryType => r.with_limited_depth(|r| {
51429                Ok(Self::BucketEntryType(Box::new(BucketEntryType::read_xdr(
51430                    r,
51431                )?)))
51432            }),
51433            TypeVariant::HotArchiveBucketEntryType => r.with_limited_depth(|r| {
51434                Ok(Self::HotArchiveBucketEntryType(Box::new(
51435                    HotArchiveBucketEntryType::read_xdr(r)?,
51436                )))
51437            }),
51438            TypeVariant::ColdArchiveBucketEntryType => r.with_limited_depth(|r| {
51439                Ok(Self::ColdArchiveBucketEntryType(Box::new(
51440                    ColdArchiveBucketEntryType::read_xdr(r)?,
51441                )))
51442            }),
51443            TypeVariant::BucketMetadata => r.with_limited_depth(|r| {
51444                Ok(Self::BucketMetadata(Box::new(BucketMetadata::read_xdr(r)?)))
51445            }),
51446            TypeVariant::BucketMetadataExt => r.with_limited_depth(|r| {
51447                Ok(Self::BucketMetadataExt(Box::new(
51448                    BucketMetadataExt::read_xdr(r)?,
51449                )))
51450            }),
51451            TypeVariant::BucketEntry => {
51452                r.with_limited_depth(|r| Ok(Self::BucketEntry(Box::new(BucketEntry::read_xdr(r)?))))
51453            }
51454            TypeVariant::HotArchiveBucketEntry => r.with_limited_depth(|r| {
51455                Ok(Self::HotArchiveBucketEntry(Box::new(
51456                    HotArchiveBucketEntry::read_xdr(r)?,
51457                )))
51458            }),
51459            TypeVariant::ColdArchiveArchivedLeaf => r.with_limited_depth(|r| {
51460                Ok(Self::ColdArchiveArchivedLeaf(Box::new(
51461                    ColdArchiveArchivedLeaf::read_xdr(r)?,
51462                )))
51463            }),
51464            TypeVariant::ColdArchiveDeletedLeaf => r.with_limited_depth(|r| {
51465                Ok(Self::ColdArchiveDeletedLeaf(Box::new(
51466                    ColdArchiveDeletedLeaf::read_xdr(r)?,
51467                )))
51468            }),
51469            TypeVariant::ColdArchiveBoundaryLeaf => r.with_limited_depth(|r| {
51470                Ok(Self::ColdArchiveBoundaryLeaf(Box::new(
51471                    ColdArchiveBoundaryLeaf::read_xdr(r)?,
51472                )))
51473            }),
51474            TypeVariant::ColdArchiveHashEntry => r.with_limited_depth(|r| {
51475                Ok(Self::ColdArchiveHashEntry(Box::new(
51476                    ColdArchiveHashEntry::read_xdr(r)?,
51477                )))
51478            }),
51479            TypeVariant::ColdArchiveBucketEntry => r.with_limited_depth(|r| {
51480                Ok(Self::ColdArchiveBucketEntry(Box::new(
51481                    ColdArchiveBucketEntry::read_xdr(r)?,
51482                )))
51483            }),
51484            TypeVariant::UpgradeType => {
51485                r.with_limited_depth(|r| Ok(Self::UpgradeType(Box::new(UpgradeType::read_xdr(r)?))))
51486            }
51487            TypeVariant::StellarValueType => r.with_limited_depth(|r| {
51488                Ok(Self::StellarValueType(Box::new(
51489                    StellarValueType::read_xdr(r)?,
51490                )))
51491            }),
51492            TypeVariant::LedgerCloseValueSignature => r.with_limited_depth(|r| {
51493                Ok(Self::LedgerCloseValueSignature(Box::new(
51494                    LedgerCloseValueSignature::read_xdr(r)?,
51495                )))
51496            }),
51497            TypeVariant::StellarValue => r.with_limited_depth(|r| {
51498                Ok(Self::StellarValue(Box::new(StellarValue::read_xdr(r)?)))
51499            }),
51500            TypeVariant::StellarValueExt => r.with_limited_depth(|r| {
51501                Ok(Self::StellarValueExt(Box::new(StellarValueExt::read_xdr(
51502                    r,
51503                )?)))
51504            }),
51505            TypeVariant::LedgerHeaderFlags => r.with_limited_depth(|r| {
51506                Ok(Self::LedgerHeaderFlags(Box::new(
51507                    LedgerHeaderFlags::read_xdr(r)?,
51508                )))
51509            }),
51510            TypeVariant::LedgerHeaderExtensionV1 => r.with_limited_depth(|r| {
51511                Ok(Self::LedgerHeaderExtensionV1(Box::new(
51512                    LedgerHeaderExtensionV1::read_xdr(r)?,
51513                )))
51514            }),
51515            TypeVariant::LedgerHeaderExtensionV1Ext => r.with_limited_depth(|r| {
51516                Ok(Self::LedgerHeaderExtensionV1Ext(Box::new(
51517                    LedgerHeaderExtensionV1Ext::read_xdr(r)?,
51518                )))
51519            }),
51520            TypeVariant::LedgerHeader => r.with_limited_depth(|r| {
51521                Ok(Self::LedgerHeader(Box::new(LedgerHeader::read_xdr(r)?)))
51522            }),
51523            TypeVariant::LedgerHeaderExt => r.with_limited_depth(|r| {
51524                Ok(Self::LedgerHeaderExt(Box::new(LedgerHeaderExt::read_xdr(
51525                    r,
51526                )?)))
51527            }),
51528            TypeVariant::LedgerUpgradeType => r.with_limited_depth(|r| {
51529                Ok(Self::LedgerUpgradeType(Box::new(
51530                    LedgerUpgradeType::read_xdr(r)?,
51531                )))
51532            }),
51533            TypeVariant::ConfigUpgradeSetKey => r.with_limited_depth(|r| {
51534                Ok(Self::ConfigUpgradeSetKey(Box::new(
51535                    ConfigUpgradeSetKey::read_xdr(r)?,
51536                )))
51537            }),
51538            TypeVariant::LedgerUpgrade => r.with_limited_depth(|r| {
51539                Ok(Self::LedgerUpgrade(Box::new(LedgerUpgrade::read_xdr(r)?)))
51540            }),
51541            TypeVariant::ConfigUpgradeSet => r.with_limited_depth(|r| {
51542                Ok(Self::ConfigUpgradeSet(Box::new(
51543                    ConfigUpgradeSet::read_xdr(r)?,
51544                )))
51545            }),
51546            TypeVariant::TxSetComponentType => r.with_limited_depth(|r| {
51547                Ok(Self::TxSetComponentType(Box::new(
51548                    TxSetComponentType::read_xdr(r)?,
51549                )))
51550            }),
51551            TypeVariant::TxSetComponent => r.with_limited_depth(|r| {
51552                Ok(Self::TxSetComponent(Box::new(TxSetComponent::read_xdr(r)?)))
51553            }),
51554            TypeVariant::TxSetComponentTxsMaybeDiscountedFee => r.with_limited_depth(|r| {
51555                Ok(Self::TxSetComponentTxsMaybeDiscountedFee(Box::new(
51556                    TxSetComponentTxsMaybeDiscountedFee::read_xdr(r)?,
51557                )))
51558            }),
51559            TypeVariant::TransactionPhase => r.with_limited_depth(|r| {
51560                Ok(Self::TransactionPhase(Box::new(
51561                    TransactionPhase::read_xdr(r)?,
51562                )))
51563            }),
51564            TypeVariant::TransactionSet => r.with_limited_depth(|r| {
51565                Ok(Self::TransactionSet(Box::new(TransactionSet::read_xdr(r)?)))
51566            }),
51567            TypeVariant::TransactionSetV1 => r.with_limited_depth(|r| {
51568                Ok(Self::TransactionSetV1(Box::new(
51569                    TransactionSetV1::read_xdr(r)?,
51570                )))
51571            }),
51572            TypeVariant::GeneralizedTransactionSet => r.with_limited_depth(|r| {
51573                Ok(Self::GeneralizedTransactionSet(Box::new(
51574                    GeneralizedTransactionSet::read_xdr(r)?,
51575                )))
51576            }),
51577            TypeVariant::TransactionResultPair => r.with_limited_depth(|r| {
51578                Ok(Self::TransactionResultPair(Box::new(
51579                    TransactionResultPair::read_xdr(r)?,
51580                )))
51581            }),
51582            TypeVariant::TransactionResultSet => r.with_limited_depth(|r| {
51583                Ok(Self::TransactionResultSet(Box::new(
51584                    TransactionResultSet::read_xdr(r)?,
51585                )))
51586            }),
51587            TypeVariant::TransactionHistoryEntry => r.with_limited_depth(|r| {
51588                Ok(Self::TransactionHistoryEntry(Box::new(
51589                    TransactionHistoryEntry::read_xdr(r)?,
51590                )))
51591            }),
51592            TypeVariant::TransactionHistoryEntryExt => r.with_limited_depth(|r| {
51593                Ok(Self::TransactionHistoryEntryExt(Box::new(
51594                    TransactionHistoryEntryExt::read_xdr(r)?,
51595                )))
51596            }),
51597            TypeVariant::TransactionHistoryResultEntry => r.with_limited_depth(|r| {
51598                Ok(Self::TransactionHistoryResultEntry(Box::new(
51599                    TransactionHistoryResultEntry::read_xdr(r)?,
51600                )))
51601            }),
51602            TypeVariant::TransactionHistoryResultEntryExt => r.with_limited_depth(|r| {
51603                Ok(Self::TransactionHistoryResultEntryExt(Box::new(
51604                    TransactionHistoryResultEntryExt::read_xdr(r)?,
51605                )))
51606            }),
51607            TypeVariant::LedgerHeaderHistoryEntry => r.with_limited_depth(|r| {
51608                Ok(Self::LedgerHeaderHistoryEntry(Box::new(
51609                    LedgerHeaderHistoryEntry::read_xdr(r)?,
51610                )))
51611            }),
51612            TypeVariant::LedgerHeaderHistoryEntryExt => r.with_limited_depth(|r| {
51613                Ok(Self::LedgerHeaderHistoryEntryExt(Box::new(
51614                    LedgerHeaderHistoryEntryExt::read_xdr(r)?,
51615                )))
51616            }),
51617            TypeVariant::LedgerScpMessages => r.with_limited_depth(|r| {
51618                Ok(Self::LedgerScpMessages(Box::new(
51619                    LedgerScpMessages::read_xdr(r)?,
51620                )))
51621            }),
51622            TypeVariant::ScpHistoryEntryV0 => r.with_limited_depth(|r| {
51623                Ok(Self::ScpHistoryEntryV0(Box::new(
51624                    ScpHistoryEntryV0::read_xdr(r)?,
51625                )))
51626            }),
51627            TypeVariant::ScpHistoryEntry => r.with_limited_depth(|r| {
51628                Ok(Self::ScpHistoryEntry(Box::new(ScpHistoryEntry::read_xdr(
51629                    r,
51630                )?)))
51631            }),
51632            TypeVariant::LedgerEntryChangeType => r.with_limited_depth(|r| {
51633                Ok(Self::LedgerEntryChangeType(Box::new(
51634                    LedgerEntryChangeType::read_xdr(r)?,
51635                )))
51636            }),
51637            TypeVariant::LedgerEntryChange => r.with_limited_depth(|r| {
51638                Ok(Self::LedgerEntryChange(Box::new(
51639                    LedgerEntryChange::read_xdr(r)?,
51640                )))
51641            }),
51642            TypeVariant::LedgerEntryChanges => r.with_limited_depth(|r| {
51643                Ok(Self::LedgerEntryChanges(Box::new(
51644                    LedgerEntryChanges::read_xdr(r)?,
51645                )))
51646            }),
51647            TypeVariant::OperationMeta => r.with_limited_depth(|r| {
51648                Ok(Self::OperationMeta(Box::new(OperationMeta::read_xdr(r)?)))
51649            }),
51650            TypeVariant::TransactionMetaV1 => r.with_limited_depth(|r| {
51651                Ok(Self::TransactionMetaV1(Box::new(
51652                    TransactionMetaV1::read_xdr(r)?,
51653                )))
51654            }),
51655            TypeVariant::TransactionMetaV2 => r.with_limited_depth(|r| {
51656                Ok(Self::TransactionMetaV2(Box::new(
51657                    TransactionMetaV2::read_xdr(r)?,
51658                )))
51659            }),
51660            TypeVariant::ContractEventType => r.with_limited_depth(|r| {
51661                Ok(Self::ContractEventType(Box::new(
51662                    ContractEventType::read_xdr(r)?,
51663                )))
51664            }),
51665            TypeVariant::ContractEvent => r.with_limited_depth(|r| {
51666                Ok(Self::ContractEvent(Box::new(ContractEvent::read_xdr(r)?)))
51667            }),
51668            TypeVariant::ContractEventBody => r.with_limited_depth(|r| {
51669                Ok(Self::ContractEventBody(Box::new(
51670                    ContractEventBody::read_xdr(r)?,
51671                )))
51672            }),
51673            TypeVariant::ContractEventV0 => r.with_limited_depth(|r| {
51674                Ok(Self::ContractEventV0(Box::new(ContractEventV0::read_xdr(
51675                    r,
51676                )?)))
51677            }),
51678            TypeVariant::DiagnosticEvent => r.with_limited_depth(|r| {
51679                Ok(Self::DiagnosticEvent(Box::new(DiagnosticEvent::read_xdr(
51680                    r,
51681                )?)))
51682            }),
51683            TypeVariant::DiagnosticEvents => r.with_limited_depth(|r| {
51684                Ok(Self::DiagnosticEvents(Box::new(
51685                    DiagnosticEvents::read_xdr(r)?,
51686                )))
51687            }),
51688            TypeVariant::SorobanTransactionMetaExtV1 => r.with_limited_depth(|r| {
51689                Ok(Self::SorobanTransactionMetaExtV1(Box::new(
51690                    SorobanTransactionMetaExtV1::read_xdr(r)?,
51691                )))
51692            }),
51693            TypeVariant::SorobanTransactionMetaExt => r.with_limited_depth(|r| {
51694                Ok(Self::SorobanTransactionMetaExt(Box::new(
51695                    SorobanTransactionMetaExt::read_xdr(r)?,
51696                )))
51697            }),
51698            TypeVariant::SorobanTransactionMeta => r.with_limited_depth(|r| {
51699                Ok(Self::SorobanTransactionMeta(Box::new(
51700                    SorobanTransactionMeta::read_xdr(r)?,
51701                )))
51702            }),
51703            TypeVariant::TransactionMetaV3 => r.with_limited_depth(|r| {
51704                Ok(Self::TransactionMetaV3(Box::new(
51705                    TransactionMetaV3::read_xdr(r)?,
51706                )))
51707            }),
51708            TypeVariant::InvokeHostFunctionSuccessPreImage => r.with_limited_depth(|r| {
51709                Ok(Self::InvokeHostFunctionSuccessPreImage(Box::new(
51710                    InvokeHostFunctionSuccessPreImage::read_xdr(r)?,
51711                )))
51712            }),
51713            TypeVariant::TransactionMeta => r.with_limited_depth(|r| {
51714                Ok(Self::TransactionMeta(Box::new(TransactionMeta::read_xdr(
51715                    r,
51716                )?)))
51717            }),
51718            TypeVariant::TransactionResultMeta => r.with_limited_depth(|r| {
51719                Ok(Self::TransactionResultMeta(Box::new(
51720                    TransactionResultMeta::read_xdr(r)?,
51721                )))
51722            }),
51723            TypeVariant::UpgradeEntryMeta => r.with_limited_depth(|r| {
51724                Ok(Self::UpgradeEntryMeta(Box::new(
51725                    UpgradeEntryMeta::read_xdr(r)?,
51726                )))
51727            }),
51728            TypeVariant::LedgerCloseMetaV0 => r.with_limited_depth(|r| {
51729                Ok(Self::LedgerCloseMetaV0(Box::new(
51730                    LedgerCloseMetaV0::read_xdr(r)?,
51731                )))
51732            }),
51733            TypeVariant::LedgerCloseMetaExtV1 => r.with_limited_depth(|r| {
51734                Ok(Self::LedgerCloseMetaExtV1(Box::new(
51735                    LedgerCloseMetaExtV1::read_xdr(r)?,
51736                )))
51737            }),
51738            TypeVariant::LedgerCloseMetaExt => r.with_limited_depth(|r| {
51739                Ok(Self::LedgerCloseMetaExt(Box::new(
51740                    LedgerCloseMetaExt::read_xdr(r)?,
51741                )))
51742            }),
51743            TypeVariant::LedgerCloseMetaV1 => r.with_limited_depth(|r| {
51744                Ok(Self::LedgerCloseMetaV1(Box::new(
51745                    LedgerCloseMetaV1::read_xdr(r)?,
51746                )))
51747            }),
51748            TypeVariant::LedgerCloseMeta => r.with_limited_depth(|r| {
51749                Ok(Self::LedgerCloseMeta(Box::new(LedgerCloseMeta::read_xdr(
51750                    r,
51751                )?)))
51752            }),
51753            TypeVariant::ErrorCode => {
51754                r.with_limited_depth(|r| Ok(Self::ErrorCode(Box::new(ErrorCode::read_xdr(r)?))))
51755            }
51756            TypeVariant::SError => {
51757                r.with_limited_depth(|r| Ok(Self::SError(Box::new(SError::read_xdr(r)?))))
51758            }
51759            TypeVariant::SendMore => {
51760                r.with_limited_depth(|r| Ok(Self::SendMore(Box::new(SendMore::read_xdr(r)?))))
51761            }
51762            TypeVariant::SendMoreExtended => r.with_limited_depth(|r| {
51763                Ok(Self::SendMoreExtended(Box::new(
51764                    SendMoreExtended::read_xdr(r)?,
51765                )))
51766            }),
51767            TypeVariant::AuthCert => {
51768                r.with_limited_depth(|r| Ok(Self::AuthCert(Box::new(AuthCert::read_xdr(r)?))))
51769            }
51770            TypeVariant::Hello => {
51771                r.with_limited_depth(|r| Ok(Self::Hello(Box::new(Hello::read_xdr(r)?))))
51772            }
51773            TypeVariant::Auth => {
51774                r.with_limited_depth(|r| Ok(Self::Auth(Box::new(Auth::read_xdr(r)?))))
51775            }
51776            TypeVariant::IpAddrType => {
51777                r.with_limited_depth(|r| Ok(Self::IpAddrType(Box::new(IpAddrType::read_xdr(r)?))))
51778            }
51779            TypeVariant::PeerAddress => {
51780                r.with_limited_depth(|r| Ok(Self::PeerAddress(Box::new(PeerAddress::read_xdr(r)?))))
51781            }
51782            TypeVariant::PeerAddressIp => r.with_limited_depth(|r| {
51783                Ok(Self::PeerAddressIp(Box::new(PeerAddressIp::read_xdr(r)?)))
51784            }),
51785            TypeVariant::MessageType => {
51786                r.with_limited_depth(|r| Ok(Self::MessageType(Box::new(MessageType::read_xdr(r)?))))
51787            }
51788            TypeVariant::DontHave => {
51789                r.with_limited_depth(|r| Ok(Self::DontHave(Box::new(DontHave::read_xdr(r)?))))
51790            }
51791            TypeVariant::SurveyMessageCommandType => r.with_limited_depth(|r| {
51792                Ok(Self::SurveyMessageCommandType(Box::new(
51793                    SurveyMessageCommandType::read_xdr(r)?,
51794                )))
51795            }),
51796            TypeVariant::SurveyMessageResponseType => r.with_limited_depth(|r| {
51797                Ok(Self::SurveyMessageResponseType(Box::new(
51798                    SurveyMessageResponseType::read_xdr(r)?,
51799                )))
51800            }),
51801            TypeVariant::TimeSlicedSurveyStartCollectingMessage => r.with_limited_depth(|r| {
51802                Ok(Self::TimeSlicedSurveyStartCollectingMessage(Box::new(
51803                    TimeSlicedSurveyStartCollectingMessage::read_xdr(r)?,
51804                )))
51805            }),
51806            TypeVariant::SignedTimeSlicedSurveyStartCollectingMessage => {
51807                r.with_limited_depth(|r| {
51808                    Ok(Self::SignedTimeSlicedSurveyStartCollectingMessage(
51809                        Box::new(SignedTimeSlicedSurveyStartCollectingMessage::read_xdr(r)?),
51810                    ))
51811                })
51812            }
51813            TypeVariant::TimeSlicedSurveyStopCollectingMessage => r.with_limited_depth(|r| {
51814                Ok(Self::TimeSlicedSurveyStopCollectingMessage(Box::new(
51815                    TimeSlicedSurveyStopCollectingMessage::read_xdr(r)?,
51816                )))
51817            }),
51818            TypeVariant::SignedTimeSlicedSurveyStopCollectingMessage => r.with_limited_depth(|r| {
51819                Ok(Self::SignedTimeSlicedSurveyStopCollectingMessage(Box::new(
51820                    SignedTimeSlicedSurveyStopCollectingMessage::read_xdr(r)?,
51821                )))
51822            }),
51823            TypeVariant::SurveyRequestMessage => r.with_limited_depth(|r| {
51824                Ok(Self::SurveyRequestMessage(Box::new(
51825                    SurveyRequestMessage::read_xdr(r)?,
51826                )))
51827            }),
51828            TypeVariant::TimeSlicedSurveyRequestMessage => r.with_limited_depth(|r| {
51829                Ok(Self::TimeSlicedSurveyRequestMessage(Box::new(
51830                    TimeSlicedSurveyRequestMessage::read_xdr(r)?,
51831                )))
51832            }),
51833            TypeVariant::SignedSurveyRequestMessage => r.with_limited_depth(|r| {
51834                Ok(Self::SignedSurveyRequestMessage(Box::new(
51835                    SignedSurveyRequestMessage::read_xdr(r)?,
51836                )))
51837            }),
51838            TypeVariant::SignedTimeSlicedSurveyRequestMessage => r.with_limited_depth(|r| {
51839                Ok(Self::SignedTimeSlicedSurveyRequestMessage(Box::new(
51840                    SignedTimeSlicedSurveyRequestMessage::read_xdr(r)?,
51841                )))
51842            }),
51843            TypeVariant::EncryptedBody => r.with_limited_depth(|r| {
51844                Ok(Self::EncryptedBody(Box::new(EncryptedBody::read_xdr(r)?)))
51845            }),
51846            TypeVariant::SurveyResponseMessage => r.with_limited_depth(|r| {
51847                Ok(Self::SurveyResponseMessage(Box::new(
51848                    SurveyResponseMessage::read_xdr(r)?,
51849                )))
51850            }),
51851            TypeVariant::TimeSlicedSurveyResponseMessage => r.with_limited_depth(|r| {
51852                Ok(Self::TimeSlicedSurveyResponseMessage(Box::new(
51853                    TimeSlicedSurveyResponseMessage::read_xdr(r)?,
51854                )))
51855            }),
51856            TypeVariant::SignedSurveyResponseMessage => r.with_limited_depth(|r| {
51857                Ok(Self::SignedSurveyResponseMessage(Box::new(
51858                    SignedSurveyResponseMessage::read_xdr(r)?,
51859                )))
51860            }),
51861            TypeVariant::SignedTimeSlicedSurveyResponseMessage => r.with_limited_depth(|r| {
51862                Ok(Self::SignedTimeSlicedSurveyResponseMessage(Box::new(
51863                    SignedTimeSlicedSurveyResponseMessage::read_xdr(r)?,
51864                )))
51865            }),
51866            TypeVariant::PeerStats => {
51867                r.with_limited_depth(|r| Ok(Self::PeerStats(Box::new(PeerStats::read_xdr(r)?))))
51868            }
51869            TypeVariant::PeerStatList => r.with_limited_depth(|r| {
51870                Ok(Self::PeerStatList(Box::new(PeerStatList::read_xdr(r)?)))
51871            }),
51872            TypeVariant::TimeSlicedNodeData => r.with_limited_depth(|r| {
51873                Ok(Self::TimeSlicedNodeData(Box::new(
51874                    TimeSlicedNodeData::read_xdr(r)?,
51875                )))
51876            }),
51877            TypeVariant::TimeSlicedPeerData => r.with_limited_depth(|r| {
51878                Ok(Self::TimeSlicedPeerData(Box::new(
51879                    TimeSlicedPeerData::read_xdr(r)?,
51880                )))
51881            }),
51882            TypeVariant::TimeSlicedPeerDataList => r.with_limited_depth(|r| {
51883                Ok(Self::TimeSlicedPeerDataList(Box::new(
51884                    TimeSlicedPeerDataList::read_xdr(r)?,
51885                )))
51886            }),
51887            TypeVariant::TopologyResponseBodyV0 => r.with_limited_depth(|r| {
51888                Ok(Self::TopologyResponseBodyV0(Box::new(
51889                    TopologyResponseBodyV0::read_xdr(r)?,
51890                )))
51891            }),
51892            TypeVariant::TopologyResponseBodyV1 => r.with_limited_depth(|r| {
51893                Ok(Self::TopologyResponseBodyV1(Box::new(
51894                    TopologyResponseBodyV1::read_xdr(r)?,
51895                )))
51896            }),
51897            TypeVariant::TopologyResponseBodyV2 => r.with_limited_depth(|r| {
51898                Ok(Self::TopologyResponseBodyV2(Box::new(
51899                    TopologyResponseBodyV2::read_xdr(r)?,
51900                )))
51901            }),
51902            TypeVariant::SurveyResponseBody => r.with_limited_depth(|r| {
51903                Ok(Self::SurveyResponseBody(Box::new(
51904                    SurveyResponseBody::read_xdr(r)?,
51905                )))
51906            }),
51907            TypeVariant::TxAdvertVector => r.with_limited_depth(|r| {
51908                Ok(Self::TxAdvertVector(Box::new(TxAdvertVector::read_xdr(r)?)))
51909            }),
51910            TypeVariant::FloodAdvert => {
51911                r.with_limited_depth(|r| Ok(Self::FloodAdvert(Box::new(FloodAdvert::read_xdr(r)?))))
51912            }
51913            TypeVariant::TxDemandVector => r.with_limited_depth(|r| {
51914                Ok(Self::TxDemandVector(Box::new(TxDemandVector::read_xdr(r)?)))
51915            }),
51916            TypeVariant::FloodDemand => {
51917                r.with_limited_depth(|r| Ok(Self::FloodDemand(Box::new(FloodDemand::read_xdr(r)?))))
51918            }
51919            TypeVariant::StellarMessage => r.with_limited_depth(|r| {
51920                Ok(Self::StellarMessage(Box::new(StellarMessage::read_xdr(r)?)))
51921            }),
51922            TypeVariant::AuthenticatedMessage => r.with_limited_depth(|r| {
51923                Ok(Self::AuthenticatedMessage(Box::new(
51924                    AuthenticatedMessage::read_xdr(r)?,
51925                )))
51926            }),
51927            TypeVariant::AuthenticatedMessageV0 => r.with_limited_depth(|r| {
51928                Ok(Self::AuthenticatedMessageV0(Box::new(
51929                    AuthenticatedMessageV0::read_xdr(r)?,
51930                )))
51931            }),
51932            TypeVariant::LiquidityPoolParameters => r.with_limited_depth(|r| {
51933                Ok(Self::LiquidityPoolParameters(Box::new(
51934                    LiquidityPoolParameters::read_xdr(r)?,
51935                )))
51936            }),
51937            TypeVariant::MuxedAccount => r.with_limited_depth(|r| {
51938                Ok(Self::MuxedAccount(Box::new(MuxedAccount::read_xdr(r)?)))
51939            }),
51940            TypeVariant::MuxedAccountMed25519 => r.with_limited_depth(|r| {
51941                Ok(Self::MuxedAccountMed25519(Box::new(
51942                    MuxedAccountMed25519::read_xdr(r)?,
51943                )))
51944            }),
51945            TypeVariant::DecoratedSignature => r.with_limited_depth(|r| {
51946                Ok(Self::DecoratedSignature(Box::new(
51947                    DecoratedSignature::read_xdr(r)?,
51948                )))
51949            }),
51950            TypeVariant::OperationType => r.with_limited_depth(|r| {
51951                Ok(Self::OperationType(Box::new(OperationType::read_xdr(r)?)))
51952            }),
51953            TypeVariant::CreateAccountOp => r.with_limited_depth(|r| {
51954                Ok(Self::CreateAccountOp(Box::new(CreateAccountOp::read_xdr(
51955                    r,
51956                )?)))
51957            }),
51958            TypeVariant::PaymentOp => {
51959                r.with_limited_depth(|r| Ok(Self::PaymentOp(Box::new(PaymentOp::read_xdr(r)?))))
51960            }
51961            TypeVariant::PathPaymentStrictReceiveOp => r.with_limited_depth(|r| {
51962                Ok(Self::PathPaymentStrictReceiveOp(Box::new(
51963                    PathPaymentStrictReceiveOp::read_xdr(r)?,
51964                )))
51965            }),
51966            TypeVariant::PathPaymentStrictSendOp => r.with_limited_depth(|r| {
51967                Ok(Self::PathPaymentStrictSendOp(Box::new(
51968                    PathPaymentStrictSendOp::read_xdr(r)?,
51969                )))
51970            }),
51971            TypeVariant::ManageSellOfferOp => r.with_limited_depth(|r| {
51972                Ok(Self::ManageSellOfferOp(Box::new(
51973                    ManageSellOfferOp::read_xdr(r)?,
51974                )))
51975            }),
51976            TypeVariant::ManageBuyOfferOp => r.with_limited_depth(|r| {
51977                Ok(Self::ManageBuyOfferOp(Box::new(
51978                    ManageBuyOfferOp::read_xdr(r)?,
51979                )))
51980            }),
51981            TypeVariant::CreatePassiveSellOfferOp => r.with_limited_depth(|r| {
51982                Ok(Self::CreatePassiveSellOfferOp(Box::new(
51983                    CreatePassiveSellOfferOp::read_xdr(r)?,
51984                )))
51985            }),
51986            TypeVariant::SetOptionsOp => r.with_limited_depth(|r| {
51987                Ok(Self::SetOptionsOp(Box::new(SetOptionsOp::read_xdr(r)?)))
51988            }),
51989            TypeVariant::ChangeTrustAsset => r.with_limited_depth(|r| {
51990                Ok(Self::ChangeTrustAsset(Box::new(
51991                    ChangeTrustAsset::read_xdr(r)?,
51992                )))
51993            }),
51994            TypeVariant::ChangeTrustOp => r.with_limited_depth(|r| {
51995                Ok(Self::ChangeTrustOp(Box::new(ChangeTrustOp::read_xdr(r)?)))
51996            }),
51997            TypeVariant::AllowTrustOp => r.with_limited_depth(|r| {
51998                Ok(Self::AllowTrustOp(Box::new(AllowTrustOp::read_xdr(r)?)))
51999            }),
52000            TypeVariant::ManageDataOp => r.with_limited_depth(|r| {
52001                Ok(Self::ManageDataOp(Box::new(ManageDataOp::read_xdr(r)?)))
52002            }),
52003            TypeVariant::BumpSequenceOp => r.with_limited_depth(|r| {
52004                Ok(Self::BumpSequenceOp(Box::new(BumpSequenceOp::read_xdr(r)?)))
52005            }),
52006            TypeVariant::CreateClaimableBalanceOp => r.with_limited_depth(|r| {
52007                Ok(Self::CreateClaimableBalanceOp(Box::new(
52008                    CreateClaimableBalanceOp::read_xdr(r)?,
52009                )))
52010            }),
52011            TypeVariant::ClaimClaimableBalanceOp => r.with_limited_depth(|r| {
52012                Ok(Self::ClaimClaimableBalanceOp(Box::new(
52013                    ClaimClaimableBalanceOp::read_xdr(r)?,
52014                )))
52015            }),
52016            TypeVariant::BeginSponsoringFutureReservesOp => r.with_limited_depth(|r| {
52017                Ok(Self::BeginSponsoringFutureReservesOp(Box::new(
52018                    BeginSponsoringFutureReservesOp::read_xdr(r)?,
52019                )))
52020            }),
52021            TypeVariant::RevokeSponsorshipType => r.with_limited_depth(|r| {
52022                Ok(Self::RevokeSponsorshipType(Box::new(
52023                    RevokeSponsorshipType::read_xdr(r)?,
52024                )))
52025            }),
52026            TypeVariant::RevokeSponsorshipOp => r.with_limited_depth(|r| {
52027                Ok(Self::RevokeSponsorshipOp(Box::new(
52028                    RevokeSponsorshipOp::read_xdr(r)?,
52029                )))
52030            }),
52031            TypeVariant::RevokeSponsorshipOpSigner => r.with_limited_depth(|r| {
52032                Ok(Self::RevokeSponsorshipOpSigner(Box::new(
52033                    RevokeSponsorshipOpSigner::read_xdr(r)?,
52034                )))
52035            }),
52036            TypeVariant::ClawbackOp => {
52037                r.with_limited_depth(|r| Ok(Self::ClawbackOp(Box::new(ClawbackOp::read_xdr(r)?))))
52038            }
52039            TypeVariant::ClawbackClaimableBalanceOp => r.with_limited_depth(|r| {
52040                Ok(Self::ClawbackClaimableBalanceOp(Box::new(
52041                    ClawbackClaimableBalanceOp::read_xdr(r)?,
52042                )))
52043            }),
52044            TypeVariant::SetTrustLineFlagsOp => r.with_limited_depth(|r| {
52045                Ok(Self::SetTrustLineFlagsOp(Box::new(
52046                    SetTrustLineFlagsOp::read_xdr(r)?,
52047                )))
52048            }),
52049            TypeVariant::LiquidityPoolDepositOp => r.with_limited_depth(|r| {
52050                Ok(Self::LiquidityPoolDepositOp(Box::new(
52051                    LiquidityPoolDepositOp::read_xdr(r)?,
52052                )))
52053            }),
52054            TypeVariant::LiquidityPoolWithdrawOp => r.with_limited_depth(|r| {
52055                Ok(Self::LiquidityPoolWithdrawOp(Box::new(
52056                    LiquidityPoolWithdrawOp::read_xdr(r)?,
52057                )))
52058            }),
52059            TypeVariant::HostFunctionType => r.with_limited_depth(|r| {
52060                Ok(Self::HostFunctionType(Box::new(
52061                    HostFunctionType::read_xdr(r)?,
52062                )))
52063            }),
52064            TypeVariant::ContractIdPreimageType => r.with_limited_depth(|r| {
52065                Ok(Self::ContractIdPreimageType(Box::new(
52066                    ContractIdPreimageType::read_xdr(r)?,
52067                )))
52068            }),
52069            TypeVariant::ContractIdPreimage => r.with_limited_depth(|r| {
52070                Ok(Self::ContractIdPreimage(Box::new(
52071                    ContractIdPreimage::read_xdr(r)?,
52072                )))
52073            }),
52074            TypeVariant::ContractIdPreimageFromAddress => r.with_limited_depth(|r| {
52075                Ok(Self::ContractIdPreimageFromAddress(Box::new(
52076                    ContractIdPreimageFromAddress::read_xdr(r)?,
52077                )))
52078            }),
52079            TypeVariant::CreateContractArgs => r.with_limited_depth(|r| {
52080                Ok(Self::CreateContractArgs(Box::new(
52081                    CreateContractArgs::read_xdr(r)?,
52082                )))
52083            }),
52084            TypeVariant::CreateContractArgsV2 => r.with_limited_depth(|r| {
52085                Ok(Self::CreateContractArgsV2(Box::new(
52086                    CreateContractArgsV2::read_xdr(r)?,
52087                )))
52088            }),
52089            TypeVariant::InvokeContractArgs => r.with_limited_depth(|r| {
52090                Ok(Self::InvokeContractArgs(Box::new(
52091                    InvokeContractArgs::read_xdr(r)?,
52092                )))
52093            }),
52094            TypeVariant::HostFunction => r.with_limited_depth(|r| {
52095                Ok(Self::HostFunction(Box::new(HostFunction::read_xdr(r)?)))
52096            }),
52097            TypeVariant::SorobanAuthorizedFunctionType => r.with_limited_depth(|r| {
52098                Ok(Self::SorobanAuthorizedFunctionType(Box::new(
52099                    SorobanAuthorizedFunctionType::read_xdr(r)?,
52100                )))
52101            }),
52102            TypeVariant::SorobanAuthorizedFunction => r.with_limited_depth(|r| {
52103                Ok(Self::SorobanAuthorizedFunction(Box::new(
52104                    SorobanAuthorizedFunction::read_xdr(r)?,
52105                )))
52106            }),
52107            TypeVariant::SorobanAuthorizedInvocation => r.with_limited_depth(|r| {
52108                Ok(Self::SorobanAuthorizedInvocation(Box::new(
52109                    SorobanAuthorizedInvocation::read_xdr(r)?,
52110                )))
52111            }),
52112            TypeVariant::SorobanAddressCredentials => r.with_limited_depth(|r| {
52113                Ok(Self::SorobanAddressCredentials(Box::new(
52114                    SorobanAddressCredentials::read_xdr(r)?,
52115                )))
52116            }),
52117            TypeVariant::SorobanCredentialsType => r.with_limited_depth(|r| {
52118                Ok(Self::SorobanCredentialsType(Box::new(
52119                    SorobanCredentialsType::read_xdr(r)?,
52120                )))
52121            }),
52122            TypeVariant::SorobanCredentials => r.with_limited_depth(|r| {
52123                Ok(Self::SorobanCredentials(Box::new(
52124                    SorobanCredentials::read_xdr(r)?,
52125                )))
52126            }),
52127            TypeVariant::SorobanAuthorizationEntry => r.with_limited_depth(|r| {
52128                Ok(Self::SorobanAuthorizationEntry(Box::new(
52129                    SorobanAuthorizationEntry::read_xdr(r)?,
52130                )))
52131            }),
52132            TypeVariant::InvokeHostFunctionOp => r.with_limited_depth(|r| {
52133                Ok(Self::InvokeHostFunctionOp(Box::new(
52134                    InvokeHostFunctionOp::read_xdr(r)?,
52135                )))
52136            }),
52137            TypeVariant::ExtendFootprintTtlOp => r.with_limited_depth(|r| {
52138                Ok(Self::ExtendFootprintTtlOp(Box::new(
52139                    ExtendFootprintTtlOp::read_xdr(r)?,
52140                )))
52141            }),
52142            TypeVariant::RestoreFootprintOp => r.with_limited_depth(|r| {
52143                Ok(Self::RestoreFootprintOp(Box::new(
52144                    RestoreFootprintOp::read_xdr(r)?,
52145                )))
52146            }),
52147            TypeVariant::Operation => {
52148                r.with_limited_depth(|r| Ok(Self::Operation(Box::new(Operation::read_xdr(r)?))))
52149            }
52150            TypeVariant::OperationBody => r.with_limited_depth(|r| {
52151                Ok(Self::OperationBody(Box::new(OperationBody::read_xdr(r)?)))
52152            }),
52153            TypeVariant::HashIdPreimage => r.with_limited_depth(|r| {
52154                Ok(Self::HashIdPreimage(Box::new(HashIdPreimage::read_xdr(r)?)))
52155            }),
52156            TypeVariant::HashIdPreimageOperationId => r.with_limited_depth(|r| {
52157                Ok(Self::HashIdPreimageOperationId(Box::new(
52158                    HashIdPreimageOperationId::read_xdr(r)?,
52159                )))
52160            }),
52161            TypeVariant::HashIdPreimageRevokeId => r.with_limited_depth(|r| {
52162                Ok(Self::HashIdPreimageRevokeId(Box::new(
52163                    HashIdPreimageRevokeId::read_xdr(r)?,
52164                )))
52165            }),
52166            TypeVariant::HashIdPreimageContractId => r.with_limited_depth(|r| {
52167                Ok(Self::HashIdPreimageContractId(Box::new(
52168                    HashIdPreimageContractId::read_xdr(r)?,
52169                )))
52170            }),
52171            TypeVariant::HashIdPreimageSorobanAuthorization => r.with_limited_depth(|r| {
52172                Ok(Self::HashIdPreimageSorobanAuthorization(Box::new(
52173                    HashIdPreimageSorobanAuthorization::read_xdr(r)?,
52174                )))
52175            }),
52176            TypeVariant::MemoType => {
52177                r.with_limited_depth(|r| Ok(Self::MemoType(Box::new(MemoType::read_xdr(r)?))))
52178            }
52179            TypeVariant::Memo => {
52180                r.with_limited_depth(|r| Ok(Self::Memo(Box::new(Memo::read_xdr(r)?))))
52181            }
52182            TypeVariant::TimeBounds => {
52183                r.with_limited_depth(|r| Ok(Self::TimeBounds(Box::new(TimeBounds::read_xdr(r)?))))
52184            }
52185            TypeVariant::LedgerBounds => r.with_limited_depth(|r| {
52186                Ok(Self::LedgerBounds(Box::new(LedgerBounds::read_xdr(r)?)))
52187            }),
52188            TypeVariant::PreconditionsV2 => r.with_limited_depth(|r| {
52189                Ok(Self::PreconditionsV2(Box::new(PreconditionsV2::read_xdr(
52190                    r,
52191                )?)))
52192            }),
52193            TypeVariant::PreconditionType => r.with_limited_depth(|r| {
52194                Ok(Self::PreconditionType(Box::new(
52195                    PreconditionType::read_xdr(r)?,
52196                )))
52197            }),
52198            TypeVariant::Preconditions => r.with_limited_depth(|r| {
52199                Ok(Self::Preconditions(Box::new(Preconditions::read_xdr(r)?)))
52200            }),
52201            TypeVariant::LedgerFootprint => r.with_limited_depth(|r| {
52202                Ok(Self::LedgerFootprint(Box::new(LedgerFootprint::read_xdr(
52203                    r,
52204                )?)))
52205            }),
52206            TypeVariant::ArchivalProofType => r.with_limited_depth(|r| {
52207                Ok(Self::ArchivalProofType(Box::new(
52208                    ArchivalProofType::read_xdr(r)?,
52209                )))
52210            }),
52211            TypeVariant::ArchivalProofNode => r.with_limited_depth(|r| {
52212                Ok(Self::ArchivalProofNode(Box::new(
52213                    ArchivalProofNode::read_xdr(r)?,
52214                )))
52215            }),
52216            TypeVariant::ProofLevel => {
52217                r.with_limited_depth(|r| Ok(Self::ProofLevel(Box::new(ProofLevel::read_xdr(r)?))))
52218            }
52219            TypeVariant::NonexistenceProofBody => r.with_limited_depth(|r| {
52220                Ok(Self::NonexistenceProofBody(Box::new(
52221                    NonexistenceProofBody::read_xdr(r)?,
52222                )))
52223            }),
52224            TypeVariant::ExistenceProofBody => r.with_limited_depth(|r| {
52225                Ok(Self::ExistenceProofBody(Box::new(
52226                    ExistenceProofBody::read_xdr(r)?,
52227                )))
52228            }),
52229            TypeVariant::ArchivalProof => r.with_limited_depth(|r| {
52230                Ok(Self::ArchivalProof(Box::new(ArchivalProof::read_xdr(r)?)))
52231            }),
52232            TypeVariant::ArchivalProofBody => r.with_limited_depth(|r| {
52233                Ok(Self::ArchivalProofBody(Box::new(
52234                    ArchivalProofBody::read_xdr(r)?,
52235                )))
52236            }),
52237            TypeVariant::SorobanResources => r.with_limited_depth(|r| {
52238                Ok(Self::SorobanResources(Box::new(
52239                    SorobanResources::read_xdr(r)?,
52240                )))
52241            }),
52242            TypeVariant::SorobanTransactionData => r.with_limited_depth(|r| {
52243                Ok(Self::SorobanTransactionData(Box::new(
52244                    SorobanTransactionData::read_xdr(r)?,
52245                )))
52246            }),
52247            TypeVariant::TransactionV0 => r.with_limited_depth(|r| {
52248                Ok(Self::TransactionV0(Box::new(TransactionV0::read_xdr(r)?)))
52249            }),
52250            TypeVariant::TransactionV0Ext => r.with_limited_depth(|r| {
52251                Ok(Self::TransactionV0Ext(Box::new(
52252                    TransactionV0Ext::read_xdr(r)?,
52253                )))
52254            }),
52255            TypeVariant::TransactionV0Envelope => r.with_limited_depth(|r| {
52256                Ok(Self::TransactionV0Envelope(Box::new(
52257                    TransactionV0Envelope::read_xdr(r)?,
52258                )))
52259            }),
52260            TypeVariant::Transaction => {
52261                r.with_limited_depth(|r| Ok(Self::Transaction(Box::new(Transaction::read_xdr(r)?))))
52262            }
52263            TypeVariant::TransactionExt => r.with_limited_depth(|r| {
52264                Ok(Self::TransactionExt(Box::new(TransactionExt::read_xdr(r)?)))
52265            }),
52266            TypeVariant::TransactionV1Envelope => r.with_limited_depth(|r| {
52267                Ok(Self::TransactionV1Envelope(Box::new(
52268                    TransactionV1Envelope::read_xdr(r)?,
52269                )))
52270            }),
52271            TypeVariant::FeeBumpTransaction => r.with_limited_depth(|r| {
52272                Ok(Self::FeeBumpTransaction(Box::new(
52273                    FeeBumpTransaction::read_xdr(r)?,
52274                )))
52275            }),
52276            TypeVariant::FeeBumpTransactionInnerTx => r.with_limited_depth(|r| {
52277                Ok(Self::FeeBumpTransactionInnerTx(Box::new(
52278                    FeeBumpTransactionInnerTx::read_xdr(r)?,
52279                )))
52280            }),
52281            TypeVariant::FeeBumpTransactionExt => r.with_limited_depth(|r| {
52282                Ok(Self::FeeBumpTransactionExt(Box::new(
52283                    FeeBumpTransactionExt::read_xdr(r)?,
52284                )))
52285            }),
52286            TypeVariant::FeeBumpTransactionEnvelope => r.with_limited_depth(|r| {
52287                Ok(Self::FeeBumpTransactionEnvelope(Box::new(
52288                    FeeBumpTransactionEnvelope::read_xdr(r)?,
52289                )))
52290            }),
52291            TypeVariant::TransactionEnvelope => r.with_limited_depth(|r| {
52292                Ok(Self::TransactionEnvelope(Box::new(
52293                    TransactionEnvelope::read_xdr(r)?,
52294                )))
52295            }),
52296            TypeVariant::TransactionSignaturePayload => r.with_limited_depth(|r| {
52297                Ok(Self::TransactionSignaturePayload(Box::new(
52298                    TransactionSignaturePayload::read_xdr(r)?,
52299                )))
52300            }),
52301            TypeVariant::TransactionSignaturePayloadTaggedTransaction => {
52302                r.with_limited_depth(|r| {
52303                    Ok(Self::TransactionSignaturePayloadTaggedTransaction(
52304                        Box::new(TransactionSignaturePayloadTaggedTransaction::read_xdr(r)?),
52305                    ))
52306                })
52307            }
52308            TypeVariant::ClaimAtomType => r.with_limited_depth(|r| {
52309                Ok(Self::ClaimAtomType(Box::new(ClaimAtomType::read_xdr(r)?)))
52310            }),
52311            TypeVariant::ClaimOfferAtomV0 => r.with_limited_depth(|r| {
52312                Ok(Self::ClaimOfferAtomV0(Box::new(
52313                    ClaimOfferAtomV0::read_xdr(r)?,
52314                )))
52315            }),
52316            TypeVariant::ClaimOfferAtom => r.with_limited_depth(|r| {
52317                Ok(Self::ClaimOfferAtom(Box::new(ClaimOfferAtom::read_xdr(r)?)))
52318            }),
52319            TypeVariant::ClaimLiquidityAtom => r.with_limited_depth(|r| {
52320                Ok(Self::ClaimLiquidityAtom(Box::new(
52321                    ClaimLiquidityAtom::read_xdr(r)?,
52322                )))
52323            }),
52324            TypeVariant::ClaimAtom => {
52325                r.with_limited_depth(|r| Ok(Self::ClaimAtom(Box::new(ClaimAtom::read_xdr(r)?))))
52326            }
52327            TypeVariant::CreateAccountResultCode => r.with_limited_depth(|r| {
52328                Ok(Self::CreateAccountResultCode(Box::new(
52329                    CreateAccountResultCode::read_xdr(r)?,
52330                )))
52331            }),
52332            TypeVariant::CreateAccountResult => r.with_limited_depth(|r| {
52333                Ok(Self::CreateAccountResult(Box::new(
52334                    CreateAccountResult::read_xdr(r)?,
52335                )))
52336            }),
52337            TypeVariant::PaymentResultCode => r.with_limited_depth(|r| {
52338                Ok(Self::PaymentResultCode(Box::new(
52339                    PaymentResultCode::read_xdr(r)?,
52340                )))
52341            }),
52342            TypeVariant::PaymentResult => r.with_limited_depth(|r| {
52343                Ok(Self::PaymentResult(Box::new(PaymentResult::read_xdr(r)?)))
52344            }),
52345            TypeVariant::PathPaymentStrictReceiveResultCode => r.with_limited_depth(|r| {
52346                Ok(Self::PathPaymentStrictReceiveResultCode(Box::new(
52347                    PathPaymentStrictReceiveResultCode::read_xdr(r)?,
52348                )))
52349            }),
52350            TypeVariant::SimplePaymentResult => r.with_limited_depth(|r| {
52351                Ok(Self::SimplePaymentResult(Box::new(
52352                    SimplePaymentResult::read_xdr(r)?,
52353                )))
52354            }),
52355            TypeVariant::PathPaymentStrictReceiveResult => r.with_limited_depth(|r| {
52356                Ok(Self::PathPaymentStrictReceiveResult(Box::new(
52357                    PathPaymentStrictReceiveResult::read_xdr(r)?,
52358                )))
52359            }),
52360            TypeVariant::PathPaymentStrictReceiveResultSuccess => r.with_limited_depth(|r| {
52361                Ok(Self::PathPaymentStrictReceiveResultSuccess(Box::new(
52362                    PathPaymentStrictReceiveResultSuccess::read_xdr(r)?,
52363                )))
52364            }),
52365            TypeVariant::PathPaymentStrictSendResultCode => r.with_limited_depth(|r| {
52366                Ok(Self::PathPaymentStrictSendResultCode(Box::new(
52367                    PathPaymentStrictSendResultCode::read_xdr(r)?,
52368                )))
52369            }),
52370            TypeVariant::PathPaymentStrictSendResult => r.with_limited_depth(|r| {
52371                Ok(Self::PathPaymentStrictSendResult(Box::new(
52372                    PathPaymentStrictSendResult::read_xdr(r)?,
52373                )))
52374            }),
52375            TypeVariant::PathPaymentStrictSendResultSuccess => r.with_limited_depth(|r| {
52376                Ok(Self::PathPaymentStrictSendResultSuccess(Box::new(
52377                    PathPaymentStrictSendResultSuccess::read_xdr(r)?,
52378                )))
52379            }),
52380            TypeVariant::ManageSellOfferResultCode => r.with_limited_depth(|r| {
52381                Ok(Self::ManageSellOfferResultCode(Box::new(
52382                    ManageSellOfferResultCode::read_xdr(r)?,
52383                )))
52384            }),
52385            TypeVariant::ManageOfferEffect => r.with_limited_depth(|r| {
52386                Ok(Self::ManageOfferEffect(Box::new(
52387                    ManageOfferEffect::read_xdr(r)?,
52388                )))
52389            }),
52390            TypeVariant::ManageOfferSuccessResult => r.with_limited_depth(|r| {
52391                Ok(Self::ManageOfferSuccessResult(Box::new(
52392                    ManageOfferSuccessResult::read_xdr(r)?,
52393                )))
52394            }),
52395            TypeVariant::ManageOfferSuccessResultOffer => r.with_limited_depth(|r| {
52396                Ok(Self::ManageOfferSuccessResultOffer(Box::new(
52397                    ManageOfferSuccessResultOffer::read_xdr(r)?,
52398                )))
52399            }),
52400            TypeVariant::ManageSellOfferResult => r.with_limited_depth(|r| {
52401                Ok(Self::ManageSellOfferResult(Box::new(
52402                    ManageSellOfferResult::read_xdr(r)?,
52403                )))
52404            }),
52405            TypeVariant::ManageBuyOfferResultCode => r.with_limited_depth(|r| {
52406                Ok(Self::ManageBuyOfferResultCode(Box::new(
52407                    ManageBuyOfferResultCode::read_xdr(r)?,
52408                )))
52409            }),
52410            TypeVariant::ManageBuyOfferResult => r.with_limited_depth(|r| {
52411                Ok(Self::ManageBuyOfferResult(Box::new(
52412                    ManageBuyOfferResult::read_xdr(r)?,
52413                )))
52414            }),
52415            TypeVariant::SetOptionsResultCode => r.with_limited_depth(|r| {
52416                Ok(Self::SetOptionsResultCode(Box::new(
52417                    SetOptionsResultCode::read_xdr(r)?,
52418                )))
52419            }),
52420            TypeVariant::SetOptionsResult => r.with_limited_depth(|r| {
52421                Ok(Self::SetOptionsResult(Box::new(
52422                    SetOptionsResult::read_xdr(r)?,
52423                )))
52424            }),
52425            TypeVariant::ChangeTrustResultCode => r.with_limited_depth(|r| {
52426                Ok(Self::ChangeTrustResultCode(Box::new(
52427                    ChangeTrustResultCode::read_xdr(r)?,
52428                )))
52429            }),
52430            TypeVariant::ChangeTrustResult => r.with_limited_depth(|r| {
52431                Ok(Self::ChangeTrustResult(Box::new(
52432                    ChangeTrustResult::read_xdr(r)?,
52433                )))
52434            }),
52435            TypeVariant::AllowTrustResultCode => r.with_limited_depth(|r| {
52436                Ok(Self::AllowTrustResultCode(Box::new(
52437                    AllowTrustResultCode::read_xdr(r)?,
52438                )))
52439            }),
52440            TypeVariant::AllowTrustResult => r.with_limited_depth(|r| {
52441                Ok(Self::AllowTrustResult(Box::new(
52442                    AllowTrustResult::read_xdr(r)?,
52443                )))
52444            }),
52445            TypeVariant::AccountMergeResultCode => r.with_limited_depth(|r| {
52446                Ok(Self::AccountMergeResultCode(Box::new(
52447                    AccountMergeResultCode::read_xdr(r)?,
52448                )))
52449            }),
52450            TypeVariant::AccountMergeResult => r.with_limited_depth(|r| {
52451                Ok(Self::AccountMergeResult(Box::new(
52452                    AccountMergeResult::read_xdr(r)?,
52453                )))
52454            }),
52455            TypeVariant::InflationResultCode => r.with_limited_depth(|r| {
52456                Ok(Self::InflationResultCode(Box::new(
52457                    InflationResultCode::read_xdr(r)?,
52458                )))
52459            }),
52460            TypeVariant::InflationPayout => r.with_limited_depth(|r| {
52461                Ok(Self::InflationPayout(Box::new(InflationPayout::read_xdr(
52462                    r,
52463                )?)))
52464            }),
52465            TypeVariant::InflationResult => r.with_limited_depth(|r| {
52466                Ok(Self::InflationResult(Box::new(InflationResult::read_xdr(
52467                    r,
52468                )?)))
52469            }),
52470            TypeVariant::ManageDataResultCode => r.with_limited_depth(|r| {
52471                Ok(Self::ManageDataResultCode(Box::new(
52472                    ManageDataResultCode::read_xdr(r)?,
52473                )))
52474            }),
52475            TypeVariant::ManageDataResult => r.with_limited_depth(|r| {
52476                Ok(Self::ManageDataResult(Box::new(
52477                    ManageDataResult::read_xdr(r)?,
52478                )))
52479            }),
52480            TypeVariant::BumpSequenceResultCode => r.with_limited_depth(|r| {
52481                Ok(Self::BumpSequenceResultCode(Box::new(
52482                    BumpSequenceResultCode::read_xdr(r)?,
52483                )))
52484            }),
52485            TypeVariant::BumpSequenceResult => r.with_limited_depth(|r| {
52486                Ok(Self::BumpSequenceResult(Box::new(
52487                    BumpSequenceResult::read_xdr(r)?,
52488                )))
52489            }),
52490            TypeVariant::CreateClaimableBalanceResultCode => r.with_limited_depth(|r| {
52491                Ok(Self::CreateClaimableBalanceResultCode(Box::new(
52492                    CreateClaimableBalanceResultCode::read_xdr(r)?,
52493                )))
52494            }),
52495            TypeVariant::CreateClaimableBalanceResult => r.with_limited_depth(|r| {
52496                Ok(Self::CreateClaimableBalanceResult(Box::new(
52497                    CreateClaimableBalanceResult::read_xdr(r)?,
52498                )))
52499            }),
52500            TypeVariant::ClaimClaimableBalanceResultCode => r.with_limited_depth(|r| {
52501                Ok(Self::ClaimClaimableBalanceResultCode(Box::new(
52502                    ClaimClaimableBalanceResultCode::read_xdr(r)?,
52503                )))
52504            }),
52505            TypeVariant::ClaimClaimableBalanceResult => r.with_limited_depth(|r| {
52506                Ok(Self::ClaimClaimableBalanceResult(Box::new(
52507                    ClaimClaimableBalanceResult::read_xdr(r)?,
52508                )))
52509            }),
52510            TypeVariant::BeginSponsoringFutureReservesResultCode => r.with_limited_depth(|r| {
52511                Ok(Self::BeginSponsoringFutureReservesResultCode(Box::new(
52512                    BeginSponsoringFutureReservesResultCode::read_xdr(r)?,
52513                )))
52514            }),
52515            TypeVariant::BeginSponsoringFutureReservesResult => r.with_limited_depth(|r| {
52516                Ok(Self::BeginSponsoringFutureReservesResult(Box::new(
52517                    BeginSponsoringFutureReservesResult::read_xdr(r)?,
52518                )))
52519            }),
52520            TypeVariant::EndSponsoringFutureReservesResultCode => r.with_limited_depth(|r| {
52521                Ok(Self::EndSponsoringFutureReservesResultCode(Box::new(
52522                    EndSponsoringFutureReservesResultCode::read_xdr(r)?,
52523                )))
52524            }),
52525            TypeVariant::EndSponsoringFutureReservesResult => r.with_limited_depth(|r| {
52526                Ok(Self::EndSponsoringFutureReservesResult(Box::new(
52527                    EndSponsoringFutureReservesResult::read_xdr(r)?,
52528                )))
52529            }),
52530            TypeVariant::RevokeSponsorshipResultCode => r.with_limited_depth(|r| {
52531                Ok(Self::RevokeSponsorshipResultCode(Box::new(
52532                    RevokeSponsorshipResultCode::read_xdr(r)?,
52533                )))
52534            }),
52535            TypeVariant::RevokeSponsorshipResult => r.with_limited_depth(|r| {
52536                Ok(Self::RevokeSponsorshipResult(Box::new(
52537                    RevokeSponsorshipResult::read_xdr(r)?,
52538                )))
52539            }),
52540            TypeVariant::ClawbackResultCode => r.with_limited_depth(|r| {
52541                Ok(Self::ClawbackResultCode(Box::new(
52542                    ClawbackResultCode::read_xdr(r)?,
52543                )))
52544            }),
52545            TypeVariant::ClawbackResult => r.with_limited_depth(|r| {
52546                Ok(Self::ClawbackResult(Box::new(ClawbackResult::read_xdr(r)?)))
52547            }),
52548            TypeVariant::ClawbackClaimableBalanceResultCode => r.with_limited_depth(|r| {
52549                Ok(Self::ClawbackClaimableBalanceResultCode(Box::new(
52550                    ClawbackClaimableBalanceResultCode::read_xdr(r)?,
52551                )))
52552            }),
52553            TypeVariant::ClawbackClaimableBalanceResult => r.with_limited_depth(|r| {
52554                Ok(Self::ClawbackClaimableBalanceResult(Box::new(
52555                    ClawbackClaimableBalanceResult::read_xdr(r)?,
52556                )))
52557            }),
52558            TypeVariant::SetTrustLineFlagsResultCode => r.with_limited_depth(|r| {
52559                Ok(Self::SetTrustLineFlagsResultCode(Box::new(
52560                    SetTrustLineFlagsResultCode::read_xdr(r)?,
52561                )))
52562            }),
52563            TypeVariant::SetTrustLineFlagsResult => r.with_limited_depth(|r| {
52564                Ok(Self::SetTrustLineFlagsResult(Box::new(
52565                    SetTrustLineFlagsResult::read_xdr(r)?,
52566                )))
52567            }),
52568            TypeVariant::LiquidityPoolDepositResultCode => r.with_limited_depth(|r| {
52569                Ok(Self::LiquidityPoolDepositResultCode(Box::new(
52570                    LiquidityPoolDepositResultCode::read_xdr(r)?,
52571                )))
52572            }),
52573            TypeVariant::LiquidityPoolDepositResult => r.with_limited_depth(|r| {
52574                Ok(Self::LiquidityPoolDepositResult(Box::new(
52575                    LiquidityPoolDepositResult::read_xdr(r)?,
52576                )))
52577            }),
52578            TypeVariant::LiquidityPoolWithdrawResultCode => r.with_limited_depth(|r| {
52579                Ok(Self::LiquidityPoolWithdrawResultCode(Box::new(
52580                    LiquidityPoolWithdrawResultCode::read_xdr(r)?,
52581                )))
52582            }),
52583            TypeVariant::LiquidityPoolWithdrawResult => r.with_limited_depth(|r| {
52584                Ok(Self::LiquidityPoolWithdrawResult(Box::new(
52585                    LiquidityPoolWithdrawResult::read_xdr(r)?,
52586                )))
52587            }),
52588            TypeVariant::InvokeHostFunctionResultCode => r.with_limited_depth(|r| {
52589                Ok(Self::InvokeHostFunctionResultCode(Box::new(
52590                    InvokeHostFunctionResultCode::read_xdr(r)?,
52591                )))
52592            }),
52593            TypeVariant::InvokeHostFunctionResult => r.with_limited_depth(|r| {
52594                Ok(Self::InvokeHostFunctionResult(Box::new(
52595                    InvokeHostFunctionResult::read_xdr(r)?,
52596                )))
52597            }),
52598            TypeVariant::ExtendFootprintTtlResultCode => r.with_limited_depth(|r| {
52599                Ok(Self::ExtendFootprintTtlResultCode(Box::new(
52600                    ExtendFootprintTtlResultCode::read_xdr(r)?,
52601                )))
52602            }),
52603            TypeVariant::ExtendFootprintTtlResult => r.with_limited_depth(|r| {
52604                Ok(Self::ExtendFootprintTtlResult(Box::new(
52605                    ExtendFootprintTtlResult::read_xdr(r)?,
52606                )))
52607            }),
52608            TypeVariant::RestoreFootprintResultCode => r.with_limited_depth(|r| {
52609                Ok(Self::RestoreFootprintResultCode(Box::new(
52610                    RestoreFootprintResultCode::read_xdr(r)?,
52611                )))
52612            }),
52613            TypeVariant::RestoreFootprintResult => r.with_limited_depth(|r| {
52614                Ok(Self::RestoreFootprintResult(Box::new(
52615                    RestoreFootprintResult::read_xdr(r)?,
52616                )))
52617            }),
52618            TypeVariant::OperationResultCode => r.with_limited_depth(|r| {
52619                Ok(Self::OperationResultCode(Box::new(
52620                    OperationResultCode::read_xdr(r)?,
52621                )))
52622            }),
52623            TypeVariant::OperationResult => r.with_limited_depth(|r| {
52624                Ok(Self::OperationResult(Box::new(OperationResult::read_xdr(
52625                    r,
52626                )?)))
52627            }),
52628            TypeVariant::OperationResultTr => r.with_limited_depth(|r| {
52629                Ok(Self::OperationResultTr(Box::new(
52630                    OperationResultTr::read_xdr(r)?,
52631                )))
52632            }),
52633            TypeVariant::TransactionResultCode => r.with_limited_depth(|r| {
52634                Ok(Self::TransactionResultCode(Box::new(
52635                    TransactionResultCode::read_xdr(r)?,
52636                )))
52637            }),
52638            TypeVariant::InnerTransactionResult => r.with_limited_depth(|r| {
52639                Ok(Self::InnerTransactionResult(Box::new(
52640                    InnerTransactionResult::read_xdr(r)?,
52641                )))
52642            }),
52643            TypeVariant::InnerTransactionResultResult => r.with_limited_depth(|r| {
52644                Ok(Self::InnerTransactionResultResult(Box::new(
52645                    InnerTransactionResultResult::read_xdr(r)?,
52646                )))
52647            }),
52648            TypeVariant::InnerTransactionResultExt => r.with_limited_depth(|r| {
52649                Ok(Self::InnerTransactionResultExt(Box::new(
52650                    InnerTransactionResultExt::read_xdr(r)?,
52651                )))
52652            }),
52653            TypeVariant::InnerTransactionResultPair => r.with_limited_depth(|r| {
52654                Ok(Self::InnerTransactionResultPair(Box::new(
52655                    InnerTransactionResultPair::read_xdr(r)?,
52656                )))
52657            }),
52658            TypeVariant::TransactionResult => r.with_limited_depth(|r| {
52659                Ok(Self::TransactionResult(Box::new(
52660                    TransactionResult::read_xdr(r)?,
52661                )))
52662            }),
52663            TypeVariant::TransactionResultResult => r.with_limited_depth(|r| {
52664                Ok(Self::TransactionResultResult(Box::new(
52665                    TransactionResultResult::read_xdr(r)?,
52666                )))
52667            }),
52668            TypeVariant::TransactionResultExt => r.with_limited_depth(|r| {
52669                Ok(Self::TransactionResultExt(Box::new(
52670                    TransactionResultExt::read_xdr(r)?,
52671                )))
52672            }),
52673            TypeVariant::Hash => {
52674                r.with_limited_depth(|r| Ok(Self::Hash(Box::new(Hash::read_xdr(r)?))))
52675            }
52676            TypeVariant::Uint256 => {
52677                r.with_limited_depth(|r| Ok(Self::Uint256(Box::new(Uint256::read_xdr(r)?))))
52678            }
52679            TypeVariant::Uint32 => {
52680                r.with_limited_depth(|r| Ok(Self::Uint32(Box::new(Uint32::read_xdr(r)?))))
52681            }
52682            TypeVariant::Int32 => {
52683                r.with_limited_depth(|r| Ok(Self::Int32(Box::new(Int32::read_xdr(r)?))))
52684            }
52685            TypeVariant::Uint64 => {
52686                r.with_limited_depth(|r| Ok(Self::Uint64(Box::new(Uint64::read_xdr(r)?))))
52687            }
52688            TypeVariant::Int64 => {
52689                r.with_limited_depth(|r| Ok(Self::Int64(Box::new(Int64::read_xdr(r)?))))
52690            }
52691            TypeVariant::TimePoint => {
52692                r.with_limited_depth(|r| Ok(Self::TimePoint(Box::new(TimePoint::read_xdr(r)?))))
52693            }
52694            TypeVariant::Duration => {
52695                r.with_limited_depth(|r| Ok(Self::Duration(Box::new(Duration::read_xdr(r)?))))
52696            }
52697            TypeVariant::ExtensionPoint => r.with_limited_depth(|r| {
52698                Ok(Self::ExtensionPoint(Box::new(ExtensionPoint::read_xdr(r)?)))
52699            }),
52700            TypeVariant::CryptoKeyType => r.with_limited_depth(|r| {
52701                Ok(Self::CryptoKeyType(Box::new(CryptoKeyType::read_xdr(r)?)))
52702            }),
52703            TypeVariant::PublicKeyType => r.with_limited_depth(|r| {
52704                Ok(Self::PublicKeyType(Box::new(PublicKeyType::read_xdr(r)?)))
52705            }),
52706            TypeVariant::SignerKeyType => r.with_limited_depth(|r| {
52707                Ok(Self::SignerKeyType(Box::new(SignerKeyType::read_xdr(r)?)))
52708            }),
52709            TypeVariant::PublicKey => {
52710                r.with_limited_depth(|r| Ok(Self::PublicKey(Box::new(PublicKey::read_xdr(r)?))))
52711            }
52712            TypeVariant::SignerKey => {
52713                r.with_limited_depth(|r| Ok(Self::SignerKey(Box::new(SignerKey::read_xdr(r)?))))
52714            }
52715            TypeVariant::SignerKeyEd25519SignedPayload => r.with_limited_depth(|r| {
52716                Ok(Self::SignerKeyEd25519SignedPayload(Box::new(
52717                    SignerKeyEd25519SignedPayload::read_xdr(r)?,
52718                )))
52719            }),
52720            TypeVariant::Signature => {
52721                r.with_limited_depth(|r| Ok(Self::Signature(Box::new(Signature::read_xdr(r)?))))
52722            }
52723            TypeVariant::SignatureHint => r.with_limited_depth(|r| {
52724                Ok(Self::SignatureHint(Box::new(SignatureHint::read_xdr(r)?)))
52725            }),
52726            TypeVariant::NodeId => {
52727                r.with_limited_depth(|r| Ok(Self::NodeId(Box::new(NodeId::read_xdr(r)?))))
52728            }
52729            TypeVariant::AccountId => {
52730                r.with_limited_depth(|r| Ok(Self::AccountId(Box::new(AccountId::read_xdr(r)?))))
52731            }
52732            TypeVariant::Curve25519Secret => r.with_limited_depth(|r| {
52733                Ok(Self::Curve25519Secret(Box::new(
52734                    Curve25519Secret::read_xdr(r)?,
52735                )))
52736            }),
52737            TypeVariant::Curve25519Public => r.with_limited_depth(|r| {
52738                Ok(Self::Curve25519Public(Box::new(
52739                    Curve25519Public::read_xdr(r)?,
52740                )))
52741            }),
52742            TypeVariant::HmacSha256Key => r.with_limited_depth(|r| {
52743                Ok(Self::HmacSha256Key(Box::new(HmacSha256Key::read_xdr(r)?)))
52744            }),
52745            TypeVariant::HmacSha256Mac => r.with_limited_depth(|r| {
52746                Ok(Self::HmacSha256Mac(Box::new(HmacSha256Mac::read_xdr(r)?)))
52747            }),
52748            TypeVariant::ShortHashSeed => r.with_limited_depth(|r| {
52749                Ok(Self::ShortHashSeed(Box::new(ShortHashSeed::read_xdr(r)?)))
52750            }),
52751            TypeVariant::BinaryFuseFilterType => r.with_limited_depth(|r| {
52752                Ok(Self::BinaryFuseFilterType(Box::new(
52753                    BinaryFuseFilterType::read_xdr(r)?,
52754                )))
52755            }),
52756            TypeVariant::SerializedBinaryFuseFilter => r.with_limited_depth(|r| {
52757                Ok(Self::SerializedBinaryFuseFilter(Box::new(
52758                    SerializedBinaryFuseFilter::read_xdr(r)?,
52759                )))
52760            }),
52761        }
52762    }
52763
52764    #[cfg(feature = "base64")]
52765    pub fn read_xdr_base64<R: Read>(v: TypeVariant, r: &mut Limited<R>) -> Result<Self> {
52766        let mut dec = Limited::new(
52767            base64::read::DecoderReader::new(&mut r.inner, base64::STANDARD),
52768            r.limits.clone(),
52769        );
52770        let t = Self::read_xdr(v, &mut dec)?;
52771        Ok(t)
52772    }
52773
52774    #[cfg(feature = "std")]
52775    pub fn read_xdr_to_end<R: Read>(v: TypeVariant, r: &mut Limited<R>) -> Result<Self> {
52776        let s = Self::read_xdr(v, r)?;
52777        // Check that any further reads, such as this read of one byte, read no
52778        // data, indicating EOF. If a byte is read the data is invalid.
52779        if r.read(&mut [0u8; 1])? == 0 {
52780            Ok(s)
52781        } else {
52782            Err(Error::Invalid)
52783        }
52784    }
52785
52786    #[cfg(feature = "base64")]
52787    pub fn read_xdr_base64_to_end<R: Read>(v: TypeVariant, r: &mut Limited<R>) -> Result<Self> {
52788        let mut dec = Limited::new(
52789            base64::read::DecoderReader::new(&mut r.inner, base64::STANDARD),
52790            r.limits.clone(),
52791        );
52792        let t = Self::read_xdr_to_end(v, &mut dec)?;
52793        Ok(t)
52794    }
52795
52796    #[cfg(feature = "std")]
52797    #[allow(clippy::too_many_lines)]
52798    pub fn read_xdr_iter<R: Read>(
52799        v: TypeVariant,
52800        r: &mut Limited<R>,
52801    ) -> Box<dyn Iterator<Item = Result<Self>> + '_> {
52802        match v {
52803            TypeVariant::Value => Box::new(
52804                ReadXdrIter::<_, Value>::new(&mut r.inner, r.limits.clone())
52805                    .map(|r| r.map(|t| Self::Value(Box::new(t)))),
52806            ),
52807            TypeVariant::ScpBallot => Box::new(
52808                ReadXdrIter::<_, ScpBallot>::new(&mut r.inner, r.limits.clone())
52809                    .map(|r| r.map(|t| Self::ScpBallot(Box::new(t)))),
52810            ),
52811            TypeVariant::ScpStatementType => Box::new(
52812                ReadXdrIter::<_, ScpStatementType>::new(&mut r.inner, r.limits.clone())
52813                    .map(|r| r.map(|t| Self::ScpStatementType(Box::new(t)))),
52814            ),
52815            TypeVariant::ScpNomination => Box::new(
52816                ReadXdrIter::<_, ScpNomination>::new(&mut r.inner, r.limits.clone())
52817                    .map(|r| r.map(|t| Self::ScpNomination(Box::new(t)))),
52818            ),
52819            TypeVariant::ScpStatement => Box::new(
52820                ReadXdrIter::<_, ScpStatement>::new(&mut r.inner, r.limits.clone())
52821                    .map(|r| r.map(|t| Self::ScpStatement(Box::new(t)))),
52822            ),
52823            TypeVariant::ScpStatementPledges => Box::new(
52824                ReadXdrIter::<_, ScpStatementPledges>::new(&mut r.inner, r.limits.clone())
52825                    .map(|r| r.map(|t| Self::ScpStatementPledges(Box::new(t)))),
52826            ),
52827            TypeVariant::ScpStatementPrepare => Box::new(
52828                ReadXdrIter::<_, ScpStatementPrepare>::new(&mut r.inner, r.limits.clone())
52829                    .map(|r| r.map(|t| Self::ScpStatementPrepare(Box::new(t)))),
52830            ),
52831            TypeVariant::ScpStatementConfirm => Box::new(
52832                ReadXdrIter::<_, ScpStatementConfirm>::new(&mut r.inner, r.limits.clone())
52833                    .map(|r| r.map(|t| Self::ScpStatementConfirm(Box::new(t)))),
52834            ),
52835            TypeVariant::ScpStatementExternalize => Box::new(
52836                ReadXdrIter::<_, ScpStatementExternalize>::new(&mut r.inner, r.limits.clone())
52837                    .map(|r| r.map(|t| Self::ScpStatementExternalize(Box::new(t)))),
52838            ),
52839            TypeVariant::ScpEnvelope => Box::new(
52840                ReadXdrIter::<_, ScpEnvelope>::new(&mut r.inner, r.limits.clone())
52841                    .map(|r| r.map(|t| Self::ScpEnvelope(Box::new(t)))),
52842            ),
52843            TypeVariant::ScpQuorumSet => Box::new(
52844                ReadXdrIter::<_, ScpQuorumSet>::new(&mut r.inner, r.limits.clone())
52845                    .map(|r| r.map(|t| Self::ScpQuorumSet(Box::new(t)))),
52846            ),
52847            TypeVariant::ConfigSettingContractExecutionLanesV0 => Box::new(
52848                ReadXdrIter::<_, ConfigSettingContractExecutionLanesV0>::new(
52849                    &mut r.inner,
52850                    r.limits.clone(),
52851                )
52852                .map(|r| r.map(|t| Self::ConfigSettingContractExecutionLanesV0(Box::new(t)))),
52853            ),
52854            TypeVariant::ConfigSettingContractComputeV0 => Box::new(
52855                ReadXdrIter::<_, ConfigSettingContractComputeV0>::new(
52856                    &mut r.inner,
52857                    r.limits.clone(),
52858                )
52859                .map(|r| r.map(|t| Self::ConfigSettingContractComputeV0(Box::new(t)))),
52860            ),
52861            TypeVariant::ConfigSettingContractLedgerCostV0 => Box::new(
52862                ReadXdrIter::<_, ConfigSettingContractLedgerCostV0>::new(
52863                    &mut r.inner,
52864                    r.limits.clone(),
52865                )
52866                .map(|r| r.map(|t| Self::ConfigSettingContractLedgerCostV0(Box::new(t)))),
52867            ),
52868            TypeVariant::ConfigSettingContractHistoricalDataV0 => Box::new(
52869                ReadXdrIter::<_, ConfigSettingContractHistoricalDataV0>::new(
52870                    &mut r.inner,
52871                    r.limits.clone(),
52872                )
52873                .map(|r| r.map(|t| Self::ConfigSettingContractHistoricalDataV0(Box::new(t)))),
52874            ),
52875            TypeVariant::ConfigSettingContractEventsV0 => Box::new(
52876                ReadXdrIter::<_, ConfigSettingContractEventsV0>::new(
52877                    &mut r.inner,
52878                    r.limits.clone(),
52879                )
52880                .map(|r| r.map(|t| Self::ConfigSettingContractEventsV0(Box::new(t)))),
52881            ),
52882            TypeVariant::ConfigSettingContractBandwidthV0 => Box::new(
52883                ReadXdrIter::<_, ConfigSettingContractBandwidthV0>::new(
52884                    &mut r.inner,
52885                    r.limits.clone(),
52886                )
52887                .map(|r| r.map(|t| Self::ConfigSettingContractBandwidthV0(Box::new(t)))),
52888            ),
52889            TypeVariant::ContractCostType => Box::new(
52890                ReadXdrIter::<_, ContractCostType>::new(&mut r.inner, r.limits.clone())
52891                    .map(|r| r.map(|t| Self::ContractCostType(Box::new(t)))),
52892            ),
52893            TypeVariant::ContractCostParamEntry => Box::new(
52894                ReadXdrIter::<_, ContractCostParamEntry>::new(&mut r.inner, r.limits.clone())
52895                    .map(|r| r.map(|t| Self::ContractCostParamEntry(Box::new(t)))),
52896            ),
52897            TypeVariant::StateArchivalSettings => Box::new(
52898                ReadXdrIter::<_, StateArchivalSettings>::new(&mut r.inner, r.limits.clone())
52899                    .map(|r| r.map(|t| Self::StateArchivalSettings(Box::new(t)))),
52900            ),
52901            TypeVariant::EvictionIterator => Box::new(
52902                ReadXdrIter::<_, EvictionIterator>::new(&mut r.inner, r.limits.clone())
52903                    .map(|r| r.map(|t| Self::EvictionIterator(Box::new(t)))),
52904            ),
52905            TypeVariant::ContractCostParams => Box::new(
52906                ReadXdrIter::<_, ContractCostParams>::new(&mut r.inner, r.limits.clone())
52907                    .map(|r| r.map(|t| Self::ContractCostParams(Box::new(t)))),
52908            ),
52909            TypeVariant::ConfigSettingId => Box::new(
52910                ReadXdrIter::<_, ConfigSettingId>::new(&mut r.inner, r.limits.clone())
52911                    .map(|r| r.map(|t| Self::ConfigSettingId(Box::new(t)))),
52912            ),
52913            TypeVariant::ConfigSettingEntry => Box::new(
52914                ReadXdrIter::<_, ConfigSettingEntry>::new(&mut r.inner, r.limits.clone())
52915                    .map(|r| r.map(|t| Self::ConfigSettingEntry(Box::new(t)))),
52916            ),
52917            TypeVariant::ScEnvMetaKind => Box::new(
52918                ReadXdrIter::<_, ScEnvMetaKind>::new(&mut r.inner, r.limits.clone())
52919                    .map(|r| r.map(|t| Self::ScEnvMetaKind(Box::new(t)))),
52920            ),
52921            TypeVariant::ScEnvMetaEntry => Box::new(
52922                ReadXdrIter::<_, ScEnvMetaEntry>::new(&mut r.inner, r.limits.clone())
52923                    .map(|r| r.map(|t| Self::ScEnvMetaEntry(Box::new(t)))),
52924            ),
52925            TypeVariant::ScEnvMetaEntryInterfaceVersion => Box::new(
52926                ReadXdrIter::<_, ScEnvMetaEntryInterfaceVersion>::new(
52927                    &mut r.inner,
52928                    r.limits.clone(),
52929                )
52930                .map(|r| r.map(|t| Self::ScEnvMetaEntryInterfaceVersion(Box::new(t)))),
52931            ),
52932            TypeVariant::ScMetaV0 => Box::new(
52933                ReadXdrIter::<_, ScMetaV0>::new(&mut r.inner, r.limits.clone())
52934                    .map(|r| r.map(|t| Self::ScMetaV0(Box::new(t)))),
52935            ),
52936            TypeVariant::ScMetaKind => Box::new(
52937                ReadXdrIter::<_, ScMetaKind>::new(&mut r.inner, r.limits.clone())
52938                    .map(|r| r.map(|t| Self::ScMetaKind(Box::new(t)))),
52939            ),
52940            TypeVariant::ScMetaEntry => Box::new(
52941                ReadXdrIter::<_, ScMetaEntry>::new(&mut r.inner, r.limits.clone())
52942                    .map(|r| r.map(|t| Self::ScMetaEntry(Box::new(t)))),
52943            ),
52944            TypeVariant::ScSpecType => Box::new(
52945                ReadXdrIter::<_, ScSpecType>::new(&mut r.inner, r.limits.clone())
52946                    .map(|r| r.map(|t| Self::ScSpecType(Box::new(t)))),
52947            ),
52948            TypeVariant::ScSpecTypeOption => Box::new(
52949                ReadXdrIter::<_, ScSpecTypeOption>::new(&mut r.inner, r.limits.clone())
52950                    .map(|r| r.map(|t| Self::ScSpecTypeOption(Box::new(t)))),
52951            ),
52952            TypeVariant::ScSpecTypeResult => Box::new(
52953                ReadXdrIter::<_, ScSpecTypeResult>::new(&mut r.inner, r.limits.clone())
52954                    .map(|r| r.map(|t| Self::ScSpecTypeResult(Box::new(t)))),
52955            ),
52956            TypeVariant::ScSpecTypeVec => Box::new(
52957                ReadXdrIter::<_, ScSpecTypeVec>::new(&mut r.inner, r.limits.clone())
52958                    .map(|r| r.map(|t| Self::ScSpecTypeVec(Box::new(t)))),
52959            ),
52960            TypeVariant::ScSpecTypeMap => Box::new(
52961                ReadXdrIter::<_, ScSpecTypeMap>::new(&mut r.inner, r.limits.clone())
52962                    .map(|r| r.map(|t| Self::ScSpecTypeMap(Box::new(t)))),
52963            ),
52964            TypeVariant::ScSpecTypeTuple => Box::new(
52965                ReadXdrIter::<_, ScSpecTypeTuple>::new(&mut r.inner, r.limits.clone())
52966                    .map(|r| r.map(|t| Self::ScSpecTypeTuple(Box::new(t)))),
52967            ),
52968            TypeVariant::ScSpecTypeBytesN => Box::new(
52969                ReadXdrIter::<_, ScSpecTypeBytesN>::new(&mut r.inner, r.limits.clone())
52970                    .map(|r| r.map(|t| Self::ScSpecTypeBytesN(Box::new(t)))),
52971            ),
52972            TypeVariant::ScSpecTypeUdt => Box::new(
52973                ReadXdrIter::<_, ScSpecTypeUdt>::new(&mut r.inner, r.limits.clone())
52974                    .map(|r| r.map(|t| Self::ScSpecTypeUdt(Box::new(t)))),
52975            ),
52976            TypeVariant::ScSpecTypeDef => Box::new(
52977                ReadXdrIter::<_, ScSpecTypeDef>::new(&mut r.inner, r.limits.clone())
52978                    .map(|r| r.map(|t| Self::ScSpecTypeDef(Box::new(t)))),
52979            ),
52980            TypeVariant::ScSpecUdtStructFieldV0 => Box::new(
52981                ReadXdrIter::<_, ScSpecUdtStructFieldV0>::new(&mut r.inner, r.limits.clone())
52982                    .map(|r| r.map(|t| Self::ScSpecUdtStructFieldV0(Box::new(t)))),
52983            ),
52984            TypeVariant::ScSpecUdtStructV0 => Box::new(
52985                ReadXdrIter::<_, ScSpecUdtStructV0>::new(&mut r.inner, r.limits.clone())
52986                    .map(|r| r.map(|t| Self::ScSpecUdtStructV0(Box::new(t)))),
52987            ),
52988            TypeVariant::ScSpecUdtUnionCaseVoidV0 => Box::new(
52989                ReadXdrIter::<_, ScSpecUdtUnionCaseVoidV0>::new(&mut r.inner, r.limits.clone())
52990                    .map(|r| r.map(|t| Self::ScSpecUdtUnionCaseVoidV0(Box::new(t)))),
52991            ),
52992            TypeVariant::ScSpecUdtUnionCaseTupleV0 => Box::new(
52993                ReadXdrIter::<_, ScSpecUdtUnionCaseTupleV0>::new(&mut r.inner, r.limits.clone())
52994                    .map(|r| r.map(|t| Self::ScSpecUdtUnionCaseTupleV0(Box::new(t)))),
52995            ),
52996            TypeVariant::ScSpecUdtUnionCaseV0Kind => Box::new(
52997                ReadXdrIter::<_, ScSpecUdtUnionCaseV0Kind>::new(&mut r.inner, r.limits.clone())
52998                    .map(|r| r.map(|t| Self::ScSpecUdtUnionCaseV0Kind(Box::new(t)))),
52999            ),
53000            TypeVariant::ScSpecUdtUnionCaseV0 => Box::new(
53001                ReadXdrIter::<_, ScSpecUdtUnionCaseV0>::new(&mut r.inner, r.limits.clone())
53002                    .map(|r| r.map(|t| Self::ScSpecUdtUnionCaseV0(Box::new(t)))),
53003            ),
53004            TypeVariant::ScSpecUdtUnionV0 => Box::new(
53005                ReadXdrIter::<_, ScSpecUdtUnionV0>::new(&mut r.inner, r.limits.clone())
53006                    .map(|r| r.map(|t| Self::ScSpecUdtUnionV0(Box::new(t)))),
53007            ),
53008            TypeVariant::ScSpecUdtEnumCaseV0 => Box::new(
53009                ReadXdrIter::<_, ScSpecUdtEnumCaseV0>::new(&mut r.inner, r.limits.clone())
53010                    .map(|r| r.map(|t| Self::ScSpecUdtEnumCaseV0(Box::new(t)))),
53011            ),
53012            TypeVariant::ScSpecUdtEnumV0 => Box::new(
53013                ReadXdrIter::<_, ScSpecUdtEnumV0>::new(&mut r.inner, r.limits.clone())
53014                    .map(|r| r.map(|t| Self::ScSpecUdtEnumV0(Box::new(t)))),
53015            ),
53016            TypeVariant::ScSpecUdtErrorEnumCaseV0 => Box::new(
53017                ReadXdrIter::<_, ScSpecUdtErrorEnumCaseV0>::new(&mut r.inner, r.limits.clone())
53018                    .map(|r| r.map(|t| Self::ScSpecUdtErrorEnumCaseV0(Box::new(t)))),
53019            ),
53020            TypeVariant::ScSpecUdtErrorEnumV0 => Box::new(
53021                ReadXdrIter::<_, ScSpecUdtErrorEnumV0>::new(&mut r.inner, r.limits.clone())
53022                    .map(|r| r.map(|t| Self::ScSpecUdtErrorEnumV0(Box::new(t)))),
53023            ),
53024            TypeVariant::ScSpecFunctionInputV0 => Box::new(
53025                ReadXdrIter::<_, ScSpecFunctionInputV0>::new(&mut r.inner, r.limits.clone())
53026                    .map(|r| r.map(|t| Self::ScSpecFunctionInputV0(Box::new(t)))),
53027            ),
53028            TypeVariant::ScSpecFunctionV0 => Box::new(
53029                ReadXdrIter::<_, ScSpecFunctionV0>::new(&mut r.inner, r.limits.clone())
53030                    .map(|r| r.map(|t| Self::ScSpecFunctionV0(Box::new(t)))),
53031            ),
53032            TypeVariant::ScSpecEntryKind => Box::new(
53033                ReadXdrIter::<_, ScSpecEntryKind>::new(&mut r.inner, r.limits.clone())
53034                    .map(|r| r.map(|t| Self::ScSpecEntryKind(Box::new(t)))),
53035            ),
53036            TypeVariant::ScSpecEntry => Box::new(
53037                ReadXdrIter::<_, ScSpecEntry>::new(&mut r.inner, r.limits.clone())
53038                    .map(|r| r.map(|t| Self::ScSpecEntry(Box::new(t)))),
53039            ),
53040            TypeVariant::ScValType => Box::new(
53041                ReadXdrIter::<_, ScValType>::new(&mut r.inner, r.limits.clone())
53042                    .map(|r| r.map(|t| Self::ScValType(Box::new(t)))),
53043            ),
53044            TypeVariant::ScErrorType => Box::new(
53045                ReadXdrIter::<_, ScErrorType>::new(&mut r.inner, r.limits.clone())
53046                    .map(|r| r.map(|t| Self::ScErrorType(Box::new(t)))),
53047            ),
53048            TypeVariant::ScErrorCode => Box::new(
53049                ReadXdrIter::<_, ScErrorCode>::new(&mut r.inner, r.limits.clone())
53050                    .map(|r| r.map(|t| Self::ScErrorCode(Box::new(t)))),
53051            ),
53052            TypeVariant::ScError => Box::new(
53053                ReadXdrIter::<_, ScError>::new(&mut r.inner, r.limits.clone())
53054                    .map(|r| r.map(|t| Self::ScError(Box::new(t)))),
53055            ),
53056            TypeVariant::UInt128Parts => Box::new(
53057                ReadXdrIter::<_, UInt128Parts>::new(&mut r.inner, r.limits.clone())
53058                    .map(|r| r.map(|t| Self::UInt128Parts(Box::new(t)))),
53059            ),
53060            TypeVariant::Int128Parts => Box::new(
53061                ReadXdrIter::<_, Int128Parts>::new(&mut r.inner, r.limits.clone())
53062                    .map(|r| r.map(|t| Self::Int128Parts(Box::new(t)))),
53063            ),
53064            TypeVariant::UInt256Parts => Box::new(
53065                ReadXdrIter::<_, UInt256Parts>::new(&mut r.inner, r.limits.clone())
53066                    .map(|r| r.map(|t| Self::UInt256Parts(Box::new(t)))),
53067            ),
53068            TypeVariant::Int256Parts => Box::new(
53069                ReadXdrIter::<_, Int256Parts>::new(&mut r.inner, r.limits.clone())
53070                    .map(|r| r.map(|t| Self::Int256Parts(Box::new(t)))),
53071            ),
53072            TypeVariant::ContractExecutableType => Box::new(
53073                ReadXdrIter::<_, ContractExecutableType>::new(&mut r.inner, r.limits.clone())
53074                    .map(|r| r.map(|t| Self::ContractExecutableType(Box::new(t)))),
53075            ),
53076            TypeVariant::ContractExecutable => Box::new(
53077                ReadXdrIter::<_, ContractExecutable>::new(&mut r.inner, r.limits.clone())
53078                    .map(|r| r.map(|t| Self::ContractExecutable(Box::new(t)))),
53079            ),
53080            TypeVariant::ScAddressType => Box::new(
53081                ReadXdrIter::<_, ScAddressType>::new(&mut r.inner, r.limits.clone())
53082                    .map(|r| r.map(|t| Self::ScAddressType(Box::new(t)))),
53083            ),
53084            TypeVariant::ScAddress => Box::new(
53085                ReadXdrIter::<_, ScAddress>::new(&mut r.inner, r.limits.clone())
53086                    .map(|r| r.map(|t| Self::ScAddress(Box::new(t)))),
53087            ),
53088            TypeVariant::ScVec => Box::new(
53089                ReadXdrIter::<_, ScVec>::new(&mut r.inner, r.limits.clone())
53090                    .map(|r| r.map(|t| Self::ScVec(Box::new(t)))),
53091            ),
53092            TypeVariant::ScMap => Box::new(
53093                ReadXdrIter::<_, ScMap>::new(&mut r.inner, r.limits.clone())
53094                    .map(|r| r.map(|t| Self::ScMap(Box::new(t)))),
53095            ),
53096            TypeVariant::ScBytes => Box::new(
53097                ReadXdrIter::<_, ScBytes>::new(&mut r.inner, r.limits.clone())
53098                    .map(|r| r.map(|t| Self::ScBytes(Box::new(t)))),
53099            ),
53100            TypeVariant::ScString => Box::new(
53101                ReadXdrIter::<_, ScString>::new(&mut r.inner, r.limits.clone())
53102                    .map(|r| r.map(|t| Self::ScString(Box::new(t)))),
53103            ),
53104            TypeVariant::ScSymbol => Box::new(
53105                ReadXdrIter::<_, ScSymbol>::new(&mut r.inner, r.limits.clone())
53106                    .map(|r| r.map(|t| Self::ScSymbol(Box::new(t)))),
53107            ),
53108            TypeVariant::ScNonceKey => Box::new(
53109                ReadXdrIter::<_, ScNonceKey>::new(&mut r.inner, r.limits.clone())
53110                    .map(|r| r.map(|t| Self::ScNonceKey(Box::new(t)))),
53111            ),
53112            TypeVariant::ScContractInstance => Box::new(
53113                ReadXdrIter::<_, ScContractInstance>::new(&mut r.inner, r.limits.clone())
53114                    .map(|r| r.map(|t| Self::ScContractInstance(Box::new(t)))),
53115            ),
53116            TypeVariant::ScVal => Box::new(
53117                ReadXdrIter::<_, ScVal>::new(&mut r.inner, r.limits.clone())
53118                    .map(|r| r.map(|t| Self::ScVal(Box::new(t)))),
53119            ),
53120            TypeVariant::ScMapEntry => Box::new(
53121                ReadXdrIter::<_, ScMapEntry>::new(&mut r.inner, r.limits.clone())
53122                    .map(|r| r.map(|t| Self::ScMapEntry(Box::new(t)))),
53123            ),
53124            TypeVariant::StoredTransactionSet => Box::new(
53125                ReadXdrIter::<_, StoredTransactionSet>::new(&mut r.inner, r.limits.clone())
53126                    .map(|r| r.map(|t| Self::StoredTransactionSet(Box::new(t)))),
53127            ),
53128            TypeVariant::StoredDebugTransactionSet => Box::new(
53129                ReadXdrIter::<_, StoredDebugTransactionSet>::new(&mut r.inner, r.limits.clone())
53130                    .map(|r| r.map(|t| Self::StoredDebugTransactionSet(Box::new(t)))),
53131            ),
53132            TypeVariant::PersistedScpStateV0 => Box::new(
53133                ReadXdrIter::<_, PersistedScpStateV0>::new(&mut r.inner, r.limits.clone())
53134                    .map(|r| r.map(|t| Self::PersistedScpStateV0(Box::new(t)))),
53135            ),
53136            TypeVariant::PersistedScpStateV1 => Box::new(
53137                ReadXdrIter::<_, PersistedScpStateV1>::new(&mut r.inner, r.limits.clone())
53138                    .map(|r| r.map(|t| Self::PersistedScpStateV1(Box::new(t)))),
53139            ),
53140            TypeVariant::PersistedScpState => Box::new(
53141                ReadXdrIter::<_, PersistedScpState>::new(&mut r.inner, r.limits.clone())
53142                    .map(|r| r.map(|t| Self::PersistedScpState(Box::new(t)))),
53143            ),
53144            TypeVariant::Thresholds => Box::new(
53145                ReadXdrIter::<_, Thresholds>::new(&mut r.inner, r.limits.clone())
53146                    .map(|r| r.map(|t| Self::Thresholds(Box::new(t)))),
53147            ),
53148            TypeVariant::String32 => Box::new(
53149                ReadXdrIter::<_, String32>::new(&mut r.inner, r.limits.clone())
53150                    .map(|r| r.map(|t| Self::String32(Box::new(t)))),
53151            ),
53152            TypeVariant::String64 => Box::new(
53153                ReadXdrIter::<_, String64>::new(&mut r.inner, r.limits.clone())
53154                    .map(|r| r.map(|t| Self::String64(Box::new(t)))),
53155            ),
53156            TypeVariant::SequenceNumber => Box::new(
53157                ReadXdrIter::<_, SequenceNumber>::new(&mut r.inner, r.limits.clone())
53158                    .map(|r| r.map(|t| Self::SequenceNumber(Box::new(t)))),
53159            ),
53160            TypeVariant::DataValue => Box::new(
53161                ReadXdrIter::<_, DataValue>::new(&mut r.inner, r.limits.clone())
53162                    .map(|r| r.map(|t| Self::DataValue(Box::new(t)))),
53163            ),
53164            TypeVariant::PoolId => Box::new(
53165                ReadXdrIter::<_, PoolId>::new(&mut r.inner, r.limits.clone())
53166                    .map(|r| r.map(|t| Self::PoolId(Box::new(t)))),
53167            ),
53168            TypeVariant::AssetCode4 => Box::new(
53169                ReadXdrIter::<_, AssetCode4>::new(&mut r.inner, r.limits.clone())
53170                    .map(|r| r.map(|t| Self::AssetCode4(Box::new(t)))),
53171            ),
53172            TypeVariant::AssetCode12 => Box::new(
53173                ReadXdrIter::<_, AssetCode12>::new(&mut r.inner, r.limits.clone())
53174                    .map(|r| r.map(|t| Self::AssetCode12(Box::new(t)))),
53175            ),
53176            TypeVariant::AssetType => Box::new(
53177                ReadXdrIter::<_, AssetType>::new(&mut r.inner, r.limits.clone())
53178                    .map(|r| r.map(|t| Self::AssetType(Box::new(t)))),
53179            ),
53180            TypeVariant::AssetCode => Box::new(
53181                ReadXdrIter::<_, AssetCode>::new(&mut r.inner, r.limits.clone())
53182                    .map(|r| r.map(|t| Self::AssetCode(Box::new(t)))),
53183            ),
53184            TypeVariant::AlphaNum4 => Box::new(
53185                ReadXdrIter::<_, AlphaNum4>::new(&mut r.inner, r.limits.clone())
53186                    .map(|r| r.map(|t| Self::AlphaNum4(Box::new(t)))),
53187            ),
53188            TypeVariant::AlphaNum12 => Box::new(
53189                ReadXdrIter::<_, AlphaNum12>::new(&mut r.inner, r.limits.clone())
53190                    .map(|r| r.map(|t| Self::AlphaNum12(Box::new(t)))),
53191            ),
53192            TypeVariant::Asset => Box::new(
53193                ReadXdrIter::<_, Asset>::new(&mut r.inner, r.limits.clone())
53194                    .map(|r| r.map(|t| Self::Asset(Box::new(t)))),
53195            ),
53196            TypeVariant::Price => Box::new(
53197                ReadXdrIter::<_, Price>::new(&mut r.inner, r.limits.clone())
53198                    .map(|r| r.map(|t| Self::Price(Box::new(t)))),
53199            ),
53200            TypeVariant::Liabilities => Box::new(
53201                ReadXdrIter::<_, Liabilities>::new(&mut r.inner, r.limits.clone())
53202                    .map(|r| r.map(|t| Self::Liabilities(Box::new(t)))),
53203            ),
53204            TypeVariant::ThresholdIndexes => Box::new(
53205                ReadXdrIter::<_, ThresholdIndexes>::new(&mut r.inner, r.limits.clone())
53206                    .map(|r| r.map(|t| Self::ThresholdIndexes(Box::new(t)))),
53207            ),
53208            TypeVariant::LedgerEntryType => Box::new(
53209                ReadXdrIter::<_, LedgerEntryType>::new(&mut r.inner, r.limits.clone())
53210                    .map(|r| r.map(|t| Self::LedgerEntryType(Box::new(t)))),
53211            ),
53212            TypeVariant::Signer => Box::new(
53213                ReadXdrIter::<_, Signer>::new(&mut r.inner, r.limits.clone())
53214                    .map(|r| r.map(|t| Self::Signer(Box::new(t)))),
53215            ),
53216            TypeVariant::AccountFlags => Box::new(
53217                ReadXdrIter::<_, AccountFlags>::new(&mut r.inner, r.limits.clone())
53218                    .map(|r| r.map(|t| Self::AccountFlags(Box::new(t)))),
53219            ),
53220            TypeVariant::SponsorshipDescriptor => Box::new(
53221                ReadXdrIter::<_, SponsorshipDescriptor>::new(&mut r.inner, r.limits.clone())
53222                    .map(|r| r.map(|t| Self::SponsorshipDescriptor(Box::new(t)))),
53223            ),
53224            TypeVariant::AccountEntryExtensionV3 => Box::new(
53225                ReadXdrIter::<_, AccountEntryExtensionV3>::new(&mut r.inner, r.limits.clone())
53226                    .map(|r| r.map(|t| Self::AccountEntryExtensionV3(Box::new(t)))),
53227            ),
53228            TypeVariant::AccountEntryExtensionV2 => Box::new(
53229                ReadXdrIter::<_, AccountEntryExtensionV2>::new(&mut r.inner, r.limits.clone())
53230                    .map(|r| r.map(|t| Self::AccountEntryExtensionV2(Box::new(t)))),
53231            ),
53232            TypeVariant::AccountEntryExtensionV2Ext => Box::new(
53233                ReadXdrIter::<_, AccountEntryExtensionV2Ext>::new(&mut r.inner, r.limits.clone())
53234                    .map(|r| r.map(|t| Self::AccountEntryExtensionV2Ext(Box::new(t)))),
53235            ),
53236            TypeVariant::AccountEntryExtensionV1 => Box::new(
53237                ReadXdrIter::<_, AccountEntryExtensionV1>::new(&mut r.inner, r.limits.clone())
53238                    .map(|r| r.map(|t| Self::AccountEntryExtensionV1(Box::new(t)))),
53239            ),
53240            TypeVariant::AccountEntryExtensionV1Ext => Box::new(
53241                ReadXdrIter::<_, AccountEntryExtensionV1Ext>::new(&mut r.inner, r.limits.clone())
53242                    .map(|r| r.map(|t| Self::AccountEntryExtensionV1Ext(Box::new(t)))),
53243            ),
53244            TypeVariant::AccountEntry => Box::new(
53245                ReadXdrIter::<_, AccountEntry>::new(&mut r.inner, r.limits.clone())
53246                    .map(|r| r.map(|t| Self::AccountEntry(Box::new(t)))),
53247            ),
53248            TypeVariant::AccountEntryExt => Box::new(
53249                ReadXdrIter::<_, AccountEntryExt>::new(&mut r.inner, r.limits.clone())
53250                    .map(|r| r.map(|t| Self::AccountEntryExt(Box::new(t)))),
53251            ),
53252            TypeVariant::TrustLineFlags => Box::new(
53253                ReadXdrIter::<_, TrustLineFlags>::new(&mut r.inner, r.limits.clone())
53254                    .map(|r| r.map(|t| Self::TrustLineFlags(Box::new(t)))),
53255            ),
53256            TypeVariant::LiquidityPoolType => Box::new(
53257                ReadXdrIter::<_, LiquidityPoolType>::new(&mut r.inner, r.limits.clone())
53258                    .map(|r| r.map(|t| Self::LiquidityPoolType(Box::new(t)))),
53259            ),
53260            TypeVariant::TrustLineAsset => Box::new(
53261                ReadXdrIter::<_, TrustLineAsset>::new(&mut r.inner, r.limits.clone())
53262                    .map(|r| r.map(|t| Self::TrustLineAsset(Box::new(t)))),
53263            ),
53264            TypeVariant::TrustLineEntryExtensionV2 => Box::new(
53265                ReadXdrIter::<_, TrustLineEntryExtensionV2>::new(&mut r.inner, r.limits.clone())
53266                    .map(|r| r.map(|t| Self::TrustLineEntryExtensionV2(Box::new(t)))),
53267            ),
53268            TypeVariant::TrustLineEntryExtensionV2Ext => Box::new(
53269                ReadXdrIter::<_, TrustLineEntryExtensionV2Ext>::new(&mut r.inner, r.limits.clone())
53270                    .map(|r| r.map(|t| Self::TrustLineEntryExtensionV2Ext(Box::new(t)))),
53271            ),
53272            TypeVariant::TrustLineEntry => Box::new(
53273                ReadXdrIter::<_, TrustLineEntry>::new(&mut r.inner, r.limits.clone())
53274                    .map(|r| r.map(|t| Self::TrustLineEntry(Box::new(t)))),
53275            ),
53276            TypeVariant::TrustLineEntryExt => Box::new(
53277                ReadXdrIter::<_, TrustLineEntryExt>::new(&mut r.inner, r.limits.clone())
53278                    .map(|r| r.map(|t| Self::TrustLineEntryExt(Box::new(t)))),
53279            ),
53280            TypeVariant::TrustLineEntryV1 => Box::new(
53281                ReadXdrIter::<_, TrustLineEntryV1>::new(&mut r.inner, r.limits.clone())
53282                    .map(|r| r.map(|t| Self::TrustLineEntryV1(Box::new(t)))),
53283            ),
53284            TypeVariant::TrustLineEntryV1Ext => Box::new(
53285                ReadXdrIter::<_, TrustLineEntryV1Ext>::new(&mut r.inner, r.limits.clone())
53286                    .map(|r| r.map(|t| Self::TrustLineEntryV1Ext(Box::new(t)))),
53287            ),
53288            TypeVariant::OfferEntryFlags => Box::new(
53289                ReadXdrIter::<_, OfferEntryFlags>::new(&mut r.inner, r.limits.clone())
53290                    .map(|r| r.map(|t| Self::OfferEntryFlags(Box::new(t)))),
53291            ),
53292            TypeVariant::OfferEntry => Box::new(
53293                ReadXdrIter::<_, OfferEntry>::new(&mut r.inner, r.limits.clone())
53294                    .map(|r| r.map(|t| Self::OfferEntry(Box::new(t)))),
53295            ),
53296            TypeVariant::OfferEntryExt => Box::new(
53297                ReadXdrIter::<_, OfferEntryExt>::new(&mut r.inner, r.limits.clone())
53298                    .map(|r| r.map(|t| Self::OfferEntryExt(Box::new(t)))),
53299            ),
53300            TypeVariant::DataEntry => Box::new(
53301                ReadXdrIter::<_, DataEntry>::new(&mut r.inner, r.limits.clone())
53302                    .map(|r| r.map(|t| Self::DataEntry(Box::new(t)))),
53303            ),
53304            TypeVariant::DataEntryExt => Box::new(
53305                ReadXdrIter::<_, DataEntryExt>::new(&mut r.inner, r.limits.clone())
53306                    .map(|r| r.map(|t| Self::DataEntryExt(Box::new(t)))),
53307            ),
53308            TypeVariant::ClaimPredicateType => Box::new(
53309                ReadXdrIter::<_, ClaimPredicateType>::new(&mut r.inner, r.limits.clone())
53310                    .map(|r| r.map(|t| Self::ClaimPredicateType(Box::new(t)))),
53311            ),
53312            TypeVariant::ClaimPredicate => Box::new(
53313                ReadXdrIter::<_, ClaimPredicate>::new(&mut r.inner, r.limits.clone())
53314                    .map(|r| r.map(|t| Self::ClaimPredicate(Box::new(t)))),
53315            ),
53316            TypeVariant::ClaimantType => Box::new(
53317                ReadXdrIter::<_, ClaimantType>::new(&mut r.inner, r.limits.clone())
53318                    .map(|r| r.map(|t| Self::ClaimantType(Box::new(t)))),
53319            ),
53320            TypeVariant::Claimant => Box::new(
53321                ReadXdrIter::<_, Claimant>::new(&mut r.inner, r.limits.clone())
53322                    .map(|r| r.map(|t| Self::Claimant(Box::new(t)))),
53323            ),
53324            TypeVariant::ClaimantV0 => Box::new(
53325                ReadXdrIter::<_, ClaimantV0>::new(&mut r.inner, r.limits.clone())
53326                    .map(|r| r.map(|t| Self::ClaimantV0(Box::new(t)))),
53327            ),
53328            TypeVariant::ClaimableBalanceIdType => Box::new(
53329                ReadXdrIter::<_, ClaimableBalanceIdType>::new(&mut r.inner, r.limits.clone())
53330                    .map(|r| r.map(|t| Self::ClaimableBalanceIdType(Box::new(t)))),
53331            ),
53332            TypeVariant::ClaimableBalanceId => Box::new(
53333                ReadXdrIter::<_, ClaimableBalanceId>::new(&mut r.inner, r.limits.clone())
53334                    .map(|r| r.map(|t| Self::ClaimableBalanceId(Box::new(t)))),
53335            ),
53336            TypeVariant::ClaimableBalanceFlags => Box::new(
53337                ReadXdrIter::<_, ClaimableBalanceFlags>::new(&mut r.inner, r.limits.clone())
53338                    .map(|r| r.map(|t| Self::ClaimableBalanceFlags(Box::new(t)))),
53339            ),
53340            TypeVariant::ClaimableBalanceEntryExtensionV1 => Box::new(
53341                ReadXdrIter::<_, ClaimableBalanceEntryExtensionV1>::new(
53342                    &mut r.inner,
53343                    r.limits.clone(),
53344                )
53345                .map(|r| r.map(|t| Self::ClaimableBalanceEntryExtensionV1(Box::new(t)))),
53346            ),
53347            TypeVariant::ClaimableBalanceEntryExtensionV1Ext => Box::new(
53348                ReadXdrIter::<_, ClaimableBalanceEntryExtensionV1Ext>::new(
53349                    &mut r.inner,
53350                    r.limits.clone(),
53351                )
53352                .map(|r| r.map(|t| Self::ClaimableBalanceEntryExtensionV1Ext(Box::new(t)))),
53353            ),
53354            TypeVariant::ClaimableBalanceEntry => Box::new(
53355                ReadXdrIter::<_, ClaimableBalanceEntry>::new(&mut r.inner, r.limits.clone())
53356                    .map(|r| r.map(|t| Self::ClaimableBalanceEntry(Box::new(t)))),
53357            ),
53358            TypeVariant::ClaimableBalanceEntryExt => Box::new(
53359                ReadXdrIter::<_, ClaimableBalanceEntryExt>::new(&mut r.inner, r.limits.clone())
53360                    .map(|r| r.map(|t| Self::ClaimableBalanceEntryExt(Box::new(t)))),
53361            ),
53362            TypeVariant::LiquidityPoolConstantProductParameters => Box::new(
53363                ReadXdrIter::<_, LiquidityPoolConstantProductParameters>::new(
53364                    &mut r.inner,
53365                    r.limits.clone(),
53366                )
53367                .map(|r| r.map(|t| Self::LiquidityPoolConstantProductParameters(Box::new(t)))),
53368            ),
53369            TypeVariant::LiquidityPoolEntry => Box::new(
53370                ReadXdrIter::<_, LiquidityPoolEntry>::new(&mut r.inner, r.limits.clone())
53371                    .map(|r| r.map(|t| Self::LiquidityPoolEntry(Box::new(t)))),
53372            ),
53373            TypeVariant::LiquidityPoolEntryBody => Box::new(
53374                ReadXdrIter::<_, LiquidityPoolEntryBody>::new(&mut r.inner, r.limits.clone())
53375                    .map(|r| r.map(|t| Self::LiquidityPoolEntryBody(Box::new(t)))),
53376            ),
53377            TypeVariant::LiquidityPoolEntryConstantProduct => Box::new(
53378                ReadXdrIter::<_, LiquidityPoolEntryConstantProduct>::new(
53379                    &mut r.inner,
53380                    r.limits.clone(),
53381                )
53382                .map(|r| r.map(|t| Self::LiquidityPoolEntryConstantProduct(Box::new(t)))),
53383            ),
53384            TypeVariant::ContractDataDurability => Box::new(
53385                ReadXdrIter::<_, ContractDataDurability>::new(&mut r.inner, r.limits.clone())
53386                    .map(|r| r.map(|t| Self::ContractDataDurability(Box::new(t)))),
53387            ),
53388            TypeVariant::ContractDataEntry => Box::new(
53389                ReadXdrIter::<_, ContractDataEntry>::new(&mut r.inner, r.limits.clone())
53390                    .map(|r| r.map(|t| Self::ContractDataEntry(Box::new(t)))),
53391            ),
53392            TypeVariant::ContractCodeCostInputs => Box::new(
53393                ReadXdrIter::<_, ContractCodeCostInputs>::new(&mut r.inner, r.limits.clone())
53394                    .map(|r| r.map(|t| Self::ContractCodeCostInputs(Box::new(t)))),
53395            ),
53396            TypeVariant::ContractCodeEntry => Box::new(
53397                ReadXdrIter::<_, ContractCodeEntry>::new(&mut r.inner, r.limits.clone())
53398                    .map(|r| r.map(|t| Self::ContractCodeEntry(Box::new(t)))),
53399            ),
53400            TypeVariant::ContractCodeEntryExt => Box::new(
53401                ReadXdrIter::<_, ContractCodeEntryExt>::new(&mut r.inner, r.limits.clone())
53402                    .map(|r| r.map(|t| Self::ContractCodeEntryExt(Box::new(t)))),
53403            ),
53404            TypeVariant::ContractCodeEntryV1 => Box::new(
53405                ReadXdrIter::<_, ContractCodeEntryV1>::new(&mut r.inner, r.limits.clone())
53406                    .map(|r| r.map(|t| Self::ContractCodeEntryV1(Box::new(t)))),
53407            ),
53408            TypeVariant::TtlEntry => Box::new(
53409                ReadXdrIter::<_, TtlEntry>::new(&mut r.inner, r.limits.clone())
53410                    .map(|r| r.map(|t| Self::TtlEntry(Box::new(t)))),
53411            ),
53412            TypeVariant::LedgerEntryExtensionV1 => Box::new(
53413                ReadXdrIter::<_, LedgerEntryExtensionV1>::new(&mut r.inner, r.limits.clone())
53414                    .map(|r| r.map(|t| Self::LedgerEntryExtensionV1(Box::new(t)))),
53415            ),
53416            TypeVariant::LedgerEntryExtensionV1Ext => Box::new(
53417                ReadXdrIter::<_, LedgerEntryExtensionV1Ext>::new(&mut r.inner, r.limits.clone())
53418                    .map(|r| r.map(|t| Self::LedgerEntryExtensionV1Ext(Box::new(t)))),
53419            ),
53420            TypeVariant::LedgerEntry => Box::new(
53421                ReadXdrIter::<_, LedgerEntry>::new(&mut r.inner, r.limits.clone())
53422                    .map(|r| r.map(|t| Self::LedgerEntry(Box::new(t)))),
53423            ),
53424            TypeVariant::LedgerEntryData => Box::new(
53425                ReadXdrIter::<_, LedgerEntryData>::new(&mut r.inner, r.limits.clone())
53426                    .map(|r| r.map(|t| Self::LedgerEntryData(Box::new(t)))),
53427            ),
53428            TypeVariant::LedgerEntryExt => Box::new(
53429                ReadXdrIter::<_, LedgerEntryExt>::new(&mut r.inner, r.limits.clone())
53430                    .map(|r| r.map(|t| Self::LedgerEntryExt(Box::new(t)))),
53431            ),
53432            TypeVariant::LedgerKey => Box::new(
53433                ReadXdrIter::<_, LedgerKey>::new(&mut r.inner, r.limits.clone())
53434                    .map(|r| r.map(|t| Self::LedgerKey(Box::new(t)))),
53435            ),
53436            TypeVariant::LedgerKeyAccount => Box::new(
53437                ReadXdrIter::<_, LedgerKeyAccount>::new(&mut r.inner, r.limits.clone())
53438                    .map(|r| r.map(|t| Self::LedgerKeyAccount(Box::new(t)))),
53439            ),
53440            TypeVariant::LedgerKeyTrustLine => Box::new(
53441                ReadXdrIter::<_, LedgerKeyTrustLine>::new(&mut r.inner, r.limits.clone())
53442                    .map(|r| r.map(|t| Self::LedgerKeyTrustLine(Box::new(t)))),
53443            ),
53444            TypeVariant::LedgerKeyOffer => Box::new(
53445                ReadXdrIter::<_, LedgerKeyOffer>::new(&mut r.inner, r.limits.clone())
53446                    .map(|r| r.map(|t| Self::LedgerKeyOffer(Box::new(t)))),
53447            ),
53448            TypeVariant::LedgerKeyData => Box::new(
53449                ReadXdrIter::<_, LedgerKeyData>::new(&mut r.inner, r.limits.clone())
53450                    .map(|r| r.map(|t| Self::LedgerKeyData(Box::new(t)))),
53451            ),
53452            TypeVariant::LedgerKeyClaimableBalance => Box::new(
53453                ReadXdrIter::<_, LedgerKeyClaimableBalance>::new(&mut r.inner, r.limits.clone())
53454                    .map(|r| r.map(|t| Self::LedgerKeyClaimableBalance(Box::new(t)))),
53455            ),
53456            TypeVariant::LedgerKeyLiquidityPool => Box::new(
53457                ReadXdrIter::<_, LedgerKeyLiquidityPool>::new(&mut r.inner, r.limits.clone())
53458                    .map(|r| r.map(|t| Self::LedgerKeyLiquidityPool(Box::new(t)))),
53459            ),
53460            TypeVariant::LedgerKeyContractData => Box::new(
53461                ReadXdrIter::<_, LedgerKeyContractData>::new(&mut r.inner, r.limits.clone())
53462                    .map(|r| r.map(|t| Self::LedgerKeyContractData(Box::new(t)))),
53463            ),
53464            TypeVariant::LedgerKeyContractCode => Box::new(
53465                ReadXdrIter::<_, LedgerKeyContractCode>::new(&mut r.inner, r.limits.clone())
53466                    .map(|r| r.map(|t| Self::LedgerKeyContractCode(Box::new(t)))),
53467            ),
53468            TypeVariant::LedgerKeyConfigSetting => Box::new(
53469                ReadXdrIter::<_, LedgerKeyConfigSetting>::new(&mut r.inner, r.limits.clone())
53470                    .map(|r| r.map(|t| Self::LedgerKeyConfigSetting(Box::new(t)))),
53471            ),
53472            TypeVariant::LedgerKeyTtl => Box::new(
53473                ReadXdrIter::<_, LedgerKeyTtl>::new(&mut r.inner, r.limits.clone())
53474                    .map(|r| r.map(|t| Self::LedgerKeyTtl(Box::new(t)))),
53475            ),
53476            TypeVariant::EnvelopeType => Box::new(
53477                ReadXdrIter::<_, EnvelopeType>::new(&mut r.inner, r.limits.clone())
53478                    .map(|r| r.map(|t| Self::EnvelopeType(Box::new(t)))),
53479            ),
53480            TypeVariant::BucketListType => Box::new(
53481                ReadXdrIter::<_, BucketListType>::new(&mut r.inner, r.limits.clone())
53482                    .map(|r| r.map(|t| Self::BucketListType(Box::new(t)))),
53483            ),
53484            TypeVariant::BucketEntryType => Box::new(
53485                ReadXdrIter::<_, BucketEntryType>::new(&mut r.inner, r.limits.clone())
53486                    .map(|r| r.map(|t| Self::BucketEntryType(Box::new(t)))),
53487            ),
53488            TypeVariant::HotArchiveBucketEntryType => Box::new(
53489                ReadXdrIter::<_, HotArchiveBucketEntryType>::new(&mut r.inner, r.limits.clone())
53490                    .map(|r| r.map(|t| Self::HotArchiveBucketEntryType(Box::new(t)))),
53491            ),
53492            TypeVariant::ColdArchiveBucketEntryType => Box::new(
53493                ReadXdrIter::<_, ColdArchiveBucketEntryType>::new(&mut r.inner, r.limits.clone())
53494                    .map(|r| r.map(|t| Self::ColdArchiveBucketEntryType(Box::new(t)))),
53495            ),
53496            TypeVariant::BucketMetadata => Box::new(
53497                ReadXdrIter::<_, BucketMetadata>::new(&mut r.inner, r.limits.clone())
53498                    .map(|r| r.map(|t| Self::BucketMetadata(Box::new(t)))),
53499            ),
53500            TypeVariant::BucketMetadataExt => Box::new(
53501                ReadXdrIter::<_, BucketMetadataExt>::new(&mut r.inner, r.limits.clone())
53502                    .map(|r| r.map(|t| Self::BucketMetadataExt(Box::new(t)))),
53503            ),
53504            TypeVariant::BucketEntry => Box::new(
53505                ReadXdrIter::<_, BucketEntry>::new(&mut r.inner, r.limits.clone())
53506                    .map(|r| r.map(|t| Self::BucketEntry(Box::new(t)))),
53507            ),
53508            TypeVariant::HotArchiveBucketEntry => Box::new(
53509                ReadXdrIter::<_, HotArchiveBucketEntry>::new(&mut r.inner, r.limits.clone())
53510                    .map(|r| r.map(|t| Self::HotArchiveBucketEntry(Box::new(t)))),
53511            ),
53512            TypeVariant::ColdArchiveArchivedLeaf => Box::new(
53513                ReadXdrIter::<_, ColdArchiveArchivedLeaf>::new(&mut r.inner, r.limits.clone())
53514                    .map(|r| r.map(|t| Self::ColdArchiveArchivedLeaf(Box::new(t)))),
53515            ),
53516            TypeVariant::ColdArchiveDeletedLeaf => Box::new(
53517                ReadXdrIter::<_, ColdArchiveDeletedLeaf>::new(&mut r.inner, r.limits.clone())
53518                    .map(|r| r.map(|t| Self::ColdArchiveDeletedLeaf(Box::new(t)))),
53519            ),
53520            TypeVariant::ColdArchiveBoundaryLeaf => Box::new(
53521                ReadXdrIter::<_, ColdArchiveBoundaryLeaf>::new(&mut r.inner, r.limits.clone())
53522                    .map(|r| r.map(|t| Self::ColdArchiveBoundaryLeaf(Box::new(t)))),
53523            ),
53524            TypeVariant::ColdArchiveHashEntry => Box::new(
53525                ReadXdrIter::<_, ColdArchiveHashEntry>::new(&mut r.inner, r.limits.clone())
53526                    .map(|r| r.map(|t| Self::ColdArchiveHashEntry(Box::new(t)))),
53527            ),
53528            TypeVariant::ColdArchiveBucketEntry => Box::new(
53529                ReadXdrIter::<_, ColdArchiveBucketEntry>::new(&mut r.inner, r.limits.clone())
53530                    .map(|r| r.map(|t| Self::ColdArchiveBucketEntry(Box::new(t)))),
53531            ),
53532            TypeVariant::UpgradeType => Box::new(
53533                ReadXdrIter::<_, UpgradeType>::new(&mut r.inner, r.limits.clone())
53534                    .map(|r| r.map(|t| Self::UpgradeType(Box::new(t)))),
53535            ),
53536            TypeVariant::StellarValueType => Box::new(
53537                ReadXdrIter::<_, StellarValueType>::new(&mut r.inner, r.limits.clone())
53538                    .map(|r| r.map(|t| Self::StellarValueType(Box::new(t)))),
53539            ),
53540            TypeVariant::LedgerCloseValueSignature => Box::new(
53541                ReadXdrIter::<_, LedgerCloseValueSignature>::new(&mut r.inner, r.limits.clone())
53542                    .map(|r| r.map(|t| Self::LedgerCloseValueSignature(Box::new(t)))),
53543            ),
53544            TypeVariant::StellarValue => Box::new(
53545                ReadXdrIter::<_, StellarValue>::new(&mut r.inner, r.limits.clone())
53546                    .map(|r| r.map(|t| Self::StellarValue(Box::new(t)))),
53547            ),
53548            TypeVariant::StellarValueExt => Box::new(
53549                ReadXdrIter::<_, StellarValueExt>::new(&mut r.inner, r.limits.clone())
53550                    .map(|r| r.map(|t| Self::StellarValueExt(Box::new(t)))),
53551            ),
53552            TypeVariant::LedgerHeaderFlags => Box::new(
53553                ReadXdrIter::<_, LedgerHeaderFlags>::new(&mut r.inner, r.limits.clone())
53554                    .map(|r| r.map(|t| Self::LedgerHeaderFlags(Box::new(t)))),
53555            ),
53556            TypeVariant::LedgerHeaderExtensionV1 => Box::new(
53557                ReadXdrIter::<_, LedgerHeaderExtensionV1>::new(&mut r.inner, r.limits.clone())
53558                    .map(|r| r.map(|t| Self::LedgerHeaderExtensionV1(Box::new(t)))),
53559            ),
53560            TypeVariant::LedgerHeaderExtensionV1Ext => Box::new(
53561                ReadXdrIter::<_, LedgerHeaderExtensionV1Ext>::new(&mut r.inner, r.limits.clone())
53562                    .map(|r| r.map(|t| Self::LedgerHeaderExtensionV1Ext(Box::new(t)))),
53563            ),
53564            TypeVariant::LedgerHeader => Box::new(
53565                ReadXdrIter::<_, LedgerHeader>::new(&mut r.inner, r.limits.clone())
53566                    .map(|r| r.map(|t| Self::LedgerHeader(Box::new(t)))),
53567            ),
53568            TypeVariant::LedgerHeaderExt => Box::new(
53569                ReadXdrIter::<_, LedgerHeaderExt>::new(&mut r.inner, r.limits.clone())
53570                    .map(|r| r.map(|t| Self::LedgerHeaderExt(Box::new(t)))),
53571            ),
53572            TypeVariant::LedgerUpgradeType => Box::new(
53573                ReadXdrIter::<_, LedgerUpgradeType>::new(&mut r.inner, r.limits.clone())
53574                    .map(|r| r.map(|t| Self::LedgerUpgradeType(Box::new(t)))),
53575            ),
53576            TypeVariant::ConfigUpgradeSetKey => Box::new(
53577                ReadXdrIter::<_, ConfigUpgradeSetKey>::new(&mut r.inner, r.limits.clone())
53578                    .map(|r| r.map(|t| Self::ConfigUpgradeSetKey(Box::new(t)))),
53579            ),
53580            TypeVariant::LedgerUpgrade => Box::new(
53581                ReadXdrIter::<_, LedgerUpgrade>::new(&mut r.inner, r.limits.clone())
53582                    .map(|r| r.map(|t| Self::LedgerUpgrade(Box::new(t)))),
53583            ),
53584            TypeVariant::ConfigUpgradeSet => Box::new(
53585                ReadXdrIter::<_, ConfigUpgradeSet>::new(&mut r.inner, r.limits.clone())
53586                    .map(|r| r.map(|t| Self::ConfigUpgradeSet(Box::new(t)))),
53587            ),
53588            TypeVariant::TxSetComponentType => Box::new(
53589                ReadXdrIter::<_, TxSetComponentType>::new(&mut r.inner, r.limits.clone())
53590                    .map(|r| r.map(|t| Self::TxSetComponentType(Box::new(t)))),
53591            ),
53592            TypeVariant::TxSetComponent => Box::new(
53593                ReadXdrIter::<_, TxSetComponent>::new(&mut r.inner, r.limits.clone())
53594                    .map(|r| r.map(|t| Self::TxSetComponent(Box::new(t)))),
53595            ),
53596            TypeVariant::TxSetComponentTxsMaybeDiscountedFee => Box::new(
53597                ReadXdrIter::<_, TxSetComponentTxsMaybeDiscountedFee>::new(
53598                    &mut r.inner,
53599                    r.limits.clone(),
53600                )
53601                .map(|r| r.map(|t| Self::TxSetComponentTxsMaybeDiscountedFee(Box::new(t)))),
53602            ),
53603            TypeVariant::TransactionPhase => Box::new(
53604                ReadXdrIter::<_, TransactionPhase>::new(&mut r.inner, r.limits.clone())
53605                    .map(|r| r.map(|t| Self::TransactionPhase(Box::new(t)))),
53606            ),
53607            TypeVariant::TransactionSet => Box::new(
53608                ReadXdrIter::<_, TransactionSet>::new(&mut r.inner, r.limits.clone())
53609                    .map(|r| r.map(|t| Self::TransactionSet(Box::new(t)))),
53610            ),
53611            TypeVariant::TransactionSetV1 => Box::new(
53612                ReadXdrIter::<_, TransactionSetV1>::new(&mut r.inner, r.limits.clone())
53613                    .map(|r| r.map(|t| Self::TransactionSetV1(Box::new(t)))),
53614            ),
53615            TypeVariant::GeneralizedTransactionSet => Box::new(
53616                ReadXdrIter::<_, GeneralizedTransactionSet>::new(&mut r.inner, r.limits.clone())
53617                    .map(|r| r.map(|t| Self::GeneralizedTransactionSet(Box::new(t)))),
53618            ),
53619            TypeVariant::TransactionResultPair => Box::new(
53620                ReadXdrIter::<_, TransactionResultPair>::new(&mut r.inner, r.limits.clone())
53621                    .map(|r| r.map(|t| Self::TransactionResultPair(Box::new(t)))),
53622            ),
53623            TypeVariant::TransactionResultSet => Box::new(
53624                ReadXdrIter::<_, TransactionResultSet>::new(&mut r.inner, r.limits.clone())
53625                    .map(|r| r.map(|t| Self::TransactionResultSet(Box::new(t)))),
53626            ),
53627            TypeVariant::TransactionHistoryEntry => Box::new(
53628                ReadXdrIter::<_, TransactionHistoryEntry>::new(&mut r.inner, r.limits.clone())
53629                    .map(|r| r.map(|t| Self::TransactionHistoryEntry(Box::new(t)))),
53630            ),
53631            TypeVariant::TransactionHistoryEntryExt => Box::new(
53632                ReadXdrIter::<_, TransactionHistoryEntryExt>::new(&mut r.inner, r.limits.clone())
53633                    .map(|r| r.map(|t| Self::TransactionHistoryEntryExt(Box::new(t)))),
53634            ),
53635            TypeVariant::TransactionHistoryResultEntry => Box::new(
53636                ReadXdrIter::<_, TransactionHistoryResultEntry>::new(
53637                    &mut r.inner,
53638                    r.limits.clone(),
53639                )
53640                .map(|r| r.map(|t| Self::TransactionHistoryResultEntry(Box::new(t)))),
53641            ),
53642            TypeVariant::TransactionHistoryResultEntryExt => Box::new(
53643                ReadXdrIter::<_, TransactionHistoryResultEntryExt>::new(
53644                    &mut r.inner,
53645                    r.limits.clone(),
53646                )
53647                .map(|r| r.map(|t| Self::TransactionHistoryResultEntryExt(Box::new(t)))),
53648            ),
53649            TypeVariant::LedgerHeaderHistoryEntry => Box::new(
53650                ReadXdrIter::<_, LedgerHeaderHistoryEntry>::new(&mut r.inner, r.limits.clone())
53651                    .map(|r| r.map(|t| Self::LedgerHeaderHistoryEntry(Box::new(t)))),
53652            ),
53653            TypeVariant::LedgerHeaderHistoryEntryExt => Box::new(
53654                ReadXdrIter::<_, LedgerHeaderHistoryEntryExt>::new(&mut r.inner, r.limits.clone())
53655                    .map(|r| r.map(|t| Self::LedgerHeaderHistoryEntryExt(Box::new(t)))),
53656            ),
53657            TypeVariant::LedgerScpMessages => Box::new(
53658                ReadXdrIter::<_, LedgerScpMessages>::new(&mut r.inner, r.limits.clone())
53659                    .map(|r| r.map(|t| Self::LedgerScpMessages(Box::new(t)))),
53660            ),
53661            TypeVariant::ScpHistoryEntryV0 => Box::new(
53662                ReadXdrIter::<_, ScpHistoryEntryV0>::new(&mut r.inner, r.limits.clone())
53663                    .map(|r| r.map(|t| Self::ScpHistoryEntryV0(Box::new(t)))),
53664            ),
53665            TypeVariant::ScpHistoryEntry => Box::new(
53666                ReadXdrIter::<_, ScpHistoryEntry>::new(&mut r.inner, r.limits.clone())
53667                    .map(|r| r.map(|t| Self::ScpHistoryEntry(Box::new(t)))),
53668            ),
53669            TypeVariant::LedgerEntryChangeType => Box::new(
53670                ReadXdrIter::<_, LedgerEntryChangeType>::new(&mut r.inner, r.limits.clone())
53671                    .map(|r| r.map(|t| Self::LedgerEntryChangeType(Box::new(t)))),
53672            ),
53673            TypeVariant::LedgerEntryChange => Box::new(
53674                ReadXdrIter::<_, LedgerEntryChange>::new(&mut r.inner, r.limits.clone())
53675                    .map(|r| r.map(|t| Self::LedgerEntryChange(Box::new(t)))),
53676            ),
53677            TypeVariant::LedgerEntryChanges => Box::new(
53678                ReadXdrIter::<_, LedgerEntryChanges>::new(&mut r.inner, r.limits.clone())
53679                    .map(|r| r.map(|t| Self::LedgerEntryChanges(Box::new(t)))),
53680            ),
53681            TypeVariant::OperationMeta => Box::new(
53682                ReadXdrIter::<_, OperationMeta>::new(&mut r.inner, r.limits.clone())
53683                    .map(|r| r.map(|t| Self::OperationMeta(Box::new(t)))),
53684            ),
53685            TypeVariant::TransactionMetaV1 => Box::new(
53686                ReadXdrIter::<_, TransactionMetaV1>::new(&mut r.inner, r.limits.clone())
53687                    .map(|r| r.map(|t| Self::TransactionMetaV1(Box::new(t)))),
53688            ),
53689            TypeVariant::TransactionMetaV2 => Box::new(
53690                ReadXdrIter::<_, TransactionMetaV2>::new(&mut r.inner, r.limits.clone())
53691                    .map(|r| r.map(|t| Self::TransactionMetaV2(Box::new(t)))),
53692            ),
53693            TypeVariant::ContractEventType => Box::new(
53694                ReadXdrIter::<_, ContractEventType>::new(&mut r.inner, r.limits.clone())
53695                    .map(|r| r.map(|t| Self::ContractEventType(Box::new(t)))),
53696            ),
53697            TypeVariant::ContractEvent => Box::new(
53698                ReadXdrIter::<_, ContractEvent>::new(&mut r.inner, r.limits.clone())
53699                    .map(|r| r.map(|t| Self::ContractEvent(Box::new(t)))),
53700            ),
53701            TypeVariant::ContractEventBody => Box::new(
53702                ReadXdrIter::<_, ContractEventBody>::new(&mut r.inner, r.limits.clone())
53703                    .map(|r| r.map(|t| Self::ContractEventBody(Box::new(t)))),
53704            ),
53705            TypeVariant::ContractEventV0 => Box::new(
53706                ReadXdrIter::<_, ContractEventV0>::new(&mut r.inner, r.limits.clone())
53707                    .map(|r| r.map(|t| Self::ContractEventV0(Box::new(t)))),
53708            ),
53709            TypeVariant::DiagnosticEvent => Box::new(
53710                ReadXdrIter::<_, DiagnosticEvent>::new(&mut r.inner, r.limits.clone())
53711                    .map(|r| r.map(|t| Self::DiagnosticEvent(Box::new(t)))),
53712            ),
53713            TypeVariant::DiagnosticEvents => Box::new(
53714                ReadXdrIter::<_, DiagnosticEvents>::new(&mut r.inner, r.limits.clone())
53715                    .map(|r| r.map(|t| Self::DiagnosticEvents(Box::new(t)))),
53716            ),
53717            TypeVariant::SorobanTransactionMetaExtV1 => Box::new(
53718                ReadXdrIter::<_, SorobanTransactionMetaExtV1>::new(&mut r.inner, r.limits.clone())
53719                    .map(|r| r.map(|t| Self::SorobanTransactionMetaExtV1(Box::new(t)))),
53720            ),
53721            TypeVariant::SorobanTransactionMetaExt => Box::new(
53722                ReadXdrIter::<_, SorobanTransactionMetaExt>::new(&mut r.inner, r.limits.clone())
53723                    .map(|r| r.map(|t| Self::SorobanTransactionMetaExt(Box::new(t)))),
53724            ),
53725            TypeVariant::SorobanTransactionMeta => Box::new(
53726                ReadXdrIter::<_, SorobanTransactionMeta>::new(&mut r.inner, r.limits.clone())
53727                    .map(|r| r.map(|t| Self::SorobanTransactionMeta(Box::new(t)))),
53728            ),
53729            TypeVariant::TransactionMetaV3 => Box::new(
53730                ReadXdrIter::<_, TransactionMetaV3>::new(&mut r.inner, r.limits.clone())
53731                    .map(|r| r.map(|t| Self::TransactionMetaV3(Box::new(t)))),
53732            ),
53733            TypeVariant::InvokeHostFunctionSuccessPreImage => Box::new(
53734                ReadXdrIter::<_, InvokeHostFunctionSuccessPreImage>::new(
53735                    &mut r.inner,
53736                    r.limits.clone(),
53737                )
53738                .map(|r| r.map(|t| Self::InvokeHostFunctionSuccessPreImage(Box::new(t)))),
53739            ),
53740            TypeVariant::TransactionMeta => Box::new(
53741                ReadXdrIter::<_, TransactionMeta>::new(&mut r.inner, r.limits.clone())
53742                    .map(|r| r.map(|t| Self::TransactionMeta(Box::new(t)))),
53743            ),
53744            TypeVariant::TransactionResultMeta => Box::new(
53745                ReadXdrIter::<_, TransactionResultMeta>::new(&mut r.inner, r.limits.clone())
53746                    .map(|r| r.map(|t| Self::TransactionResultMeta(Box::new(t)))),
53747            ),
53748            TypeVariant::UpgradeEntryMeta => Box::new(
53749                ReadXdrIter::<_, UpgradeEntryMeta>::new(&mut r.inner, r.limits.clone())
53750                    .map(|r| r.map(|t| Self::UpgradeEntryMeta(Box::new(t)))),
53751            ),
53752            TypeVariant::LedgerCloseMetaV0 => Box::new(
53753                ReadXdrIter::<_, LedgerCloseMetaV0>::new(&mut r.inner, r.limits.clone())
53754                    .map(|r| r.map(|t| Self::LedgerCloseMetaV0(Box::new(t)))),
53755            ),
53756            TypeVariant::LedgerCloseMetaExtV1 => Box::new(
53757                ReadXdrIter::<_, LedgerCloseMetaExtV1>::new(&mut r.inner, r.limits.clone())
53758                    .map(|r| r.map(|t| Self::LedgerCloseMetaExtV1(Box::new(t)))),
53759            ),
53760            TypeVariant::LedgerCloseMetaExt => Box::new(
53761                ReadXdrIter::<_, LedgerCloseMetaExt>::new(&mut r.inner, r.limits.clone())
53762                    .map(|r| r.map(|t| Self::LedgerCloseMetaExt(Box::new(t)))),
53763            ),
53764            TypeVariant::LedgerCloseMetaV1 => Box::new(
53765                ReadXdrIter::<_, LedgerCloseMetaV1>::new(&mut r.inner, r.limits.clone())
53766                    .map(|r| r.map(|t| Self::LedgerCloseMetaV1(Box::new(t)))),
53767            ),
53768            TypeVariant::LedgerCloseMeta => Box::new(
53769                ReadXdrIter::<_, LedgerCloseMeta>::new(&mut r.inner, r.limits.clone())
53770                    .map(|r| r.map(|t| Self::LedgerCloseMeta(Box::new(t)))),
53771            ),
53772            TypeVariant::ErrorCode => Box::new(
53773                ReadXdrIter::<_, ErrorCode>::new(&mut r.inner, r.limits.clone())
53774                    .map(|r| r.map(|t| Self::ErrorCode(Box::new(t)))),
53775            ),
53776            TypeVariant::SError => Box::new(
53777                ReadXdrIter::<_, SError>::new(&mut r.inner, r.limits.clone())
53778                    .map(|r| r.map(|t| Self::SError(Box::new(t)))),
53779            ),
53780            TypeVariant::SendMore => Box::new(
53781                ReadXdrIter::<_, SendMore>::new(&mut r.inner, r.limits.clone())
53782                    .map(|r| r.map(|t| Self::SendMore(Box::new(t)))),
53783            ),
53784            TypeVariant::SendMoreExtended => Box::new(
53785                ReadXdrIter::<_, SendMoreExtended>::new(&mut r.inner, r.limits.clone())
53786                    .map(|r| r.map(|t| Self::SendMoreExtended(Box::new(t)))),
53787            ),
53788            TypeVariant::AuthCert => Box::new(
53789                ReadXdrIter::<_, AuthCert>::new(&mut r.inner, r.limits.clone())
53790                    .map(|r| r.map(|t| Self::AuthCert(Box::new(t)))),
53791            ),
53792            TypeVariant::Hello => Box::new(
53793                ReadXdrIter::<_, Hello>::new(&mut r.inner, r.limits.clone())
53794                    .map(|r| r.map(|t| Self::Hello(Box::new(t)))),
53795            ),
53796            TypeVariant::Auth => Box::new(
53797                ReadXdrIter::<_, Auth>::new(&mut r.inner, r.limits.clone())
53798                    .map(|r| r.map(|t| Self::Auth(Box::new(t)))),
53799            ),
53800            TypeVariant::IpAddrType => Box::new(
53801                ReadXdrIter::<_, IpAddrType>::new(&mut r.inner, r.limits.clone())
53802                    .map(|r| r.map(|t| Self::IpAddrType(Box::new(t)))),
53803            ),
53804            TypeVariant::PeerAddress => Box::new(
53805                ReadXdrIter::<_, PeerAddress>::new(&mut r.inner, r.limits.clone())
53806                    .map(|r| r.map(|t| Self::PeerAddress(Box::new(t)))),
53807            ),
53808            TypeVariant::PeerAddressIp => Box::new(
53809                ReadXdrIter::<_, PeerAddressIp>::new(&mut r.inner, r.limits.clone())
53810                    .map(|r| r.map(|t| Self::PeerAddressIp(Box::new(t)))),
53811            ),
53812            TypeVariant::MessageType => Box::new(
53813                ReadXdrIter::<_, MessageType>::new(&mut r.inner, r.limits.clone())
53814                    .map(|r| r.map(|t| Self::MessageType(Box::new(t)))),
53815            ),
53816            TypeVariant::DontHave => Box::new(
53817                ReadXdrIter::<_, DontHave>::new(&mut r.inner, r.limits.clone())
53818                    .map(|r| r.map(|t| Self::DontHave(Box::new(t)))),
53819            ),
53820            TypeVariant::SurveyMessageCommandType => Box::new(
53821                ReadXdrIter::<_, SurveyMessageCommandType>::new(&mut r.inner, r.limits.clone())
53822                    .map(|r| r.map(|t| Self::SurveyMessageCommandType(Box::new(t)))),
53823            ),
53824            TypeVariant::SurveyMessageResponseType => Box::new(
53825                ReadXdrIter::<_, SurveyMessageResponseType>::new(&mut r.inner, r.limits.clone())
53826                    .map(|r| r.map(|t| Self::SurveyMessageResponseType(Box::new(t)))),
53827            ),
53828            TypeVariant::TimeSlicedSurveyStartCollectingMessage => Box::new(
53829                ReadXdrIter::<_, TimeSlicedSurveyStartCollectingMessage>::new(
53830                    &mut r.inner,
53831                    r.limits.clone(),
53832                )
53833                .map(|r| r.map(|t| Self::TimeSlicedSurveyStartCollectingMessage(Box::new(t)))),
53834            ),
53835            TypeVariant::SignedTimeSlicedSurveyStartCollectingMessage => Box::new(
53836                ReadXdrIter::<_, SignedTimeSlicedSurveyStartCollectingMessage>::new(
53837                    &mut r.inner,
53838                    r.limits.clone(),
53839                )
53840                .map(|r| {
53841                    r.map(|t| Self::SignedTimeSlicedSurveyStartCollectingMessage(Box::new(t)))
53842                }),
53843            ),
53844            TypeVariant::TimeSlicedSurveyStopCollectingMessage => Box::new(
53845                ReadXdrIter::<_, TimeSlicedSurveyStopCollectingMessage>::new(
53846                    &mut r.inner,
53847                    r.limits.clone(),
53848                )
53849                .map(|r| r.map(|t| Self::TimeSlicedSurveyStopCollectingMessage(Box::new(t)))),
53850            ),
53851            TypeVariant::SignedTimeSlicedSurveyStopCollectingMessage => Box::new(
53852                ReadXdrIter::<_, SignedTimeSlicedSurveyStopCollectingMessage>::new(
53853                    &mut r.inner,
53854                    r.limits.clone(),
53855                )
53856                .map(|r| r.map(|t| Self::SignedTimeSlicedSurveyStopCollectingMessage(Box::new(t)))),
53857            ),
53858            TypeVariant::SurveyRequestMessage => Box::new(
53859                ReadXdrIter::<_, SurveyRequestMessage>::new(&mut r.inner, r.limits.clone())
53860                    .map(|r| r.map(|t| Self::SurveyRequestMessage(Box::new(t)))),
53861            ),
53862            TypeVariant::TimeSlicedSurveyRequestMessage => Box::new(
53863                ReadXdrIter::<_, TimeSlicedSurveyRequestMessage>::new(
53864                    &mut r.inner,
53865                    r.limits.clone(),
53866                )
53867                .map(|r| r.map(|t| Self::TimeSlicedSurveyRequestMessage(Box::new(t)))),
53868            ),
53869            TypeVariant::SignedSurveyRequestMessage => Box::new(
53870                ReadXdrIter::<_, SignedSurveyRequestMessage>::new(&mut r.inner, r.limits.clone())
53871                    .map(|r| r.map(|t| Self::SignedSurveyRequestMessage(Box::new(t)))),
53872            ),
53873            TypeVariant::SignedTimeSlicedSurveyRequestMessage => Box::new(
53874                ReadXdrIter::<_, SignedTimeSlicedSurveyRequestMessage>::new(
53875                    &mut r.inner,
53876                    r.limits.clone(),
53877                )
53878                .map(|r| r.map(|t| Self::SignedTimeSlicedSurveyRequestMessage(Box::new(t)))),
53879            ),
53880            TypeVariant::EncryptedBody => Box::new(
53881                ReadXdrIter::<_, EncryptedBody>::new(&mut r.inner, r.limits.clone())
53882                    .map(|r| r.map(|t| Self::EncryptedBody(Box::new(t)))),
53883            ),
53884            TypeVariant::SurveyResponseMessage => Box::new(
53885                ReadXdrIter::<_, SurveyResponseMessage>::new(&mut r.inner, r.limits.clone())
53886                    .map(|r| r.map(|t| Self::SurveyResponseMessage(Box::new(t)))),
53887            ),
53888            TypeVariant::TimeSlicedSurveyResponseMessage => Box::new(
53889                ReadXdrIter::<_, TimeSlicedSurveyResponseMessage>::new(
53890                    &mut r.inner,
53891                    r.limits.clone(),
53892                )
53893                .map(|r| r.map(|t| Self::TimeSlicedSurveyResponseMessage(Box::new(t)))),
53894            ),
53895            TypeVariant::SignedSurveyResponseMessage => Box::new(
53896                ReadXdrIter::<_, SignedSurveyResponseMessage>::new(&mut r.inner, r.limits.clone())
53897                    .map(|r| r.map(|t| Self::SignedSurveyResponseMessage(Box::new(t)))),
53898            ),
53899            TypeVariant::SignedTimeSlicedSurveyResponseMessage => Box::new(
53900                ReadXdrIter::<_, SignedTimeSlicedSurveyResponseMessage>::new(
53901                    &mut r.inner,
53902                    r.limits.clone(),
53903                )
53904                .map(|r| r.map(|t| Self::SignedTimeSlicedSurveyResponseMessage(Box::new(t)))),
53905            ),
53906            TypeVariant::PeerStats => Box::new(
53907                ReadXdrIter::<_, PeerStats>::new(&mut r.inner, r.limits.clone())
53908                    .map(|r| r.map(|t| Self::PeerStats(Box::new(t)))),
53909            ),
53910            TypeVariant::PeerStatList => Box::new(
53911                ReadXdrIter::<_, PeerStatList>::new(&mut r.inner, r.limits.clone())
53912                    .map(|r| r.map(|t| Self::PeerStatList(Box::new(t)))),
53913            ),
53914            TypeVariant::TimeSlicedNodeData => Box::new(
53915                ReadXdrIter::<_, TimeSlicedNodeData>::new(&mut r.inner, r.limits.clone())
53916                    .map(|r| r.map(|t| Self::TimeSlicedNodeData(Box::new(t)))),
53917            ),
53918            TypeVariant::TimeSlicedPeerData => Box::new(
53919                ReadXdrIter::<_, TimeSlicedPeerData>::new(&mut r.inner, r.limits.clone())
53920                    .map(|r| r.map(|t| Self::TimeSlicedPeerData(Box::new(t)))),
53921            ),
53922            TypeVariant::TimeSlicedPeerDataList => Box::new(
53923                ReadXdrIter::<_, TimeSlicedPeerDataList>::new(&mut r.inner, r.limits.clone())
53924                    .map(|r| r.map(|t| Self::TimeSlicedPeerDataList(Box::new(t)))),
53925            ),
53926            TypeVariant::TopologyResponseBodyV0 => Box::new(
53927                ReadXdrIter::<_, TopologyResponseBodyV0>::new(&mut r.inner, r.limits.clone())
53928                    .map(|r| r.map(|t| Self::TopologyResponseBodyV0(Box::new(t)))),
53929            ),
53930            TypeVariant::TopologyResponseBodyV1 => Box::new(
53931                ReadXdrIter::<_, TopologyResponseBodyV1>::new(&mut r.inner, r.limits.clone())
53932                    .map(|r| r.map(|t| Self::TopologyResponseBodyV1(Box::new(t)))),
53933            ),
53934            TypeVariant::TopologyResponseBodyV2 => Box::new(
53935                ReadXdrIter::<_, TopologyResponseBodyV2>::new(&mut r.inner, r.limits.clone())
53936                    .map(|r| r.map(|t| Self::TopologyResponseBodyV2(Box::new(t)))),
53937            ),
53938            TypeVariant::SurveyResponseBody => Box::new(
53939                ReadXdrIter::<_, SurveyResponseBody>::new(&mut r.inner, r.limits.clone())
53940                    .map(|r| r.map(|t| Self::SurveyResponseBody(Box::new(t)))),
53941            ),
53942            TypeVariant::TxAdvertVector => Box::new(
53943                ReadXdrIter::<_, TxAdvertVector>::new(&mut r.inner, r.limits.clone())
53944                    .map(|r| r.map(|t| Self::TxAdvertVector(Box::new(t)))),
53945            ),
53946            TypeVariant::FloodAdvert => Box::new(
53947                ReadXdrIter::<_, FloodAdvert>::new(&mut r.inner, r.limits.clone())
53948                    .map(|r| r.map(|t| Self::FloodAdvert(Box::new(t)))),
53949            ),
53950            TypeVariant::TxDemandVector => Box::new(
53951                ReadXdrIter::<_, TxDemandVector>::new(&mut r.inner, r.limits.clone())
53952                    .map(|r| r.map(|t| Self::TxDemandVector(Box::new(t)))),
53953            ),
53954            TypeVariant::FloodDemand => Box::new(
53955                ReadXdrIter::<_, FloodDemand>::new(&mut r.inner, r.limits.clone())
53956                    .map(|r| r.map(|t| Self::FloodDemand(Box::new(t)))),
53957            ),
53958            TypeVariant::StellarMessage => Box::new(
53959                ReadXdrIter::<_, StellarMessage>::new(&mut r.inner, r.limits.clone())
53960                    .map(|r| r.map(|t| Self::StellarMessage(Box::new(t)))),
53961            ),
53962            TypeVariant::AuthenticatedMessage => Box::new(
53963                ReadXdrIter::<_, AuthenticatedMessage>::new(&mut r.inner, r.limits.clone())
53964                    .map(|r| r.map(|t| Self::AuthenticatedMessage(Box::new(t)))),
53965            ),
53966            TypeVariant::AuthenticatedMessageV0 => Box::new(
53967                ReadXdrIter::<_, AuthenticatedMessageV0>::new(&mut r.inner, r.limits.clone())
53968                    .map(|r| r.map(|t| Self::AuthenticatedMessageV0(Box::new(t)))),
53969            ),
53970            TypeVariant::LiquidityPoolParameters => Box::new(
53971                ReadXdrIter::<_, LiquidityPoolParameters>::new(&mut r.inner, r.limits.clone())
53972                    .map(|r| r.map(|t| Self::LiquidityPoolParameters(Box::new(t)))),
53973            ),
53974            TypeVariant::MuxedAccount => Box::new(
53975                ReadXdrIter::<_, MuxedAccount>::new(&mut r.inner, r.limits.clone())
53976                    .map(|r| r.map(|t| Self::MuxedAccount(Box::new(t)))),
53977            ),
53978            TypeVariant::MuxedAccountMed25519 => Box::new(
53979                ReadXdrIter::<_, MuxedAccountMed25519>::new(&mut r.inner, r.limits.clone())
53980                    .map(|r| r.map(|t| Self::MuxedAccountMed25519(Box::new(t)))),
53981            ),
53982            TypeVariant::DecoratedSignature => Box::new(
53983                ReadXdrIter::<_, DecoratedSignature>::new(&mut r.inner, r.limits.clone())
53984                    .map(|r| r.map(|t| Self::DecoratedSignature(Box::new(t)))),
53985            ),
53986            TypeVariant::OperationType => Box::new(
53987                ReadXdrIter::<_, OperationType>::new(&mut r.inner, r.limits.clone())
53988                    .map(|r| r.map(|t| Self::OperationType(Box::new(t)))),
53989            ),
53990            TypeVariant::CreateAccountOp => Box::new(
53991                ReadXdrIter::<_, CreateAccountOp>::new(&mut r.inner, r.limits.clone())
53992                    .map(|r| r.map(|t| Self::CreateAccountOp(Box::new(t)))),
53993            ),
53994            TypeVariant::PaymentOp => Box::new(
53995                ReadXdrIter::<_, PaymentOp>::new(&mut r.inner, r.limits.clone())
53996                    .map(|r| r.map(|t| Self::PaymentOp(Box::new(t)))),
53997            ),
53998            TypeVariant::PathPaymentStrictReceiveOp => Box::new(
53999                ReadXdrIter::<_, PathPaymentStrictReceiveOp>::new(&mut r.inner, r.limits.clone())
54000                    .map(|r| r.map(|t| Self::PathPaymentStrictReceiveOp(Box::new(t)))),
54001            ),
54002            TypeVariant::PathPaymentStrictSendOp => Box::new(
54003                ReadXdrIter::<_, PathPaymentStrictSendOp>::new(&mut r.inner, r.limits.clone())
54004                    .map(|r| r.map(|t| Self::PathPaymentStrictSendOp(Box::new(t)))),
54005            ),
54006            TypeVariant::ManageSellOfferOp => Box::new(
54007                ReadXdrIter::<_, ManageSellOfferOp>::new(&mut r.inner, r.limits.clone())
54008                    .map(|r| r.map(|t| Self::ManageSellOfferOp(Box::new(t)))),
54009            ),
54010            TypeVariant::ManageBuyOfferOp => Box::new(
54011                ReadXdrIter::<_, ManageBuyOfferOp>::new(&mut r.inner, r.limits.clone())
54012                    .map(|r| r.map(|t| Self::ManageBuyOfferOp(Box::new(t)))),
54013            ),
54014            TypeVariant::CreatePassiveSellOfferOp => Box::new(
54015                ReadXdrIter::<_, CreatePassiveSellOfferOp>::new(&mut r.inner, r.limits.clone())
54016                    .map(|r| r.map(|t| Self::CreatePassiveSellOfferOp(Box::new(t)))),
54017            ),
54018            TypeVariant::SetOptionsOp => Box::new(
54019                ReadXdrIter::<_, SetOptionsOp>::new(&mut r.inner, r.limits.clone())
54020                    .map(|r| r.map(|t| Self::SetOptionsOp(Box::new(t)))),
54021            ),
54022            TypeVariant::ChangeTrustAsset => Box::new(
54023                ReadXdrIter::<_, ChangeTrustAsset>::new(&mut r.inner, r.limits.clone())
54024                    .map(|r| r.map(|t| Self::ChangeTrustAsset(Box::new(t)))),
54025            ),
54026            TypeVariant::ChangeTrustOp => Box::new(
54027                ReadXdrIter::<_, ChangeTrustOp>::new(&mut r.inner, r.limits.clone())
54028                    .map(|r| r.map(|t| Self::ChangeTrustOp(Box::new(t)))),
54029            ),
54030            TypeVariant::AllowTrustOp => Box::new(
54031                ReadXdrIter::<_, AllowTrustOp>::new(&mut r.inner, r.limits.clone())
54032                    .map(|r| r.map(|t| Self::AllowTrustOp(Box::new(t)))),
54033            ),
54034            TypeVariant::ManageDataOp => Box::new(
54035                ReadXdrIter::<_, ManageDataOp>::new(&mut r.inner, r.limits.clone())
54036                    .map(|r| r.map(|t| Self::ManageDataOp(Box::new(t)))),
54037            ),
54038            TypeVariant::BumpSequenceOp => Box::new(
54039                ReadXdrIter::<_, BumpSequenceOp>::new(&mut r.inner, r.limits.clone())
54040                    .map(|r| r.map(|t| Self::BumpSequenceOp(Box::new(t)))),
54041            ),
54042            TypeVariant::CreateClaimableBalanceOp => Box::new(
54043                ReadXdrIter::<_, CreateClaimableBalanceOp>::new(&mut r.inner, r.limits.clone())
54044                    .map(|r| r.map(|t| Self::CreateClaimableBalanceOp(Box::new(t)))),
54045            ),
54046            TypeVariant::ClaimClaimableBalanceOp => Box::new(
54047                ReadXdrIter::<_, ClaimClaimableBalanceOp>::new(&mut r.inner, r.limits.clone())
54048                    .map(|r| r.map(|t| Self::ClaimClaimableBalanceOp(Box::new(t)))),
54049            ),
54050            TypeVariant::BeginSponsoringFutureReservesOp => Box::new(
54051                ReadXdrIter::<_, BeginSponsoringFutureReservesOp>::new(
54052                    &mut r.inner,
54053                    r.limits.clone(),
54054                )
54055                .map(|r| r.map(|t| Self::BeginSponsoringFutureReservesOp(Box::new(t)))),
54056            ),
54057            TypeVariant::RevokeSponsorshipType => Box::new(
54058                ReadXdrIter::<_, RevokeSponsorshipType>::new(&mut r.inner, r.limits.clone())
54059                    .map(|r| r.map(|t| Self::RevokeSponsorshipType(Box::new(t)))),
54060            ),
54061            TypeVariant::RevokeSponsorshipOp => Box::new(
54062                ReadXdrIter::<_, RevokeSponsorshipOp>::new(&mut r.inner, r.limits.clone())
54063                    .map(|r| r.map(|t| Self::RevokeSponsorshipOp(Box::new(t)))),
54064            ),
54065            TypeVariant::RevokeSponsorshipOpSigner => Box::new(
54066                ReadXdrIter::<_, RevokeSponsorshipOpSigner>::new(&mut r.inner, r.limits.clone())
54067                    .map(|r| r.map(|t| Self::RevokeSponsorshipOpSigner(Box::new(t)))),
54068            ),
54069            TypeVariant::ClawbackOp => Box::new(
54070                ReadXdrIter::<_, ClawbackOp>::new(&mut r.inner, r.limits.clone())
54071                    .map(|r| r.map(|t| Self::ClawbackOp(Box::new(t)))),
54072            ),
54073            TypeVariant::ClawbackClaimableBalanceOp => Box::new(
54074                ReadXdrIter::<_, ClawbackClaimableBalanceOp>::new(&mut r.inner, r.limits.clone())
54075                    .map(|r| r.map(|t| Self::ClawbackClaimableBalanceOp(Box::new(t)))),
54076            ),
54077            TypeVariant::SetTrustLineFlagsOp => Box::new(
54078                ReadXdrIter::<_, SetTrustLineFlagsOp>::new(&mut r.inner, r.limits.clone())
54079                    .map(|r| r.map(|t| Self::SetTrustLineFlagsOp(Box::new(t)))),
54080            ),
54081            TypeVariant::LiquidityPoolDepositOp => Box::new(
54082                ReadXdrIter::<_, LiquidityPoolDepositOp>::new(&mut r.inner, r.limits.clone())
54083                    .map(|r| r.map(|t| Self::LiquidityPoolDepositOp(Box::new(t)))),
54084            ),
54085            TypeVariant::LiquidityPoolWithdrawOp => Box::new(
54086                ReadXdrIter::<_, LiquidityPoolWithdrawOp>::new(&mut r.inner, r.limits.clone())
54087                    .map(|r| r.map(|t| Self::LiquidityPoolWithdrawOp(Box::new(t)))),
54088            ),
54089            TypeVariant::HostFunctionType => Box::new(
54090                ReadXdrIter::<_, HostFunctionType>::new(&mut r.inner, r.limits.clone())
54091                    .map(|r| r.map(|t| Self::HostFunctionType(Box::new(t)))),
54092            ),
54093            TypeVariant::ContractIdPreimageType => Box::new(
54094                ReadXdrIter::<_, ContractIdPreimageType>::new(&mut r.inner, r.limits.clone())
54095                    .map(|r| r.map(|t| Self::ContractIdPreimageType(Box::new(t)))),
54096            ),
54097            TypeVariant::ContractIdPreimage => Box::new(
54098                ReadXdrIter::<_, ContractIdPreimage>::new(&mut r.inner, r.limits.clone())
54099                    .map(|r| r.map(|t| Self::ContractIdPreimage(Box::new(t)))),
54100            ),
54101            TypeVariant::ContractIdPreimageFromAddress => Box::new(
54102                ReadXdrIter::<_, ContractIdPreimageFromAddress>::new(
54103                    &mut r.inner,
54104                    r.limits.clone(),
54105                )
54106                .map(|r| r.map(|t| Self::ContractIdPreimageFromAddress(Box::new(t)))),
54107            ),
54108            TypeVariant::CreateContractArgs => Box::new(
54109                ReadXdrIter::<_, CreateContractArgs>::new(&mut r.inner, r.limits.clone())
54110                    .map(|r| r.map(|t| Self::CreateContractArgs(Box::new(t)))),
54111            ),
54112            TypeVariant::CreateContractArgsV2 => Box::new(
54113                ReadXdrIter::<_, CreateContractArgsV2>::new(&mut r.inner, r.limits.clone())
54114                    .map(|r| r.map(|t| Self::CreateContractArgsV2(Box::new(t)))),
54115            ),
54116            TypeVariant::InvokeContractArgs => Box::new(
54117                ReadXdrIter::<_, InvokeContractArgs>::new(&mut r.inner, r.limits.clone())
54118                    .map(|r| r.map(|t| Self::InvokeContractArgs(Box::new(t)))),
54119            ),
54120            TypeVariant::HostFunction => Box::new(
54121                ReadXdrIter::<_, HostFunction>::new(&mut r.inner, r.limits.clone())
54122                    .map(|r| r.map(|t| Self::HostFunction(Box::new(t)))),
54123            ),
54124            TypeVariant::SorobanAuthorizedFunctionType => Box::new(
54125                ReadXdrIter::<_, SorobanAuthorizedFunctionType>::new(
54126                    &mut r.inner,
54127                    r.limits.clone(),
54128                )
54129                .map(|r| r.map(|t| Self::SorobanAuthorizedFunctionType(Box::new(t)))),
54130            ),
54131            TypeVariant::SorobanAuthorizedFunction => Box::new(
54132                ReadXdrIter::<_, SorobanAuthorizedFunction>::new(&mut r.inner, r.limits.clone())
54133                    .map(|r| r.map(|t| Self::SorobanAuthorizedFunction(Box::new(t)))),
54134            ),
54135            TypeVariant::SorobanAuthorizedInvocation => Box::new(
54136                ReadXdrIter::<_, SorobanAuthorizedInvocation>::new(&mut r.inner, r.limits.clone())
54137                    .map(|r| r.map(|t| Self::SorobanAuthorizedInvocation(Box::new(t)))),
54138            ),
54139            TypeVariant::SorobanAddressCredentials => Box::new(
54140                ReadXdrIter::<_, SorobanAddressCredentials>::new(&mut r.inner, r.limits.clone())
54141                    .map(|r| r.map(|t| Self::SorobanAddressCredentials(Box::new(t)))),
54142            ),
54143            TypeVariant::SorobanCredentialsType => Box::new(
54144                ReadXdrIter::<_, SorobanCredentialsType>::new(&mut r.inner, r.limits.clone())
54145                    .map(|r| r.map(|t| Self::SorobanCredentialsType(Box::new(t)))),
54146            ),
54147            TypeVariant::SorobanCredentials => Box::new(
54148                ReadXdrIter::<_, SorobanCredentials>::new(&mut r.inner, r.limits.clone())
54149                    .map(|r| r.map(|t| Self::SorobanCredentials(Box::new(t)))),
54150            ),
54151            TypeVariant::SorobanAuthorizationEntry => Box::new(
54152                ReadXdrIter::<_, SorobanAuthorizationEntry>::new(&mut r.inner, r.limits.clone())
54153                    .map(|r| r.map(|t| Self::SorobanAuthorizationEntry(Box::new(t)))),
54154            ),
54155            TypeVariant::InvokeHostFunctionOp => Box::new(
54156                ReadXdrIter::<_, InvokeHostFunctionOp>::new(&mut r.inner, r.limits.clone())
54157                    .map(|r| r.map(|t| Self::InvokeHostFunctionOp(Box::new(t)))),
54158            ),
54159            TypeVariant::ExtendFootprintTtlOp => Box::new(
54160                ReadXdrIter::<_, ExtendFootprintTtlOp>::new(&mut r.inner, r.limits.clone())
54161                    .map(|r| r.map(|t| Self::ExtendFootprintTtlOp(Box::new(t)))),
54162            ),
54163            TypeVariant::RestoreFootprintOp => Box::new(
54164                ReadXdrIter::<_, RestoreFootprintOp>::new(&mut r.inner, r.limits.clone())
54165                    .map(|r| r.map(|t| Self::RestoreFootprintOp(Box::new(t)))),
54166            ),
54167            TypeVariant::Operation => Box::new(
54168                ReadXdrIter::<_, Operation>::new(&mut r.inner, r.limits.clone())
54169                    .map(|r| r.map(|t| Self::Operation(Box::new(t)))),
54170            ),
54171            TypeVariant::OperationBody => Box::new(
54172                ReadXdrIter::<_, OperationBody>::new(&mut r.inner, r.limits.clone())
54173                    .map(|r| r.map(|t| Self::OperationBody(Box::new(t)))),
54174            ),
54175            TypeVariant::HashIdPreimage => Box::new(
54176                ReadXdrIter::<_, HashIdPreimage>::new(&mut r.inner, r.limits.clone())
54177                    .map(|r| r.map(|t| Self::HashIdPreimage(Box::new(t)))),
54178            ),
54179            TypeVariant::HashIdPreimageOperationId => Box::new(
54180                ReadXdrIter::<_, HashIdPreimageOperationId>::new(&mut r.inner, r.limits.clone())
54181                    .map(|r| r.map(|t| Self::HashIdPreimageOperationId(Box::new(t)))),
54182            ),
54183            TypeVariant::HashIdPreimageRevokeId => Box::new(
54184                ReadXdrIter::<_, HashIdPreimageRevokeId>::new(&mut r.inner, r.limits.clone())
54185                    .map(|r| r.map(|t| Self::HashIdPreimageRevokeId(Box::new(t)))),
54186            ),
54187            TypeVariant::HashIdPreimageContractId => Box::new(
54188                ReadXdrIter::<_, HashIdPreimageContractId>::new(&mut r.inner, r.limits.clone())
54189                    .map(|r| r.map(|t| Self::HashIdPreimageContractId(Box::new(t)))),
54190            ),
54191            TypeVariant::HashIdPreimageSorobanAuthorization => Box::new(
54192                ReadXdrIter::<_, HashIdPreimageSorobanAuthorization>::new(
54193                    &mut r.inner,
54194                    r.limits.clone(),
54195                )
54196                .map(|r| r.map(|t| Self::HashIdPreimageSorobanAuthorization(Box::new(t)))),
54197            ),
54198            TypeVariant::MemoType => Box::new(
54199                ReadXdrIter::<_, MemoType>::new(&mut r.inner, r.limits.clone())
54200                    .map(|r| r.map(|t| Self::MemoType(Box::new(t)))),
54201            ),
54202            TypeVariant::Memo => Box::new(
54203                ReadXdrIter::<_, Memo>::new(&mut r.inner, r.limits.clone())
54204                    .map(|r| r.map(|t| Self::Memo(Box::new(t)))),
54205            ),
54206            TypeVariant::TimeBounds => Box::new(
54207                ReadXdrIter::<_, TimeBounds>::new(&mut r.inner, r.limits.clone())
54208                    .map(|r| r.map(|t| Self::TimeBounds(Box::new(t)))),
54209            ),
54210            TypeVariant::LedgerBounds => Box::new(
54211                ReadXdrIter::<_, LedgerBounds>::new(&mut r.inner, r.limits.clone())
54212                    .map(|r| r.map(|t| Self::LedgerBounds(Box::new(t)))),
54213            ),
54214            TypeVariant::PreconditionsV2 => Box::new(
54215                ReadXdrIter::<_, PreconditionsV2>::new(&mut r.inner, r.limits.clone())
54216                    .map(|r| r.map(|t| Self::PreconditionsV2(Box::new(t)))),
54217            ),
54218            TypeVariant::PreconditionType => Box::new(
54219                ReadXdrIter::<_, PreconditionType>::new(&mut r.inner, r.limits.clone())
54220                    .map(|r| r.map(|t| Self::PreconditionType(Box::new(t)))),
54221            ),
54222            TypeVariant::Preconditions => Box::new(
54223                ReadXdrIter::<_, Preconditions>::new(&mut r.inner, r.limits.clone())
54224                    .map(|r| r.map(|t| Self::Preconditions(Box::new(t)))),
54225            ),
54226            TypeVariant::LedgerFootprint => Box::new(
54227                ReadXdrIter::<_, LedgerFootprint>::new(&mut r.inner, r.limits.clone())
54228                    .map(|r| r.map(|t| Self::LedgerFootprint(Box::new(t)))),
54229            ),
54230            TypeVariant::ArchivalProofType => Box::new(
54231                ReadXdrIter::<_, ArchivalProofType>::new(&mut r.inner, r.limits.clone())
54232                    .map(|r| r.map(|t| Self::ArchivalProofType(Box::new(t)))),
54233            ),
54234            TypeVariant::ArchivalProofNode => Box::new(
54235                ReadXdrIter::<_, ArchivalProofNode>::new(&mut r.inner, r.limits.clone())
54236                    .map(|r| r.map(|t| Self::ArchivalProofNode(Box::new(t)))),
54237            ),
54238            TypeVariant::ProofLevel => Box::new(
54239                ReadXdrIter::<_, ProofLevel>::new(&mut r.inner, r.limits.clone())
54240                    .map(|r| r.map(|t| Self::ProofLevel(Box::new(t)))),
54241            ),
54242            TypeVariant::NonexistenceProofBody => Box::new(
54243                ReadXdrIter::<_, NonexistenceProofBody>::new(&mut r.inner, r.limits.clone())
54244                    .map(|r| r.map(|t| Self::NonexistenceProofBody(Box::new(t)))),
54245            ),
54246            TypeVariant::ExistenceProofBody => Box::new(
54247                ReadXdrIter::<_, ExistenceProofBody>::new(&mut r.inner, r.limits.clone())
54248                    .map(|r| r.map(|t| Self::ExistenceProofBody(Box::new(t)))),
54249            ),
54250            TypeVariant::ArchivalProof => Box::new(
54251                ReadXdrIter::<_, ArchivalProof>::new(&mut r.inner, r.limits.clone())
54252                    .map(|r| r.map(|t| Self::ArchivalProof(Box::new(t)))),
54253            ),
54254            TypeVariant::ArchivalProofBody => Box::new(
54255                ReadXdrIter::<_, ArchivalProofBody>::new(&mut r.inner, r.limits.clone())
54256                    .map(|r| r.map(|t| Self::ArchivalProofBody(Box::new(t)))),
54257            ),
54258            TypeVariant::SorobanResources => Box::new(
54259                ReadXdrIter::<_, SorobanResources>::new(&mut r.inner, r.limits.clone())
54260                    .map(|r| r.map(|t| Self::SorobanResources(Box::new(t)))),
54261            ),
54262            TypeVariant::SorobanTransactionData => Box::new(
54263                ReadXdrIter::<_, SorobanTransactionData>::new(&mut r.inner, r.limits.clone())
54264                    .map(|r| r.map(|t| Self::SorobanTransactionData(Box::new(t)))),
54265            ),
54266            TypeVariant::TransactionV0 => Box::new(
54267                ReadXdrIter::<_, TransactionV0>::new(&mut r.inner, r.limits.clone())
54268                    .map(|r| r.map(|t| Self::TransactionV0(Box::new(t)))),
54269            ),
54270            TypeVariant::TransactionV0Ext => Box::new(
54271                ReadXdrIter::<_, TransactionV0Ext>::new(&mut r.inner, r.limits.clone())
54272                    .map(|r| r.map(|t| Self::TransactionV0Ext(Box::new(t)))),
54273            ),
54274            TypeVariant::TransactionV0Envelope => Box::new(
54275                ReadXdrIter::<_, TransactionV0Envelope>::new(&mut r.inner, r.limits.clone())
54276                    .map(|r| r.map(|t| Self::TransactionV0Envelope(Box::new(t)))),
54277            ),
54278            TypeVariant::Transaction => Box::new(
54279                ReadXdrIter::<_, Transaction>::new(&mut r.inner, r.limits.clone())
54280                    .map(|r| r.map(|t| Self::Transaction(Box::new(t)))),
54281            ),
54282            TypeVariant::TransactionExt => Box::new(
54283                ReadXdrIter::<_, TransactionExt>::new(&mut r.inner, r.limits.clone())
54284                    .map(|r| r.map(|t| Self::TransactionExt(Box::new(t)))),
54285            ),
54286            TypeVariant::TransactionV1Envelope => Box::new(
54287                ReadXdrIter::<_, TransactionV1Envelope>::new(&mut r.inner, r.limits.clone())
54288                    .map(|r| r.map(|t| Self::TransactionV1Envelope(Box::new(t)))),
54289            ),
54290            TypeVariant::FeeBumpTransaction => Box::new(
54291                ReadXdrIter::<_, FeeBumpTransaction>::new(&mut r.inner, r.limits.clone())
54292                    .map(|r| r.map(|t| Self::FeeBumpTransaction(Box::new(t)))),
54293            ),
54294            TypeVariant::FeeBumpTransactionInnerTx => Box::new(
54295                ReadXdrIter::<_, FeeBumpTransactionInnerTx>::new(&mut r.inner, r.limits.clone())
54296                    .map(|r| r.map(|t| Self::FeeBumpTransactionInnerTx(Box::new(t)))),
54297            ),
54298            TypeVariant::FeeBumpTransactionExt => Box::new(
54299                ReadXdrIter::<_, FeeBumpTransactionExt>::new(&mut r.inner, r.limits.clone())
54300                    .map(|r| r.map(|t| Self::FeeBumpTransactionExt(Box::new(t)))),
54301            ),
54302            TypeVariant::FeeBumpTransactionEnvelope => Box::new(
54303                ReadXdrIter::<_, FeeBumpTransactionEnvelope>::new(&mut r.inner, r.limits.clone())
54304                    .map(|r| r.map(|t| Self::FeeBumpTransactionEnvelope(Box::new(t)))),
54305            ),
54306            TypeVariant::TransactionEnvelope => Box::new(
54307                ReadXdrIter::<_, TransactionEnvelope>::new(&mut r.inner, r.limits.clone())
54308                    .map(|r| r.map(|t| Self::TransactionEnvelope(Box::new(t)))),
54309            ),
54310            TypeVariant::TransactionSignaturePayload => Box::new(
54311                ReadXdrIter::<_, TransactionSignaturePayload>::new(&mut r.inner, r.limits.clone())
54312                    .map(|r| r.map(|t| Self::TransactionSignaturePayload(Box::new(t)))),
54313            ),
54314            TypeVariant::TransactionSignaturePayloadTaggedTransaction => Box::new(
54315                ReadXdrIter::<_, TransactionSignaturePayloadTaggedTransaction>::new(
54316                    &mut r.inner,
54317                    r.limits.clone(),
54318                )
54319                .map(|r| {
54320                    r.map(|t| Self::TransactionSignaturePayloadTaggedTransaction(Box::new(t)))
54321                }),
54322            ),
54323            TypeVariant::ClaimAtomType => Box::new(
54324                ReadXdrIter::<_, ClaimAtomType>::new(&mut r.inner, r.limits.clone())
54325                    .map(|r| r.map(|t| Self::ClaimAtomType(Box::new(t)))),
54326            ),
54327            TypeVariant::ClaimOfferAtomV0 => Box::new(
54328                ReadXdrIter::<_, ClaimOfferAtomV0>::new(&mut r.inner, r.limits.clone())
54329                    .map(|r| r.map(|t| Self::ClaimOfferAtomV0(Box::new(t)))),
54330            ),
54331            TypeVariant::ClaimOfferAtom => Box::new(
54332                ReadXdrIter::<_, ClaimOfferAtom>::new(&mut r.inner, r.limits.clone())
54333                    .map(|r| r.map(|t| Self::ClaimOfferAtom(Box::new(t)))),
54334            ),
54335            TypeVariant::ClaimLiquidityAtom => Box::new(
54336                ReadXdrIter::<_, ClaimLiquidityAtom>::new(&mut r.inner, r.limits.clone())
54337                    .map(|r| r.map(|t| Self::ClaimLiquidityAtom(Box::new(t)))),
54338            ),
54339            TypeVariant::ClaimAtom => Box::new(
54340                ReadXdrIter::<_, ClaimAtom>::new(&mut r.inner, r.limits.clone())
54341                    .map(|r| r.map(|t| Self::ClaimAtom(Box::new(t)))),
54342            ),
54343            TypeVariant::CreateAccountResultCode => Box::new(
54344                ReadXdrIter::<_, CreateAccountResultCode>::new(&mut r.inner, r.limits.clone())
54345                    .map(|r| r.map(|t| Self::CreateAccountResultCode(Box::new(t)))),
54346            ),
54347            TypeVariant::CreateAccountResult => Box::new(
54348                ReadXdrIter::<_, CreateAccountResult>::new(&mut r.inner, r.limits.clone())
54349                    .map(|r| r.map(|t| Self::CreateAccountResult(Box::new(t)))),
54350            ),
54351            TypeVariant::PaymentResultCode => Box::new(
54352                ReadXdrIter::<_, PaymentResultCode>::new(&mut r.inner, r.limits.clone())
54353                    .map(|r| r.map(|t| Self::PaymentResultCode(Box::new(t)))),
54354            ),
54355            TypeVariant::PaymentResult => Box::new(
54356                ReadXdrIter::<_, PaymentResult>::new(&mut r.inner, r.limits.clone())
54357                    .map(|r| r.map(|t| Self::PaymentResult(Box::new(t)))),
54358            ),
54359            TypeVariant::PathPaymentStrictReceiveResultCode => Box::new(
54360                ReadXdrIter::<_, PathPaymentStrictReceiveResultCode>::new(
54361                    &mut r.inner,
54362                    r.limits.clone(),
54363                )
54364                .map(|r| r.map(|t| Self::PathPaymentStrictReceiveResultCode(Box::new(t)))),
54365            ),
54366            TypeVariant::SimplePaymentResult => Box::new(
54367                ReadXdrIter::<_, SimplePaymentResult>::new(&mut r.inner, r.limits.clone())
54368                    .map(|r| r.map(|t| Self::SimplePaymentResult(Box::new(t)))),
54369            ),
54370            TypeVariant::PathPaymentStrictReceiveResult => Box::new(
54371                ReadXdrIter::<_, PathPaymentStrictReceiveResult>::new(
54372                    &mut r.inner,
54373                    r.limits.clone(),
54374                )
54375                .map(|r| r.map(|t| Self::PathPaymentStrictReceiveResult(Box::new(t)))),
54376            ),
54377            TypeVariant::PathPaymentStrictReceiveResultSuccess => Box::new(
54378                ReadXdrIter::<_, PathPaymentStrictReceiveResultSuccess>::new(
54379                    &mut r.inner,
54380                    r.limits.clone(),
54381                )
54382                .map(|r| r.map(|t| Self::PathPaymentStrictReceiveResultSuccess(Box::new(t)))),
54383            ),
54384            TypeVariant::PathPaymentStrictSendResultCode => Box::new(
54385                ReadXdrIter::<_, PathPaymentStrictSendResultCode>::new(
54386                    &mut r.inner,
54387                    r.limits.clone(),
54388                )
54389                .map(|r| r.map(|t| Self::PathPaymentStrictSendResultCode(Box::new(t)))),
54390            ),
54391            TypeVariant::PathPaymentStrictSendResult => Box::new(
54392                ReadXdrIter::<_, PathPaymentStrictSendResult>::new(&mut r.inner, r.limits.clone())
54393                    .map(|r| r.map(|t| Self::PathPaymentStrictSendResult(Box::new(t)))),
54394            ),
54395            TypeVariant::PathPaymentStrictSendResultSuccess => Box::new(
54396                ReadXdrIter::<_, PathPaymentStrictSendResultSuccess>::new(
54397                    &mut r.inner,
54398                    r.limits.clone(),
54399                )
54400                .map(|r| r.map(|t| Self::PathPaymentStrictSendResultSuccess(Box::new(t)))),
54401            ),
54402            TypeVariant::ManageSellOfferResultCode => Box::new(
54403                ReadXdrIter::<_, ManageSellOfferResultCode>::new(&mut r.inner, r.limits.clone())
54404                    .map(|r| r.map(|t| Self::ManageSellOfferResultCode(Box::new(t)))),
54405            ),
54406            TypeVariant::ManageOfferEffect => Box::new(
54407                ReadXdrIter::<_, ManageOfferEffect>::new(&mut r.inner, r.limits.clone())
54408                    .map(|r| r.map(|t| Self::ManageOfferEffect(Box::new(t)))),
54409            ),
54410            TypeVariant::ManageOfferSuccessResult => Box::new(
54411                ReadXdrIter::<_, ManageOfferSuccessResult>::new(&mut r.inner, r.limits.clone())
54412                    .map(|r| r.map(|t| Self::ManageOfferSuccessResult(Box::new(t)))),
54413            ),
54414            TypeVariant::ManageOfferSuccessResultOffer => Box::new(
54415                ReadXdrIter::<_, ManageOfferSuccessResultOffer>::new(
54416                    &mut r.inner,
54417                    r.limits.clone(),
54418                )
54419                .map(|r| r.map(|t| Self::ManageOfferSuccessResultOffer(Box::new(t)))),
54420            ),
54421            TypeVariant::ManageSellOfferResult => Box::new(
54422                ReadXdrIter::<_, ManageSellOfferResult>::new(&mut r.inner, r.limits.clone())
54423                    .map(|r| r.map(|t| Self::ManageSellOfferResult(Box::new(t)))),
54424            ),
54425            TypeVariant::ManageBuyOfferResultCode => Box::new(
54426                ReadXdrIter::<_, ManageBuyOfferResultCode>::new(&mut r.inner, r.limits.clone())
54427                    .map(|r| r.map(|t| Self::ManageBuyOfferResultCode(Box::new(t)))),
54428            ),
54429            TypeVariant::ManageBuyOfferResult => Box::new(
54430                ReadXdrIter::<_, ManageBuyOfferResult>::new(&mut r.inner, r.limits.clone())
54431                    .map(|r| r.map(|t| Self::ManageBuyOfferResult(Box::new(t)))),
54432            ),
54433            TypeVariant::SetOptionsResultCode => Box::new(
54434                ReadXdrIter::<_, SetOptionsResultCode>::new(&mut r.inner, r.limits.clone())
54435                    .map(|r| r.map(|t| Self::SetOptionsResultCode(Box::new(t)))),
54436            ),
54437            TypeVariant::SetOptionsResult => Box::new(
54438                ReadXdrIter::<_, SetOptionsResult>::new(&mut r.inner, r.limits.clone())
54439                    .map(|r| r.map(|t| Self::SetOptionsResult(Box::new(t)))),
54440            ),
54441            TypeVariant::ChangeTrustResultCode => Box::new(
54442                ReadXdrIter::<_, ChangeTrustResultCode>::new(&mut r.inner, r.limits.clone())
54443                    .map(|r| r.map(|t| Self::ChangeTrustResultCode(Box::new(t)))),
54444            ),
54445            TypeVariant::ChangeTrustResult => Box::new(
54446                ReadXdrIter::<_, ChangeTrustResult>::new(&mut r.inner, r.limits.clone())
54447                    .map(|r| r.map(|t| Self::ChangeTrustResult(Box::new(t)))),
54448            ),
54449            TypeVariant::AllowTrustResultCode => Box::new(
54450                ReadXdrIter::<_, AllowTrustResultCode>::new(&mut r.inner, r.limits.clone())
54451                    .map(|r| r.map(|t| Self::AllowTrustResultCode(Box::new(t)))),
54452            ),
54453            TypeVariant::AllowTrustResult => Box::new(
54454                ReadXdrIter::<_, AllowTrustResult>::new(&mut r.inner, r.limits.clone())
54455                    .map(|r| r.map(|t| Self::AllowTrustResult(Box::new(t)))),
54456            ),
54457            TypeVariant::AccountMergeResultCode => Box::new(
54458                ReadXdrIter::<_, AccountMergeResultCode>::new(&mut r.inner, r.limits.clone())
54459                    .map(|r| r.map(|t| Self::AccountMergeResultCode(Box::new(t)))),
54460            ),
54461            TypeVariant::AccountMergeResult => Box::new(
54462                ReadXdrIter::<_, AccountMergeResult>::new(&mut r.inner, r.limits.clone())
54463                    .map(|r| r.map(|t| Self::AccountMergeResult(Box::new(t)))),
54464            ),
54465            TypeVariant::InflationResultCode => Box::new(
54466                ReadXdrIter::<_, InflationResultCode>::new(&mut r.inner, r.limits.clone())
54467                    .map(|r| r.map(|t| Self::InflationResultCode(Box::new(t)))),
54468            ),
54469            TypeVariant::InflationPayout => Box::new(
54470                ReadXdrIter::<_, InflationPayout>::new(&mut r.inner, r.limits.clone())
54471                    .map(|r| r.map(|t| Self::InflationPayout(Box::new(t)))),
54472            ),
54473            TypeVariant::InflationResult => Box::new(
54474                ReadXdrIter::<_, InflationResult>::new(&mut r.inner, r.limits.clone())
54475                    .map(|r| r.map(|t| Self::InflationResult(Box::new(t)))),
54476            ),
54477            TypeVariant::ManageDataResultCode => Box::new(
54478                ReadXdrIter::<_, ManageDataResultCode>::new(&mut r.inner, r.limits.clone())
54479                    .map(|r| r.map(|t| Self::ManageDataResultCode(Box::new(t)))),
54480            ),
54481            TypeVariant::ManageDataResult => Box::new(
54482                ReadXdrIter::<_, ManageDataResult>::new(&mut r.inner, r.limits.clone())
54483                    .map(|r| r.map(|t| Self::ManageDataResult(Box::new(t)))),
54484            ),
54485            TypeVariant::BumpSequenceResultCode => Box::new(
54486                ReadXdrIter::<_, BumpSequenceResultCode>::new(&mut r.inner, r.limits.clone())
54487                    .map(|r| r.map(|t| Self::BumpSequenceResultCode(Box::new(t)))),
54488            ),
54489            TypeVariant::BumpSequenceResult => Box::new(
54490                ReadXdrIter::<_, BumpSequenceResult>::new(&mut r.inner, r.limits.clone())
54491                    .map(|r| r.map(|t| Self::BumpSequenceResult(Box::new(t)))),
54492            ),
54493            TypeVariant::CreateClaimableBalanceResultCode => Box::new(
54494                ReadXdrIter::<_, CreateClaimableBalanceResultCode>::new(
54495                    &mut r.inner,
54496                    r.limits.clone(),
54497                )
54498                .map(|r| r.map(|t| Self::CreateClaimableBalanceResultCode(Box::new(t)))),
54499            ),
54500            TypeVariant::CreateClaimableBalanceResult => Box::new(
54501                ReadXdrIter::<_, CreateClaimableBalanceResult>::new(&mut r.inner, r.limits.clone())
54502                    .map(|r| r.map(|t| Self::CreateClaimableBalanceResult(Box::new(t)))),
54503            ),
54504            TypeVariant::ClaimClaimableBalanceResultCode => Box::new(
54505                ReadXdrIter::<_, ClaimClaimableBalanceResultCode>::new(
54506                    &mut r.inner,
54507                    r.limits.clone(),
54508                )
54509                .map(|r| r.map(|t| Self::ClaimClaimableBalanceResultCode(Box::new(t)))),
54510            ),
54511            TypeVariant::ClaimClaimableBalanceResult => Box::new(
54512                ReadXdrIter::<_, ClaimClaimableBalanceResult>::new(&mut r.inner, r.limits.clone())
54513                    .map(|r| r.map(|t| Self::ClaimClaimableBalanceResult(Box::new(t)))),
54514            ),
54515            TypeVariant::BeginSponsoringFutureReservesResultCode => Box::new(
54516                ReadXdrIter::<_, BeginSponsoringFutureReservesResultCode>::new(
54517                    &mut r.inner,
54518                    r.limits.clone(),
54519                )
54520                .map(|r| r.map(|t| Self::BeginSponsoringFutureReservesResultCode(Box::new(t)))),
54521            ),
54522            TypeVariant::BeginSponsoringFutureReservesResult => Box::new(
54523                ReadXdrIter::<_, BeginSponsoringFutureReservesResult>::new(
54524                    &mut r.inner,
54525                    r.limits.clone(),
54526                )
54527                .map(|r| r.map(|t| Self::BeginSponsoringFutureReservesResult(Box::new(t)))),
54528            ),
54529            TypeVariant::EndSponsoringFutureReservesResultCode => Box::new(
54530                ReadXdrIter::<_, EndSponsoringFutureReservesResultCode>::new(
54531                    &mut r.inner,
54532                    r.limits.clone(),
54533                )
54534                .map(|r| r.map(|t| Self::EndSponsoringFutureReservesResultCode(Box::new(t)))),
54535            ),
54536            TypeVariant::EndSponsoringFutureReservesResult => Box::new(
54537                ReadXdrIter::<_, EndSponsoringFutureReservesResult>::new(
54538                    &mut r.inner,
54539                    r.limits.clone(),
54540                )
54541                .map(|r| r.map(|t| Self::EndSponsoringFutureReservesResult(Box::new(t)))),
54542            ),
54543            TypeVariant::RevokeSponsorshipResultCode => Box::new(
54544                ReadXdrIter::<_, RevokeSponsorshipResultCode>::new(&mut r.inner, r.limits.clone())
54545                    .map(|r| r.map(|t| Self::RevokeSponsorshipResultCode(Box::new(t)))),
54546            ),
54547            TypeVariant::RevokeSponsorshipResult => Box::new(
54548                ReadXdrIter::<_, RevokeSponsorshipResult>::new(&mut r.inner, r.limits.clone())
54549                    .map(|r| r.map(|t| Self::RevokeSponsorshipResult(Box::new(t)))),
54550            ),
54551            TypeVariant::ClawbackResultCode => Box::new(
54552                ReadXdrIter::<_, ClawbackResultCode>::new(&mut r.inner, r.limits.clone())
54553                    .map(|r| r.map(|t| Self::ClawbackResultCode(Box::new(t)))),
54554            ),
54555            TypeVariant::ClawbackResult => Box::new(
54556                ReadXdrIter::<_, ClawbackResult>::new(&mut r.inner, r.limits.clone())
54557                    .map(|r| r.map(|t| Self::ClawbackResult(Box::new(t)))),
54558            ),
54559            TypeVariant::ClawbackClaimableBalanceResultCode => Box::new(
54560                ReadXdrIter::<_, ClawbackClaimableBalanceResultCode>::new(
54561                    &mut r.inner,
54562                    r.limits.clone(),
54563                )
54564                .map(|r| r.map(|t| Self::ClawbackClaimableBalanceResultCode(Box::new(t)))),
54565            ),
54566            TypeVariant::ClawbackClaimableBalanceResult => Box::new(
54567                ReadXdrIter::<_, ClawbackClaimableBalanceResult>::new(
54568                    &mut r.inner,
54569                    r.limits.clone(),
54570                )
54571                .map(|r| r.map(|t| Self::ClawbackClaimableBalanceResult(Box::new(t)))),
54572            ),
54573            TypeVariant::SetTrustLineFlagsResultCode => Box::new(
54574                ReadXdrIter::<_, SetTrustLineFlagsResultCode>::new(&mut r.inner, r.limits.clone())
54575                    .map(|r| r.map(|t| Self::SetTrustLineFlagsResultCode(Box::new(t)))),
54576            ),
54577            TypeVariant::SetTrustLineFlagsResult => Box::new(
54578                ReadXdrIter::<_, SetTrustLineFlagsResult>::new(&mut r.inner, r.limits.clone())
54579                    .map(|r| r.map(|t| Self::SetTrustLineFlagsResult(Box::new(t)))),
54580            ),
54581            TypeVariant::LiquidityPoolDepositResultCode => Box::new(
54582                ReadXdrIter::<_, LiquidityPoolDepositResultCode>::new(
54583                    &mut r.inner,
54584                    r.limits.clone(),
54585                )
54586                .map(|r| r.map(|t| Self::LiquidityPoolDepositResultCode(Box::new(t)))),
54587            ),
54588            TypeVariant::LiquidityPoolDepositResult => Box::new(
54589                ReadXdrIter::<_, LiquidityPoolDepositResult>::new(&mut r.inner, r.limits.clone())
54590                    .map(|r| r.map(|t| Self::LiquidityPoolDepositResult(Box::new(t)))),
54591            ),
54592            TypeVariant::LiquidityPoolWithdrawResultCode => Box::new(
54593                ReadXdrIter::<_, LiquidityPoolWithdrawResultCode>::new(
54594                    &mut r.inner,
54595                    r.limits.clone(),
54596                )
54597                .map(|r| r.map(|t| Self::LiquidityPoolWithdrawResultCode(Box::new(t)))),
54598            ),
54599            TypeVariant::LiquidityPoolWithdrawResult => Box::new(
54600                ReadXdrIter::<_, LiquidityPoolWithdrawResult>::new(&mut r.inner, r.limits.clone())
54601                    .map(|r| r.map(|t| Self::LiquidityPoolWithdrawResult(Box::new(t)))),
54602            ),
54603            TypeVariant::InvokeHostFunctionResultCode => Box::new(
54604                ReadXdrIter::<_, InvokeHostFunctionResultCode>::new(&mut r.inner, r.limits.clone())
54605                    .map(|r| r.map(|t| Self::InvokeHostFunctionResultCode(Box::new(t)))),
54606            ),
54607            TypeVariant::InvokeHostFunctionResult => Box::new(
54608                ReadXdrIter::<_, InvokeHostFunctionResult>::new(&mut r.inner, r.limits.clone())
54609                    .map(|r| r.map(|t| Self::InvokeHostFunctionResult(Box::new(t)))),
54610            ),
54611            TypeVariant::ExtendFootprintTtlResultCode => Box::new(
54612                ReadXdrIter::<_, ExtendFootprintTtlResultCode>::new(&mut r.inner, r.limits.clone())
54613                    .map(|r| r.map(|t| Self::ExtendFootprintTtlResultCode(Box::new(t)))),
54614            ),
54615            TypeVariant::ExtendFootprintTtlResult => Box::new(
54616                ReadXdrIter::<_, ExtendFootprintTtlResult>::new(&mut r.inner, r.limits.clone())
54617                    .map(|r| r.map(|t| Self::ExtendFootprintTtlResult(Box::new(t)))),
54618            ),
54619            TypeVariant::RestoreFootprintResultCode => Box::new(
54620                ReadXdrIter::<_, RestoreFootprintResultCode>::new(&mut r.inner, r.limits.clone())
54621                    .map(|r| r.map(|t| Self::RestoreFootprintResultCode(Box::new(t)))),
54622            ),
54623            TypeVariant::RestoreFootprintResult => Box::new(
54624                ReadXdrIter::<_, RestoreFootprintResult>::new(&mut r.inner, r.limits.clone())
54625                    .map(|r| r.map(|t| Self::RestoreFootprintResult(Box::new(t)))),
54626            ),
54627            TypeVariant::OperationResultCode => Box::new(
54628                ReadXdrIter::<_, OperationResultCode>::new(&mut r.inner, r.limits.clone())
54629                    .map(|r| r.map(|t| Self::OperationResultCode(Box::new(t)))),
54630            ),
54631            TypeVariant::OperationResult => Box::new(
54632                ReadXdrIter::<_, OperationResult>::new(&mut r.inner, r.limits.clone())
54633                    .map(|r| r.map(|t| Self::OperationResult(Box::new(t)))),
54634            ),
54635            TypeVariant::OperationResultTr => Box::new(
54636                ReadXdrIter::<_, OperationResultTr>::new(&mut r.inner, r.limits.clone())
54637                    .map(|r| r.map(|t| Self::OperationResultTr(Box::new(t)))),
54638            ),
54639            TypeVariant::TransactionResultCode => Box::new(
54640                ReadXdrIter::<_, TransactionResultCode>::new(&mut r.inner, r.limits.clone())
54641                    .map(|r| r.map(|t| Self::TransactionResultCode(Box::new(t)))),
54642            ),
54643            TypeVariant::InnerTransactionResult => Box::new(
54644                ReadXdrIter::<_, InnerTransactionResult>::new(&mut r.inner, r.limits.clone())
54645                    .map(|r| r.map(|t| Self::InnerTransactionResult(Box::new(t)))),
54646            ),
54647            TypeVariant::InnerTransactionResultResult => Box::new(
54648                ReadXdrIter::<_, InnerTransactionResultResult>::new(&mut r.inner, r.limits.clone())
54649                    .map(|r| r.map(|t| Self::InnerTransactionResultResult(Box::new(t)))),
54650            ),
54651            TypeVariant::InnerTransactionResultExt => Box::new(
54652                ReadXdrIter::<_, InnerTransactionResultExt>::new(&mut r.inner, r.limits.clone())
54653                    .map(|r| r.map(|t| Self::InnerTransactionResultExt(Box::new(t)))),
54654            ),
54655            TypeVariant::InnerTransactionResultPair => Box::new(
54656                ReadXdrIter::<_, InnerTransactionResultPair>::new(&mut r.inner, r.limits.clone())
54657                    .map(|r| r.map(|t| Self::InnerTransactionResultPair(Box::new(t)))),
54658            ),
54659            TypeVariant::TransactionResult => Box::new(
54660                ReadXdrIter::<_, TransactionResult>::new(&mut r.inner, r.limits.clone())
54661                    .map(|r| r.map(|t| Self::TransactionResult(Box::new(t)))),
54662            ),
54663            TypeVariant::TransactionResultResult => Box::new(
54664                ReadXdrIter::<_, TransactionResultResult>::new(&mut r.inner, r.limits.clone())
54665                    .map(|r| r.map(|t| Self::TransactionResultResult(Box::new(t)))),
54666            ),
54667            TypeVariant::TransactionResultExt => Box::new(
54668                ReadXdrIter::<_, TransactionResultExt>::new(&mut r.inner, r.limits.clone())
54669                    .map(|r| r.map(|t| Self::TransactionResultExt(Box::new(t)))),
54670            ),
54671            TypeVariant::Hash => Box::new(
54672                ReadXdrIter::<_, Hash>::new(&mut r.inner, r.limits.clone())
54673                    .map(|r| r.map(|t| Self::Hash(Box::new(t)))),
54674            ),
54675            TypeVariant::Uint256 => Box::new(
54676                ReadXdrIter::<_, Uint256>::new(&mut r.inner, r.limits.clone())
54677                    .map(|r| r.map(|t| Self::Uint256(Box::new(t)))),
54678            ),
54679            TypeVariant::Uint32 => Box::new(
54680                ReadXdrIter::<_, Uint32>::new(&mut r.inner, r.limits.clone())
54681                    .map(|r| r.map(|t| Self::Uint32(Box::new(t)))),
54682            ),
54683            TypeVariant::Int32 => Box::new(
54684                ReadXdrIter::<_, Int32>::new(&mut r.inner, r.limits.clone())
54685                    .map(|r| r.map(|t| Self::Int32(Box::new(t)))),
54686            ),
54687            TypeVariant::Uint64 => Box::new(
54688                ReadXdrIter::<_, Uint64>::new(&mut r.inner, r.limits.clone())
54689                    .map(|r| r.map(|t| Self::Uint64(Box::new(t)))),
54690            ),
54691            TypeVariant::Int64 => Box::new(
54692                ReadXdrIter::<_, Int64>::new(&mut r.inner, r.limits.clone())
54693                    .map(|r| r.map(|t| Self::Int64(Box::new(t)))),
54694            ),
54695            TypeVariant::TimePoint => Box::new(
54696                ReadXdrIter::<_, TimePoint>::new(&mut r.inner, r.limits.clone())
54697                    .map(|r| r.map(|t| Self::TimePoint(Box::new(t)))),
54698            ),
54699            TypeVariant::Duration => Box::new(
54700                ReadXdrIter::<_, Duration>::new(&mut r.inner, r.limits.clone())
54701                    .map(|r| r.map(|t| Self::Duration(Box::new(t)))),
54702            ),
54703            TypeVariant::ExtensionPoint => Box::new(
54704                ReadXdrIter::<_, ExtensionPoint>::new(&mut r.inner, r.limits.clone())
54705                    .map(|r| r.map(|t| Self::ExtensionPoint(Box::new(t)))),
54706            ),
54707            TypeVariant::CryptoKeyType => Box::new(
54708                ReadXdrIter::<_, CryptoKeyType>::new(&mut r.inner, r.limits.clone())
54709                    .map(|r| r.map(|t| Self::CryptoKeyType(Box::new(t)))),
54710            ),
54711            TypeVariant::PublicKeyType => Box::new(
54712                ReadXdrIter::<_, PublicKeyType>::new(&mut r.inner, r.limits.clone())
54713                    .map(|r| r.map(|t| Self::PublicKeyType(Box::new(t)))),
54714            ),
54715            TypeVariant::SignerKeyType => Box::new(
54716                ReadXdrIter::<_, SignerKeyType>::new(&mut r.inner, r.limits.clone())
54717                    .map(|r| r.map(|t| Self::SignerKeyType(Box::new(t)))),
54718            ),
54719            TypeVariant::PublicKey => Box::new(
54720                ReadXdrIter::<_, PublicKey>::new(&mut r.inner, r.limits.clone())
54721                    .map(|r| r.map(|t| Self::PublicKey(Box::new(t)))),
54722            ),
54723            TypeVariant::SignerKey => Box::new(
54724                ReadXdrIter::<_, SignerKey>::new(&mut r.inner, r.limits.clone())
54725                    .map(|r| r.map(|t| Self::SignerKey(Box::new(t)))),
54726            ),
54727            TypeVariant::SignerKeyEd25519SignedPayload => Box::new(
54728                ReadXdrIter::<_, SignerKeyEd25519SignedPayload>::new(
54729                    &mut r.inner,
54730                    r.limits.clone(),
54731                )
54732                .map(|r| r.map(|t| Self::SignerKeyEd25519SignedPayload(Box::new(t)))),
54733            ),
54734            TypeVariant::Signature => Box::new(
54735                ReadXdrIter::<_, Signature>::new(&mut r.inner, r.limits.clone())
54736                    .map(|r| r.map(|t| Self::Signature(Box::new(t)))),
54737            ),
54738            TypeVariant::SignatureHint => Box::new(
54739                ReadXdrIter::<_, SignatureHint>::new(&mut r.inner, r.limits.clone())
54740                    .map(|r| r.map(|t| Self::SignatureHint(Box::new(t)))),
54741            ),
54742            TypeVariant::NodeId => Box::new(
54743                ReadXdrIter::<_, NodeId>::new(&mut r.inner, r.limits.clone())
54744                    .map(|r| r.map(|t| Self::NodeId(Box::new(t)))),
54745            ),
54746            TypeVariant::AccountId => Box::new(
54747                ReadXdrIter::<_, AccountId>::new(&mut r.inner, r.limits.clone())
54748                    .map(|r| r.map(|t| Self::AccountId(Box::new(t)))),
54749            ),
54750            TypeVariant::Curve25519Secret => Box::new(
54751                ReadXdrIter::<_, Curve25519Secret>::new(&mut r.inner, r.limits.clone())
54752                    .map(|r| r.map(|t| Self::Curve25519Secret(Box::new(t)))),
54753            ),
54754            TypeVariant::Curve25519Public => Box::new(
54755                ReadXdrIter::<_, Curve25519Public>::new(&mut r.inner, r.limits.clone())
54756                    .map(|r| r.map(|t| Self::Curve25519Public(Box::new(t)))),
54757            ),
54758            TypeVariant::HmacSha256Key => Box::new(
54759                ReadXdrIter::<_, HmacSha256Key>::new(&mut r.inner, r.limits.clone())
54760                    .map(|r| r.map(|t| Self::HmacSha256Key(Box::new(t)))),
54761            ),
54762            TypeVariant::HmacSha256Mac => Box::new(
54763                ReadXdrIter::<_, HmacSha256Mac>::new(&mut r.inner, r.limits.clone())
54764                    .map(|r| r.map(|t| Self::HmacSha256Mac(Box::new(t)))),
54765            ),
54766            TypeVariant::ShortHashSeed => Box::new(
54767                ReadXdrIter::<_, ShortHashSeed>::new(&mut r.inner, r.limits.clone())
54768                    .map(|r| r.map(|t| Self::ShortHashSeed(Box::new(t)))),
54769            ),
54770            TypeVariant::BinaryFuseFilterType => Box::new(
54771                ReadXdrIter::<_, BinaryFuseFilterType>::new(&mut r.inner, r.limits.clone())
54772                    .map(|r| r.map(|t| Self::BinaryFuseFilterType(Box::new(t)))),
54773            ),
54774            TypeVariant::SerializedBinaryFuseFilter => Box::new(
54775                ReadXdrIter::<_, SerializedBinaryFuseFilter>::new(&mut r.inner, r.limits.clone())
54776                    .map(|r| r.map(|t| Self::SerializedBinaryFuseFilter(Box::new(t)))),
54777            ),
54778        }
54779    }
54780
54781    #[cfg(feature = "std")]
54782    #[allow(clippy::too_many_lines)]
54783    pub fn read_xdr_framed_iter<R: Read>(
54784        v: TypeVariant,
54785        r: &mut Limited<R>,
54786    ) -> Box<dyn Iterator<Item = Result<Self>> + '_> {
54787        match v {
54788            TypeVariant::Value => Box::new(
54789                ReadXdrIter::<_, Frame<Value>>::new(&mut r.inner, r.limits.clone())
54790                    .map(|r| r.map(|t| Self::Value(Box::new(t.0)))),
54791            ),
54792            TypeVariant::ScpBallot => Box::new(
54793                ReadXdrIter::<_, Frame<ScpBallot>>::new(&mut r.inner, r.limits.clone())
54794                    .map(|r| r.map(|t| Self::ScpBallot(Box::new(t.0)))),
54795            ),
54796            TypeVariant::ScpStatementType => Box::new(
54797                ReadXdrIter::<_, Frame<ScpStatementType>>::new(&mut r.inner, r.limits.clone())
54798                    .map(|r| r.map(|t| Self::ScpStatementType(Box::new(t.0)))),
54799            ),
54800            TypeVariant::ScpNomination => Box::new(
54801                ReadXdrIter::<_, Frame<ScpNomination>>::new(&mut r.inner, r.limits.clone())
54802                    .map(|r| r.map(|t| Self::ScpNomination(Box::new(t.0)))),
54803            ),
54804            TypeVariant::ScpStatement => Box::new(
54805                ReadXdrIter::<_, Frame<ScpStatement>>::new(&mut r.inner, r.limits.clone())
54806                    .map(|r| r.map(|t| Self::ScpStatement(Box::new(t.0)))),
54807            ),
54808            TypeVariant::ScpStatementPledges => Box::new(
54809                ReadXdrIter::<_, Frame<ScpStatementPledges>>::new(&mut r.inner, r.limits.clone())
54810                    .map(|r| r.map(|t| Self::ScpStatementPledges(Box::new(t.0)))),
54811            ),
54812            TypeVariant::ScpStatementPrepare => Box::new(
54813                ReadXdrIter::<_, Frame<ScpStatementPrepare>>::new(&mut r.inner, r.limits.clone())
54814                    .map(|r| r.map(|t| Self::ScpStatementPrepare(Box::new(t.0)))),
54815            ),
54816            TypeVariant::ScpStatementConfirm => Box::new(
54817                ReadXdrIter::<_, Frame<ScpStatementConfirm>>::new(&mut r.inner, r.limits.clone())
54818                    .map(|r| r.map(|t| Self::ScpStatementConfirm(Box::new(t.0)))),
54819            ),
54820            TypeVariant::ScpStatementExternalize => Box::new(
54821                ReadXdrIter::<_, Frame<ScpStatementExternalize>>::new(
54822                    &mut r.inner,
54823                    r.limits.clone(),
54824                )
54825                .map(|r| r.map(|t| Self::ScpStatementExternalize(Box::new(t.0)))),
54826            ),
54827            TypeVariant::ScpEnvelope => Box::new(
54828                ReadXdrIter::<_, Frame<ScpEnvelope>>::new(&mut r.inner, r.limits.clone())
54829                    .map(|r| r.map(|t| Self::ScpEnvelope(Box::new(t.0)))),
54830            ),
54831            TypeVariant::ScpQuorumSet => Box::new(
54832                ReadXdrIter::<_, Frame<ScpQuorumSet>>::new(&mut r.inner, r.limits.clone())
54833                    .map(|r| r.map(|t| Self::ScpQuorumSet(Box::new(t.0)))),
54834            ),
54835            TypeVariant::ConfigSettingContractExecutionLanesV0 => Box::new(
54836                ReadXdrIter::<_, Frame<ConfigSettingContractExecutionLanesV0>>::new(
54837                    &mut r.inner,
54838                    r.limits.clone(),
54839                )
54840                .map(|r| r.map(|t| Self::ConfigSettingContractExecutionLanesV0(Box::new(t.0)))),
54841            ),
54842            TypeVariant::ConfigSettingContractComputeV0 => Box::new(
54843                ReadXdrIter::<_, Frame<ConfigSettingContractComputeV0>>::new(
54844                    &mut r.inner,
54845                    r.limits.clone(),
54846                )
54847                .map(|r| r.map(|t| Self::ConfigSettingContractComputeV0(Box::new(t.0)))),
54848            ),
54849            TypeVariant::ConfigSettingContractLedgerCostV0 => Box::new(
54850                ReadXdrIter::<_, Frame<ConfigSettingContractLedgerCostV0>>::new(
54851                    &mut r.inner,
54852                    r.limits.clone(),
54853                )
54854                .map(|r| r.map(|t| Self::ConfigSettingContractLedgerCostV0(Box::new(t.0)))),
54855            ),
54856            TypeVariant::ConfigSettingContractHistoricalDataV0 => Box::new(
54857                ReadXdrIter::<_, Frame<ConfigSettingContractHistoricalDataV0>>::new(
54858                    &mut r.inner,
54859                    r.limits.clone(),
54860                )
54861                .map(|r| r.map(|t| Self::ConfigSettingContractHistoricalDataV0(Box::new(t.0)))),
54862            ),
54863            TypeVariant::ConfigSettingContractEventsV0 => Box::new(
54864                ReadXdrIter::<_, Frame<ConfigSettingContractEventsV0>>::new(
54865                    &mut r.inner,
54866                    r.limits.clone(),
54867                )
54868                .map(|r| r.map(|t| Self::ConfigSettingContractEventsV0(Box::new(t.0)))),
54869            ),
54870            TypeVariant::ConfigSettingContractBandwidthV0 => Box::new(
54871                ReadXdrIter::<_, Frame<ConfigSettingContractBandwidthV0>>::new(
54872                    &mut r.inner,
54873                    r.limits.clone(),
54874                )
54875                .map(|r| r.map(|t| Self::ConfigSettingContractBandwidthV0(Box::new(t.0)))),
54876            ),
54877            TypeVariant::ContractCostType => Box::new(
54878                ReadXdrIter::<_, Frame<ContractCostType>>::new(&mut r.inner, r.limits.clone())
54879                    .map(|r| r.map(|t| Self::ContractCostType(Box::new(t.0)))),
54880            ),
54881            TypeVariant::ContractCostParamEntry => Box::new(
54882                ReadXdrIter::<_, Frame<ContractCostParamEntry>>::new(
54883                    &mut r.inner,
54884                    r.limits.clone(),
54885                )
54886                .map(|r| r.map(|t| Self::ContractCostParamEntry(Box::new(t.0)))),
54887            ),
54888            TypeVariant::StateArchivalSettings => Box::new(
54889                ReadXdrIter::<_, Frame<StateArchivalSettings>>::new(&mut r.inner, r.limits.clone())
54890                    .map(|r| r.map(|t| Self::StateArchivalSettings(Box::new(t.0)))),
54891            ),
54892            TypeVariant::EvictionIterator => Box::new(
54893                ReadXdrIter::<_, Frame<EvictionIterator>>::new(&mut r.inner, r.limits.clone())
54894                    .map(|r| r.map(|t| Self::EvictionIterator(Box::new(t.0)))),
54895            ),
54896            TypeVariant::ContractCostParams => Box::new(
54897                ReadXdrIter::<_, Frame<ContractCostParams>>::new(&mut r.inner, r.limits.clone())
54898                    .map(|r| r.map(|t| Self::ContractCostParams(Box::new(t.0)))),
54899            ),
54900            TypeVariant::ConfigSettingId => Box::new(
54901                ReadXdrIter::<_, Frame<ConfigSettingId>>::new(&mut r.inner, r.limits.clone())
54902                    .map(|r| r.map(|t| Self::ConfigSettingId(Box::new(t.0)))),
54903            ),
54904            TypeVariant::ConfigSettingEntry => Box::new(
54905                ReadXdrIter::<_, Frame<ConfigSettingEntry>>::new(&mut r.inner, r.limits.clone())
54906                    .map(|r| r.map(|t| Self::ConfigSettingEntry(Box::new(t.0)))),
54907            ),
54908            TypeVariant::ScEnvMetaKind => Box::new(
54909                ReadXdrIter::<_, Frame<ScEnvMetaKind>>::new(&mut r.inner, r.limits.clone())
54910                    .map(|r| r.map(|t| Self::ScEnvMetaKind(Box::new(t.0)))),
54911            ),
54912            TypeVariant::ScEnvMetaEntry => Box::new(
54913                ReadXdrIter::<_, Frame<ScEnvMetaEntry>>::new(&mut r.inner, r.limits.clone())
54914                    .map(|r| r.map(|t| Self::ScEnvMetaEntry(Box::new(t.0)))),
54915            ),
54916            TypeVariant::ScEnvMetaEntryInterfaceVersion => Box::new(
54917                ReadXdrIter::<_, Frame<ScEnvMetaEntryInterfaceVersion>>::new(
54918                    &mut r.inner,
54919                    r.limits.clone(),
54920                )
54921                .map(|r| r.map(|t| Self::ScEnvMetaEntryInterfaceVersion(Box::new(t.0)))),
54922            ),
54923            TypeVariant::ScMetaV0 => Box::new(
54924                ReadXdrIter::<_, Frame<ScMetaV0>>::new(&mut r.inner, r.limits.clone())
54925                    .map(|r| r.map(|t| Self::ScMetaV0(Box::new(t.0)))),
54926            ),
54927            TypeVariant::ScMetaKind => Box::new(
54928                ReadXdrIter::<_, Frame<ScMetaKind>>::new(&mut r.inner, r.limits.clone())
54929                    .map(|r| r.map(|t| Self::ScMetaKind(Box::new(t.0)))),
54930            ),
54931            TypeVariant::ScMetaEntry => Box::new(
54932                ReadXdrIter::<_, Frame<ScMetaEntry>>::new(&mut r.inner, r.limits.clone())
54933                    .map(|r| r.map(|t| Self::ScMetaEntry(Box::new(t.0)))),
54934            ),
54935            TypeVariant::ScSpecType => Box::new(
54936                ReadXdrIter::<_, Frame<ScSpecType>>::new(&mut r.inner, r.limits.clone())
54937                    .map(|r| r.map(|t| Self::ScSpecType(Box::new(t.0)))),
54938            ),
54939            TypeVariant::ScSpecTypeOption => Box::new(
54940                ReadXdrIter::<_, Frame<ScSpecTypeOption>>::new(&mut r.inner, r.limits.clone())
54941                    .map(|r| r.map(|t| Self::ScSpecTypeOption(Box::new(t.0)))),
54942            ),
54943            TypeVariant::ScSpecTypeResult => Box::new(
54944                ReadXdrIter::<_, Frame<ScSpecTypeResult>>::new(&mut r.inner, r.limits.clone())
54945                    .map(|r| r.map(|t| Self::ScSpecTypeResult(Box::new(t.0)))),
54946            ),
54947            TypeVariant::ScSpecTypeVec => Box::new(
54948                ReadXdrIter::<_, Frame<ScSpecTypeVec>>::new(&mut r.inner, r.limits.clone())
54949                    .map(|r| r.map(|t| Self::ScSpecTypeVec(Box::new(t.0)))),
54950            ),
54951            TypeVariant::ScSpecTypeMap => Box::new(
54952                ReadXdrIter::<_, Frame<ScSpecTypeMap>>::new(&mut r.inner, r.limits.clone())
54953                    .map(|r| r.map(|t| Self::ScSpecTypeMap(Box::new(t.0)))),
54954            ),
54955            TypeVariant::ScSpecTypeTuple => Box::new(
54956                ReadXdrIter::<_, Frame<ScSpecTypeTuple>>::new(&mut r.inner, r.limits.clone())
54957                    .map(|r| r.map(|t| Self::ScSpecTypeTuple(Box::new(t.0)))),
54958            ),
54959            TypeVariant::ScSpecTypeBytesN => Box::new(
54960                ReadXdrIter::<_, Frame<ScSpecTypeBytesN>>::new(&mut r.inner, r.limits.clone())
54961                    .map(|r| r.map(|t| Self::ScSpecTypeBytesN(Box::new(t.0)))),
54962            ),
54963            TypeVariant::ScSpecTypeUdt => Box::new(
54964                ReadXdrIter::<_, Frame<ScSpecTypeUdt>>::new(&mut r.inner, r.limits.clone())
54965                    .map(|r| r.map(|t| Self::ScSpecTypeUdt(Box::new(t.0)))),
54966            ),
54967            TypeVariant::ScSpecTypeDef => Box::new(
54968                ReadXdrIter::<_, Frame<ScSpecTypeDef>>::new(&mut r.inner, r.limits.clone())
54969                    .map(|r| r.map(|t| Self::ScSpecTypeDef(Box::new(t.0)))),
54970            ),
54971            TypeVariant::ScSpecUdtStructFieldV0 => Box::new(
54972                ReadXdrIter::<_, Frame<ScSpecUdtStructFieldV0>>::new(
54973                    &mut r.inner,
54974                    r.limits.clone(),
54975                )
54976                .map(|r| r.map(|t| Self::ScSpecUdtStructFieldV0(Box::new(t.0)))),
54977            ),
54978            TypeVariant::ScSpecUdtStructV0 => Box::new(
54979                ReadXdrIter::<_, Frame<ScSpecUdtStructV0>>::new(&mut r.inner, r.limits.clone())
54980                    .map(|r| r.map(|t| Self::ScSpecUdtStructV0(Box::new(t.0)))),
54981            ),
54982            TypeVariant::ScSpecUdtUnionCaseVoidV0 => Box::new(
54983                ReadXdrIter::<_, Frame<ScSpecUdtUnionCaseVoidV0>>::new(
54984                    &mut r.inner,
54985                    r.limits.clone(),
54986                )
54987                .map(|r| r.map(|t| Self::ScSpecUdtUnionCaseVoidV0(Box::new(t.0)))),
54988            ),
54989            TypeVariant::ScSpecUdtUnionCaseTupleV0 => Box::new(
54990                ReadXdrIter::<_, Frame<ScSpecUdtUnionCaseTupleV0>>::new(
54991                    &mut r.inner,
54992                    r.limits.clone(),
54993                )
54994                .map(|r| r.map(|t| Self::ScSpecUdtUnionCaseTupleV0(Box::new(t.0)))),
54995            ),
54996            TypeVariant::ScSpecUdtUnionCaseV0Kind => Box::new(
54997                ReadXdrIter::<_, Frame<ScSpecUdtUnionCaseV0Kind>>::new(
54998                    &mut r.inner,
54999                    r.limits.clone(),
55000                )
55001                .map(|r| r.map(|t| Self::ScSpecUdtUnionCaseV0Kind(Box::new(t.0)))),
55002            ),
55003            TypeVariant::ScSpecUdtUnionCaseV0 => Box::new(
55004                ReadXdrIter::<_, Frame<ScSpecUdtUnionCaseV0>>::new(&mut r.inner, r.limits.clone())
55005                    .map(|r| r.map(|t| Self::ScSpecUdtUnionCaseV0(Box::new(t.0)))),
55006            ),
55007            TypeVariant::ScSpecUdtUnionV0 => Box::new(
55008                ReadXdrIter::<_, Frame<ScSpecUdtUnionV0>>::new(&mut r.inner, r.limits.clone())
55009                    .map(|r| r.map(|t| Self::ScSpecUdtUnionV0(Box::new(t.0)))),
55010            ),
55011            TypeVariant::ScSpecUdtEnumCaseV0 => Box::new(
55012                ReadXdrIter::<_, Frame<ScSpecUdtEnumCaseV0>>::new(&mut r.inner, r.limits.clone())
55013                    .map(|r| r.map(|t| Self::ScSpecUdtEnumCaseV0(Box::new(t.0)))),
55014            ),
55015            TypeVariant::ScSpecUdtEnumV0 => Box::new(
55016                ReadXdrIter::<_, Frame<ScSpecUdtEnumV0>>::new(&mut r.inner, r.limits.clone())
55017                    .map(|r| r.map(|t| Self::ScSpecUdtEnumV0(Box::new(t.0)))),
55018            ),
55019            TypeVariant::ScSpecUdtErrorEnumCaseV0 => Box::new(
55020                ReadXdrIter::<_, Frame<ScSpecUdtErrorEnumCaseV0>>::new(
55021                    &mut r.inner,
55022                    r.limits.clone(),
55023                )
55024                .map(|r| r.map(|t| Self::ScSpecUdtErrorEnumCaseV0(Box::new(t.0)))),
55025            ),
55026            TypeVariant::ScSpecUdtErrorEnumV0 => Box::new(
55027                ReadXdrIter::<_, Frame<ScSpecUdtErrorEnumV0>>::new(&mut r.inner, r.limits.clone())
55028                    .map(|r| r.map(|t| Self::ScSpecUdtErrorEnumV0(Box::new(t.0)))),
55029            ),
55030            TypeVariant::ScSpecFunctionInputV0 => Box::new(
55031                ReadXdrIter::<_, Frame<ScSpecFunctionInputV0>>::new(&mut r.inner, r.limits.clone())
55032                    .map(|r| r.map(|t| Self::ScSpecFunctionInputV0(Box::new(t.0)))),
55033            ),
55034            TypeVariant::ScSpecFunctionV0 => Box::new(
55035                ReadXdrIter::<_, Frame<ScSpecFunctionV0>>::new(&mut r.inner, r.limits.clone())
55036                    .map(|r| r.map(|t| Self::ScSpecFunctionV0(Box::new(t.0)))),
55037            ),
55038            TypeVariant::ScSpecEntryKind => Box::new(
55039                ReadXdrIter::<_, Frame<ScSpecEntryKind>>::new(&mut r.inner, r.limits.clone())
55040                    .map(|r| r.map(|t| Self::ScSpecEntryKind(Box::new(t.0)))),
55041            ),
55042            TypeVariant::ScSpecEntry => Box::new(
55043                ReadXdrIter::<_, Frame<ScSpecEntry>>::new(&mut r.inner, r.limits.clone())
55044                    .map(|r| r.map(|t| Self::ScSpecEntry(Box::new(t.0)))),
55045            ),
55046            TypeVariant::ScValType => Box::new(
55047                ReadXdrIter::<_, Frame<ScValType>>::new(&mut r.inner, r.limits.clone())
55048                    .map(|r| r.map(|t| Self::ScValType(Box::new(t.0)))),
55049            ),
55050            TypeVariant::ScErrorType => Box::new(
55051                ReadXdrIter::<_, Frame<ScErrorType>>::new(&mut r.inner, r.limits.clone())
55052                    .map(|r| r.map(|t| Self::ScErrorType(Box::new(t.0)))),
55053            ),
55054            TypeVariant::ScErrorCode => Box::new(
55055                ReadXdrIter::<_, Frame<ScErrorCode>>::new(&mut r.inner, r.limits.clone())
55056                    .map(|r| r.map(|t| Self::ScErrorCode(Box::new(t.0)))),
55057            ),
55058            TypeVariant::ScError => Box::new(
55059                ReadXdrIter::<_, Frame<ScError>>::new(&mut r.inner, r.limits.clone())
55060                    .map(|r| r.map(|t| Self::ScError(Box::new(t.0)))),
55061            ),
55062            TypeVariant::UInt128Parts => Box::new(
55063                ReadXdrIter::<_, Frame<UInt128Parts>>::new(&mut r.inner, r.limits.clone())
55064                    .map(|r| r.map(|t| Self::UInt128Parts(Box::new(t.0)))),
55065            ),
55066            TypeVariant::Int128Parts => Box::new(
55067                ReadXdrIter::<_, Frame<Int128Parts>>::new(&mut r.inner, r.limits.clone())
55068                    .map(|r| r.map(|t| Self::Int128Parts(Box::new(t.0)))),
55069            ),
55070            TypeVariant::UInt256Parts => Box::new(
55071                ReadXdrIter::<_, Frame<UInt256Parts>>::new(&mut r.inner, r.limits.clone())
55072                    .map(|r| r.map(|t| Self::UInt256Parts(Box::new(t.0)))),
55073            ),
55074            TypeVariant::Int256Parts => Box::new(
55075                ReadXdrIter::<_, Frame<Int256Parts>>::new(&mut r.inner, r.limits.clone())
55076                    .map(|r| r.map(|t| Self::Int256Parts(Box::new(t.0)))),
55077            ),
55078            TypeVariant::ContractExecutableType => Box::new(
55079                ReadXdrIter::<_, Frame<ContractExecutableType>>::new(
55080                    &mut r.inner,
55081                    r.limits.clone(),
55082                )
55083                .map(|r| r.map(|t| Self::ContractExecutableType(Box::new(t.0)))),
55084            ),
55085            TypeVariant::ContractExecutable => Box::new(
55086                ReadXdrIter::<_, Frame<ContractExecutable>>::new(&mut r.inner, r.limits.clone())
55087                    .map(|r| r.map(|t| Self::ContractExecutable(Box::new(t.0)))),
55088            ),
55089            TypeVariant::ScAddressType => Box::new(
55090                ReadXdrIter::<_, Frame<ScAddressType>>::new(&mut r.inner, r.limits.clone())
55091                    .map(|r| r.map(|t| Self::ScAddressType(Box::new(t.0)))),
55092            ),
55093            TypeVariant::ScAddress => Box::new(
55094                ReadXdrIter::<_, Frame<ScAddress>>::new(&mut r.inner, r.limits.clone())
55095                    .map(|r| r.map(|t| Self::ScAddress(Box::new(t.0)))),
55096            ),
55097            TypeVariant::ScVec => Box::new(
55098                ReadXdrIter::<_, Frame<ScVec>>::new(&mut r.inner, r.limits.clone())
55099                    .map(|r| r.map(|t| Self::ScVec(Box::new(t.0)))),
55100            ),
55101            TypeVariant::ScMap => Box::new(
55102                ReadXdrIter::<_, Frame<ScMap>>::new(&mut r.inner, r.limits.clone())
55103                    .map(|r| r.map(|t| Self::ScMap(Box::new(t.0)))),
55104            ),
55105            TypeVariant::ScBytes => Box::new(
55106                ReadXdrIter::<_, Frame<ScBytes>>::new(&mut r.inner, r.limits.clone())
55107                    .map(|r| r.map(|t| Self::ScBytes(Box::new(t.0)))),
55108            ),
55109            TypeVariant::ScString => Box::new(
55110                ReadXdrIter::<_, Frame<ScString>>::new(&mut r.inner, r.limits.clone())
55111                    .map(|r| r.map(|t| Self::ScString(Box::new(t.0)))),
55112            ),
55113            TypeVariant::ScSymbol => Box::new(
55114                ReadXdrIter::<_, Frame<ScSymbol>>::new(&mut r.inner, r.limits.clone())
55115                    .map(|r| r.map(|t| Self::ScSymbol(Box::new(t.0)))),
55116            ),
55117            TypeVariant::ScNonceKey => Box::new(
55118                ReadXdrIter::<_, Frame<ScNonceKey>>::new(&mut r.inner, r.limits.clone())
55119                    .map(|r| r.map(|t| Self::ScNonceKey(Box::new(t.0)))),
55120            ),
55121            TypeVariant::ScContractInstance => Box::new(
55122                ReadXdrIter::<_, Frame<ScContractInstance>>::new(&mut r.inner, r.limits.clone())
55123                    .map(|r| r.map(|t| Self::ScContractInstance(Box::new(t.0)))),
55124            ),
55125            TypeVariant::ScVal => Box::new(
55126                ReadXdrIter::<_, Frame<ScVal>>::new(&mut r.inner, r.limits.clone())
55127                    .map(|r| r.map(|t| Self::ScVal(Box::new(t.0)))),
55128            ),
55129            TypeVariant::ScMapEntry => Box::new(
55130                ReadXdrIter::<_, Frame<ScMapEntry>>::new(&mut r.inner, r.limits.clone())
55131                    .map(|r| r.map(|t| Self::ScMapEntry(Box::new(t.0)))),
55132            ),
55133            TypeVariant::StoredTransactionSet => Box::new(
55134                ReadXdrIter::<_, Frame<StoredTransactionSet>>::new(&mut r.inner, r.limits.clone())
55135                    .map(|r| r.map(|t| Self::StoredTransactionSet(Box::new(t.0)))),
55136            ),
55137            TypeVariant::StoredDebugTransactionSet => Box::new(
55138                ReadXdrIter::<_, Frame<StoredDebugTransactionSet>>::new(
55139                    &mut r.inner,
55140                    r.limits.clone(),
55141                )
55142                .map(|r| r.map(|t| Self::StoredDebugTransactionSet(Box::new(t.0)))),
55143            ),
55144            TypeVariant::PersistedScpStateV0 => Box::new(
55145                ReadXdrIter::<_, Frame<PersistedScpStateV0>>::new(&mut r.inner, r.limits.clone())
55146                    .map(|r| r.map(|t| Self::PersistedScpStateV0(Box::new(t.0)))),
55147            ),
55148            TypeVariant::PersistedScpStateV1 => Box::new(
55149                ReadXdrIter::<_, Frame<PersistedScpStateV1>>::new(&mut r.inner, r.limits.clone())
55150                    .map(|r| r.map(|t| Self::PersistedScpStateV1(Box::new(t.0)))),
55151            ),
55152            TypeVariant::PersistedScpState => Box::new(
55153                ReadXdrIter::<_, Frame<PersistedScpState>>::new(&mut r.inner, r.limits.clone())
55154                    .map(|r| r.map(|t| Self::PersistedScpState(Box::new(t.0)))),
55155            ),
55156            TypeVariant::Thresholds => Box::new(
55157                ReadXdrIter::<_, Frame<Thresholds>>::new(&mut r.inner, r.limits.clone())
55158                    .map(|r| r.map(|t| Self::Thresholds(Box::new(t.0)))),
55159            ),
55160            TypeVariant::String32 => Box::new(
55161                ReadXdrIter::<_, Frame<String32>>::new(&mut r.inner, r.limits.clone())
55162                    .map(|r| r.map(|t| Self::String32(Box::new(t.0)))),
55163            ),
55164            TypeVariant::String64 => Box::new(
55165                ReadXdrIter::<_, Frame<String64>>::new(&mut r.inner, r.limits.clone())
55166                    .map(|r| r.map(|t| Self::String64(Box::new(t.0)))),
55167            ),
55168            TypeVariant::SequenceNumber => Box::new(
55169                ReadXdrIter::<_, Frame<SequenceNumber>>::new(&mut r.inner, r.limits.clone())
55170                    .map(|r| r.map(|t| Self::SequenceNumber(Box::new(t.0)))),
55171            ),
55172            TypeVariant::DataValue => Box::new(
55173                ReadXdrIter::<_, Frame<DataValue>>::new(&mut r.inner, r.limits.clone())
55174                    .map(|r| r.map(|t| Self::DataValue(Box::new(t.0)))),
55175            ),
55176            TypeVariant::PoolId => Box::new(
55177                ReadXdrIter::<_, Frame<PoolId>>::new(&mut r.inner, r.limits.clone())
55178                    .map(|r| r.map(|t| Self::PoolId(Box::new(t.0)))),
55179            ),
55180            TypeVariant::AssetCode4 => Box::new(
55181                ReadXdrIter::<_, Frame<AssetCode4>>::new(&mut r.inner, r.limits.clone())
55182                    .map(|r| r.map(|t| Self::AssetCode4(Box::new(t.0)))),
55183            ),
55184            TypeVariant::AssetCode12 => Box::new(
55185                ReadXdrIter::<_, Frame<AssetCode12>>::new(&mut r.inner, r.limits.clone())
55186                    .map(|r| r.map(|t| Self::AssetCode12(Box::new(t.0)))),
55187            ),
55188            TypeVariant::AssetType => Box::new(
55189                ReadXdrIter::<_, Frame<AssetType>>::new(&mut r.inner, r.limits.clone())
55190                    .map(|r| r.map(|t| Self::AssetType(Box::new(t.0)))),
55191            ),
55192            TypeVariant::AssetCode => Box::new(
55193                ReadXdrIter::<_, Frame<AssetCode>>::new(&mut r.inner, r.limits.clone())
55194                    .map(|r| r.map(|t| Self::AssetCode(Box::new(t.0)))),
55195            ),
55196            TypeVariant::AlphaNum4 => Box::new(
55197                ReadXdrIter::<_, Frame<AlphaNum4>>::new(&mut r.inner, r.limits.clone())
55198                    .map(|r| r.map(|t| Self::AlphaNum4(Box::new(t.0)))),
55199            ),
55200            TypeVariant::AlphaNum12 => Box::new(
55201                ReadXdrIter::<_, Frame<AlphaNum12>>::new(&mut r.inner, r.limits.clone())
55202                    .map(|r| r.map(|t| Self::AlphaNum12(Box::new(t.0)))),
55203            ),
55204            TypeVariant::Asset => Box::new(
55205                ReadXdrIter::<_, Frame<Asset>>::new(&mut r.inner, r.limits.clone())
55206                    .map(|r| r.map(|t| Self::Asset(Box::new(t.0)))),
55207            ),
55208            TypeVariant::Price => Box::new(
55209                ReadXdrIter::<_, Frame<Price>>::new(&mut r.inner, r.limits.clone())
55210                    .map(|r| r.map(|t| Self::Price(Box::new(t.0)))),
55211            ),
55212            TypeVariant::Liabilities => Box::new(
55213                ReadXdrIter::<_, Frame<Liabilities>>::new(&mut r.inner, r.limits.clone())
55214                    .map(|r| r.map(|t| Self::Liabilities(Box::new(t.0)))),
55215            ),
55216            TypeVariant::ThresholdIndexes => Box::new(
55217                ReadXdrIter::<_, Frame<ThresholdIndexes>>::new(&mut r.inner, r.limits.clone())
55218                    .map(|r| r.map(|t| Self::ThresholdIndexes(Box::new(t.0)))),
55219            ),
55220            TypeVariant::LedgerEntryType => Box::new(
55221                ReadXdrIter::<_, Frame<LedgerEntryType>>::new(&mut r.inner, r.limits.clone())
55222                    .map(|r| r.map(|t| Self::LedgerEntryType(Box::new(t.0)))),
55223            ),
55224            TypeVariant::Signer => Box::new(
55225                ReadXdrIter::<_, Frame<Signer>>::new(&mut r.inner, r.limits.clone())
55226                    .map(|r| r.map(|t| Self::Signer(Box::new(t.0)))),
55227            ),
55228            TypeVariant::AccountFlags => Box::new(
55229                ReadXdrIter::<_, Frame<AccountFlags>>::new(&mut r.inner, r.limits.clone())
55230                    .map(|r| r.map(|t| Self::AccountFlags(Box::new(t.0)))),
55231            ),
55232            TypeVariant::SponsorshipDescriptor => Box::new(
55233                ReadXdrIter::<_, Frame<SponsorshipDescriptor>>::new(&mut r.inner, r.limits.clone())
55234                    .map(|r| r.map(|t| Self::SponsorshipDescriptor(Box::new(t.0)))),
55235            ),
55236            TypeVariant::AccountEntryExtensionV3 => Box::new(
55237                ReadXdrIter::<_, Frame<AccountEntryExtensionV3>>::new(
55238                    &mut r.inner,
55239                    r.limits.clone(),
55240                )
55241                .map(|r| r.map(|t| Self::AccountEntryExtensionV3(Box::new(t.0)))),
55242            ),
55243            TypeVariant::AccountEntryExtensionV2 => Box::new(
55244                ReadXdrIter::<_, Frame<AccountEntryExtensionV2>>::new(
55245                    &mut r.inner,
55246                    r.limits.clone(),
55247                )
55248                .map(|r| r.map(|t| Self::AccountEntryExtensionV2(Box::new(t.0)))),
55249            ),
55250            TypeVariant::AccountEntryExtensionV2Ext => Box::new(
55251                ReadXdrIter::<_, Frame<AccountEntryExtensionV2Ext>>::new(
55252                    &mut r.inner,
55253                    r.limits.clone(),
55254                )
55255                .map(|r| r.map(|t| Self::AccountEntryExtensionV2Ext(Box::new(t.0)))),
55256            ),
55257            TypeVariant::AccountEntryExtensionV1 => Box::new(
55258                ReadXdrIter::<_, Frame<AccountEntryExtensionV1>>::new(
55259                    &mut r.inner,
55260                    r.limits.clone(),
55261                )
55262                .map(|r| r.map(|t| Self::AccountEntryExtensionV1(Box::new(t.0)))),
55263            ),
55264            TypeVariant::AccountEntryExtensionV1Ext => Box::new(
55265                ReadXdrIter::<_, Frame<AccountEntryExtensionV1Ext>>::new(
55266                    &mut r.inner,
55267                    r.limits.clone(),
55268                )
55269                .map(|r| r.map(|t| Self::AccountEntryExtensionV1Ext(Box::new(t.0)))),
55270            ),
55271            TypeVariant::AccountEntry => Box::new(
55272                ReadXdrIter::<_, Frame<AccountEntry>>::new(&mut r.inner, r.limits.clone())
55273                    .map(|r| r.map(|t| Self::AccountEntry(Box::new(t.0)))),
55274            ),
55275            TypeVariant::AccountEntryExt => Box::new(
55276                ReadXdrIter::<_, Frame<AccountEntryExt>>::new(&mut r.inner, r.limits.clone())
55277                    .map(|r| r.map(|t| Self::AccountEntryExt(Box::new(t.0)))),
55278            ),
55279            TypeVariant::TrustLineFlags => Box::new(
55280                ReadXdrIter::<_, Frame<TrustLineFlags>>::new(&mut r.inner, r.limits.clone())
55281                    .map(|r| r.map(|t| Self::TrustLineFlags(Box::new(t.0)))),
55282            ),
55283            TypeVariant::LiquidityPoolType => Box::new(
55284                ReadXdrIter::<_, Frame<LiquidityPoolType>>::new(&mut r.inner, r.limits.clone())
55285                    .map(|r| r.map(|t| Self::LiquidityPoolType(Box::new(t.0)))),
55286            ),
55287            TypeVariant::TrustLineAsset => Box::new(
55288                ReadXdrIter::<_, Frame<TrustLineAsset>>::new(&mut r.inner, r.limits.clone())
55289                    .map(|r| r.map(|t| Self::TrustLineAsset(Box::new(t.0)))),
55290            ),
55291            TypeVariant::TrustLineEntryExtensionV2 => Box::new(
55292                ReadXdrIter::<_, Frame<TrustLineEntryExtensionV2>>::new(
55293                    &mut r.inner,
55294                    r.limits.clone(),
55295                )
55296                .map(|r| r.map(|t| Self::TrustLineEntryExtensionV2(Box::new(t.0)))),
55297            ),
55298            TypeVariant::TrustLineEntryExtensionV2Ext => Box::new(
55299                ReadXdrIter::<_, Frame<TrustLineEntryExtensionV2Ext>>::new(
55300                    &mut r.inner,
55301                    r.limits.clone(),
55302                )
55303                .map(|r| r.map(|t| Self::TrustLineEntryExtensionV2Ext(Box::new(t.0)))),
55304            ),
55305            TypeVariant::TrustLineEntry => Box::new(
55306                ReadXdrIter::<_, Frame<TrustLineEntry>>::new(&mut r.inner, r.limits.clone())
55307                    .map(|r| r.map(|t| Self::TrustLineEntry(Box::new(t.0)))),
55308            ),
55309            TypeVariant::TrustLineEntryExt => Box::new(
55310                ReadXdrIter::<_, Frame<TrustLineEntryExt>>::new(&mut r.inner, r.limits.clone())
55311                    .map(|r| r.map(|t| Self::TrustLineEntryExt(Box::new(t.0)))),
55312            ),
55313            TypeVariant::TrustLineEntryV1 => Box::new(
55314                ReadXdrIter::<_, Frame<TrustLineEntryV1>>::new(&mut r.inner, r.limits.clone())
55315                    .map(|r| r.map(|t| Self::TrustLineEntryV1(Box::new(t.0)))),
55316            ),
55317            TypeVariant::TrustLineEntryV1Ext => Box::new(
55318                ReadXdrIter::<_, Frame<TrustLineEntryV1Ext>>::new(&mut r.inner, r.limits.clone())
55319                    .map(|r| r.map(|t| Self::TrustLineEntryV1Ext(Box::new(t.0)))),
55320            ),
55321            TypeVariant::OfferEntryFlags => Box::new(
55322                ReadXdrIter::<_, Frame<OfferEntryFlags>>::new(&mut r.inner, r.limits.clone())
55323                    .map(|r| r.map(|t| Self::OfferEntryFlags(Box::new(t.0)))),
55324            ),
55325            TypeVariant::OfferEntry => Box::new(
55326                ReadXdrIter::<_, Frame<OfferEntry>>::new(&mut r.inner, r.limits.clone())
55327                    .map(|r| r.map(|t| Self::OfferEntry(Box::new(t.0)))),
55328            ),
55329            TypeVariant::OfferEntryExt => Box::new(
55330                ReadXdrIter::<_, Frame<OfferEntryExt>>::new(&mut r.inner, r.limits.clone())
55331                    .map(|r| r.map(|t| Self::OfferEntryExt(Box::new(t.0)))),
55332            ),
55333            TypeVariant::DataEntry => Box::new(
55334                ReadXdrIter::<_, Frame<DataEntry>>::new(&mut r.inner, r.limits.clone())
55335                    .map(|r| r.map(|t| Self::DataEntry(Box::new(t.0)))),
55336            ),
55337            TypeVariant::DataEntryExt => Box::new(
55338                ReadXdrIter::<_, Frame<DataEntryExt>>::new(&mut r.inner, r.limits.clone())
55339                    .map(|r| r.map(|t| Self::DataEntryExt(Box::new(t.0)))),
55340            ),
55341            TypeVariant::ClaimPredicateType => Box::new(
55342                ReadXdrIter::<_, Frame<ClaimPredicateType>>::new(&mut r.inner, r.limits.clone())
55343                    .map(|r| r.map(|t| Self::ClaimPredicateType(Box::new(t.0)))),
55344            ),
55345            TypeVariant::ClaimPredicate => Box::new(
55346                ReadXdrIter::<_, Frame<ClaimPredicate>>::new(&mut r.inner, r.limits.clone())
55347                    .map(|r| r.map(|t| Self::ClaimPredicate(Box::new(t.0)))),
55348            ),
55349            TypeVariant::ClaimantType => Box::new(
55350                ReadXdrIter::<_, Frame<ClaimantType>>::new(&mut r.inner, r.limits.clone())
55351                    .map(|r| r.map(|t| Self::ClaimantType(Box::new(t.0)))),
55352            ),
55353            TypeVariant::Claimant => Box::new(
55354                ReadXdrIter::<_, Frame<Claimant>>::new(&mut r.inner, r.limits.clone())
55355                    .map(|r| r.map(|t| Self::Claimant(Box::new(t.0)))),
55356            ),
55357            TypeVariant::ClaimantV0 => Box::new(
55358                ReadXdrIter::<_, Frame<ClaimantV0>>::new(&mut r.inner, r.limits.clone())
55359                    .map(|r| r.map(|t| Self::ClaimantV0(Box::new(t.0)))),
55360            ),
55361            TypeVariant::ClaimableBalanceIdType => Box::new(
55362                ReadXdrIter::<_, Frame<ClaimableBalanceIdType>>::new(
55363                    &mut r.inner,
55364                    r.limits.clone(),
55365                )
55366                .map(|r| r.map(|t| Self::ClaimableBalanceIdType(Box::new(t.0)))),
55367            ),
55368            TypeVariant::ClaimableBalanceId => Box::new(
55369                ReadXdrIter::<_, Frame<ClaimableBalanceId>>::new(&mut r.inner, r.limits.clone())
55370                    .map(|r| r.map(|t| Self::ClaimableBalanceId(Box::new(t.0)))),
55371            ),
55372            TypeVariant::ClaimableBalanceFlags => Box::new(
55373                ReadXdrIter::<_, Frame<ClaimableBalanceFlags>>::new(&mut r.inner, r.limits.clone())
55374                    .map(|r| r.map(|t| Self::ClaimableBalanceFlags(Box::new(t.0)))),
55375            ),
55376            TypeVariant::ClaimableBalanceEntryExtensionV1 => Box::new(
55377                ReadXdrIter::<_, Frame<ClaimableBalanceEntryExtensionV1>>::new(
55378                    &mut r.inner,
55379                    r.limits.clone(),
55380                )
55381                .map(|r| r.map(|t| Self::ClaimableBalanceEntryExtensionV1(Box::new(t.0)))),
55382            ),
55383            TypeVariant::ClaimableBalanceEntryExtensionV1Ext => Box::new(
55384                ReadXdrIter::<_, Frame<ClaimableBalanceEntryExtensionV1Ext>>::new(
55385                    &mut r.inner,
55386                    r.limits.clone(),
55387                )
55388                .map(|r| r.map(|t| Self::ClaimableBalanceEntryExtensionV1Ext(Box::new(t.0)))),
55389            ),
55390            TypeVariant::ClaimableBalanceEntry => Box::new(
55391                ReadXdrIter::<_, Frame<ClaimableBalanceEntry>>::new(&mut r.inner, r.limits.clone())
55392                    .map(|r| r.map(|t| Self::ClaimableBalanceEntry(Box::new(t.0)))),
55393            ),
55394            TypeVariant::ClaimableBalanceEntryExt => Box::new(
55395                ReadXdrIter::<_, Frame<ClaimableBalanceEntryExt>>::new(
55396                    &mut r.inner,
55397                    r.limits.clone(),
55398                )
55399                .map(|r| r.map(|t| Self::ClaimableBalanceEntryExt(Box::new(t.0)))),
55400            ),
55401            TypeVariant::LiquidityPoolConstantProductParameters => Box::new(
55402                ReadXdrIter::<_, Frame<LiquidityPoolConstantProductParameters>>::new(
55403                    &mut r.inner,
55404                    r.limits.clone(),
55405                )
55406                .map(|r| r.map(|t| Self::LiquidityPoolConstantProductParameters(Box::new(t.0)))),
55407            ),
55408            TypeVariant::LiquidityPoolEntry => Box::new(
55409                ReadXdrIter::<_, Frame<LiquidityPoolEntry>>::new(&mut r.inner, r.limits.clone())
55410                    .map(|r| r.map(|t| Self::LiquidityPoolEntry(Box::new(t.0)))),
55411            ),
55412            TypeVariant::LiquidityPoolEntryBody => Box::new(
55413                ReadXdrIter::<_, Frame<LiquidityPoolEntryBody>>::new(
55414                    &mut r.inner,
55415                    r.limits.clone(),
55416                )
55417                .map(|r| r.map(|t| Self::LiquidityPoolEntryBody(Box::new(t.0)))),
55418            ),
55419            TypeVariant::LiquidityPoolEntryConstantProduct => Box::new(
55420                ReadXdrIter::<_, Frame<LiquidityPoolEntryConstantProduct>>::new(
55421                    &mut r.inner,
55422                    r.limits.clone(),
55423                )
55424                .map(|r| r.map(|t| Self::LiquidityPoolEntryConstantProduct(Box::new(t.0)))),
55425            ),
55426            TypeVariant::ContractDataDurability => Box::new(
55427                ReadXdrIter::<_, Frame<ContractDataDurability>>::new(
55428                    &mut r.inner,
55429                    r.limits.clone(),
55430                )
55431                .map(|r| r.map(|t| Self::ContractDataDurability(Box::new(t.0)))),
55432            ),
55433            TypeVariant::ContractDataEntry => Box::new(
55434                ReadXdrIter::<_, Frame<ContractDataEntry>>::new(&mut r.inner, r.limits.clone())
55435                    .map(|r| r.map(|t| Self::ContractDataEntry(Box::new(t.0)))),
55436            ),
55437            TypeVariant::ContractCodeCostInputs => Box::new(
55438                ReadXdrIter::<_, Frame<ContractCodeCostInputs>>::new(
55439                    &mut r.inner,
55440                    r.limits.clone(),
55441                )
55442                .map(|r| r.map(|t| Self::ContractCodeCostInputs(Box::new(t.0)))),
55443            ),
55444            TypeVariant::ContractCodeEntry => Box::new(
55445                ReadXdrIter::<_, Frame<ContractCodeEntry>>::new(&mut r.inner, r.limits.clone())
55446                    .map(|r| r.map(|t| Self::ContractCodeEntry(Box::new(t.0)))),
55447            ),
55448            TypeVariant::ContractCodeEntryExt => Box::new(
55449                ReadXdrIter::<_, Frame<ContractCodeEntryExt>>::new(&mut r.inner, r.limits.clone())
55450                    .map(|r| r.map(|t| Self::ContractCodeEntryExt(Box::new(t.0)))),
55451            ),
55452            TypeVariant::ContractCodeEntryV1 => Box::new(
55453                ReadXdrIter::<_, Frame<ContractCodeEntryV1>>::new(&mut r.inner, r.limits.clone())
55454                    .map(|r| r.map(|t| Self::ContractCodeEntryV1(Box::new(t.0)))),
55455            ),
55456            TypeVariant::TtlEntry => Box::new(
55457                ReadXdrIter::<_, Frame<TtlEntry>>::new(&mut r.inner, r.limits.clone())
55458                    .map(|r| r.map(|t| Self::TtlEntry(Box::new(t.0)))),
55459            ),
55460            TypeVariant::LedgerEntryExtensionV1 => Box::new(
55461                ReadXdrIter::<_, Frame<LedgerEntryExtensionV1>>::new(
55462                    &mut r.inner,
55463                    r.limits.clone(),
55464                )
55465                .map(|r| r.map(|t| Self::LedgerEntryExtensionV1(Box::new(t.0)))),
55466            ),
55467            TypeVariant::LedgerEntryExtensionV1Ext => Box::new(
55468                ReadXdrIter::<_, Frame<LedgerEntryExtensionV1Ext>>::new(
55469                    &mut r.inner,
55470                    r.limits.clone(),
55471                )
55472                .map(|r| r.map(|t| Self::LedgerEntryExtensionV1Ext(Box::new(t.0)))),
55473            ),
55474            TypeVariant::LedgerEntry => Box::new(
55475                ReadXdrIter::<_, Frame<LedgerEntry>>::new(&mut r.inner, r.limits.clone())
55476                    .map(|r| r.map(|t| Self::LedgerEntry(Box::new(t.0)))),
55477            ),
55478            TypeVariant::LedgerEntryData => Box::new(
55479                ReadXdrIter::<_, Frame<LedgerEntryData>>::new(&mut r.inner, r.limits.clone())
55480                    .map(|r| r.map(|t| Self::LedgerEntryData(Box::new(t.0)))),
55481            ),
55482            TypeVariant::LedgerEntryExt => Box::new(
55483                ReadXdrIter::<_, Frame<LedgerEntryExt>>::new(&mut r.inner, r.limits.clone())
55484                    .map(|r| r.map(|t| Self::LedgerEntryExt(Box::new(t.0)))),
55485            ),
55486            TypeVariant::LedgerKey => Box::new(
55487                ReadXdrIter::<_, Frame<LedgerKey>>::new(&mut r.inner, r.limits.clone())
55488                    .map(|r| r.map(|t| Self::LedgerKey(Box::new(t.0)))),
55489            ),
55490            TypeVariant::LedgerKeyAccount => Box::new(
55491                ReadXdrIter::<_, Frame<LedgerKeyAccount>>::new(&mut r.inner, r.limits.clone())
55492                    .map(|r| r.map(|t| Self::LedgerKeyAccount(Box::new(t.0)))),
55493            ),
55494            TypeVariant::LedgerKeyTrustLine => Box::new(
55495                ReadXdrIter::<_, Frame<LedgerKeyTrustLine>>::new(&mut r.inner, r.limits.clone())
55496                    .map(|r| r.map(|t| Self::LedgerKeyTrustLine(Box::new(t.0)))),
55497            ),
55498            TypeVariant::LedgerKeyOffer => Box::new(
55499                ReadXdrIter::<_, Frame<LedgerKeyOffer>>::new(&mut r.inner, r.limits.clone())
55500                    .map(|r| r.map(|t| Self::LedgerKeyOffer(Box::new(t.0)))),
55501            ),
55502            TypeVariant::LedgerKeyData => Box::new(
55503                ReadXdrIter::<_, Frame<LedgerKeyData>>::new(&mut r.inner, r.limits.clone())
55504                    .map(|r| r.map(|t| Self::LedgerKeyData(Box::new(t.0)))),
55505            ),
55506            TypeVariant::LedgerKeyClaimableBalance => Box::new(
55507                ReadXdrIter::<_, Frame<LedgerKeyClaimableBalance>>::new(
55508                    &mut r.inner,
55509                    r.limits.clone(),
55510                )
55511                .map(|r| r.map(|t| Self::LedgerKeyClaimableBalance(Box::new(t.0)))),
55512            ),
55513            TypeVariant::LedgerKeyLiquidityPool => Box::new(
55514                ReadXdrIter::<_, Frame<LedgerKeyLiquidityPool>>::new(
55515                    &mut r.inner,
55516                    r.limits.clone(),
55517                )
55518                .map(|r| r.map(|t| Self::LedgerKeyLiquidityPool(Box::new(t.0)))),
55519            ),
55520            TypeVariant::LedgerKeyContractData => Box::new(
55521                ReadXdrIter::<_, Frame<LedgerKeyContractData>>::new(&mut r.inner, r.limits.clone())
55522                    .map(|r| r.map(|t| Self::LedgerKeyContractData(Box::new(t.0)))),
55523            ),
55524            TypeVariant::LedgerKeyContractCode => Box::new(
55525                ReadXdrIter::<_, Frame<LedgerKeyContractCode>>::new(&mut r.inner, r.limits.clone())
55526                    .map(|r| r.map(|t| Self::LedgerKeyContractCode(Box::new(t.0)))),
55527            ),
55528            TypeVariant::LedgerKeyConfigSetting => Box::new(
55529                ReadXdrIter::<_, Frame<LedgerKeyConfigSetting>>::new(
55530                    &mut r.inner,
55531                    r.limits.clone(),
55532                )
55533                .map(|r| r.map(|t| Self::LedgerKeyConfigSetting(Box::new(t.0)))),
55534            ),
55535            TypeVariant::LedgerKeyTtl => Box::new(
55536                ReadXdrIter::<_, Frame<LedgerKeyTtl>>::new(&mut r.inner, r.limits.clone())
55537                    .map(|r| r.map(|t| Self::LedgerKeyTtl(Box::new(t.0)))),
55538            ),
55539            TypeVariant::EnvelopeType => Box::new(
55540                ReadXdrIter::<_, Frame<EnvelopeType>>::new(&mut r.inner, r.limits.clone())
55541                    .map(|r| r.map(|t| Self::EnvelopeType(Box::new(t.0)))),
55542            ),
55543            TypeVariant::BucketListType => Box::new(
55544                ReadXdrIter::<_, Frame<BucketListType>>::new(&mut r.inner, r.limits.clone())
55545                    .map(|r| r.map(|t| Self::BucketListType(Box::new(t.0)))),
55546            ),
55547            TypeVariant::BucketEntryType => Box::new(
55548                ReadXdrIter::<_, Frame<BucketEntryType>>::new(&mut r.inner, r.limits.clone())
55549                    .map(|r| r.map(|t| Self::BucketEntryType(Box::new(t.0)))),
55550            ),
55551            TypeVariant::HotArchiveBucketEntryType => Box::new(
55552                ReadXdrIter::<_, Frame<HotArchiveBucketEntryType>>::new(
55553                    &mut r.inner,
55554                    r.limits.clone(),
55555                )
55556                .map(|r| r.map(|t| Self::HotArchiveBucketEntryType(Box::new(t.0)))),
55557            ),
55558            TypeVariant::ColdArchiveBucketEntryType => Box::new(
55559                ReadXdrIter::<_, Frame<ColdArchiveBucketEntryType>>::new(
55560                    &mut r.inner,
55561                    r.limits.clone(),
55562                )
55563                .map(|r| r.map(|t| Self::ColdArchiveBucketEntryType(Box::new(t.0)))),
55564            ),
55565            TypeVariant::BucketMetadata => Box::new(
55566                ReadXdrIter::<_, Frame<BucketMetadata>>::new(&mut r.inner, r.limits.clone())
55567                    .map(|r| r.map(|t| Self::BucketMetadata(Box::new(t.0)))),
55568            ),
55569            TypeVariant::BucketMetadataExt => Box::new(
55570                ReadXdrIter::<_, Frame<BucketMetadataExt>>::new(&mut r.inner, r.limits.clone())
55571                    .map(|r| r.map(|t| Self::BucketMetadataExt(Box::new(t.0)))),
55572            ),
55573            TypeVariant::BucketEntry => Box::new(
55574                ReadXdrIter::<_, Frame<BucketEntry>>::new(&mut r.inner, r.limits.clone())
55575                    .map(|r| r.map(|t| Self::BucketEntry(Box::new(t.0)))),
55576            ),
55577            TypeVariant::HotArchiveBucketEntry => Box::new(
55578                ReadXdrIter::<_, Frame<HotArchiveBucketEntry>>::new(&mut r.inner, r.limits.clone())
55579                    .map(|r| r.map(|t| Self::HotArchiveBucketEntry(Box::new(t.0)))),
55580            ),
55581            TypeVariant::ColdArchiveArchivedLeaf => Box::new(
55582                ReadXdrIter::<_, Frame<ColdArchiveArchivedLeaf>>::new(
55583                    &mut r.inner,
55584                    r.limits.clone(),
55585                )
55586                .map(|r| r.map(|t| Self::ColdArchiveArchivedLeaf(Box::new(t.0)))),
55587            ),
55588            TypeVariant::ColdArchiveDeletedLeaf => Box::new(
55589                ReadXdrIter::<_, Frame<ColdArchiveDeletedLeaf>>::new(
55590                    &mut r.inner,
55591                    r.limits.clone(),
55592                )
55593                .map(|r| r.map(|t| Self::ColdArchiveDeletedLeaf(Box::new(t.0)))),
55594            ),
55595            TypeVariant::ColdArchiveBoundaryLeaf => Box::new(
55596                ReadXdrIter::<_, Frame<ColdArchiveBoundaryLeaf>>::new(
55597                    &mut r.inner,
55598                    r.limits.clone(),
55599                )
55600                .map(|r| r.map(|t| Self::ColdArchiveBoundaryLeaf(Box::new(t.0)))),
55601            ),
55602            TypeVariant::ColdArchiveHashEntry => Box::new(
55603                ReadXdrIter::<_, Frame<ColdArchiveHashEntry>>::new(&mut r.inner, r.limits.clone())
55604                    .map(|r| r.map(|t| Self::ColdArchiveHashEntry(Box::new(t.0)))),
55605            ),
55606            TypeVariant::ColdArchiveBucketEntry => Box::new(
55607                ReadXdrIter::<_, Frame<ColdArchiveBucketEntry>>::new(
55608                    &mut r.inner,
55609                    r.limits.clone(),
55610                )
55611                .map(|r| r.map(|t| Self::ColdArchiveBucketEntry(Box::new(t.0)))),
55612            ),
55613            TypeVariant::UpgradeType => Box::new(
55614                ReadXdrIter::<_, Frame<UpgradeType>>::new(&mut r.inner, r.limits.clone())
55615                    .map(|r| r.map(|t| Self::UpgradeType(Box::new(t.0)))),
55616            ),
55617            TypeVariant::StellarValueType => Box::new(
55618                ReadXdrIter::<_, Frame<StellarValueType>>::new(&mut r.inner, r.limits.clone())
55619                    .map(|r| r.map(|t| Self::StellarValueType(Box::new(t.0)))),
55620            ),
55621            TypeVariant::LedgerCloseValueSignature => Box::new(
55622                ReadXdrIter::<_, Frame<LedgerCloseValueSignature>>::new(
55623                    &mut r.inner,
55624                    r.limits.clone(),
55625                )
55626                .map(|r| r.map(|t| Self::LedgerCloseValueSignature(Box::new(t.0)))),
55627            ),
55628            TypeVariant::StellarValue => Box::new(
55629                ReadXdrIter::<_, Frame<StellarValue>>::new(&mut r.inner, r.limits.clone())
55630                    .map(|r| r.map(|t| Self::StellarValue(Box::new(t.0)))),
55631            ),
55632            TypeVariant::StellarValueExt => Box::new(
55633                ReadXdrIter::<_, Frame<StellarValueExt>>::new(&mut r.inner, r.limits.clone())
55634                    .map(|r| r.map(|t| Self::StellarValueExt(Box::new(t.0)))),
55635            ),
55636            TypeVariant::LedgerHeaderFlags => Box::new(
55637                ReadXdrIter::<_, Frame<LedgerHeaderFlags>>::new(&mut r.inner, r.limits.clone())
55638                    .map(|r| r.map(|t| Self::LedgerHeaderFlags(Box::new(t.0)))),
55639            ),
55640            TypeVariant::LedgerHeaderExtensionV1 => Box::new(
55641                ReadXdrIter::<_, Frame<LedgerHeaderExtensionV1>>::new(
55642                    &mut r.inner,
55643                    r.limits.clone(),
55644                )
55645                .map(|r| r.map(|t| Self::LedgerHeaderExtensionV1(Box::new(t.0)))),
55646            ),
55647            TypeVariant::LedgerHeaderExtensionV1Ext => Box::new(
55648                ReadXdrIter::<_, Frame<LedgerHeaderExtensionV1Ext>>::new(
55649                    &mut r.inner,
55650                    r.limits.clone(),
55651                )
55652                .map(|r| r.map(|t| Self::LedgerHeaderExtensionV1Ext(Box::new(t.0)))),
55653            ),
55654            TypeVariant::LedgerHeader => Box::new(
55655                ReadXdrIter::<_, Frame<LedgerHeader>>::new(&mut r.inner, r.limits.clone())
55656                    .map(|r| r.map(|t| Self::LedgerHeader(Box::new(t.0)))),
55657            ),
55658            TypeVariant::LedgerHeaderExt => Box::new(
55659                ReadXdrIter::<_, Frame<LedgerHeaderExt>>::new(&mut r.inner, r.limits.clone())
55660                    .map(|r| r.map(|t| Self::LedgerHeaderExt(Box::new(t.0)))),
55661            ),
55662            TypeVariant::LedgerUpgradeType => Box::new(
55663                ReadXdrIter::<_, Frame<LedgerUpgradeType>>::new(&mut r.inner, r.limits.clone())
55664                    .map(|r| r.map(|t| Self::LedgerUpgradeType(Box::new(t.0)))),
55665            ),
55666            TypeVariant::ConfigUpgradeSetKey => Box::new(
55667                ReadXdrIter::<_, Frame<ConfigUpgradeSetKey>>::new(&mut r.inner, r.limits.clone())
55668                    .map(|r| r.map(|t| Self::ConfigUpgradeSetKey(Box::new(t.0)))),
55669            ),
55670            TypeVariant::LedgerUpgrade => Box::new(
55671                ReadXdrIter::<_, Frame<LedgerUpgrade>>::new(&mut r.inner, r.limits.clone())
55672                    .map(|r| r.map(|t| Self::LedgerUpgrade(Box::new(t.0)))),
55673            ),
55674            TypeVariant::ConfigUpgradeSet => Box::new(
55675                ReadXdrIter::<_, Frame<ConfigUpgradeSet>>::new(&mut r.inner, r.limits.clone())
55676                    .map(|r| r.map(|t| Self::ConfigUpgradeSet(Box::new(t.0)))),
55677            ),
55678            TypeVariant::TxSetComponentType => Box::new(
55679                ReadXdrIter::<_, Frame<TxSetComponentType>>::new(&mut r.inner, r.limits.clone())
55680                    .map(|r| r.map(|t| Self::TxSetComponentType(Box::new(t.0)))),
55681            ),
55682            TypeVariant::TxSetComponent => Box::new(
55683                ReadXdrIter::<_, Frame<TxSetComponent>>::new(&mut r.inner, r.limits.clone())
55684                    .map(|r| r.map(|t| Self::TxSetComponent(Box::new(t.0)))),
55685            ),
55686            TypeVariant::TxSetComponentTxsMaybeDiscountedFee => Box::new(
55687                ReadXdrIter::<_, Frame<TxSetComponentTxsMaybeDiscountedFee>>::new(
55688                    &mut r.inner,
55689                    r.limits.clone(),
55690                )
55691                .map(|r| r.map(|t| Self::TxSetComponentTxsMaybeDiscountedFee(Box::new(t.0)))),
55692            ),
55693            TypeVariant::TransactionPhase => Box::new(
55694                ReadXdrIter::<_, Frame<TransactionPhase>>::new(&mut r.inner, r.limits.clone())
55695                    .map(|r| r.map(|t| Self::TransactionPhase(Box::new(t.0)))),
55696            ),
55697            TypeVariant::TransactionSet => Box::new(
55698                ReadXdrIter::<_, Frame<TransactionSet>>::new(&mut r.inner, r.limits.clone())
55699                    .map(|r| r.map(|t| Self::TransactionSet(Box::new(t.0)))),
55700            ),
55701            TypeVariant::TransactionSetV1 => Box::new(
55702                ReadXdrIter::<_, Frame<TransactionSetV1>>::new(&mut r.inner, r.limits.clone())
55703                    .map(|r| r.map(|t| Self::TransactionSetV1(Box::new(t.0)))),
55704            ),
55705            TypeVariant::GeneralizedTransactionSet => Box::new(
55706                ReadXdrIter::<_, Frame<GeneralizedTransactionSet>>::new(
55707                    &mut r.inner,
55708                    r.limits.clone(),
55709                )
55710                .map(|r| r.map(|t| Self::GeneralizedTransactionSet(Box::new(t.0)))),
55711            ),
55712            TypeVariant::TransactionResultPair => Box::new(
55713                ReadXdrIter::<_, Frame<TransactionResultPair>>::new(&mut r.inner, r.limits.clone())
55714                    .map(|r| r.map(|t| Self::TransactionResultPair(Box::new(t.0)))),
55715            ),
55716            TypeVariant::TransactionResultSet => Box::new(
55717                ReadXdrIter::<_, Frame<TransactionResultSet>>::new(&mut r.inner, r.limits.clone())
55718                    .map(|r| r.map(|t| Self::TransactionResultSet(Box::new(t.0)))),
55719            ),
55720            TypeVariant::TransactionHistoryEntry => Box::new(
55721                ReadXdrIter::<_, Frame<TransactionHistoryEntry>>::new(
55722                    &mut r.inner,
55723                    r.limits.clone(),
55724                )
55725                .map(|r| r.map(|t| Self::TransactionHistoryEntry(Box::new(t.0)))),
55726            ),
55727            TypeVariant::TransactionHistoryEntryExt => Box::new(
55728                ReadXdrIter::<_, Frame<TransactionHistoryEntryExt>>::new(
55729                    &mut r.inner,
55730                    r.limits.clone(),
55731                )
55732                .map(|r| r.map(|t| Self::TransactionHistoryEntryExt(Box::new(t.0)))),
55733            ),
55734            TypeVariant::TransactionHistoryResultEntry => Box::new(
55735                ReadXdrIter::<_, Frame<TransactionHistoryResultEntry>>::new(
55736                    &mut r.inner,
55737                    r.limits.clone(),
55738                )
55739                .map(|r| r.map(|t| Self::TransactionHistoryResultEntry(Box::new(t.0)))),
55740            ),
55741            TypeVariant::TransactionHistoryResultEntryExt => Box::new(
55742                ReadXdrIter::<_, Frame<TransactionHistoryResultEntryExt>>::new(
55743                    &mut r.inner,
55744                    r.limits.clone(),
55745                )
55746                .map(|r| r.map(|t| Self::TransactionHistoryResultEntryExt(Box::new(t.0)))),
55747            ),
55748            TypeVariant::LedgerHeaderHistoryEntry => Box::new(
55749                ReadXdrIter::<_, Frame<LedgerHeaderHistoryEntry>>::new(
55750                    &mut r.inner,
55751                    r.limits.clone(),
55752                )
55753                .map(|r| r.map(|t| Self::LedgerHeaderHistoryEntry(Box::new(t.0)))),
55754            ),
55755            TypeVariant::LedgerHeaderHistoryEntryExt => Box::new(
55756                ReadXdrIter::<_, Frame<LedgerHeaderHistoryEntryExt>>::new(
55757                    &mut r.inner,
55758                    r.limits.clone(),
55759                )
55760                .map(|r| r.map(|t| Self::LedgerHeaderHistoryEntryExt(Box::new(t.0)))),
55761            ),
55762            TypeVariant::LedgerScpMessages => Box::new(
55763                ReadXdrIter::<_, Frame<LedgerScpMessages>>::new(&mut r.inner, r.limits.clone())
55764                    .map(|r| r.map(|t| Self::LedgerScpMessages(Box::new(t.0)))),
55765            ),
55766            TypeVariant::ScpHistoryEntryV0 => Box::new(
55767                ReadXdrIter::<_, Frame<ScpHistoryEntryV0>>::new(&mut r.inner, r.limits.clone())
55768                    .map(|r| r.map(|t| Self::ScpHistoryEntryV0(Box::new(t.0)))),
55769            ),
55770            TypeVariant::ScpHistoryEntry => Box::new(
55771                ReadXdrIter::<_, Frame<ScpHistoryEntry>>::new(&mut r.inner, r.limits.clone())
55772                    .map(|r| r.map(|t| Self::ScpHistoryEntry(Box::new(t.0)))),
55773            ),
55774            TypeVariant::LedgerEntryChangeType => Box::new(
55775                ReadXdrIter::<_, Frame<LedgerEntryChangeType>>::new(&mut r.inner, r.limits.clone())
55776                    .map(|r| r.map(|t| Self::LedgerEntryChangeType(Box::new(t.0)))),
55777            ),
55778            TypeVariant::LedgerEntryChange => Box::new(
55779                ReadXdrIter::<_, Frame<LedgerEntryChange>>::new(&mut r.inner, r.limits.clone())
55780                    .map(|r| r.map(|t| Self::LedgerEntryChange(Box::new(t.0)))),
55781            ),
55782            TypeVariant::LedgerEntryChanges => Box::new(
55783                ReadXdrIter::<_, Frame<LedgerEntryChanges>>::new(&mut r.inner, r.limits.clone())
55784                    .map(|r| r.map(|t| Self::LedgerEntryChanges(Box::new(t.0)))),
55785            ),
55786            TypeVariant::OperationMeta => Box::new(
55787                ReadXdrIter::<_, Frame<OperationMeta>>::new(&mut r.inner, r.limits.clone())
55788                    .map(|r| r.map(|t| Self::OperationMeta(Box::new(t.0)))),
55789            ),
55790            TypeVariant::TransactionMetaV1 => Box::new(
55791                ReadXdrIter::<_, Frame<TransactionMetaV1>>::new(&mut r.inner, r.limits.clone())
55792                    .map(|r| r.map(|t| Self::TransactionMetaV1(Box::new(t.0)))),
55793            ),
55794            TypeVariant::TransactionMetaV2 => Box::new(
55795                ReadXdrIter::<_, Frame<TransactionMetaV2>>::new(&mut r.inner, r.limits.clone())
55796                    .map(|r| r.map(|t| Self::TransactionMetaV2(Box::new(t.0)))),
55797            ),
55798            TypeVariant::ContractEventType => Box::new(
55799                ReadXdrIter::<_, Frame<ContractEventType>>::new(&mut r.inner, r.limits.clone())
55800                    .map(|r| r.map(|t| Self::ContractEventType(Box::new(t.0)))),
55801            ),
55802            TypeVariant::ContractEvent => Box::new(
55803                ReadXdrIter::<_, Frame<ContractEvent>>::new(&mut r.inner, r.limits.clone())
55804                    .map(|r| r.map(|t| Self::ContractEvent(Box::new(t.0)))),
55805            ),
55806            TypeVariant::ContractEventBody => Box::new(
55807                ReadXdrIter::<_, Frame<ContractEventBody>>::new(&mut r.inner, r.limits.clone())
55808                    .map(|r| r.map(|t| Self::ContractEventBody(Box::new(t.0)))),
55809            ),
55810            TypeVariant::ContractEventV0 => Box::new(
55811                ReadXdrIter::<_, Frame<ContractEventV0>>::new(&mut r.inner, r.limits.clone())
55812                    .map(|r| r.map(|t| Self::ContractEventV0(Box::new(t.0)))),
55813            ),
55814            TypeVariant::DiagnosticEvent => Box::new(
55815                ReadXdrIter::<_, Frame<DiagnosticEvent>>::new(&mut r.inner, r.limits.clone())
55816                    .map(|r| r.map(|t| Self::DiagnosticEvent(Box::new(t.0)))),
55817            ),
55818            TypeVariant::DiagnosticEvents => Box::new(
55819                ReadXdrIter::<_, Frame<DiagnosticEvents>>::new(&mut r.inner, r.limits.clone())
55820                    .map(|r| r.map(|t| Self::DiagnosticEvents(Box::new(t.0)))),
55821            ),
55822            TypeVariant::SorobanTransactionMetaExtV1 => Box::new(
55823                ReadXdrIter::<_, Frame<SorobanTransactionMetaExtV1>>::new(
55824                    &mut r.inner,
55825                    r.limits.clone(),
55826                )
55827                .map(|r| r.map(|t| Self::SorobanTransactionMetaExtV1(Box::new(t.0)))),
55828            ),
55829            TypeVariant::SorobanTransactionMetaExt => Box::new(
55830                ReadXdrIter::<_, Frame<SorobanTransactionMetaExt>>::new(
55831                    &mut r.inner,
55832                    r.limits.clone(),
55833                )
55834                .map(|r| r.map(|t| Self::SorobanTransactionMetaExt(Box::new(t.0)))),
55835            ),
55836            TypeVariant::SorobanTransactionMeta => Box::new(
55837                ReadXdrIter::<_, Frame<SorobanTransactionMeta>>::new(
55838                    &mut r.inner,
55839                    r.limits.clone(),
55840                )
55841                .map(|r| r.map(|t| Self::SorobanTransactionMeta(Box::new(t.0)))),
55842            ),
55843            TypeVariant::TransactionMetaV3 => Box::new(
55844                ReadXdrIter::<_, Frame<TransactionMetaV3>>::new(&mut r.inner, r.limits.clone())
55845                    .map(|r| r.map(|t| Self::TransactionMetaV3(Box::new(t.0)))),
55846            ),
55847            TypeVariant::InvokeHostFunctionSuccessPreImage => Box::new(
55848                ReadXdrIter::<_, Frame<InvokeHostFunctionSuccessPreImage>>::new(
55849                    &mut r.inner,
55850                    r.limits.clone(),
55851                )
55852                .map(|r| r.map(|t| Self::InvokeHostFunctionSuccessPreImage(Box::new(t.0)))),
55853            ),
55854            TypeVariant::TransactionMeta => Box::new(
55855                ReadXdrIter::<_, Frame<TransactionMeta>>::new(&mut r.inner, r.limits.clone())
55856                    .map(|r| r.map(|t| Self::TransactionMeta(Box::new(t.0)))),
55857            ),
55858            TypeVariant::TransactionResultMeta => Box::new(
55859                ReadXdrIter::<_, Frame<TransactionResultMeta>>::new(&mut r.inner, r.limits.clone())
55860                    .map(|r| r.map(|t| Self::TransactionResultMeta(Box::new(t.0)))),
55861            ),
55862            TypeVariant::UpgradeEntryMeta => Box::new(
55863                ReadXdrIter::<_, Frame<UpgradeEntryMeta>>::new(&mut r.inner, r.limits.clone())
55864                    .map(|r| r.map(|t| Self::UpgradeEntryMeta(Box::new(t.0)))),
55865            ),
55866            TypeVariant::LedgerCloseMetaV0 => Box::new(
55867                ReadXdrIter::<_, Frame<LedgerCloseMetaV0>>::new(&mut r.inner, r.limits.clone())
55868                    .map(|r| r.map(|t| Self::LedgerCloseMetaV0(Box::new(t.0)))),
55869            ),
55870            TypeVariant::LedgerCloseMetaExtV1 => Box::new(
55871                ReadXdrIter::<_, Frame<LedgerCloseMetaExtV1>>::new(&mut r.inner, r.limits.clone())
55872                    .map(|r| r.map(|t| Self::LedgerCloseMetaExtV1(Box::new(t.0)))),
55873            ),
55874            TypeVariant::LedgerCloseMetaExt => Box::new(
55875                ReadXdrIter::<_, Frame<LedgerCloseMetaExt>>::new(&mut r.inner, r.limits.clone())
55876                    .map(|r| r.map(|t| Self::LedgerCloseMetaExt(Box::new(t.0)))),
55877            ),
55878            TypeVariant::LedgerCloseMetaV1 => Box::new(
55879                ReadXdrIter::<_, Frame<LedgerCloseMetaV1>>::new(&mut r.inner, r.limits.clone())
55880                    .map(|r| r.map(|t| Self::LedgerCloseMetaV1(Box::new(t.0)))),
55881            ),
55882            TypeVariant::LedgerCloseMeta => Box::new(
55883                ReadXdrIter::<_, Frame<LedgerCloseMeta>>::new(&mut r.inner, r.limits.clone())
55884                    .map(|r| r.map(|t| Self::LedgerCloseMeta(Box::new(t.0)))),
55885            ),
55886            TypeVariant::ErrorCode => Box::new(
55887                ReadXdrIter::<_, Frame<ErrorCode>>::new(&mut r.inner, r.limits.clone())
55888                    .map(|r| r.map(|t| Self::ErrorCode(Box::new(t.0)))),
55889            ),
55890            TypeVariant::SError => Box::new(
55891                ReadXdrIter::<_, Frame<SError>>::new(&mut r.inner, r.limits.clone())
55892                    .map(|r| r.map(|t| Self::SError(Box::new(t.0)))),
55893            ),
55894            TypeVariant::SendMore => Box::new(
55895                ReadXdrIter::<_, Frame<SendMore>>::new(&mut r.inner, r.limits.clone())
55896                    .map(|r| r.map(|t| Self::SendMore(Box::new(t.0)))),
55897            ),
55898            TypeVariant::SendMoreExtended => Box::new(
55899                ReadXdrIter::<_, Frame<SendMoreExtended>>::new(&mut r.inner, r.limits.clone())
55900                    .map(|r| r.map(|t| Self::SendMoreExtended(Box::new(t.0)))),
55901            ),
55902            TypeVariant::AuthCert => Box::new(
55903                ReadXdrIter::<_, Frame<AuthCert>>::new(&mut r.inner, r.limits.clone())
55904                    .map(|r| r.map(|t| Self::AuthCert(Box::new(t.0)))),
55905            ),
55906            TypeVariant::Hello => Box::new(
55907                ReadXdrIter::<_, Frame<Hello>>::new(&mut r.inner, r.limits.clone())
55908                    .map(|r| r.map(|t| Self::Hello(Box::new(t.0)))),
55909            ),
55910            TypeVariant::Auth => Box::new(
55911                ReadXdrIter::<_, Frame<Auth>>::new(&mut r.inner, r.limits.clone())
55912                    .map(|r| r.map(|t| Self::Auth(Box::new(t.0)))),
55913            ),
55914            TypeVariant::IpAddrType => Box::new(
55915                ReadXdrIter::<_, Frame<IpAddrType>>::new(&mut r.inner, r.limits.clone())
55916                    .map(|r| r.map(|t| Self::IpAddrType(Box::new(t.0)))),
55917            ),
55918            TypeVariant::PeerAddress => Box::new(
55919                ReadXdrIter::<_, Frame<PeerAddress>>::new(&mut r.inner, r.limits.clone())
55920                    .map(|r| r.map(|t| Self::PeerAddress(Box::new(t.0)))),
55921            ),
55922            TypeVariant::PeerAddressIp => Box::new(
55923                ReadXdrIter::<_, Frame<PeerAddressIp>>::new(&mut r.inner, r.limits.clone())
55924                    .map(|r| r.map(|t| Self::PeerAddressIp(Box::new(t.0)))),
55925            ),
55926            TypeVariant::MessageType => Box::new(
55927                ReadXdrIter::<_, Frame<MessageType>>::new(&mut r.inner, r.limits.clone())
55928                    .map(|r| r.map(|t| Self::MessageType(Box::new(t.0)))),
55929            ),
55930            TypeVariant::DontHave => Box::new(
55931                ReadXdrIter::<_, Frame<DontHave>>::new(&mut r.inner, r.limits.clone())
55932                    .map(|r| r.map(|t| Self::DontHave(Box::new(t.0)))),
55933            ),
55934            TypeVariant::SurveyMessageCommandType => Box::new(
55935                ReadXdrIter::<_, Frame<SurveyMessageCommandType>>::new(
55936                    &mut r.inner,
55937                    r.limits.clone(),
55938                )
55939                .map(|r| r.map(|t| Self::SurveyMessageCommandType(Box::new(t.0)))),
55940            ),
55941            TypeVariant::SurveyMessageResponseType => Box::new(
55942                ReadXdrIter::<_, Frame<SurveyMessageResponseType>>::new(
55943                    &mut r.inner,
55944                    r.limits.clone(),
55945                )
55946                .map(|r| r.map(|t| Self::SurveyMessageResponseType(Box::new(t.0)))),
55947            ),
55948            TypeVariant::TimeSlicedSurveyStartCollectingMessage => Box::new(
55949                ReadXdrIter::<_, Frame<TimeSlicedSurveyStartCollectingMessage>>::new(
55950                    &mut r.inner,
55951                    r.limits.clone(),
55952                )
55953                .map(|r| r.map(|t| Self::TimeSlicedSurveyStartCollectingMessage(Box::new(t.0)))),
55954            ),
55955            TypeVariant::SignedTimeSlicedSurveyStartCollectingMessage => Box::new(
55956                ReadXdrIter::<_, Frame<SignedTimeSlicedSurveyStartCollectingMessage>>::new(
55957                    &mut r.inner,
55958                    r.limits.clone(),
55959                )
55960                .map(|r| {
55961                    r.map(|t| Self::SignedTimeSlicedSurveyStartCollectingMessage(Box::new(t.0)))
55962                }),
55963            ),
55964            TypeVariant::TimeSlicedSurveyStopCollectingMessage => Box::new(
55965                ReadXdrIter::<_, Frame<TimeSlicedSurveyStopCollectingMessage>>::new(
55966                    &mut r.inner,
55967                    r.limits.clone(),
55968                )
55969                .map(|r| r.map(|t| Self::TimeSlicedSurveyStopCollectingMessage(Box::new(t.0)))),
55970            ),
55971            TypeVariant::SignedTimeSlicedSurveyStopCollectingMessage => Box::new(
55972                ReadXdrIter::<_, Frame<SignedTimeSlicedSurveyStopCollectingMessage>>::new(
55973                    &mut r.inner,
55974                    r.limits.clone(),
55975                )
55976                .map(|r| {
55977                    r.map(|t| Self::SignedTimeSlicedSurveyStopCollectingMessage(Box::new(t.0)))
55978                }),
55979            ),
55980            TypeVariant::SurveyRequestMessage => Box::new(
55981                ReadXdrIter::<_, Frame<SurveyRequestMessage>>::new(&mut r.inner, r.limits.clone())
55982                    .map(|r| r.map(|t| Self::SurveyRequestMessage(Box::new(t.0)))),
55983            ),
55984            TypeVariant::TimeSlicedSurveyRequestMessage => Box::new(
55985                ReadXdrIter::<_, Frame<TimeSlicedSurveyRequestMessage>>::new(
55986                    &mut r.inner,
55987                    r.limits.clone(),
55988                )
55989                .map(|r| r.map(|t| Self::TimeSlicedSurveyRequestMessage(Box::new(t.0)))),
55990            ),
55991            TypeVariant::SignedSurveyRequestMessage => Box::new(
55992                ReadXdrIter::<_, Frame<SignedSurveyRequestMessage>>::new(
55993                    &mut r.inner,
55994                    r.limits.clone(),
55995                )
55996                .map(|r| r.map(|t| Self::SignedSurveyRequestMessage(Box::new(t.0)))),
55997            ),
55998            TypeVariant::SignedTimeSlicedSurveyRequestMessage => Box::new(
55999                ReadXdrIter::<_, Frame<SignedTimeSlicedSurveyRequestMessage>>::new(
56000                    &mut r.inner,
56001                    r.limits.clone(),
56002                )
56003                .map(|r| r.map(|t| Self::SignedTimeSlicedSurveyRequestMessage(Box::new(t.0)))),
56004            ),
56005            TypeVariant::EncryptedBody => Box::new(
56006                ReadXdrIter::<_, Frame<EncryptedBody>>::new(&mut r.inner, r.limits.clone())
56007                    .map(|r| r.map(|t| Self::EncryptedBody(Box::new(t.0)))),
56008            ),
56009            TypeVariant::SurveyResponseMessage => Box::new(
56010                ReadXdrIter::<_, Frame<SurveyResponseMessage>>::new(&mut r.inner, r.limits.clone())
56011                    .map(|r| r.map(|t| Self::SurveyResponseMessage(Box::new(t.0)))),
56012            ),
56013            TypeVariant::TimeSlicedSurveyResponseMessage => Box::new(
56014                ReadXdrIter::<_, Frame<TimeSlicedSurveyResponseMessage>>::new(
56015                    &mut r.inner,
56016                    r.limits.clone(),
56017                )
56018                .map(|r| r.map(|t| Self::TimeSlicedSurveyResponseMessage(Box::new(t.0)))),
56019            ),
56020            TypeVariant::SignedSurveyResponseMessage => Box::new(
56021                ReadXdrIter::<_, Frame<SignedSurveyResponseMessage>>::new(
56022                    &mut r.inner,
56023                    r.limits.clone(),
56024                )
56025                .map(|r| r.map(|t| Self::SignedSurveyResponseMessage(Box::new(t.0)))),
56026            ),
56027            TypeVariant::SignedTimeSlicedSurveyResponseMessage => Box::new(
56028                ReadXdrIter::<_, Frame<SignedTimeSlicedSurveyResponseMessage>>::new(
56029                    &mut r.inner,
56030                    r.limits.clone(),
56031                )
56032                .map(|r| r.map(|t| Self::SignedTimeSlicedSurveyResponseMessage(Box::new(t.0)))),
56033            ),
56034            TypeVariant::PeerStats => Box::new(
56035                ReadXdrIter::<_, Frame<PeerStats>>::new(&mut r.inner, r.limits.clone())
56036                    .map(|r| r.map(|t| Self::PeerStats(Box::new(t.0)))),
56037            ),
56038            TypeVariant::PeerStatList => Box::new(
56039                ReadXdrIter::<_, Frame<PeerStatList>>::new(&mut r.inner, r.limits.clone())
56040                    .map(|r| r.map(|t| Self::PeerStatList(Box::new(t.0)))),
56041            ),
56042            TypeVariant::TimeSlicedNodeData => Box::new(
56043                ReadXdrIter::<_, Frame<TimeSlicedNodeData>>::new(&mut r.inner, r.limits.clone())
56044                    .map(|r| r.map(|t| Self::TimeSlicedNodeData(Box::new(t.0)))),
56045            ),
56046            TypeVariant::TimeSlicedPeerData => Box::new(
56047                ReadXdrIter::<_, Frame<TimeSlicedPeerData>>::new(&mut r.inner, r.limits.clone())
56048                    .map(|r| r.map(|t| Self::TimeSlicedPeerData(Box::new(t.0)))),
56049            ),
56050            TypeVariant::TimeSlicedPeerDataList => Box::new(
56051                ReadXdrIter::<_, Frame<TimeSlicedPeerDataList>>::new(
56052                    &mut r.inner,
56053                    r.limits.clone(),
56054                )
56055                .map(|r| r.map(|t| Self::TimeSlicedPeerDataList(Box::new(t.0)))),
56056            ),
56057            TypeVariant::TopologyResponseBodyV0 => Box::new(
56058                ReadXdrIter::<_, Frame<TopologyResponseBodyV0>>::new(
56059                    &mut r.inner,
56060                    r.limits.clone(),
56061                )
56062                .map(|r| r.map(|t| Self::TopologyResponseBodyV0(Box::new(t.0)))),
56063            ),
56064            TypeVariant::TopologyResponseBodyV1 => Box::new(
56065                ReadXdrIter::<_, Frame<TopologyResponseBodyV1>>::new(
56066                    &mut r.inner,
56067                    r.limits.clone(),
56068                )
56069                .map(|r| r.map(|t| Self::TopologyResponseBodyV1(Box::new(t.0)))),
56070            ),
56071            TypeVariant::TopologyResponseBodyV2 => Box::new(
56072                ReadXdrIter::<_, Frame<TopologyResponseBodyV2>>::new(
56073                    &mut r.inner,
56074                    r.limits.clone(),
56075                )
56076                .map(|r| r.map(|t| Self::TopologyResponseBodyV2(Box::new(t.0)))),
56077            ),
56078            TypeVariant::SurveyResponseBody => Box::new(
56079                ReadXdrIter::<_, Frame<SurveyResponseBody>>::new(&mut r.inner, r.limits.clone())
56080                    .map(|r| r.map(|t| Self::SurveyResponseBody(Box::new(t.0)))),
56081            ),
56082            TypeVariant::TxAdvertVector => Box::new(
56083                ReadXdrIter::<_, Frame<TxAdvertVector>>::new(&mut r.inner, r.limits.clone())
56084                    .map(|r| r.map(|t| Self::TxAdvertVector(Box::new(t.0)))),
56085            ),
56086            TypeVariant::FloodAdvert => Box::new(
56087                ReadXdrIter::<_, Frame<FloodAdvert>>::new(&mut r.inner, r.limits.clone())
56088                    .map(|r| r.map(|t| Self::FloodAdvert(Box::new(t.0)))),
56089            ),
56090            TypeVariant::TxDemandVector => Box::new(
56091                ReadXdrIter::<_, Frame<TxDemandVector>>::new(&mut r.inner, r.limits.clone())
56092                    .map(|r| r.map(|t| Self::TxDemandVector(Box::new(t.0)))),
56093            ),
56094            TypeVariant::FloodDemand => Box::new(
56095                ReadXdrIter::<_, Frame<FloodDemand>>::new(&mut r.inner, r.limits.clone())
56096                    .map(|r| r.map(|t| Self::FloodDemand(Box::new(t.0)))),
56097            ),
56098            TypeVariant::StellarMessage => Box::new(
56099                ReadXdrIter::<_, Frame<StellarMessage>>::new(&mut r.inner, r.limits.clone())
56100                    .map(|r| r.map(|t| Self::StellarMessage(Box::new(t.0)))),
56101            ),
56102            TypeVariant::AuthenticatedMessage => Box::new(
56103                ReadXdrIter::<_, Frame<AuthenticatedMessage>>::new(&mut r.inner, r.limits.clone())
56104                    .map(|r| r.map(|t| Self::AuthenticatedMessage(Box::new(t.0)))),
56105            ),
56106            TypeVariant::AuthenticatedMessageV0 => Box::new(
56107                ReadXdrIter::<_, Frame<AuthenticatedMessageV0>>::new(
56108                    &mut r.inner,
56109                    r.limits.clone(),
56110                )
56111                .map(|r| r.map(|t| Self::AuthenticatedMessageV0(Box::new(t.0)))),
56112            ),
56113            TypeVariant::LiquidityPoolParameters => Box::new(
56114                ReadXdrIter::<_, Frame<LiquidityPoolParameters>>::new(
56115                    &mut r.inner,
56116                    r.limits.clone(),
56117                )
56118                .map(|r| r.map(|t| Self::LiquidityPoolParameters(Box::new(t.0)))),
56119            ),
56120            TypeVariant::MuxedAccount => Box::new(
56121                ReadXdrIter::<_, Frame<MuxedAccount>>::new(&mut r.inner, r.limits.clone())
56122                    .map(|r| r.map(|t| Self::MuxedAccount(Box::new(t.0)))),
56123            ),
56124            TypeVariant::MuxedAccountMed25519 => Box::new(
56125                ReadXdrIter::<_, Frame<MuxedAccountMed25519>>::new(&mut r.inner, r.limits.clone())
56126                    .map(|r| r.map(|t| Self::MuxedAccountMed25519(Box::new(t.0)))),
56127            ),
56128            TypeVariant::DecoratedSignature => Box::new(
56129                ReadXdrIter::<_, Frame<DecoratedSignature>>::new(&mut r.inner, r.limits.clone())
56130                    .map(|r| r.map(|t| Self::DecoratedSignature(Box::new(t.0)))),
56131            ),
56132            TypeVariant::OperationType => Box::new(
56133                ReadXdrIter::<_, Frame<OperationType>>::new(&mut r.inner, r.limits.clone())
56134                    .map(|r| r.map(|t| Self::OperationType(Box::new(t.0)))),
56135            ),
56136            TypeVariant::CreateAccountOp => Box::new(
56137                ReadXdrIter::<_, Frame<CreateAccountOp>>::new(&mut r.inner, r.limits.clone())
56138                    .map(|r| r.map(|t| Self::CreateAccountOp(Box::new(t.0)))),
56139            ),
56140            TypeVariant::PaymentOp => Box::new(
56141                ReadXdrIter::<_, Frame<PaymentOp>>::new(&mut r.inner, r.limits.clone())
56142                    .map(|r| r.map(|t| Self::PaymentOp(Box::new(t.0)))),
56143            ),
56144            TypeVariant::PathPaymentStrictReceiveOp => Box::new(
56145                ReadXdrIter::<_, Frame<PathPaymentStrictReceiveOp>>::new(
56146                    &mut r.inner,
56147                    r.limits.clone(),
56148                )
56149                .map(|r| r.map(|t| Self::PathPaymentStrictReceiveOp(Box::new(t.0)))),
56150            ),
56151            TypeVariant::PathPaymentStrictSendOp => Box::new(
56152                ReadXdrIter::<_, Frame<PathPaymentStrictSendOp>>::new(
56153                    &mut r.inner,
56154                    r.limits.clone(),
56155                )
56156                .map(|r| r.map(|t| Self::PathPaymentStrictSendOp(Box::new(t.0)))),
56157            ),
56158            TypeVariant::ManageSellOfferOp => Box::new(
56159                ReadXdrIter::<_, Frame<ManageSellOfferOp>>::new(&mut r.inner, r.limits.clone())
56160                    .map(|r| r.map(|t| Self::ManageSellOfferOp(Box::new(t.0)))),
56161            ),
56162            TypeVariant::ManageBuyOfferOp => Box::new(
56163                ReadXdrIter::<_, Frame<ManageBuyOfferOp>>::new(&mut r.inner, r.limits.clone())
56164                    .map(|r| r.map(|t| Self::ManageBuyOfferOp(Box::new(t.0)))),
56165            ),
56166            TypeVariant::CreatePassiveSellOfferOp => Box::new(
56167                ReadXdrIter::<_, Frame<CreatePassiveSellOfferOp>>::new(
56168                    &mut r.inner,
56169                    r.limits.clone(),
56170                )
56171                .map(|r| r.map(|t| Self::CreatePassiveSellOfferOp(Box::new(t.0)))),
56172            ),
56173            TypeVariant::SetOptionsOp => Box::new(
56174                ReadXdrIter::<_, Frame<SetOptionsOp>>::new(&mut r.inner, r.limits.clone())
56175                    .map(|r| r.map(|t| Self::SetOptionsOp(Box::new(t.0)))),
56176            ),
56177            TypeVariant::ChangeTrustAsset => Box::new(
56178                ReadXdrIter::<_, Frame<ChangeTrustAsset>>::new(&mut r.inner, r.limits.clone())
56179                    .map(|r| r.map(|t| Self::ChangeTrustAsset(Box::new(t.0)))),
56180            ),
56181            TypeVariant::ChangeTrustOp => Box::new(
56182                ReadXdrIter::<_, Frame<ChangeTrustOp>>::new(&mut r.inner, r.limits.clone())
56183                    .map(|r| r.map(|t| Self::ChangeTrustOp(Box::new(t.0)))),
56184            ),
56185            TypeVariant::AllowTrustOp => Box::new(
56186                ReadXdrIter::<_, Frame<AllowTrustOp>>::new(&mut r.inner, r.limits.clone())
56187                    .map(|r| r.map(|t| Self::AllowTrustOp(Box::new(t.0)))),
56188            ),
56189            TypeVariant::ManageDataOp => Box::new(
56190                ReadXdrIter::<_, Frame<ManageDataOp>>::new(&mut r.inner, r.limits.clone())
56191                    .map(|r| r.map(|t| Self::ManageDataOp(Box::new(t.0)))),
56192            ),
56193            TypeVariant::BumpSequenceOp => Box::new(
56194                ReadXdrIter::<_, Frame<BumpSequenceOp>>::new(&mut r.inner, r.limits.clone())
56195                    .map(|r| r.map(|t| Self::BumpSequenceOp(Box::new(t.0)))),
56196            ),
56197            TypeVariant::CreateClaimableBalanceOp => Box::new(
56198                ReadXdrIter::<_, Frame<CreateClaimableBalanceOp>>::new(
56199                    &mut r.inner,
56200                    r.limits.clone(),
56201                )
56202                .map(|r| r.map(|t| Self::CreateClaimableBalanceOp(Box::new(t.0)))),
56203            ),
56204            TypeVariant::ClaimClaimableBalanceOp => Box::new(
56205                ReadXdrIter::<_, Frame<ClaimClaimableBalanceOp>>::new(
56206                    &mut r.inner,
56207                    r.limits.clone(),
56208                )
56209                .map(|r| r.map(|t| Self::ClaimClaimableBalanceOp(Box::new(t.0)))),
56210            ),
56211            TypeVariant::BeginSponsoringFutureReservesOp => Box::new(
56212                ReadXdrIter::<_, Frame<BeginSponsoringFutureReservesOp>>::new(
56213                    &mut r.inner,
56214                    r.limits.clone(),
56215                )
56216                .map(|r| r.map(|t| Self::BeginSponsoringFutureReservesOp(Box::new(t.0)))),
56217            ),
56218            TypeVariant::RevokeSponsorshipType => Box::new(
56219                ReadXdrIter::<_, Frame<RevokeSponsorshipType>>::new(&mut r.inner, r.limits.clone())
56220                    .map(|r| r.map(|t| Self::RevokeSponsorshipType(Box::new(t.0)))),
56221            ),
56222            TypeVariant::RevokeSponsorshipOp => Box::new(
56223                ReadXdrIter::<_, Frame<RevokeSponsorshipOp>>::new(&mut r.inner, r.limits.clone())
56224                    .map(|r| r.map(|t| Self::RevokeSponsorshipOp(Box::new(t.0)))),
56225            ),
56226            TypeVariant::RevokeSponsorshipOpSigner => Box::new(
56227                ReadXdrIter::<_, Frame<RevokeSponsorshipOpSigner>>::new(
56228                    &mut r.inner,
56229                    r.limits.clone(),
56230                )
56231                .map(|r| r.map(|t| Self::RevokeSponsorshipOpSigner(Box::new(t.0)))),
56232            ),
56233            TypeVariant::ClawbackOp => Box::new(
56234                ReadXdrIter::<_, Frame<ClawbackOp>>::new(&mut r.inner, r.limits.clone())
56235                    .map(|r| r.map(|t| Self::ClawbackOp(Box::new(t.0)))),
56236            ),
56237            TypeVariant::ClawbackClaimableBalanceOp => Box::new(
56238                ReadXdrIter::<_, Frame<ClawbackClaimableBalanceOp>>::new(
56239                    &mut r.inner,
56240                    r.limits.clone(),
56241                )
56242                .map(|r| r.map(|t| Self::ClawbackClaimableBalanceOp(Box::new(t.0)))),
56243            ),
56244            TypeVariant::SetTrustLineFlagsOp => Box::new(
56245                ReadXdrIter::<_, Frame<SetTrustLineFlagsOp>>::new(&mut r.inner, r.limits.clone())
56246                    .map(|r| r.map(|t| Self::SetTrustLineFlagsOp(Box::new(t.0)))),
56247            ),
56248            TypeVariant::LiquidityPoolDepositOp => Box::new(
56249                ReadXdrIter::<_, Frame<LiquidityPoolDepositOp>>::new(
56250                    &mut r.inner,
56251                    r.limits.clone(),
56252                )
56253                .map(|r| r.map(|t| Self::LiquidityPoolDepositOp(Box::new(t.0)))),
56254            ),
56255            TypeVariant::LiquidityPoolWithdrawOp => Box::new(
56256                ReadXdrIter::<_, Frame<LiquidityPoolWithdrawOp>>::new(
56257                    &mut r.inner,
56258                    r.limits.clone(),
56259                )
56260                .map(|r| r.map(|t| Self::LiquidityPoolWithdrawOp(Box::new(t.0)))),
56261            ),
56262            TypeVariant::HostFunctionType => Box::new(
56263                ReadXdrIter::<_, Frame<HostFunctionType>>::new(&mut r.inner, r.limits.clone())
56264                    .map(|r| r.map(|t| Self::HostFunctionType(Box::new(t.0)))),
56265            ),
56266            TypeVariant::ContractIdPreimageType => Box::new(
56267                ReadXdrIter::<_, Frame<ContractIdPreimageType>>::new(
56268                    &mut r.inner,
56269                    r.limits.clone(),
56270                )
56271                .map(|r| r.map(|t| Self::ContractIdPreimageType(Box::new(t.0)))),
56272            ),
56273            TypeVariant::ContractIdPreimage => Box::new(
56274                ReadXdrIter::<_, Frame<ContractIdPreimage>>::new(&mut r.inner, r.limits.clone())
56275                    .map(|r| r.map(|t| Self::ContractIdPreimage(Box::new(t.0)))),
56276            ),
56277            TypeVariant::ContractIdPreimageFromAddress => Box::new(
56278                ReadXdrIter::<_, Frame<ContractIdPreimageFromAddress>>::new(
56279                    &mut r.inner,
56280                    r.limits.clone(),
56281                )
56282                .map(|r| r.map(|t| Self::ContractIdPreimageFromAddress(Box::new(t.0)))),
56283            ),
56284            TypeVariant::CreateContractArgs => Box::new(
56285                ReadXdrIter::<_, Frame<CreateContractArgs>>::new(&mut r.inner, r.limits.clone())
56286                    .map(|r| r.map(|t| Self::CreateContractArgs(Box::new(t.0)))),
56287            ),
56288            TypeVariant::CreateContractArgsV2 => Box::new(
56289                ReadXdrIter::<_, Frame<CreateContractArgsV2>>::new(&mut r.inner, r.limits.clone())
56290                    .map(|r| r.map(|t| Self::CreateContractArgsV2(Box::new(t.0)))),
56291            ),
56292            TypeVariant::InvokeContractArgs => Box::new(
56293                ReadXdrIter::<_, Frame<InvokeContractArgs>>::new(&mut r.inner, r.limits.clone())
56294                    .map(|r| r.map(|t| Self::InvokeContractArgs(Box::new(t.0)))),
56295            ),
56296            TypeVariant::HostFunction => Box::new(
56297                ReadXdrIter::<_, Frame<HostFunction>>::new(&mut r.inner, r.limits.clone())
56298                    .map(|r| r.map(|t| Self::HostFunction(Box::new(t.0)))),
56299            ),
56300            TypeVariant::SorobanAuthorizedFunctionType => Box::new(
56301                ReadXdrIter::<_, Frame<SorobanAuthorizedFunctionType>>::new(
56302                    &mut r.inner,
56303                    r.limits.clone(),
56304                )
56305                .map(|r| r.map(|t| Self::SorobanAuthorizedFunctionType(Box::new(t.0)))),
56306            ),
56307            TypeVariant::SorobanAuthorizedFunction => Box::new(
56308                ReadXdrIter::<_, Frame<SorobanAuthorizedFunction>>::new(
56309                    &mut r.inner,
56310                    r.limits.clone(),
56311                )
56312                .map(|r| r.map(|t| Self::SorobanAuthorizedFunction(Box::new(t.0)))),
56313            ),
56314            TypeVariant::SorobanAuthorizedInvocation => Box::new(
56315                ReadXdrIter::<_, Frame<SorobanAuthorizedInvocation>>::new(
56316                    &mut r.inner,
56317                    r.limits.clone(),
56318                )
56319                .map(|r| r.map(|t| Self::SorobanAuthorizedInvocation(Box::new(t.0)))),
56320            ),
56321            TypeVariant::SorobanAddressCredentials => Box::new(
56322                ReadXdrIter::<_, Frame<SorobanAddressCredentials>>::new(
56323                    &mut r.inner,
56324                    r.limits.clone(),
56325                )
56326                .map(|r| r.map(|t| Self::SorobanAddressCredentials(Box::new(t.0)))),
56327            ),
56328            TypeVariant::SorobanCredentialsType => Box::new(
56329                ReadXdrIter::<_, Frame<SorobanCredentialsType>>::new(
56330                    &mut r.inner,
56331                    r.limits.clone(),
56332                )
56333                .map(|r| r.map(|t| Self::SorobanCredentialsType(Box::new(t.0)))),
56334            ),
56335            TypeVariant::SorobanCredentials => Box::new(
56336                ReadXdrIter::<_, Frame<SorobanCredentials>>::new(&mut r.inner, r.limits.clone())
56337                    .map(|r| r.map(|t| Self::SorobanCredentials(Box::new(t.0)))),
56338            ),
56339            TypeVariant::SorobanAuthorizationEntry => Box::new(
56340                ReadXdrIter::<_, Frame<SorobanAuthorizationEntry>>::new(
56341                    &mut r.inner,
56342                    r.limits.clone(),
56343                )
56344                .map(|r| r.map(|t| Self::SorobanAuthorizationEntry(Box::new(t.0)))),
56345            ),
56346            TypeVariant::InvokeHostFunctionOp => Box::new(
56347                ReadXdrIter::<_, Frame<InvokeHostFunctionOp>>::new(&mut r.inner, r.limits.clone())
56348                    .map(|r| r.map(|t| Self::InvokeHostFunctionOp(Box::new(t.0)))),
56349            ),
56350            TypeVariant::ExtendFootprintTtlOp => Box::new(
56351                ReadXdrIter::<_, Frame<ExtendFootprintTtlOp>>::new(&mut r.inner, r.limits.clone())
56352                    .map(|r| r.map(|t| Self::ExtendFootprintTtlOp(Box::new(t.0)))),
56353            ),
56354            TypeVariant::RestoreFootprintOp => Box::new(
56355                ReadXdrIter::<_, Frame<RestoreFootprintOp>>::new(&mut r.inner, r.limits.clone())
56356                    .map(|r| r.map(|t| Self::RestoreFootprintOp(Box::new(t.0)))),
56357            ),
56358            TypeVariant::Operation => Box::new(
56359                ReadXdrIter::<_, Frame<Operation>>::new(&mut r.inner, r.limits.clone())
56360                    .map(|r| r.map(|t| Self::Operation(Box::new(t.0)))),
56361            ),
56362            TypeVariant::OperationBody => Box::new(
56363                ReadXdrIter::<_, Frame<OperationBody>>::new(&mut r.inner, r.limits.clone())
56364                    .map(|r| r.map(|t| Self::OperationBody(Box::new(t.0)))),
56365            ),
56366            TypeVariant::HashIdPreimage => Box::new(
56367                ReadXdrIter::<_, Frame<HashIdPreimage>>::new(&mut r.inner, r.limits.clone())
56368                    .map(|r| r.map(|t| Self::HashIdPreimage(Box::new(t.0)))),
56369            ),
56370            TypeVariant::HashIdPreimageOperationId => Box::new(
56371                ReadXdrIter::<_, Frame<HashIdPreimageOperationId>>::new(
56372                    &mut r.inner,
56373                    r.limits.clone(),
56374                )
56375                .map(|r| r.map(|t| Self::HashIdPreimageOperationId(Box::new(t.0)))),
56376            ),
56377            TypeVariant::HashIdPreimageRevokeId => Box::new(
56378                ReadXdrIter::<_, Frame<HashIdPreimageRevokeId>>::new(
56379                    &mut r.inner,
56380                    r.limits.clone(),
56381                )
56382                .map(|r| r.map(|t| Self::HashIdPreimageRevokeId(Box::new(t.0)))),
56383            ),
56384            TypeVariant::HashIdPreimageContractId => Box::new(
56385                ReadXdrIter::<_, Frame<HashIdPreimageContractId>>::new(
56386                    &mut r.inner,
56387                    r.limits.clone(),
56388                )
56389                .map(|r| r.map(|t| Self::HashIdPreimageContractId(Box::new(t.0)))),
56390            ),
56391            TypeVariant::HashIdPreimageSorobanAuthorization => Box::new(
56392                ReadXdrIter::<_, Frame<HashIdPreimageSorobanAuthorization>>::new(
56393                    &mut r.inner,
56394                    r.limits.clone(),
56395                )
56396                .map(|r| r.map(|t| Self::HashIdPreimageSorobanAuthorization(Box::new(t.0)))),
56397            ),
56398            TypeVariant::MemoType => Box::new(
56399                ReadXdrIter::<_, Frame<MemoType>>::new(&mut r.inner, r.limits.clone())
56400                    .map(|r| r.map(|t| Self::MemoType(Box::new(t.0)))),
56401            ),
56402            TypeVariant::Memo => Box::new(
56403                ReadXdrIter::<_, Frame<Memo>>::new(&mut r.inner, r.limits.clone())
56404                    .map(|r| r.map(|t| Self::Memo(Box::new(t.0)))),
56405            ),
56406            TypeVariant::TimeBounds => Box::new(
56407                ReadXdrIter::<_, Frame<TimeBounds>>::new(&mut r.inner, r.limits.clone())
56408                    .map(|r| r.map(|t| Self::TimeBounds(Box::new(t.0)))),
56409            ),
56410            TypeVariant::LedgerBounds => Box::new(
56411                ReadXdrIter::<_, Frame<LedgerBounds>>::new(&mut r.inner, r.limits.clone())
56412                    .map(|r| r.map(|t| Self::LedgerBounds(Box::new(t.0)))),
56413            ),
56414            TypeVariant::PreconditionsV2 => Box::new(
56415                ReadXdrIter::<_, Frame<PreconditionsV2>>::new(&mut r.inner, r.limits.clone())
56416                    .map(|r| r.map(|t| Self::PreconditionsV2(Box::new(t.0)))),
56417            ),
56418            TypeVariant::PreconditionType => Box::new(
56419                ReadXdrIter::<_, Frame<PreconditionType>>::new(&mut r.inner, r.limits.clone())
56420                    .map(|r| r.map(|t| Self::PreconditionType(Box::new(t.0)))),
56421            ),
56422            TypeVariant::Preconditions => Box::new(
56423                ReadXdrIter::<_, Frame<Preconditions>>::new(&mut r.inner, r.limits.clone())
56424                    .map(|r| r.map(|t| Self::Preconditions(Box::new(t.0)))),
56425            ),
56426            TypeVariant::LedgerFootprint => Box::new(
56427                ReadXdrIter::<_, Frame<LedgerFootprint>>::new(&mut r.inner, r.limits.clone())
56428                    .map(|r| r.map(|t| Self::LedgerFootprint(Box::new(t.0)))),
56429            ),
56430            TypeVariant::ArchivalProofType => Box::new(
56431                ReadXdrIter::<_, Frame<ArchivalProofType>>::new(&mut r.inner, r.limits.clone())
56432                    .map(|r| r.map(|t| Self::ArchivalProofType(Box::new(t.0)))),
56433            ),
56434            TypeVariant::ArchivalProofNode => Box::new(
56435                ReadXdrIter::<_, Frame<ArchivalProofNode>>::new(&mut r.inner, r.limits.clone())
56436                    .map(|r| r.map(|t| Self::ArchivalProofNode(Box::new(t.0)))),
56437            ),
56438            TypeVariant::ProofLevel => Box::new(
56439                ReadXdrIter::<_, Frame<ProofLevel>>::new(&mut r.inner, r.limits.clone())
56440                    .map(|r| r.map(|t| Self::ProofLevel(Box::new(t.0)))),
56441            ),
56442            TypeVariant::NonexistenceProofBody => Box::new(
56443                ReadXdrIter::<_, Frame<NonexistenceProofBody>>::new(&mut r.inner, r.limits.clone())
56444                    .map(|r| r.map(|t| Self::NonexistenceProofBody(Box::new(t.0)))),
56445            ),
56446            TypeVariant::ExistenceProofBody => Box::new(
56447                ReadXdrIter::<_, Frame<ExistenceProofBody>>::new(&mut r.inner, r.limits.clone())
56448                    .map(|r| r.map(|t| Self::ExistenceProofBody(Box::new(t.0)))),
56449            ),
56450            TypeVariant::ArchivalProof => Box::new(
56451                ReadXdrIter::<_, Frame<ArchivalProof>>::new(&mut r.inner, r.limits.clone())
56452                    .map(|r| r.map(|t| Self::ArchivalProof(Box::new(t.0)))),
56453            ),
56454            TypeVariant::ArchivalProofBody => Box::new(
56455                ReadXdrIter::<_, Frame<ArchivalProofBody>>::new(&mut r.inner, r.limits.clone())
56456                    .map(|r| r.map(|t| Self::ArchivalProofBody(Box::new(t.0)))),
56457            ),
56458            TypeVariant::SorobanResources => Box::new(
56459                ReadXdrIter::<_, Frame<SorobanResources>>::new(&mut r.inner, r.limits.clone())
56460                    .map(|r| r.map(|t| Self::SorobanResources(Box::new(t.0)))),
56461            ),
56462            TypeVariant::SorobanTransactionData => Box::new(
56463                ReadXdrIter::<_, Frame<SorobanTransactionData>>::new(
56464                    &mut r.inner,
56465                    r.limits.clone(),
56466                )
56467                .map(|r| r.map(|t| Self::SorobanTransactionData(Box::new(t.0)))),
56468            ),
56469            TypeVariant::TransactionV0 => Box::new(
56470                ReadXdrIter::<_, Frame<TransactionV0>>::new(&mut r.inner, r.limits.clone())
56471                    .map(|r| r.map(|t| Self::TransactionV0(Box::new(t.0)))),
56472            ),
56473            TypeVariant::TransactionV0Ext => Box::new(
56474                ReadXdrIter::<_, Frame<TransactionV0Ext>>::new(&mut r.inner, r.limits.clone())
56475                    .map(|r| r.map(|t| Self::TransactionV0Ext(Box::new(t.0)))),
56476            ),
56477            TypeVariant::TransactionV0Envelope => Box::new(
56478                ReadXdrIter::<_, Frame<TransactionV0Envelope>>::new(&mut r.inner, r.limits.clone())
56479                    .map(|r| r.map(|t| Self::TransactionV0Envelope(Box::new(t.0)))),
56480            ),
56481            TypeVariant::Transaction => Box::new(
56482                ReadXdrIter::<_, Frame<Transaction>>::new(&mut r.inner, r.limits.clone())
56483                    .map(|r| r.map(|t| Self::Transaction(Box::new(t.0)))),
56484            ),
56485            TypeVariant::TransactionExt => Box::new(
56486                ReadXdrIter::<_, Frame<TransactionExt>>::new(&mut r.inner, r.limits.clone())
56487                    .map(|r| r.map(|t| Self::TransactionExt(Box::new(t.0)))),
56488            ),
56489            TypeVariant::TransactionV1Envelope => Box::new(
56490                ReadXdrIter::<_, Frame<TransactionV1Envelope>>::new(&mut r.inner, r.limits.clone())
56491                    .map(|r| r.map(|t| Self::TransactionV1Envelope(Box::new(t.0)))),
56492            ),
56493            TypeVariant::FeeBumpTransaction => Box::new(
56494                ReadXdrIter::<_, Frame<FeeBumpTransaction>>::new(&mut r.inner, r.limits.clone())
56495                    .map(|r| r.map(|t| Self::FeeBumpTransaction(Box::new(t.0)))),
56496            ),
56497            TypeVariant::FeeBumpTransactionInnerTx => Box::new(
56498                ReadXdrIter::<_, Frame<FeeBumpTransactionInnerTx>>::new(
56499                    &mut r.inner,
56500                    r.limits.clone(),
56501                )
56502                .map(|r| r.map(|t| Self::FeeBumpTransactionInnerTx(Box::new(t.0)))),
56503            ),
56504            TypeVariant::FeeBumpTransactionExt => Box::new(
56505                ReadXdrIter::<_, Frame<FeeBumpTransactionExt>>::new(&mut r.inner, r.limits.clone())
56506                    .map(|r| r.map(|t| Self::FeeBumpTransactionExt(Box::new(t.0)))),
56507            ),
56508            TypeVariant::FeeBumpTransactionEnvelope => Box::new(
56509                ReadXdrIter::<_, Frame<FeeBumpTransactionEnvelope>>::new(
56510                    &mut r.inner,
56511                    r.limits.clone(),
56512                )
56513                .map(|r| r.map(|t| Self::FeeBumpTransactionEnvelope(Box::new(t.0)))),
56514            ),
56515            TypeVariant::TransactionEnvelope => Box::new(
56516                ReadXdrIter::<_, Frame<TransactionEnvelope>>::new(&mut r.inner, r.limits.clone())
56517                    .map(|r| r.map(|t| Self::TransactionEnvelope(Box::new(t.0)))),
56518            ),
56519            TypeVariant::TransactionSignaturePayload => Box::new(
56520                ReadXdrIter::<_, Frame<TransactionSignaturePayload>>::new(
56521                    &mut r.inner,
56522                    r.limits.clone(),
56523                )
56524                .map(|r| r.map(|t| Self::TransactionSignaturePayload(Box::new(t.0)))),
56525            ),
56526            TypeVariant::TransactionSignaturePayloadTaggedTransaction => Box::new(
56527                ReadXdrIter::<_, Frame<TransactionSignaturePayloadTaggedTransaction>>::new(
56528                    &mut r.inner,
56529                    r.limits.clone(),
56530                )
56531                .map(|r| {
56532                    r.map(|t| Self::TransactionSignaturePayloadTaggedTransaction(Box::new(t.0)))
56533                }),
56534            ),
56535            TypeVariant::ClaimAtomType => Box::new(
56536                ReadXdrIter::<_, Frame<ClaimAtomType>>::new(&mut r.inner, r.limits.clone())
56537                    .map(|r| r.map(|t| Self::ClaimAtomType(Box::new(t.0)))),
56538            ),
56539            TypeVariant::ClaimOfferAtomV0 => Box::new(
56540                ReadXdrIter::<_, Frame<ClaimOfferAtomV0>>::new(&mut r.inner, r.limits.clone())
56541                    .map(|r| r.map(|t| Self::ClaimOfferAtomV0(Box::new(t.0)))),
56542            ),
56543            TypeVariant::ClaimOfferAtom => Box::new(
56544                ReadXdrIter::<_, Frame<ClaimOfferAtom>>::new(&mut r.inner, r.limits.clone())
56545                    .map(|r| r.map(|t| Self::ClaimOfferAtom(Box::new(t.0)))),
56546            ),
56547            TypeVariant::ClaimLiquidityAtom => Box::new(
56548                ReadXdrIter::<_, Frame<ClaimLiquidityAtom>>::new(&mut r.inner, r.limits.clone())
56549                    .map(|r| r.map(|t| Self::ClaimLiquidityAtom(Box::new(t.0)))),
56550            ),
56551            TypeVariant::ClaimAtom => Box::new(
56552                ReadXdrIter::<_, Frame<ClaimAtom>>::new(&mut r.inner, r.limits.clone())
56553                    .map(|r| r.map(|t| Self::ClaimAtom(Box::new(t.0)))),
56554            ),
56555            TypeVariant::CreateAccountResultCode => Box::new(
56556                ReadXdrIter::<_, Frame<CreateAccountResultCode>>::new(
56557                    &mut r.inner,
56558                    r.limits.clone(),
56559                )
56560                .map(|r| r.map(|t| Self::CreateAccountResultCode(Box::new(t.0)))),
56561            ),
56562            TypeVariant::CreateAccountResult => Box::new(
56563                ReadXdrIter::<_, Frame<CreateAccountResult>>::new(&mut r.inner, r.limits.clone())
56564                    .map(|r| r.map(|t| Self::CreateAccountResult(Box::new(t.0)))),
56565            ),
56566            TypeVariant::PaymentResultCode => Box::new(
56567                ReadXdrIter::<_, Frame<PaymentResultCode>>::new(&mut r.inner, r.limits.clone())
56568                    .map(|r| r.map(|t| Self::PaymentResultCode(Box::new(t.0)))),
56569            ),
56570            TypeVariant::PaymentResult => Box::new(
56571                ReadXdrIter::<_, Frame<PaymentResult>>::new(&mut r.inner, r.limits.clone())
56572                    .map(|r| r.map(|t| Self::PaymentResult(Box::new(t.0)))),
56573            ),
56574            TypeVariant::PathPaymentStrictReceiveResultCode => Box::new(
56575                ReadXdrIter::<_, Frame<PathPaymentStrictReceiveResultCode>>::new(
56576                    &mut r.inner,
56577                    r.limits.clone(),
56578                )
56579                .map(|r| r.map(|t| Self::PathPaymentStrictReceiveResultCode(Box::new(t.0)))),
56580            ),
56581            TypeVariant::SimplePaymentResult => Box::new(
56582                ReadXdrIter::<_, Frame<SimplePaymentResult>>::new(&mut r.inner, r.limits.clone())
56583                    .map(|r| r.map(|t| Self::SimplePaymentResult(Box::new(t.0)))),
56584            ),
56585            TypeVariant::PathPaymentStrictReceiveResult => Box::new(
56586                ReadXdrIter::<_, Frame<PathPaymentStrictReceiveResult>>::new(
56587                    &mut r.inner,
56588                    r.limits.clone(),
56589                )
56590                .map(|r| r.map(|t| Self::PathPaymentStrictReceiveResult(Box::new(t.0)))),
56591            ),
56592            TypeVariant::PathPaymentStrictReceiveResultSuccess => Box::new(
56593                ReadXdrIter::<_, Frame<PathPaymentStrictReceiveResultSuccess>>::new(
56594                    &mut r.inner,
56595                    r.limits.clone(),
56596                )
56597                .map(|r| r.map(|t| Self::PathPaymentStrictReceiveResultSuccess(Box::new(t.0)))),
56598            ),
56599            TypeVariant::PathPaymentStrictSendResultCode => Box::new(
56600                ReadXdrIter::<_, Frame<PathPaymentStrictSendResultCode>>::new(
56601                    &mut r.inner,
56602                    r.limits.clone(),
56603                )
56604                .map(|r| r.map(|t| Self::PathPaymentStrictSendResultCode(Box::new(t.0)))),
56605            ),
56606            TypeVariant::PathPaymentStrictSendResult => Box::new(
56607                ReadXdrIter::<_, Frame<PathPaymentStrictSendResult>>::new(
56608                    &mut r.inner,
56609                    r.limits.clone(),
56610                )
56611                .map(|r| r.map(|t| Self::PathPaymentStrictSendResult(Box::new(t.0)))),
56612            ),
56613            TypeVariant::PathPaymentStrictSendResultSuccess => Box::new(
56614                ReadXdrIter::<_, Frame<PathPaymentStrictSendResultSuccess>>::new(
56615                    &mut r.inner,
56616                    r.limits.clone(),
56617                )
56618                .map(|r| r.map(|t| Self::PathPaymentStrictSendResultSuccess(Box::new(t.0)))),
56619            ),
56620            TypeVariant::ManageSellOfferResultCode => Box::new(
56621                ReadXdrIter::<_, Frame<ManageSellOfferResultCode>>::new(
56622                    &mut r.inner,
56623                    r.limits.clone(),
56624                )
56625                .map(|r| r.map(|t| Self::ManageSellOfferResultCode(Box::new(t.0)))),
56626            ),
56627            TypeVariant::ManageOfferEffect => Box::new(
56628                ReadXdrIter::<_, Frame<ManageOfferEffect>>::new(&mut r.inner, r.limits.clone())
56629                    .map(|r| r.map(|t| Self::ManageOfferEffect(Box::new(t.0)))),
56630            ),
56631            TypeVariant::ManageOfferSuccessResult => Box::new(
56632                ReadXdrIter::<_, Frame<ManageOfferSuccessResult>>::new(
56633                    &mut r.inner,
56634                    r.limits.clone(),
56635                )
56636                .map(|r| r.map(|t| Self::ManageOfferSuccessResult(Box::new(t.0)))),
56637            ),
56638            TypeVariant::ManageOfferSuccessResultOffer => Box::new(
56639                ReadXdrIter::<_, Frame<ManageOfferSuccessResultOffer>>::new(
56640                    &mut r.inner,
56641                    r.limits.clone(),
56642                )
56643                .map(|r| r.map(|t| Self::ManageOfferSuccessResultOffer(Box::new(t.0)))),
56644            ),
56645            TypeVariant::ManageSellOfferResult => Box::new(
56646                ReadXdrIter::<_, Frame<ManageSellOfferResult>>::new(&mut r.inner, r.limits.clone())
56647                    .map(|r| r.map(|t| Self::ManageSellOfferResult(Box::new(t.0)))),
56648            ),
56649            TypeVariant::ManageBuyOfferResultCode => Box::new(
56650                ReadXdrIter::<_, Frame<ManageBuyOfferResultCode>>::new(
56651                    &mut r.inner,
56652                    r.limits.clone(),
56653                )
56654                .map(|r| r.map(|t| Self::ManageBuyOfferResultCode(Box::new(t.0)))),
56655            ),
56656            TypeVariant::ManageBuyOfferResult => Box::new(
56657                ReadXdrIter::<_, Frame<ManageBuyOfferResult>>::new(&mut r.inner, r.limits.clone())
56658                    .map(|r| r.map(|t| Self::ManageBuyOfferResult(Box::new(t.0)))),
56659            ),
56660            TypeVariant::SetOptionsResultCode => Box::new(
56661                ReadXdrIter::<_, Frame<SetOptionsResultCode>>::new(&mut r.inner, r.limits.clone())
56662                    .map(|r| r.map(|t| Self::SetOptionsResultCode(Box::new(t.0)))),
56663            ),
56664            TypeVariant::SetOptionsResult => Box::new(
56665                ReadXdrIter::<_, Frame<SetOptionsResult>>::new(&mut r.inner, r.limits.clone())
56666                    .map(|r| r.map(|t| Self::SetOptionsResult(Box::new(t.0)))),
56667            ),
56668            TypeVariant::ChangeTrustResultCode => Box::new(
56669                ReadXdrIter::<_, Frame<ChangeTrustResultCode>>::new(&mut r.inner, r.limits.clone())
56670                    .map(|r| r.map(|t| Self::ChangeTrustResultCode(Box::new(t.0)))),
56671            ),
56672            TypeVariant::ChangeTrustResult => Box::new(
56673                ReadXdrIter::<_, Frame<ChangeTrustResult>>::new(&mut r.inner, r.limits.clone())
56674                    .map(|r| r.map(|t| Self::ChangeTrustResult(Box::new(t.0)))),
56675            ),
56676            TypeVariant::AllowTrustResultCode => Box::new(
56677                ReadXdrIter::<_, Frame<AllowTrustResultCode>>::new(&mut r.inner, r.limits.clone())
56678                    .map(|r| r.map(|t| Self::AllowTrustResultCode(Box::new(t.0)))),
56679            ),
56680            TypeVariant::AllowTrustResult => Box::new(
56681                ReadXdrIter::<_, Frame<AllowTrustResult>>::new(&mut r.inner, r.limits.clone())
56682                    .map(|r| r.map(|t| Self::AllowTrustResult(Box::new(t.0)))),
56683            ),
56684            TypeVariant::AccountMergeResultCode => Box::new(
56685                ReadXdrIter::<_, Frame<AccountMergeResultCode>>::new(
56686                    &mut r.inner,
56687                    r.limits.clone(),
56688                )
56689                .map(|r| r.map(|t| Self::AccountMergeResultCode(Box::new(t.0)))),
56690            ),
56691            TypeVariant::AccountMergeResult => Box::new(
56692                ReadXdrIter::<_, Frame<AccountMergeResult>>::new(&mut r.inner, r.limits.clone())
56693                    .map(|r| r.map(|t| Self::AccountMergeResult(Box::new(t.0)))),
56694            ),
56695            TypeVariant::InflationResultCode => Box::new(
56696                ReadXdrIter::<_, Frame<InflationResultCode>>::new(&mut r.inner, r.limits.clone())
56697                    .map(|r| r.map(|t| Self::InflationResultCode(Box::new(t.0)))),
56698            ),
56699            TypeVariant::InflationPayout => Box::new(
56700                ReadXdrIter::<_, Frame<InflationPayout>>::new(&mut r.inner, r.limits.clone())
56701                    .map(|r| r.map(|t| Self::InflationPayout(Box::new(t.0)))),
56702            ),
56703            TypeVariant::InflationResult => Box::new(
56704                ReadXdrIter::<_, Frame<InflationResult>>::new(&mut r.inner, r.limits.clone())
56705                    .map(|r| r.map(|t| Self::InflationResult(Box::new(t.0)))),
56706            ),
56707            TypeVariant::ManageDataResultCode => Box::new(
56708                ReadXdrIter::<_, Frame<ManageDataResultCode>>::new(&mut r.inner, r.limits.clone())
56709                    .map(|r| r.map(|t| Self::ManageDataResultCode(Box::new(t.0)))),
56710            ),
56711            TypeVariant::ManageDataResult => Box::new(
56712                ReadXdrIter::<_, Frame<ManageDataResult>>::new(&mut r.inner, r.limits.clone())
56713                    .map(|r| r.map(|t| Self::ManageDataResult(Box::new(t.0)))),
56714            ),
56715            TypeVariant::BumpSequenceResultCode => Box::new(
56716                ReadXdrIter::<_, Frame<BumpSequenceResultCode>>::new(
56717                    &mut r.inner,
56718                    r.limits.clone(),
56719                )
56720                .map(|r| r.map(|t| Self::BumpSequenceResultCode(Box::new(t.0)))),
56721            ),
56722            TypeVariant::BumpSequenceResult => Box::new(
56723                ReadXdrIter::<_, Frame<BumpSequenceResult>>::new(&mut r.inner, r.limits.clone())
56724                    .map(|r| r.map(|t| Self::BumpSequenceResult(Box::new(t.0)))),
56725            ),
56726            TypeVariant::CreateClaimableBalanceResultCode => Box::new(
56727                ReadXdrIter::<_, Frame<CreateClaimableBalanceResultCode>>::new(
56728                    &mut r.inner,
56729                    r.limits.clone(),
56730                )
56731                .map(|r| r.map(|t| Self::CreateClaimableBalanceResultCode(Box::new(t.0)))),
56732            ),
56733            TypeVariant::CreateClaimableBalanceResult => Box::new(
56734                ReadXdrIter::<_, Frame<CreateClaimableBalanceResult>>::new(
56735                    &mut r.inner,
56736                    r.limits.clone(),
56737                )
56738                .map(|r| r.map(|t| Self::CreateClaimableBalanceResult(Box::new(t.0)))),
56739            ),
56740            TypeVariant::ClaimClaimableBalanceResultCode => Box::new(
56741                ReadXdrIter::<_, Frame<ClaimClaimableBalanceResultCode>>::new(
56742                    &mut r.inner,
56743                    r.limits.clone(),
56744                )
56745                .map(|r| r.map(|t| Self::ClaimClaimableBalanceResultCode(Box::new(t.0)))),
56746            ),
56747            TypeVariant::ClaimClaimableBalanceResult => Box::new(
56748                ReadXdrIter::<_, Frame<ClaimClaimableBalanceResult>>::new(
56749                    &mut r.inner,
56750                    r.limits.clone(),
56751                )
56752                .map(|r| r.map(|t| Self::ClaimClaimableBalanceResult(Box::new(t.0)))),
56753            ),
56754            TypeVariant::BeginSponsoringFutureReservesResultCode => Box::new(
56755                ReadXdrIter::<_, Frame<BeginSponsoringFutureReservesResultCode>>::new(
56756                    &mut r.inner,
56757                    r.limits.clone(),
56758                )
56759                .map(|r| r.map(|t| Self::BeginSponsoringFutureReservesResultCode(Box::new(t.0)))),
56760            ),
56761            TypeVariant::BeginSponsoringFutureReservesResult => Box::new(
56762                ReadXdrIter::<_, Frame<BeginSponsoringFutureReservesResult>>::new(
56763                    &mut r.inner,
56764                    r.limits.clone(),
56765                )
56766                .map(|r| r.map(|t| Self::BeginSponsoringFutureReservesResult(Box::new(t.0)))),
56767            ),
56768            TypeVariant::EndSponsoringFutureReservesResultCode => Box::new(
56769                ReadXdrIter::<_, Frame<EndSponsoringFutureReservesResultCode>>::new(
56770                    &mut r.inner,
56771                    r.limits.clone(),
56772                )
56773                .map(|r| r.map(|t| Self::EndSponsoringFutureReservesResultCode(Box::new(t.0)))),
56774            ),
56775            TypeVariant::EndSponsoringFutureReservesResult => Box::new(
56776                ReadXdrIter::<_, Frame<EndSponsoringFutureReservesResult>>::new(
56777                    &mut r.inner,
56778                    r.limits.clone(),
56779                )
56780                .map(|r| r.map(|t| Self::EndSponsoringFutureReservesResult(Box::new(t.0)))),
56781            ),
56782            TypeVariant::RevokeSponsorshipResultCode => Box::new(
56783                ReadXdrIter::<_, Frame<RevokeSponsorshipResultCode>>::new(
56784                    &mut r.inner,
56785                    r.limits.clone(),
56786                )
56787                .map(|r| r.map(|t| Self::RevokeSponsorshipResultCode(Box::new(t.0)))),
56788            ),
56789            TypeVariant::RevokeSponsorshipResult => Box::new(
56790                ReadXdrIter::<_, Frame<RevokeSponsorshipResult>>::new(
56791                    &mut r.inner,
56792                    r.limits.clone(),
56793                )
56794                .map(|r| r.map(|t| Self::RevokeSponsorshipResult(Box::new(t.0)))),
56795            ),
56796            TypeVariant::ClawbackResultCode => Box::new(
56797                ReadXdrIter::<_, Frame<ClawbackResultCode>>::new(&mut r.inner, r.limits.clone())
56798                    .map(|r| r.map(|t| Self::ClawbackResultCode(Box::new(t.0)))),
56799            ),
56800            TypeVariant::ClawbackResult => Box::new(
56801                ReadXdrIter::<_, Frame<ClawbackResult>>::new(&mut r.inner, r.limits.clone())
56802                    .map(|r| r.map(|t| Self::ClawbackResult(Box::new(t.0)))),
56803            ),
56804            TypeVariant::ClawbackClaimableBalanceResultCode => Box::new(
56805                ReadXdrIter::<_, Frame<ClawbackClaimableBalanceResultCode>>::new(
56806                    &mut r.inner,
56807                    r.limits.clone(),
56808                )
56809                .map(|r| r.map(|t| Self::ClawbackClaimableBalanceResultCode(Box::new(t.0)))),
56810            ),
56811            TypeVariant::ClawbackClaimableBalanceResult => Box::new(
56812                ReadXdrIter::<_, Frame<ClawbackClaimableBalanceResult>>::new(
56813                    &mut r.inner,
56814                    r.limits.clone(),
56815                )
56816                .map(|r| r.map(|t| Self::ClawbackClaimableBalanceResult(Box::new(t.0)))),
56817            ),
56818            TypeVariant::SetTrustLineFlagsResultCode => Box::new(
56819                ReadXdrIter::<_, Frame<SetTrustLineFlagsResultCode>>::new(
56820                    &mut r.inner,
56821                    r.limits.clone(),
56822                )
56823                .map(|r| r.map(|t| Self::SetTrustLineFlagsResultCode(Box::new(t.0)))),
56824            ),
56825            TypeVariant::SetTrustLineFlagsResult => Box::new(
56826                ReadXdrIter::<_, Frame<SetTrustLineFlagsResult>>::new(
56827                    &mut r.inner,
56828                    r.limits.clone(),
56829                )
56830                .map(|r| r.map(|t| Self::SetTrustLineFlagsResult(Box::new(t.0)))),
56831            ),
56832            TypeVariant::LiquidityPoolDepositResultCode => Box::new(
56833                ReadXdrIter::<_, Frame<LiquidityPoolDepositResultCode>>::new(
56834                    &mut r.inner,
56835                    r.limits.clone(),
56836                )
56837                .map(|r| r.map(|t| Self::LiquidityPoolDepositResultCode(Box::new(t.0)))),
56838            ),
56839            TypeVariant::LiquidityPoolDepositResult => Box::new(
56840                ReadXdrIter::<_, Frame<LiquidityPoolDepositResult>>::new(
56841                    &mut r.inner,
56842                    r.limits.clone(),
56843                )
56844                .map(|r| r.map(|t| Self::LiquidityPoolDepositResult(Box::new(t.0)))),
56845            ),
56846            TypeVariant::LiquidityPoolWithdrawResultCode => Box::new(
56847                ReadXdrIter::<_, Frame<LiquidityPoolWithdrawResultCode>>::new(
56848                    &mut r.inner,
56849                    r.limits.clone(),
56850                )
56851                .map(|r| r.map(|t| Self::LiquidityPoolWithdrawResultCode(Box::new(t.0)))),
56852            ),
56853            TypeVariant::LiquidityPoolWithdrawResult => Box::new(
56854                ReadXdrIter::<_, Frame<LiquidityPoolWithdrawResult>>::new(
56855                    &mut r.inner,
56856                    r.limits.clone(),
56857                )
56858                .map(|r| r.map(|t| Self::LiquidityPoolWithdrawResult(Box::new(t.0)))),
56859            ),
56860            TypeVariant::InvokeHostFunctionResultCode => Box::new(
56861                ReadXdrIter::<_, Frame<InvokeHostFunctionResultCode>>::new(
56862                    &mut r.inner,
56863                    r.limits.clone(),
56864                )
56865                .map(|r| r.map(|t| Self::InvokeHostFunctionResultCode(Box::new(t.0)))),
56866            ),
56867            TypeVariant::InvokeHostFunctionResult => Box::new(
56868                ReadXdrIter::<_, Frame<InvokeHostFunctionResult>>::new(
56869                    &mut r.inner,
56870                    r.limits.clone(),
56871                )
56872                .map(|r| r.map(|t| Self::InvokeHostFunctionResult(Box::new(t.0)))),
56873            ),
56874            TypeVariant::ExtendFootprintTtlResultCode => Box::new(
56875                ReadXdrIter::<_, Frame<ExtendFootprintTtlResultCode>>::new(
56876                    &mut r.inner,
56877                    r.limits.clone(),
56878                )
56879                .map(|r| r.map(|t| Self::ExtendFootprintTtlResultCode(Box::new(t.0)))),
56880            ),
56881            TypeVariant::ExtendFootprintTtlResult => Box::new(
56882                ReadXdrIter::<_, Frame<ExtendFootprintTtlResult>>::new(
56883                    &mut r.inner,
56884                    r.limits.clone(),
56885                )
56886                .map(|r| r.map(|t| Self::ExtendFootprintTtlResult(Box::new(t.0)))),
56887            ),
56888            TypeVariant::RestoreFootprintResultCode => Box::new(
56889                ReadXdrIter::<_, Frame<RestoreFootprintResultCode>>::new(
56890                    &mut r.inner,
56891                    r.limits.clone(),
56892                )
56893                .map(|r| r.map(|t| Self::RestoreFootprintResultCode(Box::new(t.0)))),
56894            ),
56895            TypeVariant::RestoreFootprintResult => Box::new(
56896                ReadXdrIter::<_, Frame<RestoreFootprintResult>>::new(
56897                    &mut r.inner,
56898                    r.limits.clone(),
56899                )
56900                .map(|r| r.map(|t| Self::RestoreFootprintResult(Box::new(t.0)))),
56901            ),
56902            TypeVariant::OperationResultCode => Box::new(
56903                ReadXdrIter::<_, Frame<OperationResultCode>>::new(&mut r.inner, r.limits.clone())
56904                    .map(|r| r.map(|t| Self::OperationResultCode(Box::new(t.0)))),
56905            ),
56906            TypeVariant::OperationResult => Box::new(
56907                ReadXdrIter::<_, Frame<OperationResult>>::new(&mut r.inner, r.limits.clone())
56908                    .map(|r| r.map(|t| Self::OperationResult(Box::new(t.0)))),
56909            ),
56910            TypeVariant::OperationResultTr => Box::new(
56911                ReadXdrIter::<_, Frame<OperationResultTr>>::new(&mut r.inner, r.limits.clone())
56912                    .map(|r| r.map(|t| Self::OperationResultTr(Box::new(t.0)))),
56913            ),
56914            TypeVariant::TransactionResultCode => Box::new(
56915                ReadXdrIter::<_, Frame<TransactionResultCode>>::new(&mut r.inner, r.limits.clone())
56916                    .map(|r| r.map(|t| Self::TransactionResultCode(Box::new(t.0)))),
56917            ),
56918            TypeVariant::InnerTransactionResult => Box::new(
56919                ReadXdrIter::<_, Frame<InnerTransactionResult>>::new(
56920                    &mut r.inner,
56921                    r.limits.clone(),
56922                )
56923                .map(|r| r.map(|t| Self::InnerTransactionResult(Box::new(t.0)))),
56924            ),
56925            TypeVariant::InnerTransactionResultResult => Box::new(
56926                ReadXdrIter::<_, Frame<InnerTransactionResultResult>>::new(
56927                    &mut r.inner,
56928                    r.limits.clone(),
56929                )
56930                .map(|r| r.map(|t| Self::InnerTransactionResultResult(Box::new(t.0)))),
56931            ),
56932            TypeVariant::InnerTransactionResultExt => Box::new(
56933                ReadXdrIter::<_, Frame<InnerTransactionResultExt>>::new(
56934                    &mut r.inner,
56935                    r.limits.clone(),
56936                )
56937                .map(|r| r.map(|t| Self::InnerTransactionResultExt(Box::new(t.0)))),
56938            ),
56939            TypeVariant::InnerTransactionResultPair => Box::new(
56940                ReadXdrIter::<_, Frame<InnerTransactionResultPair>>::new(
56941                    &mut r.inner,
56942                    r.limits.clone(),
56943                )
56944                .map(|r| r.map(|t| Self::InnerTransactionResultPair(Box::new(t.0)))),
56945            ),
56946            TypeVariant::TransactionResult => Box::new(
56947                ReadXdrIter::<_, Frame<TransactionResult>>::new(&mut r.inner, r.limits.clone())
56948                    .map(|r| r.map(|t| Self::TransactionResult(Box::new(t.0)))),
56949            ),
56950            TypeVariant::TransactionResultResult => Box::new(
56951                ReadXdrIter::<_, Frame<TransactionResultResult>>::new(
56952                    &mut r.inner,
56953                    r.limits.clone(),
56954                )
56955                .map(|r| r.map(|t| Self::TransactionResultResult(Box::new(t.0)))),
56956            ),
56957            TypeVariant::TransactionResultExt => Box::new(
56958                ReadXdrIter::<_, Frame<TransactionResultExt>>::new(&mut r.inner, r.limits.clone())
56959                    .map(|r| r.map(|t| Self::TransactionResultExt(Box::new(t.0)))),
56960            ),
56961            TypeVariant::Hash => Box::new(
56962                ReadXdrIter::<_, Frame<Hash>>::new(&mut r.inner, r.limits.clone())
56963                    .map(|r| r.map(|t| Self::Hash(Box::new(t.0)))),
56964            ),
56965            TypeVariant::Uint256 => Box::new(
56966                ReadXdrIter::<_, Frame<Uint256>>::new(&mut r.inner, r.limits.clone())
56967                    .map(|r| r.map(|t| Self::Uint256(Box::new(t.0)))),
56968            ),
56969            TypeVariant::Uint32 => Box::new(
56970                ReadXdrIter::<_, Frame<Uint32>>::new(&mut r.inner, r.limits.clone())
56971                    .map(|r| r.map(|t| Self::Uint32(Box::new(t.0)))),
56972            ),
56973            TypeVariant::Int32 => Box::new(
56974                ReadXdrIter::<_, Frame<Int32>>::new(&mut r.inner, r.limits.clone())
56975                    .map(|r| r.map(|t| Self::Int32(Box::new(t.0)))),
56976            ),
56977            TypeVariant::Uint64 => Box::new(
56978                ReadXdrIter::<_, Frame<Uint64>>::new(&mut r.inner, r.limits.clone())
56979                    .map(|r| r.map(|t| Self::Uint64(Box::new(t.0)))),
56980            ),
56981            TypeVariant::Int64 => Box::new(
56982                ReadXdrIter::<_, Frame<Int64>>::new(&mut r.inner, r.limits.clone())
56983                    .map(|r| r.map(|t| Self::Int64(Box::new(t.0)))),
56984            ),
56985            TypeVariant::TimePoint => Box::new(
56986                ReadXdrIter::<_, Frame<TimePoint>>::new(&mut r.inner, r.limits.clone())
56987                    .map(|r| r.map(|t| Self::TimePoint(Box::new(t.0)))),
56988            ),
56989            TypeVariant::Duration => Box::new(
56990                ReadXdrIter::<_, Frame<Duration>>::new(&mut r.inner, r.limits.clone())
56991                    .map(|r| r.map(|t| Self::Duration(Box::new(t.0)))),
56992            ),
56993            TypeVariant::ExtensionPoint => Box::new(
56994                ReadXdrIter::<_, Frame<ExtensionPoint>>::new(&mut r.inner, r.limits.clone())
56995                    .map(|r| r.map(|t| Self::ExtensionPoint(Box::new(t.0)))),
56996            ),
56997            TypeVariant::CryptoKeyType => Box::new(
56998                ReadXdrIter::<_, Frame<CryptoKeyType>>::new(&mut r.inner, r.limits.clone())
56999                    .map(|r| r.map(|t| Self::CryptoKeyType(Box::new(t.0)))),
57000            ),
57001            TypeVariant::PublicKeyType => Box::new(
57002                ReadXdrIter::<_, Frame<PublicKeyType>>::new(&mut r.inner, r.limits.clone())
57003                    .map(|r| r.map(|t| Self::PublicKeyType(Box::new(t.0)))),
57004            ),
57005            TypeVariant::SignerKeyType => Box::new(
57006                ReadXdrIter::<_, Frame<SignerKeyType>>::new(&mut r.inner, r.limits.clone())
57007                    .map(|r| r.map(|t| Self::SignerKeyType(Box::new(t.0)))),
57008            ),
57009            TypeVariant::PublicKey => Box::new(
57010                ReadXdrIter::<_, Frame<PublicKey>>::new(&mut r.inner, r.limits.clone())
57011                    .map(|r| r.map(|t| Self::PublicKey(Box::new(t.0)))),
57012            ),
57013            TypeVariant::SignerKey => Box::new(
57014                ReadXdrIter::<_, Frame<SignerKey>>::new(&mut r.inner, r.limits.clone())
57015                    .map(|r| r.map(|t| Self::SignerKey(Box::new(t.0)))),
57016            ),
57017            TypeVariant::SignerKeyEd25519SignedPayload => Box::new(
57018                ReadXdrIter::<_, Frame<SignerKeyEd25519SignedPayload>>::new(
57019                    &mut r.inner,
57020                    r.limits.clone(),
57021                )
57022                .map(|r| r.map(|t| Self::SignerKeyEd25519SignedPayload(Box::new(t.0)))),
57023            ),
57024            TypeVariant::Signature => Box::new(
57025                ReadXdrIter::<_, Frame<Signature>>::new(&mut r.inner, r.limits.clone())
57026                    .map(|r| r.map(|t| Self::Signature(Box::new(t.0)))),
57027            ),
57028            TypeVariant::SignatureHint => Box::new(
57029                ReadXdrIter::<_, Frame<SignatureHint>>::new(&mut r.inner, r.limits.clone())
57030                    .map(|r| r.map(|t| Self::SignatureHint(Box::new(t.0)))),
57031            ),
57032            TypeVariant::NodeId => Box::new(
57033                ReadXdrIter::<_, Frame<NodeId>>::new(&mut r.inner, r.limits.clone())
57034                    .map(|r| r.map(|t| Self::NodeId(Box::new(t.0)))),
57035            ),
57036            TypeVariant::AccountId => Box::new(
57037                ReadXdrIter::<_, Frame<AccountId>>::new(&mut r.inner, r.limits.clone())
57038                    .map(|r| r.map(|t| Self::AccountId(Box::new(t.0)))),
57039            ),
57040            TypeVariant::Curve25519Secret => Box::new(
57041                ReadXdrIter::<_, Frame<Curve25519Secret>>::new(&mut r.inner, r.limits.clone())
57042                    .map(|r| r.map(|t| Self::Curve25519Secret(Box::new(t.0)))),
57043            ),
57044            TypeVariant::Curve25519Public => Box::new(
57045                ReadXdrIter::<_, Frame<Curve25519Public>>::new(&mut r.inner, r.limits.clone())
57046                    .map(|r| r.map(|t| Self::Curve25519Public(Box::new(t.0)))),
57047            ),
57048            TypeVariant::HmacSha256Key => Box::new(
57049                ReadXdrIter::<_, Frame<HmacSha256Key>>::new(&mut r.inner, r.limits.clone())
57050                    .map(|r| r.map(|t| Self::HmacSha256Key(Box::new(t.0)))),
57051            ),
57052            TypeVariant::HmacSha256Mac => Box::new(
57053                ReadXdrIter::<_, Frame<HmacSha256Mac>>::new(&mut r.inner, r.limits.clone())
57054                    .map(|r| r.map(|t| Self::HmacSha256Mac(Box::new(t.0)))),
57055            ),
57056            TypeVariant::ShortHashSeed => Box::new(
57057                ReadXdrIter::<_, Frame<ShortHashSeed>>::new(&mut r.inner, r.limits.clone())
57058                    .map(|r| r.map(|t| Self::ShortHashSeed(Box::new(t.0)))),
57059            ),
57060            TypeVariant::BinaryFuseFilterType => Box::new(
57061                ReadXdrIter::<_, Frame<BinaryFuseFilterType>>::new(&mut r.inner, r.limits.clone())
57062                    .map(|r| r.map(|t| Self::BinaryFuseFilterType(Box::new(t.0)))),
57063            ),
57064            TypeVariant::SerializedBinaryFuseFilter => Box::new(
57065                ReadXdrIter::<_, Frame<SerializedBinaryFuseFilter>>::new(
57066                    &mut r.inner,
57067                    r.limits.clone(),
57068                )
57069                .map(|r| r.map(|t| Self::SerializedBinaryFuseFilter(Box::new(t.0)))),
57070            ),
57071        }
57072    }
57073
57074    #[cfg(feature = "base64")]
57075    #[allow(clippy::too_many_lines)]
57076    pub fn read_xdr_base64_iter<R: Read>(
57077        v: TypeVariant,
57078        r: &mut Limited<R>,
57079    ) -> Box<dyn Iterator<Item = Result<Self>> + '_> {
57080        let dec = base64::read::DecoderReader::new(&mut r.inner, base64::STANDARD);
57081        match v {
57082            TypeVariant::Value => Box::new(
57083                ReadXdrIter::<_, Value>::new(dec, r.limits.clone())
57084                    .map(|r| r.map(|t| Self::Value(Box::new(t)))),
57085            ),
57086            TypeVariant::ScpBallot => Box::new(
57087                ReadXdrIter::<_, ScpBallot>::new(dec, r.limits.clone())
57088                    .map(|r| r.map(|t| Self::ScpBallot(Box::new(t)))),
57089            ),
57090            TypeVariant::ScpStatementType => Box::new(
57091                ReadXdrIter::<_, ScpStatementType>::new(dec, r.limits.clone())
57092                    .map(|r| r.map(|t| Self::ScpStatementType(Box::new(t)))),
57093            ),
57094            TypeVariant::ScpNomination => Box::new(
57095                ReadXdrIter::<_, ScpNomination>::new(dec, r.limits.clone())
57096                    .map(|r| r.map(|t| Self::ScpNomination(Box::new(t)))),
57097            ),
57098            TypeVariant::ScpStatement => Box::new(
57099                ReadXdrIter::<_, ScpStatement>::new(dec, r.limits.clone())
57100                    .map(|r| r.map(|t| Self::ScpStatement(Box::new(t)))),
57101            ),
57102            TypeVariant::ScpStatementPledges => Box::new(
57103                ReadXdrIter::<_, ScpStatementPledges>::new(dec, r.limits.clone())
57104                    .map(|r| r.map(|t| Self::ScpStatementPledges(Box::new(t)))),
57105            ),
57106            TypeVariant::ScpStatementPrepare => Box::new(
57107                ReadXdrIter::<_, ScpStatementPrepare>::new(dec, r.limits.clone())
57108                    .map(|r| r.map(|t| Self::ScpStatementPrepare(Box::new(t)))),
57109            ),
57110            TypeVariant::ScpStatementConfirm => Box::new(
57111                ReadXdrIter::<_, ScpStatementConfirm>::new(dec, r.limits.clone())
57112                    .map(|r| r.map(|t| Self::ScpStatementConfirm(Box::new(t)))),
57113            ),
57114            TypeVariant::ScpStatementExternalize => Box::new(
57115                ReadXdrIter::<_, ScpStatementExternalize>::new(dec, r.limits.clone())
57116                    .map(|r| r.map(|t| Self::ScpStatementExternalize(Box::new(t)))),
57117            ),
57118            TypeVariant::ScpEnvelope => Box::new(
57119                ReadXdrIter::<_, ScpEnvelope>::new(dec, r.limits.clone())
57120                    .map(|r| r.map(|t| Self::ScpEnvelope(Box::new(t)))),
57121            ),
57122            TypeVariant::ScpQuorumSet => Box::new(
57123                ReadXdrIter::<_, ScpQuorumSet>::new(dec, r.limits.clone())
57124                    .map(|r| r.map(|t| Self::ScpQuorumSet(Box::new(t)))),
57125            ),
57126            TypeVariant::ConfigSettingContractExecutionLanesV0 => Box::new(
57127                ReadXdrIter::<_, ConfigSettingContractExecutionLanesV0>::new(dec, r.limits.clone())
57128                    .map(|r| r.map(|t| Self::ConfigSettingContractExecutionLanesV0(Box::new(t)))),
57129            ),
57130            TypeVariant::ConfigSettingContractComputeV0 => Box::new(
57131                ReadXdrIter::<_, ConfigSettingContractComputeV0>::new(dec, r.limits.clone())
57132                    .map(|r| r.map(|t| Self::ConfigSettingContractComputeV0(Box::new(t)))),
57133            ),
57134            TypeVariant::ConfigSettingContractLedgerCostV0 => Box::new(
57135                ReadXdrIter::<_, ConfigSettingContractLedgerCostV0>::new(dec, r.limits.clone())
57136                    .map(|r| r.map(|t| Self::ConfigSettingContractLedgerCostV0(Box::new(t)))),
57137            ),
57138            TypeVariant::ConfigSettingContractHistoricalDataV0 => Box::new(
57139                ReadXdrIter::<_, ConfigSettingContractHistoricalDataV0>::new(dec, r.limits.clone())
57140                    .map(|r| r.map(|t| Self::ConfigSettingContractHistoricalDataV0(Box::new(t)))),
57141            ),
57142            TypeVariant::ConfigSettingContractEventsV0 => Box::new(
57143                ReadXdrIter::<_, ConfigSettingContractEventsV0>::new(dec, r.limits.clone())
57144                    .map(|r| r.map(|t| Self::ConfigSettingContractEventsV0(Box::new(t)))),
57145            ),
57146            TypeVariant::ConfigSettingContractBandwidthV0 => Box::new(
57147                ReadXdrIter::<_, ConfigSettingContractBandwidthV0>::new(dec, r.limits.clone())
57148                    .map(|r| r.map(|t| Self::ConfigSettingContractBandwidthV0(Box::new(t)))),
57149            ),
57150            TypeVariant::ContractCostType => Box::new(
57151                ReadXdrIter::<_, ContractCostType>::new(dec, r.limits.clone())
57152                    .map(|r| r.map(|t| Self::ContractCostType(Box::new(t)))),
57153            ),
57154            TypeVariant::ContractCostParamEntry => Box::new(
57155                ReadXdrIter::<_, ContractCostParamEntry>::new(dec, r.limits.clone())
57156                    .map(|r| r.map(|t| Self::ContractCostParamEntry(Box::new(t)))),
57157            ),
57158            TypeVariant::StateArchivalSettings => Box::new(
57159                ReadXdrIter::<_, StateArchivalSettings>::new(dec, r.limits.clone())
57160                    .map(|r| r.map(|t| Self::StateArchivalSettings(Box::new(t)))),
57161            ),
57162            TypeVariant::EvictionIterator => Box::new(
57163                ReadXdrIter::<_, EvictionIterator>::new(dec, r.limits.clone())
57164                    .map(|r| r.map(|t| Self::EvictionIterator(Box::new(t)))),
57165            ),
57166            TypeVariant::ContractCostParams => Box::new(
57167                ReadXdrIter::<_, ContractCostParams>::new(dec, r.limits.clone())
57168                    .map(|r| r.map(|t| Self::ContractCostParams(Box::new(t)))),
57169            ),
57170            TypeVariant::ConfigSettingId => Box::new(
57171                ReadXdrIter::<_, ConfigSettingId>::new(dec, r.limits.clone())
57172                    .map(|r| r.map(|t| Self::ConfigSettingId(Box::new(t)))),
57173            ),
57174            TypeVariant::ConfigSettingEntry => Box::new(
57175                ReadXdrIter::<_, ConfigSettingEntry>::new(dec, r.limits.clone())
57176                    .map(|r| r.map(|t| Self::ConfigSettingEntry(Box::new(t)))),
57177            ),
57178            TypeVariant::ScEnvMetaKind => Box::new(
57179                ReadXdrIter::<_, ScEnvMetaKind>::new(dec, r.limits.clone())
57180                    .map(|r| r.map(|t| Self::ScEnvMetaKind(Box::new(t)))),
57181            ),
57182            TypeVariant::ScEnvMetaEntry => Box::new(
57183                ReadXdrIter::<_, ScEnvMetaEntry>::new(dec, r.limits.clone())
57184                    .map(|r| r.map(|t| Self::ScEnvMetaEntry(Box::new(t)))),
57185            ),
57186            TypeVariant::ScEnvMetaEntryInterfaceVersion => Box::new(
57187                ReadXdrIter::<_, ScEnvMetaEntryInterfaceVersion>::new(dec, r.limits.clone())
57188                    .map(|r| r.map(|t| Self::ScEnvMetaEntryInterfaceVersion(Box::new(t)))),
57189            ),
57190            TypeVariant::ScMetaV0 => Box::new(
57191                ReadXdrIter::<_, ScMetaV0>::new(dec, r.limits.clone())
57192                    .map(|r| r.map(|t| Self::ScMetaV0(Box::new(t)))),
57193            ),
57194            TypeVariant::ScMetaKind => Box::new(
57195                ReadXdrIter::<_, ScMetaKind>::new(dec, r.limits.clone())
57196                    .map(|r| r.map(|t| Self::ScMetaKind(Box::new(t)))),
57197            ),
57198            TypeVariant::ScMetaEntry => Box::new(
57199                ReadXdrIter::<_, ScMetaEntry>::new(dec, r.limits.clone())
57200                    .map(|r| r.map(|t| Self::ScMetaEntry(Box::new(t)))),
57201            ),
57202            TypeVariant::ScSpecType => Box::new(
57203                ReadXdrIter::<_, ScSpecType>::new(dec, r.limits.clone())
57204                    .map(|r| r.map(|t| Self::ScSpecType(Box::new(t)))),
57205            ),
57206            TypeVariant::ScSpecTypeOption => Box::new(
57207                ReadXdrIter::<_, ScSpecTypeOption>::new(dec, r.limits.clone())
57208                    .map(|r| r.map(|t| Self::ScSpecTypeOption(Box::new(t)))),
57209            ),
57210            TypeVariant::ScSpecTypeResult => Box::new(
57211                ReadXdrIter::<_, ScSpecTypeResult>::new(dec, r.limits.clone())
57212                    .map(|r| r.map(|t| Self::ScSpecTypeResult(Box::new(t)))),
57213            ),
57214            TypeVariant::ScSpecTypeVec => Box::new(
57215                ReadXdrIter::<_, ScSpecTypeVec>::new(dec, r.limits.clone())
57216                    .map(|r| r.map(|t| Self::ScSpecTypeVec(Box::new(t)))),
57217            ),
57218            TypeVariant::ScSpecTypeMap => Box::new(
57219                ReadXdrIter::<_, ScSpecTypeMap>::new(dec, r.limits.clone())
57220                    .map(|r| r.map(|t| Self::ScSpecTypeMap(Box::new(t)))),
57221            ),
57222            TypeVariant::ScSpecTypeTuple => Box::new(
57223                ReadXdrIter::<_, ScSpecTypeTuple>::new(dec, r.limits.clone())
57224                    .map(|r| r.map(|t| Self::ScSpecTypeTuple(Box::new(t)))),
57225            ),
57226            TypeVariant::ScSpecTypeBytesN => Box::new(
57227                ReadXdrIter::<_, ScSpecTypeBytesN>::new(dec, r.limits.clone())
57228                    .map(|r| r.map(|t| Self::ScSpecTypeBytesN(Box::new(t)))),
57229            ),
57230            TypeVariant::ScSpecTypeUdt => Box::new(
57231                ReadXdrIter::<_, ScSpecTypeUdt>::new(dec, r.limits.clone())
57232                    .map(|r| r.map(|t| Self::ScSpecTypeUdt(Box::new(t)))),
57233            ),
57234            TypeVariant::ScSpecTypeDef => Box::new(
57235                ReadXdrIter::<_, ScSpecTypeDef>::new(dec, r.limits.clone())
57236                    .map(|r| r.map(|t| Self::ScSpecTypeDef(Box::new(t)))),
57237            ),
57238            TypeVariant::ScSpecUdtStructFieldV0 => Box::new(
57239                ReadXdrIter::<_, ScSpecUdtStructFieldV0>::new(dec, r.limits.clone())
57240                    .map(|r| r.map(|t| Self::ScSpecUdtStructFieldV0(Box::new(t)))),
57241            ),
57242            TypeVariant::ScSpecUdtStructV0 => Box::new(
57243                ReadXdrIter::<_, ScSpecUdtStructV0>::new(dec, r.limits.clone())
57244                    .map(|r| r.map(|t| Self::ScSpecUdtStructV0(Box::new(t)))),
57245            ),
57246            TypeVariant::ScSpecUdtUnionCaseVoidV0 => Box::new(
57247                ReadXdrIter::<_, ScSpecUdtUnionCaseVoidV0>::new(dec, r.limits.clone())
57248                    .map(|r| r.map(|t| Self::ScSpecUdtUnionCaseVoidV0(Box::new(t)))),
57249            ),
57250            TypeVariant::ScSpecUdtUnionCaseTupleV0 => Box::new(
57251                ReadXdrIter::<_, ScSpecUdtUnionCaseTupleV0>::new(dec, r.limits.clone())
57252                    .map(|r| r.map(|t| Self::ScSpecUdtUnionCaseTupleV0(Box::new(t)))),
57253            ),
57254            TypeVariant::ScSpecUdtUnionCaseV0Kind => Box::new(
57255                ReadXdrIter::<_, ScSpecUdtUnionCaseV0Kind>::new(dec, r.limits.clone())
57256                    .map(|r| r.map(|t| Self::ScSpecUdtUnionCaseV0Kind(Box::new(t)))),
57257            ),
57258            TypeVariant::ScSpecUdtUnionCaseV0 => Box::new(
57259                ReadXdrIter::<_, ScSpecUdtUnionCaseV0>::new(dec, r.limits.clone())
57260                    .map(|r| r.map(|t| Self::ScSpecUdtUnionCaseV0(Box::new(t)))),
57261            ),
57262            TypeVariant::ScSpecUdtUnionV0 => Box::new(
57263                ReadXdrIter::<_, ScSpecUdtUnionV0>::new(dec, r.limits.clone())
57264                    .map(|r| r.map(|t| Self::ScSpecUdtUnionV0(Box::new(t)))),
57265            ),
57266            TypeVariant::ScSpecUdtEnumCaseV0 => Box::new(
57267                ReadXdrIter::<_, ScSpecUdtEnumCaseV0>::new(dec, r.limits.clone())
57268                    .map(|r| r.map(|t| Self::ScSpecUdtEnumCaseV0(Box::new(t)))),
57269            ),
57270            TypeVariant::ScSpecUdtEnumV0 => Box::new(
57271                ReadXdrIter::<_, ScSpecUdtEnumV0>::new(dec, r.limits.clone())
57272                    .map(|r| r.map(|t| Self::ScSpecUdtEnumV0(Box::new(t)))),
57273            ),
57274            TypeVariant::ScSpecUdtErrorEnumCaseV0 => Box::new(
57275                ReadXdrIter::<_, ScSpecUdtErrorEnumCaseV0>::new(dec, r.limits.clone())
57276                    .map(|r| r.map(|t| Self::ScSpecUdtErrorEnumCaseV0(Box::new(t)))),
57277            ),
57278            TypeVariant::ScSpecUdtErrorEnumV0 => Box::new(
57279                ReadXdrIter::<_, ScSpecUdtErrorEnumV0>::new(dec, r.limits.clone())
57280                    .map(|r| r.map(|t| Self::ScSpecUdtErrorEnumV0(Box::new(t)))),
57281            ),
57282            TypeVariant::ScSpecFunctionInputV0 => Box::new(
57283                ReadXdrIter::<_, ScSpecFunctionInputV0>::new(dec, r.limits.clone())
57284                    .map(|r| r.map(|t| Self::ScSpecFunctionInputV0(Box::new(t)))),
57285            ),
57286            TypeVariant::ScSpecFunctionV0 => Box::new(
57287                ReadXdrIter::<_, ScSpecFunctionV0>::new(dec, r.limits.clone())
57288                    .map(|r| r.map(|t| Self::ScSpecFunctionV0(Box::new(t)))),
57289            ),
57290            TypeVariant::ScSpecEntryKind => Box::new(
57291                ReadXdrIter::<_, ScSpecEntryKind>::new(dec, r.limits.clone())
57292                    .map(|r| r.map(|t| Self::ScSpecEntryKind(Box::new(t)))),
57293            ),
57294            TypeVariant::ScSpecEntry => Box::new(
57295                ReadXdrIter::<_, ScSpecEntry>::new(dec, r.limits.clone())
57296                    .map(|r| r.map(|t| Self::ScSpecEntry(Box::new(t)))),
57297            ),
57298            TypeVariant::ScValType => Box::new(
57299                ReadXdrIter::<_, ScValType>::new(dec, r.limits.clone())
57300                    .map(|r| r.map(|t| Self::ScValType(Box::new(t)))),
57301            ),
57302            TypeVariant::ScErrorType => Box::new(
57303                ReadXdrIter::<_, ScErrorType>::new(dec, r.limits.clone())
57304                    .map(|r| r.map(|t| Self::ScErrorType(Box::new(t)))),
57305            ),
57306            TypeVariant::ScErrorCode => Box::new(
57307                ReadXdrIter::<_, ScErrorCode>::new(dec, r.limits.clone())
57308                    .map(|r| r.map(|t| Self::ScErrorCode(Box::new(t)))),
57309            ),
57310            TypeVariant::ScError => Box::new(
57311                ReadXdrIter::<_, ScError>::new(dec, r.limits.clone())
57312                    .map(|r| r.map(|t| Self::ScError(Box::new(t)))),
57313            ),
57314            TypeVariant::UInt128Parts => Box::new(
57315                ReadXdrIter::<_, UInt128Parts>::new(dec, r.limits.clone())
57316                    .map(|r| r.map(|t| Self::UInt128Parts(Box::new(t)))),
57317            ),
57318            TypeVariant::Int128Parts => Box::new(
57319                ReadXdrIter::<_, Int128Parts>::new(dec, r.limits.clone())
57320                    .map(|r| r.map(|t| Self::Int128Parts(Box::new(t)))),
57321            ),
57322            TypeVariant::UInt256Parts => Box::new(
57323                ReadXdrIter::<_, UInt256Parts>::new(dec, r.limits.clone())
57324                    .map(|r| r.map(|t| Self::UInt256Parts(Box::new(t)))),
57325            ),
57326            TypeVariant::Int256Parts => Box::new(
57327                ReadXdrIter::<_, Int256Parts>::new(dec, r.limits.clone())
57328                    .map(|r| r.map(|t| Self::Int256Parts(Box::new(t)))),
57329            ),
57330            TypeVariant::ContractExecutableType => Box::new(
57331                ReadXdrIter::<_, ContractExecutableType>::new(dec, r.limits.clone())
57332                    .map(|r| r.map(|t| Self::ContractExecutableType(Box::new(t)))),
57333            ),
57334            TypeVariant::ContractExecutable => Box::new(
57335                ReadXdrIter::<_, ContractExecutable>::new(dec, r.limits.clone())
57336                    .map(|r| r.map(|t| Self::ContractExecutable(Box::new(t)))),
57337            ),
57338            TypeVariant::ScAddressType => Box::new(
57339                ReadXdrIter::<_, ScAddressType>::new(dec, r.limits.clone())
57340                    .map(|r| r.map(|t| Self::ScAddressType(Box::new(t)))),
57341            ),
57342            TypeVariant::ScAddress => Box::new(
57343                ReadXdrIter::<_, ScAddress>::new(dec, r.limits.clone())
57344                    .map(|r| r.map(|t| Self::ScAddress(Box::new(t)))),
57345            ),
57346            TypeVariant::ScVec => Box::new(
57347                ReadXdrIter::<_, ScVec>::new(dec, r.limits.clone())
57348                    .map(|r| r.map(|t| Self::ScVec(Box::new(t)))),
57349            ),
57350            TypeVariant::ScMap => Box::new(
57351                ReadXdrIter::<_, ScMap>::new(dec, r.limits.clone())
57352                    .map(|r| r.map(|t| Self::ScMap(Box::new(t)))),
57353            ),
57354            TypeVariant::ScBytes => Box::new(
57355                ReadXdrIter::<_, ScBytes>::new(dec, r.limits.clone())
57356                    .map(|r| r.map(|t| Self::ScBytes(Box::new(t)))),
57357            ),
57358            TypeVariant::ScString => Box::new(
57359                ReadXdrIter::<_, ScString>::new(dec, r.limits.clone())
57360                    .map(|r| r.map(|t| Self::ScString(Box::new(t)))),
57361            ),
57362            TypeVariant::ScSymbol => Box::new(
57363                ReadXdrIter::<_, ScSymbol>::new(dec, r.limits.clone())
57364                    .map(|r| r.map(|t| Self::ScSymbol(Box::new(t)))),
57365            ),
57366            TypeVariant::ScNonceKey => Box::new(
57367                ReadXdrIter::<_, ScNonceKey>::new(dec, r.limits.clone())
57368                    .map(|r| r.map(|t| Self::ScNonceKey(Box::new(t)))),
57369            ),
57370            TypeVariant::ScContractInstance => Box::new(
57371                ReadXdrIter::<_, ScContractInstance>::new(dec, r.limits.clone())
57372                    .map(|r| r.map(|t| Self::ScContractInstance(Box::new(t)))),
57373            ),
57374            TypeVariant::ScVal => Box::new(
57375                ReadXdrIter::<_, ScVal>::new(dec, r.limits.clone())
57376                    .map(|r| r.map(|t| Self::ScVal(Box::new(t)))),
57377            ),
57378            TypeVariant::ScMapEntry => Box::new(
57379                ReadXdrIter::<_, ScMapEntry>::new(dec, r.limits.clone())
57380                    .map(|r| r.map(|t| Self::ScMapEntry(Box::new(t)))),
57381            ),
57382            TypeVariant::StoredTransactionSet => Box::new(
57383                ReadXdrIter::<_, StoredTransactionSet>::new(dec, r.limits.clone())
57384                    .map(|r| r.map(|t| Self::StoredTransactionSet(Box::new(t)))),
57385            ),
57386            TypeVariant::StoredDebugTransactionSet => Box::new(
57387                ReadXdrIter::<_, StoredDebugTransactionSet>::new(dec, r.limits.clone())
57388                    .map(|r| r.map(|t| Self::StoredDebugTransactionSet(Box::new(t)))),
57389            ),
57390            TypeVariant::PersistedScpStateV0 => Box::new(
57391                ReadXdrIter::<_, PersistedScpStateV0>::new(dec, r.limits.clone())
57392                    .map(|r| r.map(|t| Self::PersistedScpStateV0(Box::new(t)))),
57393            ),
57394            TypeVariant::PersistedScpStateV1 => Box::new(
57395                ReadXdrIter::<_, PersistedScpStateV1>::new(dec, r.limits.clone())
57396                    .map(|r| r.map(|t| Self::PersistedScpStateV1(Box::new(t)))),
57397            ),
57398            TypeVariant::PersistedScpState => Box::new(
57399                ReadXdrIter::<_, PersistedScpState>::new(dec, r.limits.clone())
57400                    .map(|r| r.map(|t| Self::PersistedScpState(Box::new(t)))),
57401            ),
57402            TypeVariant::Thresholds => Box::new(
57403                ReadXdrIter::<_, Thresholds>::new(dec, r.limits.clone())
57404                    .map(|r| r.map(|t| Self::Thresholds(Box::new(t)))),
57405            ),
57406            TypeVariant::String32 => Box::new(
57407                ReadXdrIter::<_, String32>::new(dec, r.limits.clone())
57408                    .map(|r| r.map(|t| Self::String32(Box::new(t)))),
57409            ),
57410            TypeVariant::String64 => Box::new(
57411                ReadXdrIter::<_, String64>::new(dec, r.limits.clone())
57412                    .map(|r| r.map(|t| Self::String64(Box::new(t)))),
57413            ),
57414            TypeVariant::SequenceNumber => Box::new(
57415                ReadXdrIter::<_, SequenceNumber>::new(dec, r.limits.clone())
57416                    .map(|r| r.map(|t| Self::SequenceNumber(Box::new(t)))),
57417            ),
57418            TypeVariant::DataValue => Box::new(
57419                ReadXdrIter::<_, DataValue>::new(dec, r.limits.clone())
57420                    .map(|r| r.map(|t| Self::DataValue(Box::new(t)))),
57421            ),
57422            TypeVariant::PoolId => Box::new(
57423                ReadXdrIter::<_, PoolId>::new(dec, r.limits.clone())
57424                    .map(|r| r.map(|t| Self::PoolId(Box::new(t)))),
57425            ),
57426            TypeVariant::AssetCode4 => Box::new(
57427                ReadXdrIter::<_, AssetCode4>::new(dec, r.limits.clone())
57428                    .map(|r| r.map(|t| Self::AssetCode4(Box::new(t)))),
57429            ),
57430            TypeVariant::AssetCode12 => Box::new(
57431                ReadXdrIter::<_, AssetCode12>::new(dec, r.limits.clone())
57432                    .map(|r| r.map(|t| Self::AssetCode12(Box::new(t)))),
57433            ),
57434            TypeVariant::AssetType => Box::new(
57435                ReadXdrIter::<_, AssetType>::new(dec, r.limits.clone())
57436                    .map(|r| r.map(|t| Self::AssetType(Box::new(t)))),
57437            ),
57438            TypeVariant::AssetCode => Box::new(
57439                ReadXdrIter::<_, AssetCode>::new(dec, r.limits.clone())
57440                    .map(|r| r.map(|t| Self::AssetCode(Box::new(t)))),
57441            ),
57442            TypeVariant::AlphaNum4 => Box::new(
57443                ReadXdrIter::<_, AlphaNum4>::new(dec, r.limits.clone())
57444                    .map(|r| r.map(|t| Self::AlphaNum4(Box::new(t)))),
57445            ),
57446            TypeVariant::AlphaNum12 => Box::new(
57447                ReadXdrIter::<_, AlphaNum12>::new(dec, r.limits.clone())
57448                    .map(|r| r.map(|t| Self::AlphaNum12(Box::new(t)))),
57449            ),
57450            TypeVariant::Asset => Box::new(
57451                ReadXdrIter::<_, Asset>::new(dec, r.limits.clone())
57452                    .map(|r| r.map(|t| Self::Asset(Box::new(t)))),
57453            ),
57454            TypeVariant::Price => Box::new(
57455                ReadXdrIter::<_, Price>::new(dec, r.limits.clone())
57456                    .map(|r| r.map(|t| Self::Price(Box::new(t)))),
57457            ),
57458            TypeVariant::Liabilities => Box::new(
57459                ReadXdrIter::<_, Liabilities>::new(dec, r.limits.clone())
57460                    .map(|r| r.map(|t| Self::Liabilities(Box::new(t)))),
57461            ),
57462            TypeVariant::ThresholdIndexes => Box::new(
57463                ReadXdrIter::<_, ThresholdIndexes>::new(dec, r.limits.clone())
57464                    .map(|r| r.map(|t| Self::ThresholdIndexes(Box::new(t)))),
57465            ),
57466            TypeVariant::LedgerEntryType => Box::new(
57467                ReadXdrIter::<_, LedgerEntryType>::new(dec, r.limits.clone())
57468                    .map(|r| r.map(|t| Self::LedgerEntryType(Box::new(t)))),
57469            ),
57470            TypeVariant::Signer => Box::new(
57471                ReadXdrIter::<_, Signer>::new(dec, r.limits.clone())
57472                    .map(|r| r.map(|t| Self::Signer(Box::new(t)))),
57473            ),
57474            TypeVariant::AccountFlags => Box::new(
57475                ReadXdrIter::<_, AccountFlags>::new(dec, r.limits.clone())
57476                    .map(|r| r.map(|t| Self::AccountFlags(Box::new(t)))),
57477            ),
57478            TypeVariant::SponsorshipDescriptor => Box::new(
57479                ReadXdrIter::<_, SponsorshipDescriptor>::new(dec, r.limits.clone())
57480                    .map(|r| r.map(|t| Self::SponsorshipDescriptor(Box::new(t)))),
57481            ),
57482            TypeVariant::AccountEntryExtensionV3 => Box::new(
57483                ReadXdrIter::<_, AccountEntryExtensionV3>::new(dec, r.limits.clone())
57484                    .map(|r| r.map(|t| Self::AccountEntryExtensionV3(Box::new(t)))),
57485            ),
57486            TypeVariant::AccountEntryExtensionV2 => Box::new(
57487                ReadXdrIter::<_, AccountEntryExtensionV2>::new(dec, r.limits.clone())
57488                    .map(|r| r.map(|t| Self::AccountEntryExtensionV2(Box::new(t)))),
57489            ),
57490            TypeVariant::AccountEntryExtensionV2Ext => Box::new(
57491                ReadXdrIter::<_, AccountEntryExtensionV2Ext>::new(dec, r.limits.clone())
57492                    .map(|r| r.map(|t| Self::AccountEntryExtensionV2Ext(Box::new(t)))),
57493            ),
57494            TypeVariant::AccountEntryExtensionV1 => Box::new(
57495                ReadXdrIter::<_, AccountEntryExtensionV1>::new(dec, r.limits.clone())
57496                    .map(|r| r.map(|t| Self::AccountEntryExtensionV1(Box::new(t)))),
57497            ),
57498            TypeVariant::AccountEntryExtensionV1Ext => Box::new(
57499                ReadXdrIter::<_, AccountEntryExtensionV1Ext>::new(dec, r.limits.clone())
57500                    .map(|r| r.map(|t| Self::AccountEntryExtensionV1Ext(Box::new(t)))),
57501            ),
57502            TypeVariant::AccountEntry => Box::new(
57503                ReadXdrIter::<_, AccountEntry>::new(dec, r.limits.clone())
57504                    .map(|r| r.map(|t| Self::AccountEntry(Box::new(t)))),
57505            ),
57506            TypeVariant::AccountEntryExt => Box::new(
57507                ReadXdrIter::<_, AccountEntryExt>::new(dec, r.limits.clone())
57508                    .map(|r| r.map(|t| Self::AccountEntryExt(Box::new(t)))),
57509            ),
57510            TypeVariant::TrustLineFlags => Box::new(
57511                ReadXdrIter::<_, TrustLineFlags>::new(dec, r.limits.clone())
57512                    .map(|r| r.map(|t| Self::TrustLineFlags(Box::new(t)))),
57513            ),
57514            TypeVariant::LiquidityPoolType => Box::new(
57515                ReadXdrIter::<_, LiquidityPoolType>::new(dec, r.limits.clone())
57516                    .map(|r| r.map(|t| Self::LiquidityPoolType(Box::new(t)))),
57517            ),
57518            TypeVariant::TrustLineAsset => Box::new(
57519                ReadXdrIter::<_, TrustLineAsset>::new(dec, r.limits.clone())
57520                    .map(|r| r.map(|t| Self::TrustLineAsset(Box::new(t)))),
57521            ),
57522            TypeVariant::TrustLineEntryExtensionV2 => Box::new(
57523                ReadXdrIter::<_, TrustLineEntryExtensionV2>::new(dec, r.limits.clone())
57524                    .map(|r| r.map(|t| Self::TrustLineEntryExtensionV2(Box::new(t)))),
57525            ),
57526            TypeVariant::TrustLineEntryExtensionV2Ext => Box::new(
57527                ReadXdrIter::<_, TrustLineEntryExtensionV2Ext>::new(dec, r.limits.clone())
57528                    .map(|r| r.map(|t| Self::TrustLineEntryExtensionV2Ext(Box::new(t)))),
57529            ),
57530            TypeVariant::TrustLineEntry => Box::new(
57531                ReadXdrIter::<_, TrustLineEntry>::new(dec, r.limits.clone())
57532                    .map(|r| r.map(|t| Self::TrustLineEntry(Box::new(t)))),
57533            ),
57534            TypeVariant::TrustLineEntryExt => Box::new(
57535                ReadXdrIter::<_, TrustLineEntryExt>::new(dec, r.limits.clone())
57536                    .map(|r| r.map(|t| Self::TrustLineEntryExt(Box::new(t)))),
57537            ),
57538            TypeVariant::TrustLineEntryV1 => Box::new(
57539                ReadXdrIter::<_, TrustLineEntryV1>::new(dec, r.limits.clone())
57540                    .map(|r| r.map(|t| Self::TrustLineEntryV1(Box::new(t)))),
57541            ),
57542            TypeVariant::TrustLineEntryV1Ext => Box::new(
57543                ReadXdrIter::<_, TrustLineEntryV1Ext>::new(dec, r.limits.clone())
57544                    .map(|r| r.map(|t| Self::TrustLineEntryV1Ext(Box::new(t)))),
57545            ),
57546            TypeVariant::OfferEntryFlags => Box::new(
57547                ReadXdrIter::<_, OfferEntryFlags>::new(dec, r.limits.clone())
57548                    .map(|r| r.map(|t| Self::OfferEntryFlags(Box::new(t)))),
57549            ),
57550            TypeVariant::OfferEntry => Box::new(
57551                ReadXdrIter::<_, OfferEntry>::new(dec, r.limits.clone())
57552                    .map(|r| r.map(|t| Self::OfferEntry(Box::new(t)))),
57553            ),
57554            TypeVariant::OfferEntryExt => Box::new(
57555                ReadXdrIter::<_, OfferEntryExt>::new(dec, r.limits.clone())
57556                    .map(|r| r.map(|t| Self::OfferEntryExt(Box::new(t)))),
57557            ),
57558            TypeVariant::DataEntry => Box::new(
57559                ReadXdrIter::<_, DataEntry>::new(dec, r.limits.clone())
57560                    .map(|r| r.map(|t| Self::DataEntry(Box::new(t)))),
57561            ),
57562            TypeVariant::DataEntryExt => Box::new(
57563                ReadXdrIter::<_, DataEntryExt>::new(dec, r.limits.clone())
57564                    .map(|r| r.map(|t| Self::DataEntryExt(Box::new(t)))),
57565            ),
57566            TypeVariant::ClaimPredicateType => Box::new(
57567                ReadXdrIter::<_, ClaimPredicateType>::new(dec, r.limits.clone())
57568                    .map(|r| r.map(|t| Self::ClaimPredicateType(Box::new(t)))),
57569            ),
57570            TypeVariant::ClaimPredicate => Box::new(
57571                ReadXdrIter::<_, ClaimPredicate>::new(dec, r.limits.clone())
57572                    .map(|r| r.map(|t| Self::ClaimPredicate(Box::new(t)))),
57573            ),
57574            TypeVariant::ClaimantType => Box::new(
57575                ReadXdrIter::<_, ClaimantType>::new(dec, r.limits.clone())
57576                    .map(|r| r.map(|t| Self::ClaimantType(Box::new(t)))),
57577            ),
57578            TypeVariant::Claimant => Box::new(
57579                ReadXdrIter::<_, Claimant>::new(dec, r.limits.clone())
57580                    .map(|r| r.map(|t| Self::Claimant(Box::new(t)))),
57581            ),
57582            TypeVariant::ClaimantV0 => Box::new(
57583                ReadXdrIter::<_, ClaimantV0>::new(dec, r.limits.clone())
57584                    .map(|r| r.map(|t| Self::ClaimantV0(Box::new(t)))),
57585            ),
57586            TypeVariant::ClaimableBalanceIdType => Box::new(
57587                ReadXdrIter::<_, ClaimableBalanceIdType>::new(dec, r.limits.clone())
57588                    .map(|r| r.map(|t| Self::ClaimableBalanceIdType(Box::new(t)))),
57589            ),
57590            TypeVariant::ClaimableBalanceId => Box::new(
57591                ReadXdrIter::<_, ClaimableBalanceId>::new(dec, r.limits.clone())
57592                    .map(|r| r.map(|t| Self::ClaimableBalanceId(Box::new(t)))),
57593            ),
57594            TypeVariant::ClaimableBalanceFlags => Box::new(
57595                ReadXdrIter::<_, ClaimableBalanceFlags>::new(dec, r.limits.clone())
57596                    .map(|r| r.map(|t| Self::ClaimableBalanceFlags(Box::new(t)))),
57597            ),
57598            TypeVariant::ClaimableBalanceEntryExtensionV1 => Box::new(
57599                ReadXdrIter::<_, ClaimableBalanceEntryExtensionV1>::new(dec, r.limits.clone())
57600                    .map(|r| r.map(|t| Self::ClaimableBalanceEntryExtensionV1(Box::new(t)))),
57601            ),
57602            TypeVariant::ClaimableBalanceEntryExtensionV1Ext => Box::new(
57603                ReadXdrIter::<_, ClaimableBalanceEntryExtensionV1Ext>::new(dec, r.limits.clone())
57604                    .map(|r| r.map(|t| Self::ClaimableBalanceEntryExtensionV1Ext(Box::new(t)))),
57605            ),
57606            TypeVariant::ClaimableBalanceEntry => Box::new(
57607                ReadXdrIter::<_, ClaimableBalanceEntry>::new(dec, r.limits.clone())
57608                    .map(|r| r.map(|t| Self::ClaimableBalanceEntry(Box::new(t)))),
57609            ),
57610            TypeVariant::ClaimableBalanceEntryExt => Box::new(
57611                ReadXdrIter::<_, ClaimableBalanceEntryExt>::new(dec, r.limits.clone())
57612                    .map(|r| r.map(|t| Self::ClaimableBalanceEntryExt(Box::new(t)))),
57613            ),
57614            TypeVariant::LiquidityPoolConstantProductParameters => Box::new(
57615                ReadXdrIter::<_, LiquidityPoolConstantProductParameters>::new(
57616                    dec,
57617                    r.limits.clone(),
57618                )
57619                .map(|r| r.map(|t| Self::LiquidityPoolConstantProductParameters(Box::new(t)))),
57620            ),
57621            TypeVariant::LiquidityPoolEntry => Box::new(
57622                ReadXdrIter::<_, LiquidityPoolEntry>::new(dec, r.limits.clone())
57623                    .map(|r| r.map(|t| Self::LiquidityPoolEntry(Box::new(t)))),
57624            ),
57625            TypeVariant::LiquidityPoolEntryBody => Box::new(
57626                ReadXdrIter::<_, LiquidityPoolEntryBody>::new(dec, r.limits.clone())
57627                    .map(|r| r.map(|t| Self::LiquidityPoolEntryBody(Box::new(t)))),
57628            ),
57629            TypeVariant::LiquidityPoolEntryConstantProduct => Box::new(
57630                ReadXdrIter::<_, LiquidityPoolEntryConstantProduct>::new(dec, r.limits.clone())
57631                    .map(|r| r.map(|t| Self::LiquidityPoolEntryConstantProduct(Box::new(t)))),
57632            ),
57633            TypeVariant::ContractDataDurability => Box::new(
57634                ReadXdrIter::<_, ContractDataDurability>::new(dec, r.limits.clone())
57635                    .map(|r| r.map(|t| Self::ContractDataDurability(Box::new(t)))),
57636            ),
57637            TypeVariant::ContractDataEntry => Box::new(
57638                ReadXdrIter::<_, ContractDataEntry>::new(dec, r.limits.clone())
57639                    .map(|r| r.map(|t| Self::ContractDataEntry(Box::new(t)))),
57640            ),
57641            TypeVariant::ContractCodeCostInputs => Box::new(
57642                ReadXdrIter::<_, ContractCodeCostInputs>::new(dec, r.limits.clone())
57643                    .map(|r| r.map(|t| Self::ContractCodeCostInputs(Box::new(t)))),
57644            ),
57645            TypeVariant::ContractCodeEntry => Box::new(
57646                ReadXdrIter::<_, ContractCodeEntry>::new(dec, r.limits.clone())
57647                    .map(|r| r.map(|t| Self::ContractCodeEntry(Box::new(t)))),
57648            ),
57649            TypeVariant::ContractCodeEntryExt => Box::new(
57650                ReadXdrIter::<_, ContractCodeEntryExt>::new(dec, r.limits.clone())
57651                    .map(|r| r.map(|t| Self::ContractCodeEntryExt(Box::new(t)))),
57652            ),
57653            TypeVariant::ContractCodeEntryV1 => Box::new(
57654                ReadXdrIter::<_, ContractCodeEntryV1>::new(dec, r.limits.clone())
57655                    .map(|r| r.map(|t| Self::ContractCodeEntryV1(Box::new(t)))),
57656            ),
57657            TypeVariant::TtlEntry => Box::new(
57658                ReadXdrIter::<_, TtlEntry>::new(dec, r.limits.clone())
57659                    .map(|r| r.map(|t| Self::TtlEntry(Box::new(t)))),
57660            ),
57661            TypeVariant::LedgerEntryExtensionV1 => Box::new(
57662                ReadXdrIter::<_, LedgerEntryExtensionV1>::new(dec, r.limits.clone())
57663                    .map(|r| r.map(|t| Self::LedgerEntryExtensionV1(Box::new(t)))),
57664            ),
57665            TypeVariant::LedgerEntryExtensionV1Ext => Box::new(
57666                ReadXdrIter::<_, LedgerEntryExtensionV1Ext>::new(dec, r.limits.clone())
57667                    .map(|r| r.map(|t| Self::LedgerEntryExtensionV1Ext(Box::new(t)))),
57668            ),
57669            TypeVariant::LedgerEntry => Box::new(
57670                ReadXdrIter::<_, LedgerEntry>::new(dec, r.limits.clone())
57671                    .map(|r| r.map(|t| Self::LedgerEntry(Box::new(t)))),
57672            ),
57673            TypeVariant::LedgerEntryData => Box::new(
57674                ReadXdrIter::<_, LedgerEntryData>::new(dec, r.limits.clone())
57675                    .map(|r| r.map(|t| Self::LedgerEntryData(Box::new(t)))),
57676            ),
57677            TypeVariant::LedgerEntryExt => Box::new(
57678                ReadXdrIter::<_, LedgerEntryExt>::new(dec, r.limits.clone())
57679                    .map(|r| r.map(|t| Self::LedgerEntryExt(Box::new(t)))),
57680            ),
57681            TypeVariant::LedgerKey => Box::new(
57682                ReadXdrIter::<_, LedgerKey>::new(dec, r.limits.clone())
57683                    .map(|r| r.map(|t| Self::LedgerKey(Box::new(t)))),
57684            ),
57685            TypeVariant::LedgerKeyAccount => Box::new(
57686                ReadXdrIter::<_, LedgerKeyAccount>::new(dec, r.limits.clone())
57687                    .map(|r| r.map(|t| Self::LedgerKeyAccount(Box::new(t)))),
57688            ),
57689            TypeVariant::LedgerKeyTrustLine => Box::new(
57690                ReadXdrIter::<_, LedgerKeyTrustLine>::new(dec, r.limits.clone())
57691                    .map(|r| r.map(|t| Self::LedgerKeyTrustLine(Box::new(t)))),
57692            ),
57693            TypeVariant::LedgerKeyOffer => Box::new(
57694                ReadXdrIter::<_, LedgerKeyOffer>::new(dec, r.limits.clone())
57695                    .map(|r| r.map(|t| Self::LedgerKeyOffer(Box::new(t)))),
57696            ),
57697            TypeVariant::LedgerKeyData => Box::new(
57698                ReadXdrIter::<_, LedgerKeyData>::new(dec, r.limits.clone())
57699                    .map(|r| r.map(|t| Self::LedgerKeyData(Box::new(t)))),
57700            ),
57701            TypeVariant::LedgerKeyClaimableBalance => Box::new(
57702                ReadXdrIter::<_, LedgerKeyClaimableBalance>::new(dec, r.limits.clone())
57703                    .map(|r| r.map(|t| Self::LedgerKeyClaimableBalance(Box::new(t)))),
57704            ),
57705            TypeVariant::LedgerKeyLiquidityPool => Box::new(
57706                ReadXdrIter::<_, LedgerKeyLiquidityPool>::new(dec, r.limits.clone())
57707                    .map(|r| r.map(|t| Self::LedgerKeyLiquidityPool(Box::new(t)))),
57708            ),
57709            TypeVariant::LedgerKeyContractData => Box::new(
57710                ReadXdrIter::<_, LedgerKeyContractData>::new(dec, r.limits.clone())
57711                    .map(|r| r.map(|t| Self::LedgerKeyContractData(Box::new(t)))),
57712            ),
57713            TypeVariant::LedgerKeyContractCode => Box::new(
57714                ReadXdrIter::<_, LedgerKeyContractCode>::new(dec, r.limits.clone())
57715                    .map(|r| r.map(|t| Self::LedgerKeyContractCode(Box::new(t)))),
57716            ),
57717            TypeVariant::LedgerKeyConfigSetting => Box::new(
57718                ReadXdrIter::<_, LedgerKeyConfigSetting>::new(dec, r.limits.clone())
57719                    .map(|r| r.map(|t| Self::LedgerKeyConfigSetting(Box::new(t)))),
57720            ),
57721            TypeVariant::LedgerKeyTtl => Box::new(
57722                ReadXdrIter::<_, LedgerKeyTtl>::new(dec, r.limits.clone())
57723                    .map(|r| r.map(|t| Self::LedgerKeyTtl(Box::new(t)))),
57724            ),
57725            TypeVariant::EnvelopeType => Box::new(
57726                ReadXdrIter::<_, EnvelopeType>::new(dec, r.limits.clone())
57727                    .map(|r| r.map(|t| Self::EnvelopeType(Box::new(t)))),
57728            ),
57729            TypeVariant::BucketListType => Box::new(
57730                ReadXdrIter::<_, BucketListType>::new(dec, r.limits.clone())
57731                    .map(|r| r.map(|t| Self::BucketListType(Box::new(t)))),
57732            ),
57733            TypeVariant::BucketEntryType => Box::new(
57734                ReadXdrIter::<_, BucketEntryType>::new(dec, r.limits.clone())
57735                    .map(|r| r.map(|t| Self::BucketEntryType(Box::new(t)))),
57736            ),
57737            TypeVariant::HotArchiveBucketEntryType => Box::new(
57738                ReadXdrIter::<_, HotArchiveBucketEntryType>::new(dec, r.limits.clone())
57739                    .map(|r| r.map(|t| Self::HotArchiveBucketEntryType(Box::new(t)))),
57740            ),
57741            TypeVariant::ColdArchiveBucketEntryType => Box::new(
57742                ReadXdrIter::<_, ColdArchiveBucketEntryType>::new(dec, r.limits.clone())
57743                    .map(|r| r.map(|t| Self::ColdArchiveBucketEntryType(Box::new(t)))),
57744            ),
57745            TypeVariant::BucketMetadata => Box::new(
57746                ReadXdrIter::<_, BucketMetadata>::new(dec, r.limits.clone())
57747                    .map(|r| r.map(|t| Self::BucketMetadata(Box::new(t)))),
57748            ),
57749            TypeVariant::BucketMetadataExt => Box::new(
57750                ReadXdrIter::<_, BucketMetadataExt>::new(dec, r.limits.clone())
57751                    .map(|r| r.map(|t| Self::BucketMetadataExt(Box::new(t)))),
57752            ),
57753            TypeVariant::BucketEntry => Box::new(
57754                ReadXdrIter::<_, BucketEntry>::new(dec, r.limits.clone())
57755                    .map(|r| r.map(|t| Self::BucketEntry(Box::new(t)))),
57756            ),
57757            TypeVariant::HotArchiveBucketEntry => Box::new(
57758                ReadXdrIter::<_, HotArchiveBucketEntry>::new(dec, r.limits.clone())
57759                    .map(|r| r.map(|t| Self::HotArchiveBucketEntry(Box::new(t)))),
57760            ),
57761            TypeVariant::ColdArchiveArchivedLeaf => Box::new(
57762                ReadXdrIter::<_, ColdArchiveArchivedLeaf>::new(dec, r.limits.clone())
57763                    .map(|r| r.map(|t| Self::ColdArchiveArchivedLeaf(Box::new(t)))),
57764            ),
57765            TypeVariant::ColdArchiveDeletedLeaf => Box::new(
57766                ReadXdrIter::<_, ColdArchiveDeletedLeaf>::new(dec, r.limits.clone())
57767                    .map(|r| r.map(|t| Self::ColdArchiveDeletedLeaf(Box::new(t)))),
57768            ),
57769            TypeVariant::ColdArchiveBoundaryLeaf => Box::new(
57770                ReadXdrIter::<_, ColdArchiveBoundaryLeaf>::new(dec, r.limits.clone())
57771                    .map(|r| r.map(|t| Self::ColdArchiveBoundaryLeaf(Box::new(t)))),
57772            ),
57773            TypeVariant::ColdArchiveHashEntry => Box::new(
57774                ReadXdrIter::<_, ColdArchiveHashEntry>::new(dec, r.limits.clone())
57775                    .map(|r| r.map(|t| Self::ColdArchiveHashEntry(Box::new(t)))),
57776            ),
57777            TypeVariant::ColdArchiveBucketEntry => Box::new(
57778                ReadXdrIter::<_, ColdArchiveBucketEntry>::new(dec, r.limits.clone())
57779                    .map(|r| r.map(|t| Self::ColdArchiveBucketEntry(Box::new(t)))),
57780            ),
57781            TypeVariant::UpgradeType => Box::new(
57782                ReadXdrIter::<_, UpgradeType>::new(dec, r.limits.clone())
57783                    .map(|r| r.map(|t| Self::UpgradeType(Box::new(t)))),
57784            ),
57785            TypeVariant::StellarValueType => Box::new(
57786                ReadXdrIter::<_, StellarValueType>::new(dec, r.limits.clone())
57787                    .map(|r| r.map(|t| Self::StellarValueType(Box::new(t)))),
57788            ),
57789            TypeVariant::LedgerCloseValueSignature => Box::new(
57790                ReadXdrIter::<_, LedgerCloseValueSignature>::new(dec, r.limits.clone())
57791                    .map(|r| r.map(|t| Self::LedgerCloseValueSignature(Box::new(t)))),
57792            ),
57793            TypeVariant::StellarValue => Box::new(
57794                ReadXdrIter::<_, StellarValue>::new(dec, r.limits.clone())
57795                    .map(|r| r.map(|t| Self::StellarValue(Box::new(t)))),
57796            ),
57797            TypeVariant::StellarValueExt => Box::new(
57798                ReadXdrIter::<_, StellarValueExt>::new(dec, r.limits.clone())
57799                    .map(|r| r.map(|t| Self::StellarValueExt(Box::new(t)))),
57800            ),
57801            TypeVariant::LedgerHeaderFlags => Box::new(
57802                ReadXdrIter::<_, LedgerHeaderFlags>::new(dec, r.limits.clone())
57803                    .map(|r| r.map(|t| Self::LedgerHeaderFlags(Box::new(t)))),
57804            ),
57805            TypeVariant::LedgerHeaderExtensionV1 => Box::new(
57806                ReadXdrIter::<_, LedgerHeaderExtensionV1>::new(dec, r.limits.clone())
57807                    .map(|r| r.map(|t| Self::LedgerHeaderExtensionV1(Box::new(t)))),
57808            ),
57809            TypeVariant::LedgerHeaderExtensionV1Ext => Box::new(
57810                ReadXdrIter::<_, LedgerHeaderExtensionV1Ext>::new(dec, r.limits.clone())
57811                    .map(|r| r.map(|t| Self::LedgerHeaderExtensionV1Ext(Box::new(t)))),
57812            ),
57813            TypeVariant::LedgerHeader => Box::new(
57814                ReadXdrIter::<_, LedgerHeader>::new(dec, r.limits.clone())
57815                    .map(|r| r.map(|t| Self::LedgerHeader(Box::new(t)))),
57816            ),
57817            TypeVariant::LedgerHeaderExt => Box::new(
57818                ReadXdrIter::<_, LedgerHeaderExt>::new(dec, r.limits.clone())
57819                    .map(|r| r.map(|t| Self::LedgerHeaderExt(Box::new(t)))),
57820            ),
57821            TypeVariant::LedgerUpgradeType => Box::new(
57822                ReadXdrIter::<_, LedgerUpgradeType>::new(dec, r.limits.clone())
57823                    .map(|r| r.map(|t| Self::LedgerUpgradeType(Box::new(t)))),
57824            ),
57825            TypeVariant::ConfigUpgradeSetKey => Box::new(
57826                ReadXdrIter::<_, ConfigUpgradeSetKey>::new(dec, r.limits.clone())
57827                    .map(|r| r.map(|t| Self::ConfigUpgradeSetKey(Box::new(t)))),
57828            ),
57829            TypeVariant::LedgerUpgrade => Box::new(
57830                ReadXdrIter::<_, LedgerUpgrade>::new(dec, r.limits.clone())
57831                    .map(|r| r.map(|t| Self::LedgerUpgrade(Box::new(t)))),
57832            ),
57833            TypeVariant::ConfigUpgradeSet => Box::new(
57834                ReadXdrIter::<_, ConfigUpgradeSet>::new(dec, r.limits.clone())
57835                    .map(|r| r.map(|t| Self::ConfigUpgradeSet(Box::new(t)))),
57836            ),
57837            TypeVariant::TxSetComponentType => Box::new(
57838                ReadXdrIter::<_, TxSetComponentType>::new(dec, r.limits.clone())
57839                    .map(|r| r.map(|t| Self::TxSetComponentType(Box::new(t)))),
57840            ),
57841            TypeVariant::TxSetComponent => Box::new(
57842                ReadXdrIter::<_, TxSetComponent>::new(dec, r.limits.clone())
57843                    .map(|r| r.map(|t| Self::TxSetComponent(Box::new(t)))),
57844            ),
57845            TypeVariant::TxSetComponentTxsMaybeDiscountedFee => Box::new(
57846                ReadXdrIter::<_, TxSetComponentTxsMaybeDiscountedFee>::new(dec, r.limits.clone())
57847                    .map(|r| r.map(|t| Self::TxSetComponentTxsMaybeDiscountedFee(Box::new(t)))),
57848            ),
57849            TypeVariant::TransactionPhase => Box::new(
57850                ReadXdrIter::<_, TransactionPhase>::new(dec, r.limits.clone())
57851                    .map(|r| r.map(|t| Self::TransactionPhase(Box::new(t)))),
57852            ),
57853            TypeVariant::TransactionSet => Box::new(
57854                ReadXdrIter::<_, TransactionSet>::new(dec, r.limits.clone())
57855                    .map(|r| r.map(|t| Self::TransactionSet(Box::new(t)))),
57856            ),
57857            TypeVariant::TransactionSetV1 => Box::new(
57858                ReadXdrIter::<_, TransactionSetV1>::new(dec, r.limits.clone())
57859                    .map(|r| r.map(|t| Self::TransactionSetV1(Box::new(t)))),
57860            ),
57861            TypeVariant::GeneralizedTransactionSet => Box::new(
57862                ReadXdrIter::<_, GeneralizedTransactionSet>::new(dec, r.limits.clone())
57863                    .map(|r| r.map(|t| Self::GeneralizedTransactionSet(Box::new(t)))),
57864            ),
57865            TypeVariant::TransactionResultPair => Box::new(
57866                ReadXdrIter::<_, TransactionResultPair>::new(dec, r.limits.clone())
57867                    .map(|r| r.map(|t| Self::TransactionResultPair(Box::new(t)))),
57868            ),
57869            TypeVariant::TransactionResultSet => Box::new(
57870                ReadXdrIter::<_, TransactionResultSet>::new(dec, r.limits.clone())
57871                    .map(|r| r.map(|t| Self::TransactionResultSet(Box::new(t)))),
57872            ),
57873            TypeVariant::TransactionHistoryEntry => Box::new(
57874                ReadXdrIter::<_, TransactionHistoryEntry>::new(dec, r.limits.clone())
57875                    .map(|r| r.map(|t| Self::TransactionHistoryEntry(Box::new(t)))),
57876            ),
57877            TypeVariant::TransactionHistoryEntryExt => Box::new(
57878                ReadXdrIter::<_, TransactionHistoryEntryExt>::new(dec, r.limits.clone())
57879                    .map(|r| r.map(|t| Self::TransactionHistoryEntryExt(Box::new(t)))),
57880            ),
57881            TypeVariant::TransactionHistoryResultEntry => Box::new(
57882                ReadXdrIter::<_, TransactionHistoryResultEntry>::new(dec, r.limits.clone())
57883                    .map(|r| r.map(|t| Self::TransactionHistoryResultEntry(Box::new(t)))),
57884            ),
57885            TypeVariant::TransactionHistoryResultEntryExt => Box::new(
57886                ReadXdrIter::<_, TransactionHistoryResultEntryExt>::new(dec, r.limits.clone())
57887                    .map(|r| r.map(|t| Self::TransactionHistoryResultEntryExt(Box::new(t)))),
57888            ),
57889            TypeVariant::LedgerHeaderHistoryEntry => Box::new(
57890                ReadXdrIter::<_, LedgerHeaderHistoryEntry>::new(dec, r.limits.clone())
57891                    .map(|r| r.map(|t| Self::LedgerHeaderHistoryEntry(Box::new(t)))),
57892            ),
57893            TypeVariant::LedgerHeaderHistoryEntryExt => Box::new(
57894                ReadXdrIter::<_, LedgerHeaderHistoryEntryExt>::new(dec, r.limits.clone())
57895                    .map(|r| r.map(|t| Self::LedgerHeaderHistoryEntryExt(Box::new(t)))),
57896            ),
57897            TypeVariant::LedgerScpMessages => Box::new(
57898                ReadXdrIter::<_, LedgerScpMessages>::new(dec, r.limits.clone())
57899                    .map(|r| r.map(|t| Self::LedgerScpMessages(Box::new(t)))),
57900            ),
57901            TypeVariant::ScpHistoryEntryV0 => Box::new(
57902                ReadXdrIter::<_, ScpHistoryEntryV0>::new(dec, r.limits.clone())
57903                    .map(|r| r.map(|t| Self::ScpHistoryEntryV0(Box::new(t)))),
57904            ),
57905            TypeVariant::ScpHistoryEntry => Box::new(
57906                ReadXdrIter::<_, ScpHistoryEntry>::new(dec, r.limits.clone())
57907                    .map(|r| r.map(|t| Self::ScpHistoryEntry(Box::new(t)))),
57908            ),
57909            TypeVariant::LedgerEntryChangeType => Box::new(
57910                ReadXdrIter::<_, LedgerEntryChangeType>::new(dec, r.limits.clone())
57911                    .map(|r| r.map(|t| Self::LedgerEntryChangeType(Box::new(t)))),
57912            ),
57913            TypeVariant::LedgerEntryChange => Box::new(
57914                ReadXdrIter::<_, LedgerEntryChange>::new(dec, r.limits.clone())
57915                    .map(|r| r.map(|t| Self::LedgerEntryChange(Box::new(t)))),
57916            ),
57917            TypeVariant::LedgerEntryChanges => Box::new(
57918                ReadXdrIter::<_, LedgerEntryChanges>::new(dec, r.limits.clone())
57919                    .map(|r| r.map(|t| Self::LedgerEntryChanges(Box::new(t)))),
57920            ),
57921            TypeVariant::OperationMeta => Box::new(
57922                ReadXdrIter::<_, OperationMeta>::new(dec, r.limits.clone())
57923                    .map(|r| r.map(|t| Self::OperationMeta(Box::new(t)))),
57924            ),
57925            TypeVariant::TransactionMetaV1 => Box::new(
57926                ReadXdrIter::<_, TransactionMetaV1>::new(dec, r.limits.clone())
57927                    .map(|r| r.map(|t| Self::TransactionMetaV1(Box::new(t)))),
57928            ),
57929            TypeVariant::TransactionMetaV2 => Box::new(
57930                ReadXdrIter::<_, TransactionMetaV2>::new(dec, r.limits.clone())
57931                    .map(|r| r.map(|t| Self::TransactionMetaV2(Box::new(t)))),
57932            ),
57933            TypeVariant::ContractEventType => Box::new(
57934                ReadXdrIter::<_, ContractEventType>::new(dec, r.limits.clone())
57935                    .map(|r| r.map(|t| Self::ContractEventType(Box::new(t)))),
57936            ),
57937            TypeVariant::ContractEvent => Box::new(
57938                ReadXdrIter::<_, ContractEvent>::new(dec, r.limits.clone())
57939                    .map(|r| r.map(|t| Self::ContractEvent(Box::new(t)))),
57940            ),
57941            TypeVariant::ContractEventBody => Box::new(
57942                ReadXdrIter::<_, ContractEventBody>::new(dec, r.limits.clone())
57943                    .map(|r| r.map(|t| Self::ContractEventBody(Box::new(t)))),
57944            ),
57945            TypeVariant::ContractEventV0 => Box::new(
57946                ReadXdrIter::<_, ContractEventV0>::new(dec, r.limits.clone())
57947                    .map(|r| r.map(|t| Self::ContractEventV0(Box::new(t)))),
57948            ),
57949            TypeVariant::DiagnosticEvent => Box::new(
57950                ReadXdrIter::<_, DiagnosticEvent>::new(dec, r.limits.clone())
57951                    .map(|r| r.map(|t| Self::DiagnosticEvent(Box::new(t)))),
57952            ),
57953            TypeVariant::DiagnosticEvents => Box::new(
57954                ReadXdrIter::<_, DiagnosticEvents>::new(dec, r.limits.clone())
57955                    .map(|r| r.map(|t| Self::DiagnosticEvents(Box::new(t)))),
57956            ),
57957            TypeVariant::SorobanTransactionMetaExtV1 => Box::new(
57958                ReadXdrIter::<_, SorobanTransactionMetaExtV1>::new(dec, r.limits.clone())
57959                    .map(|r| r.map(|t| Self::SorobanTransactionMetaExtV1(Box::new(t)))),
57960            ),
57961            TypeVariant::SorobanTransactionMetaExt => Box::new(
57962                ReadXdrIter::<_, SorobanTransactionMetaExt>::new(dec, r.limits.clone())
57963                    .map(|r| r.map(|t| Self::SorobanTransactionMetaExt(Box::new(t)))),
57964            ),
57965            TypeVariant::SorobanTransactionMeta => Box::new(
57966                ReadXdrIter::<_, SorobanTransactionMeta>::new(dec, r.limits.clone())
57967                    .map(|r| r.map(|t| Self::SorobanTransactionMeta(Box::new(t)))),
57968            ),
57969            TypeVariant::TransactionMetaV3 => Box::new(
57970                ReadXdrIter::<_, TransactionMetaV3>::new(dec, r.limits.clone())
57971                    .map(|r| r.map(|t| Self::TransactionMetaV3(Box::new(t)))),
57972            ),
57973            TypeVariant::InvokeHostFunctionSuccessPreImage => Box::new(
57974                ReadXdrIter::<_, InvokeHostFunctionSuccessPreImage>::new(dec, r.limits.clone())
57975                    .map(|r| r.map(|t| Self::InvokeHostFunctionSuccessPreImage(Box::new(t)))),
57976            ),
57977            TypeVariant::TransactionMeta => Box::new(
57978                ReadXdrIter::<_, TransactionMeta>::new(dec, r.limits.clone())
57979                    .map(|r| r.map(|t| Self::TransactionMeta(Box::new(t)))),
57980            ),
57981            TypeVariant::TransactionResultMeta => Box::new(
57982                ReadXdrIter::<_, TransactionResultMeta>::new(dec, r.limits.clone())
57983                    .map(|r| r.map(|t| Self::TransactionResultMeta(Box::new(t)))),
57984            ),
57985            TypeVariant::UpgradeEntryMeta => Box::new(
57986                ReadXdrIter::<_, UpgradeEntryMeta>::new(dec, r.limits.clone())
57987                    .map(|r| r.map(|t| Self::UpgradeEntryMeta(Box::new(t)))),
57988            ),
57989            TypeVariant::LedgerCloseMetaV0 => Box::new(
57990                ReadXdrIter::<_, LedgerCloseMetaV0>::new(dec, r.limits.clone())
57991                    .map(|r| r.map(|t| Self::LedgerCloseMetaV0(Box::new(t)))),
57992            ),
57993            TypeVariant::LedgerCloseMetaExtV1 => Box::new(
57994                ReadXdrIter::<_, LedgerCloseMetaExtV1>::new(dec, r.limits.clone())
57995                    .map(|r| r.map(|t| Self::LedgerCloseMetaExtV1(Box::new(t)))),
57996            ),
57997            TypeVariant::LedgerCloseMetaExt => Box::new(
57998                ReadXdrIter::<_, LedgerCloseMetaExt>::new(dec, r.limits.clone())
57999                    .map(|r| r.map(|t| Self::LedgerCloseMetaExt(Box::new(t)))),
58000            ),
58001            TypeVariant::LedgerCloseMetaV1 => Box::new(
58002                ReadXdrIter::<_, LedgerCloseMetaV1>::new(dec, r.limits.clone())
58003                    .map(|r| r.map(|t| Self::LedgerCloseMetaV1(Box::new(t)))),
58004            ),
58005            TypeVariant::LedgerCloseMeta => Box::new(
58006                ReadXdrIter::<_, LedgerCloseMeta>::new(dec, r.limits.clone())
58007                    .map(|r| r.map(|t| Self::LedgerCloseMeta(Box::new(t)))),
58008            ),
58009            TypeVariant::ErrorCode => Box::new(
58010                ReadXdrIter::<_, ErrorCode>::new(dec, r.limits.clone())
58011                    .map(|r| r.map(|t| Self::ErrorCode(Box::new(t)))),
58012            ),
58013            TypeVariant::SError => Box::new(
58014                ReadXdrIter::<_, SError>::new(dec, r.limits.clone())
58015                    .map(|r| r.map(|t| Self::SError(Box::new(t)))),
58016            ),
58017            TypeVariant::SendMore => Box::new(
58018                ReadXdrIter::<_, SendMore>::new(dec, r.limits.clone())
58019                    .map(|r| r.map(|t| Self::SendMore(Box::new(t)))),
58020            ),
58021            TypeVariant::SendMoreExtended => Box::new(
58022                ReadXdrIter::<_, SendMoreExtended>::new(dec, r.limits.clone())
58023                    .map(|r| r.map(|t| Self::SendMoreExtended(Box::new(t)))),
58024            ),
58025            TypeVariant::AuthCert => Box::new(
58026                ReadXdrIter::<_, AuthCert>::new(dec, r.limits.clone())
58027                    .map(|r| r.map(|t| Self::AuthCert(Box::new(t)))),
58028            ),
58029            TypeVariant::Hello => Box::new(
58030                ReadXdrIter::<_, Hello>::new(dec, r.limits.clone())
58031                    .map(|r| r.map(|t| Self::Hello(Box::new(t)))),
58032            ),
58033            TypeVariant::Auth => Box::new(
58034                ReadXdrIter::<_, Auth>::new(dec, r.limits.clone())
58035                    .map(|r| r.map(|t| Self::Auth(Box::new(t)))),
58036            ),
58037            TypeVariant::IpAddrType => Box::new(
58038                ReadXdrIter::<_, IpAddrType>::new(dec, r.limits.clone())
58039                    .map(|r| r.map(|t| Self::IpAddrType(Box::new(t)))),
58040            ),
58041            TypeVariant::PeerAddress => Box::new(
58042                ReadXdrIter::<_, PeerAddress>::new(dec, r.limits.clone())
58043                    .map(|r| r.map(|t| Self::PeerAddress(Box::new(t)))),
58044            ),
58045            TypeVariant::PeerAddressIp => Box::new(
58046                ReadXdrIter::<_, PeerAddressIp>::new(dec, r.limits.clone())
58047                    .map(|r| r.map(|t| Self::PeerAddressIp(Box::new(t)))),
58048            ),
58049            TypeVariant::MessageType => Box::new(
58050                ReadXdrIter::<_, MessageType>::new(dec, r.limits.clone())
58051                    .map(|r| r.map(|t| Self::MessageType(Box::new(t)))),
58052            ),
58053            TypeVariant::DontHave => Box::new(
58054                ReadXdrIter::<_, DontHave>::new(dec, r.limits.clone())
58055                    .map(|r| r.map(|t| Self::DontHave(Box::new(t)))),
58056            ),
58057            TypeVariant::SurveyMessageCommandType => Box::new(
58058                ReadXdrIter::<_, SurveyMessageCommandType>::new(dec, r.limits.clone())
58059                    .map(|r| r.map(|t| Self::SurveyMessageCommandType(Box::new(t)))),
58060            ),
58061            TypeVariant::SurveyMessageResponseType => Box::new(
58062                ReadXdrIter::<_, SurveyMessageResponseType>::new(dec, r.limits.clone())
58063                    .map(|r| r.map(|t| Self::SurveyMessageResponseType(Box::new(t)))),
58064            ),
58065            TypeVariant::TimeSlicedSurveyStartCollectingMessage => Box::new(
58066                ReadXdrIter::<_, TimeSlicedSurveyStartCollectingMessage>::new(
58067                    dec,
58068                    r.limits.clone(),
58069                )
58070                .map(|r| r.map(|t| Self::TimeSlicedSurveyStartCollectingMessage(Box::new(t)))),
58071            ),
58072            TypeVariant::SignedTimeSlicedSurveyStartCollectingMessage => Box::new(
58073                ReadXdrIter::<_, SignedTimeSlicedSurveyStartCollectingMessage>::new(
58074                    dec,
58075                    r.limits.clone(),
58076                )
58077                .map(|r| {
58078                    r.map(|t| Self::SignedTimeSlicedSurveyStartCollectingMessage(Box::new(t)))
58079                }),
58080            ),
58081            TypeVariant::TimeSlicedSurveyStopCollectingMessage => Box::new(
58082                ReadXdrIter::<_, TimeSlicedSurveyStopCollectingMessage>::new(dec, r.limits.clone())
58083                    .map(|r| r.map(|t| Self::TimeSlicedSurveyStopCollectingMessage(Box::new(t)))),
58084            ),
58085            TypeVariant::SignedTimeSlicedSurveyStopCollectingMessage => Box::new(
58086                ReadXdrIter::<_, SignedTimeSlicedSurveyStopCollectingMessage>::new(
58087                    dec,
58088                    r.limits.clone(),
58089                )
58090                .map(|r| r.map(|t| Self::SignedTimeSlicedSurveyStopCollectingMessage(Box::new(t)))),
58091            ),
58092            TypeVariant::SurveyRequestMessage => Box::new(
58093                ReadXdrIter::<_, SurveyRequestMessage>::new(dec, r.limits.clone())
58094                    .map(|r| r.map(|t| Self::SurveyRequestMessage(Box::new(t)))),
58095            ),
58096            TypeVariant::TimeSlicedSurveyRequestMessage => Box::new(
58097                ReadXdrIter::<_, TimeSlicedSurveyRequestMessage>::new(dec, r.limits.clone())
58098                    .map(|r| r.map(|t| Self::TimeSlicedSurveyRequestMessage(Box::new(t)))),
58099            ),
58100            TypeVariant::SignedSurveyRequestMessage => Box::new(
58101                ReadXdrIter::<_, SignedSurveyRequestMessage>::new(dec, r.limits.clone())
58102                    .map(|r| r.map(|t| Self::SignedSurveyRequestMessage(Box::new(t)))),
58103            ),
58104            TypeVariant::SignedTimeSlicedSurveyRequestMessage => Box::new(
58105                ReadXdrIter::<_, SignedTimeSlicedSurveyRequestMessage>::new(dec, r.limits.clone())
58106                    .map(|r| r.map(|t| Self::SignedTimeSlicedSurveyRequestMessage(Box::new(t)))),
58107            ),
58108            TypeVariant::EncryptedBody => Box::new(
58109                ReadXdrIter::<_, EncryptedBody>::new(dec, r.limits.clone())
58110                    .map(|r| r.map(|t| Self::EncryptedBody(Box::new(t)))),
58111            ),
58112            TypeVariant::SurveyResponseMessage => Box::new(
58113                ReadXdrIter::<_, SurveyResponseMessage>::new(dec, r.limits.clone())
58114                    .map(|r| r.map(|t| Self::SurveyResponseMessage(Box::new(t)))),
58115            ),
58116            TypeVariant::TimeSlicedSurveyResponseMessage => Box::new(
58117                ReadXdrIter::<_, TimeSlicedSurveyResponseMessage>::new(dec, r.limits.clone())
58118                    .map(|r| r.map(|t| Self::TimeSlicedSurveyResponseMessage(Box::new(t)))),
58119            ),
58120            TypeVariant::SignedSurveyResponseMessage => Box::new(
58121                ReadXdrIter::<_, SignedSurveyResponseMessage>::new(dec, r.limits.clone())
58122                    .map(|r| r.map(|t| Self::SignedSurveyResponseMessage(Box::new(t)))),
58123            ),
58124            TypeVariant::SignedTimeSlicedSurveyResponseMessage => Box::new(
58125                ReadXdrIter::<_, SignedTimeSlicedSurveyResponseMessage>::new(dec, r.limits.clone())
58126                    .map(|r| r.map(|t| Self::SignedTimeSlicedSurveyResponseMessage(Box::new(t)))),
58127            ),
58128            TypeVariant::PeerStats => Box::new(
58129                ReadXdrIter::<_, PeerStats>::new(dec, r.limits.clone())
58130                    .map(|r| r.map(|t| Self::PeerStats(Box::new(t)))),
58131            ),
58132            TypeVariant::PeerStatList => Box::new(
58133                ReadXdrIter::<_, PeerStatList>::new(dec, r.limits.clone())
58134                    .map(|r| r.map(|t| Self::PeerStatList(Box::new(t)))),
58135            ),
58136            TypeVariant::TimeSlicedNodeData => Box::new(
58137                ReadXdrIter::<_, TimeSlicedNodeData>::new(dec, r.limits.clone())
58138                    .map(|r| r.map(|t| Self::TimeSlicedNodeData(Box::new(t)))),
58139            ),
58140            TypeVariant::TimeSlicedPeerData => Box::new(
58141                ReadXdrIter::<_, TimeSlicedPeerData>::new(dec, r.limits.clone())
58142                    .map(|r| r.map(|t| Self::TimeSlicedPeerData(Box::new(t)))),
58143            ),
58144            TypeVariant::TimeSlicedPeerDataList => Box::new(
58145                ReadXdrIter::<_, TimeSlicedPeerDataList>::new(dec, r.limits.clone())
58146                    .map(|r| r.map(|t| Self::TimeSlicedPeerDataList(Box::new(t)))),
58147            ),
58148            TypeVariant::TopologyResponseBodyV0 => Box::new(
58149                ReadXdrIter::<_, TopologyResponseBodyV0>::new(dec, r.limits.clone())
58150                    .map(|r| r.map(|t| Self::TopologyResponseBodyV0(Box::new(t)))),
58151            ),
58152            TypeVariant::TopologyResponseBodyV1 => Box::new(
58153                ReadXdrIter::<_, TopologyResponseBodyV1>::new(dec, r.limits.clone())
58154                    .map(|r| r.map(|t| Self::TopologyResponseBodyV1(Box::new(t)))),
58155            ),
58156            TypeVariant::TopologyResponseBodyV2 => Box::new(
58157                ReadXdrIter::<_, TopologyResponseBodyV2>::new(dec, r.limits.clone())
58158                    .map(|r| r.map(|t| Self::TopologyResponseBodyV2(Box::new(t)))),
58159            ),
58160            TypeVariant::SurveyResponseBody => Box::new(
58161                ReadXdrIter::<_, SurveyResponseBody>::new(dec, r.limits.clone())
58162                    .map(|r| r.map(|t| Self::SurveyResponseBody(Box::new(t)))),
58163            ),
58164            TypeVariant::TxAdvertVector => Box::new(
58165                ReadXdrIter::<_, TxAdvertVector>::new(dec, r.limits.clone())
58166                    .map(|r| r.map(|t| Self::TxAdvertVector(Box::new(t)))),
58167            ),
58168            TypeVariant::FloodAdvert => Box::new(
58169                ReadXdrIter::<_, FloodAdvert>::new(dec, r.limits.clone())
58170                    .map(|r| r.map(|t| Self::FloodAdvert(Box::new(t)))),
58171            ),
58172            TypeVariant::TxDemandVector => Box::new(
58173                ReadXdrIter::<_, TxDemandVector>::new(dec, r.limits.clone())
58174                    .map(|r| r.map(|t| Self::TxDemandVector(Box::new(t)))),
58175            ),
58176            TypeVariant::FloodDemand => Box::new(
58177                ReadXdrIter::<_, FloodDemand>::new(dec, r.limits.clone())
58178                    .map(|r| r.map(|t| Self::FloodDemand(Box::new(t)))),
58179            ),
58180            TypeVariant::StellarMessage => Box::new(
58181                ReadXdrIter::<_, StellarMessage>::new(dec, r.limits.clone())
58182                    .map(|r| r.map(|t| Self::StellarMessage(Box::new(t)))),
58183            ),
58184            TypeVariant::AuthenticatedMessage => Box::new(
58185                ReadXdrIter::<_, AuthenticatedMessage>::new(dec, r.limits.clone())
58186                    .map(|r| r.map(|t| Self::AuthenticatedMessage(Box::new(t)))),
58187            ),
58188            TypeVariant::AuthenticatedMessageV0 => Box::new(
58189                ReadXdrIter::<_, AuthenticatedMessageV0>::new(dec, r.limits.clone())
58190                    .map(|r| r.map(|t| Self::AuthenticatedMessageV0(Box::new(t)))),
58191            ),
58192            TypeVariant::LiquidityPoolParameters => Box::new(
58193                ReadXdrIter::<_, LiquidityPoolParameters>::new(dec, r.limits.clone())
58194                    .map(|r| r.map(|t| Self::LiquidityPoolParameters(Box::new(t)))),
58195            ),
58196            TypeVariant::MuxedAccount => Box::new(
58197                ReadXdrIter::<_, MuxedAccount>::new(dec, r.limits.clone())
58198                    .map(|r| r.map(|t| Self::MuxedAccount(Box::new(t)))),
58199            ),
58200            TypeVariant::MuxedAccountMed25519 => Box::new(
58201                ReadXdrIter::<_, MuxedAccountMed25519>::new(dec, r.limits.clone())
58202                    .map(|r| r.map(|t| Self::MuxedAccountMed25519(Box::new(t)))),
58203            ),
58204            TypeVariant::DecoratedSignature => Box::new(
58205                ReadXdrIter::<_, DecoratedSignature>::new(dec, r.limits.clone())
58206                    .map(|r| r.map(|t| Self::DecoratedSignature(Box::new(t)))),
58207            ),
58208            TypeVariant::OperationType => Box::new(
58209                ReadXdrIter::<_, OperationType>::new(dec, r.limits.clone())
58210                    .map(|r| r.map(|t| Self::OperationType(Box::new(t)))),
58211            ),
58212            TypeVariant::CreateAccountOp => Box::new(
58213                ReadXdrIter::<_, CreateAccountOp>::new(dec, r.limits.clone())
58214                    .map(|r| r.map(|t| Self::CreateAccountOp(Box::new(t)))),
58215            ),
58216            TypeVariant::PaymentOp => Box::new(
58217                ReadXdrIter::<_, PaymentOp>::new(dec, r.limits.clone())
58218                    .map(|r| r.map(|t| Self::PaymentOp(Box::new(t)))),
58219            ),
58220            TypeVariant::PathPaymentStrictReceiveOp => Box::new(
58221                ReadXdrIter::<_, PathPaymentStrictReceiveOp>::new(dec, r.limits.clone())
58222                    .map(|r| r.map(|t| Self::PathPaymentStrictReceiveOp(Box::new(t)))),
58223            ),
58224            TypeVariant::PathPaymentStrictSendOp => Box::new(
58225                ReadXdrIter::<_, PathPaymentStrictSendOp>::new(dec, r.limits.clone())
58226                    .map(|r| r.map(|t| Self::PathPaymentStrictSendOp(Box::new(t)))),
58227            ),
58228            TypeVariant::ManageSellOfferOp => Box::new(
58229                ReadXdrIter::<_, ManageSellOfferOp>::new(dec, r.limits.clone())
58230                    .map(|r| r.map(|t| Self::ManageSellOfferOp(Box::new(t)))),
58231            ),
58232            TypeVariant::ManageBuyOfferOp => Box::new(
58233                ReadXdrIter::<_, ManageBuyOfferOp>::new(dec, r.limits.clone())
58234                    .map(|r| r.map(|t| Self::ManageBuyOfferOp(Box::new(t)))),
58235            ),
58236            TypeVariant::CreatePassiveSellOfferOp => Box::new(
58237                ReadXdrIter::<_, CreatePassiveSellOfferOp>::new(dec, r.limits.clone())
58238                    .map(|r| r.map(|t| Self::CreatePassiveSellOfferOp(Box::new(t)))),
58239            ),
58240            TypeVariant::SetOptionsOp => Box::new(
58241                ReadXdrIter::<_, SetOptionsOp>::new(dec, r.limits.clone())
58242                    .map(|r| r.map(|t| Self::SetOptionsOp(Box::new(t)))),
58243            ),
58244            TypeVariant::ChangeTrustAsset => Box::new(
58245                ReadXdrIter::<_, ChangeTrustAsset>::new(dec, r.limits.clone())
58246                    .map(|r| r.map(|t| Self::ChangeTrustAsset(Box::new(t)))),
58247            ),
58248            TypeVariant::ChangeTrustOp => Box::new(
58249                ReadXdrIter::<_, ChangeTrustOp>::new(dec, r.limits.clone())
58250                    .map(|r| r.map(|t| Self::ChangeTrustOp(Box::new(t)))),
58251            ),
58252            TypeVariant::AllowTrustOp => Box::new(
58253                ReadXdrIter::<_, AllowTrustOp>::new(dec, r.limits.clone())
58254                    .map(|r| r.map(|t| Self::AllowTrustOp(Box::new(t)))),
58255            ),
58256            TypeVariant::ManageDataOp => Box::new(
58257                ReadXdrIter::<_, ManageDataOp>::new(dec, r.limits.clone())
58258                    .map(|r| r.map(|t| Self::ManageDataOp(Box::new(t)))),
58259            ),
58260            TypeVariant::BumpSequenceOp => Box::new(
58261                ReadXdrIter::<_, BumpSequenceOp>::new(dec, r.limits.clone())
58262                    .map(|r| r.map(|t| Self::BumpSequenceOp(Box::new(t)))),
58263            ),
58264            TypeVariant::CreateClaimableBalanceOp => Box::new(
58265                ReadXdrIter::<_, CreateClaimableBalanceOp>::new(dec, r.limits.clone())
58266                    .map(|r| r.map(|t| Self::CreateClaimableBalanceOp(Box::new(t)))),
58267            ),
58268            TypeVariant::ClaimClaimableBalanceOp => Box::new(
58269                ReadXdrIter::<_, ClaimClaimableBalanceOp>::new(dec, r.limits.clone())
58270                    .map(|r| r.map(|t| Self::ClaimClaimableBalanceOp(Box::new(t)))),
58271            ),
58272            TypeVariant::BeginSponsoringFutureReservesOp => Box::new(
58273                ReadXdrIter::<_, BeginSponsoringFutureReservesOp>::new(dec, r.limits.clone())
58274                    .map(|r| r.map(|t| Self::BeginSponsoringFutureReservesOp(Box::new(t)))),
58275            ),
58276            TypeVariant::RevokeSponsorshipType => Box::new(
58277                ReadXdrIter::<_, RevokeSponsorshipType>::new(dec, r.limits.clone())
58278                    .map(|r| r.map(|t| Self::RevokeSponsorshipType(Box::new(t)))),
58279            ),
58280            TypeVariant::RevokeSponsorshipOp => Box::new(
58281                ReadXdrIter::<_, RevokeSponsorshipOp>::new(dec, r.limits.clone())
58282                    .map(|r| r.map(|t| Self::RevokeSponsorshipOp(Box::new(t)))),
58283            ),
58284            TypeVariant::RevokeSponsorshipOpSigner => Box::new(
58285                ReadXdrIter::<_, RevokeSponsorshipOpSigner>::new(dec, r.limits.clone())
58286                    .map(|r| r.map(|t| Self::RevokeSponsorshipOpSigner(Box::new(t)))),
58287            ),
58288            TypeVariant::ClawbackOp => Box::new(
58289                ReadXdrIter::<_, ClawbackOp>::new(dec, r.limits.clone())
58290                    .map(|r| r.map(|t| Self::ClawbackOp(Box::new(t)))),
58291            ),
58292            TypeVariant::ClawbackClaimableBalanceOp => Box::new(
58293                ReadXdrIter::<_, ClawbackClaimableBalanceOp>::new(dec, r.limits.clone())
58294                    .map(|r| r.map(|t| Self::ClawbackClaimableBalanceOp(Box::new(t)))),
58295            ),
58296            TypeVariant::SetTrustLineFlagsOp => Box::new(
58297                ReadXdrIter::<_, SetTrustLineFlagsOp>::new(dec, r.limits.clone())
58298                    .map(|r| r.map(|t| Self::SetTrustLineFlagsOp(Box::new(t)))),
58299            ),
58300            TypeVariant::LiquidityPoolDepositOp => Box::new(
58301                ReadXdrIter::<_, LiquidityPoolDepositOp>::new(dec, r.limits.clone())
58302                    .map(|r| r.map(|t| Self::LiquidityPoolDepositOp(Box::new(t)))),
58303            ),
58304            TypeVariant::LiquidityPoolWithdrawOp => Box::new(
58305                ReadXdrIter::<_, LiquidityPoolWithdrawOp>::new(dec, r.limits.clone())
58306                    .map(|r| r.map(|t| Self::LiquidityPoolWithdrawOp(Box::new(t)))),
58307            ),
58308            TypeVariant::HostFunctionType => Box::new(
58309                ReadXdrIter::<_, HostFunctionType>::new(dec, r.limits.clone())
58310                    .map(|r| r.map(|t| Self::HostFunctionType(Box::new(t)))),
58311            ),
58312            TypeVariant::ContractIdPreimageType => Box::new(
58313                ReadXdrIter::<_, ContractIdPreimageType>::new(dec, r.limits.clone())
58314                    .map(|r| r.map(|t| Self::ContractIdPreimageType(Box::new(t)))),
58315            ),
58316            TypeVariant::ContractIdPreimage => Box::new(
58317                ReadXdrIter::<_, ContractIdPreimage>::new(dec, r.limits.clone())
58318                    .map(|r| r.map(|t| Self::ContractIdPreimage(Box::new(t)))),
58319            ),
58320            TypeVariant::ContractIdPreimageFromAddress => Box::new(
58321                ReadXdrIter::<_, ContractIdPreimageFromAddress>::new(dec, r.limits.clone())
58322                    .map(|r| r.map(|t| Self::ContractIdPreimageFromAddress(Box::new(t)))),
58323            ),
58324            TypeVariant::CreateContractArgs => Box::new(
58325                ReadXdrIter::<_, CreateContractArgs>::new(dec, r.limits.clone())
58326                    .map(|r| r.map(|t| Self::CreateContractArgs(Box::new(t)))),
58327            ),
58328            TypeVariant::CreateContractArgsV2 => Box::new(
58329                ReadXdrIter::<_, CreateContractArgsV2>::new(dec, r.limits.clone())
58330                    .map(|r| r.map(|t| Self::CreateContractArgsV2(Box::new(t)))),
58331            ),
58332            TypeVariant::InvokeContractArgs => Box::new(
58333                ReadXdrIter::<_, InvokeContractArgs>::new(dec, r.limits.clone())
58334                    .map(|r| r.map(|t| Self::InvokeContractArgs(Box::new(t)))),
58335            ),
58336            TypeVariant::HostFunction => Box::new(
58337                ReadXdrIter::<_, HostFunction>::new(dec, r.limits.clone())
58338                    .map(|r| r.map(|t| Self::HostFunction(Box::new(t)))),
58339            ),
58340            TypeVariant::SorobanAuthorizedFunctionType => Box::new(
58341                ReadXdrIter::<_, SorobanAuthorizedFunctionType>::new(dec, r.limits.clone())
58342                    .map(|r| r.map(|t| Self::SorobanAuthorizedFunctionType(Box::new(t)))),
58343            ),
58344            TypeVariant::SorobanAuthorizedFunction => Box::new(
58345                ReadXdrIter::<_, SorobanAuthorizedFunction>::new(dec, r.limits.clone())
58346                    .map(|r| r.map(|t| Self::SorobanAuthorizedFunction(Box::new(t)))),
58347            ),
58348            TypeVariant::SorobanAuthorizedInvocation => Box::new(
58349                ReadXdrIter::<_, SorobanAuthorizedInvocation>::new(dec, r.limits.clone())
58350                    .map(|r| r.map(|t| Self::SorobanAuthorizedInvocation(Box::new(t)))),
58351            ),
58352            TypeVariant::SorobanAddressCredentials => Box::new(
58353                ReadXdrIter::<_, SorobanAddressCredentials>::new(dec, r.limits.clone())
58354                    .map(|r| r.map(|t| Self::SorobanAddressCredentials(Box::new(t)))),
58355            ),
58356            TypeVariant::SorobanCredentialsType => Box::new(
58357                ReadXdrIter::<_, SorobanCredentialsType>::new(dec, r.limits.clone())
58358                    .map(|r| r.map(|t| Self::SorobanCredentialsType(Box::new(t)))),
58359            ),
58360            TypeVariant::SorobanCredentials => Box::new(
58361                ReadXdrIter::<_, SorobanCredentials>::new(dec, r.limits.clone())
58362                    .map(|r| r.map(|t| Self::SorobanCredentials(Box::new(t)))),
58363            ),
58364            TypeVariant::SorobanAuthorizationEntry => Box::new(
58365                ReadXdrIter::<_, SorobanAuthorizationEntry>::new(dec, r.limits.clone())
58366                    .map(|r| r.map(|t| Self::SorobanAuthorizationEntry(Box::new(t)))),
58367            ),
58368            TypeVariant::InvokeHostFunctionOp => Box::new(
58369                ReadXdrIter::<_, InvokeHostFunctionOp>::new(dec, r.limits.clone())
58370                    .map(|r| r.map(|t| Self::InvokeHostFunctionOp(Box::new(t)))),
58371            ),
58372            TypeVariant::ExtendFootprintTtlOp => Box::new(
58373                ReadXdrIter::<_, ExtendFootprintTtlOp>::new(dec, r.limits.clone())
58374                    .map(|r| r.map(|t| Self::ExtendFootprintTtlOp(Box::new(t)))),
58375            ),
58376            TypeVariant::RestoreFootprintOp => Box::new(
58377                ReadXdrIter::<_, RestoreFootprintOp>::new(dec, r.limits.clone())
58378                    .map(|r| r.map(|t| Self::RestoreFootprintOp(Box::new(t)))),
58379            ),
58380            TypeVariant::Operation => Box::new(
58381                ReadXdrIter::<_, Operation>::new(dec, r.limits.clone())
58382                    .map(|r| r.map(|t| Self::Operation(Box::new(t)))),
58383            ),
58384            TypeVariant::OperationBody => Box::new(
58385                ReadXdrIter::<_, OperationBody>::new(dec, r.limits.clone())
58386                    .map(|r| r.map(|t| Self::OperationBody(Box::new(t)))),
58387            ),
58388            TypeVariant::HashIdPreimage => Box::new(
58389                ReadXdrIter::<_, HashIdPreimage>::new(dec, r.limits.clone())
58390                    .map(|r| r.map(|t| Self::HashIdPreimage(Box::new(t)))),
58391            ),
58392            TypeVariant::HashIdPreimageOperationId => Box::new(
58393                ReadXdrIter::<_, HashIdPreimageOperationId>::new(dec, r.limits.clone())
58394                    .map(|r| r.map(|t| Self::HashIdPreimageOperationId(Box::new(t)))),
58395            ),
58396            TypeVariant::HashIdPreimageRevokeId => Box::new(
58397                ReadXdrIter::<_, HashIdPreimageRevokeId>::new(dec, r.limits.clone())
58398                    .map(|r| r.map(|t| Self::HashIdPreimageRevokeId(Box::new(t)))),
58399            ),
58400            TypeVariant::HashIdPreimageContractId => Box::new(
58401                ReadXdrIter::<_, HashIdPreimageContractId>::new(dec, r.limits.clone())
58402                    .map(|r| r.map(|t| Self::HashIdPreimageContractId(Box::new(t)))),
58403            ),
58404            TypeVariant::HashIdPreimageSorobanAuthorization => Box::new(
58405                ReadXdrIter::<_, HashIdPreimageSorobanAuthorization>::new(dec, r.limits.clone())
58406                    .map(|r| r.map(|t| Self::HashIdPreimageSorobanAuthorization(Box::new(t)))),
58407            ),
58408            TypeVariant::MemoType => Box::new(
58409                ReadXdrIter::<_, MemoType>::new(dec, r.limits.clone())
58410                    .map(|r| r.map(|t| Self::MemoType(Box::new(t)))),
58411            ),
58412            TypeVariant::Memo => Box::new(
58413                ReadXdrIter::<_, Memo>::new(dec, r.limits.clone())
58414                    .map(|r| r.map(|t| Self::Memo(Box::new(t)))),
58415            ),
58416            TypeVariant::TimeBounds => Box::new(
58417                ReadXdrIter::<_, TimeBounds>::new(dec, r.limits.clone())
58418                    .map(|r| r.map(|t| Self::TimeBounds(Box::new(t)))),
58419            ),
58420            TypeVariant::LedgerBounds => Box::new(
58421                ReadXdrIter::<_, LedgerBounds>::new(dec, r.limits.clone())
58422                    .map(|r| r.map(|t| Self::LedgerBounds(Box::new(t)))),
58423            ),
58424            TypeVariant::PreconditionsV2 => Box::new(
58425                ReadXdrIter::<_, PreconditionsV2>::new(dec, r.limits.clone())
58426                    .map(|r| r.map(|t| Self::PreconditionsV2(Box::new(t)))),
58427            ),
58428            TypeVariant::PreconditionType => Box::new(
58429                ReadXdrIter::<_, PreconditionType>::new(dec, r.limits.clone())
58430                    .map(|r| r.map(|t| Self::PreconditionType(Box::new(t)))),
58431            ),
58432            TypeVariant::Preconditions => Box::new(
58433                ReadXdrIter::<_, Preconditions>::new(dec, r.limits.clone())
58434                    .map(|r| r.map(|t| Self::Preconditions(Box::new(t)))),
58435            ),
58436            TypeVariant::LedgerFootprint => Box::new(
58437                ReadXdrIter::<_, LedgerFootprint>::new(dec, r.limits.clone())
58438                    .map(|r| r.map(|t| Self::LedgerFootprint(Box::new(t)))),
58439            ),
58440            TypeVariant::ArchivalProofType => Box::new(
58441                ReadXdrIter::<_, ArchivalProofType>::new(dec, r.limits.clone())
58442                    .map(|r| r.map(|t| Self::ArchivalProofType(Box::new(t)))),
58443            ),
58444            TypeVariant::ArchivalProofNode => Box::new(
58445                ReadXdrIter::<_, ArchivalProofNode>::new(dec, r.limits.clone())
58446                    .map(|r| r.map(|t| Self::ArchivalProofNode(Box::new(t)))),
58447            ),
58448            TypeVariant::ProofLevel => Box::new(
58449                ReadXdrIter::<_, ProofLevel>::new(dec, r.limits.clone())
58450                    .map(|r| r.map(|t| Self::ProofLevel(Box::new(t)))),
58451            ),
58452            TypeVariant::NonexistenceProofBody => Box::new(
58453                ReadXdrIter::<_, NonexistenceProofBody>::new(dec, r.limits.clone())
58454                    .map(|r| r.map(|t| Self::NonexistenceProofBody(Box::new(t)))),
58455            ),
58456            TypeVariant::ExistenceProofBody => Box::new(
58457                ReadXdrIter::<_, ExistenceProofBody>::new(dec, r.limits.clone())
58458                    .map(|r| r.map(|t| Self::ExistenceProofBody(Box::new(t)))),
58459            ),
58460            TypeVariant::ArchivalProof => Box::new(
58461                ReadXdrIter::<_, ArchivalProof>::new(dec, r.limits.clone())
58462                    .map(|r| r.map(|t| Self::ArchivalProof(Box::new(t)))),
58463            ),
58464            TypeVariant::ArchivalProofBody => Box::new(
58465                ReadXdrIter::<_, ArchivalProofBody>::new(dec, r.limits.clone())
58466                    .map(|r| r.map(|t| Self::ArchivalProofBody(Box::new(t)))),
58467            ),
58468            TypeVariant::SorobanResources => Box::new(
58469                ReadXdrIter::<_, SorobanResources>::new(dec, r.limits.clone())
58470                    .map(|r| r.map(|t| Self::SorobanResources(Box::new(t)))),
58471            ),
58472            TypeVariant::SorobanTransactionData => Box::new(
58473                ReadXdrIter::<_, SorobanTransactionData>::new(dec, r.limits.clone())
58474                    .map(|r| r.map(|t| Self::SorobanTransactionData(Box::new(t)))),
58475            ),
58476            TypeVariant::TransactionV0 => Box::new(
58477                ReadXdrIter::<_, TransactionV0>::new(dec, r.limits.clone())
58478                    .map(|r| r.map(|t| Self::TransactionV0(Box::new(t)))),
58479            ),
58480            TypeVariant::TransactionV0Ext => Box::new(
58481                ReadXdrIter::<_, TransactionV0Ext>::new(dec, r.limits.clone())
58482                    .map(|r| r.map(|t| Self::TransactionV0Ext(Box::new(t)))),
58483            ),
58484            TypeVariant::TransactionV0Envelope => Box::new(
58485                ReadXdrIter::<_, TransactionV0Envelope>::new(dec, r.limits.clone())
58486                    .map(|r| r.map(|t| Self::TransactionV0Envelope(Box::new(t)))),
58487            ),
58488            TypeVariant::Transaction => Box::new(
58489                ReadXdrIter::<_, Transaction>::new(dec, r.limits.clone())
58490                    .map(|r| r.map(|t| Self::Transaction(Box::new(t)))),
58491            ),
58492            TypeVariant::TransactionExt => Box::new(
58493                ReadXdrIter::<_, TransactionExt>::new(dec, r.limits.clone())
58494                    .map(|r| r.map(|t| Self::TransactionExt(Box::new(t)))),
58495            ),
58496            TypeVariant::TransactionV1Envelope => Box::new(
58497                ReadXdrIter::<_, TransactionV1Envelope>::new(dec, r.limits.clone())
58498                    .map(|r| r.map(|t| Self::TransactionV1Envelope(Box::new(t)))),
58499            ),
58500            TypeVariant::FeeBumpTransaction => Box::new(
58501                ReadXdrIter::<_, FeeBumpTransaction>::new(dec, r.limits.clone())
58502                    .map(|r| r.map(|t| Self::FeeBumpTransaction(Box::new(t)))),
58503            ),
58504            TypeVariant::FeeBumpTransactionInnerTx => Box::new(
58505                ReadXdrIter::<_, FeeBumpTransactionInnerTx>::new(dec, r.limits.clone())
58506                    .map(|r| r.map(|t| Self::FeeBumpTransactionInnerTx(Box::new(t)))),
58507            ),
58508            TypeVariant::FeeBumpTransactionExt => Box::new(
58509                ReadXdrIter::<_, FeeBumpTransactionExt>::new(dec, r.limits.clone())
58510                    .map(|r| r.map(|t| Self::FeeBumpTransactionExt(Box::new(t)))),
58511            ),
58512            TypeVariant::FeeBumpTransactionEnvelope => Box::new(
58513                ReadXdrIter::<_, FeeBumpTransactionEnvelope>::new(dec, r.limits.clone())
58514                    .map(|r| r.map(|t| Self::FeeBumpTransactionEnvelope(Box::new(t)))),
58515            ),
58516            TypeVariant::TransactionEnvelope => Box::new(
58517                ReadXdrIter::<_, TransactionEnvelope>::new(dec, r.limits.clone())
58518                    .map(|r| r.map(|t| Self::TransactionEnvelope(Box::new(t)))),
58519            ),
58520            TypeVariant::TransactionSignaturePayload => Box::new(
58521                ReadXdrIter::<_, TransactionSignaturePayload>::new(dec, r.limits.clone())
58522                    .map(|r| r.map(|t| Self::TransactionSignaturePayload(Box::new(t)))),
58523            ),
58524            TypeVariant::TransactionSignaturePayloadTaggedTransaction => Box::new(
58525                ReadXdrIter::<_, TransactionSignaturePayloadTaggedTransaction>::new(
58526                    dec,
58527                    r.limits.clone(),
58528                )
58529                .map(|r| {
58530                    r.map(|t| Self::TransactionSignaturePayloadTaggedTransaction(Box::new(t)))
58531                }),
58532            ),
58533            TypeVariant::ClaimAtomType => Box::new(
58534                ReadXdrIter::<_, ClaimAtomType>::new(dec, r.limits.clone())
58535                    .map(|r| r.map(|t| Self::ClaimAtomType(Box::new(t)))),
58536            ),
58537            TypeVariant::ClaimOfferAtomV0 => Box::new(
58538                ReadXdrIter::<_, ClaimOfferAtomV0>::new(dec, r.limits.clone())
58539                    .map(|r| r.map(|t| Self::ClaimOfferAtomV0(Box::new(t)))),
58540            ),
58541            TypeVariant::ClaimOfferAtom => Box::new(
58542                ReadXdrIter::<_, ClaimOfferAtom>::new(dec, r.limits.clone())
58543                    .map(|r| r.map(|t| Self::ClaimOfferAtom(Box::new(t)))),
58544            ),
58545            TypeVariant::ClaimLiquidityAtom => Box::new(
58546                ReadXdrIter::<_, ClaimLiquidityAtom>::new(dec, r.limits.clone())
58547                    .map(|r| r.map(|t| Self::ClaimLiquidityAtom(Box::new(t)))),
58548            ),
58549            TypeVariant::ClaimAtom => Box::new(
58550                ReadXdrIter::<_, ClaimAtom>::new(dec, r.limits.clone())
58551                    .map(|r| r.map(|t| Self::ClaimAtom(Box::new(t)))),
58552            ),
58553            TypeVariant::CreateAccountResultCode => Box::new(
58554                ReadXdrIter::<_, CreateAccountResultCode>::new(dec, r.limits.clone())
58555                    .map(|r| r.map(|t| Self::CreateAccountResultCode(Box::new(t)))),
58556            ),
58557            TypeVariant::CreateAccountResult => Box::new(
58558                ReadXdrIter::<_, CreateAccountResult>::new(dec, r.limits.clone())
58559                    .map(|r| r.map(|t| Self::CreateAccountResult(Box::new(t)))),
58560            ),
58561            TypeVariant::PaymentResultCode => Box::new(
58562                ReadXdrIter::<_, PaymentResultCode>::new(dec, r.limits.clone())
58563                    .map(|r| r.map(|t| Self::PaymentResultCode(Box::new(t)))),
58564            ),
58565            TypeVariant::PaymentResult => Box::new(
58566                ReadXdrIter::<_, PaymentResult>::new(dec, r.limits.clone())
58567                    .map(|r| r.map(|t| Self::PaymentResult(Box::new(t)))),
58568            ),
58569            TypeVariant::PathPaymentStrictReceiveResultCode => Box::new(
58570                ReadXdrIter::<_, PathPaymentStrictReceiveResultCode>::new(dec, r.limits.clone())
58571                    .map(|r| r.map(|t| Self::PathPaymentStrictReceiveResultCode(Box::new(t)))),
58572            ),
58573            TypeVariant::SimplePaymentResult => Box::new(
58574                ReadXdrIter::<_, SimplePaymentResult>::new(dec, r.limits.clone())
58575                    .map(|r| r.map(|t| Self::SimplePaymentResult(Box::new(t)))),
58576            ),
58577            TypeVariant::PathPaymentStrictReceiveResult => Box::new(
58578                ReadXdrIter::<_, PathPaymentStrictReceiveResult>::new(dec, r.limits.clone())
58579                    .map(|r| r.map(|t| Self::PathPaymentStrictReceiveResult(Box::new(t)))),
58580            ),
58581            TypeVariant::PathPaymentStrictReceiveResultSuccess => Box::new(
58582                ReadXdrIter::<_, PathPaymentStrictReceiveResultSuccess>::new(dec, r.limits.clone())
58583                    .map(|r| r.map(|t| Self::PathPaymentStrictReceiveResultSuccess(Box::new(t)))),
58584            ),
58585            TypeVariant::PathPaymentStrictSendResultCode => Box::new(
58586                ReadXdrIter::<_, PathPaymentStrictSendResultCode>::new(dec, r.limits.clone())
58587                    .map(|r| r.map(|t| Self::PathPaymentStrictSendResultCode(Box::new(t)))),
58588            ),
58589            TypeVariant::PathPaymentStrictSendResult => Box::new(
58590                ReadXdrIter::<_, PathPaymentStrictSendResult>::new(dec, r.limits.clone())
58591                    .map(|r| r.map(|t| Self::PathPaymentStrictSendResult(Box::new(t)))),
58592            ),
58593            TypeVariant::PathPaymentStrictSendResultSuccess => Box::new(
58594                ReadXdrIter::<_, PathPaymentStrictSendResultSuccess>::new(dec, r.limits.clone())
58595                    .map(|r| r.map(|t| Self::PathPaymentStrictSendResultSuccess(Box::new(t)))),
58596            ),
58597            TypeVariant::ManageSellOfferResultCode => Box::new(
58598                ReadXdrIter::<_, ManageSellOfferResultCode>::new(dec, r.limits.clone())
58599                    .map(|r| r.map(|t| Self::ManageSellOfferResultCode(Box::new(t)))),
58600            ),
58601            TypeVariant::ManageOfferEffect => Box::new(
58602                ReadXdrIter::<_, ManageOfferEffect>::new(dec, r.limits.clone())
58603                    .map(|r| r.map(|t| Self::ManageOfferEffect(Box::new(t)))),
58604            ),
58605            TypeVariant::ManageOfferSuccessResult => Box::new(
58606                ReadXdrIter::<_, ManageOfferSuccessResult>::new(dec, r.limits.clone())
58607                    .map(|r| r.map(|t| Self::ManageOfferSuccessResult(Box::new(t)))),
58608            ),
58609            TypeVariant::ManageOfferSuccessResultOffer => Box::new(
58610                ReadXdrIter::<_, ManageOfferSuccessResultOffer>::new(dec, r.limits.clone())
58611                    .map(|r| r.map(|t| Self::ManageOfferSuccessResultOffer(Box::new(t)))),
58612            ),
58613            TypeVariant::ManageSellOfferResult => Box::new(
58614                ReadXdrIter::<_, ManageSellOfferResult>::new(dec, r.limits.clone())
58615                    .map(|r| r.map(|t| Self::ManageSellOfferResult(Box::new(t)))),
58616            ),
58617            TypeVariant::ManageBuyOfferResultCode => Box::new(
58618                ReadXdrIter::<_, ManageBuyOfferResultCode>::new(dec, r.limits.clone())
58619                    .map(|r| r.map(|t| Self::ManageBuyOfferResultCode(Box::new(t)))),
58620            ),
58621            TypeVariant::ManageBuyOfferResult => Box::new(
58622                ReadXdrIter::<_, ManageBuyOfferResult>::new(dec, r.limits.clone())
58623                    .map(|r| r.map(|t| Self::ManageBuyOfferResult(Box::new(t)))),
58624            ),
58625            TypeVariant::SetOptionsResultCode => Box::new(
58626                ReadXdrIter::<_, SetOptionsResultCode>::new(dec, r.limits.clone())
58627                    .map(|r| r.map(|t| Self::SetOptionsResultCode(Box::new(t)))),
58628            ),
58629            TypeVariant::SetOptionsResult => Box::new(
58630                ReadXdrIter::<_, SetOptionsResult>::new(dec, r.limits.clone())
58631                    .map(|r| r.map(|t| Self::SetOptionsResult(Box::new(t)))),
58632            ),
58633            TypeVariant::ChangeTrustResultCode => Box::new(
58634                ReadXdrIter::<_, ChangeTrustResultCode>::new(dec, r.limits.clone())
58635                    .map(|r| r.map(|t| Self::ChangeTrustResultCode(Box::new(t)))),
58636            ),
58637            TypeVariant::ChangeTrustResult => Box::new(
58638                ReadXdrIter::<_, ChangeTrustResult>::new(dec, r.limits.clone())
58639                    .map(|r| r.map(|t| Self::ChangeTrustResult(Box::new(t)))),
58640            ),
58641            TypeVariant::AllowTrustResultCode => Box::new(
58642                ReadXdrIter::<_, AllowTrustResultCode>::new(dec, r.limits.clone())
58643                    .map(|r| r.map(|t| Self::AllowTrustResultCode(Box::new(t)))),
58644            ),
58645            TypeVariant::AllowTrustResult => Box::new(
58646                ReadXdrIter::<_, AllowTrustResult>::new(dec, r.limits.clone())
58647                    .map(|r| r.map(|t| Self::AllowTrustResult(Box::new(t)))),
58648            ),
58649            TypeVariant::AccountMergeResultCode => Box::new(
58650                ReadXdrIter::<_, AccountMergeResultCode>::new(dec, r.limits.clone())
58651                    .map(|r| r.map(|t| Self::AccountMergeResultCode(Box::new(t)))),
58652            ),
58653            TypeVariant::AccountMergeResult => Box::new(
58654                ReadXdrIter::<_, AccountMergeResult>::new(dec, r.limits.clone())
58655                    .map(|r| r.map(|t| Self::AccountMergeResult(Box::new(t)))),
58656            ),
58657            TypeVariant::InflationResultCode => Box::new(
58658                ReadXdrIter::<_, InflationResultCode>::new(dec, r.limits.clone())
58659                    .map(|r| r.map(|t| Self::InflationResultCode(Box::new(t)))),
58660            ),
58661            TypeVariant::InflationPayout => Box::new(
58662                ReadXdrIter::<_, InflationPayout>::new(dec, r.limits.clone())
58663                    .map(|r| r.map(|t| Self::InflationPayout(Box::new(t)))),
58664            ),
58665            TypeVariant::InflationResult => Box::new(
58666                ReadXdrIter::<_, InflationResult>::new(dec, r.limits.clone())
58667                    .map(|r| r.map(|t| Self::InflationResult(Box::new(t)))),
58668            ),
58669            TypeVariant::ManageDataResultCode => Box::new(
58670                ReadXdrIter::<_, ManageDataResultCode>::new(dec, r.limits.clone())
58671                    .map(|r| r.map(|t| Self::ManageDataResultCode(Box::new(t)))),
58672            ),
58673            TypeVariant::ManageDataResult => Box::new(
58674                ReadXdrIter::<_, ManageDataResult>::new(dec, r.limits.clone())
58675                    .map(|r| r.map(|t| Self::ManageDataResult(Box::new(t)))),
58676            ),
58677            TypeVariant::BumpSequenceResultCode => Box::new(
58678                ReadXdrIter::<_, BumpSequenceResultCode>::new(dec, r.limits.clone())
58679                    .map(|r| r.map(|t| Self::BumpSequenceResultCode(Box::new(t)))),
58680            ),
58681            TypeVariant::BumpSequenceResult => Box::new(
58682                ReadXdrIter::<_, BumpSequenceResult>::new(dec, r.limits.clone())
58683                    .map(|r| r.map(|t| Self::BumpSequenceResult(Box::new(t)))),
58684            ),
58685            TypeVariant::CreateClaimableBalanceResultCode => Box::new(
58686                ReadXdrIter::<_, CreateClaimableBalanceResultCode>::new(dec, r.limits.clone())
58687                    .map(|r| r.map(|t| Self::CreateClaimableBalanceResultCode(Box::new(t)))),
58688            ),
58689            TypeVariant::CreateClaimableBalanceResult => Box::new(
58690                ReadXdrIter::<_, CreateClaimableBalanceResult>::new(dec, r.limits.clone())
58691                    .map(|r| r.map(|t| Self::CreateClaimableBalanceResult(Box::new(t)))),
58692            ),
58693            TypeVariant::ClaimClaimableBalanceResultCode => Box::new(
58694                ReadXdrIter::<_, ClaimClaimableBalanceResultCode>::new(dec, r.limits.clone())
58695                    .map(|r| r.map(|t| Self::ClaimClaimableBalanceResultCode(Box::new(t)))),
58696            ),
58697            TypeVariant::ClaimClaimableBalanceResult => Box::new(
58698                ReadXdrIter::<_, ClaimClaimableBalanceResult>::new(dec, r.limits.clone())
58699                    .map(|r| r.map(|t| Self::ClaimClaimableBalanceResult(Box::new(t)))),
58700            ),
58701            TypeVariant::BeginSponsoringFutureReservesResultCode => Box::new(
58702                ReadXdrIter::<_, BeginSponsoringFutureReservesResultCode>::new(
58703                    dec,
58704                    r.limits.clone(),
58705                )
58706                .map(|r| r.map(|t| Self::BeginSponsoringFutureReservesResultCode(Box::new(t)))),
58707            ),
58708            TypeVariant::BeginSponsoringFutureReservesResult => Box::new(
58709                ReadXdrIter::<_, BeginSponsoringFutureReservesResult>::new(dec, r.limits.clone())
58710                    .map(|r| r.map(|t| Self::BeginSponsoringFutureReservesResult(Box::new(t)))),
58711            ),
58712            TypeVariant::EndSponsoringFutureReservesResultCode => Box::new(
58713                ReadXdrIter::<_, EndSponsoringFutureReservesResultCode>::new(dec, r.limits.clone())
58714                    .map(|r| r.map(|t| Self::EndSponsoringFutureReservesResultCode(Box::new(t)))),
58715            ),
58716            TypeVariant::EndSponsoringFutureReservesResult => Box::new(
58717                ReadXdrIter::<_, EndSponsoringFutureReservesResult>::new(dec, r.limits.clone())
58718                    .map(|r| r.map(|t| Self::EndSponsoringFutureReservesResult(Box::new(t)))),
58719            ),
58720            TypeVariant::RevokeSponsorshipResultCode => Box::new(
58721                ReadXdrIter::<_, RevokeSponsorshipResultCode>::new(dec, r.limits.clone())
58722                    .map(|r| r.map(|t| Self::RevokeSponsorshipResultCode(Box::new(t)))),
58723            ),
58724            TypeVariant::RevokeSponsorshipResult => Box::new(
58725                ReadXdrIter::<_, RevokeSponsorshipResult>::new(dec, r.limits.clone())
58726                    .map(|r| r.map(|t| Self::RevokeSponsorshipResult(Box::new(t)))),
58727            ),
58728            TypeVariant::ClawbackResultCode => Box::new(
58729                ReadXdrIter::<_, ClawbackResultCode>::new(dec, r.limits.clone())
58730                    .map(|r| r.map(|t| Self::ClawbackResultCode(Box::new(t)))),
58731            ),
58732            TypeVariant::ClawbackResult => Box::new(
58733                ReadXdrIter::<_, ClawbackResult>::new(dec, r.limits.clone())
58734                    .map(|r| r.map(|t| Self::ClawbackResult(Box::new(t)))),
58735            ),
58736            TypeVariant::ClawbackClaimableBalanceResultCode => Box::new(
58737                ReadXdrIter::<_, ClawbackClaimableBalanceResultCode>::new(dec, r.limits.clone())
58738                    .map(|r| r.map(|t| Self::ClawbackClaimableBalanceResultCode(Box::new(t)))),
58739            ),
58740            TypeVariant::ClawbackClaimableBalanceResult => Box::new(
58741                ReadXdrIter::<_, ClawbackClaimableBalanceResult>::new(dec, r.limits.clone())
58742                    .map(|r| r.map(|t| Self::ClawbackClaimableBalanceResult(Box::new(t)))),
58743            ),
58744            TypeVariant::SetTrustLineFlagsResultCode => Box::new(
58745                ReadXdrIter::<_, SetTrustLineFlagsResultCode>::new(dec, r.limits.clone())
58746                    .map(|r| r.map(|t| Self::SetTrustLineFlagsResultCode(Box::new(t)))),
58747            ),
58748            TypeVariant::SetTrustLineFlagsResult => Box::new(
58749                ReadXdrIter::<_, SetTrustLineFlagsResult>::new(dec, r.limits.clone())
58750                    .map(|r| r.map(|t| Self::SetTrustLineFlagsResult(Box::new(t)))),
58751            ),
58752            TypeVariant::LiquidityPoolDepositResultCode => Box::new(
58753                ReadXdrIter::<_, LiquidityPoolDepositResultCode>::new(dec, r.limits.clone())
58754                    .map(|r| r.map(|t| Self::LiquidityPoolDepositResultCode(Box::new(t)))),
58755            ),
58756            TypeVariant::LiquidityPoolDepositResult => Box::new(
58757                ReadXdrIter::<_, LiquidityPoolDepositResult>::new(dec, r.limits.clone())
58758                    .map(|r| r.map(|t| Self::LiquidityPoolDepositResult(Box::new(t)))),
58759            ),
58760            TypeVariant::LiquidityPoolWithdrawResultCode => Box::new(
58761                ReadXdrIter::<_, LiquidityPoolWithdrawResultCode>::new(dec, r.limits.clone())
58762                    .map(|r| r.map(|t| Self::LiquidityPoolWithdrawResultCode(Box::new(t)))),
58763            ),
58764            TypeVariant::LiquidityPoolWithdrawResult => Box::new(
58765                ReadXdrIter::<_, LiquidityPoolWithdrawResult>::new(dec, r.limits.clone())
58766                    .map(|r| r.map(|t| Self::LiquidityPoolWithdrawResult(Box::new(t)))),
58767            ),
58768            TypeVariant::InvokeHostFunctionResultCode => Box::new(
58769                ReadXdrIter::<_, InvokeHostFunctionResultCode>::new(dec, r.limits.clone())
58770                    .map(|r| r.map(|t| Self::InvokeHostFunctionResultCode(Box::new(t)))),
58771            ),
58772            TypeVariant::InvokeHostFunctionResult => Box::new(
58773                ReadXdrIter::<_, InvokeHostFunctionResult>::new(dec, r.limits.clone())
58774                    .map(|r| r.map(|t| Self::InvokeHostFunctionResult(Box::new(t)))),
58775            ),
58776            TypeVariant::ExtendFootprintTtlResultCode => Box::new(
58777                ReadXdrIter::<_, ExtendFootprintTtlResultCode>::new(dec, r.limits.clone())
58778                    .map(|r| r.map(|t| Self::ExtendFootprintTtlResultCode(Box::new(t)))),
58779            ),
58780            TypeVariant::ExtendFootprintTtlResult => Box::new(
58781                ReadXdrIter::<_, ExtendFootprintTtlResult>::new(dec, r.limits.clone())
58782                    .map(|r| r.map(|t| Self::ExtendFootprintTtlResult(Box::new(t)))),
58783            ),
58784            TypeVariant::RestoreFootprintResultCode => Box::new(
58785                ReadXdrIter::<_, RestoreFootprintResultCode>::new(dec, r.limits.clone())
58786                    .map(|r| r.map(|t| Self::RestoreFootprintResultCode(Box::new(t)))),
58787            ),
58788            TypeVariant::RestoreFootprintResult => Box::new(
58789                ReadXdrIter::<_, RestoreFootprintResult>::new(dec, r.limits.clone())
58790                    .map(|r| r.map(|t| Self::RestoreFootprintResult(Box::new(t)))),
58791            ),
58792            TypeVariant::OperationResultCode => Box::new(
58793                ReadXdrIter::<_, OperationResultCode>::new(dec, r.limits.clone())
58794                    .map(|r| r.map(|t| Self::OperationResultCode(Box::new(t)))),
58795            ),
58796            TypeVariant::OperationResult => Box::new(
58797                ReadXdrIter::<_, OperationResult>::new(dec, r.limits.clone())
58798                    .map(|r| r.map(|t| Self::OperationResult(Box::new(t)))),
58799            ),
58800            TypeVariant::OperationResultTr => Box::new(
58801                ReadXdrIter::<_, OperationResultTr>::new(dec, r.limits.clone())
58802                    .map(|r| r.map(|t| Self::OperationResultTr(Box::new(t)))),
58803            ),
58804            TypeVariant::TransactionResultCode => Box::new(
58805                ReadXdrIter::<_, TransactionResultCode>::new(dec, r.limits.clone())
58806                    .map(|r| r.map(|t| Self::TransactionResultCode(Box::new(t)))),
58807            ),
58808            TypeVariant::InnerTransactionResult => Box::new(
58809                ReadXdrIter::<_, InnerTransactionResult>::new(dec, r.limits.clone())
58810                    .map(|r| r.map(|t| Self::InnerTransactionResult(Box::new(t)))),
58811            ),
58812            TypeVariant::InnerTransactionResultResult => Box::new(
58813                ReadXdrIter::<_, InnerTransactionResultResult>::new(dec, r.limits.clone())
58814                    .map(|r| r.map(|t| Self::InnerTransactionResultResult(Box::new(t)))),
58815            ),
58816            TypeVariant::InnerTransactionResultExt => Box::new(
58817                ReadXdrIter::<_, InnerTransactionResultExt>::new(dec, r.limits.clone())
58818                    .map(|r| r.map(|t| Self::InnerTransactionResultExt(Box::new(t)))),
58819            ),
58820            TypeVariant::InnerTransactionResultPair => Box::new(
58821                ReadXdrIter::<_, InnerTransactionResultPair>::new(dec, r.limits.clone())
58822                    .map(|r| r.map(|t| Self::InnerTransactionResultPair(Box::new(t)))),
58823            ),
58824            TypeVariant::TransactionResult => Box::new(
58825                ReadXdrIter::<_, TransactionResult>::new(dec, r.limits.clone())
58826                    .map(|r| r.map(|t| Self::TransactionResult(Box::new(t)))),
58827            ),
58828            TypeVariant::TransactionResultResult => Box::new(
58829                ReadXdrIter::<_, TransactionResultResult>::new(dec, r.limits.clone())
58830                    .map(|r| r.map(|t| Self::TransactionResultResult(Box::new(t)))),
58831            ),
58832            TypeVariant::TransactionResultExt => Box::new(
58833                ReadXdrIter::<_, TransactionResultExt>::new(dec, r.limits.clone())
58834                    .map(|r| r.map(|t| Self::TransactionResultExt(Box::new(t)))),
58835            ),
58836            TypeVariant::Hash => Box::new(
58837                ReadXdrIter::<_, Hash>::new(dec, r.limits.clone())
58838                    .map(|r| r.map(|t| Self::Hash(Box::new(t)))),
58839            ),
58840            TypeVariant::Uint256 => Box::new(
58841                ReadXdrIter::<_, Uint256>::new(dec, r.limits.clone())
58842                    .map(|r| r.map(|t| Self::Uint256(Box::new(t)))),
58843            ),
58844            TypeVariant::Uint32 => Box::new(
58845                ReadXdrIter::<_, Uint32>::new(dec, r.limits.clone())
58846                    .map(|r| r.map(|t| Self::Uint32(Box::new(t)))),
58847            ),
58848            TypeVariant::Int32 => Box::new(
58849                ReadXdrIter::<_, Int32>::new(dec, r.limits.clone())
58850                    .map(|r| r.map(|t| Self::Int32(Box::new(t)))),
58851            ),
58852            TypeVariant::Uint64 => Box::new(
58853                ReadXdrIter::<_, Uint64>::new(dec, r.limits.clone())
58854                    .map(|r| r.map(|t| Self::Uint64(Box::new(t)))),
58855            ),
58856            TypeVariant::Int64 => Box::new(
58857                ReadXdrIter::<_, Int64>::new(dec, r.limits.clone())
58858                    .map(|r| r.map(|t| Self::Int64(Box::new(t)))),
58859            ),
58860            TypeVariant::TimePoint => Box::new(
58861                ReadXdrIter::<_, TimePoint>::new(dec, r.limits.clone())
58862                    .map(|r| r.map(|t| Self::TimePoint(Box::new(t)))),
58863            ),
58864            TypeVariant::Duration => Box::new(
58865                ReadXdrIter::<_, Duration>::new(dec, r.limits.clone())
58866                    .map(|r| r.map(|t| Self::Duration(Box::new(t)))),
58867            ),
58868            TypeVariant::ExtensionPoint => Box::new(
58869                ReadXdrIter::<_, ExtensionPoint>::new(dec, r.limits.clone())
58870                    .map(|r| r.map(|t| Self::ExtensionPoint(Box::new(t)))),
58871            ),
58872            TypeVariant::CryptoKeyType => Box::new(
58873                ReadXdrIter::<_, CryptoKeyType>::new(dec, r.limits.clone())
58874                    .map(|r| r.map(|t| Self::CryptoKeyType(Box::new(t)))),
58875            ),
58876            TypeVariant::PublicKeyType => Box::new(
58877                ReadXdrIter::<_, PublicKeyType>::new(dec, r.limits.clone())
58878                    .map(|r| r.map(|t| Self::PublicKeyType(Box::new(t)))),
58879            ),
58880            TypeVariant::SignerKeyType => Box::new(
58881                ReadXdrIter::<_, SignerKeyType>::new(dec, r.limits.clone())
58882                    .map(|r| r.map(|t| Self::SignerKeyType(Box::new(t)))),
58883            ),
58884            TypeVariant::PublicKey => Box::new(
58885                ReadXdrIter::<_, PublicKey>::new(dec, r.limits.clone())
58886                    .map(|r| r.map(|t| Self::PublicKey(Box::new(t)))),
58887            ),
58888            TypeVariant::SignerKey => Box::new(
58889                ReadXdrIter::<_, SignerKey>::new(dec, r.limits.clone())
58890                    .map(|r| r.map(|t| Self::SignerKey(Box::new(t)))),
58891            ),
58892            TypeVariant::SignerKeyEd25519SignedPayload => Box::new(
58893                ReadXdrIter::<_, SignerKeyEd25519SignedPayload>::new(dec, r.limits.clone())
58894                    .map(|r| r.map(|t| Self::SignerKeyEd25519SignedPayload(Box::new(t)))),
58895            ),
58896            TypeVariant::Signature => Box::new(
58897                ReadXdrIter::<_, Signature>::new(dec, r.limits.clone())
58898                    .map(|r| r.map(|t| Self::Signature(Box::new(t)))),
58899            ),
58900            TypeVariant::SignatureHint => Box::new(
58901                ReadXdrIter::<_, SignatureHint>::new(dec, r.limits.clone())
58902                    .map(|r| r.map(|t| Self::SignatureHint(Box::new(t)))),
58903            ),
58904            TypeVariant::NodeId => Box::new(
58905                ReadXdrIter::<_, NodeId>::new(dec, r.limits.clone())
58906                    .map(|r| r.map(|t| Self::NodeId(Box::new(t)))),
58907            ),
58908            TypeVariant::AccountId => Box::new(
58909                ReadXdrIter::<_, AccountId>::new(dec, r.limits.clone())
58910                    .map(|r| r.map(|t| Self::AccountId(Box::new(t)))),
58911            ),
58912            TypeVariant::Curve25519Secret => Box::new(
58913                ReadXdrIter::<_, Curve25519Secret>::new(dec, r.limits.clone())
58914                    .map(|r| r.map(|t| Self::Curve25519Secret(Box::new(t)))),
58915            ),
58916            TypeVariant::Curve25519Public => Box::new(
58917                ReadXdrIter::<_, Curve25519Public>::new(dec, r.limits.clone())
58918                    .map(|r| r.map(|t| Self::Curve25519Public(Box::new(t)))),
58919            ),
58920            TypeVariant::HmacSha256Key => Box::new(
58921                ReadXdrIter::<_, HmacSha256Key>::new(dec, r.limits.clone())
58922                    .map(|r| r.map(|t| Self::HmacSha256Key(Box::new(t)))),
58923            ),
58924            TypeVariant::HmacSha256Mac => Box::new(
58925                ReadXdrIter::<_, HmacSha256Mac>::new(dec, r.limits.clone())
58926                    .map(|r| r.map(|t| Self::HmacSha256Mac(Box::new(t)))),
58927            ),
58928            TypeVariant::ShortHashSeed => Box::new(
58929                ReadXdrIter::<_, ShortHashSeed>::new(dec, r.limits.clone())
58930                    .map(|r| r.map(|t| Self::ShortHashSeed(Box::new(t)))),
58931            ),
58932            TypeVariant::BinaryFuseFilterType => Box::new(
58933                ReadXdrIter::<_, BinaryFuseFilterType>::new(dec, r.limits.clone())
58934                    .map(|r| r.map(|t| Self::BinaryFuseFilterType(Box::new(t)))),
58935            ),
58936            TypeVariant::SerializedBinaryFuseFilter => Box::new(
58937                ReadXdrIter::<_, SerializedBinaryFuseFilter>::new(dec, r.limits.clone())
58938                    .map(|r| r.map(|t| Self::SerializedBinaryFuseFilter(Box::new(t)))),
58939            ),
58940        }
58941    }
58942
58943    #[cfg(feature = "std")]
58944    pub fn from_xdr<B: AsRef<[u8]>>(v: TypeVariant, bytes: B, limits: Limits) -> Result<Self> {
58945        let mut cursor = Limited::new(Cursor::new(bytes.as_ref()), limits);
58946        let t = Self::read_xdr_to_end(v, &mut cursor)?;
58947        Ok(t)
58948    }
58949
58950    #[cfg(feature = "base64")]
58951    pub fn from_xdr_base64(v: TypeVariant, b64: impl AsRef<[u8]>, limits: Limits) -> Result<Self> {
58952        let mut b64_reader = Cursor::new(b64);
58953        let mut dec = Limited::new(
58954            base64::read::DecoderReader::new(&mut b64_reader, base64::STANDARD),
58955            limits,
58956        );
58957        let t = Self::read_xdr_to_end(v, &mut dec)?;
58958        Ok(t)
58959    }
58960
58961    #[cfg(all(feature = "std", feature = "serde_json"))]
58962    #[deprecated(note = "use from_json")]
58963    pub fn read_json(v: TypeVariant, r: impl Read) -> Result<Self> {
58964        Self::from_json(v, r)
58965    }
58966
58967    #[cfg(all(feature = "std", feature = "serde_json"))]
58968    #[allow(clippy::too_many_lines)]
58969    pub fn from_json(v: TypeVariant, r: impl Read) -> Result<Self> {
58970        match v {
58971            TypeVariant::Value => Ok(Self::Value(Box::new(serde_json::from_reader(r)?))),
58972            TypeVariant::ScpBallot => Ok(Self::ScpBallot(Box::new(serde_json::from_reader(r)?))),
58973            TypeVariant::ScpStatementType => Ok(Self::ScpStatementType(Box::new(
58974                serde_json::from_reader(r)?,
58975            ))),
58976            TypeVariant::ScpNomination => {
58977                Ok(Self::ScpNomination(Box::new(serde_json::from_reader(r)?)))
58978            }
58979            TypeVariant::ScpStatement => {
58980                Ok(Self::ScpStatement(Box::new(serde_json::from_reader(r)?)))
58981            }
58982            TypeVariant::ScpStatementPledges => Ok(Self::ScpStatementPledges(Box::new(
58983                serde_json::from_reader(r)?,
58984            ))),
58985            TypeVariant::ScpStatementPrepare => Ok(Self::ScpStatementPrepare(Box::new(
58986                serde_json::from_reader(r)?,
58987            ))),
58988            TypeVariant::ScpStatementConfirm => Ok(Self::ScpStatementConfirm(Box::new(
58989                serde_json::from_reader(r)?,
58990            ))),
58991            TypeVariant::ScpStatementExternalize => Ok(Self::ScpStatementExternalize(Box::new(
58992                serde_json::from_reader(r)?,
58993            ))),
58994            TypeVariant::ScpEnvelope => {
58995                Ok(Self::ScpEnvelope(Box::new(serde_json::from_reader(r)?)))
58996            }
58997            TypeVariant::ScpQuorumSet => {
58998                Ok(Self::ScpQuorumSet(Box::new(serde_json::from_reader(r)?)))
58999            }
59000            TypeVariant::ConfigSettingContractExecutionLanesV0 => Ok(
59001                Self::ConfigSettingContractExecutionLanesV0(Box::new(serde_json::from_reader(r)?)),
59002            ),
59003            TypeVariant::ConfigSettingContractComputeV0 => Ok(
59004                Self::ConfigSettingContractComputeV0(Box::new(serde_json::from_reader(r)?)),
59005            ),
59006            TypeVariant::ConfigSettingContractLedgerCostV0 => Ok(
59007                Self::ConfigSettingContractLedgerCostV0(Box::new(serde_json::from_reader(r)?)),
59008            ),
59009            TypeVariant::ConfigSettingContractHistoricalDataV0 => Ok(
59010                Self::ConfigSettingContractHistoricalDataV0(Box::new(serde_json::from_reader(r)?)),
59011            ),
59012            TypeVariant::ConfigSettingContractEventsV0 => Ok(Self::ConfigSettingContractEventsV0(
59013                Box::new(serde_json::from_reader(r)?),
59014            )),
59015            TypeVariant::ConfigSettingContractBandwidthV0 => Ok(
59016                Self::ConfigSettingContractBandwidthV0(Box::new(serde_json::from_reader(r)?)),
59017            ),
59018            TypeVariant::ContractCostType => Ok(Self::ContractCostType(Box::new(
59019                serde_json::from_reader(r)?,
59020            ))),
59021            TypeVariant::ContractCostParamEntry => Ok(Self::ContractCostParamEntry(Box::new(
59022                serde_json::from_reader(r)?,
59023            ))),
59024            TypeVariant::StateArchivalSettings => Ok(Self::StateArchivalSettings(Box::new(
59025                serde_json::from_reader(r)?,
59026            ))),
59027            TypeVariant::EvictionIterator => Ok(Self::EvictionIterator(Box::new(
59028                serde_json::from_reader(r)?,
59029            ))),
59030            TypeVariant::ContractCostParams => Ok(Self::ContractCostParams(Box::new(
59031                serde_json::from_reader(r)?,
59032            ))),
59033            TypeVariant::ConfigSettingId => {
59034                Ok(Self::ConfigSettingId(Box::new(serde_json::from_reader(r)?)))
59035            }
59036            TypeVariant::ConfigSettingEntry => Ok(Self::ConfigSettingEntry(Box::new(
59037                serde_json::from_reader(r)?,
59038            ))),
59039            TypeVariant::ScEnvMetaKind => {
59040                Ok(Self::ScEnvMetaKind(Box::new(serde_json::from_reader(r)?)))
59041            }
59042            TypeVariant::ScEnvMetaEntry => {
59043                Ok(Self::ScEnvMetaEntry(Box::new(serde_json::from_reader(r)?)))
59044            }
59045            TypeVariant::ScEnvMetaEntryInterfaceVersion => Ok(
59046                Self::ScEnvMetaEntryInterfaceVersion(Box::new(serde_json::from_reader(r)?)),
59047            ),
59048            TypeVariant::ScMetaV0 => Ok(Self::ScMetaV0(Box::new(serde_json::from_reader(r)?))),
59049            TypeVariant::ScMetaKind => Ok(Self::ScMetaKind(Box::new(serde_json::from_reader(r)?))),
59050            TypeVariant::ScMetaEntry => {
59051                Ok(Self::ScMetaEntry(Box::new(serde_json::from_reader(r)?)))
59052            }
59053            TypeVariant::ScSpecType => Ok(Self::ScSpecType(Box::new(serde_json::from_reader(r)?))),
59054            TypeVariant::ScSpecTypeOption => Ok(Self::ScSpecTypeOption(Box::new(
59055                serde_json::from_reader(r)?,
59056            ))),
59057            TypeVariant::ScSpecTypeResult => Ok(Self::ScSpecTypeResult(Box::new(
59058                serde_json::from_reader(r)?,
59059            ))),
59060            TypeVariant::ScSpecTypeVec => {
59061                Ok(Self::ScSpecTypeVec(Box::new(serde_json::from_reader(r)?)))
59062            }
59063            TypeVariant::ScSpecTypeMap => {
59064                Ok(Self::ScSpecTypeMap(Box::new(serde_json::from_reader(r)?)))
59065            }
59066            TypeVariant::ScSpecTypeTuple => {
59067                Ok(Self::ScSpecTypeTuple(Box::new(serde_json::from_reader(r)?)))
59068            }
59069            TypeVariant::ScSpecTypeBytesN => Ok(Self::ScSpecTypeBytesN(Box::new(
59070                serde_json::from_reader(r)?,
59071            ))),
59072            TypeVariant::ScSpecTypeUdt => {
59073                Ok(Self::ScSpecTypeUdt(Box::new(serde_json::from_reader(r)?)))
59074            }
59075            TypeVariant::ScSpecTypeDef => {
59076                Ok(Self::ScSpecTypeDef(Box::new(serde_json::from_reader(r)?)))
59077            }
59078            TypeVariant::ScSpecUdtStructFieldV0 => Ok(Self::ScSpecUdtStructFieldV0(Box::new(
59079                serde_json::from_reader(r)?,
59080            ))),
59081            TypeVariant::ScSpecUdtStructV0 => Ok(Self::ScSpecUdtStructV0(Box::new(
59082                serde_json::from_reader(r)?,
59083            ))),
59084            TypeVariant::ScSpecUdtUnionCaseVoidV0 => Ok(Self::ScSpecUdtUnionCaseVoidV0(Box::new(
59085                serde_json::from_reader(r)?,
59086            ))),
59087            TypeVariant::ScSpecUdtUnionCaseTupleV0 => Ok(Self::ScSpecUdtUnionCaseTupleV0(
59088                Box::new(serde_json::from_reader(r)?),
59089            )),
59090            TypeVariant::ScSpecUdtUnionCaseV0Kind => Ok(Self::ScSpecUdtUnionCaseV0Kind(Box::new(
59091                serde_json::from_reader(r)?,
59092            ))),
59093            TypeVariant::ScSpecUdtUnionCaseV0 => Ok(Self::ScSpecUdtUnionCaseV0(Box::new(
59094                serde_json::from_reader(r)?,
59095            ))),
59096            TypeVariant::ScSpecUdtUnionV0 => Ok(Self::ScSpecUdtUnionV0(Box::new(
59097                serde_json::from_reader(r)?,
59098            ))),
59099            TypeVariant::ScSpecUdtEnumCaseV0 => Ok(Self::ScSpecUdtEnumCaseV0(Box::new(
59100                serde_json::from_reader(r)?,
59101            ))),
59102            TypeVariant::ScSpecUdtEnumV0 => {
59103                Ok(Self::ScSpecUdtEnumV0(Box::new(serde_json::from_reader(r)?)))
59104            }
59105            TypeVariant::ScSpecUdtErrorEnumCaseV0 => Ok(Self::ScSpecUdtErrorEnumCaseV0(Box::new(
59106                serde_json::from_reader(r)?,
59107            ))),
59108            TypeVariant::ScSpecUdtErrorEnumV0 => Ok(Self::ScSpecUdtErrorEnumV0(Box::new(
59109                serde_json::from_reader(r)?,
59110            ))),
59111            TypeVariant::ScSpecFunctionInputV0 => Ok(Self::ScSpecFunctionInputV0(Box::new(
59112                serde_json::from_reader(r)?,
59113            ))),
59114            TypeVariant::ScSpecFunctionV0 => Ok(Self::ScSpecFunctionV0(Box::new(
59115                serde_json::from_reader(r)?,
59116            ))),
59117            TypeVariant::ScSpecEntryKind => {
59118                Ok(Self::ScSpecEntryKind(Box::new(serde_json::from_reader(r)?)))
59119            }
59120            TypeVariant::ScSpecEntry => {
59121                Ok(Self::ScSpecEntry(Box::new(serde_json::from_reader(r)?)))
59122            }
59123            TypeVariant::ScValType => Ok(Self::ScValType(Box::new(serde_json::from_reader(r)?))),
59124            TypeVariant::ScErrorType => {
59125                Ok(Self::ScErrorType(Box::new(serde_json::from_reader(r)?)))
59126            }
59127            TypeVariant::ScErrorCode => {
59128                Ok(Self::ScErrorCode(Box::new(serde_json::from_reader(r)?)))
59129            }
59130            TypeVariant::ScError => Ok(Self::ScError(Box::new(serde_json::from_reader(r)?))),
59131            TypeVariant::UInt128Parts => {
59132                Ok(Self::UInt128Parts(Box::new(serde_json::from_reader(r)?)))
59133            }
59134            TypeVariant::Int128Parts => {
59135                Ok(Self::Int128Parts(Box::new(serde_json::from_reader(r)?)))
59136            }
59137            TypeVariant::UInt256Parts => {
59138                Ok(Self::UInt256Parts(Box::new(serde_json::from_reader(r)?)))
59139            }
59140            TypeVariant::Int256Parts => {
59141                Ok(Self::Int256Parts(Box::new(serde_json::from_reader(r)?)))
59142            }
59143            TypeVariant::ContractExecutableType => Ok(Self::ContractExecutableType(Box::new(
59144                serde_json::from_reader(r)?,
59145            ))),
59146            TypeVariant::ContractExecutable => Ok(Self::ContractExecutable(Box::new(
59147                serde_json::from_reader(r)?,
59148            ))),
59149            TypeVariant::ScAddressType => {
59150                Ok(Self::ScAddressType(Box::new(serde_json::from_reader(r)?)))
59151            }
59152            TypeVariant::ScAddress => Ok(Self::ScAddress(Box::new(serde_json::from_reader(r)?))),
59153            TypeVariant::ScVec => Ok(Self::ScVec(Box::new(serde_json::from_reader(r)?))),
59154            TypeVariant::ScMap => Ok(Self::ScMap(Box::new(serde_json::from_reader(r)?))),
59155            TypeVariant::ScBytes => Ok(Self::ScBytes(Box::new(serde_json::from_reader(r)?))),
59156            TypeVariant::ScString => Ok(Self::ScString(Box::new(serde_json::from_reader(r)?))),
59157            TypeVariant::ScSymbol => Ok(Self::ScSymbol(Box::new(serde_json::from_reader(r)?))),
59158            TypeVariant::ScNonceKey => Ok(Self::ScNonceKey(Box::new(serde_json::from_reader(r)?))),
59159            TypeVariant::ScContractInstance => Ok(Self::ScContractInstance(Box::new(
59160                serde_json::from_reader(r)?,
59161            ))),
59162            TypeVariant::ScVal => Ok(Self::ScVal(Box::new(serde_json::from_reader(r)?))),
59163            TypeVariant::ScMapEntry => Ok(Self::ScMapEntry(Box::new(serde_json::from_reader(r)?))),
59164            TypeVariant::StoredTransactionSet => Ok(Self::StoredTransactionSet(Box::new(
59165                serde_json::from_reader(r)?,
59166            ))),
59167            TypeVariant::StoredDebugTransactionSet => Ok(Self::StoredDebugTransactionSet(
59168                Box::new(serde_json::from_reader(r)?),
59169            )),
59170            TypeVariant::PersistedScpStateV0 => Ok(Self::PersistedScpStateV0(Box::new(
59171                serde_json::from_reader(r)?,
59172            ))),
59173            TypeVariant::PersistedScpStateV1 => Ok(Self::PersistedScpStateV1(Box::new(
59174                serde_json::from_reader(r)?,
59175            ))),
59176            TypeVariant::PersistedScpState => Ok(Self::PersistedScpState(Box::new(
59177                serde_json::from_reader(r)?,
59178            ))),
59179            TypeVariant::Thresholds => Ok(Self::Thresholds(Box::new(serde_json::from_reader(r)?))),
59180            TypeVariant::String32 => Ok(Self::String32(Box::new(serde_json::from_reader(r)?))),
59181            TypeVariant::String64 => Ok(Self::String64(Box::new(serde_json::from_reader(r)?))),
59182            TypeVariant::SequenceNumber => {
59183                Ok(Self::SequenceNumber(Box::new(serde_json::from_reader(r)?)))
59184            }
59185            TypeVariant::DataValue => Ok(Self::DataValue(Box::new(serde_json::from_reader(r)?))),
59186            TypeVariant::PoolId => Ok(Self::PoolId(Box::new(serde_json::from_reader(r)?))),
59187            TypeVariant::AssetCode4 => Ok(Self::AssetCode4(Box::new(serde_json::from_reader(r)?))),
59188            TypeVariant::AssetCode12 => {
59189                Ok(Self::AssetCode12(Box::new(serde_json::from_reader(r)?)))
59190            }
59191            TypeVariant::AssetType => Ok(Self::AssetType(Box::new(serde_json::from_reader(r)?))),
59192            TypeVariant::AssetCode => Ok(Self::AssetCode(Box::new(serde_json::from_reader(r)?))),
59193            TypeVariant::AlphaNum4 => Ok(Self::AlphaNum4(Box::new(serde_json::from_reader(r)?))),
59194            TypeVariant::AlphaNum12 => Ok(Self::AlphaNum12(Box::new(serde_json::from_reader(r)?))),
59195            TypeVariant::Asset => Ok(Self::Asset(Box::new(serde_json::from_reader(r)?))),
59196            TypeVariant::Price => Ok(Self::Price(Box::new(serde_json::from_reader(r)?))),
59197            TypeVariant::Liabilities => {
59198                Ok(Self::Liabilities(Box::new(serde_json::from_reader(r)?)))
59199            }
59200            TypeVariant::ThresholdIndexes => Ok(Self::ThresholdIndexes(Box::new(
59201                serde_json::from_reader(r)?,
59202            ))),
59203            TypeVariant::LedgerEntryType => {
59204                Ok(Self::LedgerEntryType(Box::new(serde_json::from_reader(r)?)))
59205            }
59206            TypeVariant::Signer => Ok(Self::Signer(Box::new(serde_json::from_reader(r)?))),
59207            TypeVariant::AccountFlags => {
59208                Ok(Self::AccountFlags(Box::new(serde_json::from_reader(r)?)))
59209            }
59210            TypeVariant::SponsorshipDescriptor => Ok(Self::SponsorshipDescriptor(Box::new(
59211                serde_json::from_reader(r)?,
59212            ))),
59213            TypeVariant::AccountEntryExtensionV3 => Ok(Self::AccountEntryExtensionV3(Box::new(
59214                serde_json::from_reader(r)?,
59215            ))),
59216            TypeVariant::AccountEntryExtensionV2 => Ok(Self::AccountEntryExtensionV2(Box::new(
59217                serde_json::from_reader(r)?,
59218            ))),
59219            TypeVariant::AccountEntryExtensionV2Ext => Ok(Self::AccountEntryExtensionV2Ext(
59220                Box::new(serde_json::from_reader(r)?),
59221            )),
59222            TypeVariant::AccountEntryExtensionV1 => Ok(Self::AccountEntryExtensionV1(Box::new(
59223                serde_json::from_reader(r)?,
59224            ))),
59225            TypeVariant::AccountEntryExtensionV1Ext => Ok(Self::AccountEntryExtensionV1Ext(
59226                Box::new(serde_json::from_reader(r)?),
59227            )),
59228            TypeVariant::AccountEntry => {
59229                Ok(Self::AccountEntry(Box::new(serde_json::from_reader(r)?)))
59230            }
59231            TypeVariant::AccountEntryExt => {
59232                Ok(Self::AccountEntryExt(Box::new(serde_json::from_reader(r)?)))
59233            }
59234            TypeVariant::TrustLineFlags => {
59235                Ok(Self::TrustLineFlags(Box::new(serde_json::from_reader(r)?)))
59236            }
59237            TypeVariant::LiquidityPoolType => Ok(Self::LiquidityPoolType(Box::new(
59238                serde_json::from_reader(r)?,
59239            ))),
59240            TypeVariant::TrustLineAsset => {
59241                Ok(Self::TrustLineAsset(Box::new(serde_json::from_reader(r)?)))
59242            }
59243            TypeVariant::TrustLineEntryExtensionV2 => Ok(Self::TrustLineEntryExtensionV2(
59244                Box::new(serde_json::from_reader(r)?),
59245            )),
59246            TypeVariant::TrustLineEntryExtensionV2Ext => Ok(Self::TrustLineEntryExtensionV2Ext(
59247                Box::new(serde_json::from_reader(r)?),
59248            )),
59249            TypeVariant::TrustLineEntry => {
59250                Ok(Self::TrustLineEntry(Box::new(serde_json::from_reader(r)?)))
59251            }
59252            TypeVariant::TrustLineEntryExt => Ok(Self::TrustLineEntryExt(Box::new(
59253                serde_json::from_reader(r)?,
59254            ))),
59255            TypeVariant::TrustLineEntryV1 => Ok(Self::TrustLineEntryV1(Box::new(
59256                serde_json::from_reader(r)?,
59257            ))),
59258            TypeVariant::TrustLineEntryV1Ext => Ok(Self::TrustLineEntryV1Ext(Box::new(
59259                serde_json::from_reader(r)?,
59260            ))),
59261            TypeVariant::OfferEntryFlags => {
59262                Ok(Self::OfferEntryFlags(Box::new(serde_json::from_reader(r)?)))
59263            }
59264            TypeVariant::OfferEntry => Ok(Self::OfferEntry(Box::new(serde_json::from_reader(r)?))),
59265            TypeVariant::OfferEntryExt => {
59266                Ok(Self::OfferEntryExt(Box::new(serde_json::from_reader(r)?)))
59267            }
59268            TypeVariant::DataEntry => Ok(Self::DataEntry(Box::new(serde_json::from_reader(r)?))),
59269            TypeVariant::DataEntryExt => {
59270                Ok(Self::DataEntryExt(Box::new(serde_json::from_reader(r)?)))
59271            }
59272            TypeVariant::ClaimPredicateType => Ok(Self::ClaimPredicateType(Box::new(
59273                serde_json::from_reader(r)?,
59274            ))),
59275            TypeVariant::ClaimPredicate => {
59276                Ok(Self::ClaimPredicate(Box::new(serde_json::from_reader(r)?)))
59277            }
59278            TypeVariant::ClaimantType => {
59279                Ok(Self::ClaimantType(Box::new(serde_json::from_reader(r)?)))
59280            }
59281            TypeVariant::Claimant => Ok(Self::Claimant(Box::new(serde_json::from_reader(r)?))),
59282            TypeVariant::ClaimantV0 => Ok(Self::ClaimantV0(Box::new(serde_json::from_reader(r)?))),
59283            TypeVariant::ClaimableBalanceIdType => Ok(Self::ClaimableBalanceIdType(Box::new(
59284                serde_json::from_reader(r)?,
59285            ))),
59286            TypeVariant::ClaimableBalanceId => Ok(Self::ClaimableBalanceId(Box::new(
59287                serde_json::from_reader(r)?,
59288            ))),
59289            TypeVariant::ClaimableBalanceFlags => Ok(Self::ClaimableBalanceFlags(Box::new(
59290                serde_json::from_reader(r)?,
59291            ))),
59292            TypeVariant::ClaimableBalanceEntryExtensionV1 => Ok(
59293                Self::ClaimableBalanceEntryExtensionV1(Box::new(serde_json::from_reader(r)?)),
59294            ),
59295            TypeVariant::ClaimableBalanceEntryExtensionV1Ext => Ok(
59296                Self::ClaimableBalanceEntryExtensionV1Ext(Box::new(serde_json::from_reader(r)?)),
59297            ),
59298            TypeVariant::ClaimableBalanceEntry => Ok(Self::ClaimableBalanceEntry(Box::new(
59299                serde_json::from_reader(r)?,
59300            ))),
59301            TypeVariant::ClaimableBalanceEntryExt => Ok(Self::ClaimableBalanceEntryExt(Box::new(
59302                serde_json::from_reader(r)?,
59303            ))),
59304            TypeVariant::LiquidityPoolConstantProductParameters => Ok(
59305                Self::LiquidityPoolConstantProductParameters(Box::new(serde_json::from_reader(r)?)),
59306            ),
59307            TypeVariant::LiquidityPoolEntry => Ok(Self::LiquidityPoolEntry(Box::new(
59308                serde_json::from_reader(r)?,
59309            ))),
59310            TypeVariant::LiquidityPoolEntryBody => Ok(Self::LiquidityPoolEntryBody(Box::new(
59311                serde_json::from_reader(r)?,
59312            ))),
59313            TypeVariant::LiquidityPoolEntryConstantProduct => Ok(
59314                Self::LiquidityPoolEntryConstantProduct(Box::new(serde_json::from_reader(r)?)),
59315            ),
59316            TypeVariant::ContractDataDurability => Ok(Self::ContractDataDurability(Box::new(
59317                serde_json::from_reader(r)?,
59318            ))),
59319            TypeVariant::ContractDataEntry => Ok(Self::ContractDataEntry(Box::new(
59320                serde_json::from_reader(r)?,
59321            ))),
59322            TypeVariant::ContractCodeCostInputs => Ok(Self::ContractCodeCostInputs(Box::new(
59323                serde_json::from_reader(r)?,
59324            ))),
59325            TypeVariant::ContractCodeEntry => Ok(Self::ContractCodeEntry(Box::new(
59326                serde_json::from_reader(r)?,
59327            ))),
59328            TypeVariant::ContractCodeEntryExt => Ok(Self::ContractCodeEntryExt(Box::new(
59329                serde_json::from_reader(r)?,
59330            ))),
59331            TypeVariant::ContractCodeEntryV1 => Ok(Self::ContractCodeEntryV1(Box::new(
59332                serde_json::from_reader(r)?,
59333            ))),
59334            TypeVariant::TtlEntry => Ok(Self::TtlEntry(Box::new(serde_json::from_reader(r)?))),
59335            TypeVariant::LedgerEntryExtensionV1 => Ok(Self::LedgerEntryExtensionV1(Box::new(
59336                serde_json::from_reader(r)?,
59337            ))),
59338            TypeVariant::LedgerEntryExtensionV1Ext => Ok(Self::LedgerEntryExtensionV1Ext(
59339                Box::new(serde_json::from_reader(r)?),
59340            )),
59341            TypeVariant::LedgerEntry => {
59342                Ok(Self::LedgerEntry(Box::new(serde_json::from_reader(r)?)))
59343            }
59344            TypeVariant::LedgerEntryData => {
59345                Ok(Self::LedgerEntryData(Box::new(serde_json::from_reader(r)?)))
59346            }
59347            TypeVariant::LedgerEntryExt => {
59348                Ok(Self::LedgerEntryExt(Box::new(serde_json::from_reader(r)?)))
59349            }
59350            TypeVariant::LedgerKey => Ok(Self::LedgerKey(Box::new(serde_json::from_reader(r)?))),
59351            TypeVariant::LedgerKeyAccount => Ok(Self::LedgerKeyAccount(Box::new(
59352                serde_json::from_reader(r)?,
59353            ))),
59354            TypeVariant::LedgerKeyTrustLine => Ok(Self::LedgerKeyTrustLine(Box::new(
59355                serde_json::from_reader(r)?,
59356            ))),
59357            TypeVariant::LedgerKeyOffer => {
59358                Ok(Self::LedgerKeyOffer(Box::new(serde_json::from_reader(r)?)))
59359            }
59360            TypeVariant::LedgerKeyData => {
59361                Ok(Self::LedgerKeyData(Box::new(serde_json::from_reader(r)?)))
59362            }
59363            TypeVariant::LedgerKeyClaimableBalance => Ok(Self::LedgerKeyClaimableBalance(
59364                Box::new(serde_json::from_reader(r)?),
59365            )),
59366            TypeVariant::LedgerKeyLiquidityPool => Ok(Self::LedgerKeyLiquidityPool(Box::new(
59367                serde_json::from_reader(r)?,
59368            ))),
59369            TypeVariant::LedgerKeyContractData => Ok(Self::LedgerKeyContractData(Box::new(
59370                serde_json::from_reader(r)?,
59371            ))),
59372            TypeVariant::LedgerKeyContractCode => Ok(Self::LedgerKeyContractCode(Box::new(
59373                serde_json::from_reader(r)?,
59374            ))),
59375            TypeVariant::LedgerKeyConfigSetting => Ok(Self::LedgerKeyConfigSetting(Box::new(
59376                serde_json::from_reader(r)?,
59377            ))),
59378            TypeVariant::LedgerKeyTtl => {
59379                Ok(Self::LedgerKeyTtl(Box::new(serde_json::from_reader(r)?)))
59380            }
59381            TypeVariant::EnvelopeType => {
59382                Ok(Self::EnvelopeType(Box::new(serde_json::from_reader(r)?)))
59383            }
59384            TypeVariant::BucketListType => {
59385                Ok(Self::BucketListType(Box::new(serde_json::from_reader(r)?)))
59386            }
59387            TypeVariant::BucketEntryType => {
59388                Ok(Self::BucketEntryType(Box::new(serde_json::from_reader(r)?)))
59389            }
59390            TypeVariant::HotArchiveBucketEntryType => Ok(Self::HotArchiveBucketEntryType(
59391                Box::new(serde_json::from_reader(r)?),
59392            )),
59393            TypeVariant::ColdArchiveBucketEntryType => Ok(Self::ColdArchiveBucketEntryType(
59394                Box::new(serde_json::from_reader(r)?),
59395            )),
59396            TypeVariant::BucketMetadata => {
59397                Ok(Self::BucketMetadata(Box::new(serde_json::from_reader(r)?)))
59398            }
59399            TypeVariant::BucketMetadataExt => Ok(Self::BucketMetadataExt(Box::new(
59400                serde_json::from_reader(r)?,
59401            ))),
59402            TypeVariant::BucketEntry => {
59403                Ok(Self::BucketEntry(Box::new(serde_json::from_reader(r)?)))
59404            }
59405            TypeVariant::HotArchiveBucketEntry => Ok(Self::HotArchiveBucketEntry(Box::new(
59406                serde_json::from_reader(r)?,
59407            ))),
59408            TypeVariant::ColdArchiveArchivedLeaf => Ok(Self::ColdArchiveArchivedLeaf(Box::new(
59409                serde_json::from_reader(r)?,
59410            ))),
59411            TypeVariant::ColdArchiveDeletedLeaf => Ok(Self::ColdArchiveDeletedLeaf(Box::new(
59412                serde_json::from_reader(r)?,
59413            ))),
59414            TypeVariant::ColdArchiveBoundaryLeaf => Ok(Self::ColdArchiveBoundaryLeaf(Box::new(
59415                serde_json::from_reader(r)?,
59416            ))),
59417            TypeVariant::ColdArchiveHashEntry => Ok(Self::ColdArchiveHashEntry(Box::new(
59418                serde_json::from_reader(r)?,
59419            ))),
59420            TypeVariant::ColdArchiveBucketEntry => Ok(Self::ColdArchiveBucketEntry(Box::new(
59421                serde_json::from_reader(r)?,
59422            ))),
59423            TypeVariant::UpgradeType => {
59424                Ok(Self::UpgradeType(Box::new(serde_json::from_reader(r)?)))
59425            }
59426            TypeVariant::StellarValueType => Ok(Self::StellarValueType(Box::new(
59427                serde_json::from_reader(r)?,
59428            ))),
59429            TypeVariant::LedgerCloseValueSignature => Ok(Self::LedgerCloseValueSignature(
59430                Box::new(serde_json::from_reader(r)?),
59431            )),
59432            TypeVariant::StellarValue => {
59433                Ok(Self::StellarValue(Box::new(serde_json::from_reader(r)?)))
59434            }
59435            TypeVariant::StellarValueExt => {
59436                Ok(Self::StellarValueExt(Box::new(serde_json::from_reader(r)?)))
59437            }
59438            TypeVariant::LedgerHeaderFlags => Ok(Self::LedgerHeaderFlags(Box::new(
59439                serde_json::from_reader(r)?,
59440            ))),
59441            TypeVariant::LedgerHeaderExtensionV1 => Ok(Self::LedgerHeaderExtensionV1(Box::new(
59442                serde_json::from_reader(r)?,
59443            ))),
59444            TypeVariant::LedgerHeaderExtensionV1Ext => Ok(Self::LedgerHeaderExtensionV1Ext(
59445                Box::new(serde_json::from_reader(r)?),
59446            )),
59447            TypeVariant::LedgerHeader => {
59448                Ok(Self::LedgerHeader(Box::new(serde_json::from_reader(r)?)))
59449            }
59450            TypeVariant::LedgerHeaderExt => {
59451                Ok(Self::LedgerHeaderExt(Box::new(serde_json::from_reader(r)?)))
59452            }
59453            TypeVariant::LedgerUpgradeType => Ok(Self::LedgerUpgradeType(Box::new(
59454                serde_json::from_reader(r)?,
59455            ))),
59456            TypeVariant::ConfigUpgradeSetKey => Ok(Self::ConfigUpgradeSetKey(Box::new(
59457                serde_json::from_reader(r)?,
59458            ))),
59459            TypeVariant::LedgerUpgrade => {
59460                Ok(Self::LedgerUpgrade(Box::new(serde_json::from_reader(r)?)))
59461            }
59462            TypeVariant::ConfigUpgradeSet => Ok(Self::ConfigUpgradeSet(Box::new(
59463                serde_json::from_reader(r)?,
59464            ))),
59465            TypeVariant::TxSetComponentType => Ok(Self::TxSetComponentType(Box::new(
59466                serde_json::from_reader(r)?,
59467            ))),
59468            TypeVariant::TxSetComponent => {
59469                Ok(Self::TxSetComponent(Box::new(serde_json::from_reader(r)?)))
59470            }
59471            TypeVariant::TxSetComponentTxsMaybeDiscountedFee => Ok(
59472                Self::TxSetComponentTxsMaybeDiscountedFee(Box::new(serde_json::from_reader(r)?)),
59473            ),
59474            TypeVariant::TransactionPhase => Ok(Self::TransactionPhase(Box::new(
59475                serde_json::from_reader(r)?,
59476            ))),
59477            TypeVariant::TransactionSet => {
59478                Ok(Self::TransactionSet(Box::new(serde_json::from_reader(r)?)))
59479            }
59480            TypeVariant::TransactionSetV1 => Ok(Self::TransactionSetV1(Box::new(
59481                serde_json::from_reader(r)?,
59482            ))),
59483            TypeVariant::GeneralizedTransactionSet => Ok(Self::GeneralizedTransactionSet(
59484                Box::new(serde_json::from_reader(r)?),
59485            )),
59486            TypeVariant::TransactionResultPair => Ok(Self::TransactionResultPair(Box::new(
59487                serde_json::from_reader(r)?,
59488            ))),
59489            TypeVariant::TransactionResultSet => Ok(Self::TransactionResultSet(Box::new(
59490                serde_json::from_reader(r)?,
59491            ))),
59492            TypeVariant::TransactionHistoryEntry => Ok(Self::TransactionHistoryEntry(Box::new(
59493                serde_json::from_reader(r)?,
59494            ))),
59495            TypeVariant::TransactionHistoryEntryExt => Ok(Self::TransactionHistoryEntryExt(
59496                Box::new(serde_json::from_reader(r)?),
59497            )),
59498            TypeVariant::TransactionHistoryResultEntry => Ok(Self::TransactionHistoryResultEntry(
59499                Box::new(serde_json::from_reader(r)?),
59500            )),
59501            TypeVariant::TransactionHistoryResultEntryExt => Ok(
59502                Self::TransactionHistoryResultEntryExt(Box::new(serde_json::from_reader(r)?)),
59503            ),
59504            TypeVariant::LedgerHeaderHistoryEntry => Ok(Self::LedgerHeaderHistoryEntry(Box::new(
59505                serde_json::from_reader(r)?,
59506            ))),
59507            TypeVariant::LedgerHeaderHistoryEntryExt => Ok(Self::LedgerHeaderHistoryEntryExt(
59508                Box::new(serde_json::from_reader(r)?),
59509            )),
59510            TypeVariant::LedgerScpMessages => Ok(Self::LedgerScpMessages(Box::new(
59511                serde_json::from_reader(r)?,
59512            ))),
59513            TypeVariant::ScpHistoryEntryV0 => Ok(Self::ScpHistoryEntryV0(Box::new(
59514                serde_json::from_reader(r)?,
59515            ))),
59516            TypeVariant::ScpHistoryEntry => {
59517                Ok(Self::ScpHistoryEntry(Box::new(serde_json::from_reader(r)?)))
59518            }
59519            TypeVariant::LedgerEntryChangeType => Ok(Self::LedgerEntryChangeType(Box::new(
59520                serde_json::from_reader(r)?,
59521            ))),
59522            TypeVariant::LedgerEntryChange => Ok(Self::LedgerEntryChange(Box::new(
59523                serde_json::from_reader(r)?,
59524            ))),
59525            TypeVariant::LedgerEntryChanges => Ok(Self::LedgerEntryChanges(Box::new(
59526                serde_json::from_reader(r)?,
59527            ))),
59528            TypeVariant::OperationMeta => {
59529                Ok(Self::OperationMeta(Box::new(serde_json::from_reader(r)?)))
59530            }
59531            TypeVariant::TransactionMetaV1 => Ok(Self::TransactionMetaV1(Box::new(
59532                serde_json::from_reader(r)?,
59533            ))),
59534            TypeVariant::TransactionMetaV2 => Ok(Self::TransactionMetaV2(Box::new(
59535                serde_json::from_reader(r)?,
59536            ))),
59537            TypeVariant::ContractEventType => Ok(Self::ContractEventType(Box::new(
59538                serde_json::from_reader(r)?,
59539            ))),
59540            TypeVariant::ContractEvent => {
59541                Ok(Self::ContractEvent(Box::new(serde_json::from_reader(r)?)))
59542            }
59543            TypeVariant::ContractEventBody => Ok(Self::ContractEventBody(Box::new(
59544                serde_json::from_reader(r)?,
59545            ))),
59546            TypeVariant::ContractEventV0 => {
59547                Ok(Self::ContractEventV0(Box::new(serde_json::from_reader(r)?)))
59548            }
59549            TypeVariant::DiagnosticEvent => {
59550                Ok(Self::DiagnosticEvent(Box::new(serde_json::from_reader(r)?)))
59551            }
59552            TypeVariant::DiagnosticEvents => Ok(Self::DiagnosticEvents(Box::new(
59553                serde_json::from_reader(r)?,
59554            ))),
59555            TypeVariant::SorobanTransactionMetaExtV1 => Ok(Self::SorobanTransactionMetaExtV1(
59556                Box::new(serde_json::from_reader(r)?),
59557            )),
59558            TypeVariant::SorobanTransactionMetaExt => Ok(Self::SorobanTransactionMetaExt(
59559                Box::new(serde_json::from_reader(r)?),
59560            )),
59561            TypeVariant::SorobanTransactionMeta => Ok(Self::SorobanTransactionMeta(Box::new(
59562                serde_json::from_reader(r)?,
59563            ))),
59564            TypeVariant::TransactionMetaV3 => Ok(Self::TransactionMetaV3(Box::new(
59565                serde_json::from_reader(r)?,
59566            ))),
59567            TypeVariant::InvokeHostFunctionSuccessPreImage => Ok(
59568                Self::InvokeHostFunctionSuccessPreImage(Box::new(serde_json::from_reader(r)?)),
59569            ),
59570            TypeVariant::TransactionMeta => {
59571                Ok(Self::TransactionMeta(Box::new(serde_json::from_reader(r)?)))
59572            }
59573            TypeVariant::TransactionResultMeta => Ok(Self::TransactionResultMeta(Box::new(
59574                serde_json::from_reader(r)?,
59575            ))),
59576            TypeVariant::UpgradeEntryMeta => Ok(Self::UpgradeEntryMeta(Box::new(
59577                serde_json::from_reader(r)?,
59578            ))),
59579            TypeVariant::LedgerCloseMetaV0 => Ok(Self::LedgerCloseMetaV0(Box::new(
59580                serde_json::from_reader(r)?,
59581            ))),
59582            TypeVariant::LedgerCloseMetaExtV1 => Ok(Self::LedgerCloseMetaExtV1(Box::new(
59583                serde_json::from_reader(r)?,
59584            ))),
59585            TypeVariant::LedgerCloseMetaExt => Ok(Self::LedgerCloseMetaExt(Box::new(
59586                serde_json::from_reader(r)?,
59587            ))),
59588            TypeVariant::LedgerCloseMetaV1 => Ok(Self::LedgerCloseMetaV1(Box::new(
59589                serde_json::from_reader(r)?,
59590            ))),
59591            TypeVariant::LedgerCloseMeta => {
59592                Ok(Self::LedgerCloseMeta(Box::new(serde_json::from_reader(r)?)))
59593            }
59594            TypeVariant::ErrorCode => Ok(Self::ErrorCode(Box::new(serde_json::from_reader(r)?))),
59595            TypeVariant::SError => Ok(Self::SError(Box::new(serde_json::from_reader(r)?))),
59596            TypeVariant::SendMore => Ok(Self::SendMore(Box::new(serde_json::from_reader(r)?))),
59597            TypeVariant::SendMoreExtended => Ok(Self::SendMoreExtended(Box::new(
59598                serde_json::from_reader(r)?,
59599            ))),
59600            TypeVariant::AuthCert => Ok(Self::AuthCert(Box::new(serde_json::from_reader(r)?))),
59601            TypeVariant::Hello => Ok(Self::Hello(Box::new(serde_json::from_reader(r)?))),
59602            TypeVariant::Auth => Ok(Self::Auth(Box::new(serde_json::from_reader(r)?))),
59603            TypeVariant::IpAddrType => Ok(Self::IpAddrType(Box::new(serde_json::from_reader(r)?))),
59604            TypeVariant::PeerAddress => {
59605                Ok(Self::PeerAddress(Box::new(serde_json::from_reader(r)?)))
59606            }
59607            TypeVariant::PeerAddressIp => {
59608                Ok(Self::PeerAddressIp(Box::new(serde_json::from_reader(r)?)))
59609            }
59610            TypeVariant::MessageType => {
59611                Ok(Self::MessageType(Box::new(serde_json::from_reader(r)?)))
59612            }
59613            TypeVariant::DontHave => Ok(Self::DontHave(Box::new(serde_json::from_reader(r)?))),
59614            TypeVariant::SurveyMessageCommandType => Ok(Self::SurveyMessageCommandType(Box::new(
59615                serde_json::from_reader(r)?,
59616            ))),
59617            TypeVariant::SurveyMessageResponseType => Ok(Self::SurveyMessageResponseType(
59618                Box::new(serde_json::from_reader(r)?),
59619            )),
59620            TypeVariant::TimeSlicedSurveyStartCollectingMessage => Ok(
59621                Self::TimeSlicedSurveyStartCollectingMessage(Box::new(serde_json::from_reader(r)?)),
59622            ),
59623            TypeVariant::SignedTimeSlicedSurveyStartCollectingMessage => {
59624                Ok(Self::SignedTimeSlicedSurveyStartCollectingMessage(
59625                    Box::new(serde_json::from_reader(r)?),
59626                ))
59627            }
59628            TypeVariant::TimeSlicedSurveyStopCollectingMessage => Ok(
59629                Self::TimeSlicedSurveyStopCollectingMessage(Box::new(serde_json::from_reader(r)?)),
59630            ),
59631            TypeVariant::SignedTimeSlicedSurveyStopCollectingMessage => {
59632                Ok(Self::SignedTimeSlicedSurveyStopCollectingMessage(Box::new(
59633                    serde_json::from_reader(r)?,
59634                )))
59635            }
59636            TypeVariant::SurveyRequestMessage => Ok(Self::SurveyRequestMessage(Box::new(
59637                serde_json::from_reader(r)?,
59638            ))),
59639            TypeVariant::TimeSlicedSurveyRequestMessage => Ok(
59640                Self::TimeSlicedSurveyRequestMessage(Box::new(serde_json::from_reader(r)?)),
59641            ),
59642            TypeVariant::SignedSurveyRequestMessage => Ok(Self::SignedSurveyRequestMessage(
59643                Box::new(serde_json::from_reader(r)?),
59644            )),
59645            TypeVariant::SignedTimeSlicedSurveyRequestMessage => Ok(
59646                Self::SignedTimeSlicedSurveyRequestMessage(Box::new(serde_json::from_reader(r)?)),
59647            ),
59648            TypeVariant::EncryptedBody => {
59649                Ok(Self::EncryptedBody(Box::new(serde_json::from_reader(r)?)))
59650            }
59651            TypeVariant::SurveyResponseMessage => Ok(Self::SurveyResponseMessage(Box::new(
59652                serde_json::from_reader(r)?,
59653            ))),
59654            TypeVariant::TimeSlicedSurveyResponseMessage => Ok(
59655                Self::TimeSlicedSurveyResponseMessage(Box::new(serde_json::from_reader(r)?)),
59656            ),
59657            TypeVariant::SignedSurveyResponseMessage => Ok(Self::SignedSurveyResponseMessage(
59658                Box::new(serde_json::from_reader(r)?),
59659            )),
59660            TypeVariant::SignedTimeSlicedSurveyResponseMessage => Ok(
59661                Self::SignedTimeSlicedSurveyResponseMessage(Box::new(serde_json::from_reader(r)?)),
59662            ),
59663            TypeVariant::PeerStats => Ok(Self::PeerStats(Box::new(serde_json::from_reader(r)?))),
59664            TypeVariant::PeerStatList => {
59665                Ok(Self::PeerStatList(Box::new(serde_json::from_reader(r)?)))
59666            }
59667            TypeVariant::TimeSlicedNodeData => Ok(Self::TimeSlicedNodeData(Box::new(
59668                serde_json::from_reader(r)?,
59669            ))),
59670            TypeVariant::TimeSlicedPeerData => Ok(Self::TimeSlicedPeerData(Box::new(
59671                serde_json::from_reader(r)?,
59672            ))),
59673            TypeVariant::TimeSlicedPeerDataList => Ok(Self::TimeSlicedPeerDataList(Box::new(
59674                serde_json::from_reader(r)?,
59675            ))),
59676            TypeVariant::TopologyResponseBodyV0 => Ok(Self::TopologyResponseBodyV0(Box::new(
59677                serde_json::from_reader(r)?,
59678            ))),
59679            TypeVariant::TopologyResponseBodyV1 => Ok(Self::TopologyResponseBodyV1(Box::new(
59680                serde_json::from_reader(r)?,
59681            ))),
59682            TypeVariant::TopologyResponseBodyV2 => Ok(Self::TopologyResponseBodyV2(Box::new(
59683                serde_json::from_reader(r)?,
59684            ))),
59685            TypeVariant::SurveyResponseBody => Ok(Self::SurveyResponseBody(Box::new(
59686                serde_json::from_reader(r)?,
59687            ))),
59688            TypeVariant::TxAdvertVector => {
59689                Ok(Self::TxAdvertVector(Box::new(serde_json::from_reader(r)?)))
59690            }
59691            TypeVariant::FloodAdvert => {
59692                Ok(Self::FloodAdvert(Box::new(serde_json::from_reader(r)?)))
59693            }
59694            TypeVariant::TxDemandVector => {
59695                Ok(Self::TxDemandVector(Box::new(serde_json::from_reader(r)?)))
59696            }
59697            TypeVariant::FloodDemand => {
59698                Ok(Self::FloodDemand(Box::new(serde_json::from_reader(r)?)))
59699            }
59700            TypeVariant::StellarMessage => {
59701                Ok(Self::StellarMessage(Box::new(serde_json::from_reader(r)?)))
59702            }
59703            TypeVariant::AuthenticatedMessage => Ok(Self::AuthenticatedMessage(Box::new(
59704                serde_json::from_reader(r)?,
59705            ))),
59706            TypeVariant::AuthenticatedMessageV0 => Ok(Self::AuthenticatedMessageV0(Box::new(
59707                serde_json::from_reader(r)?,
59708            ))),
59709            TypeVariant::LiquidityPoolParameters => Ok(Self::LiquidityPoolParameters(Box::new(
59710                serde_json::from_reader(r)?,
59711            ))),
59712            TypeVariant::MuxedAccount => {
59713                Ok(Self::MuxedAccount(Box::new(serde_json::from_reader(r)?)))
59714            }
59715            TypeVariant::MuxedAccountMed25519 => Ok(Self::MuxedAccountMed25519(Box::new(
59716                serde_json::from_reader(r)?,
59717            ))),
59718            TypeVariant::DecoratedSignature => Ok(Self::DecoratedSignature(Box::new(
59719                serde_json::from_reader(r)?,
59720            ))),
59721            TypeVariant::OperationType => {
59722                Ok(Self::OperationType(Box::new(serde_json::from_reader(r)?)))
59723            }
59724            TypeVariant::CreateAccountOp => {
59725                Ok(Self::CreateAccountOp(Box::new(serde_json::from_reader(r)?)))
59726            }
59727            TypeVariant::PaymentOp => Ok(Self::PaymentOp(Box::new(serde_json::from_reader(r)?))),
59728            TypeVariant::PathPaymentStrictReceiveOp => Ok(Self::PathPaymentStrictReceiveOp(
59729                Box::new(serde_json::from_reader(r)?),
59730            )),
59731            TypeVariant::PathPaymentStrictSendOp => Ok(Self::PathPaymentStrictSendOp(Box::new(
59732                serde_json::from_reader(r)?,
59733            ))),
59734            TypeVariant::ManageSellOfferOp => Ok(Self::ManageSellOfferOp(Box::new(
59735                serde_json::from_reader(r)?,
59736            ))),
59737            TypeVariant::ManageBuyOfferOp => Ok(Self::ManageBuyOfferOp(Box::new(
59738                serde_json::from_reader(r)?,
59739            ))),
59740            TypeVariant::CreatePassiveSellOfferOp => Ok(Self::CreatePassiveSellOfferOp(Box::new(
59741                serde_json::from_reader(r)?,
59742            ))),
59743            TypeVariant::SetOptionsOp => {
59744                Ok(Self::SetOptionsOp(Box::new(serde_json::from_reader(r)?)))
59745            }
59746            TypeVariant::ChangeTrustAsset => Ok(Self::ChangeTrustAsset(Box::new(
59747                serde_json::from_reader(r)?,
59748            ))),
59749            TypeVariant::ChangeTrustOp => {
59750                Ok(Self::ChangeTrustOp(Box::new(serde_json::from_reader(r)?)))
59751            }
59752            TypeVariant::AllowTrustOp => {
59753                Ok(Self::AllowTrustOp(Box::new(serde_json::from_reader(r)?)))
59754            }
59755            TypeVariant::ManageDataOp => {
59756                Ok(Self::ManageDataOp(Box::new(serde_json::from_reader(r)?)))
59757            }
59758            TypeVariant::BumpSequenceOp => {
59759                Ok(Self::BumpSequenceOp(Box::new(serde_json::from_reader(r)?)))
59760            }
59761            TypeVariant::CreateClaimableBalanceOp => Ok(Self::CreateClaimableBalanceOp(Box::new(
59762                serde_json::from_reader(r)?,
59763            ))),
59764            TypeVariant::ClaimClaimableBalanceOp => Ok(Self::ClaimClaimableBalanceOp(Box::new(
59765                serde_json::from_reader(r)?,
59766            ))),
59767            TypeVariant::BeginSponsoringFutureReservesOp => Ok(
59768                Self::BeginSponsoringFutureReservesOp(Box::new(serde_json::from_reader(r)?)),
59769            ),
59770            TypeVariant::RevokeSponsorshipType => Ok(Self::RevokeSponsorshipType(Box::new(
59771                serde_json::from_reader(r)?,
59772            ))),
59773            TypeVariant::RevokeSponsorshipOp => Ok(Self::RevokeSponsorshipOp(Box::new(
59774                serde_json::from_reader(r)?,
59775            ))),
59776            TypeVariant::RevokeSponsorshipOpSigner => Ok(Self::RevokeSponsorshipOpSigner(
59777                Box::new(serde_json::from_reader(r)?),
59778            )),
59779            TypeVariant::ClawbackOp => Ok(Self::ClawbackOp(Box::new(serde_json::from_reader(r)?))),
59780            TypeVariant::ClawbackClaimableBalanceOp => Ok(Self::ClawbackClaimableBalanceOp(
59781                Box::new(serde_json::from_reader(r)?),
59782            )),
59783            TypeVariant::SetTrustLineFlagsOp => Ok(Self::SetTrustLineFlagsOp(Box::new(
59784                serde_json::from_reader(r)?,
59785            ))),
59786            TypeVariant::LiquidityPoolDepositOp => Ok(Self::LiquidityPoolDepositOp(Box::new(
59787                serde_json::from_reader(r)?,
59788            ))),
59789            TypeVariant::LiquidityPoolWithdrawOp => Ok(Self::LiquidityPoolWithdrawOp(Box::new(
59790                serde_json::from_reader(r)?,
59791            ))),
59792            TypeVariant::HostFunctionType => Ok(Self::HostFunctionType(Box::new(
59793                serde_json::from_reader(r)?,
59794            ))),
59795            TypeVariant::ContractIdPreimageType => Ok(Self::ContractIdPreimageType(Box::new(
59796                serde_json::from_reader(r)?,
59797            ))),
59798            TypeVariant::ContractIdPreimage => Ok(Self::ContractIdPreimage(Box::new(
59799                serde_json::from_reader(r)?,
59800            ))),
59801            TypeVariant::ContractIdPreimageFromAddress => Ok(Self::ContractIdPreimageFromAddress(
59802                Box::new(serde_json::from_reader(r)?),
59803            )),
59804            TypeVariant::CreateContractArgs => Ok(Self::CreateContractArgs(Box::new(
59805                serde_json::from_reader(r)?,
59806            ))),
59807            TypeVariant::CreateContractArgsV2 => Ok(Self::CreateContractArgsV2(Box::new(
59808                serde_json::from_reader(r)?,
59809            ))),
59810            TypeVariant::InvokeContractArgs => Ok(Self::InvokeContractArgs(Box::new(
59811                serde_json::from_reader(r)?,
59812            ))),
59813            TypeVariant::HostFunction => {
59814                Ok(Self::HostFunction(Box::new(serde_json::from_reader(r)?)))
59815            }
59816            TypeVariant::SorobanAuthorizedFunctionType => Ok(Self::SorobanAuthorizedFunctionType(
59817                Box::new(serde_json::from_reader(r)?),
59818            )),
59819            TypeVariant::SorobanAuthorizedFunction => Ok(Self::SorobanAuthorizedFunction(
59820                Box::new(serde_json::from_reader(r)?),
59821            )),
59822            TypeVariant::SorobanAuthorizedInvocation => Ok(Self::SorobanAuthorizedInvocation(
59823                Box::new(serde_json::from_reader(r)?),
59824            )),
59825            TypeVariant::SorobanAddressCredentials => Ok(Self::SorobanAddressCredentials(
59826                Box::new(serde_json::from_reader(r)?),
59827            )),
59828            TypeVariant::SorobanCredentialsType => Ok(Self::SorobanCredentialsType(Box::new(
59829                serde_json::from_reader(r)?,
59830            ))),
59831            TypeVariant::SorobanCredentials => Ok(Self::SorobanCredentials(Box::new(
59832                serde_json::from_reader(r)?,
59833            ))),
59834            TypeVariant::SorobanAuthorizationEntry => Ok(Self::SorobanAuthorizationEntry(
59835                Box::new(serde_json::from_reader(r)?),
59836            )),
59837            TypeVariant::InvokeHostFunctionOp => Ok(Self::InvokeHostFunctionOp(Box::new(
59838                serde_json::from_reader(r)?,
59839            ))),
59840            TypeVariant::ExtendFootprintTtlOp => Ok(Self::ExtendFootprintTtlOp(Box::new(
59841                serde_json::from_reader(r)?,
59842            ))),
59843            TypeVariant::RestoreFootprintOp => Ok(Self::RestoreFootprintOp(Box::new(
59844                serde_json::from_reader(r)?,
59845            ))),
59846            TypeVariant::Operation => Ok(Self::Operation(Box::new(serde_json::from_reader(r)?))),
59847            TypeVariant::OperationBody => {
59848                Ok(Self::OperationBody(Box::new(serde_json::from_reader(r)?)))
59849            }
59850            TypeVariant::HashIdPreimage => {
59851                Ok(Self::HashIdPreimage(Box::new(serde_json::from_reader(r)?)))
59852            }
59853            TypeVariant::HashIdPreimageOperationId => Ok(Self::HashIdPreimageOperationId(
59854                Box::new(serde_json::from_reader(r)?),
59855            )),
59856            TypeVariant::HashIdPreimageRevokeId => Ok(Self::HashIdPreimageRevokeId(Box::new(
59857                serde_json::from_reader(r)?,
59858            ))),
59859            TypeVariant::HashIdPreimageContractId => Ok(Self::HashIdPreimageContractId(Box::new(
59860                serde_json::from_reader(r)?,
59861            ))),
59862            TypeVariant::HashIdPreimageSorobanAuthorization => Ok(
59863                Self::HashIdPreimageSorobanAuthorization(Box::new(serde_json::from_reader(r)?)),
59864            ),
59865            TypeVariant::MemoType => Ok(Self::MemoType(Box::new(serde_json::from_reader(r)?))),
59866            TypeVariant::Memo => Ok(Self::Memo(Box::new(serde_json::from_reader(r)?))),
59867            TypeVariant::TimeBounds => Ok(Self::TimeBounds(Box::new(serde_json::from_reader(r)?))),
59868            TypeVariant::LedgerBounds => {
59869                Ok(Self::LedgerBounds(Box::new(serde_json::from_reader(r)?)))
59870            }
59871            TypeVariant::PreconditionsV2 => {
59872                Ok(Self::PreconditionsV2(Box::new(serde_json::from_reader(r)?)))
59873            }
59874            TypeVariant::PreconditionType => Ok(Self::PreconditionType(Box::new(
59875                serde_json::from_reader(r)?,
59876            ))),
59877            TypeVariant::Preconditions => {
59878                Ok(Self::Preconditions(Box::new(serde_json::from_reader(r)?)))
59879            }
59880            TypeVariant::LedgerFootprint => {
59881                Ok(Self::LedgerFootprint(Box::new(serde_json::from_reader(r)?)))
59882            }
59883            TypeVariant::ArchivalProofType => Ok(Self::ArchivalProofType(Box::new(
59884                serde_json::from_reader(r)?,
59885            ))),
59886            TypeVariant::ArchivalProofNode => Ok(Self::ArchivalProofNode(Box::new(
59887                serde_json::from_reader(r)?,
59888            ))),
59889            TypeVariant::ProofLevel => Ok(Self::ProofLevel(Box::new(serde_json::from_reader(r)?))),
59890            TypeVariant::NonexistenceProofBody => Ok(Self::NonexistenceProofBody(Box::new(
59891                serde_json::from_reader(r)?,
59892            ))),
59893            TypeVariant::ExistenceProofBody => Ok(Self::ExistenceProofBody(Box::new(
59894                serde_json::from_reader(r)?,
59895            ))),
59896            TypeVariant::ArchivalProof => {
59897                Ok(Self::ArchivalProof(Box::new(serde_json::from_reader(r)?)))
59898            }
59899            TypeVariant::ArchivalProofBody => Ok(Self::ArchivalProofBody(Box::new(
59900                serde_json::from_reader(r)?,
59901            ))),
59902            TypeVariant::SorobanResources => Ok(Self::SorobanResources(Box::new(
59903                serde_json::from_reader(r)?,
59904            ))),
59905            TypeVariant::SorobanTransactionData => Ok(Self::SorobanTransactionData(Box::new(
59906                serde_json::from_reader(r)?,
59907            ))),
59908            TypeVariant::TransactionV0 => {
59909                Ok(Self::TransactionV0(Box::new(serde_json::from_reader(r)?)))
59910            }
59911            TypeVariant::TransactionV0Ext => Ok(Self::TransactionV0Ext(Box::new(
59912                serde_json::from_reader(r)?,
59913            ))),
59914            TypeVariant::TransactionV0Envelope => Ok(Self::TransactionV0Envelope(Box::new(
59915                serde_json::from_reader(r)?,
59916            ))),
59917            TypeVariant::Transaction => {
59918                Ok(Self::Transaction(Box::new(serde_json::from_reader(r)?)))
59919            }
59920            TypeVariant::TransactionExt => {
59921                Ok(Self::TransactionExt(Box::new(serde_json::from_reader(r)?)))
59922            }
59923            TypeVariant::TransactionV1Envelope => Ok(Self::TransactionV1Envelope(Box::new(
59924                serde_json::from_reader(r)?,
59925            ))),
59926            TypeVariant::FeeBumpTransaction => Ok(Self::FeeBumpTransaction(Box::new(
59927                serde_json::from_reader(r)?,
59928            ))),
59929            TypeVariant::FeeBumpTransactionInnerTx => Ok(Self::FeeBumpTransactionInnerTx(
59930                Box::new(serde_json::from_reader(r)?),
59931            )),
59932            TypeVariant::FeeBumpTransactionExt => Ok(Self::FeeBumpTransactionExt(Box::new(
59933                serde_json::from_reader(r)?,
59934            ))),
59935            TypeVariant::FeeBumpTransactionEnvelope => Ok(Self::FeeBumpTransactionEnvelope(
59936                Box::new(serde_json::from_reader(r)?),
59937            )),
59938            TypeVariant::TransactionEnvelope => Ok(Self::TransactionEnvelope(Box::new(
59939                serde_json::from_reader(r)?,
59940            ))),
59941            TypeVariant::TransactionSignaturePayload => Ok(Self::TransactionSignaturePayload(
59942                Box::new(serde_json::from_reader(r)?),
59943            )),
59944            TypeVariant::TransactionSignaturePayloadTaggedTransaction => {
59945                Ok(Self::TransactionSignaturePayloadTaggedTransaction(
59946                    Box::new(serde_json::from_reader(r)?),
59947                ))
59948            }
59949            TypeVariant::ClaimAtomType => {
59950                Ok(Self::ClaimAtomType(Box::new(serde_json::from_reader(r)?)))
59951            }
59952            TypeVariant::ClaimOfferAtomV0 => Ok(Self::ClaimOfferAtomV0(Box::new(
59953                serde_json::from_reader(r)?,
59954            ))),
59955            TypeVariant::ClaimOfferAtom => {
59956                Ok(Self::ClaimOfferAtom(Box::new(serde_json::from_reader(r)?)))
59957            }
59958            TypeVariant::ClaimLiquidityAtom => Ok(Self::ClaimLiquidityAtom(Box::new(
59959                serde_json::from_reader(r)?,
59960            ))),
59961            TypeVariant::ClaimAtom => Ok(Self::ClaimAtom(Box::new(serde_json::from_reader(r)?))),
59962            TypeVariant::CreateAccountResultCode => Ok(Self::CreateAccountResultCode(Box::new(
59963                serde_json::from_reader(r)?,
59964            ))),
59965            TypeVariant::CreateAccountResult => Ok(Self::CreateAccountResult(Box::new(
59966                serde_json::from_reader(r)?,
59967            ))),
59968            TypeVariant::PaymentResultCode => Ok(Self::PaymentResultCode(Box::new(
59969                serde_json::from_reader(r)?,
59970            ))),
59971            TypeVariant::PaymentResult => {
59972                Ok(Self::PaymentResult(Box::new(serde_json::from_reader(r)?)))
59973            }
59974            TypeVariant::PathPaymentStrictReceiveResultCode => Ok(
59975                Self::PathPaymentStrictReceiveResultCode(Box::new(serde_json::from_reader(r)?)),
59976            ),
59977            TypeVariant::SimplePaymentResult => Ok(Self::SimplePaymentResult(Box::new(
59978                serde_json::from_reader(r)?,
59979            ))),
59980            TypeVariant::PathPaymentStrictReceiveResult => Ok(
59981                Self::PathPaymentStrictReceiveResult(Box::new(serde_json::from_reader(r)?)),
59982            ),
59983            TypeVariant::PathPaymentStrictReceiveResultSuccess => Ok(
59984                Self::PathPaymentStrictReceiveResultSuccess(Box::new(serde_json::from_reader(r)?)),
59985            ),
59986            TypeVariant::PathPaymentStrictSendResultCode => Ok(
59987                Self::PathPaymentStrictSendResultCode(Box::new(serde_json::from_reader(r)?)),
59988            ),
59989            TypeVariant::PathPaymentStrictSendResult => Ok(Self::PathPaymentStrictSendResult(
59990                Box::new(serde_json::from_reader(r)?),
59991            )),
59992            TypeVariant::PathPaymentStrictSendResultSuccess => Ok(
59993                Self::PathPaymentStrictSendResultSuccess(Box::new(serde_json::from_reader(r)?)),
59994            ),
59995            TypeVariant::ManageSellOfferResultCode => Ok(Self::ManageSellOfferResultCode(
59996                Box::new(serde_json::from_reader(r)?),
59997            )),
59998            TypeVariant::ManageOfferEffect => Ok(Self::ManageOfferEffect(Box::new(
59999                serde_json::from_reader(r)?,
60000            ))),
60001            TypeVariant::ManageOfferSuccessResult => Ok(Self::ManageOfferSuccessResult(Box::new(
60002                serde_json::from_reader(r)?,
60003            ))),
60004            TypeVariant::ManageOfferSuccessResultOffer => Ok(Self::ManageOfferSuccessResultOffer(
60005                Box::new(serde_json::from_reader(r)?),
60006            )),
60007            TypeVariant::ManageSellOfferResult => Ok(Self::ManageSellOfferResult(Box::new(
60008                serde_json::from_reader(r)?,
60009            ))),
60010            TypeVariant::ManageBuyOfferResultCode => Ok(Self::ManageBuyOfferResultCode(Box::new(
60011                serde_json::from_reader(r)?,
60012            ))),
60013            TypeVariant::ManageBuyOfferResult => Ok(Self::ManageBuyOfferResult(Box::new(
60014                serde_json::from_reader(r)?,
60015            ))),
60016            TypeVariant::SetOptionsResultCode => Ok(Self::SetOptionsResultCode(Box::new(
60017                serde_json::from_reader(r)?,
60018            ))),
60019            TypeVariant::SetOptionsResult => Ok(Self::SetOptionsResult(Box::new(
60020                serde_json::from_reader(r)?,
60021            ))),
60022            TypeVariant::ChangeTrustResultCode => Ok(Self::ChangeTrustResultCode(Box::new(
60023                serde_json::from_reader(r)?,
60024            ))),
60025            TypeVariant::ChangeTrustResult => Ok(Self::ChangeTrustResult(Box::new(
60026                serde_json::from_reader(r)?,
60027            ))),
60028            TypeVariant::AllowTrustResultCode => Ok(Self::AllowTrustResultCode(Box::new(
60029                serde_json::from_reader(r)?,
60030            ))),
60031            TypeVariant::AllowTrustResult => Ok(Self::AllowTrustResult(Box::new(
60032                serde_json::from_reader(r)?,
60033            ))),
60034            TypeVariant::AccountMergeResultCode => Ok(Self::AccountMergeResultCode(Box::new(
60035                serde_json::from_reader(r)?,
60036            ))),
60037            TypeVariant::AccountMergeResult => Ok(Self::AccountMergeResult(Box::new(
60038                serde_json::from_reader(r)?,
60039            ))),
60040            TypeVariant::InflationResultCode => Ok(Self::InflationResultCode(Box::new(
60041                serde_json::from_reader(r)?,
60042            ))),
60043            TypeVariant::InflationPayout => {
60044                Ok(Self::InflationPayout(Box::new(serde_json::from_reader(r)?)))
60045            }
60046            TypeVariant::InflationResult => {
60047                Ok(Self::InflationResult(Box::new(serde_json::from_reader(r)?)))
60048            }
60049            TypeVariant::ManageDataResultCode => Ok(Self::ManageDataResultCode(Box::new(
60050                serde_json::from_reader(r)?,
60051            ))),
60052            TypeVariant::ManageDataResult => Ok(Self::ManageDataResult(Box::new(
60053                serde_json::from_reader(r)?,
60054            ))),
60055            TypeVariant::BumpSequenceResultCode => Ok(Self::BumpSequenceResultCode(Box::new(
60056                serde_json::from_reader(r)?,
60057            ))),
60058            TypeVariant::BumpSequenceResult => Ok(Self::BumpSequenceResult(Box::new(
60059                serde_json::from_reader(r)?,
60060            ))),
60061            TypeVariant::CreateClaimableBalanceResultCode => Ok(
60062                Self::CreateClaimableBalanceResultCode(Box::new(serde_json::from_reader(r)?)),
60063            ),
60064            TypeVariant::CreateClaimableBalanceResult => Ok(Self::CreateClaimableBalanceResult(
60065                Box::new(serde_json::from_reader(r)?),
60066            )),
60067            TypeVariant::ClaimClaimableBalanceResultCode => Ok(
60068                Self::ClaimClaimableBalanceResultCode(Box::new(serde_json::from_reader(r)?)),
60069            ),
60070            TypeVariant::ClaimClaimableBalanceResult => Ok(Self::ClaimClaimableBalanceResult(
60071                Box::new(serde_json::from_reader(r)?),
60072            )),
60073            TypeVariant::BeginSponsoringFutureReservesResultCode => {
60074                Ok(Self::BeginSponsoringFutureReservesResultCode(Box::new(
60075                    serde_json::from_reader(r)?,
60076                )))
60077            }
60078            TypeVariant::BeginSponsoringFutureReservesResult => Ok(
60079                Self::BeginSponsoringFutureReservesResult(Box::new(serde_json::from_reader(r)?)),
60080            ),
60081            TypeVariant::EndSponsoringFutureReservesResultCode => Ok(
60082                Self::EndSponsoringFutureReservesResultCode(Box::new(serde_json::from_reader(r)?)),
60083            ),
60084            TypeVariant::EndSponsoringFutureReservesResult => Ok(
60085                Self::EndSponsoringFutureReservesResult(Box::new(serde_json::from_reader(r)?)),
60086            ),
60087            TypeVariant::RevokeSponsorshipResultCode => Ok(Self::RevokeSponsorshipResultCode(
60088                Box::new(serde_json::from_reader(r)?),
60089            )),
60090            TypeVariant::RevokeSponsorshipResult => Ok(Self::RevokeSponsorshipResult(Box::new(
60091                serde_json::from_reader(r)?,
60092            ))),
60093            TypeVariant::ClawbackResultCode => Ok(Self::ClawbackResultCode(Box::new(
60094                serde_json::from_reader(r)?,
60095            ))),
60096            TypeVariant::ClawbackResult => {
60097                Ok(Self::ClawbackResult(Box::new(serde_json::from_reader(r)?)))
60098            }
60099            TypeVariant::ClawbackClaimableBalanceResultCode => Ok(
60100                Self::ClawbackClaimableBalanceResultCode(Box::new(serde_json::from_reader(r)?)),
60101            ),
60102            TypeVariant::ClawbackClaimableBalanceResult => Ok(
60103                Self::ClawbackClaimableBalanceResult(Box::new(serde_json::from_reader(r)?)),
60104            ),
60105            TypeVariant::SetTrustLineFlagsResultCode => Ok(Self::SetTrustLineFlagsResultCode(
60106                Box::new(serde_json::from_reader(r)?),
60107            )),
60108            TypeVariant::SetTrustLineFlagsResult => Ok(Self::SetTrustLineFlagsResult(Box::new(
60109                serde_json::from_reader(r)?,
60110            ))),
60111            TypeVariant::LiquidityPoolDepositResultCode => Ok(
60112                Self::LiquidityPoolDepositResultCode(Box::new(serde_json::from_reader(r)?)),
60113            ),
60114            TypeVariant::LiquidityPoolDepositResult => Ok(Self::LiquidityPoolDepositResult(
60115                Box::new(serde_json::from_reader(r)?),
60116            )),
60117            TypeVariant::LiquidityPoolWithdrawResultCode => Ok(
60118                Self::LiquidityPoolWithdrawResultCode(Box::new(serde_json::from_reader(r)?)),
60119            ),
60120            TypeVariant::LiquidityPoolWithdrawResult => Ok(Self::LiquidityPoolWithdrawResult(
60121                Box::new(serde_json::from_reader(r)?),
60122            )),
60123            TypeVariant::InvokeHostFunctionResultCode => Ok(Self::InvokeHostFunctionResultCode(
60124                Box::new(serde_json::from_reader(r)?),
60125            )),
60126            TypeVariant::InvokeHostFunctionResult => Ok(Self::InvokeHostFunctionResult(Box::new(
60127                serde_json::from_reader(r)?,
60128            ))),
60129            TypeVariant::ExtendFootprintTtlResultCode => Ok(Self::ExtendFootprintTtlResultCode(
60130                Box::new(serde_json::from_reader(r)?),
60131            )),
60132            TypeVariant::ExtendFootprintTtlResult => Ok(Self::ExtendFootprintTtlResult(Box::new(
60133                serde_json::from_reader(r)?,
60134            ))),
60135            TypeVariant::RestoreFootprintResultCode => Ok(Self::RestoreFootprintResultCode(
60136                Box::new(serde_json::from_reader(r)?),
60137            )),
60138            TypeVariant::RestoreFootprintResult => Ok(Self::RestoreFootprintResult(Box::new(
60139                serde_json::from_reader(r)?,
60140            ))),
60141            TypeVariant::OperationResultCode => Ok(Self::OperationResultCode(Box::new(
60142                serde_json::from_reader(r)?,
60143            ))),
60144            TypeVariant::OperationResult => {
60145                Ok(Self::OperationResult(Box::new(serde_json::from_reader(r)?)))
60146            }
60147            TypeVariant::OperationResultTr => Ok(Self::OperationResultTr(Box::new(
60148                serde_json::from_reader(r)?,
60149            ))),
60150            TypeVariant::TransactionResultCode => Ok(Self::TransactionResultCode(Box::new(
60151                serde_json::from_reader(r)?,
60152            ))),
60153            TypeVariant::InnerTransactionResult => Ok(Self::InnerTransactionResult(Box::new(
60154                serde_json::from_reader(r)?,
60155            ))),
60156            TypeVariant::InnerTransactionResultResult => Ok(Self::InnerTransactionResultResult(
60157                Box::new(serde_json::from_reader(r)?),
60158            )),
60159            TypeVariant::InnerTransactionResultExt => Ok(Self::InnerTransactionResultExt(
60160                Box::new(serde_json::from_reader(r)?),
60161            )),
60162            TypeVariant::InnerTransactionResultPair => Ok(Self::InnerTransactionResultPair(
60163                Box::new(serde_json::from_reader(r)?),
60164            )),
60165            TypeVariant::TransactionResult => Ok(Self::TransactionResult(Box::new(
60166                serde_json::from_reader(r)?,
60167            ))),
60168            TypeVariant::TransactionResultResult => Ok(Self::TransactionResultResult(Box::new(
60169                serde_json::from_reader(r)?,
60170            ))),
60171            TypeVariant::TransactionResultExt => Ok(Self::TransactionResultExt(Box::new(
60172                serde_json::from_reader(r)?,
60173            ))),
60174            TypeVariant::Hash => Ok(Self::Hash(Box::new(serde_json::from_reader(r)?))),
60175            TypeVariant::Uint256 => Ok(Self::Uint256(Box::new(serde_json::from_reader(r)?))),
60176            TypeVariant::Uint32 => Ok(Self::Uint32(Box::new(serde_json::from_reader(r)?))),
60177            TypeVariant::Int32 => Ok(Self::Int32(Box::new(serde_json::from_reader(r)?))),
60178            TypeVariant::Uint64 => Ok(Self::Uint64(Box::new(serde_json::from_reader(r)?))),
60179            TypeVariant::Int64 => Ok(Self::Int64(Box::new(serde_json::from_reader(r)?))),
60180            TypeVariant::TimePoint => Ok(Self::TimePoint(Box::new(serde_json::from_reader(r)?))),
60181            TypeVariant::Duration => Ok(Self::Duration(Box::new(serde_json::from_reader(r)?))),
60182            TypeVariant::ExtensionPoint => {
60183                Ok(Self::ExtensionPoint(Box::new(serde_json::from_reader(r)?)))
60184            }
60185            TypeVariant::CryptoKeyType => {
60186                Ok(Self::CryptoKeyType(Box::new(serde_json::from_reader(r)?)))
60187            }
60188            TypeVariant::PublicKeyType => {
60189                Ok(Self::PublicKeyType(Box::new(serde_json::from_reader(r)?)))
60190            }
60191            TypeVariant::SignerKeyType => {
60192                Ok(Self::SignerKeyType(Box::new(serde_json::from_reader(r)?)))
60193            }
60194            TypeVariant::PublicKey => Ok(Self::PublicKey(Box::new(serde_json::from_reader(r)?))),
60195            TypeVariant::SignerKey => Ok(Self::SignerKey(Box::new(serde_json::from_reader(r)?))),
60196            TypeVariant::SignerKeyEd25519SignedPayload => Ok(Self::SignerKeyEd25519SignedPayload(
60197                Box::new(serde_json::from_reader(r)?),
60198            )),
60199            TypeVariant::Signature => Ok(Self::Signature(Box::new(serde_json::from_reader(r)?))),
60200            TypeVariant::SignatureHint => {
60201                Ok(Self::SignatureHint(Box::new(serde_json::from_reader(r)?)))
60202            }
60203            TypeVariant::NodeId => Ok(Self::NodeId(Box::new(serde_json::from_reader(r)?))),
60204            TypeVariant::AccountId => Ok(Self::AccountId(Box::new(serde_json::from_reader(r)?))),
60205            TypeVariant::Curve25519Secret => Ok(Self::Curve25519Secret(Box::new(
60206                serde_json::from_reader(r)?,
60207            ))),
60208            TypeVariant::Curve25519Public => Ok(Self::Curve25519Public(Box::new(
60209                serde_json::from_reader(r)?,
60210            ))),
60211            TypeVariant::HmacSha256Key => {
60212                Ok(Self::HmacSha256Key(Box::new(serde_json::from_reader(r)?)))
60213            }
60214            TypeVariant::HmacSha256Mac => {
60215                Ok(Self::HmacSha256Mac(Box::new(serde_json::from_reader(r)?)))
60216            }
60217            TypeVariant::ShortHashSeed => {
60218                Ok(Self::ShortHashSeed(Box::new(serde_json::from_reader(r)?)))
60219            }
60220            TypeVariant::BinaryFuseFilterType => Ok(Self::BinaryFuseFilterType(Box::new(
60221                serde_json::from_reader(r)?,
60222            ))),
60223            TypeVariant::SerializedBinaryFuseFilter => Ok(Self::SerializedBinaryFuseFilter(
60224                Box::new(serde_json::from_reader(r)?),
60225            )),
60226        }
60227    }
60228
60229    #[cfg(all(feature = "std", feature = "serde_json"))]
60230    #[allow(clippy::too_many_lines)]
60231    pub fn deserialize_json<'r, R: serde_json::de::Read<'r>>(
60232        v: TypeVariant,
60233        r: &mut serde_json::de::Deserializer<R>,
60234    ) -> Result<Self> {
60235        match v {
60236            TypeVariant::Value => Ok(Self::Value(Box::new(serde::de::Deserialize::deserialize(
60237                r,
60238            )?))),
60239            TypeVariant::ScpBallot => Ok(Self::ScpBallot(Box::new(
60240                serde::de::Deserialize::deserialize(r)?,
60241            ))),
60242            TypeVariant::ScpStatementType => Ok(Self::ScpStatementType(Box::new(
60243                serde::de::Deserialize::deserialize(r)?,
60244            ))),
60245            TypeVariant::ScpNomination => Ok(Self::ScpNomination(Box::new(
60246                serde::de::Deserialize::deserialize(r)?,
60247            ))),
60248            TypeVariant::ScpStatement => Ok(Self::ScpStatement(Box::new(
60249                serde::de::Deserialize::deserialize(r)?,
60250            ))),
60251            TypeVariant::ScpStatementPledges => Ok(Self::ScpStatementPledges(Box::new(
60252                serde::de::Deserialize::deserialize(r)?,
60253            ))),
60254            TypeVariant::ScpStatementPrepare => Ok(Self::ScpStatementPrepare(Box::new(
60255                serde::de::Deserialize::deserialize(r)?,
60256            ))),
60257            TypeVariant::ScpStatementConfirm => Ok(Self::ScpStatementConfirm(Box::new(
60258                serde::de::Deserialize::deserialize(r)?,
60259            ))),
60260            TypeVariant::ScpStatementExternalize => Ok(Self::ScpStatementExternalize(Box::new(
60261                serde::de::Deserialize::deserialize(r)?,
60262            ))),
60263            TypeVariant::ScpEnvelope => Ok(Self::ScpEnvelope(Box::new(
60264                serde::de::Deserialize::deserialize(r)?,
60265            ))),
60266            TypeVariant::ScpQuorumSet => Ok(Self::ScpQuorumSet(Box::new(
60267                serde::de::Deserialize::deserialize(r)?,
60268            ))),
60269            TypeVariant::ConfigSettingContractExecutionLanesV0 => {
60270                Ok(Self::ConfigSettingContractExecutionLanesV0(Box::new(
60271                    serde::de::Deserialize::deserialize(r)?,
60272                )))
60273            }
60274            TypeVariant::ConfigSettingContractComputeV0 => {
60275                Ok(Self::ConfigSettingContractComputeV0(Box::new(
60276                    serde::de::Deserialize::deserialize(r)?,
60277                )))
60278            }
60279            TypeVariant::ConfigSettingContractLedgerCostV0 => {
60280                Ok(Self::ConfigSettingContractLedgerCostV0(Box::new(
60281                    serde::de::Deserialize::deserialize(r)?,
60282                )))
60283            }
60284            TypeVariant::ConfigSettingContractHistoricalDataV0 => {
60285                Ok(Self::ConfigSettingContractHistoricalDataV0(Box::new(
60286                    serde::de::Deserialize::deserialize(r)?,
60287                )))
60288            }
60289            TypeVariant::ConfigSettingContractEventsV0 => Ok(Self::ConfigSettingContractEventsV0(
60290                Box::new(serde::de::Deserialize::deserialize(r)?),
60291            )),
60292            TypeVariant::ConfigSettingContractBandwidthV0 => {
60293                Ok(Self::ConfigSettingContractBandwidthV0(Box::new(
60294                    serde::de::Deserialize::deserialize(r)?,
60295                )))
60296            }
60297            TypeVariant::ContractCostType => Ok(Self::ContractCostType(Box::new(
60298                serde::de::Deserialize::deserialize(r)?,
60299            ))),
60300            TypeVariant::ContractCostParamEntry => Ok(Self::ContractCostParamEntry(Box::new(
60301                serde::de::Deserialize::deserialize(r)?,
60302            ))),
60303            TypeVariant::StateArchivalSettings => Ok(Self::StateArchivalSettings(Box::new(
60304                serde::de::Deserialize::deserialize(r)?,
60305            ))),
60306            TypeVariant::EvictionIterator => Ok(Self::EvictionIterator(Box::new(
60307                serde::de::Deserialize::deserialize(r)?,
60308            ))),
60309            TypeVariant::ContractCostParams => Ok(Self::ContractCostParams(Box::new(
60310                serde::de::Deserialize::deserialize(r)?,
60311            ))),
60312            TypeVariant::ConfigSettingId => Ok(Self::ConfigSettingId(Box::new(
60313                serde::de::Deserialize::deserialize(r)?,
60314            ))),
60315            TypeVariant::ConfigSettingEntry => Ok(Self::ConfigSettingEntry(Box::new(
60316                serde::de::Deserialize::deserialize(r)?,
60317            ))),
60318            TypeVariant::ScEnvMetaKind => Ok(Self::ScEnvMetaKind(Box::new(
60319                serde::de::Deserialize::deserialize(r)?,
60320            ))),
60321            TypeVariant::ScEnvMetaEntry => Ok(Self::ScEnvMetaEntry(Box::new(
60322                serde::de::Deserialize::deserialize(r)?,
60323            ))),
60324            TypeVariant::ScEnvMetaEntryInterfaceVersion => {
60325                Ok(Self::ScEnvMetaEntryInterfaceVersion(Box::new(
60326                    serde::de::Deserialize::deserialize(r)?,
60327                )))
60328            }
60329            TypeVariant::ScMetaV0 => Ok(Self::ScMetaV0(Box::new(
60330                serde::de::Deserialize::deserialize(r)?,
60331            ))),
60332            TypeVariant::ScMetaKind => Ok(Self::ScMetaKind(Box::new(
60333                serde::de::Deserialize::deserialize(r)?,
60334            ))),
60335            TypeVariant::ScMetaEntry => Ok(Self::ScMetaEntry(Box::new(
60336                serde::de::Deserialize::deserialize(r)?,
60337            ))),
60338            TypeVariant::ScSpecType => Ok(Self::ScSpecType(Box::new(
60339                serde::de::Deserialize::deserialize(r)?,
60340            ))),
60341            TypeVariant::ScSpecTypeOption => Ok(Self::ScSpecTypeOption(Box::new(
60342                serde::de::Deserialize::deserialize(r)?,
60343            ))),
60344            TypeVariant::ScSpecTypeResult => Ok(Self::ScSpecTypeResult(Box::new(
60345                serde::de::Deserialize::deserialize(r)?,
60346            ))),
60347            TypeVariant::ScSpecTypeVec => Ok(Self::ScSpecTypeVec(Box::new(
60348                serde::de::Deserialize::deserialize(r)?,
60349            ))),
60350            TypeVariant::ScSpecTypeMap => Ok(Self::ScSpecTypeMap(Box::new(
60351                serde::de::Deserialize::deserialize(r)?,
60352            ))),
60353            TypeVariant::ScSpecTypeTuple => Ok(Self::ScSpecTypeTuple(Box::new(
60354                serde::de::Deserialize::deserialize(r)?,
60355            ))),
60356            TypeVariant::ScSpecTypeBytesN => Ok(Self::ScSpecTypeBytesN(Box::new(
60357                serde::de::Deserialize::deserialize(r)?,
60358            ))),
60359            TypeVariant::ScSpecTypeUdt => Ok(Self::ScSpecTypeUdt(Box::new(
60360                serde::de::Deserialize::deserialize(r)?,
60361            ))),
60362            TypeVariant::ScSpecTypeDef => Ok(Self::ScSpecTypeDef(Box::new(
60363                serde::de::Deserialize::deserialize(r)?,
60364            ))),
60365            TypeVariant::ScSpecUdtStructFieldV0 => Ok(Self::ScSpecUdtStructFieldV0(Box::new(
60366                serde::de::Deserialize::deserialize(r)?,
60367            ))),
60368            TypeVariant::ScSpecUdtStructV0 => Ok(Self::ScSpecUdtStructV0(Box::new(
60369                serde::de::Deserialize::deserialize(r)?,
60370            ))),
60371            TypeVariant::ScSpecUdtUnionCaseVoidV0 => Ok(Self::ScSpecUdtUnionCaseVoidV0(Box::new(
60372                serde::de::Deserialize::deserialize(r)?,
60373            ))),
60374            TypeVariant::ScSpecUdtUnionCaseTupleV0 => Ok(Self::ScSpecUdtUnionCaseTupleV0(
60375                Box::new(serde::de::Deserialize::deserialize(r)?),
60376            )),
60377            TypeVariant::ScSpecUdtUnionCaseV0Kind => Ok(Self::ScSpecUdtUnionCaseV0Kind(Box::new(
60378                serde::de::Deserialize::deserialize(r)?,
60379            ))),
60380            TypeVariant::ScSpecUdtUnionCaseV0 => Ok(Self::ScSpecUdtUnionCaseV0(Box::new(
60381                serde::de::Deserialize::deserialize(r)?,
60382            ))),
60383            TypeVariant::ScSpecUdtUnionV0 => Ok(Self::ScSpecUdtUnionV0(Box::new(
60384                serde::de::Deserialize::deserialize(r)?,
60385            ))),
60386            TypeVariant::ScSpecUdtEnumCaseV0 => Ok(Self::ScSpecUdtEnumCaseV0(Box::new(
60387                serde::de::Deserialize::deserialize(r)?,
60388            ))),
60389            TypeVariant::ScSpecUdtEnumV0 => Ok(Self::ScSpecUdtEnumV0(Box::new(
60390                serde::de::Deserialize::deserialize(r)?,
60391            ))),
60392            TypeVariant::ScSpecUdtErrorEnumCaseV0 => Ok(Self::ScSpecUdtErrorEnumCaseV0(Box::new(
60393                serde::de::Deserialize::deserialize(r)?,
60394            ))),
60395            TypeVariant::ScSpecUdtErrorEnumV0 => Ok(Self::ScSpecUdtErrorEnumV0(Box::new(
60396                serde::de::Deserialize::deserialize(r)?,
60397            ))),
60398            TypeVariant::ScSpecFunctionInputV0 => Ok(Self::ScSpecFunctionInputV0(Box::new(
60399                serde::de::Deserialize::deserialize(r)?,
60400            ))),
60401            TypeVariant::ScSpecFunctionV0 => Ok(Self::ScSpecFunctionV0(Box::new(
60402                serde::de::Deserialize::deserialize(r)?,
60403            ))),
60404            TypeVariant::ScSpecEntryKind => Ok(Self::ScSpecEntryKind(Box::new(
60405                serde::de::Deserialize::deserialize(r)?,
60406            ))),
60407            TypeVariant::ScSpecEntry => Ok(Self::ScSpecEntry(Box::new(
60408                serde::de::Deserialize::deserialize(r)?,
60409            ))),
60410            TypeVariant::ScValType => Ok(Self::ScValType(Box::new(
60411                serde::de::Deserialize::deserialize(r)?,
60412            ))),
60413            TypeVariant::ScErrorType => Ok(Self::ScErrorType(Box::new(
60414                serde::de::Deserialize::deserialize(r)?,
60415            ))),
60416            TypeVariant::ScErrorCode => Ok(Self::ScErrorCode(Box::new(
60417                serde::de::Deserialize::deserialize(r)?,
60418            ))),
60419            TypeVariant::ScError => Ok(Self::ScError(Box::new(
60420                serde::de::Deserialize::deserialize(r)?,
60421            ))),
60422            TypeVariant::UInt128Parts => Ok(Self::UInt128Parts(Box::new(
60423                serde::de::Deserialize::deserialize(r)?,
60424            ))),
60425            TypeVariant::Int128Parts => Ok(Self::Int128Parts(Box::new(
60426                serde::de::Deserialize::deserialize(r)?,
60427            ))),
60428            TypeVariant::UInt256Parts => Ok(Self::UInt256Parts(Box::new(
60429                serde::de::Deserialize::deserialize(r)?,
60430            ))),
60431            TypeVariant::Int256Parts => Ok(Self::Int256Parts(Box::new(
60432                serde::de::Deserialize::deserialize(r)?,
60433            ))),
60434            TypeVariant::ContractExecutableType => Ok(Self::ContractExecutableType(Box::new(
60435                serde::de::Deserialize::deserialize(r)?,
60436            ))),
60437            TypeVariant::ContractExecutable => Ok(Self::ContractExecutable(Box::new(
60438                serde::de::Deserialize::deserialize(r)?,
60439            ))),
60440            TypeVariant::ScAddressType => Ok(Self::ScAddressType(Box::new(
60441                serde::de::Deserialize::deserialize(r)?,
60442            ))),
60443            TypeVariant::ScAddress => Ok(Self::ScAddress(Box::new(
60444                serde::de::Deserialize::deserialize(r)?,
60445            ))),
60446            TypeVariant::ScVec => Ok(Self::ScVec(Box::new(serde::de::Deserialize::deserialize(
60447                r,
60448            )?))),
60449            TypeVariant::ScMap => Ok(Self::ScMap(Box::new(serde::de::Deserialize::deserialize(
60450                r,
60451            )?))),
60452            TypeVariant::ScBytes => Ok(Self::ScBytes(Box::new(
60453                serde::de::Deserialize::deserialize(r)?,
60454            ))),
60455            TypeVariant::ScString => Ok(Self::ScString(Box::new(
60456                serde::de::Deserialize::deserialize(r)?,
60457            ))),
60458            TypeVariant::ScSymbol => Ok(Self::ScSymbol(Box::new(
60459                serde::de::Deserialize::deserialize(r)?,
60460            ))),
60461            TypeVariant::ScNonceKey => Ok(Self::ScNonceKey(Box::new(
60462                serde::de::Deserialize::deserialize(r)?,
60463            ))),
60464            TypeVariant::ScContractInstance => Ok(Self::ScContractInstance(Box::new(
60465                serde::de::Deserialize::deserialize(r)?,
60466            ))),
60467            TypeVariant::ScVal => Ok(Self::ScVal(Box::new(serde::de::Deserialize::deserialize(
60468                r,
60469            )?))),
60470            TypeVariant::ScMapEntry => Ok(Self::ScMapEntry(Box::new(
60471                serde::de::Deserialize::deserialize(r)?,
60472            ))),
60473            TypeVariant::StoredTransactionSet => Ok(Self::StoredTransactionSet(Box::new(
60474                serde::de::Deserialize::deserialize(r)?,
60475            ))),
60476            TypeVariant::StoredDebugTransactionSet => Ok(Self::StoredDebugTransactionSet(
60477                Box::new(serde::de::Deserialize::deserialize(r)?),
60478            )),
60479            TypeVariant::PersistedScpStateV0 => Ok(Self::PersistedScpStateV0(Box::new(
60480                serde::de::Deserialize::deserialize(r)?,
60481            ))),
60482            TypeVariant::PersistedScpStateV1 => Ok(Self::PersistedScpStateV1(Box::new(
60483                serde::de::Deserialize::deserialize(r)?,
60484            ))),
60485            TypeVariant::PersistedScpState => Ok(Self::PersistedScpState(Box::new(
60486                serde::de::Deserialize::deserialize(r)?,
60487            ))),
60488            TypeVariant::Thresholds => Ok(Self::Thresholds(Box::new(
60489                serde::de::Deserialize::deserialize(r)?,
60490            ))),
60491            TypeVariant::String32 => Ok(Self::String32(Box::new(
60492                serde::de::Deserialize::deserialize(r)?,
60493            ))),
60494            TypeVariant::String64 => Ok(Self::String64(Box::new(
60495                serde::de::Deserialize::deserialize(r)?,
60496            ))),
60497            TypeVariant::SequenceNumber => Ok(Self::SequenceNumber(Box::new(
60498                serde::de::Deserialize::deserialize(r)?,
60499            ))),
60500            TypeVariant::DataValue => Ok(Self::DataValue(Box::new(
60501                serde::de::Deserialize::deserialize(r)?,
60502            ))),
60503            TypeVariant::PoolId => Ok(Self::PoolId(Box::new(serde::de::Deserialize::deserialize(
60504                r,
60505            )?))),
60506            TypeVariant::AssetCode4 => Ok(Self::AssetCode4(Box::new(
60507                serde::de::Deserialize::deserialize(r)?,
60508            ))),
60509            TypeVariant::AssetCode12 => Ok(Self::AssetCode12(Box::new(
60510                serde::de::Deserialize::deserialize(r)?,
60511            ))),
60512            TypeVariant::AssetType => Ok(Self::AssetType(Box::new(
60513                serde::de::Deserialize::deserialize(r)?,
60514            ))),
60515            TypeVariant::AssetCode => Ok(Self::AssetCode(Box::new(
60516                serde::de::Deserialize::deserialize(r)?,
60517            ))),
60518            TypeVariant::AlphaNum4 => Ok(Self::AlphaNum4(Box::new(
60519                serde::de::Deserialize::deserialize(r)?,
60520            ))),
60521            TypeVariant::AlphaNum12 => Ok(Self::AlphaNum12(Box::new(
60522                serde::de::Deserialize::deserialize(r)?,
60523            ))),
60524            TypeVariant::Asset => Ok(Self::Asset(Box::new(serde::de::Deserialize::deserialize(
60525                r,
60526            )?))),
60527            TypeVariant::Price => Ok(Self::Price(Box::new(serde::de::Deserialize::deserialize(
60528                r,
60529            )?))),
60530            TypeVariant::Liabilities => Ok(Self::Liabilities(Box::new(
60531                serde::de::Deserialize::deserialize(r)?,
60532            ))),
60533            TypeVariant::ThresholdIndexes => Ok(Self::ThresholdIndexes(Box::new(
60534                serde::de::Deserialize::deserialize(r)?,
60535            ))),
60536            TypeVariant::LedgerEntryType => Ok(Self::LedgerEntryType(Box::new(
60537                serde::de::Deserialize::deserialize(r)?,
60538            ))),
60539            TypeVariant::Signer => Ok(Self::Signer(Box::new(serde::de::Deserialize::deserialize(
60540                r,
60541            )?))),
60542            TypeVariant::AccountFlags => Ok(Self::AccountFlags(Box::new(
60543                serde::de::Deserialize::deserialize(r)?,
60544            ))),
60545            TypeVariant::SponsorshipDescriptor => Ok(Self::SponsorshipDescriptor(Box::new(
60546                serde::de::Deserialize::deserialize(r)?,
60547            ))),
60548            TypeVariant::AccountEntryExtensionV3 => Ok(Self::AccountEntryExtensionV3(Box::new(
60549                serde::de::Deserialize::deserialize(r)?,
60550            ))),
60551            TypeVariant::AccountEntryExtensionV2 => Ok(Self::AccountEntryExtensionV2(Box::new(
60552                serde::de::Deserialize::deserialize(r)?,
60553            ))),
60554            TypeVariant::AccountEntryExtensionV2Ext => Ok(Self::AccountEntryExtensionV2Ext(
60555                Box::new(serde::de::Deserialize::deserialize(r)?),
60556            )),
60557            TypeVariant::AccountEntryExtensionV1 => Ok(Self::AccountEntryExtensionV1(Box::new(
60558                serde::de::Deserialize::deserialize(r)?,
60559            ))),
60560            TypeVariant::AccountEntryExtensionV1Ext => Ok(Self::AccountEntryExtensionV1Ext(
60561                Box::new(serde::de::Deserialize::deserialize(r)?),
60562            )),
60563            TypeVariant::AccountEntry => Ok(Self::AccountEntry(Box::new(
60564                serde::de::Deserialize::deserialize(r)?,
60565            ))),
60566            TypeVariant::AccountEntryExt => Ok(Self::AccountEntryExt(Box::new(
60567                serde::de::Deserialize::deserialize(r)?,
60568            ))),
60569            TypeVariant::TrustLineFlags => Ok(Self::TrustLineFlags(Box::new(
60570                serde::de::Deserialize::deserialize(r)?,
60571            ))),
60572            TypeVariant::LiquidityPoolType => Ok(Self::LiquidityPoolType(Box::new(
60573                serde::de::Deserialize::deserialize(r)?,
60574            ))),
60575            TypeVariant::TrustLineAsset => Ok(Self::TrustLineAsset(Box::new(
60576                serde::de::Deserialize::deserialize(r)?,
60577            ))),
60578            TypeVariant::TrustLineEntryExtensionV2 => Ok(Self::TrustLineEntryExtensionV2(
60579                Box::new(serde::de::Deserialize::deserialize(r)?),
60580            )),
60581            TypeVariant::TrustLineEntryExtensionV2Ext => Ok(Self::TrustLineEntryExtensionV2Ext(
60582                Box::new(serde::de::Deserialize::deserialize(r)?),
60583            )),
60584            TypeVariant::TrustLineEntry => Ok(Self::TrustLineEntry(Box::new(
60585                serde::de::Deserialize::deserialize(r)?,
60586            ))),
60587            TypeVariant::TrustLineEntryExt => Ok(Self::TrustLineEntryExt(Box::new(
60588                serde::de::Deserialize::deserialize(r)?,
60589            ))),
60590            TypeVariant::TrustLineEntryV1 => Ok(Self::TrustLineEntryV1(Box::new(
60591                serde::de::Deserialize::deserialize(r)?,
60592            ))),
60593            TypeVariant::TrustLineEntryV1Ext => Ok(Self::TrustLineEntryV1Ext(Box::new(
60594                serde::de::Deserialize::deserialize(r)?,
60595            ))),
60596            TypeVariant::OfferEntryFlags => Ok(Self::OfferEntryFlags(Box::new(
60597                serde::de::Deserialize::deserialize(r)?,
60598            ))),
60599            TypeVariant::OfferEntry => Ok(Self::OfferEntry(Box::new(
60600                serde::de::Deserialize::deserialize(r)?,
60601            ))),
60602            TypeVariant::OfferEntryExt => Ok(Self::OfferEntryExt(Box::new(
60603                serde::de::Deserialize::deserialize(r)?,
60604            ))),
60605            TypeVariant::DataEntry => Ok(Self::DataEntry(Box::new(
60606                serde::de::Deserialize::deserialize(r)?,
60607            ))),
60608            TypeVariant::DataEntryExt => Ok(Self::DataEntryExt(Box::new(
60609                serde::de::Deserialize::deserialize(r)?,
60610            ))),
60611            TypeVariant::ClaimPredicateType => Ok(Self::ClaimPredicateType(Box::new(
60612                serde::de::Deserialize::deserialize(r)?,
60613            ))),
60614            TypeVariant::ClaimPredicate => Ok(Self::ClaimPredicate(Box::new(
60615                serde::de::Deserialize::deserialize(r)?,
60616            ))),
60617            TypeVariant::ClaimantType => Ok(Self::ClaimantType(Box::new(
60618                serde::de::Deserialize::deserialize(r)?,
60619            ))),
60620            TypeVariant::Claimant => Ok(Self::Claimant(Box::new(
60621                serde::de::Deserialize::deserialize(r)?,
60622            ))),
60623            TypeVariant::ClaimantV0 => Ok(Self::ClaimantV0(Box::new(
60624                serde::de::Deserialize::deserialize(r)?,
60625            ))),
60626            TypeVariant::ClaimableBalanceIdType => Ok(Self::ClaimableBalanceIdType(Box::new(
60627                serde::de::Deserialize::deserialize(r)?,
60628            ))),
60629            TypeVariant::ClaimableBalanceId => Ok(Self::ClaimableBalanceId(Box::new(
60630                serde::de::Deserialize::deserialize(r)?,
60631            ))),
60632            TypeVariant::ClaimableBalanceFlags => Ok(Self::ClaimableBalanceFlags(Box::new(
60633                serde::de::Deserialize::deserialize(r)?,
60634            ))),
60635            TypeVariant::ClaimableBalanceEntryExtensionV1 => {
60636                Ok(Self::ClaimableBalanceEntryExtensionV1(Box::new(
60637                    serde::de::Deserialize::deserialize(r)?,
60638                )))
60639            }
60640            TypeVariant::ClaimableBalanceEntryExtensionV1Ext => {
60641                Ok(Self::ClaimableBalanceEntryExtensionV1Ext(Box::new(
60642                    serde::de::Deserialize::deserialize(r)?,
60643                )))
60644            }
60645            TypeVariant::ClaimableBalanceEntry => Ok(Self::ClaimableBalanceEntry(Box::new(
60646                serde::de::Deserialize::deserialize(r)?,
60647            ))),
60648            TypeVariant::ClaimableBalanceEntryExt => Ok(Self::ClaimableBalanceEntryExt(Box::new(
60649                serde::de::Deserialize::deserialize(r)?,
60650            ))),
60651            TypeVariant::LiquidityPoolConstantProductParameters => {
60652                Ok(Self::LiquidityPoolConstantProductParameters(Box::new(
60653                    serde::de::Deserialize::deserialize(r)?,
60654                )))
60655            }
60656            TypeVariant::LiquidityPoolEntry => Ok(Self::LiquidityPoolEntry(Box::new(
60657                serde::de::Deserialize::deserialize(r)?,
60658            ))),
60659            TypeVariant::LiquidityPoolEntryBody => Ok(Self::LiquidityPoolEntryBody(Box::new(
60660                serde::de::Deserialize::deserialize(r)?,
60661            ))),
60662            TypeVariant::LiquidityPoolEntryConstantProduct => {
60663                Ok(Self::LiquidityPoolEntryConstantProduct(Box::new(
60664                    serde::de::Deserialize::deserialize(r)?,
60665                )))
60666            }
60667            TypeVariant::ContractDataDurability => Ok(Self::ContractDataDurability(Box::new(
60668                serde::de::Deserialize::deserialize(r)?,
60669            ))),
60670            TypeVariant::ContractDataEntry => Ok(Self::ContractDataEntry(Box::new(
60671                serde::de::Deserialize::deserialize(r)?,
60672            ))),
60673            TypeVariant::ContractCodeCostInputs => Ok(Self::ContractCodeCostInputs(Box::new(
60674                serde::de::Deserialize::deserialize(r)?,
60675            ))),
60676            TypeVariant::ContractCodeEntry => Ok(Self::ContractCodeEntry(Box::new(
60677                serde::de::Deserialize::deserialize(r)?,
60678            ))),
60679            TypeVariant::ContractCodeEntryExt => Ok(Self::ContractCodeEntryExt(Box::new(
60680                serde::de::Deserialize::deserialize(r)?,
60681            ))),
60682            TypeVariant::ContractCodeEntryV1 => Ok(Self::ContractCodeEntryV1(Box::new(
60683                serde::de::Deserialize::deserialize(r)?,
60684            ))),
60685            TypeVariant::TtlEntry => Ok(Self::TtlEntry(Box::new(
60686                serde::de::Deserialize::deserialize(r)?,
60687            ))),
60688            TypeVariant::LedgerEntryExtensionV1 => Ok(Self::LedgerEntryExtensionV1(Box::new(
60689                serde::de::Deserialize::deserialize(r)?,
60690            ))),
60691            TypeVariant::LedgerEntryExtensionV1Ext => Ok(Self::LedgerEntryExtensionV1Ext(
60692                Box::new(serde::de::Deserialize::deserialize(r)?),
60693            )),
60694            TypeVariant::LedgerEntry => Ok(Self::LedgerEntry(Box::new(
60695                serde::de::Deserialize::deserialize(r)?,
60696            ))),
60697            TypeVariant::LedgerEntryData => Ok(Self::LedgerEntryData(Box::new(
60698                serde::de::Deserialize::deserialize(r)?,
60699            ))),
60700            TypeVariant::LedgerEntryExt => Ok(Self::LedgerEntryExt(Box::new(
60701                serde::de::Deserialize::deserialize(r)?,
60702            ))),
60703            TypeVariant::LedgerKey => Ok(Self::LedgerKey(Box::new(
60704                serde::de::Deserialize::deserialize(r)?,
60705            ))),
60706            TypeVariant::LedgerKeyAccount => Ok(Self::LedgerKeyAccount(Box::new(
60707                serde::de::Deserialize::deserialize(r)?,
60708            ))),
60709            TypeVariant::LedgerKeyTrustLine => Ok(Self::LedgerKeyTrustLine(Box::new(
60710                serde::de::Deserialize::deserialize(r)?,
60711            ))),
60712            TypeVariant::LedgerKeyOffer => Ok(Self::LedgerKeyOffer(Box::new(
60713                serde::de::Deserialize::deserialize(r)?,
60714            ))),
60715            TypeVariant::LedgerKeyData => Ok(Self::LedgerKeyData(Box::new(
60716                serde::de::Deserialize::deserialize(r)?,
60717            ))),
60718            TypeVariant::LedgerKeyClaimableBalance => Ok(Self::LedgerKeyClaimableBalance(
60719                Box::new(serde::de::Deserialize::deserialize(r)?),
60720            )),
60721            TypeVariant::LedgerKeyLiquidityPool => Ok(Self::LedgerKeyLiquidityPool(Box::new(
60722                serde::de::Deserialize::deserialize(r)?,
60723            ))),
60724            TypeVariant::LedgerKeyContractData => Ok(Self::LedgerKeyContractData(Box::new(
60725                serde::de::Deserialize::deserialize(r)?,
60726            ))),
60727            TypeVariant::LedgerKeyContractCode => Ok(Self::LedgerKeyContractCode(Box::new(
60728                serde::de::Deserialize::deserialize(r)?,
60729            ))),
60730            TypeVariant::LedgerKeyConfigSetting => Ok(Self::LedgerKeyConfigSetting(Box::new(
60731                serde::de::Deserialize::deserialize(r)?,
60732            ))),
60733            TypeVariant::LedgerKeyTtl => Ok(Self::LedgerKeyTtl(Box::new(
60734                serde::de::Deserialize::deserialize(r)?,
60735            ))),
60736            TypeVariant::EnvelopeType => Ok(Self::EnvelopeType(Box::new(
60737                serde::de::Deserialize::deserialize(r)?,
60738            ))),
60739            TypeVariant::BucketListType => Ok(Self::BucketListType(Box::new(
60740                serde::de::Deserialize::deserialize(r)?,
60741            ))),
60742            TypeVariant::BucketEntryType => Ok(Self::BucketEntryType(Box::new(
60743                serde::de::Deserialize::deserialize(r)?,
60744            ))),
60745            TypeVariant::HotArchiveBucketEntryType => Ok(Self::HotArchiveBucketEntryType(
60746                Box::new(serde::de::Deserialize::deserialize(r)?),
60747            )),
60748            TypeVariant::ColdArchiveBucketEntryType => Ok(Self::ColdArchiveBucketEntryType(
60749                Box::new(serde::de::Deserialize::deserialize(r)?),
60750            )),
60751            TypeVariant::BucketMetadata => Ok(Self::BucketMetadata(Box::new(
60752                serde::de::Deserialize::deserialize(r)?,
60753            ))),
60754            TypeVariant::BucketMetadataExt => Ok(Self::BucketMetadataExt(Box::new(
60755                serde::de::Deserialize::deserialize(r)?,
60756            ))),
60757            TypeVariant::BucketEntry => Ok(Self::BucketEntry(Box::new(
60758                serde::de::Deserialize::deserialize(r)?,
60759            ))),
60760            TypeVariant::HotArchiveBucketEntry => Ok(Self::HotArchiveBucketEntry(Box::new(
60761                serde::de::Deserialize::deserialize(r)?,
60762            ))),
60763            TypeVariant::ColdArchiveArchivedLeaf => Ok(Self::ColdArchiveArchivedLeaf(Box::new(
60764                serde::de::Deserialize::deserialize(r)?,
60765            ))),
60766            TypeVariant::ColdArchiveDeletedLeaf => Ok(Self::ColdArchiveDeletedLeaf(Box::new(
60767                serde::de::Deserialize::deserialize(r)?,
60768            ))),
60769            TypeVariant::ColdArchiveBoundaryLeaf => Ok(Self::ColdArchiveBoundaryLeaf(Box::new(
60770                serde::de::Deserialize::deserialize(r)?,
60771            ))),
60772            TypeVariant::ColdArchiveHashEntry => Ok(Self::ColdArchiveHashEntry(Box::new(
60773                serde::de::Deserialize::deserialize(r)?,
60774            ))),
60775            TypeVariant::ColdArchiveBucketEntry => Ok(Self::ColdArchiveBucketEntry(Box::new(
60776                serde::de::Deserialize::deserialize(r)?,
60777            ))),
60778            TypeVariant::UpgradeType => Ok(Self::UpgradeType(Box::new(
60779                serde::de::Deserialize::deserialize(r)?,
60780            ))),
60781            TypeVariant::StellarValueType => Ok(Self::StellarValueType(Box::new(
60782                serde::de::Deserialize::deserialize(r)?,
60783            ))),
60784            TypeVariant::LedgerCloseValueSignature => Ok(Self::LedgerCloseValueSignature(
60785                Box::new(serde::de::Deserialize::deserialize(r)?),
60786            )),
60787            TypeVariant::StellarValue => Ok(Self::StellarValue(Box::new(
60788                serde::de::Deserialize::deserialize(r)?,
60789            ))),
60790            TypeVariant::StellarValueExt => Ok(Self::StellarValueExt(Box::new(
60791                serde::de::Deserialize::deserialize(r)?,
60792            ))),
60793            TypeVariant::LedgerHeaderFlags => Ok(Self::LedgerHeaderFlags(Box::new(
60794                serde::de::Deserialize::deserialize(r)?,
60795            ))),
60796            TypeVariant::LedgerHeaderExtensionV1 => Ok(Self::LedgerHeaderExtensionV1(Box::new(
60797                serde::de::Deserialize::deserialize(r)?,
60798            ))),
60799            TypeVariant::LedgerHeaderExtensionV1Ext => Ok(Self::LedgerHeaderExtensionV1Ext(
60800                Box::new(serde::de::Deserialize::deserialize(r)?),
60801            )),
60802            TypeVariant::LedgerHeader => Ok(Self::LedgerHeader(Box::new(
60803                serde::de::Deserialize::deserialize(r)?,
60804            ))),
60805            TypeVariant::LedgerHeaderExt => Ok(Self::LedgerHeaderExt(Box::new(
60806                serde::de::Deserialize::deserialize(r)?,
60807            ))),
60808            TypeVariant::LedgerUpgradeType => Ok(Self::LedgerUpgradeType(Box::new(
60809                serde::de::Deserialize::deserialize(r)?,
60810            ))),
60811            TypeVariant::ConfigUpgradeSetKey => Ok(Self::ConfigUpgradeSetKey(Box::new(
60812                serde::de::Deserialize::deserialize(r)?,
60813            ))),
60814            TypeVariant::LedgerUpgrade => Ok(Self::LedgerUpgrade(Box::new(
60815                serde::de::Deserialize::deserialize(r)?,
60816            ))),
60817            TypeVariant::ConfigUpgradeSet => Ok(Self::ConfigUpgradeSet(Box::new(
60818                serde::de::Deserialize::deserialize(r)?,
60819            ))),
60820            TypeVariant::TxSetComponentType => Ok(Self::TxSetComponentType(Box::new(
60821                serde::de::Deserialize::deserialize(r)?,
60822            ))),
60823            TypeVariant::TxSetComponent => Ok(Self::TxSetComponent(Box::new(
60824                serde::de::Deserialize::deserialize(r)?,
60825            ))),
60826            TypeVariant::TxSetComponentTxsMaybeDiscountedFee => {
60827                Ok(Self::TxSetComponentTxsMaybeDiscountedFee(Box::new(
60828                    serde::de::Deserialize::deserialize(r)?,
60829                )))
60830            }
60831            TypeVariant::TransactionPhase => Ok(Self::TransactionPhase(Box::new(
60832                serde::de::Deserialize::deserialize(r)?,
60833            ))),
60834            TypeVariant::TransactionSet => Ok(Self::TransactionSet(Box::new(
60835                serde::de::Deserialize::deserialize(r)?,
60836            ))),
60837            TypeVariant::TransactionSetV1 => Ok(Self::TransactionSetV1(Box::new(
60838                serde::de::Deserialize::deserialize(r)?,
60839            ))),
60840            TypeVariant::GeneralizedTransactionSet => Ok(Self::GeneralizedTransactionSet(
60841                Box::new(serde::de::Deserialize::deserialize(r)?),
60842            )),
60843            TypeVariant::TransactionResultPair => Ok(Self::TransactionResultPair(Box::new(
60844                serde::de::Deserialize::deserialize(r)?,
60845            ))),
60846            TypeVariant::TransactionResultSet => Ok(Self::TransactionResultSet(Box::new(
60847                serde::de::Deserialize::deserialize(r)?,
60848            ))),
60849            TypeVariant::TransactionHistoryEntry => Ok(Self::TransactionHistoryEntry(Box::new(
60850                serde::de::Deserialize::deserialize(r)?,
60851            ))),
60852            TypeVariant::TransactionHistoryEntryExt => Ok(Self::TransactionHistoryEntryExt(
60853                Box::new(serde::de::Deserialize::deserialize(r)?),
60854            )),
60855            TypeVariant::TransactionHistoryResultEntry => Ok(Self::TransactionHistoryResultEntry(
60856                Box::new(serde::de::Deserialize::deserialize(r)?),
60857            )),
60858            TypeVariant::TransactionHistoryResultEntryExt => {
60859                Ok(Self::TransactionHistoryResultEntryExt(Box::new(
60860                    serde::de::Deserialize::deserialize(r)?,
60861                )))
60862            }
60863            TypeVariant::LedgerHeaderHistoryEntry => Ok(Self::LedgerHeaderHistoryEntry(Box::new(
60864                serde::de::Deserialize::deserialize(r)?,
60865            ))),
60866            TypeVariant::LedgerHeaderHistoryEntryExt => Ok(Self::LedgerHeaderHistoryEntryExt(
60867                Box::new(serde::de::Deserialize::deserialize(r)?),
60868            )),
60869            TypeVariant::LedgerScpMessages => Ok(Self::LedgerScpMessages(Box::new(
60870                serde::de::Deserialize::deserialize(r)?,
60871            ))),
60872            TypeVariant::ScpHistoryEntryV0 => Ok(Self::ScpHistoryEntryV0(Box::new(
60873                serde::de::Deserialize::deserialize(r)?,
60874            ))),
60875            TypeVariant::ScpHistoryEntry => Ok(Self::ScpHistoryEntry(Box::new(
60876                serde::de::Deserialize::deserialize(r)?,
60877            ))),
60878            TypeVariant::LedgerEntryChangeType => Ok(Self::LedgerEntryChangeType(Box::new(
60879                serde::de::Deserialize::deserialize(r)?,
60880            ))),
60881            TypeVariant::LedgerEntryChange => Ok(Self::LedgerEntryChange(Box::new(
60882                serde::de::Deserialize::deserialize(r)?,
60883            ))),
60884            TypeVariant::LedgerEntryChanges => Ok(Self::LedgerEntryChanges(Box::new(
60885                serde::de::Deserialize::deserialize(r)?,
60886            ))),
60887            TypeVariant::OperationMeta => Ok(Self::OperationMeta(Box::new(
60888                serde::de::Deserialize::deserialize(r)?,
60889            ))),
60890            TypeVariant::TransactionMetaV1 => Ok(Self::TransactionMetaV1(Box::new(
60891                serde::de::Deserialize::deserialize(r)?,
60892            ))),
60893            TypeVariant::TransactionMetaV2 => Ok(Self::TransactionMetaV2(Box::new(
60894                serde::de::Deserialize::deserialize(r)?,
60895            ))),
60896            TypeVariant::ContractEventType => Ok(Self::ContractEventType(Box::new(
60897                serde::de::Deserialize::deserialize(r)?,
60898            ))),
60899            TypeVariant::ContractEvent => Ok(Self::ContractEvent(Box::new(
60900                serde::de::Deserialize::deserialize(r)?,
60901            ))),
60902            TypeVariant::ContractEventBody => Ok(Self::ContractEventBody(Box::new(
60903                serde::de::Deserialize::deserialize(r)?,
60904            ))),
60905            TypeVariant::ContractEventV0 => Ok(Self::ContractEventV0(Box::new(
60906                serde::de::Deserialize::deserialize(r)?,
60907            ))),
60908            TypeVariant::DiagnosticEvent => Ok(Self::DiagnosticEvent(Box::new(
60909                serde::de::Deserialize::deserialize(r)?,
60910            ))),
60911            TypeVariant::DiagnosticEvents => Ok(Self::DiagnosticEvents(Box::new(
60912                serde::de::Deserialize::deserialize(r)?,
60913            ))),
60914            TypeVariant::SorobanTransactionMetaExtV1 => Ok(Self::SorobanTransactionMetaExtV1(
60915                Box::new(serde::de::Deserialize::deserialize(r)?),
60916            )),
60917            TypeVariant::SorobanTransactionMetaExt => Ok(Self::SorobanTransactionMetaExt(
60918                Box::new(serde::de::Deserialize::deserialize(r)?),
60919            )),
60920            TypeVariant::SorobanTransactionMeta => Ok(Self::SorobanTransactionMeta(Box::new(
60921                serde::de::Deserialize::deserialize(r)?,
60922            ))),
60923            TypeVariant::TransactionMetaV3 => Ok(Self::TransactionMetaV3(Box::new(
60924                serde::de::Deserialize::deserialize(r)?,
60925            ))),
60926            TypeVariant::InvokeHostFunctionSuccessPreImage => {
60927                Ok(Self::InvokeHostFunctionSuccessPreImage(Box::new(
60928                    serde::de::Deserialize::deserialize(r)?,
60929                )))
60930            }
60931            TypeVariant::TransactionMeta => Ok(Self::TransactionMeta(Box::new(
60932                serde::de::Deserialize::deserialize(r)?,
60933            ))),
60934            TypeVariant::TransactionResultMeta => Ok(Self::TransactionResultMeta(Box::new(
60935                serde::de::Deserialize::deserialize(r)?,
60936            ))),
60937            TypeVariant::UpgradeEntryMeta => Ok(Self::UpgradeEntryMeta(Box::new(
60938                serde::de::Deserialize::deserialize(r)?,
60939            ))),
60940            TypeVariant::LedgerCloseMetaV0 => Ok(Self::LedgerCloseMetaV0(Box::new(
60941                serde::de::Deserialize::deserialize(r)?,
60942            ))),
60943            TypeVariant::LedgerCloseMetaExtV1 => Ok(Self::LedgerCloseMetaExtV1(Box::new(
60944                serde::de::Deserialize::deserialize(r)?,
60945            ))),
60946            TypeVariant::LedgerCloseMetaExt => Ok(Self::LedgerCloseMetaExt(Box::new(
60947                serde::de::Deserialize::deserialize(r)?,
60948            ))),
60949            TypeVariant::LedgerCloseMetaV1 => Ok(Self::LedgerCloseMetaV1(Box::new(
60950                serde::de::Deserialize::deserialize(r)?,
60951            ))),
60952            TypeVariant::LedgerCloseMeta => Ok(Self::LedgerCloseMeta(Box::new(
60953                serde::de::Deserialize::deserialize(r)?,
60954            ))),
60955            TypeVariant::ErrorCode => Ok(Self::ErrorCode(Box::new(
60956                serde::de::Deserialize::deserialize(r)?,
60957            ))),
60958            TypeVariant::SError => Ok(Self::SError(Box::new(serde::de::Deserialize::deserialize(
60959                r,
60960            )?))),
60961            TypeVariant::SendMore => Ok(Self::SendMore(Box::new(
60962                serde::de::Deserialize::deserialize(r)?,
60963            ))),
60964            TypeVariant::SendMoreExtended => Ok(Self::SendMoreExtended(Box::new(
60965                serde::de::Deserialize::deserialize(r)?,
60966            ))),
60967            TypeVariant::AuthCert => Ok(Self::AuthCert(Box::new(
60968                serde::de::Deserialize::deserialize(r)?,
60969            ))),
60970            TypeVariant::Hello => Ok(Self::Hello(Box::new(serde::de::Deserialize::deserialize(
60971                r,
60972            )?))),
60973            TypeVariant::Auth => Ok(Self::Auth(Box::new(serde::de::Deserialize::deserialize(
60974                r,
60975            )?))),
60976            TypeVariant::IpAddrType => Ok(Self::IpAddrType(Box::new(
60977                serde::de::Deserialize::deserialize(r)?,
60978            ))),
60979            TypeVariant::PeerAddress => Ok(Self::PeerAddress(Box::new(
60980                serde::de::Deserialize::deserialize(r)?,
60981            ))),
60982            TypeVariant::PeerAddressIp => Ok(Self::PeerAddressIp(Box::new(
60983                serde::de::Deserialize::deserialize(r)?,
60984            ))),
60985            TypeVariant::MessageType => Ok(Self::MessageType(Box::new(
60986                serde::de::Deserialize::deserialize(r)?,
60987            ))),
60988            TypeVariant::DontHave => Ok(Self::DontHave(Box::new(
60989                serde::de::Deserialize::deserialize(r)?,
60990            ))),
60991            TypeVariant::SurveyMessageCommandType => Ok(Self::SurveyMessageCommandType(Box::new(
60992                serde::de::Deserialize::deserialize(r)?,
60993            ))),
60994            TypeVariant::SurveyMessageResponseType => Ok(Self::SurveyMessageResponseType(
60995                Box::new(serde::de::Deserialize::deserialize(r)?),
60996            )),
60997            TypeVariant::TimeSlicedSurveyStartCollectingMessage => {
60998                Ok(Self::TimeSlicedSurveyStartCollectingMessage(Box::new(
60999                    serde::de::Deserialize::deserialize(r)?,
61000                )))
61001            }
61002            TypeVariant::SignedTimeSlicedSurveyStartCollectingMessage => {
61003                Ok(Self::SignedTimeSlicedSurveyStartCollectingMessage(
61004                    Box::new(serde::de::Deserialize::deserialize(r)?),
61005                ))
61006            }
61007            TypeVariant::TimeSlicedSurveyStopCollectingMessage => {
61008                Ok(Self::TimeSlicedSurveyStopCollectingMessage(Box::new(
61009                    serde::de::Deserialize::deserialize(r)?,
61010                )))
61011            }
61012            TypeVariant::SignedTimeSlicedSurveyStopCollectingMessage => {
61013                Ok(Self::SignedTimeSlicedSurveyStopCollectingMessage(Box::new(
61014                    serde::de::Deserialize::deserialize(r)?,
61015                )))
61016            }
61017            TypeVariant::SurveyRequestMessage => Ok(Self::SurveyRequestMessage(Box::new(
61018                serde::de::Deserialize::deserialize(r)?,
61019            ))),
61020            TypeVariant::TimeSlicedSurveyRequestMessage => {
61021                Ok(Self::TimeSlicedSurveyRequestMessage(Box::new(
61022                    serde::de::Deserialize::deserialize(r)?,
61023                )))
61024            }
61025            TypeVariant::SignedSurveyRequestMessage => Ok(Self::SignedSurveyRequestMessage(
61026                Box::new(serde::de::Deserialize::deserialize(r)?),
61027            )),
61028            TypeVariant::SignedTimeSlicedSurveyRequestMessage => {
61029                Ok(Self::SignedTimeSlicedSurveyRequestMessage(Box::new(
61030                    serde::de::Deserialize::deserialize(r)?,
61031                )))
61032            }
61033            TypeVariant::EncryptedBody => Ok(Self::EncryptedBody(Box::new(
61034                serde::de::Deserialize::deserialize(r)?,
61035            ))),
61036            TypeVariant::SurveyResponseMessage => Ok(Self::SurveyResponseMessage(Box::new(
61037                serde::de::Deserialize::deserialize(r)?,
61038            ))),
61039            TypeVariant::TimeSlicedSurveyResponseMessage => {
61040                Ok(Self::TimeSlicedSurveyResponseMessage(Box::new(
61041                    serde::de::Deserialize::deserialize(r)?,
61042                )))
61043            }
61044            TypeVariant::SignedSurveyResponseMessage => Ok(Self::SignedSurveyResponseMessage(
61045                Box::new(serde::de::Deserialize::deserialize(r)?),
61046            )),
61047            TypeVariant::SignedTimeSlicedSurveyResponseMessage => {
61048                Ok(Self::SignedTimeSlicedSurveyResponseMessage(Box::new(
61049                    serde::de::Deserialize::deserialize(r)?,
61050                )))
61051            }
61052            TypeVariant::PeerStats => Ok(Self::PeerStats(Box::new(
61053                serde::de::Deserialize::deserialize(r)?,
61054            ))),
61055            TypeVariant::PeerStatList => Ok(Self::PeerStatList(Box::new(
61056                serde::de::Deserialize::deserialize(r)?,
61057            ))),
61058            TypeVariant::TimeSlicedNodeData => Ok(Self::TimeSlicedNodeData(Box::new(
61059                serde::de::Deserialize::deserialize(r)?,
61060            ))),
61061            TypeVariant::TimeSlicedPeerData => Ok(Self::TimeSlicedPeerData(Box::new(
61062                serde::de::Deserialize::deserialize(r)?,
61063            ))),
61064            TypeVariant::TimeSlicedPeerDataList => Ok(Self::TimeSlicedPeerDataList(Box::new(
61065                serde::de::Deserialize::deserialize(r)?,
61066            ))),
61067            TypeVariant::TopologyResponseBodyV0 => Ok(Self::TopologyResponseBodyV0(Box::new(
61068                serde::de::Deserialize::deserialize(r)?,
61069            ))),
61070            TypeVariant::TopologyResponseBodyV1 => Ok(Self::TopologyResponseBodyV1(Box::new(
61071                serde::de::Deserialize::deserialize(r)?,
61072            ))),
61073            TypeVariant::TopologyResponseBodyV2 => Ok(Self::TopologyResponseBodyV2(Box::new(
61074                serde::de::Deserialize::deserialize(r)?,
61075            ))),
61076            TypeVariant::SurveyResponseBody => Ok(Self::SurveyResponseBody(Box::new(
61077                serde::de::Deserialize::deserialize(r)?,
61078            ))),
61079            TypeVariant::TxAdvertVector => Ok(Self::TxAdvertVector(Box::new(
61080                serde::de::Deserialize::deserialize(r)?,
61081            ))),
61082            TypeVariant::FloodAdvert => Ok(Self::FloodAdvert(Box::new(
61083                serde::de::Deserialize::deserialize(r)?,
61084            ))),
61085            TypeVariant::TxDemandVector => Ok(Self::TxDemandVector(Box::new(
61086                serde::de::Deserialize::deserialize(r)?,
61087            ))),
61088            TypeVariant::FloodDemand => Ok(Self::FloodDemand(Box::new(
61089                serde::de::Deserialize::deserialize(r)?,
61090            ))),
61091            TypeVariant::StellarMessage => Ok(Self::StellarMessage(Box::new(
61092                serde::de::Deserialize::deserialize(r)?,
61093            ))),
61094            TypeVariant::AuthenticatedMessage => Ok(Self::AuthenticatedMessage(Box::new(
61095                serde::de::Deserialize::deserialize(r)?,
61096            ))),
61097            TypeVariant::AuthenticatedMessageV0 => Ok(Self::AuthenticatedMessageV0(Box::new(
61098                serde::de::Deserialize::deserialize(r)?,
61099            ))),
61100            TypeVariant::LiquidityPoolParameters => Ok(Self::LiquidityPoolParameters(Box::new(
61101                serde::de::Deserialize::deserialize(r)?,
61102            ))),
61103            TypeVariant::MuxedAccount => Ok(Self::MuxedAccount(Box::new(
61104                serde::de::Deserialize::deserialize(r)?,
61105            ))),
61106            TypeVariant::MuxedAccountMed25519 => Ok(Self::MuxedAccountMed25519(Box::new(
61107                serde::de::Deserialize::deserialize(r)?,
61108            ))),
61109            TypeVariant::DecoratedSignature => Ok(Self::DecoratedSignature(Box::new(
61110                serde::de::Deserialize::deserialize(r)?,
61111            ))),
61112            TypeVariant::OperationType => Ok(Self::OperationType(Box::new(
61113                serde::de::Deserialize::deserialize(r)?,
61114            ))),
61115            TypeVariant::CreateAccountOp => Ok(Self::CreateAccountOp(Box::new(
61116                serde::de::Deserialize::deserialize(r)?,
61117            ))),
61118            TypeVariant::PaymentOp => Ok(Self::PaymentOp(Box::new(
61119                serde::de::Deserialize::deserialize(r)?,
61120            ))),
61121            TypeVariant::PathPaymentStrictReceiveOp => Ok(Self::PathPaymentStrictReceiveOp(
61122                Box::new(serde::de::Deserialize::deserialize(r)?),
61123            )),
61124            TypeVariant::PathPaymentStrictSendOp => Ok(Self::PathPaymentStrictSendOp(Box::new(
61125                serde::de::Deserialize::deserialize(r)?,
61126            ))),
61127            TypeVariant::ManageSellOfferOp => Ok(Self::ManageSellOfferOp(Box::new(
61128                serde::de::Deserialize::deserialize(r)?,
61129            ))),
61130            TypeVariant::ManageBuyOfferOp => Ok(Self::ManageBuyOfferOp(Box::new(
61131                serde::de::Deserialize::deserialize(r)?,
61132            ))),
61133            TypeVariant::CreatePassiveSellOfferOp => Ok(Self::CreatePassiveSellOfferOp(Box::new(
61134                serde::de::Deserialize::deserialize(r)?,
61135            ))),
61136            TypeVariant::SetOptionsOp => Ok(Self::SetOptionsOp(Box::new(
61137                serde::de::Deserialize::deserialize(r)?,
61138            ))),
61139            TypeVariant::ChangeTrustAsset => Ok(Self::ChangeTrustAsset(Box::new(
61140                serde::de::Deserialize::deserialize(r)?,
61141            ))),
61142            TypeVariant::ChangeTrustOp => Ok(Self::ChangeTrustOp(Box::new(
61143                serde::de::Deserialize::deserialize(r)?,
61144            ))),
61145            TypeVariant::AllowTrustOp => Ok(Self::AllowTrustOp(Box::new(
61146                serde::de::Deserialize::deserialize(r)?,
61147            ))),
61148            TypeVariant::ManageDataOp => Ok(Self::ManageDataOp(Box::new(
61149                serde::de::Deserialize::deserialize(r)?,
61150            ))),
61151            TypeVariant::BumpSequenceOp => Ok(Self::BumpSequenceOp(Box::new(
61152                serde::de::Deserialize::deserialize(r)?,
61153            ))),
61154            TypeVariant::CreateClaimableBalanceOp => Ok(Self::CreateClaimableBalanceOp(Box::new(
61155                serde::de::Deserialize::deserialize(r)?,
61156            ))),
61157            TypeVariant::ClaimClaimableBalanceOp => Ok(Self::ClaimClaimableBalanceOp(Box::new(
61158                serde::de::Deserialize::deserialize(r)?,
61159            ))),
61160            TypeVariant::BeginSponsoringFutureReservesOp => {
61161                Ok(Self::BeginSponsoringFutureReservesOp(Box::new(
61162                    serde::de::Deserialize::deserialize(r)?,
61163                )))
61164            }
61165            TypeVariant::RevokeSponsorshipType => Ok(Self::RevokeSponsorshipType(Box::new(
61166                serde::de::Deserialize::deserialize(r)?,
61167            ))),
61168            TypeVariant::RevokeSponsorshipOp => Ok(Self::RevokeSponsorshipOp(Box::new(
61169                serde::de::Deserialize::deserialize(r)?,
61170            ))),
61171            TypeVariant::RevokeSponsorshipOpSigner => Ok(Self::RevokeSponsorshipOpSigner(
61172                Box::new(serde::de::Deserialize::deserialize(r)?),
61173            )),
61174            TypeVariant::ClawbackOp => Ok(Self::ClawbackOp(Box::new(
61175                serde::de::Deserialize::deserialize(r)?,
61176            ))),
61177            TypeVariant::ClawbackClaimableBalanceOp => Ok(Self::ClawbackClaimableBalanceOp(
61178                Box::new(serde::de::Deserialize::deserialize(r)?),
61179            )),
61180            TypeVariant::SetTrustLineFlagsOp => Ok(Self::SetTrustLineFlagsOp(Box::new(
61181                serde::de::Deserialize::deserialize(r)?,
61182            ))),
61183            TypeVariant::LiquidityPoolDepositOp => Ok(Self::LiquidityPoolDepositOp(Box::new(
61184                serde::de::Deserialize::deserialize(r)?,
61185            ))),
61186            TypeVariant::LiquidityPoolWithdrawOp => Ok(Self::LiquidityPoolWithdrawOp(Box::new(
61187                serde::de::Deserialize::deserialize(r)?,
61188            ))),
61189            TypeVariant::HostFunctionType => Ok(Self::HostFunctionType(Box::new(
61190                serde::de::Deserialize::deserialize(r)?,
61191            ))),
61192            TypeVariant::ContractIdPreimageType => Ok(Self::ContractIdPreimageType(Box::new(
61193                serde::de::Deserialize::deserialize(r)?,
61194            ))),
61195            TypeVariant::ContractIdPreimage => Ok(Self::ContractIdPreimage(Box::new(
61196                serde::de::Deserialize::deserialize(r)?,
61197            ))),
61198            TypeVariant::ContractIdPreimageFromAddress => Ok(Self::ContractIdPreimageFromAddress(
61199                Box::new(serde::de::Deserialize::deserialize(r)?),
61200            )),
61201            TypeVariant::CreateContractArgs => Ok(Self::CreateContractArgs(Box::new(
61202                serde::de::Deserialize::deserialize(r)?,
61203            ))),
61204            TypeVariant::CreateContractArgsV2 => Ok(Self::CreateContractArgsV2(Box::new(
61205                serde::de::Deserialize::deserialize(r)?,
61206            ))),
61207            TypeVariant::InvokeContractArgs => Ok(Self::InvokeContractArgs(Box::new(
61208                serde::de::Deserialize::deserialize(r)?,
61209            ))),
61210            TypeVariant::HostFunction => Ok(Self::HostFunction(Box::new(
61211                serde::de::Deserialize::deserialize(r)?,
61212            ))),
61213            TypeVariant::SorobanAuthorizedFunctionType => Ok(Self::SorobanAuthorizedFunctionType(
61214                Box::new(serde::de::Deserialize::deserialize(r)?),
61215            )),
61216            TypeVariant::SorobanAuthorizedFunction => Ok(Self::SorobanAuthorizedFunction(
61217                Box::new(serde::de::Deserialize::deserialize(r)?),
61218            )),
61219            TypeVariant::SorobanAuthorizedInvocation => Ok(Self::SorobanAuthorizedInvocation(
61220                Box::new(serde::de::Deserialize::deserialize(r)?),
61221            )),
61222            TypeVariant::SorobanAddressCredentials => Ok(Self::SorobanAddressCredentials(
61223                Box::new(serde::de::Deserialize::deserialize(r)?),
61224            )),
61225            TypeVariant::SorobanCredentialsType => Ok(Self::SorobanCredentialsType(Box::new(
61226                serde::de::Deserialize::deserialize(r)?,
61227            ))),
61228            TypeVariant::SorobanCredentials => Ok(Self::SorobanCredentials(Box::new(
61229                serde::de::Deserialize::deserialize(r)?,
61230            ))),
61231            TypeVariant::SorobanAuthorizationEntry => Ok(Self::SorobanAuthorizationEntry(
61232                Box::new(serde::de::Deserialize::deserialize(r)?),
61233            )),
61234            TypeVariant::InvokeHostFunctionOp => Ok(Self::InvokeHostFunctionOp(Box::new(
61235                serde::de::Deserialize::deserialize(r)?,
61236            ))),
61237            TypeVariant::ExtendFootprintTtlOp => Ok(Self::ExtendFootprintTtlOp(Box::new(
61238                serde::de::Deserialize::deserialize(r)?,
61239            ))),
61240            TypeVariant::RestoreFootprintOp => Ok(Self::RestoreFootprintOp(Box::new(
61241                serde::de::Deserialize::deserialize(r)?,
61242            ))),
61243            TypeVariant::Operation => Ok(Self::Operation(Box::new(
61244                serde::de::Deserialize::deserialize(r)?,
61245            ))),
61246            TypeVariant::OperationBody => Ok(Self::OperationBody(Box::new(
61247                serde::de::Deserialize::deserialize(r)?,
61248            ))),
61249            TypeVariant::HashIdPreimage => Ok(Self::HashIdPreimage(Box::new(
61250                serde::de::Deserialize::deserialize(r)?,
61251            ))),
61252            TypeVariant::HashIdPreimageOperationId => Ok(Self::HashIdPreimageOperationId(
61253                Box::new(serde::de::Deserialize::deserialize(r)?),
61254            )),
61255            TypeVariant::HashIdPreimageRevokeId => Ok(Self::HashIdPreimageRevokeId(Box::new(
61256                serde::de::Deserialize::deserialize(r)?,
61257            ))),
61258            TypeVariant::HashIdPreimageContractId => Ok(Self::HashIdPreimageContractId(Box::new(
61259                serde::de::Deserialize::deserialize(r)?,
61260            ))),
61261            TypeVariant::HashIdPreimageSorobanAuthorization => {
61262                Ok(Self::HashIdPreimageSorobanAuthorization(Box::new(
61263                    serde::de::Deserialize::deserialize(r)?,
61264                )))
61265            }
61266            TypeVariant::MemoType => Ok(Self::MemoType(Box::new(
61267                serde::de::Deserialize::deserialize(r)?,
61268            ))),
61269            TypeVariant::Memo => Ok(Self::Memo(Box::new(serde::de::Deserialize::deserialize(
61270                r,
61271            )?))),
61272            TypeVariant::TimeBounds => Ok(Self::TimeBounds(Box::new(
61273                serde::de::Deserialize::deserialize(r)?,
61274            ))),
61275            TypeVariant::LedgerBounds => Ok(Self::LedgerBounds(Box::new(
61276                serde::de::Deserialize::deserialize(r)?,
61277            ))),
61278            TypeVariant::PreconditionsV2 => Ok(Self::PreconditionsV2(Box::new(
61279                serde::de::Deserialize::deserialize(r)?,
61280            ))),
61281            TypeVariant::PreconditionType => Ok(Self::PreconditionType(Box::new(
61282                serde::de::Deserialize::deserialize(r)?,
61283            ))),
61284            TypeVariant::Preconditions => Ok(Self::Preconditions(Box::new(
61285                serde::de::Deserialize::deserialize(r)?,
61286            ))),
61287            TypeVariant::LedgerFootprint => Ok(Self::LedgerFootprint(Box::new(
61288                serde::de::Deserialize::deserialize(r)?,
61289            ))),
61290            TypeVariant::ArchivalProofType => Ok(Self::ArchivalProofType(Box::new(
61291                serde::de::Deserialize::deserialize(r)?,
61292            ))),
61293            TypeVariant::ArchivalProofNode => Ok(Self::ArchivalProofNode(Box::new(
61294                serde::de::Deserialize::deserialize(r)?,
61295            ))),
61296            TypeVariant::ProofLevel => Ok(Self::ProofLevel(Box::new(
61297                serde::de::Deserialize::deserialize(r)?,
61298            ))),
61299            TypeVariant::NonexistenceProofBody => Ok(Self::NonexistenceProofBody(Box::new(
61300                serde::de::Deserialize::deserialize(r)?,
61301            ))),
61302            TypeVariant::ExistenceProofBody => Ok(Self::ExistenceProofBody(Box::new(
61303                serde::de::Deserialize::deserialize(r)?,
61304            ))),
61305            TypeVariant::ArchivalProof => Ok(Self::ArchivalProof(Box::new(
61306                serde::de::Deserialize::deserialize(r)?,
61307            ))),
61308            TypeVariant::ArchivalProofBody => Ok(Self::ArchivalProofBody(Box::new(
61309                serde::de::Deserialize::deserialize(r)?,
61310            ))),
61311            TypeVariant::SorobanResources => Ok(Self::SorobanResources(Box::new(
61312                serde::de::Deserialize::deserialize(r)?,
61313            ))),
61314            TypeVariant::SorobanTransactionData => Ok(Self::SorobanTransactionData(Box::new(
61315                serde::de::Deserialize::deserialize(r)?,
61316            ))),
61317            TypeVariant::TransactionV0 => Ok(Self::TransactionV0(Box::new(
61318                serde::de::Deserialize::deserialize(r)?,
61319            ))),
61320            TypeVariant::TransactionV0Ext => Ok(Self::TransactionV0Ext(Box::new(
61321                serde::de::Deserialize::deserialize(r)?,
61322            ))),
61323            TypeVariant::TransactionV0Envelope => Ok(Self::TransactionV0Envelope(Box::new(
61324                serde::de::Deserialize::deserialize(r)?,
61325            ))),
61326            TypeVariant::Transaction => Ok(Self::Transaction(Box::new(
61327                serde::de::Deserialize::deserialize(r)?,
61328            ))),
61329            TypeVariant::TransactionExt => Ok(Self::TransactionExt(Box::new(
61330                serde::de::Deserialize::deserialize(r)?,
61331            ))),
61332            TypeVariant::TransactionV1Envelope => Ok(Self::TransactionV1Envelope(Box::new(
61333                serde::de::Deserialize::deserialize(r)?,
61334            ))),
61335            TypeVariant::FeeBumpTransaction => Ok(Self::FeeBumpTransaction(Box::new(
61336                serde::de::Deserialize::deserialize(r)?,
61337            ))),
61338            TypeVariant::FeeBumpTransactionInnerTx => Ok(Self::FeeBumpTransactionInnerTx(
61339                Box::new(serde::de::Deserialize::deserialize(r)?),
61340            )),
61341            TypeVariant::FeeBumpTransactionExt => Ok(Self::FeeBumpTransactionExt(Box::new(
61342                serde::de::Deserialize::deserialize(r)?,
61343            ))),
61344            TypeVariant::FeeBumpTransactionEnvelope => Ok(Self::FeeBumpTransactionEnvelope(
61345                Box::new(serde::de::Deserialize::deserialize(r)?),
61346            )),
61347            TypeVariant::TransactionEnvelope => Ok(Self::TransactionEnvelope(Box::new(
61348                serde::de::Deserialize::deserialize(r)?,
61349            ))),
61350            TypeVariant::TransactionSignaturePayload => Ok(Self::TransactionSignaturePayload(
61351                Box::new(serde::de::Deserialize::deserialize(r)?),
61352            )),
61353            TypeVariant::TransactionSignaturePayloadTaggedTransaction => {
61354                Ok(Self::TransactionSignaturePayloadTaggedTransaction(
61355                    Box::new(serde::de::Deserialize::deserialize(r)?),
61356                ))
61357            }
61358            TypeVariant::ClaimAtomType => Ok(Self::ClaimAtomType(Box::new(
61359                serde::de::Deserialize::deserialize(r)?,
61360            ))),
61361            TypeVariant::ClaimOfferAtomV0 => Ok(Self::ClaimOfferAtomV0(Box::new(
61362                serde::de::Deserialize::deserialize(r)?,
61363            ))),
61364            TypeVariant::ClaimOfferAtom => Ok(Self::ClaimOfferAtom(Box::new(
61365                serde::de::Deserialize::deserialize(r)?,
61366            ))),
61367            TypeVariant::ClaimLiquidityAtom => Ok(Self::ClaimLiquidityAtom(Box::new(
61368                serde::de::Deserialize::deserialize(r)?,
61369            ))),
61370            TypeVariant::ClaimAtom => Ok(Self::ClaimAtom(Box::new(
61371                serde::de::Deserialize::deserialize(r)?,
61372            ))),
61373            TypeVariant::CreateAccountResultCode => Ok(Self::CreateAccountResultCode(Box::new(
61374                serde::de::Deserialize::deserialize(r)?,
61375            ))),
61376            TypeVariant::CreateAccountResult => Ok(Self::CreateAccountResult(Box::new(
61377                serde::de::Deserialize::deserialize(r)?,
61378            ))),
61379            TypeVariant::PaymentResultCode => Ok(Self::PaymentResultCode(Box::new(
61380                serde::de::Deserialize::deserialize(r)?,
61381            ))),
61382            TypeVariant::PaymentResult => Ok(Self::PaymentResult(Box::new(
61383                serde::de::Deserialize::deserialize(r)?,
61384            ))),
61385            TypeVariant::PathPaymentStrictReceiveResultCode => {
61386                Ok(Self::PathPaymentStrictReceiveResultCode(Box::new(
61387                    serde::de::Deserialize::deserialize(r)?,
61388                )))
61389            }
61390            TypeVariant::SimplePaymentResult => Ok(Self::SimplePaymentResult(Box::new(
61391                serde::de::Deserialize::deserialize(r)?,
61392            ))),
61393            TypeVariant::PathPaymentStrictReceiveResult => {
61394                Ok(Self::PathPaymentStrictReceiveResult(Box::new(
61395                    serde::de::Deserialize::deserialize(r)?,
61396                )))
61397            }
61398            TypeVariant::PathPaymentStrictReceiveResultSuccess => {
61399                Ok(Self::PathPaymentStrictReceiveResultSuccess(Box::new(
61400                    serde::de::Deserialize::deserialize(r)?,
61401                )))
61402            }
61403            TypeVariant::PathPaymentStrictSendResultCode => {
61404                Ok(Self::PathPaymentStrictSendResultCode(Box::new(
61405                    serde::de::Deserialize::deserialize(r)?,
61406                )))
61407            }
61408            TypeVariant::PathPaymentStrictSendResult => Ok(Self::PathPaymentStrictSendResult(
61409                Box::new(serde::de::Deserialize::deserialize(r)?),
61410            )),
61411            TypeVariant::PathPaymentStrictSendResultSuccess => {
61412                Ok(Self::PathPaymentStrictSendResultSuccess(Box::new(
61413                    serde::de::Deserialize::deserialize(r)?,
61414                )))
61415            }
61416            TypeVariant::ManageSellOfferResultCode => Ok(Self::ManageSellOfferResultCode(
61417                Box::new(serde::de::Deserialize::deserialize(r)?),
61418            )),
61419            TypeVariant::ManageOfferEffect => Ok(Self::ManageOfferEffect(Box::new(
61420                serde::de::Deserialize::deserialize(r)?,
61421            ))),
61422            TypeVariant::ManageOfferSuccessResult => Ok(Self::ManageOfferSuccessResult(Box::new(
61423                serde::de::Deserialize::deserialize(r)?,
61424            ))),
61425            TypeVariant::ManageOfferSuccessResultOffer => Ok(Self::ManageOfferSuccessResultOffer(
61426                Box::new(serde::de::Deserialize::deserialize(r)?),
61427            )),
61428            TypeVariant::ManageSellOfferResult => Ok(Self::ManageSellOfferResult(Box::new(
61429                serde::de::Deserialize::deserialize(r)?,
61430            ))),
61431            TypeVariant::ManageBuyOfferResultCode => Ok(Self::ManageBuyOfferResultCode(Box::new(
61432                serde::de::Deserialize::deserialize(r)?,
61433            ))),
61434            TypeVariant::ManageBuyOfferResult => Ok(Self::ManageBuyOfferResult(Box::new(
61435                serde::de::Deserialize::deserialize(r)?,
61436            ))),
61437            TypeVariant::SetOptionsResultCode => Ok(Self::SetOptionsResultCode(Box::new(
61438                serde::de::Deserialize::deserialize(r)?,
61439            ))),
61440            TypeVariant::SetOptionsResult => Ok(Self::SetOptionsResult(Box::new(
61441                serde::de::Deserialize::deserialize(r)?,
61442            ))),
61443            TypeVariant::ChangeTrustResultCode => Ok(Self::ChangeTrustResultCode(Box::new(
61444                serde::de::Deserialize::deserialize(r)?,
61445            ))),
61446            TypeVariant::ChangeTrustResult => Ok(Self::ChangeTrustResult(Box::new(
61447                serde::de::Deserialize::deserialize(r)?,
61448            ))),
61449            TypeVariant::AllowTrustResultCode => Ok(Self::AllowTrustResultCode(Box::new(
61450                serde::de::Deserialize::deserialize(r)?,
61451            ))),
61452            TypeVariant::AllowTrustResult => Ok(Self::AllowTrustResult(Box::new(
61453                serde::de::Deserialize::deserialize(r)?,
61454            ))),
61455            TypeVariant::AccountMergeResultCode => Ok(Self::AccountMergeResultCode(Box::new(
61456                serde::de::Deserialize::deserialize(r)?,
61457            ))),
61458            TypeVariant::AccountMergeResult => Ok(Self::AccountMergeResult(Box::new(
61459                serde::de::Deserialize::deserialize(r)?,
61460            ))),
61461            TypeVariant::InflationResultCode => Ok(Self::InflationResultCode(Box::new(
61462                serde::de::Deserialize::deserialize(r)?,
61463            ))),
61464            TypeVariant::InflationPayout => Ok(Self::InflationPayout(Box::new(
61465                serde::de::Deserialize::deserialize(r)?,
61466            ))),
61467            TypeVariant::InflationResult => Ok(Self::InflationResult(Box::new(
61468                serde::de::Deserialize::deserialize(r)?,
61469            ))),
61470            TypeVariant::ManageDataResultCode => Ok(Self::ManageDataResultCode(Box::new(
61471                serde::de::Deserialize::deserialize(r)?,
61472            ))),
61473            TypeVariant::ManageDataResult => Ok(Self::ManageDataResult(Box::new(
61474                serde::de::Deserialize::deserialize(r)?,
61475            ))),
61476            TypeVariant::BumpSequenceResultCode => Ok(Self::BumpSequenceResultCode(Box::new(
61477                serde::de::Deserialize::deserialize(r)?,
61478            ))),
61479            TypeVariant::BumpSequenceResult => Ok(Self::BumpSequenceResult(Box::new(
61480                serde::de::Deserialize::deserialize(r)?,
61481            ))),
61482            TypeVariant::CreateClaimableBalanceResultCode => {
61483                Ok(Self::CreateClaimableBalanceResultCode(Box::new(
61484                    serde::de::Deserialize::deserialize(r)?,
61485                )))
61486            }
61487            TypeVariant::CreateClaimableBalanceResult => Ok(Self::CreateClaimableBalanceResult(
61488                Box::new(serde::de::Deserialize::deserialize(r)?),
61489            )),
61490            TypeVariant::ClaimClaimableBalanceResultCode => {
61491                Ok(Self::ClaimClaimableBalanceResultCode(Box::new(
61492                    serde::de::Deserialize::deserialize(r)?,
61493                )))
61494            }
61495            TypeVariant::ClaimClaimableBalanceResult => Ok(Self::ClaimClaimableBalanceResult(
61496                Box::new(serde::de::Deserialize::deserialize(r)?),
61497            )),
61498            TypeVariant::BeginSponsoringFutureReservesResultCode => {
61499                Ok(Self::BeginSponsoringFutureReservesResultCode(Box::new(
61500                    serde::de::Deserialize::deserialize(r)?,
61501                )))
61502            }
61503            TypeVariant::BeginSponsoringFutureReservesResult => {
61504                Ok(Self::BeginSponsoringFutureReservesResult(Box::new(
61505                    serde::de::Deserialize::deserialize(r)?,
61506                )))
61507            }
61508            TypeVariant::EndSponsoringFutureReservesResultCode => {
61509                Ok(Self::EndSponsoringFutureReservesResultCode(Box::new(
61510                    serde::de::Deserialize::deserialize(r)?,
61511                )))
61512            }
61513            TypeVariant::EndSponsoringFutureReservesResult => {
61514                Ok(Self::EndSponsoringFutureReservesResult(Box::new(
61515                    serde::de::Deserialize::deserialize(r)?,
61516                )))
61517            }
61518            TypeVariant::RevokeSponsorshipResultCode => Ok(Self::RevokeSponsorshipResultCode(
61519                Box::new(serde::de::Deserialize::deserialize(r)?),
61520            )),
61521            TypeVariant::RevokeSponsorshipResult => Ok(Self::RevokeSponsorshipResult(Box::new(
61522                serde::de::Deserialize::deserialize(r)?,
61523            ))),
61524            TypeVariant::ClawbackResultCode => Ok(Self::ClawbackResultCode(Box::new(
61525                serde::de::Deserialize::deserialize(r)?,
61526            ))),
61527            TypeVariant::ClawbackResult => Ok(Self::ClawbackResult(Box::new(
61528                serde::de::Deserialize::deserialize(r)?,
61529            ))),
61530            TypeVariant::ClawbackClaimableBalanceResultCode => {
61531                Ok(Self::ClawbackClaimableBalanceResultCode(Box::new(
61532                    serde::de::Deserialize::deserialize(r)?,
61533                )))
61534            }
61535            TypeVariant::ClawbackClaimableBalanceResult => {
61536                Ok(Self::ClawbackClaimableBalanceResult(Box::new(
61537                    serde::de::Deserialize::deserialize(r)?,
61538                )))
61539            }
61540            TypeVariant::SetTrustLineFlagsResultCode => Ok(Self::SetTrustLineFlagsResultCode(
61541                Box::new(serde::de::Deserialize::deserialize(r)?),
61542            )),
61543            TypeVariant::SetTrustLineFlagsResult => Ok(Self::SetTrustLineFlagsResult(Box::new(
61544                serde::de::Deserialize::deserialize(r)?,
61545            ))),
61546            TypeVariant::LiquidityPoolDepositResultCode => {
61547                Ok(Self::LiquidityPoolDepositResultCode(Box::new(
61548                    serde::de::Deserialize::deserialize(r)?,
61549                )))
61550            }
61551            TypeVariant::LiquidityPoolDepositResult => Ok(Self::LiquidityPoolDepositResult(
61552                Box::new(serde::de::Deserialize::deserialize(r)?),
61553            )),
61554            TypeVariant::LiquidityPoolWithdrawResultCode => {
61555                Ok(Self::LiquidityPoolWithdrawResultCode(Box::new(
61556                    serde::de::Deserialize::deserialize(r)?,
61557                )))
61558            }
61559            TypeVariant::LiquidityPoolWithdrawResult => Ok(Self::LiquidityPoolWithdrawResult(
61560                Box::new(serde::de::Deserialize::deserialize(r)?),
61561            )),
61562            TypeVariant::InvokeHostFunctionResultCode => Ok(Self::InvokeHostFunctionResultCode(
61563                Box::new(serde::de::Deserialize::deserialize(r)?),
61564            )),
61565            TypeVariant::InvokeHostFunctionResult => Ok(Self::InvokeHostFunctionResult(Box::new(
61566                serde::de::Deserialize::deserialize(r)?,
61567            ))),
61568            TypeVariant::ExtendFootprintTtlResultCode => Ok(Self::ExtendFootprintTtlResultCode(
61569                Box::new(serde::de::Deserialize::deserialize(r)?),
61570            )),
61571            TypeVariant::ExtendFootprintTtlResult => Ok(Self::ExtendFootprintTtlResult(Box::new(
61572                serde::de::Deserialize::deserialize(r)?,
61573            ))),
61574            TypeVariant::RestoreFootprintResultCode => Ok(Self::RestoreFootprintResultCode(
61575                Box::new(serde::de::Deserialize::deserialize(r)?),
61576            )),
61577            TypeVariant::RestoreFootprintResult => Ok(Self::RestoreFootprintResult(Box::new(
61578                serde::de::Deserialize::deserialize(r)?,
61579            ))),
61580            TypeVariant::OperationResultCode => Ok(Self::OperationResultCode(Box::new(
61581                serde::de::Deserialize::deserialize(r)?,
61582            ))),
61583            TypeVariant::OperationResult => Ok(Self::OperationResult(Box::new(
61584                serde::de::Deserialize::deserialize(r)?,
61585            ))),
61586            TypeVariant::OperationResultTr => Ok(Self::OperationResultTr(Box::new(
61587                serde::de::Deserialize::deserialize(r)?,
61588            ))),
61589            TypeVariant::TransactionResultCode => Ok(Self::TransactionResultCode(Box::new(
61590                serde::de::Deserialize::deserialize(r)?,
61591            ))),
61592            TypeVariant::InnerTransactionResult => Ok(Self::InnerTransactionResult(Box::new(
61593                serde::de::Deserialize::deserialize(r)?,
61594            ))),
61595            TypeVariant::InnerTransactionResultResult => Ok(Self::InnerTransactionResultResult(
61596                Box::new(serde::de::Deserialize::deserialize(r)?),
61597            )),
61598            TypeVariant::InnerTransactionResultExt => Ok(Self::InnerTransactionResultExt(
61599                Box::new(serde::de::Deserialize::deserialize(r)?),
61600            )),
61601            TypeVariant::InnerTransactionResultPair => Ok(Self::InnerTransactionResultPair(
61602                Box::new(serde::de::Deserialize::deserialize(r)?),
61603            )),
61604            TypeVariant::TransactionResult => Ok(Self::TransactionResult(Box::new(
61605                serde::de::Deserialize::deserialize(r)?,
61606            ))),
61607            TypeVariant::TransactionResultResult => Ok(Self::TransactionResultResult(Box::new(
61608                serde::de::Deserialize::deserialize(r)?,
61609            ))),
61610            TypeVariant::TransactionResultExt => Ok(Self::TransactionResultExt(Box::new(
61611                serde::de::Deserialize::deserialize(r)?,
61612            ))),
61613            TypeVariant::Hash => Ok(Self::Hash(Box::new(serde::de::Deserialize::deserialize(
61614                r,
61615            )?))),
61616            TypeVariant::Uint256 => Ok(Self::Uint256(Box::new(
61617                serde::de::Deserialize::deserialize(r)?,
61618            ))),
61619            TypeVariant::Uint32 => Ok(Self::Uint32(Box::new(serde::de::Deserialize::deserialize(
61620                r,
61621            )?))),
61622            TypeVariant::Int32 => Ok(Self::Int32(Box::new(serde::de::Deserialize::deserialize(
61623                r,
61624            )?))),
61625            TypeVariant::Uint64 => Ok(Self::Uint64(Box::new(serde::de::Deserialize::deserialize(
61626                r,
61627            )?))),
61628            TypeVariant::Int64 => Ok(Self::Int64(Box::new(serde::de::Deserialize::deserialize(
61629                r,
61630            )?))),
61631            TypeVariant::TimePoint => Ok(Self::TimePoint(Box::new(
61632                serde::de::Deserialize::deserialize(r)?,
61633            ))),
61634            TypeVariant::Duration => Ok(Self::Duration(Box::new(
61635                serde::de::Deserialize::deserialize(r)?,
61636            ))),
61637            TypeVariant::ExtensionPoint => Ok(Self::ExtensionPoint(Box::new(
61638                serde::de::Deserialize::deserialize(r)?,
61639            ))),
61640            TypeVariant::CryptoKeyType => Ok(Self::CryptoKeyType(Box::new(
61641                serde::de::Deserialize::deserialize(r)?,
61642            ))),
61643            TypeVariant::PublicKeyType => Ok(Self::PublicKeyType(Box::new(
61644                serde::de::Deserialize::deserialize(r)?,
61645            ))),
61646            TypeVariant::SignerKeyType => Ok(Self::SignerKeyType(Box::new(
61647                serde::de::Deserialize::deserialize(r)?,
61648            ))),
61649            TypeVariant::PublicKey => Ok(Self::PublicKey(Box::new(
61650                serde::de::Deserialize::deserialize(r)?,
61651            ))),
61652            TypeVariant::SignerKey => Ok(Self::SignerKey(Box::new(
61653                serde::de::Deserialize::deserialize(r)?,
61654            ))),
61655            TypeVariant::SignerKeyEd25519SignedPayload => Ok(Self::SignerKeyEd25519SignedPayload(
61656                Box::new(serde::de::Deserialize::deserialize(r)?),
61657            )),
61658            TypeVariant::Signature => Ok(Self::Signature(Box::new(
61659                serde::de::Deserialize::deserialize(r)?,
61660            ))),
61661            TypeVariant::SignatureHint => Ok(Self::SignatureHint(Box::new(
61662                serde::de::Deserialize::deserialize(r)?,
61663            ))),
61664            TypeVariant::NodeId => Ok(Self::NodeId(Box::new(serde::de::Deserialize::deserialize(
61665                r,
61666            )?))),
61667            TypeVariant::AccountId => Ok(Self::AccountId(Box::new(
61668                serde::de::Deserialize::deserialize(r)?,
61669            ))),
61670            TypeVariant::Curve25519Secret => Ok(Self::Curve25519Secret(Box::new(
61671                serde::de::Deserialize::deserialize(r)?,
61672            ))),
61673            TypeVariant::Curve25519Public => Ok(Self::Curve25519Public(Box::new(
61674                serde::de::Deserialize::deserialize(r)?,
61675            ))),
61676            TypeVariant::HmacSha256Key => Ok(Self::HmacSha256Key(Box::new(
61677                serde::de::Deserialize::deserialize(r)?,
61678            ))),
61679            TypeVariant::HmacSha256Mac => Ok(Self::HmacSha256Mac(Box::new(
61680                serde::de::Deserialize::deserialize(r)?,
61681            ))),
61682            TypeVariant::ShortHashSeed => Ok(Self::ShortHashSeed(Box::new(
61683                serde::de::Deserialize::deserialize(r)?,
61684            ))),
61685            TypeVariant::BinaryFuseFilterType => Ok(Self::BinaryFuseFilterType(Box::new(
61686                serde::de::Deserialize::deserialize(r)?,
61687            ))),
61688            TypeVariant::SerializedBinaryFuseFilter => Ok(Self::SerializedBinaryFuseFilter(
61689                Box::new(serde::de::Deserialize::deserialize(r)?),
61690            )),
61691        }
61692    }
61693
61694    #[cfg(feature = "alloc")]
61695    #[must_use]
61696    #[allow(clippy::too_many_lines)]
61697    pub fn value(&self) -> &dyn core::any::Any {
61698        #[allow(clippy::match_same_arms)]
61699        match self {
61700            Self::Value(ref v) => v.as_ref(),
61701            Self::ScpBallot(ref v) => v.as_ref(),
61702            Self::ScpStatementType(ref v) => v.as_ref(),
61703            Self::ScpNomination(ref v) => v.as_ref(),
61704            Self::ScpStatement(ref v) => v.as_ref(),
61705            Self::ScpStatementPledges(ref v) => v.as_ref(),
61706            Self::ScpStatementPrepare(ref v) => v.as_ref(),
61707            Self::ScpStatementConfirm(ref v) => v.as_ref(),
61708            Self::ScpStatementExternalize(ref v) => v.as_ref(),
61709            Self::ScpEnvelope(ref v) => v.as_ref(),
61710            Self::ScpQuorumSet(ref v) => v.as_ref(),
61711            Self::ConfigSettingContractExecutionLanesV0(ref v) => v.as_ref(),
61712            Self::ConfigSettingContractComputeV0(ref v) => v.as_ref(),
61713            Self::ConfigSettingContractLedgerCostV0(ref v) => v.as_ref(),
61714            Self::ConfigSettingContractHistoricalDataV0(ref v) => v.as_ref(),
61715            Self::ConfigSettingContractEventsV0(ref v) => v.as_ref(),
61716            Self::ConfigSettingContractBandwidthV0(ref v) => v.as_ref(),
61717            Self::ContractCostType(ref v) => v.as_ref(),
61718            Self::ContractCostParamEntry(ref v) => v.as_ref(),
61719            Self::StateArchivalSettings(ref v) => v.as_ref(),
61720            Self::EvictionIterator(ref v) => v.as_ref(),
61721            Self::ContractCostParams(ref v) => v.as_ref(),
61722            Self::ConfigSettingId(ref v) => v.as_ref(),
61723            Self::ConfigSettingEntry(ref v) => v.as_ref(),
61724            Self::ScEnvMetaKind(ref v) => v.as_ref(),
61725            Self::ScEnvMetaEntry(ref v) => v.as_ref(),
61726            Self::ScEnvMetaEntryInterfaceVersion(ref v) => v.as_ref(),
61727            Self::ScMetaV0(ref v) => v.as_ref(),
61728            Self::ScMetaKind(ref v) => v.as_ref(),
61729            Self::ScMetaEntry(ref v) => v.as_ref(),
61730            Self::ScSpecType(ref v) => v.as_ref(),
61731            Self::ScSpecTypeOption(ref v) => v.as_ref(),
61732            Self::ScSpecTypeResult(ref v) => v.as_ref(),
61733            Self::ScSpecTypeVec(ref v) => v.as_ref(),
61734            Self::ScSpecTypeMap(ref v) => v.as_ref(),
61735            Self::ScSpecTypeTuple(ref v) => v.as_ref(),
61736            Self::ScSpecTypeBytesN(ref v) => v.as_ref(),
61737            Self::ScSpecTypeUdt(ref v) => v.as_ref(),
61738            Self::ScSpecTypeDef(ref v) => v.as_ref(),
61739            Self::ScSpecUdtStructFieldV0(ref v) => v.as_ref(),
61740            Self::ScSpecUdtStructV0(ref v) => v.as_ref(),
61741            Self::ScSpecUdtUnionCaseVoidV0(ref v) => v.as_ref(),
61742            Self::ScSpecUdtUnionCaseTupleV0(ref v) => v.as_ref(),
61743            Self::ScSpecUdtUnionCaseV0Kind(ref v) => v.as_ref(),
61744            Self::ScSpecUdtUnionCaseV0(ref v) => v.as_ref(),
61745            Self::ScSpecUdtUnionV0(ref v) => v.as_ref(),
61746            Self::ScSpecUdtEnumCaseV0(ref v) => v.as_ref(),
61747            Self::ScSpecUdtEnumV0(ref v) => v.as_ref(),
61748            Self::ScSpecUdtErrorEnumCaseV0(ref v) => v.as_ref(),
61749            Self::ScSpecUdtErrorEnumV0(ref v) => v.as_ref(),
61750            Self::ScSpecFunctionInputV0(ref v) => v.as_ref(),
61751            Self::ScSpecFunctionV0(ref v) => v.as_ref(),
61752            Self::ScSpecEntryKind(ref v) => v.as_ref(),
61753            Self::ScSpecEntry(ref v) => v.as_ref(),
61754            Self::ScValType(ref v) => v.as_ref(),
61755            Self::ScErrorType(ref v) => v.as_ref(),
61756            Self::ScErrorCode(ref v) => v.as_ref(),
61757            Self::ScError(ref v) => v.as_ref(),
61758            Self::UInt128Parts(ref v) => v.as_ref(),
61759            Self::Int128Parts(ref v) => v.as_ref(),
61760            Self::UInt256Parts(ref v) => v.as_ref(),
61761            Self::Int256Parts(ref v) => v.as_ref(),
61762            Self::ContractExecutableType(ref v) => v.as_ref(),
61763            Self::ContractExecutable(ref v) => v.as_ref(),
61764            Self::ScAddressType(ref v) => v.as_ref(),
61765            Self::ScAddress(ref v) => v.as_ref(),
61766            Self::ScVec(ref v) => v.as_ref(),
61767            Self::ScMap(ref v) => v.as_ref(),
61768            Self::ScBytes(ref v) => v.as_ref(),
61769            Self::ScString(ref v) => v.as_ref(),
61770            Self::ScSymbol(ref v) => v.as_ref(),
61771            Self::ScNonceKey(ref v) => v.as_ref(),
61772            Self::ScContractInstance(ref v) => v.as_ref(),
61773            Self::ScVal(ref v) => v.as_ref(),
61774            Self::ScMapEntry(ref v) => v.as_ref(),
61775            Self::StoredTransactionSet(ref v) => v.as_ref(),
61776            Self::StoredDebugTransactionSet(ref v) => v.as_ref(),
61777            Self::PersistedScpStateV0(ref v) => v.as_ref(),
61778            Self::PersistedScpStateV1(ref v) => v.as_ref(),
61779            Self::PersistedScpState(ref v) => v.as_ref(),
61780            Self::Thresholds(ref v) => v.as_ref(),
61781            Self::String32(ref v) => v.as_ref(),
61782            Self::String64(ref v) => v.as_ref(),
61783            Self::SequenceNumber(ref v) => v.as_ref(),
61784            Self::DataValue(ref v) => v.as_ref(),
61785            Self::PoolId(ref v) => v.as_ref(),
61786            Self::AssetCode4(ref v) => v.as_ref(),
61787            Self::AssetCode12(ref v) => v.as_ref(),
61788            Self::AssetType(ref v) => v.as_ref(),
61789            Self::AssetCode(ref v) => v.as_ref(),
61790            Self::AlphaNum4(ref v) => v.as_ref(),
61791            Self::AlphaNum12(ref v) => v.as_ref(),
61792            Self::Asset(ref v) => v.as_ref(),
61793            Self::Price(ref v) => v.as_ref(),
61794            Self::Liabilities(ref v) => v.as_ref(),
61795            Self::ThresholdIndexes(ref v) => v.as_ref(),
61796            Self::LedgerEntryType(ref v) => v.as_ref(),
61797            Self::Signer(ref v) => v.as_ref(),
61798            Self::AccountFlags(ref v) => v.as_ref(),
61799            Self::SponsorshipDescriptor(ref v) => v.as_ref(),
61800            Self::AccountEntryExtensionV3(ref v) => v.as_ref(),
61801            Self::AccountEntryExtensionV2(ref v) => v.as_ref(),
61802            Self::AccountEntryExtensionV2Ext(ref v) => v.as_ref(),
61803            Self::AccountEntryExtensionV1(ref v) => v.as_ref(),
61804            Self::AccountEntryExtensionV1Ext(ref v) => v.as_ref(),
61805            Self::AccountEntry(ref v) => v.as_ref(),
61806            Self::AccountEntryExt(ref v) => v.as_ref(),
61807            Self::TrustLineFlags(ref v) => v.as_ref(),
61808            Self::LiquidityPoolType(ref v) => v.as_ref(),
61809            Self::TrustLineAsset(ref v) => v.as_ref(),
61810            Self::TrustLineEntryExtensionV2(ref v) => v.as_ref(),
61811            Self::TrustLineEntryExtensionV2Ext(ref v) => v.as_ref(),
61812            Self::TrustLineEntry(ref v) => v.as_ref(),
61813            Self::TrustLineEntryExt(ref v) => v.as_ref(),
61814            Self::TrustLineEntryV1(ref v) => v.as_ref(),
61815            Self::TrustLineEntryV1Ext(ref v) => v.as_ref(),
61816            Self::OfferEntryFlags(ref v) => v.as_ref(),
61817            Self::OfferEntry(ref v) => v.as_ref(),
61818            Self::OfferEntryExt(ref v) => v.as_ref(),
61819            Self::DataEntry(ref v) => v.as_ref(),
61820            Self::DataEntryExt(ref v) => v.as_ref(),
61821            Self::ClaimPredicateType(ref v) => v.as_ref(),
61822            Self::ClaimPredicate(ref v) => v.as_ref(),
61823            Self::ClaimantType(ref v) => v.as_ref(),
61824            Self::Claimant(ref v) => v.as_ref(),
61825            Self::ClaimantV0(ref v) => v.as_ref(),
61826            Self::ClaimableBalanceIdType(ref v) => v.as_ref(),
61827            Self::ClaimableBalanceId(ref v) => v.as_ref(),
61828            Self::ClaimableBalanceFlags(ref v) => v.as_ref(),
61829            Self::ClaimableBalanceEntryExtensionV1(ref v) => v.as_ref(),
61830            Self::ClaimableBalanceEntryExtensionV1Ext(ref v) => v.as_ref(),
61831            Self::ClaimableBalanceEntry(ref v) => v.as_ref(),
61832            Self::ClaimableBalanceEntryExt(ref v) => v.as_ref(),
61833            Self::LiquidityPoolConstantProductParameters(ref v) => v.as_ref(),
61834            Self::LiquidityPoolEntry(ref v) => v.as_ref(),
61835            Self::LiquidityPoolEntryBody(ref v) => v.as_ref(),
61836            Self::LiquidityPoolEntryConstantProduct(ref v) => v.as_ref(),
61837            Self::ContractDataDurability(ref v) => v.as_ref(),
61838            Self::ContractDataEntry(ref v) => v.as_ref(),
61839            Self::ContractCodeCostInputs(ref v) => v.as_ref(),
61840            Self::ContractCodeEntry(ref v) => v.as_ref(),
61841            Self::ContractCodeEntryExt(ref v) => v.as_ref(),
61842            Self::ContractCodeEntryV1(ref v) => v.as_ref(),
61843            Self::TtlEntry(ref v) => v.as_ref(),
61844            Self::LedgerEntryExtensionV1(ref v) => v.as_ref(),
61845            Self::LedgerEntryExtensionV1Ext(ref v) => v.as_ref(),
61846            Self::LedgerEntry(ref v) => v.as_ref(),
61847            Self::LedgerEntryData(ref v) => v.as_ref(),
61848            Self::LedgerEntryExt(ref v) => v.as_ref(),
61849            Self::LedgerKey(ref v) => v.as_ref(),
61850            Self::LedgerKeyAccount(ref v) => v.as_ref(),
61851            Self::LedgerKeyTrustLine(ref v) => v.as_ref(),
61852            Self::LedgerKeyOffer(ref v) => v.as_ref(),
61853            Self::LedgerKeyData(ref v) => v.as_ref(),
61854            Self::LedgerKeyClaimableBalance(ref v) => v.as_ref(),
61855            Self::LedgerKeyLiquidityPool(ref v) => v.as_ref(),
61856            Self::LedgerKeyContractData(ref v) => v.as_ref(),
61857            Self::LedgerKeyContractCode(ref v) => v.as_ref(),
61858            Self::LedgerKeyConfigSetting(ref v) => v.as_ref(),
61859            Self::LedgerKeyTtl(ref v) => v.as_ref(),
61860            Self::EnvelopeType(ref v) => v.as_ref(),
61861            Self::BucketListType(ref v) => v.as_ref(),
61862            Self::BucketEntryType(ref v) => v.as_ref(),
61863            Self::HotArchiveBucketEntryType(ref v) => v.as_ref(),
61864            Self::ColdArchiveBucketEntryType(ref v) => v.as_ref(),
61865            Self::BucketMetadata(ref v) => v.as_ref(),
61866            Self::BucketMetadataExt(ref v) => v.as_ref(),
61867            Self::BucketEntry(ref v) => v.as_ref(),
61868            Self::HotArchiveBucketEntry(ref v) => v.as_ref(),
61869            Self::ColdArchiveArchivedLeaf(ref v) => v.as_ref(),
61870            Self::ColdArchiveDeletedLeaf(ref v) => v.as_ref(),
61871            Self::ColdArchiveBoundaryLeaf(ref v) => v.as_ref(),
61872            Self::ColdArchiveHashEntry(ref v) => v.as_ref(),
61873            Self::ColdArchiveBucketEntry(ref v) => v.as_ref(),
61874            Self::UpgradeType(ref v) => v.as_ref(),
61875            Self::StellarValueType(ref v) => v.as_ref(),
61876            Self::LedgerCloseValueSignature(ref v) => v.as_ref(),
61877            Self::StellarValue(ref v) => v.as_ref(),
61878            Self::StellarValueExt(ref v) => v.as_ref(),
61879            Self::LedgerHeaderFlags(ref v) => v.as_ref(),
61880            Self::LedgerHeaderExtensionV1(ref v) => v.as_ref(),
61881            Self::LedgerHeaderExtensionV1Ext(ref v) => v.as_ref(),
61882            Self::LedgerHeader(ref v) => v.as_ref(),
61883            Self::LedgerHeaderExt(ref v) => v.as_ref(),
61884            Self::LedgerUpgradeType(ref v) => v.as_ref(),
61885            Self::ConfigUpgradeSetKey(ref v) => v.as_ref(),
61886            Self::LedgerUpgrade(ref v) => v.as_ref(),
61887            Self::ConfigUpgradeSet(ref v) => v.as_ref(),
61888            Self::TxSetComponentType(ref v) => v.as_ref(),
61889            Self::TxSetComponent(ref v) => v.as_ref(),
61890            Self::TxSetComponentTxsMaybeDiscountedFee(ref v) => v.as_ref(),
61891            Self::TransactionPhase(ref v) => v.as_ref(),
61892            Self::TransactionSet(ref v) => v.as_ref(),
61893            Self::TransactionSetV1(ref v) => v.as_ref(),
61894            Self::GeneralizedTransactionSet(ref v) => v.as_ref(),
61895            Self::TransactionResultPair(ref v) => v.as_ref(),
61896            Self::TransactionResultSet(ref v) => v.as_ref(),
61897            Self::TransactionHistoryEntry(ref v) => v.as_ref(),
61898            Self::TransactionHistoryEntryExt(ref v) => v.as_ref(),
61899            Self::TransactionHistoryResultEntry(ref v) => v.as_ref(),
61900            Self::TransactionHistoryResultEntryExt(ref v) => v.as_ref(),
61901            Self::LedgerHeaderHistoryEntry(ref v) => v.as_ref(),
61902            Self::LedgerHeaderHistoryEntryExt(ref v) => v.as_ref(),
61903            Self::LedgerScpMessages(ref v) => v.as_ref(),
61904            Self::ScpHistoryEntryV0(ref v) => v.as_ref(),
61905            Self::ScpHistoryEntry(ref v) => v.as_ref(),
61906            Self::LedgerEntryChangeType(ref v) => v.as_ref(),
61907            Self::LedgerEntryChange(ref v) => v.as_ref(),
61908            Self::LedgerEntryChanges(ref v) => v.as_ref(),
61909            Self::OperationMeta(ref v) => v.as_ref(),
61910            Self::TransactionMetaV1(ref v) => v.as_ref(),
61911            Self::TransactionMetaV2(ref v) => v.as_ref(),
61912            Self::ContractEventType(ref v) => v.as_ref(),
61913            Self::ContractEvent(ref v) => v.as_ref(),
61914            Self::ContractEventBody(ref v) => v.as_ref(),
61915            Self::ContractEventV0(ref v) => v.as_ref(),
61916            Self::DiagnosticEvent(ref v) => v.as_ref(),
61917            Self::DiagnosticEvents(ref v) => v.as_ref(),
61918            Self::SorobanTransactionMetaExtV1(ref v) => v.as_ref(),
61919            Self::SorobanTransactionMetaExt(ref v) => v.as_ref(),
61920            Self::SorobanTransactionMeta(ref v) => v.as_ref(),
61921            Self::TransactionMetaV3(ref v) => v.as_ref(),
61922            Self::InvokeHostFunctionSuccessPreImage(ref v) => v.as_ref(),
61923            Self::TransactionMeta(ref v) => v.as_ref(),
61924            Self::TransactionResultMeta(ref v) => v.as_ref(),
61925            Self::UpgradeEntryMeta(ref v) => v.as_ref(),
61926            Self::LedgerCloseMetaV0(ref v) => v.as_ref(),
61927            Self::LedgerCloseMetaExtV1(ref v) => v.as_ref(),
61928            Self::LedgerCloseMetaExt(ref v) => v.as_ref(),
61929            Self::LedgerCloseMetaV1(ref v) => v.as_ref(),
61930            Self::LedgerCloseMeta(ref v) => v.as_ref(),
61931            Self::ErrorCode(ref v) => v.as_ref(),
61932            Self::SError(ref v) => v.as_ref(),
61933            Self::SendMore(ref v) => v.as_ref(),
61934            Self::SendMoreExtended(ref v) => v.as_ref(),
61935            Self::AuthCert(ref v) => v.as_ref(),
61936            Self::Hello(ref v) => v.as_ref(),
61937            Self::Auth(ref v) => v.as_ref(),
61938            Self::IpAddrType(ref v) => v.as_ref(),
61939            Self::PeerAddress(ref v) => v.as_ref(),
61940            Self::PeerAddressIp(ref v) => v.as_ref(),
61941            Self::MessageType(ref v) => v.as_ref(),
61942            Self::DontHave(ref v) => v.as_ref(),
61943            Self::SurveyMessageCommandType(ref v) => v.as_ref(),
61944            Self::SurveyMessageResponseType(ref v) => v.as_ref(),
61945            Self::TimeSlicedSurveyStartCollectingMessage(ref v) => v.as_ref(),
61946            Self::SignedTimeSlicedSurveyStartCollectingMessage(ref v) => v.as_ref(),
61947            Self::TimeSlicedSurveyStopCollectingMessage(ref v) => v.as_ref(),
61948            Self::SignedTimeSlicedSurveyStopCollectingMessage(ref v) => v.as_ref(),
61949            Self::SurveyRequestMessage(ref v) => v.as_ref(),
61950            Self::TimeSlicedSurveyRequestMessage(ref v) => v.as_ref(),
61951            Self::SignedSurveyRequestMessage(ref v) => v.as_ref(),
61952            Self::SignedTimeSlicedSurveyRequestMessage(ref v) => v.as_ref(),
61953            Self::EncryptedBody(ref v) => v.as_ref(),
61954            Self::SurveyResponseMessage(ref v) => v.as_ref(),
61955            Self::TimeSlicedSurveyResponseMessage(ref v) => v.as_ref(),
61956            Self::SignedSurveyResponseMessage(ref v) => v.as_ref(),
61957            Self::SignedTimeSlicedSurveyResponseMessage(ref v) => v.as_ref(),
61958            Self::PeerStats(ref v) => v.as_ref(),
61959            Self::PeerStatList(ref v) => v.as_ref(),
61960            Self::TimeSlicedNodeData(ref v) => v.as_ref(),
61961            Self::TimeSlicedPeerData(ref v) => v.as_ref(),
61962            Self::TimeSlicedPeerDataList(ref v) => v.as_ref(),
61963            Self::TopologyResponseBodyV0(ref v) => v.as_ref(),
61964            Self::TopologyResponseBodyV1(ref v) => v.as_ref(),
61965            Self::TopologyResponseBodyV2(ref v) => v.as_ref(),
61966            Self::SurveyResponseBody(ref v) => v.as_ref(),
61967            Self::TxAdvertVector(ref v) => v.as_ref(),
61968            Self::FloodAdvert(ref v) => v.as_ref(),
61969            Self::TxDemandVector(ref v) => v.as_ref(),
61970            Self::FloodDemand(ref v) => v.as_ref(),
61971            Self::StellarMessage(ref v) => v.as_ref(),
61972            Self::AuthenticatedMessage(ref v) => v.as_ref(),
61973            Self::AuthenticatedMessageV0(ref v) => v.as_ref(),
61974            Self::LiquidityPoolParameters(ref v) => v.as_ref(),
61975            Self::MuxedAccount(ref v) => v.as_ref(),
61976            Self::MuxedAccountMed25519(ref v) => v.as_ref(),
61977            Self::DecoratedSignature(ref v) => v.as_ref(),
61978            Self::OperationType(ref v) => v.as_ref(),
61979            Self::CreateAccountOp(ref v) => v.as_ref(),
61980            Self::PaymentOp(ref v) => v.as_ref(),
61981            Self::PathPaymentStrictReceiveOp(ref v) => v.as_ref(),
61982            Self::PathPaymentStrictSendOp(ref v) => v.as_ref(),
61983            Self::ManageSellOfferOp(ref v) => v.as_ref(),
61984            Self::ManageBuyOfferOp(ref v) => v.as_ref(),
61985            Self::CreatePassiveSellOfferOp(ref v) => v.as_ref(),
61986            Self::SetOptionsOp(ref v) => v.as_ref(),
61987            Self::ChangeTrustAsset(ref v) => v.as_ref(),
61988            Self::ChangeTrustOp(ref v) => v.as_ref(),
61989            Self::AllowTrustOp(ref v) => v.as_ref(),
61990            Self::ManageDataOp(ref v) => v.as_ref(),
61991            Self::BumpSequenceOp(ref v) => v.as_ref(),
61992            Self::CreateClaimableBalanceOp(ref v) => v.as_ref(),
61993            Self::ClaimClaimableBalanceOp(ref v) => v.as_ref(),
61994            Self::BeginSponsoringFutureReservesOp(ref v) => v.as_ref(),
61995            Self::RevokeSponsorshipType(ref v) => v.as_ref(),
61996            Self::RevokeSponsorshipOp(ref v) => v.as_ref(),
61997            Self::RevokeSponsorshipOpSigner(ref v) => v.as_ref(),
61998            Self::ClawbackOp(ref v) => v.as_ref(),
61999            Self::ClawbackClaimableBalanceOp(ref v) => v.as_ref(),
62000            Self::SetTrustLineFlagsOp(ref v) => v.as_ref(),
62001            Self::LiquidityPoolDepositOp(ref v) => v.as_ref(),
62002            Self::LiquidityPoolWithdrawOp(ref v) => v.as_ref(),
62003            Self::HostFunctionType(ref v) => v.as_ref(),
62004            Self::ContractIdPreimageType(ref v) => v.as_ref(),
62005            Self::ContractIdPreimage(ref v) => v.as_ref(),
62006            Self::ContractIdPreimageFromAddress(ref v) => v.as_ref(),
62007            Self::CreateContractArgs(ref v) => v.as_ref(),
62008            Self::CreateContractArgsV2(ref v) => v.as_ref(),
62009            Self::InvokeContractArgs(ref v) => v.as_ref(),
62010            Self::HostFunction(ref v) => v.as_ref(),
62011            Self::SorobanAuthorizedFunctionType(ref v) => v.as_ref(),
62012            Self::SorobanAuthorizedFunction(ref v) => v.as_ref(),
62013            Self::SorobanAuthorizedInvocation(ref v) => v.as_ref(),
62014            Self::SorobanAddressCredentials(ref v) => v.as_ref(),
62015            Self::SorobanCredentialsType(ref v) => v.as_ref(),
62016            Self::SorobanCredentials(ref v) => v.as_ref(),
62017            Self::SorobanAuthorizationEntry(ref v) => v.as_ref(),
62018            Self::InvokeHostFunctionOp(ref v) => v.as_ref(),
62019            Self::ExtendFootprintTtlOp(ref v) => v.as_ref(),
62020            Self::RestoreFootprintOp(ref v) => v.as_ref(),
62021            Self::Operation(ref v) => v.as_ref(),
62022            Self::OperationBody(ref v) => v.as_ref(),
62023            Self::HashIdPreimage(ref v) => v.as_ref(),
62024            Self::HashIdPreimageOperationId(ref v) => v.as_ref(),
62025            Self::HashIdPreimageRevokeId(ref v) => v.as_ref(),
62026            Self::HashIdPreimageContractId(ref v) => v.as_ref(),
62027            Self::HashIdPreimageSorobanAuthorization(ref v) => v.as_ref(),
62028            Self::MemoType(ref v) => v.as_ref(),
62029            Self::Memo(ref v) => v.as_ref(),
62030            Self::TimeBounds(ref v) => v.as_ref(),
62031            Self::LedgerBounds(ref v) => v.as_ref(),
62032            Self::PreconditionsV2(ref v) => v.as_ref(),
62033            Self::PreconditionType(ref v) => v.as_ref(),
62034            Self::Preconditions(ref v) => v.as_ref(),
62035            Self::LedgerFootprint(ref v) => v.as_ref(),
62036            Self::ArchivalProofType(ref v) => v.as_ref(),
62037            Self::ArchivalProofNode(ref v) => v.as_ref(),
62038            Self::ProofLevel(ref v) => v.as_ref(),
62039            Self::NonexistenceProofBody(ref v) => v.as_ref(),
62040            Self::ExistenceProofBody(ref v) => v.as_ref(),
62041            Self::ArchivalProof(ref v) => v.as_ref(),
62042            Self::ArchivalProofBody(ref v) => v.as_ref(),
62043            Self::SorobanResources(ref v) => v.as_ref(),
62044            Self::SorobanTransactionData(ref v) => v.as_ref(),
62045            Self::TransactionV0(ref v) => v.as_ref(),
62046            Self::TransactionV0Ext(ref v) => v.as_ref(),
62047            Self::TransactionV0Envelope(ref v) => v.as_ref(),
62048            Self::Transaction(ref v) => v.as_ref(),
62049            Self::TransactionExt(ref v) => v.as_ref(),
62050            Self::TransactionV1Envelope(ref v) => v.as_ref(),
62051            Self::FeeBumpTransaction(ref v) => v.as_ref(),
62052            Self::FeeBumpTransactionInnerTx(ref v) => v.as_ref(),
62053            Self::FeeBumpTransactionExt(ref v) => v.as_ref(),
62054            Self::FeeBumpTransactionEnvelope(ref v) => v.as_ref(),
62055            Self::TransactionEnvelope(ref v) => v.as_ref(),
62056            Self::TransactionSignaturePayload(ref v) => v.as_ref(),
62057            Self::TransactionSignaturePayloadTaggedTransaction(ref v) => v.as_ref(),
62058            Self::ClaimAtomType(ref v) => v.as_ref(),
62059            Self::ClaimOfferAtomV0(ref v) => v.as_ref(),
62060            Self::ClaimOfferAtom(ref v) => v.as_ref(),
62061            Self::ClaimLiquidityAtom(ref v) => v.as_ref(),
62062            Self::ClaimAtom(ref v) => v.as_ref(),
62063            Self::CreateAccountResultCode(ref v) => v.as_ref(),
62064            Self::CreateAccountResult(ref v) => v.as_ref(),
62065            Self::PaymentResultCode(ref v) => v.as_ref(),
62066            Self::PaymentResult(ref v) => v.as_ref(),
62067            Self::PathPaymentStrictReceiveResultCode(ref v) => v.as_ref(),
62068            Self::SimplePaymentResult(ref v) => v.as_ref(),
62069            Self::PathPaymentStrictReceiveResult(ref v) => v.as_ref(),
62070            Self::PathPaymentStrictReceiveResultSuccess(ref v) => v.as_ref(),
62071            Self::PathPaymentStrictSendResultCode(ref v) => v.as_ref(),
62072            Self::PathPaymentStrictSendResult(ref v) => v.as_ref(),
62073            Self::PathPaymentStrictSendResultSuccess(ref v) => v.as_ref(),
62074            Self::ManageSellOfferResultCode(ref v) => v.as_ref(),
62075            Self::ManageOfferEffect(ref v) => v.as_ref(),
62076            Self::ManageOfferSuccessResult(ref v) => v.as_ref(),
62077            Self::ManageOfferSuccessResultOffer(ref v) => v.as_ref(),
62078            Self::ManageSellOfferResult(ref v) => v.as_ref(),
62079            Self::ManageBuyOfferResultCode(ref v) => v.as_ref(),
62080            Self::ManageBuyOfferResult(ref v) => v.as_ref(),
62081            Self::SetOptionsResultCode(ref v) => v.as_ref(),
62082            Self::SetOptionsResult(ref v) => v.as_ref(),
62083            Self::ChangeTrustResultCode(ref v) => v.as_ref(),
62084            Self::ChangeTrustResult(ref v) => v.as_ref(),
62085            Self::AllowTrustResultCode(ref v) => v.as_ref(),
62086            Self::AllowTrustResult(ref v) => v.as_ref(),
62087            Self::AccountMergeResultCode(ref v) => v.as_ref(),
62088            Self::AccountMergeResult(ref v) => v.as_ref(),
62089            Self::InflationResultCode(ref v) => v.as_ref(),
62090            Self::InflationPayout(ref v) => v.as_ref(),
62091            Self::InflationResult(ref v) => v.as_ref(),
62092            Self::ManageDataResultCode(ref v) => v.as_ref(),
62093            Self::ManageDataResult(ref v) => v.as_ref(),
62094            Self::BumpSequenceResultCode(ref v) => v.as_ref(),
62095            Self::BumpSequenceResult(ref v) => v.as_ref(),
62096            Self::CreateClaimableBalanceResultCode(ref v) => v.as_ref(),
62097            Self::CreateClaimableBalanceResult(ref v) => v.as_ref(),
62098            Self::ClaimClaimableBalanceResultCode(ref v) => v.as_ref(),
62099            Self::ClaimClaimableBalanceResult(ref v) => v.as_ref(),
62100            Self::BeginSponsoringFutureReservesResultCode(ref v) => v.as_ref(),
62101            Self::BeginSponsoringFutureReservesResult(ref v) => v.as_ref(),
62102            Self::EndSponsoringFutureReservesResultCode(ref v) => v.as_ref(),
62103            Self::EndSponsoringFutureReservesResult(ref v) => v.as_ref(),
62104            Self::RevokeSponsorshipResultCode(ref v) => v.as_ref(),
62105            Self::RevokeSponsorshipResult(ref v) => v.as_ref(),
62106            Self::ClawbackResultCode(ref v) => v.as_ref(),
62107            Self::ClawbackResult(ref v) => v.as_ref(),
62108            Self::ClawbackClaimableBalanceResultCode(ref v) => v.as_ref(),
62109            Self::ClawbackClaimableBalanceResult(ref v) => v.as_ref(),
62110            Self::SetTrustLineFlagsResultCode(ref v) => v.as_ref(),
62111            Self::SetTrustLineFlagsResult(ref v) => v.as_ref(),
62112            Self::LiquidityPoolDepositResultCode(ref v) => v.as_ref(),
62113            Self::LiquidityPoolDepositResult(ref v) => v.as_ref(),
62114            Self::LiquidityPoolWithdrawResultCode(ref v) => v.as_ref(),
62115            Self::LiquidityPoolWithdrawResult(ref v) => v.as_ref(),
62116            Self::InvokeHostFunctionResultCode(ref v) => v.as_ref(),
62117            Self::InvokeHostFunctionResult(ref v) => v.as_ref(),
62118            Self::ExtendFootprintTtlResultCode(ref v) => v.as_ref(),
62119            Self::ExtendFootprintTtlResult(ref v) => v.as_ref(),
62120            Self::RestoreFootprintResultCode(ref v) => v.as_ref(),
62121            Self::RestoreFootprintResult(ref v) => v.as_ref(),
62122            Self::OperationResultCode(ref v) => v.as_ref(),
62123            Self::OperationResult(ref v) => v.as_ref(),
62124            Self::OperationResultTr(ref v) => v.as_ref(),
62125            Self::TransactionResultCode(ref v) => v.as_ref(),
62126            Self::InnerTransactionResult(ref v) => v.as_ref(),
62127            Self::InnerTransactionResultResult(ref v) => v.as_ref(),
62128            Self::InnerTransactionResultExt(ref v) => v.as_ref(),
62129            Self::InnerTransactionResultPair(ref v) => v.as_ref(),
62130            Self::TransactionResult(ref v) => v.as_ref(),
62131            Self::TransactionResultResult(ref v) => v.as_ref(),
62132            Self::TransactionResultExt(ref v) => v.as_ref(),
62133            Self::Hash(ref v) => v.as_ref(),
62134            Self::Uint256(ref v) => v.as_ref(),
62135            Self::Uint32(ref v) => v.as_ref(),
62136            Self::Int32(ref v) => v.as_ref(),
62137            Self::Uint64(ref v) => v.as_ref(),
62138            Self::Int64(ref v) => v.as_ref(),
62139            Self::TimePoint(ref v) => v.as_ref(),
62140            Self::Duration(ref v) => v.as_ref(),
62141            Self::ExtensionPoint(ref v) => v.as_ref(),
62142            Self::CryptoKeyType(ref v) => v.as_ref(),
62143            Self::PublicKeyType(ref v) => v.as_ref(),
62144            Self::SignerKeyType(ref v) => v.as_ref(),
62145            Self::PublicKey(ref v) => v.as_ref(),
62146            Self::SignerKey(ref v) => v.as_ref(),
62147            Self::SignerKeyEd25519SignedPayload(ref v) => v.as_ref(),
62148            Self::Signature(ref v) => v.as_ref(),
62149            Self::SignatureHint(ref v) => v.as_ref(),
62150            Self::NodeId(ref v) => v.as_ref(),
62151            Self::AccountId(ref v) => v.as_ref(),
62152            Self::Curve25519Secret(ref v) => v.as_ref(),
62153            Self::Curve25519Public(ref v) => v.as_ref(),
62154            Self::HmacSha256Key(ref v) => v.as_ref(),
62155            Self::HmacSha256Mac(ref v) => v.as_ref(),
62156            Self::ShortHashSeed(ref v) => v.as_ref(),
62157            Self::BinaryFuseFilterType(ref v) => v.as_ref(),
62158            Self::SerializedBinaryFuseFilter(ref v) => v.as_ref(),
62159        }
62160    }
62161
62162    #[must_use]
62163    #[allow(clippy::too_many_lines)]
62164    pub const fn name(&self) -> &'static str {
62165        match self {
62166            Self::Value(_) => "Value",
62167            Self::ScpBallot(_) => "ScpBallot",
62168            Self::ScpStatementType(_) => "ScpStatementType",
62169            Self::ScpNomination(_) => "ScpNomination",
62170            Self::ScpStatement(_) => "ScpStatement",
62171            Self::ScpStatementPledges(_) => "ScpStatementPledges",
62172            Self::ScpStatementPrepare(_) => "ScpStatementPrepare",
62173            Self::ScpStatementConfirm(_) => "ScpStatementConfirm",
62174            Self::ScpStatementExternalize(_) => "ScpStatementExternalize",
62175            Self::ScpEnvelope(_) => "ScpEnvelope",
62176            Self::ScpQuorumSet(_) => "ScpQuorumSet",
62177            Self::ConfigSettingContractExecutionLanesV0(_) => {
62178                "ConfigSettingContractExecutionLanesV0"
62179            }
62180            Self::ConfigSettingContractComputeV0(_) => "ConfigSettingContractComputeV0",
62181            Self::ConfigSettingContractLedgerCostV0(_) => "ConfigSettingContractLedgerCostV0",
62182            Self::ConfigSettingContractHistoricalDataV0(_) => {
62183                "ConfigSettingContractHistoricalDataV0"
62184            }
62185            Self::ConfigSettingContractEventsV0(_) => "ConfigSettingContractEventsV0",
62186            Self::ConfigSettingContractBandwidthV0(_) => "ConfigSettingContractBandwidthV0",
62187            Self::ContractCostType(_) => "ContractCostType",
62188            Self::ContractCostParamEntry(_) => "ContractCostParamEntry",
62189            Self::StateArchivalSettings(_) => "StateArchivalSettings",
62190            Self::EvictionIterator(_) => "EvictionIterator",
62191            Self::ContractCostParams(_) => "ContractCostParams",
62192            Self::ConfigSettingId(_) => "ConfigSettingId",
62193            Self::ConfigSettingEntry(_) => "ConfigSettingEntry",
62194            Self::ScEnvMetaKind(_) => "ScEnvMetaKind",
62195            Self::ScEnvMetaEntry(_) => "ScEnvMetaEntry",
62196            Self::ScEnvMetaEntryInterfaceVersion(_) => "ScEnvMetaEntryInterfaceVersion",
62197            Self::ScMetaV0(_) => "ScMetaV0",
62198            Self::ScMetaKind(_) => "ScMetaKind",
62199            Self::ScMetaEntry(_) => "ScMetaEntry",
62200            Self::ScSpecType(_) => "ScSpecType",
62201            Self::ScSpecTypeOption(_) => "ScSpecTypeOption",
62202            Self::ScSpecTypeResult(_) => "ScSpecTypeResult",
62203            Self::ScSpecTypeVec(_) => "ScSpecTypeVec",
62204            Self::ScSpecTypeMap(_) => "ScSpecTypeMap",
62205            Self::ScSpecTypeTuple(_) => "ScSpecTypeTuple",
62206            Self::ScSpecTypeBytesN(_) => "ScSpecTypeBytesN",
62207            Self::ScSpecTypeUdt(_) => "ScSpecTypeUdt",
62208            Self::ScSpecTypeDef(_) => "ScSpecTypeDef",
62209            Self::ScSpecUdtStructFieldV0(_) => "ScSpecUdtStructFieldV0",
62210            Self::ScSpecUdtStructV0(_) => "ScSpecUdtStructV0",
62211            Self::ScSpecUdtUnionCaseVoidV0(_) => "ScSpecUdtUnionCaseVoidV0",
62212            Self::ScSpecUdtUnionCaseTupleV0(_) => "ScSpecUdtUnionCaseTupleV0",
62213            Self::ScSpecUdtUnionCaseV0Kind(_) => "ScSpecUdtUnionCaseV0Kind",
62214            Self::ScSpecUdtUnionCaseV0(_) => "ScSpecUdtUnionCaseV0",
62215            Self::ScSpecUdtUnionV0(_) => "ScSpecUdtUnionV0",
62216            Self::ScSpecUdtEnumCaseV0(_) => "ScSpecUdtEnumCaseV0",
62217            Self::ScSpecUdtEnumV0(_) => "ScSpecUdtEnumV0",
62218            Self::ScSpecUdtErrorEnumCaseV0(_) => "ScSpecUdtErrorEnumCaseV0",
62219            Self::ScSpecUdtErrorEnumV0(_) => "ScSpecUdtErrorEnumV0",
62220            Self::ScSpecFunctionInputV0(_) => "ScSpecFunctionInputV0",
62221            Self::ScSpecFunctionV0(_) => "ScSpecFunctionV0",
62222            Self::ScSpecEntryKind(_) => "ScSpecEntryKind",
62223            Self::ScSpecEntry(_) => "ScSpecEntry",
62224            Self::ScValType(_) => "ScValType",
62225            Self::ScErrorType(_) => "ScErrorType",
62226            Self::ScErrorCode(_) => "ScErrorCode",
62227            Self::ScError(_) => "ScError",
62228            Self::UInt128Parts(_) => "UInt128Parts",
62229            Self::Int128Parts(_) => "Int128Parts",
62230            Self::UInt256Parts(_) => "UInt256Parts",
62231            Self::Int256Parts(_) => "Int256Parts",
62232            Self::ContractExecutableType(_) => "ContractExecutableType",
62233            Self::ContractExecutable(_) => "ContractExecutable",
62234            Self::ScAddressType(_) => "ScAddressType",
62235            Self::ScAddress(_) => "ScAddress",
62236            Self::ScVec(_) => "ScVec",
62237            Self::ScMap(_) => "ScMap",
62238            Self::ScBytes(_) => "ScBytes",
62239            Self::ScString(_) => "ScString",
62240            Self::ScSymbol(_) => "ScSymbol",
62241            Self::ScNonceKey(_) => "ScNonceKey",
62242            Self::ScContractInstance(_) => "ScContractInstance",
62243            Self::ScVal(_) => "ScVal",
62244            Self::ScMapEntry(_) => "ScMapEntry",
62245            Self::StoredTransactionSet(_) => "StoredTransactionSet",
62246            Self::StoredDebugTransactionSet(_) => "StoredDebugTransactionSet",
62247            Self::PersistedScpStateV0(_) => "PersistedScpStateV0",
62248            Self::PersistedScpStateV1(_) => "PersistedScpStateV1",
62249            Self::PersistedScpState(_) => "PersistedScpState",
62250            Self::Thresholds(_) => "Thresholds",
62251            Self::String32(_) => "String32",
62252            Self::String64(_) => "String64",
62253            Self::SequenceNumber(_) => "SequenceNumber",
62254            Self::DataValue(_) => "DataValue",
62255            Self::PoolId(_) => "PoolId",
62256            Self::AssetCode4(_) => "AssetCode4",
62257            Self::AssetCode12(_) => "AssetCode12",
62258            Self::AssetType(_) => "AssetType",
62259            Self::AssetCode(_) => "AssetCode",
62260            Self::AlphaNum4(_) => "AlphaNum4",
62261            Self::AlphaNum12(_) => "AlphaNum12",
62262            Self::Asset(_) => "Asset",
62263            Self::Price(_) => "Price",
62264            Self::Liabilities(_) => "Liabilities",
62265            Self::ThresholdIndexes(_) => "ThresholdIndexes",
62266            Self::LedgerEntryType(_) => "LedgerEntryType",
62267            Self::Signer(_) => "Signer",
62268            Self::AccountFlags(_) => "AccountFlags",
62269            Self::SponsorshipDescriptor(_) => "SponsorshipDescriptor",
62270            Self::AccountEntryExtensionV3(_) => "AccountEntryExtensionV3",
62271            Self::AccountEntryExtensionV2(_) => "AccountEntryExtensionV2",
62272            Self::AccountEntryExtensionV2Ext(_) => "AccountEntryExtensionV2Ext",
62273            Self::AccountEntryExtensionV1(_) => "AccountEntryExtensionV1",
62274            Self::AccountEntryExtensionV1Ext(_) => "AccountEntryExtensionV1Ext",
62275            Self::AccountEntry(_) => "AccountEntry",
62276            Self::AccountEntryExt(_) => "AccountEntryExt",
62277            Self::TrustLineFlags(_) => "TrustLineFlags",
62278            Self::LiquidityPoolType(_) => "LiquidityPoolType",
62279            Self::TrustLineAsset(_) => "TrustLineAsset",
62280            Self::TrustLineEntryExtensionV2(_) => "TrustLineEntryExtensionV2",
62281            Self::TrustLineEntryExtensionV2Ext(_) => "TrustLineEntryExtensionV2Ext",
62282            Self::TrustLineEntry(_) => "TrustLineEntry",
62283            Self::TrustLineEntryExt(_) => "TrustLineEntryExt",
62284            Self::TrustLineEntryV1(_) => "TrustLineEntryV1",
62285            Self::TrustLineEntryV1Ext(_) => "TrustLineEntryV1Ext",
62286            Self::OfferEntryFlags(_) => "OfferEntryFlags",
62287            Self::OfferEntry(_) => "OfferEntry",
62288            Self::OfferEntryExt(_) => "OfferEntryExt",
62289            Self::DataEntry(_) => "DataEntry",
62290            Self::DataEntryExt(_) => "DataEntryExt",
62291            Self::ClaimPredicateType(_) => "ClaimPredicateType",
62292            Self::ClaimPredicate(_) => "ClaimPredicate",
62293            Self::ClaimantType(_) => "ClaimantType",
62294            Self::Claimant(_) => "Claimant",
62295            Self::ClaimantV0(_) => "ClaimantV0",
62296            Self::ClaimableBalanceIdType(_) => "ClaimableBalanceIdType",
62297            Self::ClaimableBalanceId(_) => "ClaimableBalanceId",
62298            Self::ClaimableBalanceFlags(_) => "ClaimableBalanceFlags",
62299            Self::ClaimableBalanceEntryExtensionV1(_) => "ClaimableBalanceEntryExtensionV1",
62300            Self::ClaimableBalanceEntryExtensionV1Ext(_) => "ClaimableBalanceEntryExtensionV1Ext",
62301            Self::ClaimableBalanceEntry(_) => "ClaimableBalanceEntry",
62302            Self::ClaimableBalanceEntryExt(_) => "ClaimableBalanceEntryExt",
62303            Self::LiquidityPoolConstantProductParameters(_) => {
62304                "LiquidityPoolConstantProductParameters"
62305            }
62306            Self::LiquidityPoolEntry(_) => "LiquidityPoolEntry",
62307            Self::LiquidityPoolEntryBody(_) => "LiquidityPoolEntryBody",
62308            Self::LiquidityPoolEntryConstantProduct(_) => "LiquidityPoolEntryConstantProduct",
62309            Self::ContractDataDurability(_) => "ContractDataDurability",
62310            Self::ContractDataEntry(_) => "ContractDataEntry",
62311            Self::ContractCodeCostInputs(_) => "ContractCodeCostInputs",
62312            Self::ContractCodeEntry(_) => "ContractCodeEntry",
62313            Self::ContractCodeEntryExt(_) => "ContractCodeEntryExt",
62314            Self::ContractCodeEntryV1(_) => "ContractCodeEntryV1",
62315            Self::TtlEntry(_) => "TtlEntry",
62316            Self::LedgerEntryExtensionV1(_) => "LedgerEntryExtensionV1",
62317            Self::LedgerEntryExtensionV1Ext(_) => "LedgerEntryExtensionV1Ext",
62318            Self::LedgerEntry(_) => "LedgerEntry",
62319            Self::LedgerEntryData(_) => "LedgerEntryData",
62320            Self::LedgerEntryExt(_) => "LedgerEntryExt",
62321            Self::LedgerKey(_) => "LedgerKey",
62322            Self::LedgerKeyAccount(_) => "LedgerKeyAccount",
62323            Self::LedgerKeyTrustLine(_) => "LedgerKeyTrustLine",
62324            Self::LedgerKeyOffer(_) => "LedgerKeyOffer",
62325            Self::LedgerKeyData(_) => "LedgerKeyData",
62326            Self::LedgerKeyClaimableBalance(_) => "LedgerKeyClaimableBalance",
62327            Self::LedgerKeyLiquidityPool(_) => "LedgerKeyLiquidityPool",
62328            Self::LedgerKeyContractData(_) => "LedgerKeyContractData",
62329            Self::LedgerKeyContractCode(_) => "LedgerKeyContractCode",
62330            Self::LedgerKeyConfigSetting(_) => "LedgerKeyConfigSetting",
62331            Self::LedgerKeyTtl(_) => "LedgerKeyTtl",
62332            Self::EnvelopeType(_) => "EnvelopeType",
62333            Self::BucketListType(_) => "BucketListType",
62334            Self::BucketEntryType(_) => "BucketEntryType",
62335            Self::HotArchiveBucketEntryType(_) => "HotArchiveBucketEntryType",
62336            Self::ColdArchiveBucketEntryType(_) => "ColdArchiveBucketEntryType",
62337            Self::BucketMetadata(_) => "BucketMetadata",
62338            Self::BucketMetadataExt(_) => "BucketMetadataExt",
62339            Self::BucketEntry(_) => "BucketEntry",
62340            Self::HotArchiveBucketEntry(_) => "HotArchiveBucketEntry",
62341            Self::ColdArchiveArchivedLeaf(_) => "ColdArchiveArchivedLeaf",
62342            Self::ColdArchiveDeletedLeaf(_) => "ColdArchiveDeletedLeaf",
62343            Self::ColdArchiveBoundaryLeaf(_) => "ColdArchiveBoundaryLeaf",
62344            Self::ColdArchiveHashEntry(_) => "ColdArchiveHashEntry",
62345            Self::ColdArchiveBucketEntry(_) => "ColdArchiveBucketEntry",
62346            Self::UpgradeType(_) => "UpgradeType",
62347            Self::StellarValueType(_) => "StellarValueType",
62348            Self::LedgerCloseValueSignature(_) => "LedgerCloseValueSignature",
62349            Self::StellarValue(_) => "StellarValue",
62350            Self::StellarValueExt(_) => "StellarValueExt",
62351            Self::LedgerHeaderFlags(_) => "LedgerHeaderFlags",
62352            Self::LedgerHeaderExtensionV1(_) => "LedgerHeaderExtensionV1",
62353            Self::LedgerHeaderExtensionV1Ext(_) => "LedgerHeaderExtensionV1Ext",
62354            Self::LedgerHeader(_) => "LedgerHeader",
62355            Self::LedgerHeaderExt(_) => "LedgerHeaderExt",
62356            Self::LedgerUpgradeType(_) => "LedgerUpgradeType",
62357            Self::ConfigUpgradeSetKey(_) => "ConfigUpgradeSetKey",
62358            Self::LedgerUpgrade(_) => "LedgerUpgrade",
62359            Self::ConfigUpgradeSet(_) => "ConfigUpgradeSet",
62360            Self::TxSetComponentType(_) => "TxSetComponentType",
62361            Self::TxSetComponent(_) => "TxSetComponent",
62362            Self::TxSetComponentTxsMaybeDiscountedFee(_) => "TxSetComponentTxsMaybeDiscountedFee",
62363            Self::TransactionPhase(_) => "TransactionPhase",
62364            Self::TransactionSet(_) => "TransactionSet",
62365            Self::TransactionSetV1(_) => "TransactionSetV1",
62366            Self::GeneralizedTransactionSet(_) => "GeneralizedTransactionSet",
62367            Self::TransactionResultPair(_) => "TransactionResultPair",
62368            Self::TransactionResultSet(_) => "TransactionResultSet",
62369            Self::TransactionHistoryEntry(_) => "TransactionHistoryEntry",
62370            Self::TransactionHistoryEntryExt(_) => "TransactionHistoryEntryExt",
62371            Self::TransactionHistoryResultEntry(_) => "TransactionHistoryResultEntry",
62372            Self::TransactionHistoryResultEntryExt(_) => "TransactionHistoryResultEntryExt",
62373            Self::LedgerHeaderHistoryEntry(_) => "LedgerHeaderHistoryEntry",
62374            Self::LedgerHeaderHistoryEntryExt(_) => "LedgerHeaderHistoryEntryExt",
62375            Self::LedgerScpMessages(_) => "LedgerScpMessages",
62376            Self::ScpHistoryEntryV0(_) => "ScpHistoryEntryV0",
62377            Self::ScpHistoryEntry(_) => "ScpHistoryEntry",
62378            Self::LedgerEntryChangeType(_) => "LedgerEntryChangeType",
62379            Self::LedgerEntryChange(_) => "LedgerEntryChange",
62380            Self::LedgerEntryChanges(_) => "LedgerEntryChanges",
62381            Self::OperationMeta(_) => "OperationMeta",
62382            Self::TransactionMetaV1(_) => "TransactionMetaV1",
62383            Self::TransactionMetaV2(_) => "TransactionMetaV2",
62384            Self::ContractEventType(_) => "ContractEventType",
62385            Self::ContractEvent(_) => "ContractEvent",
62386            Self::ContractEventBody(_) => "ContractEventBody",
62387            Self::ContractEventV0(_) => "ContractEventV0",
62388            Self::DiagnosticEvent(_) => "DiagnosticEvent",
62389            Self::DiagnosticEvents(_) => "DiagnosticEvents",
62390            Self::SorobanTransactionMetaExtV1(_) => "SorobanTransactionMetaExtV1",
62391            Self::SorobanTransactionMetaExt(_) => "SorobanTransactionMetaExt",
62392            Self::SorobanTransactionMeta(_) => "SorobanTransactionMeta",
62393            Self::TransactionMetaV3(_) => "TransactionMetaV3",
62394            Self::InvokeHostFunctionSuccessPreImage(_) => "InvokeHostFunctionSuccessPreImage",
62395            Self::TransactionMeta(_) => "TransactionMeta",
62396            Self::TransactionResultMeta(_) => "TransactionResultMeta",
62397            Self::UpgradeEntryMeta(_) => "UpgradeEntryMeta",
62398            Self::LedgerCloseMetaV0(_) => "LedgerCloseMetaV0",
62399            Self::LedgerCloseMetaExtV1(_) => "LedgerCloseMetaExtV1",
62400            Self::LedgerCloseMetaExt(_) => "LedgerCloseMetaExt",
62401            Self::LedgerCloseMetaV1(_) => "LedgerCloseMetaV1",
62402            Self::LedgerCloseMeta(_) => "LedgerCloseMeta",
62403            Self::ErrorCode(_) => "ErrorCode",
62404            Self::SError(_) => "SError",
62405            Self::SendMore(_) => "SendMore",
62406            Self::SendMoreExtended(_) => "SendMoreExtended",
62407            Self::AuthCert(_) => "AuthCert",
62408            Self::Hello(_) => "Hello",
62409            Self::Auth(_) => "Auth",
62410            Self::IpAddrType(_) => "IpAddrType",
62411            Self::PeerAddress(_) => "PeerAddress",
62412            Self::PeerAddressIp(_) => "PeerAddressIp",
62413            Self::MessageType(_) => "MessageType",
62414            Self::DontHave(_) => "DontHave",
62415            Self::SurveyMessageCommandType(_) => "SurveyMessageCommandType",
62416            Self::SurveyMessageResponseType(_) => "SurveyMessageResponseType",
62417            Self::TimeSlicedSurveyStartCollectingMessage(_) => {
62418                "TimeSlicedSurveyStartCollectingMessage"
62419            }
62420            Self::SignedTimeSlicedSurveyStartCollectingMessage(_) => {
62421                "SignedTimeSlicedSurveyStartCollectingMessage"
62422            }
62423            Self::TimeSlicedSurveyStopCollectingMessage(_) => {
62424                "TimeSlicedSurveyStopCollectingMessage"
62425            }
62426            Self::SignedTimeSlicedSurveyStopCollectingMessage(_) => {
62427                "SignedTimeSlicedSurveyStopCollectingMessage"
62428            }
62429            Self::SurveyRequestMessage(_) => "SurveyRequestMessage",
62430            Self::TimeSlicedSurveyRequestMessage(_) => "TimeSlicedSurveyRequestMessage",
62431            Self::SignedSurveyRequestMessage(_) => "SignedSurveyRequestMessage",
62432            Self::SignedTimeSlicedSurveyRequestMessage(_) => "SignedTimeSlicedSurveyRequestMessage",
62433            Self::EncryptedBody(_) => "EncryptedBody",
62434            Self::SurveyResponseMessage(_) => "SurveyResponseMessage",
62435            Self::TimeSlicedSurveyResponseMessage(_) => "TimeSlicedSurveyResponseMessage",
62436            Self::SignedSurveyResponseMessage(_) => "SignedSurveyResponseMessage",
62437            Self::SignedTimeSlicedSurveyResponseMessage(_) => {
62438                "SignedTimeSlicedSurveyResponseMessage"
62439            }
62440            Self::PeerStats(_) => "PeerStats",
62441            Self::PeerStatList(_) => "PeerStatList",
62442            Self::TimeSlicedNodeData(_) => "TimeSlicedNodeData",
62443            Self::TimeSlicedPeerData(_) => "TimeSlicedPeerData",
62444            Self::TimeSlicedPeerDataList(_) => "TimeSlicedPeerDataList",
62445            Self::TopologyResponseBodyV0(_) => "TopologyResponseBodyV0",
62446            Self::TopologyResponseBodyV1(_) => "TopologyResponseBodyV1",
62447            Self::TopologyResponseBodyV2(_) => "TopologyResponseBodyV2",
62448            Self::SurveyResponseBody(_) => "SurveyResponseBody",
62449            Self::TxAdvertVector(_) => "TxAdvertVector",
62450            Self::FloodAdvert(_) => "FloodAdvert",
62451            Self::TxDemandVector(_) => "TxDemandVector",
62452            Self::FloodDemand(_) => "FloodDemand",
62453            Self::StellarMessage(_) => "StellarMessage",
62454            Self::AuthenticatedMessage(_) => "AuthenticatedMessage",
62455            Self::AuthenticatedMessageV0(_) => "AuthenticatedMessageV0",
62456            Self::LiquidityPoolParameters(_) => "LiquidityPoolParameters",
62457            Self::MuxedAccount(_) => "MuxedAccount",
62458            Self::MuxedAccountMed25519(_) => "MuxedAccountMed25519",
62459            Self::DecoratedSignature(_) => "DecoratedSignature",
62460            Self::OperationType(_) => "OperationType",
62461            Self::CreateAccountOp(_) => "CreateAccountOp",
62462            Self::PaymentOp(_) => "PaymentOp",
62463            Self::PathPaymentStrictReceiveOp(_) => "PathPaymentStrictReceiveOp",
62464            Self::PathPaymentStrictSendOp(_) => "PathPaymentStrictSendOp",
62465            Self::ManageSellOfferOp(_) => "ManageSellOfferOp",
62466            Self::ManageBuyOfferOp(_) => "ManageBuyOfferOp",
62467            Self::CreatePassiveSellOfferOp(_) => "CreatePassiveSellOfferOp",
62468            Self::SetOptionsOp(_) => "SetOptionsOp",
62469            Self::ChangeTrustAsset(_) => "ChangeTrustAsset",
62470            Self::ChangeTrustOp(_) => "ChangeTrustOp",
62471            Self::AllowTrustOp(_) => "AllowTrustOp",
62472            Self::ManageDataOp(_) => "ManageDataOp",
62473            Self::BumpSequenceOp(_) => "BumpSequenceOp",
62474            Self::CreateClaimableBalanceOp(_) => "CreateClaimableBalanceOp",
62475            Self::ClaimClaimableBalanceOp(_) => "ClaimClaimableBalanceOp",
62476            Self::BeginSponsoringFutureReservesOp(_) => "BeginSponsoringFutureReservesOp",
62477            Self::RevokeSponsorshipType(_) => "RevokeSponsorshipType",
62478            Self::RevokeSponsorshipOp(_) => "RevokeSponsorshipOp",
62479            Self::RevokeSponsorshipOpSigner(_) => "RevokeSponsorshipOpSigner",
62480            Self::ClawbackOp(_) => "ClawbackOp",
62481            Self::ClawbackClaimableBalanceOp(_) => "ClawbackClaimableBalanceOp",
62482            Self::SetTrustLineFlagsOp(_) => "SetTrustLineFlagsOp",
62483            Self::LiquidityPoolDepositOp(_) => "LiquidityPoolDepositOp",
62484            Self::LiquidityPoolWithdrawOp(_) => "LiquidityPoolWithdrawOp",
62485            Self::HostFunctionType(_) => "HostFunctionType",
62486            Self::ContractIdPreimageType(_) => "ContractIdPreimageType",
62487            Self::ContractIdPreimage(_) => "ContractIdPreimage",
62488            Self::ContractIdPreimageFromAddress(_) => "ContractIdPreimageFromAddress",
62489            Self::CreateContractArgs(_) => "CreateContractArgs",
62490            Self::CreateContractArgsV2(_) => "CreateContractArgsV2",
62491            Self::InvokeContractArgs(_) => "InvokeContractArgs",
62492            Self::HostFunction(_) => "HostFunction",
62493            Self::SorobanAuthorizedFunctionType(_) => "SorobanAuthorizedFunctionType",
62494            Self::SorobanAuthorizedFunction(_) => "SorobanAuthorizedFunction",
62495            Self::SorobanAuthorizedInvocation(_) => "SorobanAuthorizedInvocation",
62496            Self::SorobanAddressCredentials(_) => "SorobanAddressCredentials",
62497            Self::SorobanCredentialsType(_) => "SorobanCredentialsType",
62498            Self::SorobanCredentials(_) => "SorobanCredentials",
62499            Self::SorobanAuthorizationEntry(_) => "SorobanAuthorizationEntry",
62500            Self::InvokeHostFunctionOp(_) => "InvokeHostFunctionOp",
62501            Self::ExtendFootprintTtlOp(_) => "ExtendFootprintTtlOp",
62502            Self::RestoreFootprintOp(_) => "RestoreFootprintOp",
62503            Self::Operation(_) => "Operation",
62504            Self::OperationBody(_) => "OperationBody",
62505            Self::HashIdPreimage(_) => "HashIdPreimage",
62506            Self::HashIdPreimageOperationId(_) => "HashIdPreimageOperationId",
62507            Self::HashIdPreimageRevokeId(_) => "HashIdPreimageRevokeId",
62508            Self::HashIdPreimageContractId(_) => "HashIdPreimageContractId",
62509            Self::HashIdPreimageSorobanAuthorization(_) => "HashIdPreimageSorobanAuthorization",
62510            Self::MemoType(_) => "MemoType",
62511            Self::Memo(_) => "Memo",
62512            Self::TimeBounds(_) => "TimeBounds",
62513            Self::LedgerBounds(_) => "LedgerBounds",
62514            Self::PreconditionsV2(_) => "PreconditionsV2",
62515            Self::PreconditionType(_) => "PreconditionType",
62516            Self::Preconditions(_) => "Preconditions",
62517            Self::LedgerFootprint(_) => "LedgerFootprint",
62518            Self::ArchivalProofType(_) => "ArchivalProofType",
62519            Self::ArchivalProofNode(_) => "ArchivalProofNode",
62520            Self::ProofLevel(_) => "ProofLevel",
62521            Self::NonexistenceProofBody(_) => "NonexistenceProofBody",
62522            Self::ExistenceProofBody(_) => "ExistenceProofBody",
62523            Self::ArchivalProof(_) => "ArchivalProof",
62524            Self::ArchivalProofBody(_) => "ArchivalProofBody",
62525            Self::SorobanResources(_) => "SorobanResources",
62526            Self::SorobanTransactionData(_) => "SorobanTransactionData",
62527            Self::TransactionV0(_) => "TransactionV0",
62528            Self::TransactionV0Ext(_) => "TransactionV0Ext",
62529            Self::TransactionV0Envelope(_) => "TransactionV0Envelope",
62530            Self::Transaction(_) => "Transaction",
62531            Self::TransactionExt(_) => "TransactionExt",
62532            Self::TransactionV1Envelope(_) => "TransactionV1Envelope",
62533            Self::FeeBumpTransaction(_) => "FeeBumpTransaction",
62534            Self::FeeBumpTransactionInnerTx(_) => "FeeBumpTransactionInnerTx",
62535            Self::FeeBumpTransactionExt(_) => "FeeBumpTransactionExt",
62536            Self::FeeBumpTransactionEnvelope(_) => "FeeBumpTransactionEnvelope",
62537            Self::TransactionEnvelope(_) => "TransactionEnvelope",
62538            Self::TransactionSignaturePayload(_) => "TransactionSignaturePayload",
62539            Self::TransactionSignaturePayloadTaggedTransaction(_) => {
62540                "TransactionSignaturePayloadTaggedTransaction"
62541            }
62542            Self::ClaimAtomType(_) => "ClaimAtomType",
62543            Self::ClaimOfferAtomV0(_) => "ClaimOfferAtomV0",
62544            Self::ClaimOfferAtom(_) => "ClaimOfferAtom",
62545            Self::ClaimLiquidityAtom(_) => "ClaimLiquidityAtom",
62546            Self::ClaimAtom(_) => "ClaimAtom",
62547            Self::CreateAccountResultCode(_) => "CreateAccountResultCode",
62548            Self::CreateAccountResult(_) => "CreateAccountResult",
62549            Self::PaymentResultCode(_) => "PaymentResultCode",
62550            Self::PaymentResult(_) => "PaymentResult",
62551            Self::PathPaymentStrictReceiveResultCode(_) => "PathPaymentStrictReceiveResultCode",
62552            Self::SimplePaymentResult(_) => "SimplePaymentResult",
62553            Self::PathPaymentStrictReceiveResult(_) => "PathPaymentStrictReceiveResult",
62554            Self::PathPaymentStrictReceiveResultSuccess(_) => {
62555                "PathPaymentStrictReceiveResultSuccess"
62556            }
62557            Self::PathPaymentStrictSendResultCode(_) => "PathPaymentStrictSendResultCode",
62558            Self::PathPaymentStrictSendResult(_) => "PathPaymentStrictSendResult",
62559            Self::PathPaymentStrictSendResultSuccess(_) => "PathPaymentStrictSendResultSuccess",
62560            Self::ManageSellOfferResultCode(_) => "ManageSellOfferResultCode",
62561            Self::ManageOfferEffect(_) => "ManageOfferEffect",
62562            Self::ManageOfferSuccessResult(_) => "ManageOfferSuccessResult",
62563            Self::ManageOfferSuccessResultOffer(_) => "ManageOfferSuccessResultOffer",
62564            Self::ManageSellOfferResult(_) => "ManageSellOfferResult",
62565            Self::ManageBuyOfferResultCode(_) => "ManageBuyOfferResultCode",
62566            Self::ManageBuyOfferResult(_) => "ManageBuyOfferResult",
62567            Self::SetOptionsResultCode(_) => "SetOptionsResultCode",
62568            Self::SetOptionsResult(_) => "SetOptionsResult",
62569            Self::ChangeTrustResultCode(_) => "ChangeTrustResultCode",
62570            Self::ChangeTrustResult(_) => "ChangeTrustResult",
62571            Self::AllowTrustResultCode(_) => "AllowTrustResultCode",
62572            Self::AllowTrustResult(_) => "AllowTrustResult",
62573            Self::AccountMergeResultCode(_) => "AccountMergeResultCode",
62574            Self::AccountMergeResult(_) => "AccountMergeResult",
62575            Self::InflationResultCode(_) => "InflationResultCode",
62576            Self::InflationPayout(_) => "InflationPayout",
62577            Self::InflationResult(_) => "InflationResult",
62578            Self::ManageDataResultCode(_) => "ManageDataResultCode",
62579            Self::ManageDataResult(_) => "ManageDataResult",
62580            Self::BumpSequenceResultCode(_) => "BumpSequenceResultCode",
62581            Self::BumpSequenceResult(_) => "BumpSequenceResult",
62582            Self::CreateClaimableBalanceResultCode(_) => "CreateClaimableBalanceResultCode",
62583            Self::CreateClaimableBalanceResult(_) => "CreateClaimableBalanceResult",
62584            Self::ClaimClaimableBalanceResultCode(_) => "ClaimClaimableBalanceResultCode",
62585            Self::ClaimClaimableBalanceResult(_) => "ClaimClaimableBalanceResult",
62586            Self::BeginSponsoringFutureReservesResultCode(_) => {
62587                "BeginSponsoringFutureReservesResultCode"
62588            }
62589            Self::BeginSponsoringFutureReservesResult(_) => "BeginSponsoringFutureReservesResult",
62590            Self::EndSponsoringFutureReservesResultCode(_) => {
62591                "EndSponsoringFutureReservesResultCode"
62592            }
62593            Self::EndSponsoringFutureReservesResult(_) => "EndSponsoringFutureReservesResult",
62594            Self::RevokeSponsorshipResultCode(_) => "RevokeSponsorshipResultCode",
62595            Self::RevokeSponsorshipResult(_) => "RevokeSponsorshipResult",
62596            Self::ClawbackResultCode(_) => "ClawbackResultCode",
62597            Self::ClawbackResult(_) => "ClawbackResult",
62598            Self::ClawbackClaimableBalanceResultCode(_) => "ClawbackClaimableBalanceResultCode",
62599            Self::ClawbackClaimableBalanceResult(_) => "ClawbackClaimableBalanceResult",
62600            Self::SetTrustLineFlagsResultCode(_) => "SetTrustLineFlagsResultCode",
62601            Self::SetTrustLineFlagsResult(_) => "SetTrustLineFlagsResult",
62602            Self::LiquidityPoolDepositResultCode(_) => "LiquidityPoolDepositResultCode",
62603            Self::LiquidityPoolDepositResult(_) => "LiquidityPoolDepositResult",
62604            Self::LiquidityPoolWithdrawResultCode(_) => "LiquidityPoolWithdrawResultCode",
62605            Self::LiquidityPoolWithdrawResult(_) => "LiquidityPoolWithdrawResult",
62606            Self::InvokeHostFunctionResultCode(_) => "InvokeHostFunctionResultCode",
62607            Self::InvokeHostFunctionResult(_) => "InvokeHostFunctionResult",
62608            Self::ExtendFootprintTtlResultCode(_) => "ExtendFootprintTtlResultCode",
62609            Self::ExtendFootprintTtlResult(_) => "ExtendFootprintTtlResult",
62610            Self::RestoreFootprintResultCode(_) => "RestoreFootprintResultCode",
62611            Self::RestoreFootprintResult(_) => "RestoreFootprintResult",
62612            Self::OperationResultCode(_) => "OperationResultCode",
62613            Self::OperationResult(_) => "OperationResult",
62614            Self::OperationResultTr(_) => "OperationResultTr",
62615            Self::TransactionResultCode(_) => "TransactionResultCode",
62616            Self::InnerTransactionResult(_) => "InnerTransactionResult",
62617            Self::InnerTransactionResultResult(_) => "InnerTransactionResultResult",
62618            Self::InnerTransactionResultExt(_) => "InnerTransactionResultExt",
62619            Self::InnerTransactionResultPair(_) => "InnerTransactionResultPair",
62620            Self::TransactionResult(_) => "TransactionResult",
62621            Self::TransactionResultResult(_) => "TransactionResultResult",
62622            Self::TransactionResultExt(_) => "TransactionResultExt",
62623            Self::Hash(_) => "Hash",
62624            Self::Uint256(_) => "Uint256",
62625            Self::Uint32(_) => "Uint32",
62626            Self::Int32(_) => "Int32",
62627            Self::Uint64(_) => "Uint64",
62628            Self::Int64(_) => "Int64",
62629            Self::TimePoint(_) => "TimePoint",
62630            Self::Duration(_) => "Duration",
62631            Self::ExtensionPoint(_) => "ExtensionPoint",
62632            Self::CryptoKeyType(_) => "CryptoKeyType",
62633            Self::PublicKeyType(_) => "PublicKeyType",
62634            Self::SignerKeyType(_) => "SignerKeyType",
62635            Self::PublicKey(_) => "PublicKey",
62636            Self::SignerKey(_) => "SignerKey",
62637            Self::SignerKeyEd25519SignedPayload(_) => "SignerKeyEd25519SignedPayload",
62638            Self::Signature(_) => "Signature",
62639            Self::SignatureHint(_) => "SignatureHint",
62640            Self::NodeId(_) => "NodeId",
62641            Self::AccountId(_) => "AccountId",
62642            Self::Curve25519Secret(_) => "Curve25519Secret",
62643            Self::Curve25519Public(_) => "Curve25519Public",
62644            Self::HmacSha256Key(_) => "HmacSha256Key",
62645            Self::HmacSha256Mac(_) => "HmacSha256Mac",
62646            Self::ShortHashSeed(_) => "ShortHashSeed",
62647            Self::BinaryFuseFilterType(_) => "BinaryFuseFilterType",
62648            Self::SerializedBinaryFuseFilter(_) => "SerializedBinaryFuseFilter",
62649        }
62650    }
62651
62652    #[must_use]
62653    #[allow(clippy::too_many_lines)]
62654    pub const fn variants() -> [TypeVariant; 459] {
62655        Self::VARIANTS
62656    }
62657
62658    #[must_use]
62659    #[allow(clippy::too_many_lines)]
62660    pub const fn variant(&self) -> TypeVariant {
62661        match self {
62662            Self::Value(_) => TypeVariant::Value,
62663            Self::ScpBallot(_) => TypeVariant::ScpBallot,
62664            Self::ScpStatementType(_) => TypeVariant::ScpStatementType,
62665            Self::ScpNomination(_) => TypeVariant::ScpNomination,
62666            Self::ScpStatement(_) => TypeVariant::ScpStatement,
62667            Self::ScpStatementPledges(_) => TypeVariant::ScpStatementPledges,
62668            Self::ScpStatementPrepare(_) => TypeVariant::ScpStatementPrepare,
62669            Self::ScpStatementConfirm(_) => TypeVariant::ScpStatementConfirm,
62670            Self::ScpStatementExternalize(_) => TypeVariant::ScpStatementExternalize,
62671            Self::ScpEnvelope(_) => TypeVariant::ScpEnvelope,
62672            Self::ScpQuorumSet(_) => TypeVariant::ScpQuorumSet,
62673            Self::ConfigSettingContractExecutionLanesV0(_) => {
62674                TypeVariant::ConfigSettingContractExecutionLanesV0
62675            }
62676            Self::ConfigSettingContractComputeV0(_) => TypeVariant::ConfigSettingContractComputeV0,
62677            Self::ConfigSettingContractLedgerCostV0(_) => {
62678                TypeVariant::ConfigSettingContractLedgerCostV0
62679            }
62680            Self::ConfigSettingContractHistoricalDataV0(_) => {
62681                TypeVariant::ConfigSettingContractHistoricalDataV0
62682            }
62683            Self::ConfigSettingContractEventsV0(_) => TypeVariant::ConfigSettingContractEventsV0,
62684            Self::ConfigSettingContractBandwidthV0(_) => {
62685                TypeVariant::ConfigSettingContractBandwidthV0
62686            }
62687            Self::ContractCostType(_) => TypeVariant::ContractCostType,
62688            Self::ContractCostParamEntry(_) => TypeVariant::ContractCostParamEntry,
62689            Self::StateArchivalSettings(_) => TypeVariant::StateArchivalSettings,
62690            Self::EvictionIterator(_) => TypeVariant::EvictionIterator,
62691            Self::ContractCostParams(_) => TypeVariant::ContractCostParams,
62692            Self::ConfigSettingId(_) => TypeVariant::ConfigSettingId,
62693            Self::ConfigSettingEntry(_) => TypeVariant::ConfigSettingEntry,
62694            Self::ScEnvMetaKind(_) => TypeVariant::ScEnvMetaKind,
62695            Self::ScEnvMetaEntry(_) => TypeVariant::ScEnvMetaEntry,
62696            Self::ScEnvMetaEntryInterfaceVersion(_) => TypeVariant::ScEnvMetaEntryInterfaceVersion,
62697            Self::ScMetaV0(_) => TypeVariant::ScMetaV0,
62698            Self::ScMetaKind(_) => TypeVariant::ScMetaKind,
62699            Self::ScMetaEntry(_) => TypeVariant::ScMetaEntry,
62700            Self::ScSpecType(_) => TypeVariant::ScSpecType,
62701            Self::ScSpecTypeOption(_) => TypeVariant::ScSpecTypeOption,
62702            Self::ScSpecTypeResult(_) => TypeVariant::ScSpecTypeResult,
62703            Self::ScSpecTypeVec(_) => TypeVariant::ScSpecTypeVec,
62704            Self::ScSpecTypeMap(_) => TypeVariant::ScSpecTypeMap,
62705            Self::ScSpecTypeTuple(_) => TypeVariant::ScSpecTypeTuple,
62706            Self::ScSpecTypeBytesN(_) => TypeVariant::ScSpecTypeBytesN,
62707            Self::ScSpecTypeUdt(_) => TypeVariant::ScSpecTypeUdt,
62708            Self::ScSpecTypeDef(_) => TypeVariant::ScSpecTypeDef,
62709            Self::ScSpecUdtStructFieldV0(_) => TypeVariant::ScSpecUdtStructFieldV0,
62710            Self::ScSpecUdtStructV0(_) => TypeVariant::ScSpecUdtStructV0,
62711            Self::ScSpecUdtUnionCaseVoidV0(_) => TypeVariant::ScSpecUdtUnionCaseVoidV0,
62712            Self::ScSpecUdtUnionCaseTupleV0(_) => TypeVariant::ScSpecUdtUnionCaseTupleV0,
62713            Self::ScSpecUdtUnionCaseV0Kind(_) => TypeVariant::ScSpecUdtUnionCaseV0Kind,
62714            Self::ScSpecUdtUnionCaseV0(_) => TypeVariant::ScSpecUdtUnionCaseV0,
62715            Self::ScSpecUdtUnionV0(_) => TypeVariant::ScSpecUdtUnionV0,
62716            Self::ScSpecUdtEnumCaseV0(_) => TypeVariant::ScSpecUdtEnumCaseV0,
62717            Self::ScSpecUdtEnumV0(_) => TypeVariant::ScSpecUdtEnumV0,
62718            Self::ScSpecUdtErrorEnumCaseV0(_) => TypeVariant::ScSpecUdtErrorEnumCaseV0,
62719            Self::ScSpecUdtErrorEnumV0(_) => TypeVariant::ScSpecUdtErrorEnumV0,
62720            Self::ScSpecFunctionInputV0(_) => TypeVariant::ScSpecFunctionInputV0,
62721            Self::ScSpecFunctionV0(_) => TypeVariant::ScSpecFunctionV0,
62722            Self::ScSpecEntryKind(_) => TypeVariant::ScSpecEntryKind,
62723            Self::ScSpecEntry(_) => TypeVariant::ScSpecEntry,
62724            Self::ScValType(_) => TypeVariant::ScValType,
62725            Self::ScErrorType(_) => TypeVariant::ScErrorType,
62726            Self::ScErrorCode(_) => TypeVariant::ScErrorCode,
62727            Self::ScError(_) => TypeVariant::ScError,
62728            Self::UInt128Parts(_) => TypeVariant::UInt128Parts,
62729            Self::Int128Parts(_) => TypeVariant::Int128Parts,
62730            Self::UInt256Parts(_) => TypeVariant::UInt256Parts,
62731            Self::Int256Parts(_) => TypeVariant::Int256Parts,
62732            Self::ContractExecutableType(_) => TypeVariant::ContractExecutableType,
62733            Self::ContractExecutable(_) => TypeVariant::ContractExecutable,
62734            Self::ScAddressType(_) => TypeVariant::ScAddressType,
62735            Self::ScAddress(_) => TypeVariant::ScAddress,
62736            Self::ScVec(_) => TypeVariant::ScVec,
62737            Self::ScMap(_) => TypeVariant::ScMap,
62738            Self::ScBytes(_) => TypeVariant::ScBytes,
62739            Self::ScString(_) => TypeVariant::ScString,
62740            Self::ScSymbol(_) => TypeVariant::ScSymbol,
62741            Self::ScNonceKey(_) => TypeVariant::ScNonceKey,
62742            Self::ScContractInstance(_) => TypeVariant::ScContractInstance,
62743            Self::ScVal(_) => TypeVariant::ScVal,
62744            Self::ScMapEntry(_) => TypeVariant::ScMapEntry,
62745            Self::StoredTransactionSet(_) => TypeVariant::StoredTransactionSet,
62746            Self::StoredDebugTransactionSet(_) => TypeVariant::StoredDebugTransactionSet,
62747            Self::PersistedScpStateV0(_) => TypeVariant::PersistedScpStateV0,
62748            Self::PersistedScpStateV1(_) => TypeVariant::PersistedScpStateV1,
62749            Self::PersistedScpState(_) => TypeVariant::PersistedScpState,
62750            Self::Thresholds(_) => TypeVariant::Thresholds,
62751            Self::String32(_) => TypeVariant::String32,
62752            Self::String64(_) => TypeVariant::String64,
62753            Self::SequenceNumber(_) => TypeVariant::SequenceNumber,
62754            Self::DataValue(_) => TypeVariant::DataValue,
62755            Self::PoolId(_) => TypeVariant::PoolId,
62756            Self::AssetCode4(_) => TypeVariant::AssetCode4,
62757            Self::AssetCode12(_) => TypeVariant::AssetCode12,
62758            Self::AssetType(_) => TypeVariant::AssetType,
62759            Self::AssetCode(_) => TypeVariant::AssetCode,
62760            Self::AlphaNum4(_) => TypeVariant::AlphaNum4,
62761            Self::AlphaNum12(_) => TypeVariant::AlphaNum12,
62762            Self::Asset(_) => TypeVariant::Asset,
62763            Self::Price(_) => TypeVariant::Price,
62764            Self::Liabilities(_) => TypeVariant::Liabilities,
62765            Self::ThresholdIndexes(_) => TypeVariant::ThresholdIndexes,
62766            Self::LedgerEntryType(_) => TypeVariant::LedgerEntryType,
62767            Self::Signer(_) => TypeVariant::Signer,
62768            Self::AccountFlags(_) => TypeVariant::AccountFlags,
62769            Self::SponsorshipDescriptor(_) => TypeVariant::SponsorshipDescriptor,
62770            Self::AccountEntryExtensionV3(_) => TypeVariant::AccountEntryExtensionV3,
62771            Self::AccountEntryExtensionV2(_) => TypeVariant::AccountEntryExtensionV2,
62772            Self::AccountEntryExtensionV2Ext(_) => TypeVariant::AccountEntryExtensionV2Ext,
62773            Self::AccountEntryExtensionV1(_) => TypeVariant::AccountEntryExtensionV1,
62774            Self::AccountEntryExtensionV1Ext(_) => TypeVariant::AccountEntryExtensionV1Ext,
62775            Self::AccountEntry(_) => TypeVariant::AccountEntry,
62776            Self::AccountEntryExt(_) => TypeVariant::AccountEntryExt,
62777            Self::TrustLineFlags(_) => TypeVariant::TrustLineFlags,
62778            Self::LiquidityPoolType(_) => TypeVariant::LiquidityPoolType,
62779            Self::TrustLineAsset(_) => TypeVariant::TrustLineAsset,
62780            Self::TrustLineEntryExtensionV2(_) => TypeVariant::TrustLineEntryExtensionV2,
62781            Self::TrustLineEntryExtensionV2Ext(_) => TypeVariant::TrustLineEntryExtensionV2Ext,
62782            Self::TrustLineEntry(_) => TypeVariant::TrustLineEntry,
62783            Self::TrustLineEntryExt(_) => TypeVariant::TrustLineEntryExt,
62784            Self::TrustLineEntryV1(_) => TypeVariant::TrustLineEntryV1,
62785            Self::TrustLineEntryV1Ext(_) => TypeVariant::TrustLineEntryV1Ext,
62786            Self::OfferEntryFlags(_) => TypeVariant::OfferEntryFlags,
62787            Self::OfferEntry(_) => TypeVariant::OfferEntry,
62788            Self::OfferEntryExt(_) => TypeVariant::OfferEntryExt,
62789            Self::DataEntry(_) => TypeVariant::DataEntry,
62790            Self::DataEntryExt(_) => TypeVariant::DataEntryExt,
62791            Self::ClaimPredicateType(_) => TypeVariant::ClaimPredicateType,
62792            Self::ClaimPredicate(_) => TypeVariant::ClaimPredicate,
62793            Self::ClaimantType(_) => TypeVariant::ClaimantType,
62794            Self::Claimant(_) => TypeVariant::Claimant,
62795            Self::ClaimantV0(_) => TypeVariant::ClaimantV0,
62796            Self::ClaimableBalanceIdType(_) => TypeVariant::ClaimableBalanceIdType,
62797            Self::ClaimableBalanceId(_) => TypeVariant::ClaimableBalanceId,
62798            Self::ClaimableBalanceFlags(_) => TypeVariant::ClaimableBalanceFlags,
62799            Self::ClaimableBalanceEntryExtensionV1(_) => {
62800                TypeVariant::ClaimableBalanceEntryExtensionV1
62801            }
62802            Self::ClaimableBalanceEntryExtensionV1Ext(_) => {
62803                TypeVariant::ClaimableBalanceEntryExtensionV1Ext
62804            }
62805            Self::ClaimableBalanceEntry(_) => TypeVariant::ClaimableBalanceEntry,
62806            Self::ClaimableBalanceEntryExt(_) => TypeVariant::ClaimableBalanceEntryExt,
62807            Self::LiquidityPoolConstantProductParameters(_) => {
62808                TypeVariant::LiquidityPoolConstantProductParameters
62809            }
62810            Self::LiquidityPoolEntry(_) => TypeVariant::LiquidityPoolEntry,
62811            Self::LiquidityPoolEntryBody(_) => TypeVariant::LiquidityPoolEntryBody,
62812            Self::LiquidityPoolEntryConstantProduct(_) => {
62813                TypeVariant::LiquidityPoolEntryConstantProduct
62814            }
62815            Self::ContractDataDurability(_) => TypeVariant::ContractDataDurability,
62816            Self::ContractDataEntry(_) => TypeVariant::ContractDataEntry,
62817            Self::ContractCodeCostInputs(_) => TypeVariant::ContractCodeCostInputs,
62818            Self::ContractCodeEntry(_) => TypeVariant::ContractCodeEntry,
62819            Self::ContractCodeEntryExt(_) => TypeVariant::ContractCodeEntryExt,
62820            Self::ContractCodeEntryV1(_) => TypeVariant::ContractCodeEntryV1,
62821            Self::TtlEntry(_) => TypeVariant::TtlEntry,
62822            Self::LedgerEntryExtensionV1(_) => TypeVariant::LedgerEntryExtensionV1,
62823            Self::LedgerEntryExtensionV1Ext(_) => TypeVariant::LedgerEntryExtensionV1Ext,
62824            Self::LedgerEntry(_) => TypeVariant::LedgerEntry,
62825            Self::LedgerEntryData(_) => TypeVariant::LedgerEntryData,
62826            Self::LedgerEntryExt(_) => TypeVariant::LedgerEntryExt,
62827            Self::LedgerKey(_) => TypeVariant::LedgerKey,
62828            Self::LedgerKeyAccount(_) => TypeVariant::LedgerKeyAccount,
62829            Self::LedgerKeyTrustLine(_) => TypeVariant::LedgerKeyTrustLine,
62830            Self::LedgerKeyOffer(_) => TypeVariant::LedgerKeyOffer,
62831            Self::LedgerKeyData(_) => TypeVariant::LedgerKeyData,
62832            Self::LedgerKeyClaimableBalance(_) => TypeVariant::LedgerKeyClaimableBalance,
62833            Self::LedgerKeyLiquidityPool(_) => TypeVariant::LedgerKeyLiquidityPool,
62834            Self::LedgerKeyContractData(_) => TypeVariant::LedgerKeyContractData,
62835            Self::LedgerKeyContractCode(_) => TypeVariant::LedgerKeyContractCode,
62836            Self::LedgerKeyConfigSetting(_) => TypeVariant::LedgerKeyConfigSetting,
62837            Self::LedgerKeyTtl(_) => TypeVariant::LedgerKeyTtl,
62838            Self::EnvelopeType(_) => TypeVariant::EnvelopeType,
62839            Self::BucketListType(_) => TypeVariant::BucketListType,
62840            Self::BucketEntryType(_) => TypeVariant::BucketEntryType,
62841            Self::HotArchiveBucketEntryType(_) => TypeVariant::HotArchiveBucketEntryType,
62842            Self::ColdArchiveBucketEntryType(_) => TypeVariant::ColdArchiveBucketEntryType,
62843            Self::BucketMetadata(_) => TypeVariant::BucketMetadata,
62844            Self::BucketMetadataExt(_) => TypeVariant::BucketMetadataExt,
62845            Self::BucketEntry(_) => TypeVariant::BucketEntry,
62846            Self::HotArchiveBucketEntry(_) => TypeVariant::HotArchiveBucketEntry,
62847            Self::ColdArchiveArchivedLeaf(_) => TypeVariant::ColdArchiveArchivedLeaf,
62848            Self::ColdArchiveDeletedLeaf(_) => TypeVariant::ColdArchiveDeletedLeaf,
62849            Self::ColdArchiveBoundaryLeaf(_) => TypeVariant::ColdArchiveBoundaryLeaf,
62850            Self::ColdArchiveHashEntry(_) => TypeVariant::ColdArchiveHashEntry,
62851            Self::ColdArchiveBucketEntry(_) => TypeVariant::ColdArchiveBucketEntry,
62852            Self::UpgradeType(_) => TypeVariant::UpgradeType,
62853            Self::StellarValueType(_) => TypeVariant::StellarValueType,
62854            Self::LedgerCloseValueSignature(_) => TypeVariant::LedgerCloseValueSignature,
62855            Self::StellarValue(_) => TypeVariant::StellarValue,
62856            Self::StellarValueExt(_) => TypeVariant::StellarValueExt,
62857            Self::LedgerHeaderFlags(_) => TypeVariant::LedgerHeaderFlags,
62858            Self::LedgerHeaderExtensionV1(_) => TypeVariant::LedgerHeaderExtensionV1,
62859            Self::LedgerHeaderExtensionV1Ext(_) => TypeVariant::LedgerHeaderExtensionV1Ext,
62860            Self::LedgerHeader(_) => TypeVariant::LedgerHeader,
62861            Self::LedgerHeaderExt(_) => TypeVariant::LedgerHeaderExt,
62862            Self::LedgerUpgradeType(_) => TypeVariant::LedgerUpgradeType,
62863            Self::ConfigUpgradeSetKey(_) => TypeVariant::ConfigUpgradeSetKey,
62864            Self::LedgerUpgrade(_) => TypeVariant::LedgerUpgrade,
62865            Self::ConfigUpgradeSet(_) => TypeVariant::ConfigUpgradeSet,
62866            Self::TxSetComponentType(_) => TypeVariant::TxSetComponentType,
62867            Self::TxSetComponent(_) => TypeVariant::TxSetComponent,
62868            Self::TxSetComponentTxsMaybeDiscountedFee(_) => {
62869                TypeVariant::TxSetComponentTxsMaybeDiscountedFee
62870            }
62871            Self::TransactionPhase(_) => TypeVariant::TransactionPhase,
62872            Self::TransactionSet(_) => TypeVariant::TransactionSet,
62873            Self::TransactionSetV1(_) => TypeVariant::TransactionSetV1,
62874            Self::GeneralizedTransactionSet(_) => TypeVariant::GeneralizedTransactionSet,
62875            Self::TransactionResultPair(_) => TypeVariant::TransactionResultPair,
62876            Self::TransactionResultSet(_) => TypeVariant::TransactionResultSet,
62877            Self::TransactionHistoryEntry(_) => TypeVariant::TransactionHistoryEntry,
62878            Self::TransactionHistoryEntryExt(_) => TypeVariant::TransactionHistoryEntryExt,
62879            Self::TransactionHistoryResultEntry(_) => TypeVariant::TransactionHistoryResultEntry,
62880            Self::TransactionHistoryResultEntryExt(_) => {
62881                TypeVariant::TransactionHistoryResultEntryExt
62882            }
62883            Self::LedgerHeaderHistoryEntry(_) => TypeVariant::LedgerHeaderHistoryEntry,
62884            Self::LedgerHeaderHistoryEntryExt(_) => TypeVariant::LedgerHeaderHistoryEntryExt,
62885            Self::LedgerScpMessages(_) => TypeVariant::LedgerScpMessages,
62886            Self::ScpHistoryEntryV0(_) => TypeVariant::ScpHistoryEntryV0,
62887            Self::ScpHistoryEntry(_) => TypeVariant::ScpHistoryEntry,
62888            Self::LedgerEntryChangeType(_) => TypeVariant::LedgerEntryChangeType,
62889            Self::LedgerEntryChange(_) => TypeVariant::LedgerEntryChange,
62890            Self::LedgerEntryChanges(_) => TypeVariant::LedgerEntryChanges,
62891            Self::OperationMeta(_) => TypeVariant::OperationMeta,
62892            Self::TransactionMetaV1(_) => TypeVariant::TransactionMetaV1,
62893            Self::TransactionMetaV2(_) => TypeVariant::TransactionMetaV2,
62894            Self::ContractEventType(_) => TypeVariant::ContractEventType,
62895            Self::ContractEvent(_) => TypeVariant::ContractEvent,
62896            Self::ContractEventBody(_) => TypeVariant::ContractEventBody,
62897            Self::ContractEventV0(_) => TypeVariant::ContractEventV0,
62898            Self::DiagnosticEvent(_) => TypeVariant::DiagnosticEvent,
62899            Self::DiagnosticEvents(_) => TypeVariant::DiagnosticEvents,
62900            Self::SorobanTransactionMetaExtV1(_) => TypeVariant::SorobanTransactionMetaExtV1,
62901            Self::SorobanTransactionMetaExt(_) => TypeVariant::SorobanTransactionMetaExt,
62902            Self::SorobanTransactionMeta(_) => TypeVariant::SorobanTransactionMeta,
62903            Self::TransactionMetaV3(_) => TypeVariant::TransactionMetaV3,
62904            Self::InvokeHostFunctionSuccessPreImage(_) => {
62905                TypeVariant::InvokeHostFunctionSuccessPreImage
62906            }
62907            Self::TransactionMeta(_) => TypeVariant::TransactionMeta,
62908            Self::TransactionResultMeta(_) => TypeVariant::TransactionResultMeta,
62909            Self::UpgradeEntryMeta(_) => TypeVariant::UpgradeEntryMeta,
62910            Self::LedgerCloseMetaV0(_) => TypeVariant::LedgerCloseMetaV0,
62911            Self::LedgerCloseMetaExtV1(_) => TypeVariant::LedgerCloseMetaExtV1,
62912            Self::LedgerCloseMetaExt(_) => TypeVariant::LedgerCloseMetaExt,
62913            Self::LedgerCloseMetaV1(_) => TypeVariant::LedgerCloseMetaV1,
62914            Self::LedgerCloseMeta(_) => TypeVariant::LedgerCloseMeta,
62915            Self::ErrorCode(_) => TypeVariant::ErrorCode,
62916            Self::SError(_) => TypeVariant::SError,
62917            Self::SendMore(_) => TypeVariant::SendMore,
62918            Self::SendMoreExtended(_) => TypeVariant::SendMoreExtended,
62919            Self::AuthCert(_) => TypeVariant::AuthCert,
62920            Self::Hello(_) => TypeVariant::Hello,
62921            Self::Auth(_) => TypeVariant::Auth,
62922            Self::IpAddrType(_) => TypeVariant::IpAddrType,
62923            Self::PeerAddress(_) => TypeVariant::PeerAddress,
62924            Self::PeerAddressIp(_) => TypeVariant::PeerAddressIp,
62925            Self::MessageType(_) => TypeVariant::MessageType,
62926            Self::DontHave(_) => TypeVariant::DontHave,
62927            Self::SurveyMessageCommandType(_) => TypeVariant::SurveyMessageCommandType,
62928            Self::SurveyMessageResponseType(_) => TypeVariant::SurveyMessageResponseType,
62929            Self::TimeSlicedSurveyStartCollectingMessage(_) => {
62930                TypeVariant::TimeSlicedSurveyStartCollectingMessage
62931            }
62932            Self::SignedTimeSlicedSurveyStartCollectingMessage(_) => {
62933                TypeVariant::SignedTimeSlicedSurveyStartCollectingMessage
62934            }
62935            Self::TimeSlicedSurveyStopCollectingMessage(_) => {
62936                TypeVariant::TimeSlicedSurveyStopCollectingMessage
62937            }
62938            Self::SignedTimeSlicedSurveyStopCollectingMessage(_) => {
62939                TypeVariant::SignedTimeSlicedSurveyStopCollectingMessage
62940            }
62941            Self::SurveyRequestMessage(_) => TypeVariant::SurveyRequestMessage,
62942            Self::TimeSlicedSurveyRequestMessage(_) => TypeVariant::TimeSlicedSurveyRequestMessage,
62943            Self::SignedSurveyRequestMessage(_) => TypeVariant::SignedSurveyRequestMessage,
62944            Self::SignedTimeSlicedSurveyRequestMessage(_) => {
62945                TypeVariant::SignedTimeSlicedSurveyRequestMessage
62946            }
62947            Self::EncryptedBody(_) => TypeVariant::EncryptedBody,
62948            Self::SurveyResponseMessage(_) => TypeVariant::SurveyResponseMessage,
62949            Self::TimeSlicedSurveyResponseMessage(_) => {
62950                TypeVariant::TimeSlicedSurveyResponseMessage
62951            }
62952            Self::SignedSurveyResponseMessage(_) => TypeVariant::SignedSurveyResponseMessage,
62953            Self::SignedTimeSlicedSurveyResponseMessage(_) => {
62954                TypeVariant::SignedTimeSlicedSurveyResponseMessage
62955            }
62956            Self::PeerStats(_) => TypeVariant::PeerStats,
62957            Self::PeerStatList(_) => TypeVariant::PeerStatList,
62958            Self::TimeSlicedNodeData(_) => TypeVariant::TimeSlicedNodeData,
62959            Self::TimeSlicedPeerData(_) => TypeVariant::TimeSlicedPeerData,
62960            Self::TimeSlicedPeerDataList(_) => TypeVariant::TimeSlicedPeerDataList,
62961            Self::TopologyResponseBodyV0(_) => TypeVariant::TopologyResponseBodyV0,
62962            Self::TopologyResponseBodyV1(_) => TypeVariant::TopologyResponseBodyV1,
62963            Self::TopologyResponseBodyV2(_) => TypeVariant::TopologyResponseBodyV2,
62964            Self::SurveyResponseBody(_) => TypeVariant::SurveyResponseBody,
62965            Self::TxAdvertVector(_) => TypeVariant::TxAdvertVector,
62966            Self::FloodAdvert(_) => TypeVariant::FloodAdvert,
62967            Self::TxDemandVector(_) => TypeVariant::TxDemandVector,
62968            Self::FloodDemand(_) => TypeVariant::FloodDemand,
62969            Self::StellarMessage(_) => TypeVariant::StellarMessage,
62970            Self::AuthenticatedMessage(_) => TypeVariant::AuthenticatedMessage,
62971            Self::AuthenticatedMessageV0(_) => TypeVariant::AuthenticatedMessageV0,
62972            Self::LiquidityPoolParameters(_) => TypeVariant::LiquidityPoolParameters,
62973            Self::MuxedAccount(_) => TypeVariant::MuxedAccount,
62974            Self::MuxedAccountMed25519(_) => TypeVariant::MuxedAccountMed25519,
62975            Self::DecoratedSignature(_) => TypeVariant::DecoratedSignature,
62976            Self::OperationType(_) => TypeVariant::OperationType,
62977            Self::CreateAccountOp(_) => TypeVariant::CreateAccountOp,
62978            Self::PaymentOp(_) => TypeVariant::PaymentOp,
62979            Self::PathPaymentStrictReceiveOp(_) => TypeVariant::PathPaymentStrictReceiveOp,
62980            Self::PathPaymentStrictSendOp(_) => TypeVariant::PathPaymentStrictSendOp,
62981            Self::ManageSellOfferOp(_) => TypeVariant::ManageSellOfferOp,
62982            Self::ManageBuyOfferOp(_) => TypeVariant::ManageBuyOfferOp,
62983            Self::CreatePassiveSellOfferOp(_) => TypeVariant::CreatePassiveSellOfferOp,
62984            Self::SetOptionsOp(_) => TypeVariant::SetOptionsOp,
62985            Self::ChangeTrustAsset(_) => TypeVariant::ChangeTrustAsset,
62986            Self::ChangeTrustOp(_) => TypeVariant::ChangeTrustOp,
62987            Self::AllowTrustOp(_) => TypeVariant::AllowTrustOp,
62988            Self::ManageDataOp(_) => TypeVariant::ManageDataOp,
62989            Self::BumpSequenceOp(_) => TypeVariant::BumpSequenceOp,
62990            Self::CreateClaimableBalanceOp(_) => TypeVariant::CreateClaimableBalanceOp,
62991            Self::ClaimClaimableBalanceOp(_) => TypeVariant::ClaimClaimableBalanceOp,
62992            Self::BeginSponsoringFutureReservesOp(_) => {
62993                TypeVariant::BeginSponsoringFutureReservesOp
62994            }
62995            Self::RevokeSponsorshipType(_) => TypeVariant::RevokeSponsorshipType,
62996            Self::RevokeSponsorshipOp(_) => TypeVariant::RevokeSponsorshipOp,
62997            Self::RevokeSponsorshipOpSigner(_) => TypeVariant::RevokeSponsorshipOpSigner,
62998            Self::ClawbackOp(_) => TypeVariant::ClawbackOp,
62999            Self::ClawbackClaimableBalanceOp(_) => TypeVariant::ClawbackClaimableBalanceOp,
63000            Self::SetTrustLineFlagsOp(_) => TypeVariant::SetTrustLineFlagsOp,
63001            Self::LiquidityPoolDepositOp(_) => TypeVariant::LiquidityPoolDepositOp,
63002            Self::LiquidityPoolWithdrawOp(_) => TypeVariant::LiquidityPoolWithdrawOp,
63003            Self::HostFunctionType(_) => TypeVariant::HostFunctionType,
63004            Self::ContractIdPreimageType(_) => TypeVariant::ContractIdPreimageType,
63005            Self::ContractIdPreimage(_) => TypeVariant::ContractIdPreimage,
63006            Self::ContractIdPreimageFromAddress(_) => TypeVariant::ContractIdPreimageFromAddress,
63007            Self::CreateContractArgs(_) => TypeVariant::CreateContractArgs,
63008            Self::CreateContractArgsV2(_) => TypeVariant::CreateContractArgsV2,
63009            Self::InvokeContractArgs(_) => TypeVariant::InvokeContractArgs,
63010            Self::HostFunction(_) => TypeVariant::HostFunction,
63011            Self::SorobanAuthorizedFunctionType(_) => TypeVariant::SorobanAuthorizedFunctionType,
63012            Self::SorobanAuthorizedFunction(_) => TypeVariant::SorobanAuthorizedFunction,
63013            Self::SorobanAuthorizedInvocation(_) => TypeVariant::SorobanAuthorizedInvocation,
63014            Self::SorobanAddressCredentials(_) => TypeVariant::SorobanAddressCredentials,
63015            Self::SorobanCredentialsType(_) => TypeVariant::SorobanCredentialsType,
63016            Self::SorobanCredentials(_) => TypeVariant::SorobanCredentials,
63017            Self::SorobanAuthorizationEntry(_) => TypeVariant::SorobanAuthorizationEntry,
63018            Self::InvokeHostFunctionOp(_) => TypeVariant::InvokeHostFunctionOp,
63019            Self::ExtendFootprintTtlOp(_) => TypeVariant::ExtendFootprintTtlOp,
63020            Self::RestoreFootprintOp(_) => TypeVariant::RestoreFootprintOp,
63021            Self::Operation(_) => TypeVariant::Operation,
63022            Self::OperationBody(_) => TypeVariant::OperationBody,
63023            Self::HashIdPreimage(_) => TypeVariant::HashIdPreimage,
63024            Self::HashIdPreimageOperationId(_) => TypeVariant::HashIdPreimageOperationId,
63025            Self::HashIdPreimageRevokeId(_) => TypeVariant::HashIdPreimageRevokeId,
63026            Self::HashIdPreimageContractId(_) => TypeVariant::HashIdPreimageContractId,
63027            Self::HashIdPreimageSorobanAuthorization(_) => {
63028                TypeVariant::HashIdPreimageSorobanAuthorization
63029            }
63030            Self::MemoType(_) => TypeVariant::MemoType,
63031            Self::Memo(_) => TypeVariant::Memo,
63032            Self::TimeBounds(_) => TypeVariant::TimeBounds,
63033            Self::LedgerBounds(_) => TypeVariant::LedgerBounds,
63034            Self::PreconditionsV2(_) => TypeVariant::PreconditionsV2,
63035            Self::PreconditionType(_) => TypeVariant::PreconditionType,
63036            Self::Preconditions(_) => TypeVariant::Preconditions,
63037            Self::LedgerFootprint(_) => TypeVariant::LedgerFootprint,
63038            Self::ArchivalProofType(_) => TypeVariant::ArchivalProofType,
63039            Self::ArchivalProofNode(_) => TypeVariant::ArchivalProofNode,
63040            Self::ProofLevel(_) => TypeVariant::ProofLevel,
63041            Self::NonexistenceProofBody(_) => TypeVariant::NonexistenceProofBody,
63042            Self::ExistenceProofBody(_) => TypeVariant::ExistenceProofBody,
63043            Self::ArchivalProof(_) => TypeVariant::ArchivalProof,
63044            Self::ArchivalProofBody(_) => TypeVariant::ArchivalProofBody,
63045            Self::SorobanResources(_) => TypeVariant::SorobanResources,
63046            Self::SorobanTransactionData(_) => TypeVariant::SorobanTransactionData,
63047            Self::TransactionV0(_) => TypeVariant::TransactionV0,
63048            Self::TransactionV0Ext(_) => TypeVariant::TransactionV0Ext,
63049            Self::TransactionV0Envelope(_) => TypeVariant::TransactionV0Envelope,
63050            Self::Transaction(_) => TypeVariant::Transaction,
63051            Self::TransactionExt(_) => TypeVariant::TransactionExt,
63052            Self::TransactionV1Envelope(_) => TypeVariant::TransactionV1Envelope,
63053            Self::FeeBumpTransaction(_) => TypeVariant::FeeBumpTransaction,
63054            Self::FeeBumpTransactionInnerTx(_) => TypeVariant::FeeBumpTransactionInnerTx,
63055            Self::FeeBumpTransactionExt(_) => TypeVariant::FeeBumpTransactionExt,
63056            Self::FeeBumpTransactionEnvelope(_) => TypeVariant::FeeBumpTransactionEnvelope,
63057            Self::TransactionEnvelope(_) => TypeVariant::TransactionEnvelope,
63058            Self::TransactionSignaturePayload(_) => TypeVariant::TransactionSignaturePayload,
63059            Self::TransactionSignaturePayloadTaggedTransaction(_) => {
63060                TypeVariant::TransactionSignaturePayloadTaggedTransaction
63061            }
63062            Self::ClaimAtomType(_) => TypeVariant::ClaimAtomType,
63063            Self::ClaimOfferAtomV0(_) => TypeVariant::ClaimOfferAtomV0,
63064            Self::ClaimOfferAtom(_) => TypeVariant::ClaimOfferAtom,
63065            Self::ClaimLiquidityAtom(_) => TypeVariant::ClaimLiquidityAtom,
63066            Self::ClaimAtom(_) => TypeVariant::ClaimAtom,
63067            Self::CreateAccountResultCode(_) => TypeVariant::CreateAccountResultCode,
63068            Self::CreateAccountResult(_) => TypeVariant::CreateAccountResult,
63069            Self::PaymentResultCode(_) => TypeVariant::PaymentResultCode,
63070            Self::PaymentResult(_) => TypeVariant::PaymentResult,
63071            Self::PathPaymentStrictReceiveResultCode(_) => {
63072                TypeVariant::PathPaymentStrictReceiveResultCode
63073            }
63074            Self::SimplePaymentResult(_) => TypeVariant::SimplePaymentResult,
63075            Self::PathPaymentStrictReceiveResult(_) => TypeVariant::PathPaymentStrictReceiveResult,
63076            Self::PathPaymentStrictReceiveResultSuccess(_) => {
63077                TypeVariant::PathPaymentStrictReceiveResultSuccess
63078            }
63079            Self::PathPaymentStrictSendResultCode(_) => {
63080                TypeVariant::PathPaymentStrictSendResultCode
63081            }
63082            Self::PathPaymentStrictSendResult(_) => TypeVariant::PathPaymentStrictSendResult,
63083            Self::PathPaymentStrictSendResultSuccess(_) => {
63084                TypeVariant::PathPaymentStrictSendResultSuccess
63085            }
63086            Self::ManageSellOfferResultCode(_) => TypeVariant::ManageSellOfferResultCode,
63087            Self::ManageOfferEffect(_) => TypeVariant::ManageOfferEffect,
63088            Self::ManageOfferSuccessResult(_) => TypeVariant::ManageOfferSuccessResult,
63089            Self::ManageOfferSuccessResultOffer(_) => TypeVariant::ManageOfferSuccessResultOffer,
63090            Self::ManageSellOfferResult(_) => TypeVariant::ManageSellOfferResult,
63091            Self::ManageBuyOfferResultCode(_) => TypeVariant::ManageBuyOfferResultCode,
63092            Self::ManageBuyOfferResult(_) => TypeVariant::ManageBuyOfferResult,
63093            Self::SetOptionsResultCode(_) => TypeVariant::SetOptionsResultCode,
63094            Self::SetOptionsResult(_) => TypeVariant::SetOptionsResult,
63095            Self::ChangeTrustResultCode(_) => TypeVariant::ChangeTrustResultCode,
63096            Self::ChangeTrustResult(_) => TypeVariant::ChangeTrustResult,
63097            Self::AllowTrustResultCode(_) => TypeVariant::AllowTrustResultCode,
63098            Self::AllowTrustResult(_) => TypeVariant::AllowTrustResult,
63099            Self::AccountMergeResultCode(_) => TypeVariant::AccountMergeResultCode,
63100            Self::AccountMergeResult(_) => TypeVariant::AccountMergeResult,
63101            Self::InflationResultCode(_) => TypeVariant::InflationResultCode,
63102            Self::InflationPayout(_) => TypeVariant::InflationPayout,
63103            Self::InflationResult(_) => TypeVariant::InflationResult,
63104            Self::ManageDataResultCode(_) => TypeVariant::ManageDataResultCode,
63105            Self::ManageDataResult(_) => TypeVariant::ManageDataResult,
63106            Self::BumpSequenceResultCode(_) => TypeVariant::BumpSequenceResultCode,
63107            Self::BumpSequenceResult(_) => TypeVariant::BumpSequenceResult,
63108            Self::CreateClaimableBalanceResultCode(_) => {
63109                TypeVariant::CreateClaimableBalanceResultCode
63110            }
63111            Self::CreateClaimableBalanceResult(_) => TypeVariant::CreateClaimableBalanceResult,
63112            Self::ClaimClaimableBalanceResultCode(_) => {
63113                TypeVariant::ClaimClaimableBalanceResultCode
63114            }
63115            Self::ClaimClaimableBalanceResult(_) => TypeVariant::ClaimClaimableBalanceResult,
63116            Self::BeginSponsoringFutureReservesResultCode(_) => {
63117                TypeVariant::BeginSponsoringFutureReservesResultCode
63118            }
63119            Self::BeginSponsoringFutureReservesResult(_) => {
63120                TypeVariant::BeginSponsoringFutureReservesResult
63121            }
63122            Self::EndSponsoringFutureReservesResultCode(_) => {
63123                TypeVariant::EndSponsoringFutureReservesResultCode
63124            }
63125            Self::EndSponsoringFutureReservesResult(_) => {
63126                TypeVariant::EndSponsoringFutureReservesResult
63127            }
63128            Self::RevokeSponsorshipResultCode(_) => TypeVariant::RevokeSponsorshipResultCode,
63129            Self::RevokeSponsorshipResult(_) => TypeVariant::RevokeSponsorshipResult,
63130            Self::ClawbackResultCode(_) => TypeVariant::ClawbackResultCode,
63131            Self::ClawbackResult(_) => TypeVariant::ClawbackResult,
63132            Self::ClawbackClaimableBalanceResultCode(_) => {
63133                TypeVariant::ClawbackClaimableBalanceResultCode
63134            }
63135            Self::ClawbackClaimableBalanceResult(_) => TypeVariant::ClawbackClaimableBalanceResult,
63136            Self::SetTrustLineFlagsResultCode(_) => TypeVariant::SetTrustLineFlagsResultCode,
63137            Self::SetTrustLineFlagsResult(_) => TypeVariant::SetTrustLineFlagsResult,
63138            Self::LiquidityPoolDepositResultCode(_) => TypeVariant::LiquidityPoolDepositResultCode,
63139            Self::LiquidityPoolDepositResult(_) => TypeVariant::LiquidityPoolDepositResult,
63140            Self::LiquidityPoolWithdrawResultCode(_) => {
63141                TypeVariant::LiquidityPoolWithdrawResultCode
63142            }
63143            Self::LiquidityPoolWithdrawResult(_) => TypeVariant::LiquidityPoolWithdrawResult,
63144            Self::InvokeHostFunctionResultCode(_) => TypeVariant::InvokeHostFunctionResultCode,
63145            Self::InvokeHostFunctionResult(_) => TypeVariant::InvokeHostFunctionResult,
63146            Self::ExtendFootprintTtlResultCode(_) => TypeVariant::ExtendFootprintTtlResultCode,
63147            Self::ExtendFootprintTtlResult(_) => TypeVariant::ExtendFootprintTtlResult,
63148            Self::RestoreFootprintResultCode(_) => TypeVariant::RestoreFootprintResultCode,
63149            Self::RestoreFootprintResult(_) => TypeVariant::RestoreFootprintResult,
63150            Self::OperationResultCode(_) => TypeVariant::OperationResultCode,
63151            Self::OperationResult(_) => TypeVariant::OperationResult,
63152            Self::OperationResultTr(_) => TypeVariant::OperationResultTr,
63153            Self::TransactionResultCode(_) => TypeVariant::TransactionResultCode,
63154            Self::InnerTransactionResult(_) => TypeVariant::InnerTransactionResult,
63155            Self::InnerTransactionResultResult(_) => TypeVariant::InnerTransactionResultResult,
63156            Self::InnerTransactionResultExt(_) => TypeVariant::InnerTransactionResultExt,
63157            Self::InnerTransactionResultPair(_) => TypeVariant::InnerTransactionResultPair,
63158            Self::TransactionResult(_) => TypeVariant::TransactionResult,
63159            Self::TransactionResultResult(_) => TypeVariant::TransactionResultResult,
63160            Self::TransactionResultExt(_) => TypeVariant::TransactionResultExt,
63161            Self::Hash(_) => TypeVariant::Hash,
63162            Self::Uint256(_) => TypeVariant::Uint256,
63163            Self::Uint32(_) => TypeVariant::Uint32,
63164            Self::Int32(_) => TypeVariant::Int32,
63165            Self::Uint64(_) => TypeVariant::Uint64,
63166            Self::Int64(_) => TypeVariant::Int64,
63167            Self::TimePoint(_) => TypeVariant::TimePoint,
63168            Self::Duration(_) => TypeVariant::Duration,
63169            Self::ExtensionPoint(_) => TypeVariant::ExtensionPoint,
63170            Self::CryptoKeyType(_) => TypeVariant::CryptoKeyType,
63171            Self::PublicKeyType(_) => TypeVariant::PublicKeyType,
63172            Self::SignerKeyType(_) => TypeVariant::SignerKeyType,
63173            Self::PublicKey(_) => TypeVariant::PublicKey,
63174            Self::SignerKey(_) => TypeVariant::SignerKey,
63175            Self::SignerKeyEd25519SignedPayload(_) => TypeVariant::SignerKeyEd25519SignedPayload,
63176            Self::Signature(_) => TypeVariant::Signature,
63177            Self::SignatureHint(_) => TypeVariant::SignatureHint,
63178            Self::NodeId(_) => TypeVariant::NodeId,
63179            Self::AccountId(_) => TypeVariant::AccountId,
63180            Self::Curve25519Secret(_) => TypeVariant::Curve25519Secret,
63181            Self::Curve25519Public(_) => TypeVariant::Curve25519Public,
63182            Self::HmacSha256Key(_) => TypeVariant::HmacSha256Key,
63183            Self::HmacSha256Mac(_) => TypeVariant::HmacSha256Mac,
63184            Self::ShortHashSeed(_) => TypeVariant::ShortHashSeed,
63185            Self::BinaryFuseFilterType(_) => TypeVariant::BinaryFuseFilterType,
63186            Self::SerializedBinaryFuseFilter(_) => TypeVariant::SerializedBinaryFuseFilter,
63187        }
63188    }
63189}
63190
63191impl Name for Type {
63192    #[must_use]
63193    fn name(&self) -> &'static str {
63194        Self::name(self)
63195    }
63196}
63197
63198impl Variants<TypeVariant> for Type {
63199    fn variants() -> slice::Iter<'static, TypeVariant> {
63200        Self::VARIANTS.iter()
63201    }
63202}
63203
63204impl WriteXdr for Type {
63205    #[cfg(feature = "std")]
63206    #[allow(clippy::too_many_lines)]
63207    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
63208        match self {
63209            Self::Value(v) => v.write_xdr(w),
63210            Self::ScpBallot(v) => v.write_xdr(w),
63211            Self::ScpStatementType(v) => v.write_xdr(w),
63212            Self::ScpNomination(v) => v.write_xdr(w),
63213            Self::ScpStatement(v) => v.write_xdr(w),
63214            Self::ScpStatementPledges(v) => v.write_xdr(w),
63215            Self::ScpStatementPrepare(v) => v.write_xdr(w),
63216            Self::ScpStatementConfirm(v) => v.write_xdr(w),
63217            Self::ScpStatementExternalize(v) => v.write_xdr(w),
63218            Self::ScpEnvelope(v) => v.write_xdr(w),
63219            Self::ScpQuorumSet(v) => v.write_xdr(w),
63220            Self::ConfigSettingContractExecutionLanesV0(v) => v.write_xdr(w),
63221            Self::ConfigSettingContractComputeV0(v) => v.write_xdr(w),
63222            Self::ConfigSettingContractLedgerCostV0(v) => v.write_xdr(w),
63223            Self::ConfigSettingContractHistoricalDataV0(v) => v.write_xdr(w),
63224            Self::ConfigSettingContractEventsV0(v) => v.write_xdr(w),
63225            Self::ConfigSettingContractBandwidthV0(v) => v.write_xdr(w),
63226            Self::ContractCostType(v) => v.write_xdr(w),
63227            Self::ContractCostParamEntry(v) => v.write_xdr(w),
63228            Self::StateArchivalSettings(v) => v.write_xdr(w),
63229            Self::EvictionIterator(v) => v.write_xdr(w),
63230            Self::ContractCostParams(v) => v.write_xdr(w),
63231            Self::ConfigSettingId(v) => v.write_xdr(w),
63232            Self::ConfigSettingEntry(v) => v.write_xdr(w),
63233            Self::ScEnvMetaKind(v) => v.write_xdr(w),
63234            Self::ScEnvMetaEntry(v) => v.write_xdr(w),
63235            Self::ScEnvMetaEntryInterfaceVersion(v) => v.write_xdr(w),
63236            Self::ScMetaV0(v) => v.write_xdr(w),
63237            Self::ScMetaKind(v) => v.write_xdr(w),
63238            Self::ScMetaEntry(v) => v.write_xdr(w),
63239            Self::ScSpecType(v) => v.write_xdr(w),
63240            Self::ScSpecTypeOption(v) => v.write_xdr(w),
63241            Self::ScSpecTypeResult(v) => v.write_xdr(w),
63242            Self::ScSpecTypeVec(v) => v.write_xdr(w),
63243            Self::ScSpecTypeMap(v) => v.write_xdr(w),
63244            Self::ScSpecTypeTuple(v) => v.write_xdr(w),
63245            Self::ScSpecTypeBytesN(v) => v.write_xdr(w),
63246            Self::ScSpecTypeUdt(v) => v.write_xdr(w),
63247            Self::ScSpecTypeDef(v) => v.write_xdr(w),
63248            Self::ScSpecUdtStructFieldV0(v) => v.write_xdr(w),
63249            Self::ScSpecUdtStructV0(v) => v.write_xdr(w),
63250            Self::ScSpecUdtUnionCaseVoidV0(v) => v.write_xdr(w),
63251            Self::ScSpecUdtUnionCaseTupleV0(v) => v.write_xdr(w),
63252            Self::ScSpecUdtUnionCaseV0Kind(v) => v.write_xdr(w),
63253            Self::ScSpecUdtUnionCaseV0(v) => v.write_xdr(w),
63254            Self::ScSpecUdtUnionV0(v) => v.write_xdr(w),
63255            Self::ScSpecUdtEnumCaseV0(v) => v.write_xdr(w),
63256            Self::ScSpecUdtEnumV0(v) => v.write_xdr(w),
63257            Self::ScSpecUdtErrorEnumCaseV0(v) => v.write_xdr(w),
63258            Self::ScSpecUdtErrorEnumV0(v) => v.write_xdr(w),
63259            Self::ScSpecFunctionInputV0(v) => v.write_xdr(w),
63260            Self::ScSpecFunctionV0(v) => v.write_xdr(w),
63261            Self::ScSpecEntryKind(v) => v.write_xdr(w),
63262            Self::ScSpecEntry(v) => v.write_xdr(w),
63263            Self::ScValType(v) => v.write_xdr(w),
63264            Self::ScErrorType(v) => v.write_xdr(w),
63265            Self::ScErrorCode(v) => v.write_xdr(w),
63266            Self::ScError(v) => v.write_xdr(w),
63267            Self::UInt128Parts(v) => v.write_xdr(w),
63268            Self::Int128Parts(v) => v.write_xdr(w),
63269            Self::UInt256Parts(v) => v.write_xdr(w),
63270            Self::Int256Parts(v) => v.write_xdr(w),
63271            Self::ContractExecutableType(v) => v.write_xdr(w),
63272            Self::ContractExecutable(v) => v.write_xdr(w),
63273            Self::ScAddressType(v) => v.write_xdr(w),
63274            Self::ScAddress(v) => v.write_xdr(w),
63275            Self::ScVec(v) => v.write_xdr(w),
63276            Self::ScMap(v) => v.write_xdr(w),
63277            Self::ScBytes(v) => v.write_xdr(w),
63278            Self::ScString(v) => v.write_xdr(w),
63279            Self::ScSymbol(v) => v.write_xdr(w),
63280            Self::ScNonceKey(v) => v.write_xdr(w),
63281            Self::ScContractInstance(v) => v.write_xdr(w),
63282            Self::ScVal(v) => v.write_xdr(w),
63283            Self::ScMapEntry(v) => v.write_xdr(w),
63284            Self::StoredTransactionSet(v) => v.write_xdr(w),
63285            Self::StoredDebugTransactionSet(v) => v.write_xdr(w),
63286            Self::PersistedScpStateV0(v) => v.write_xdr(w),
63287            Self::PersistedScpStateV1(v) => v.write_xdr(w),
63288            Self::PersistedScpState(v) => v.write_xdr(w),
63289            Self::Thresholds(v) => v.write_xdr(w),
63290            Self::String32(v) => v.write_xdr(w),
63291            Self::String64(v) => v.write_xdr(w),
63292            Self::SequenceNumber(v) => v.write_xdr(w),
63293            Self::DataValue(v) => v.write_xdr(w),
63294            Self::PoolId(v) => v.write_xdr(w),
63295            Self::AssetCode4(v) => v.write_xdr(w),
63296            Self::AssetCode12(v) => v.write_xdr(w),
63297            Self::AssetType(v) => v.write_xdr(w),
63298            Self::AssetCode(v) => v.write_xdr(w),
63299            Self::AlphaNum4(v) => v.write_xdr(w),
63300            Self::AlphaNum12(v) => v.write_xdr(w),
63301            Self::Asset(v) => v.write_xdr(w),
63302            Self::Price(v) => v.write_xdr(w),
63303            Self::Liabilities(v) => v.write_xdr(w),
63304            Self::ThresholdIndexes(v) => v.write_xdr(w),
63305            Self::LedgerEntryType(v) => v.write_xdr(w),
63306            Self::Signer(v) => v.write_xdr(w),
63307            Self::AccountFlags(v) => v.write_xdr(w),
63308            Self::SponsorshipDescriptor(v) => v.write_xdr(w),
63309            Self::AccountEntryExtensionV3(v) => v.write_xdr(w),
63310            Self::AccountEntryExtensionV2(v) => v.write_xdr(w),
63311            Self::AccountEntryExtensionV2Ext(v) => v.write_xdr(w),
63312            Self::AccountEntryExtensionV1(v) => v.write_xdr(w),
63313            Self::AccountEntryExtensionV1Ext(v) => v.write_xdr(w),
63314            Self::AccountEntry(v) => v.write_xdr(w),
63315            Self::AccountEntryExt(v) => v.write_xdr(w),
63316            Self::TrustLineFlags(v) => v.write_xdr(w),
63317            Self::LiquidityPoolType(v) => v.write_xdr(w),
63318            Self::TrustLineAsset(v) => v.write_xdr(w),
63319            Self::TrustLineEntryExtensionV2(v) => v.write_xdr(w),
63320            Self::TrustLineEntryExtensionV2Ext(v) => v.write_xdr(w),
63321            Self::TrustLineEntry(v) => v.write_xdr(w),
63322            Self::TrustLineEntryExt(v) => v.write_xdr(w),
63323            Self::TrustLineEntryV1(v) => v.write_xdr(w),
63324            Self::TrustLineEntryV1Ext(v) => v.write_xdr(w),
63325            Self::OfferEntryFlags(v) => v.write_xdr(w),
63326            Self::OfferEntry(v) => v.write_xdr(w),
63327            Self::OfferEntryExt(v) => v.write_xdr(w),
63328            Self::DataEntry(v) => v.write_xdr(w),
63329            Self::DataEntryExt(v) => v.write_xdr(w),
63330            Self::ClaimPredicateType(v) => v.write_xdr(w),
63331            Self::ClaimPredicate(v) => v.write_xdr(w),
63332            Self::ClaimantType(v) => v.write_xdr(w),
63333            Self::Claimant(v) => v.write_xdr(w),
63334            Self::ClaimantV0(v) => v.write_xdr(w),
63335            Self::ClaimableBalanceIdType(v) => v.write_xdr(w),
63336            Self::ClaimableBalanceId(v) => v.write_xdr(w),
63337            Self::ClaimableBalanceFlags(v) => v.write_xdr(w),
63338            Self::ClaimableBalanceEntryExtensionV1(v) => v.write_xdr(w),
63339            Self::ClaimableBalanceEntryExtensionV1Ext(v) => v.write_xdr(w),
63340            Self::ClaimableBalanceEntry(v) => v.write_xdr(w),
63341            Self::ClaimableBalanceEntryExt(v) => v.write_xdr(w),
63342            Self::LiquidityPoolConstantProductParameters(v) => v.write_xdr(w),
63343            Self::LiquidityPoolEntry(v) => v.write_xdr(w),
63344            Self::LiquidityPoolEntryBody(v) => v.write_xdr(w),
63345            Self::LiquidityPoolEntryConstantProduct(v) => v.write_xdr(w),
63346            Self::ContractDataDurability(v) => v.write_xdr(w),
63347            Self::ContractDataEntry(v) => v.write_xdr(w),
63348            Self::ContractCodeCostInputs(v) => v.write_xdr(w),
63349            Self::ContractCodeEntry(v) => v.write_xdr(w),
63350            Self::ContractCodeEntryExt(v) => v.write_xdr(w),
63351            Self::ContractCodeEntryV1(v) => v.write_xdr(w),
63352            Self::TtlEntry(v) => v.write_xdr(w),
63353            Self::LedgerEntryExtensionV1(v) => v.write_xdr(w),
63354            Self::LedgerEntryExtensionV1Ext(v) => v.write_xdr(w),
63355            Self::LedgerEntry(v) => v.write_xdr(w),
63356            Self::LedgerEntryData(v) => v.write_xdr(w),
63357            Self::LedgerEntryExt(v) => v.write_xdr(w),
63358            Self::LedgerKey(v) => v.write_xdr(w),
63359            Self::LedgerKeyAccount(v) => v.write_xdr(w),
63360            Self::LedgerKeyTrustLine(v) => v.write_xdr(w),
63361            Self::LedgerKeyOffer(v) => v.write_xdr(w),
63362            Self::LedgerKeyData(v) => v.write_xdr(w),
63363            Self::LedgerKeyClaimableBalance(v) => v.write_xdr(w),
63364            Self::LedgerKeyLiquidityPool(v) => v.write_xdr(w),
63365            Self::LedgerKeyContractData(v) => v.write_xdr(w),
63366            Self::LedgerKeyContractCode(v) => v.write_xdr(w),
63367            Self::LedgerKeyConfigSetting(v) => v.write_xdr(w),
63368            Self::LedgerKeyTtl(v) => v.write_xdr(w),
63369            Self::EnvelopeType(v) => v.write_xdr(w),
63370            Self::BucketListType(v) => v.write_xdr(w),
63371            Self::BucketEntryType(v) => v.write_xdr(w),
63372            Self::HotArchiveBucketEntryType(v) => v.write_xdr(w),
63373            Self::ColdArchiveBucketEntryType(v) => v.write_xdr(w),
63374            Self::BucketMetadata(v) => v.write_xdr(w),
63375            Self::BucketMetadataExt(v) => v.write_xdr(w),
63376            Self::BucketEntry(v) => v.write_xdr(w),
63377            Self::HotArchiveBucketEntry(v) => v.write_xdr(w),
63378            Self::ColdArchiveArchivedLeaf(v) => v.write_xdr(w),
63379            Self::ColdArchiveDeletedLeaf(v) => v.write_xdr(w),
63380            Self::ColdArchiveBoundaryLeaf(v) => v.write_xdr(w),
63381            Self::ColdArchiveHashEntry(v) => v.write_xdr(w),
63382            Self::ColdArchiveBucketEntry(v) => v.write_xdr(w),
63383            Self::UpgradeType(v) => v.write_xdr(w),
63384            Self::StellarValueType(v) => v.write_xdr(w),
63385            Self::LedgerCloseValueSignature(v) => v.write_xdr(w),
63386            Self::StellarValue(v) => v.write_xdr(w),
63387            Self::StellarValueExt(v) => v.write_xdr(w),
63388            Self::LedgerHeaderFlags(v) => v.write_xdr(w),
63389            Self::LedgerHeaderExtensionV1(v) => v.write_xdr(w),
63390            Self::LedgerHeaderExtensionV1Ext(v) => v.write_xdr(w),
63391            Self::LedgerHeader(v) => v.write_xdr(w),
63392            Self::LedgerHeaderExt(v) => v.write_xdr(w),
63393            Self::LedgerUpgradeType(v) => v.write_xdr(w),
63394            Self::ConfigUpgradeSetKey(v) => v.write_xdr(w),
63395            Self::LedgerUpgrade(v) => v.write_xdr(w),
63396            Self::ConfigUpgradeSet(v) => v.write_xdr(w),
63397            Self::TxSetComponentType(v) => v.write_xdr(w),
63398            Self::TxSetComponent(v) => v.write_xdr(w),
63399            Self::TxSetComponentTxsMaybeDiscountedFee(v) => v.write_xdr(w),
63400            Self::TransactionPhase(v) => v.write_xdr(w),
63401            Self::TransactionSet(v) => v.write_xdr(w),
63402            Self::TransactionSetV1(v) => v.write_xdr(w),
63403            Self::GeneralizedTransactionSet(v) => v.write_xdr(w),
63404            Self::TransactionResultPair(v) => v.write_xdr(w),
63405            Self::TransactionResultSet(v) => v.write_xdr(w),
63406            Self::TransactionHistoryEntry(v) => v.write_xdr(w),
63407            Self::TransactionHistoryEntryExt(v) => v.write_xdr(w),
63408            Self::TransactionHistoryResultEntry(v) => v.write_xdr(w),
63409            Self::TransactionHistoryResultEntryExt(v) => v.write_xdr(w),
63410            Self::LedgerHeaderHistoryEntry(v) => v.write_xdr(w),
63411            Self::LedgerHeaderHistoryEntryExt(v) => v.write_xdr(w),
63412            Self::LedgerScpMessages(v) => v.write_xdr(w),
63413            Self::ScpHistoryEntryV0(v) => v.write_xdr(w),
63414            Self::ScpHistoryEntry(v) => v.write_xdr(w),
63415            Self::LedgerEntryChangeType(v) => v.write_xdr(w),
63416            Self::LedgerEntryChange(v) => v.write_xdr(w),
63417            Self::LedgerEntryChanges(v) => v.write_xdr(w),
63418            Self::OperationMeta(v) => v.write_xdr(w),
63419            Self::TransactionMetaV1(v) => v.write_xdr(w),
63420            Self::TransactionMetaV2(v) => v.write_xdr(w),
63421            Self::ContractEventType(v) => v.write_xdr(w),
63422            Self::ContractEvent(v) => v.write_xdr(w),
63423            Self::ContractEventBody(v) => v.write_xdr(w),
63424            Self::ContractEventV0(v) => v.write_xdr(w),
63425            Self::DiagnosticEvent(v) => v.write_xdr(w),
63426            Self::DiagnosticEvents(v) => v.write_xdr(w),
63427            Self::SorobanTransactionMetaExtV1(v) => v.write_xdr(w),
63428            Self::SorobanTransactionMetaExt(v) => v.write_xdr(w),
63429            Self::SorobanTransactionMeta(v) => v.write_xdr(w),
63430            Self::TransactionMetaV3(v) => v.write_xdr(w),
63431            Self::InvokeHostFunctionSuccessPreImage(v) => v.write_xdr(w),
63432            Self::TransactionMeta(v) => v.write_xdr(w),
63433            Self::TransactionResultMeta(v) => v.write_xdr(w),
63434            Self::UpgradeEntryMeta(v) => v.write_xdr(w),
63435            Self::LedgerCloseMetaV0(v) => v.write_xdr(w),
63436            Self::LedgerCloseMetaExtV1(v) => v.write_xdr(w),
63437            Self::LedgerCloseMetaExt(v) => v.write_xdr(w),
63438            Self::LedgerCloseMetaV1(v) => v.write_xdr(w),
63439            Self::LedgerCloseMeta(v) => v.write_xdr(w),
63440            Self::ErrorCode(v) => v.write_xdr(w),
63441            Self::SError(v) => v.write_xdr(w),
63442            Self::SendMore(v) => v.write_xdr(w),
63443            Self::SendMoreExtended(v) => v.write_xdr(w),
63444            Self::AuthCert(v) => v.write_xdr(w),
63445            Self::Hello(v) => v.write_xdr(w),
63446            Self::Auth(v) => v.write_xdr(w),
63447            Self::IpAddrType(v) => v.write_xdr(w),
63448            Self::PeerAddress(v) => v.write_xdr(w),
63449            Self::PeerAddressIp(v) => v.write_xdr(w),
63450            Self::MessageType(v) => v.write_xdr(w),
63451            Self::DontHave(v) => v.write_xdr(w),
63452            Self::SurveyMessageCommandType(v) => v.write_xdr(w),
63453            Self::SurveyMessageResponseType(v) => v.write_xdr(w),
63454            Self::TimeSlicedSurveyStartCollectingMessage(v) => v.write_xdr(w),
63455            Self::SignedTimeSlicedSurveyStartCollectingMessage(v) => v.write_xdr(w),
63456            Self::TimeSlicedSurveyStopCollectingMessage(v) => v.write_xdr(w),
63457            Self::SignedTimeSlicedSurveyStopCollectingMessage(v) => v.write_xdr(w),
63458            Self::SurveyRequestMessage(v) => v.write_xdr(w),
63459            Self::TimeSlicedSurveyRequestMessage(v) => v.write_xdr(w),
63460            Self::SignedSurveyRequestMessage(v) => v.write_xdr(w),
63461            Self::SignedTimeSlicedSurveyRequestMessage(v) => v.write_xdr(w),
63462            Self::EncryptedBody(v) => v.write_xdr(w),
63463            Self::SurveyResponseMessage(v) => v.write_xdr(w),
63464            Self::TimeSlicedSurveyResponseMessage(v) => v.write_xdr(w),
63465            Self::SignedSurveyResponseMessage(v) => v.write_xdr(w),
63466            Self::SignedTimeSlicedSurveyResponseMessage(v) => v.write_xdr(w),
63467            Self::PeerStats(v) => v.write_xdr(w),
63468            Self::PeerStatList(v) => v.write_xdr(w),
63469            Self::TimeSlicedNodeData(v) => v.write_xdr(w),
63470            Self::TimeSlicedPeerData(v) => v.write_xdr(w),
63471            Self::TimeSlicedPeerDataList(v) => v.write_xdr(w),
63472            Self::TopologyResponseBodyV0(v) => v.write_xdr(w),
63473            Self::TopologyResponseBodyV1(v) => v.write_xdr(w),
63474            Self::TopologyResponseBodyV2(v) => v.write_xdr(w),
63475            Self::SurveyResponseBody(v) => v.write_xdr(w),
63476            Self::TxAdvertVector(v) => v.write_xdr(w),
63477            Self::FloodAdvert(v) => v.write_xdr(w),
63478            Self::TxDemandVector(v) => v.write_xdr(w),
63479            Self::FloodDemand(v) => v.write_xdr(w),
63480            Self::StellarMessage(v) => v.write_xdr(w),
63481            Self::AuthenticatedMessage(v) => v.write_xdr(w),
63482            Self::AuthenticatedMessageV0(v) => v.write_xdr(w),
63483            Self::LiquidityPoolParameters(v) => v.write_xdr(w),
63484            Self::MuxedAccount(v) => v.write_xdr(w),
63485            Self::MuxedAccountMed25519(v) => v.write_xdr(w),
63486            Self::DecoratedSignature(v) => v.write_xdr(w),
63487            Self::OperationType(v) => v.write_xdr(w),
63488            Self::CreateAccountOp(v) => v.write_xdr(w),
63489            Self::PaymentOp(v) => v.write_xdr(w),
63490            Self::PathPaymentStrictReceiveOp(v) => v.write_xdr(w),
63491            Self::PathPaymentStrictSendOp(v) => v.write_xdr(w),
63492            Self::ManageSellOfferOp(v) => v.write_xdr(w),
63493            Self::ManageBuyOfferOp(v) => v.write_xdr(w),
63494            Self::CreatePassiveSellOfferOp(v) => v.write_xdr(w),
63495            Self::SetOptionsOp(v) => v.write_xdr(w),
63496            Self::ChangeTrustAsset(v) => v.write_xdr(w),
63497            Self::ChangeTrustOp(v) => v.write_xdr(w),
63498            Self::AllowTrustOp(v) => v.write_xdr(w),
63499            Self::ManageDataOp(v) => v.write_xdr(w),
63500            Self::BumpSequenceOp(v) => v.write_xdr(w),
63501            Self::CreateClaimableBalanceOp(v) => v.write_xdr(w),
63502            Self::ClaimClaimableBalanceOp(v) => v.write_xdr(w),
63503            Self::BeginSponsoringFutureReservesOp(v) => v.write_xdr(w),
63504            Self::RevokeSponsorshipType(v) => v.write_xdr(w),
63505            Self::RevokeSponsorshipOp(v) => v.write_xdr(w),
63506            Self::RevokeSponsorshipOpSigner(v) => v.write_xdr(w),
63507            Self::ClawbackOp(v) => v.write_xdr(w),
63508            Self::ClawbackClaimableBalanceOp(v) => v.write_xdr(w),
63509            Self::SetTrustLineFlagsOp(v) => v.write_xdr(w),
63510            Self::LiquidityPoolDepositOp(v) => v.write_xdr(w),
63511            Self::LiquidityPoolWithdrawOp(v) => v.write_xdr(w),
63512            Self::HostFunctionType(v) => v.write_xdr(w),
63513            Self::ContractIdPreimageType(v) => v.write_xdr(w),
63514            Self::ContractIdPreimage(v) => v.write_xdr(w),
63515            Self::ContractIdPreimageFromAddress(v) => v.write_xdr(w),
63516            Self::CreateContractArgs(v) => v.write_xdr(w),
63517            Self::CreateContractArgsV2(v) => v.write_xdr(w),
63518            Self::InvokeContractArgs(v) => v.write_xdr(w),
63519            Self::HostFunction(v) => v.write_xdr(w),
63520            Self::SorobanAuthorizedFunctionType(v) => v.write_xdr(w),
63521            Self::SorobanAuthorizedFunction(v) => v.write_xdr(w),
63522            Self::SorobanAuthorizedInvocation(v) => v.write_xdr(w),
63523            Self::SorobanAddressCredentials(v) => v.write_xdr(w),
63524            Self::SorobanCredentialsType(v) => v.write_xdr(w),
63525            Self::SorobanCredentials(v) => v.write_xdr(w),
63526            Self::SorobanAuthorizationEntry(v) => v.write_xdr(w),
63527            Self::InvokeHostFunctionOp(v) => v.write_xdr(w),
63528            Self::ExtendFootprintTtlOp(v) => v.write_xdr(w),
63529            Self::RestoreFootprintOp(v) => v.write_xdr(w),
63530            Self::Operation(v) => v.write_xdr(w),
63531            Self::OperationBody(v) => v.write_xdr(w),
63532            Self::HashIdPreimage(v) => v.write_xdr(w),
63533            Self::HashIdPreimageOperationId(v) => v.write_xdr(w),
63534            Self::HashIdPreimageRevokeId(v) => v.write_xdr(w),
63535            Self::HashIdPreimageContractId(v) => v.write_xdr(w),
63536            Self::HashIdPreimageSorobanAuthorization(v) => v.write_xdr(w),
63537            Self::MemoType(v) => v.write_xdr(w),
63538            Self::Memo(v) => v.write_xdr(w),
63539            Self::TimeBounds(v) => v.write_xdr(w),
63540            Self::LedgerBounds(v) => v.write_xdr(w),
63541            Self::PreconditionsV2(v) => v.write_xdr(w),
63542            Self::PreconditionType(v) => v.write_xdr(w),
63543            Self::Preconditions(v) => v.write_xdr(w),
63544            Self::LedgerFootprint(v) => v.write_xdr(w),
63545            Self::ArchivalProofType(v) => v.write_xdr(w),
63546            Self::ArchivalProofNode(v) => v.write_xdr(w),
63547            Self::ProofLevel(v) => v.write_xdr(w),
63548            Self::NonexistenceProofBody(v) => v.write_xdr(w),
63549            Self::ExistenceProofBody(v) => v.write_xdr(w),
63550            Self::ArchivalProof(v) => v.write_xdr(w),
63551            Self::ArchivalProofBody(v) => v.write_xdr(w),
63552            Self::SorobanResources(v) => v.write_xdr(w),
63553            Self::SorobanTransactionData(v) => v.write_xdr(w),
63554            Self::TransactionV0(v) => v.write_xdr(w),
63555            Self::TransactionV0Ext(v) => v.write_xdr(w),
63556            Self::TransactionV0Envelope(v) => v.write_xdr(w),
63557            Self::Transaction(v) => v.write_xdr(w),
63558            Self::TransactionExt(v) => v.write_xdr(w),
63559            Self::TransactionV1Envelope(v) => v.write_xdr(w),
63560            Self::FeeBumpTransaction(v) => v.write_xdr(w),
63561            Self::FeeBumpTransactionInnerTx(v) => v.write_xdr(w),
63562            Self::FeeBumpTransactionExt(v) => v.write_xdr(w),
63563            Self::FeeBumpTransactionEnvelope(v) => v.write_xdr(w),
63564            Self::TransactionEnvelope(v) => v.write_xdr(w),
63565            Self::TransactionSignaturePayload(v) => v.write_xdr(w),
63566            Self::TransactionSignaturePayloadTaggedTransaction(v) => v.write_xdr(w),
63567            Self::ClaimAtomType(v) => v.write_xdr(w),
63568            Self::ClaimOfferAtomV0(v) => v.write_xdr(w),
63569            Self::ClaimOfferAtom(v) => v.write_xdr(w),
63570            Self::ClaimLiquidityAtom(v) => v.write_xdr(w),
63571            Self::ClaimAtom(v) => v.write_xdr(w),
63572            Self::CreateAccountResultCode(v) => v.write_xdr(w),
63573            Self::CreateAccountResult(v) => v.write_xdr(w),
63574            Self::PaymentResultCode(v) => v.write_xdr(w),
63575            Self::PaymentResult(v) => v.write_xdr(w),
63576            Self::PathPaymentStrictReceiveResultCode(v) => v.write_xdr(w),
63577            Self::SimplePaymentResult(v) => v.write_xdr(w),
63578            Self::PathPaymentStrictReceiveResult(v) => v.write_xdr(w),
63579            Self::PathPaymentStrictReceiveResultSuccess(v) => v.write_xdr(w),
63580            Self::PathPaymentStrictSendResultCode(v) => v.write_xdr(w),
63581            Self::PathPaymentStrictSendResult(v) => v.write_xdr(w),
63582            Self::PathPaymentStrictSendResultSuccess(v) => v.write_xdr(w),
63583            Self::ManageSellOfferResultCode(v) => v.write_xdr(w),
63584            Self::ManageOfferEffect(v) => v.write_xdr(w),
63585            Self::ManageOfferSuccessResult(v) => v.write_xdr(w),
63586            Self::ManageOfferSuccessResultOffer(v) => v.write_xdr(w),
63587            Self::ManageSellOfferResult(v) => v.write_xdr(w),
63588            Self::ManageBuyOfferResultCode(v) => v.write_xdr(w),
63589            Self::ManageBuyOfferResult(v) => v.write_xdr(w),
63590            Self::SetOptionsResultCode(v) => v.write_xdr(w),
63591            Self::SetOptionsResult(v) => v.write_xdr(w),
63592            Self::ChangeTrustResultCode(v) => v.write_xdr(w),
63593            Self::ChangeTrustResult(v) => v.write_xdr(w),
63594            Self::AllowTrustResultCode(v) => v.write_xdr(w),
63595            Self::AllowTrustResult(v) => v.write_xdr(w),
63596            Self::AccountMergeResultCode(v) => v.write_xdr(w),
63597            Self::AccountMergeResult(v) => v.write_xdr(w),
63598            Self::InflationResultCode(v) => v.write_xdr(w),
63599            Self::InflationPayout(v) => v.write_xdr(w),
63600            Self::InflationResult(v) => v.write_xdr(w),
63601            Self::ManageDataResultCode(v) => v.write_xdr(w),
63602            Self::ManageDataResult(v) => v.write_xdr(w),
63603            Self::BumpSequenceResultCode(v) => v.write_xdr(w),
63604            Self::BumpSequenceResult(v) => v.write_xdr(w),
63605            Self::CreateClaimableBalanceResultCode(v) => v.write_xdr(w),
63606            Self::CreateClaimableBalanceResult(v) => v.write_xdr(w),
63607            Self::ClaimClaimableBalanceResultCode(v) => v.write_xdr(w),
63608            Self::ClaimClaimableBalanceResult(v) => v.write_xdr(w),
63609            Self::BeginSponsoringFutureReservesResultCode(v) => v.write_xdr(w),
63610            Self::BeginSponsoringFutureReservesResult(v) => v.write_xdr(w),
63611            Self::EndSponsoringFutureReservesResultCode(v) => v.write_xdr(w),
63612            Self::EndSponsoringFutureReservesResult(v) => v.write_xdr(w),
63613            Self::RevokeSponsorshipResultCode(v) => v.write_xdr(w),
63614            Self::RevokeSponsorshipResult(v) => v.write_xdr(w),
63615            Self::ClawbackResultCode(v) => v.write_xdr(w),
63616            Self::ClawbackResult(v) => v.write_xdr(w),
63617            Self::ClawbackClaimableBalanceResultCode(v) => v.write_xdr(w),
63618            Self::ClawbackClaimableBalanceResult(v) => v.write_xdr(w),
63619            Self::SetTrustLineFlagsResultCode(v) => v.write_xdr(w),
63620            Self::SetTrustLineFlagsResult(v) => v.write_xdr(w),
63621            Self::LiquidityPoolDepositResultCode(v) => v.write_xdr(w),
63622            Self::LiquidityPoolDepositResult(v) => v.write_xdr(w),
63623            Self::LiquidityPoolWithdrawResultCode(v) => v.write_xdr(w),
63624            Self::LiquidityPoolWithdrawResult(v) => v.write_xdr(w),
63625            Self::InvokeHostFunctionResultCode(v) => v.write_xdr(w),
63626            Self::InvokeHostFunctionResult(v) => v.write_xdr(w),
63627            Self::ExtendFootprintTtlResultCode(v) => v.write_xdr(w),
63628            Self::ExtendFootprintTtlResult(v) => v.write_xdr(w),
63629            Self::RestoreFootprintResultCode(v) => v.write_xdr(w),
63630            Self::RestoreFootprintResult(v) => v.write_xdr(w),
63631            Self::OperationResultCode(v) => v.write_xdr(w),
63632            Self::OperationResult(v) => v.write_xdr(w),
63633            Self::OperationResultTr(v) => v.write_xdr(w),
63634            Self::TransactionResultCode(v) => v.write_xdr(w),
63635            Self::InnerTransactionResult(v) => v.write_xdr(w),
63636            Self::InnerTransactionResultResult(v) => v.write_xdr(w),
63637            Self::InnerTransactionResultExt(v) => v.write_xdr(w),
63638            Self::InnerTransactionResultPair(v) => v.write_xdr(w),
63639            Self::TransactionResult(v) => v.write_xdr(w),
63640            Self::TransactionResultResult(v) => v.write_xdr(w),
63641            Self::TransactionResultExt(v) => v.write_xdr(w),
63642            Self::Hash(v) => v.write_xdr(w),
63643            Self::Uint256(v) => v.write_xdr(w),
63644            Self::Uint32(v) => v.write_xdr(w),
63645            Self::Int32(v) => v.write_xdr(w),
63646            Self::Uint64(v) => v.write_xdr(w),
63647            Self::Int64(v) => v.write_xdr(w),
63648            Self::TimePoint(v) => v.write_xdr(w),
63649            Self::Duration(v) => v.write_xdr(w),
63650            Self::ExtensionPoint(v) => v.write_xdr(w),
63651            Self::CryptoKeyType(v) => v.write_xdr(w),
63652            Self::PublicKeyType(v) => v.write_xdr(w),
63653            Self::SignerKeyType(v) => v.write_xdr(w),
63654            Self::PublicKey(v) => v.write_xdr(w),
63655            Self::SignerKey(v) => v.write_xdr(w),
63656            Self::SignerKeyEd25519SignedPayload(v) => v.write_xdr(w),
63657            Self::Signature(v) => v.write_xdr(w),
63658            Self::SignatureHint(v) => v.write_xdr(w),
63659            Self::NodeId(v) => v.write_xdr(w),
63660            Self::AccountId(v) => v.write_xdr(w),
63661            Self::Curve25519Secret(v) => v.write_xdr(w),
63662            Self::Curve25519Public(v) => v.write_xdr(w),
63663            Self::HmacSha256Key(v) => v.write_xdr(w),
63664            Self::HmacSha256Mac(v) => v.write_xdr(w),
63665            Self::ShortHashSeed(v) => v.write_xdr(w),
63666            Self::BinaryFuseFilterType(v) => v.write_xdr(w),
63667            Self::SerializedBinaryFuseFilter(v) => v.write_xdr(w),
63668        }
63669    }
63670}