stellar_xdr/next/
generated.rs

1// Module  is generated from:
2//  xdr/next/Stellar-SCP.x
3//  xdr/next/Stellar-contract-config-setting.x
4//  xdr/next/Stellar-contract-env-meta.x
5//  xdr/next/Stellar-contract-meta.x
6//  xdr/next/Stellar-contract-spec.x
7//  xdr/next/Stellar-contract.x
8//  xdr/next/Stellar-internal.x
9//  xdr/next/Stellar-ledger-entries.x
10//  xdr/next/Stellar-ledger.x
11//  xdr/next/Stellar-overlay.x
12//  xdr/next/Stellar-transaction.x
13//  xdr/next/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/next/Stellar-SCP.x",
21        "8f32b04d008f8bc33b8843d075e69837231a673691ee41d8b821ca229a6e802a",
22    ),
23    (
24        "xdr/next/Stellar-contract-config-setting.x",
25        "c1fabe60eac9eaa4e60897d4e6476434fc5fbda81c5e4c2c65081fce9793bc49",
26    ),
27    (
28        "xdr/next/Stellar-contract-env-meta.x",
29        "75a271414d852096fea3283c63b7f2a702f2905f78fc28eb60ec7d7bd366a780",
30    ),
31    (
32        "xdr/next/Stellar-contract-meta.x",
33        "f01532c11ca044e19d9f9f16fe373e9af64835da473be556b9a807ee3319ae0d",
34    ),
35    (
36        "xdr/next/Stellar-contract-spec.x",
37        "c7ffa21d2e91afb8e666b33524d307955426ff553a486d670c29217ed9888d49",
38    ),
39    (
40        "xdr/next/Stellar-contract.x",
41        "7f665e4103e146a88fcdabce879aaaacd3bf9283feb194cc47ff986264c1e315",
42    ),
43    (
44        "xdr/next/Stellar-internal.x",
45        "227835866c1b2122d1eaf28839ba85ea7289d1cb681dda4ca619c2da3d71fe00",
46    ),
47    (
48        "xdr/next/Stellar-ledger-entries.x",
49        "5dea4f695f01aeb57ad97b97646f3da7dcf5ec35748e5065b19de429fb762cbc",
50    ),
51    (
52        "xdr/next/Stellar-ledger.x",
53        "f1a71a10f83e9f010a35b00b6eb9c88ed373c1aa66b5a01d4dd32f661b504b10",
54    ),
55    (
56        "xdr/next/Stellar-overlay.x",
57        "8c73b7c3ad974e7fc4aa4fdf34f7ad50053406254efbd7406c96657cf41691d3",
58    ),
59    (
60        "xdr/next/Stellar-transaction.x",
61        "c48c3ed9267b2919bba9c424bdd138d25c3e96fd082afe35cd3184ef11dc86d5",
62    ),
63    (
64        "xdr/next/Stellar-types.x",
65        "afe02efc4e6767ed8909c3b4350c4045449b614ce487adcf7e9f816f309bf6f8",
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/// ConfigSettingContractParallelComputeV0 is an XDR Struct defines as:
3761///
3762/// ```text
3763/// struct ConfigSettingContractParallelComputeV0
3764/// {
3765///     // Maximum number of threads that can be used to apply a
3766///     // transaction set to close the ledger.
3767///     // This doesn't limit or defined the actual number of
3768///     // threads used and instead only defines the minimum number
3769///     // of physical threads that a tier-1 validator has to support
3770///     // in order to not fall out of sync with the network.
3771///     uint32 ledgerMaxParallelThreads;
3772/// };
3773/// ```
3774///
3775#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
3776#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
3777#[cfg_attr(
3778    all(feature = "serde", feature = "alloc"),
3779    derive(serde::Serialize, serde::Deserialize),
3780    serde(rename_all = "snake_case")
3781)]
3782#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
3783pub struct ConfigSettingContractParallelComputeV0 {
3784    pub ledger_max_parallel_threads: u32,
3785}
3786
3787impl ReadXdr for ConfigSettingContractParallelComputeV0 {
3788    #[cfg(feature = "std")]
3789    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
3790        r.with_limited_depth(|r| {
3791            Ok(Self {
3792                ledger_max_parallel_threads: u32::read_xdr(r)?,
3793            })
3794        })
3795    }
3796}
3797
3798impl WriteXdr for ConfigSettingContractParallelComputeV0 {
3799    #[cfg(feature = "std")]
3800    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
3801        w.with_limited_depth(|w| {
3802            self.ledger_max_parallel_threads.write_xdr(w)?;
3803            Ok(())
3804        })
3805    }
3806}
3807
3808/// ConfigSettingContractLedgerCostV0 is an XDR Struct defines as:
3809///
3810/// ```text
3811/// struct ConfigSettingContractLedgerCostV0
3812/// {
3813///     // Maximum number of ledger entry read operations per ledger
3814///     uint32 ledgerMaxReadLedgerEntries;
3815///     // Maximum number of bytes that can be read per ledger
3816///     uint32 ledgerMaxReadBytes;
3817///     // Maximum number of ledger entry write operations per ledger
3818///     uint32 ledgerMaxWriteLedgerEntries;
3819///     // Maximum number of bytes that can be written per ledger
3820///     uint32 ledgerMaxWriteBytes;
3821///
3822///     // Maximum number of ledger entry read operations per transaction
3823///     uint32 txMaxReadLedgerEntries;
3824///     // Maximum number of bytes that can be read per transaction
3825///     uint32 txMaxReadBytes;
3826///     // Maximum number of ledger entry write operations per transaction
3827///     uint32 txMaxWriteLedgerEntries;
3828///     // Maximum number of bytes that can be written per transaction
3829///     uint32 txMaxWriteBytes;
3830///
3831///     int64 feeReadLedgerEntry;  // Fee per ledger entry read
3832///     int64 feeWriteLedgerEntry; // Fee per ledger entry write
3833///
3834///     int64 feeRead1KB;  // Fee for reading 1KB
3835///
3836///     // The following parameters determine the write fee per 1KB.
3837///     // Write fee grows linearly until bucket list reaches this size
3838///     int64 bucketListTargetSizeBytes;
3839///     // Fee per 1KB write when the bucket list is empty
3840///     int64 writeFee1KBBucketListLow;
3841///     // Fee per 1KB write when the bucket list has reached `bucketListTargetSizeBytes`
3842///     int64 writeFee1KBBucketListHigh;
3843///     // Write fee multiplier for any additional data past the first `bucketListTargetSizeBytes`
3844///     uint32 bucketListWriteFeeGrowthFactor;
3845/// };
3846/// ```
3847///
3848#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
3849#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
3850#[cfg_attr(
3851    all(feature = "serde", feature = "alloc"),
3852    derive(serde::Serialize, serde::Deserialize),
3853    serde(rename_all = "snake_case")
3854)]
3855#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
3856pub struct ConfigSettingContractLedgerCostV0 {
3857    pub ledger_max_read_ledger_entries: u32,
3858    pub ledger_max_read_bytes: u32,
3859    pub ledger_max_write_ledger_entries: u32,
3860    pub ledger_max_write_bytes: u32,
3861    pub tx_max_read_ledger_entries: u32,
3862    pub tx_max_read_bytes: u32,
3863    pub tx_max_write_ledger_entries: u32,
3864    pub tx_max_write_bytes: u32,
3865    pub fee_read_ledger_entry: i64,
3866    pub fee_write_ledger_entry: i64,
3867    pub fee_read1_kb: i64,
3868    pub bucket_list_target_size_bytes: i64,
3869    pub write_fee1_kb_bucket_list_low: i64,
3870    pub write_fee1_kb_bucket_list_high: i64,
3871    pub bucket_list_write_fee_growth_factor: u32,
3872}
3873
3874impl ReadXdr for ConfigSettingContractLedgerCostV0 {
3875    #[cfg(feature = "std")]
3876    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
3877        r.with_limited_depth(|r| {
3878            Ok(Self {
3879                ledger_max_read_ledger_entries: u32::read_xdr(r)?,
3880                ledger_max_read_bytes: u32::read_xdr(r)?,
3881                ledger_max_write_ledger_entries: u32::read_xdr(r)?,
3882                ledger_max_write_bytes: u32::read_xdr(r)?,
3883                tx_max_read_ledger_entries: u32::read_xdr(r)?,
3884                tx_max_read_bytes: u32::read_xdr(r)?,
3885                tx_max_write_ledger_entries: u32::read_xdr(r)?,
3886                tx_max_write_bytes: u32::read_xdr(r)?,
3887                fee_read_ledger_entry: i64::read_xdr(r)?,
3888                fee_write_ledger_entry: i64::read_xdr(r)?,
3889                fee_read1_kb: i64::read_xdr(r)?,
3890                bucket_list_target_size_bytes: i64::read_xdr(r)?,
3891                write_fee1_kb_bucket_list_low: i64::read_xdr(r)?,
3892                write_fee1_kb_bucket_list_high: i64::read_xdr(r)?,
3893                bucket_list_write_fee_growth_factor: u32::read_xdr(r)?,
3894            })
3895        })
3896    }
3897}
3898
3899impl WriteXdr for ConfigSettingContractLedgerCostV0 {
3900    #[cfg(feature = "std")]
3901    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
3902        w.with_limited_depth(|w| {
3903            self.ledger_max_read_ledger_entries.write_xdr(w)?;
3904            self.ledger_max_read_bytes.write_xdr(w)?;
3905            self.ledger_max_write_ledger_entries.write_xdr(w)?;
3906            self.ledger_max_write_bytes.write_xdr(w)?;
3907            self.tx_max_read_ledger_entries.write_xdr(w)?;
3908            self.tx_max_read_bytes.write_xdr(w)?;
3909            self.tx_max_write_ledger_entries.write_xdr(w)?;
3910            self.tx_max_write_bytes.write_xdr(w)?;
3911            self.fee_read_ledger_entry.write_xdr(w)?;
3912            self.fee_write_ledger_entry.write_xdr(w)?;
3913            self.fee_read1_kb.write_xdr(w)?;
3914            self.bucket_list_target_size_bytes.write_xdr(w)?;
3915            self.write_fee1_kb_bucket_list_low.write_xdr(w)?;
3916            self.write_fee1_kb_bucket_list_high.write_xdr(w)?;
3917            self.bucket_list_write_fee_growth_factor.write_xdr(w)?;
3918            Ok(())
3919        })
3920    }
3921}
3922
3923/// ConfigSettingContractHistoricalDataV0 is an XDR Struct defines as:
3924///
3925/// ```text
3926/// struct ConfigSettingContractHistoricalDataV0
3927/// {
3928///     int64 feeHistorical1KB; // Fee for storing 1KB in archives
3929/// };
3930/// ```
3931///
3932#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
3933#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
3934#[cfg_attr(
3935    all(feature = "serde", feature = "alloc"),
3936    derive(serde::Serialize, serde::Deserialize),
3937    serde(rename_all = "snake_case")
3938)]
3939#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
3940pub struct ConfigSettingContractHistoricalDataV0 {
3941    pub fee_historical1_kb: i64,
3942}
3943
3944impl ReadXdr for ConfigSettingContractHistoricalDataV0 {
3945    #[cfg(feature = "std")]
3946    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
3947        r.with_limited_depth(|r| {
3948            Ok(Self {
3949                fee_historical1_kb: i64::read_xdr(r)?,
3950            })
3951        })
3952    }
3953}
3954
3955impl WriteXdr for ConfigSettingContractHistoricalDataV0 {
3956    #[cfg(feature = "std")]
3957    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
3958        w.with_limited_depth(|w| {
3959            self.fee_historical1_kb.write_xdr(w)?;
3960            Ok(())
3961        })
3962    }
3963}
3964
3965/// ConfigSettingContractEventsV0 is an XDR Struct defines as:
3966///
3967/// ```text
3968/// struct ConfigSettingContractEventsV0
3969/// {
3970///     // Maximum size of events that a contract call can emit.
3971///     uint32 txMaxContractEventsSizeBytes;
3972///     // Fee for generating 1KB of contract events.
3973///     int64 feeContractEvents1KB;
3974/// };
3975/// ```
3976///
3977#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
3978#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
3979#[cfg_attr(
3980    all(feature = "serde", feature = "alloc"),
3981    derive(serde::Serialize, serde::Deserialize),
3982    serde(rename_all = "snake_case")
3983)]
3984#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
3985pub struct ConfigSettingContractEventsV0 {
3986    pub tx_max_contract_events_size_bytes: u32,
3987    pub fee_contract_events1_kb: i64,
3988}
3989
3990impl ReadXdr for ConfigSettingContractEventsV0 {
3991    #[cfg(feature = "std")]
3992    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
3993        r.with_limited_depth(|r| {
3994            Ok(Self {
3995                tx_max_contract_events_size_bytes: u32::read_xdr(r)?,
3996                fee_contract_events1_kb: i64::read_xdr(r)?,
3997            })
3998        })
3999    }
4000}
4001
4002impl WriteXdr for ConfigSettingContractEventsV0 {
4003    #[cfg(feature = "std")]
4004    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
4005        w.with_limited_depth(|w| {
4006            self.tx_max_contract_events_size_bytes.write_xdr(w)?;
4007            self.fee_contract_events1_kb.write_xdr(w)?;
4008            Ok(())
4009        })
4010    }
4011}
4012
4013/// ConfigSettingContractBandwidthV0 is an XDR Struct defines as:
4014///
4015/// ```text
4016/// struct ConfigSettingContractBandwidthV0
4017/// {
4018///     // Maximum sum of all transaction sizes in the ledger in bytes
4019///     uint32 ledgerMaxTxsSizeBytes;
4020///     // Maximum size in bytes for a transaction
4021///     uint32 txMaxSizeBytes;
4022///
4023///     // Fee for 1 KB of transaction size
4024///     int64 feeTxSize1KB;
4025/// };
4026/// ```
4027///
4028#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
4029#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
4030#[cfg_attr(
4031    all(feature = "serde", feature = "alloc"),
4032    derive(serde::Serialize, serde::Deserialize),
4033    serde(rename_all = "snake_case")
4034)]
4035#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
4036pub struct ConfigSettingContractBandwidthV0 {
4037    pub ledger_max_txs_size_bytes: u32,
4038    pub tx_max_size_bytes: u32,
4039    pub fee_tx_size1_kb: i64,
4040}
4041
4042impl ReadXdr for ConfigSettingContractBandwidthV0 {
4043    #[cfg(feature = "std")]
4044    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
4045        r.with_limited_depth(|r| {
4046            Ok(Self {
4047                ledger_max_txs_size_bytes: u32::read_xdr(r)?,
4048                tx_max_size_bytes: u32::read_xdr(r)?,
4049                fee_tx_size1_kb: i64::read_xdr(r)?,
4050            })
4051        })
4052    }
4053}
4054
4055impl WriteXdr for ConfigSettingContractBandwidthV0 {
4056    #[cfg(feature = "std")]
4057    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
4058        w.with_limited_depth(|w| {
4059            self.ledger_max_txs_size_bytes.write_xdr(w)?;
4060            self.tx_max_size_bytes.write_xdr(w)?;
4061            self.fee_tx_size1_kb.write_xdr(w)?;
4062            Ok(())
4063        })
4064    }
4065}
4066
4067/// ContractCostType is an XDR Enum defines as:
4068///
4069/// ```text
4070/// enum ContractCostType {
4071///     // Cost of running 1 wasm instruction
4072///     WasmInsnExec = 0,
4073///     // Cost of allocating a slice of memory (in bytes)
4074///     MemAlloc = 1,
4075///     // Cost of copying a slice of bytes into a pre-allocated memory
4076///     MemCpy = 2,
4077///     // Cost of comparing two slices of memory
4078///     MemCmp = 3,
4079///     // Cost of a host function dispatch, not including the actual work done by
4080///     // the function nor the cost of VM invocation machinary
4081///     DispatchHostFunction = 4,
4082///     // Cost of visiting a host object from the host object storage. Exists to
4083///     // make sure some baseline cost coverage, i.e. repeatly visiting objects
4084///     // by the guest will always incur some charges.
4085///     VisitObject = 5,
4086///     // Cost of serializing an xdr object to bytes
4087///     ValSer = 6,
4088///     // Cost of deserializing an xdr object from bytes
4089///     ValDeser = 7,
4090///     // Cost of computing the sha256 hash from bytes
4091///     ComputeSha256Hash = 8,
4092///     // Cost of computing the ed25519 pubkey from bytes
4093///     ComputeEd25519PubKey = 9,
4094///     // Cost of verifying ed25519 signature of a payload.
4095///     VerifyEd25519Sig = 10,
4096///     // Cost of instantiation a VM from wasm bytes code.
4097///     VmInstantiation = 11,
4098///     // Cost of instantiation a VM from a cached state.
4099///     VmCachedInstantiation = 12,
4100///     // Cost of invoking a function on the VM. If the function is a host function,
4101///     // additional cost will be covered by `DispatchHostFunction`.
4102///     InvokeVmFunction = 13,
4103///     // Cost of computing a keccak256 hash from bytes.
4104///     ComputeKeccak256Hash = 14,
4105///     // Cost of decoding an ECDSA signature computed from a 256-bit prime modulus
4106///     // curve (e.g. secp256k1 and secp256r1)
4107///     DecodeEcdsaCurve256Sig = 15,
4108///     // Cost of recovering an ECDSA secp256k1 key from a signature.
4109///     RecoverEcdsaSecp256k1Key = 16,
4110///     // Cost of int256 addition (`+`) and subtraction (`-`) operations
4111///     Int256AddSub = 17,
4112///     // Cost of int256 multiplication (`*`) operation
4113///     Int256Mul = 18,
4114///     // Cost of int256 division (`/`) operation
4115///     Int256Div = 19,
4116///     // Cost of int256 power (`exp`) operation
4117///     Int256Pow = 20,
4118///     // Cost of int256 shift (`shl`, `shr`) operation
4119///     Int256Shift = 21,
4120///     // Cost of drawing random bytes using a ChaCha20 PRNG
4121///     ChaCha20DrawBytes = 22,
4122///
4123///     // Cost of parsing wasm bytes that only encode instructions.
4124///     ParseWasmInstructions = 23,
4125///     // Cost of parsing a known number of wasm functions.
4126///     ParseWasmFunctions = 24,
4127///     // Cost of parsing a known number of wasm globals.
4128///     ParseWasmGlobals = 25,
4129///     // Cost of parsing a known number of wasm table entries.
4130///     ParseWasmTableEntries = 26,
4131///     // Cost of parsing a known number of wasm types.
4132///     ParseWasmTypes = 27,
4133///     // Cost of parsing a known number of wasm data segments.
4134///     ParseWasmDataSegments = 28,
4135///     // Cost of parsing a known number of wasm element segments.
4136///     ParseWasmElemSegments = 29,
4137///     // Cost of parsing a known number of wasm imports.
4138///     ParseWasmImports = 30,
4139///     // Cost of parsing a known number of wasm exports.
4140///     ParseWasmExports = 31,
4141///     // Cost of parsing a known number of data segment bytes.
4142///     ParseWasmDataSegmentBytes = 32,
4143///
4144///     // Cost of instantiating wasm bytes that only encode instructions.
4145///     InstantiateWasmInstructions = 33,
4146///     // Cost of instantiating a known number of wasm functions.
4147///     InstantiateWasmFunctions = 34,
4148///     // Cost of instantiating a known number of wasm globals.
4149///     InstantiateWasmGlobals = 35,
4150///     // Cost of instantiating a known number of wasm table entries.
4151///     InstantiateWasmTableEntries = 36,
4152///     // Cost of instantiating a known number of wasm types.
4153///     InstantiateWasmTypes = 37,
4154///     // Cost of instantiating a known number of wasm data segments.
4155///     InstantiateWasmDataSegments = 38,
4156///     // Cost of instantiating a known number of wasm element segments.
4157///     InstantiateWasmElemSegments = 39,
4158///     // Cost of instantiating a known number of wasm imports.
4159///     InstantiateWasmImports = 40,
4160///     // Cost of instantiating a known number of wasm exports.
4161///     InstantiateWasmExports = 41,
4162///     // Cost of instantiating a known number of data segment bytes.
4163///     InstantiateWasmDataSegmentBytes = 42,
4164///
4165///     // Cost of decoding a bytes array representing an uncompressed SEC-1 encoded
4166///     // point on a 256-bit elliptic curve
4167///     Sec1DecodePointUncompressed = 43,
4168///     // Cost of verifying an ECDSA Secp256r1 signature
4169///     VerifyEcdsaSecp256r1Sig = 44,
4170///
4171///     // Cost of encoding a BLS12-381 Fp (base field element)
4172///     Bls12381EncodeFp = 45,
4173///     // Cost of decoding a BLS12-381 Fp (base field element)
4174///     Bls12381DecodeFp = 46,
4175///     // Cost of checking a G1 point lies on the curve
4176///     Bls12381G1CheckPointOnCurve = 47,
4177///     // Cost of checking a G1 point belongs to the correct subgroup
4178///     Bls12381G1CheckPointInSubgroup = 48,
4179///     // Cost of checking a G2 point lies on the curve
4180///     Bls12381G2CheckPointOnCurve = 49,
4181///     // Cost of checking a G2 point belongs to the correct subgroup
4182///     Bls12381G2CheckPointInSubgroup = 50,
4183///     // Cost of converting a BLS12-381 G1 point from projective to affine coordinates
4184///     Bls12381G1ProjectiveToAffine = 51,
4185///     // Cost of converting a BLS12-381 G2 point from projective to affine coordinates
4186///     Bls12381G2ProjectiveToAffine = 52,
4187///     // Cost of performing BLS12-381 G1 point addition
4188///     Bls12381G1Add = 53,
4189///     // Cost of performing BLS12-381 G1 scalar multiplication
4190///     Bls12381G1Mul = 54,
4191///     // Cost of performing BLS12-381 G1 multi-scalar multiplication (MSM)
4192///     Bls12381G1Msm = 55,
4193///     // Cost of mapping a BLS12-381 Fp field element to a G1 point
4194///     Bls12381MapFpToG1 = 56,
4195///     // Cost of hashing to a BLS12-381 G1 point
4196///     Bls12381HashToG1 = 57,
4197///     // Cost of performing BLS12-381 G2 point addition
4198///     Bls12381G2Add = 58,
4199///     // Cost of performing BLS12-381 G2 scalar multiplication
4200///     Bls12381G2Mul = 59,
4201///     // Cost of performing BLS12-381 G2 multi-scalar multiplication (MSM)
4202///     Bls12381G2Msm = 60,
4203///     // Cost of mapping a BLS12-381 Fp2 field element to a G2 point
4204///     Bls12381MapFp2ToG2 = 61,
4205///     // Cost of hashing to a BLS12-381 G2 point
4206///     Bls12381HashToG2 = 62,
4207///     // Cost of performing BLS12-381 pairing operation
4208///     Bls12381Pairing = 63,
4209///     // Cost of converting a BLS12-381 scalar element from U256
4210///     Bls12381FrFromU256 = 64,
4211///     // Cost of converting a BLS12-381 scalar element to U256
4212///     Bls12381FrToU256 = 65,
4213///     // Cost of performing BLS12-381 scalar element addition/subtraction
4214///     Bls12381FrAddSub = 66,
4215///     // Cost of performing BLS12-381 scalar element multiplication
4216///     Bls12381FrMul = 67,
4217///     // Cost of performing BLS12-381 scalar element exponentiation
4218///     Bls12381FrPow = 68,
4219///     // Cost of performing BLS12-381 scalar element inversion
4220///     Bls12381FrInv = 69
4221/// };
4222/// ```
4223///
4224// enum
4225#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
4226#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
4227#[cfg_attr(
4228    all(feature = "serde", feature = "alloc"),
4229    derive(serde::Serialize, serde::Deserialize),
4230    serde(rename_all = "snake_case")
4231)]
4232#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
4233#[repr(i32)]
4234pub enum ContractCostType {
4235    WasmInsnExec = 0,
4236    MemAlloc = 1,
4237    MemCpy = 2,
4238    MemCmp = 3,
4239    DispatchHostFunction = 4,
4240    VisitObject = 5,
4241    ValSer = 6,
4242    ValDeser = 7,
4243    ComputeSha256Hash = 8,
4244    ComputeEd25519PubKey = 9,
4245    VerifyEd25519Sig = 10,
4246    VmInstantiation = 11,
4247    VmCachedInstantiation = 12,
4248    InvokeVmFunction = 13,
4249    ComputeKeccak256Hash = 14,
4250    DecodeEcdsaCurve256Sig = 15,
4251    RecoverEcdsaSecp256k1Key = 16,
4252    Int256AddSub = 17,
4253    Int256Mul = 18,
4254    Int256Div = 19,
4255    Int256Pow = 20,
4256    Int256Shift = 21,
4257    ChaCha20DrawBytes = 22,
4258    ParseWasmInstructions = 23,
4259    ParseWasmFunctions = 24,
4260    ParseWasmGlobals = 25,
4261    ParseWasmTableEntries = 26,
4262    ParseWasmTypes = 27,
4263    ParseWasmDataSegments = 28,
4264    ParseWasmElemSegments = 29,
4265    ParseWasmImports = 30,
4266    ParseWasmExports = 31,
4267    ParseWasmDataSegmentBytes = 32,
4268    InstantiateWasmInstructions = 33,
4269    InstantiateWasmFunctions = 34,
4270    InstantiateWasmGlobals = 35,
4271    InstantiateWasmTableEntries = 36,
4272    InstantiateWasmTypes = 37,
4273    InstantiateWasmDataSegments = 38,
4274    InstantiateWasmElemSegments = 39,
4275    InstantiateWasmImports = 40,
4276    InstantiateWasmExports = 41,
4277    InstantiateWasmDataSegmentBytes = 42,
4278    Sec1DecodePointUncompressed = 43,
4279    VerifyEcdsaSecp256r1Sig = 44,
4280    Bls12381EncodeFp = 45,
4281    Bls12381DecodeFp = 46,
4282    Bls12381G1CheckPointOnCurve = 47,
4283    Bls12381G1CheckPointInSubgroup = 48,
4284    Bls12381G2CheckPointOnCurve = 49,
4285    Bls12381G2CheckPointInSubgroup = 50,
4286    Bls12381G1ProjectiveToAffine = 51,
4287    Bls12381G2ProjectiveToAffine = 52,
4288    Bls12381G1Add = 53,
4289    Bls12381G1Mul = 54,
4290    Bls12381G1Msm = 55,
4291    Bls12381MapFpToG1 = 56,
4292    Bls12381HashToG1 = 57,
4293    Bls12381G2Add = 58,
4294    Bls12381G2Mul = 59,
4295    Bls12381G2Msm = 60,
4296    Bls12381MapFp2ToG2 = 61,
4297    Bls12381HashToG2 = 62,
4298    Bls12381Pairing = 63,
4299    Bls12381FrFromU256 = 64,
4300    Bls12381FrToU256 = 65,
4301    Bls12381FrAddSub = 66,
4302    Bls12381FrMul = 67,
4303    Bls12381FrPow = 68,
4304    Bls12381FrInv = 69,
4305}
4306
4307impl ContractCostType {
4308    pub const VARIANTS: [ContractCostType; 70] = [
4309        ContractCostType::WasmInsnExec,
4310        ContractCostType::MemAlloc,
4311        ContractCostType::MemCpy,
4312        ContractCostType::MemCmp,
4313        ContractCostType::DispatchHostFunction,
4314        ContractCostType::VisitObject,
4315        ContractCostType::ValSer,
4316        ContractCostType::ValDeser,
4317        ContractCostType::ComputeSha256Hash,
4318        ContractCostType::ComputeEd25519PubKey,
4319        ContractCostType::VerifyEd25519Sig,
4320        ContractCostType::VmInstantiation,
4321        ContractCostType::VmCachedInstantiation,
4322        ContractCostType::InvokeVmFunction,
4323        ContractCostType::ComputeKeccak256Hash,
4324        ContractCostType::DecodeEcdsaCurve256Sig,
4325        ContractCostType::RecoverEcdsaSecp256k1Key,
4326        ContractCostType::Int256AddSub,
4327        ContractCostType::Int256Mul,
4328        ContractCostType::Int256Div,
4329        ContractCostType::Int256Pow,
4330        ContractCostType::Int256Shift,
4331        ContractCostType::ChaCha20DrawBytes,
4332        ContractCostType::ParseWasmInstructions,
4333        ContractCostType::ParseWasmFunctions,
4334        ContractCostType::ParseWasmGlobals,
4335        ContractCostType::ParseWasmTableEntries,
4336        ContractCostType::ParseWasmTypes,
4337        ContractCostType::ParseWasmDataSegments,
4338        ContractCostType::ParseWasmElemSegments,
4339        ContractCostType::ParseWasmImports,
4340        ContractCostType::ParseWasmExports,
4341        ContractCostType::ParseWasmDataSegmentBytes,
4342        ContractCostType::InstantiateWasmInstructions,
4343        ContractCostType::InstantiateWasmFunctions,
4344        ContractCostType::InstantiateWasmGlobals,
4345        ContractCostType::InstantiateWasmTableEntries,
4346        ContractCostType::InstantiateWasmTypes,
4347        ContractCostType::InstantiateWasmDataSegments,
4348        ContractCostType::InstantiateWasmElemSegments,
4349        ContractCostType::InstantiateWasmImports,
4350        ContractCostType::InstantiateWasmExports,
4351        ContractCostType::InstantiateWasmDataSegmentBytes,
4352        ContractCostType::Sec1DecodePointUncompressed,
4353        ContractCostType::VerifyEcdsaSecp256r1Sig,
4354        ContractCostType::Bls12381EncodeFp,
4355        ContractCostType::Bls12381DecodeFp,
4356        ContractCostType::Bls12381G1CheckPointOnCurve,
4357        ContractCostType::Bls12381G1CheckPointInSubgroup,
4358        ContractCostType::Bls12381G2CheckPointOnCurve,
4359        ContractCostType::Bls12381G2CheckPointInSubgroup,
4360        ContractCostType::Bls12381G1ProjectiveToAffine,
4361        ContractCostType::Bls12381G2ProjectiveToAffine,
4362        ContractCostType::Bls12381G1Add,
4363        ContractCostType::Bls12381G1Mul,
4364        ContractCostType::Bls12381G1Msm,
4365        ContractCostType::Bls12381MapFpToG1,
4366        ContractCostType::Bls12381HashToG1,
4367        ContractCostType::Bls12381G2Add,
4368        ContractCostType::Bls12381G2Mul,
4369        ContractCostType::Bls12381G2Msm,
4370        ContractCostType::Bls12381MapFp2ToG2,
4371        ContractCostType::Bls12381HashToG2,
4372        ContractCostType::Bls12381Pairing,
4373        ContractCostType::Bls12381FrFromU256,
4374        ContractCostType::Bls12381FrToU256,
4375        ContractCostType::Bls12381FrAddSub,
4376        ContractCostType::Bls12381FrMul,
4377        ContractCostType::Bls12381FrPow,
4378        ContractCostType::Bls12381FrInv,
4379    ];
4380    pub const VARIANTS_STR: [&'static str; 70] = [
4381        "WasmInsnExec",
4382        "MemAlloc",
4383        "MemCpy",
4384        "MemCmp",
4385        "DispatchHostFunction",
4386        "VisitObject",
4387        "ValSer",
4388        "ValDeser",
4389        "ComputeSha256Hash",
4390        "ComputeEd25519PubKey",
4391        "VerifyEd25519Sig",
4392        "VmInstantiation",
4393        "VmCachedInstantiation",
4394        "InvokeVmFunction",
4395        "ComputeKeccak256Hash",
4396        "DecodeEcdsaCurve256Sig",
4397        "RecoverEcdsaSecp256k1Key",
4398        "Int256AddSub",
4399        "Int256Mul",
4400        "Int256Div",
4401        "Int256Pow",
4402        "Int256Shift",
4403        "ChaCha20DrawBytes",
4404        "ParseWasmInstructions",
4405        "ParseWasmFunctions",
4406        "ParseWasmGlobals",
4407        "ParseWasmTableEntries",
4408        "ParseWasmTypes",
4409        "ParseWasmDataSegments",
4410        "ParseWasmElemSegments",
4411        "ParseWasmImports",
4412        "ParseWasmExports",
4413        "ParseWasmDataSegmentBytes",
4414        "InstantiateWasmInstructions",
4415        "InstantiateWasmFunctions",
4416        "InstantiateWasmGlobals",
4417        "InstantiateWasmTableEntries",
4418        "InstantiateWasmTypes",
4419        "InstantiateWasmDataSegments",
4420        "InstantiateWasmElemSegments",
4421        "InstantiateWasmImports",
4422        "InstantiateWasmExports",
4423        "InstantiateWasmDataSegmentBytes",
4424        "Sec1DecodePointUncompressed",
4425        "VerifyEcdsaSecp256r1Sig",
4426        "Bls12381EncodeFp",
4427        "Bls12381DecodeFp",
4428        "Bls12381G1CheckPointOnCurve",
4429        "Bls12381G1CheckPointInSubgroup",
4430        "Bls12381G2CheckPointOnCurve",
4431        "Bls12381G2CheckPointInSubgroup",
4432        "Bls12381G1ProjectiveToAffine",
4433        "Bls12381G2ProjectiveToAffine",
4434        "Bls12381G1Add",
4435        "Bls12381G1Mul",
4436        "Bls12381G1Msm",
4437        "Bls12381MapFpToG1",
4438        "Bls12381HashToG1",
4439        "Bls12381G2Add",
4440        "Bls12381G2Mul",
4441        "Bls12381G2Msm",
4442        "Bls12381MapFp2ToG2",
4443        "Bls12381HashToG2",
4444        "Bls12381Pairing",
4445        "Bls12381FrFromU256",
4446        "Bls12381FrToU256",
4447        "Bls12381FrAddSub",
4448        "Bls12381FrMul",
4449        "Bls12381FrPow",
4450        "Bls12381FrInv",
4451    ];
4452
4453    #[must_use]
4454    pub const fn name(&self) -> &'static str {
4455        match self {
4456            Self::WasmInsnExec => "WasmInsnExec",
4457            Self::MemAlloc => "MemAlloc",
4458            Self::MemCpy => "MemCpy",
4459            Self::MemCmp => "MemCmp",
4460            Self::DispatchHostFunction => "DispatchHostFunction",
4461            Self::VisitObject => "VisitObject",
4462            Self::ValSer => "ValSer",
4463            Self::ValDeser => "ValDeser",
4464            Self::ComputeSha256Hash => "ComputeSha256Hash",
4465            Self::ComputeEd25519PubKey => "ComputeEd25519PubKey",
4466            Self::VerifyEd25519Sig => "VerifyEd25519Sig",
4467            Self::VmInstantiation => "VmInstantiation",
4468            Self::VmCachedInstantiation => "VmCachedInstantiation",
4469            Self::InvokeVmFunction => "InvokeVmFunction",
4470            Self::ComputeKeccak256Hash => "ComputeKeccak256Hash",
4471            Self::DecodeEcdsaCurve256Sig => "DecodeEcdsaCurve256Sig",
4472            Self::RecoverEcdsaSecp256k1Key => "RecoverEcdsaSecp256k1Key",
4473            Self::Int256AddSub => "Int256AddSub",
4474            Self::Int256Mul => "Int256Mul",
4475            Self::Int256Div => "Int256Div",
4476            Self::Int256Pow => "Int256Pow",
4477            Self::Int256Shift => "Int256Shift",
4478            Self::ChaCha20DrawBytes => "ChaCha20DrawBytes",
4479            Self::ParseWasmInstructions => "ParseWasmInstructions",
4480            Self::ParseWasmFunctions => "ParseWasmFunctions",
4481            Self::ParseWasmGlobals => "ParseWasmGlobals",
4482            Self::ParseWasmTableEntries => "ParseWasmTableEntries",
4483            Self::ParseWasmTypes => "ParseWasmTypes",
4484            Self::ParseWasmDataSegments => "ParseWasmDataSegments",
4485            Self::ParseWasmElemSegments => "ParseWasmElemSegments",
4486            Self::ParseWasmImports => "ParseWasmImports",
4487            Self::ParseWasmExports => "ParseWasmExports",
4488            Self::ParseWasmDataSegmentBytes => "ParseWasmDataSegmentBytes",
4489            Self::InstantiateWasmInstructions => "InstantiateWasmInstructions",
4490            Self::InstantiateWasmFunctions => "InstantiateWasmFunctions",
4491            Self::InstantiateWasmGlobals => "InstantiateWasmGlobals",
4492            Self::InstantiateWasmTableEntries => "InstantiateWasmTableEntries",
4493            Self::InstantiateWasmTypes => "InstantiateWasmTypes",
4494            Self::InstantiateWasmDataSegments => "InstantiateWasmDataSegments",
4495            Self::InstantiateWasmElemSegments => "InstantiateWasmElemSegments",
4496            Self::InstantiateWasmImports => "InstantiateWasmImports",
4497            Self::InstantiateWasmExports => "InstantiateWasmExports",
4498            Self::InstantiateWasmDataSegmentBytes => "InstantiateWasmDataSegmentBytes",
4499            Self::Sec1DecodePointUncompressed => "Sec1DecodePointUncompressed",
4500            Self::VerifyEcdsaSecp256r1Sig => "VerifyEcdsaSecp256r1Sig",
4501            Self::Bls12381EncodeFp => "Bls12381EncodeFp",
4502            Self::Bls12381DecodeFp => "Bls12381DecodeFp",
4503            Self::Bls12381G1CheckPointOnCurve => "Bls12381G1CheckPointOnCurve",
4504            Self::Bls12381G1CheckPointInSubgroup => "Bls12381G1CheckPointInSubgroup",
4505            Self::Bls12381G2CheckPointOnCurve => "Bls12381G2CheckPointOnCurve",
4506            Self::Bls12381G2CheckPointInSubgroup => "Bls12381G2CheckPointInSubgroup",
4507            Self::Bls12381G1ProjectiveToAffine => "Bls12381G1ProjectiveToAffine",
4508            Self::Bls12381G2ProjectiveToAffine => "Bls12381G2ProjectiveToAffine",
4509            Self::Bls12381G1Add => "Bls12381G1Add",
4510            Self::Bls12381G1Mul => "Bls12381G1Mul",
4511            Self::Bls12381G1Msm => "Bls12381G1Msm",
4512            Self::Bls12381MapFpToG1 => "Bls12381MapFpToG1",
4513            Self::Bls12381HashToG1 => "Bls12381HashToG1",
4514            Self::Bls12381G2Add => "Bls12381G2Add",
4515            Self::Bls12381G2Mul => "Bls12381G2Mul",
4516            Self::Bls12381G2Msm => "Bls12381G2Msm",
4517            Self::Bls12381MapFp2ToG2 => "Bls12381MapFp2ToG2",
4518            Self::Bls12381HashToG2 => "Bls12381HashToG2",
4519            Self::Bls12381Pairing => "Bls12381Pairing",
4520            Self::Bls12381FrFromU256 => "Bls12381FrFromU256",
4521            Self::Bls12381FrToU256 => "Bls12381FrToU256",
4522            Self::Bls12381FrAddSub => "Bls12381FrAddSub",
4523            Self::Bls12381FrMul => "Bls12381FrMul",
4524            Self::Bls12381FrPow => "Bls12381FrPow",
4525            Self::Bls12381FrInv => "Bls12381FrInv",
4526        }
4527    }
4528
4529    #[must_use]
4530    pub const fn variants() -> [ContractCostType; 70] {
4531        Self::VARIANTS
4532    }
4533}
4534
4535impl Name for ContractCostType {
4536    #[must_use]
4537    fn name(&self) -> &'static str {
4538        Self::name(self)
4539    }
4540}
4541
4542impl Variants<ContractCostType> for ContractCostType {
4543    fn variants() -> slice::Iter<'static, ContractCostType> {
4544        Self::VARIANTS.iter()
4545    }
4546}
4547
4548impl Enum for ContractCostType {}
4549
4550impl fmt::Display for ContractCostType {
4551    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
4552        f.write_str(self.name())
4553    }
4554}
4555
4556impl TryFrom<i32> for ContractCostType {
4557    type Error = Error;
4558
4559    fn try_from(i: i32) -> Result<Self> {
4560        let e = match i {
4561            0 => ContractCostType::WasmInsnExec,
4562            1 => ContractCostType::MemAlloc,
4563            2 => ContractCostType::MemCpy,
4564            3 => ContractCostType::MemCmp,
4565            4 => ContractCostType::DispatchHostFunction,
4566            5 => ContractCostType::VisitObject,
4567            6 => ContractCostType::ValSer,
4568            7 => ContractCostType::ValDeser,
4569            8 => ContractCostType::ComputeSha256Hash,
4570            9 => ContractCostType::ComputeEd25519PubKey,
4571            10 => ContractCostType::VerifyEd25519Sig,
4572            11 => ContractCostType::VmInstantiation,
4573            12 => ContractCostType::VmCachedInstantiation,
4574            13 => ContractCostType::InvokeVmFunction,
4575            14 => ContractCostType::ComputeKeccak256Hash,
4576            15 => ContractCostType::DecodeEcdsaCurve256Sig,
4577            16 => ContractCostType::RecoverEcdsaSecp256k1Key,
4578            17 => ContractCostType::Int256AddSub,
4579            18 => ContractCostType::Int256Mul,
4580            19 => ContractCostType::Int256Div,
4581            20 => ContractCostType::Int256Pow,
4582            21 => ContractCostType::Int256Shift,
4583            22 => ContractCostType::ChaCha20DrawBytes,
4584            23 => ContractCostType::ParseWasmInstructions,
4585            24 => ContractCostType::ParseWasmFunctions,
4586            25 => ContractCostType::ParseWasmGlobals,
4587            26 => ContractCostType::ParseWasmTableEntries,
4588            27 => ContractCostType::ParseWasmTypes,
4589            28 => ContractCostType::ParseWasmDataSegments,
4590            29 => ContractCostType::ParseWasmElemSegments,
4591            30 => ContractCostType::ParseWasmImports,
4592            31 => ContractCostType::ParseWasmExports,
4593            32 => ContractCostType::ParseWasmDataSegmentBytes,
4594            33 => ContractCostType::InstantiateWasmInstructions,
4595            34 => ContractCostType::InstantiateWasmFunctions,
4596            35 => ContractCostType::InstantiateWasmGlobals,
4597            36 => ContractCostType::InstantiateWasmTableEntries,
4598            37 => ContractCostType::InstantiateWasmTypes,
4599            38 => ContractCostType::InstantiateWasmDataSegments,
4600            39 => ContractCostType::InstantiateWasmElemSegments,
4601            40 => ContractCostType::InstantiateWasmImports,
4602            41 => ContractCostType::InstantiateWasmExports,
4603            42 => ContractCostType::InstantiateWasmDataSegmentBytes,
4604            43 => ContractCostType::Sec1DecodePointUncompressed,
4605            44 => ContractCostType::VerifyEcdsaSecp256r1Sig,
4606            45 => ContractCostType::Bls12381EncodeFp,
4607            46 => ContractCostType::Bls12381DecodeFp,
4608            47 => ContractCostType::Bls12381G1CheckPointOnCurve,
4609            48 => ContractCostType::Bls12381G1CheckPointInSubgroup,
4610            49 => ContractCostType::Bls12381G2CheckPointOnCurve,
4611            50 => ContractCostType::Bls12381G2CheckPointInSubgroup,
4612            51 => ContractCostType::Bls12381G1ProjectiveToAffine,
4613            52 => ContractCostType::Bls12381G2ProjectiveToAffine,
4614            53 => ContractCostType::Bls12381G1Add,
4615            54 => ContractCostType::Bls12381G1Mul,
4616            55 => ContractCostType::Bls12381G1Msm,
4617            56 => ContractCostType::Bls12381MapFpToG1,
4618            57 => ContractCostType::Bls12381HashToG1,
4619            58 => ContractCostType::Bls12381G2Add,
4620            59 => ContractCostType::Bls12381G2Mul,
4621            60 => ContractCostType::Bls12381G2Msm,
4622            61 => ContractCostType::Bls12381MapFp2ToG2,
4623            62 => ContractCostType::Bls12381HashToG2,
4624            63 => ContractCostType::Bls12381Pairing,
4625            64 => ContractCostType::Bls12381FrFromU256,
4626            65 => ContractCostType::Bls12381FrToU256,
4627            66 => ContractCostType::Bls12381FrAddSub,
4628            67 => ContractCostType::Bls12381FrMul,
4629            68 => ContractCostType::Bls12381FrPow,
4630            69 => ContractCostType::Bls12381FrInv,
4631            #[allow(unreachable_patterns)]
4632            _ => return Err(Error::Invalid),
4633        };
4634        Ok(e)
4635    }
4636}
4637
4638impl From<ContractCostType> for i32 {
4639    #[must_use]
4640    fn from(e: ContractCostType) -> Self {
4641        e as Self
4642    }
4643}
4644
4645impl ReadXdr for ContractCostType {
4646    #[cfg(feature = "std")]
4647    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
4648        r.with_limited_depth(|r| {
4649            let e = i32::read_xdr(r)?;
4650            let v: Self = e.try_into()?;
4651            Ok(v)
4652        })
4653    }
4654}
4655
4656impl WriteXdr for ContractCostType {
4657    #[cfg(feature = "std")]
4658    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
4659        w.with_limited_depth(|w| {
4660            let i: i32 = (*self).into();
4661            i.write_xdr(w)
4662        })
4663    }
4664}
4665
4666/// ContractCostParamEntry is an XDR Struct defines as:
4667///
4668/// ```text
4669/// struct ContractCostParamEntry {
4670///     // use `ext` to add more terms (e.g. higher order polynomials) in the future
4671///     ExtensionPoint ext;
4672///
4673///     int64 constTerm;
4674///     int64 linearTerm;
4675/// };
4676/// ```
4677///
4678#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
4679#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
4680#[cfg_attr(
4681    all(feature = "serde", feature = "alloc"),
4682    derive(serde::Serialize, serde::Deserialize),
4683    serde(rename_all = "snake_case")
4684)]
4685#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
4686pub struct ContractCostParamEntry {
4687    pub ext: ExtensionPoint,
4688    pub const_term: i64,
4689    pub linear_term: i64,
4690}
4691
4692impl ReadXdr for ContractCostParamEntry {
4693    #[cfg(feature = "std")]
4694    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
4695        r.with_limited_depth(|r| {
4696            Ok(Self {
4697                ext: ExtensionPoint::read_xdr(r)?,
4698                const_term: i64::read_xdr(r)?,
4699                linear_term: i64::read_xdr(r)?,
4700            })
4701        })
4702    }
4703}
4704
4705impl WriteXdr for ContractCostParamEntry {
4706    #[cfg(feature = "std")]
4707    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
4708        w.with_limited_depth(|w| {
4709            self.ext.write_xdr(w)?;
4710            self.const_term.write_xdr(w)?;
4711            self.linear_term.write_xdr(w)?;
4712            Ok(())
4713        })
4714    }
4715}
4716
4717/// StateArchivalSettings is an XDR Struct defines as:
4718///
4719/// ```text
4720/// struct StateArchivalSettings {
4721///     uint32 maxEntryTTL;
4722///     uint32 minTemporaryTTL;
4723///     uint32 minPersistentTTL;
4724///
4725///     // rent_fee = wfee_rate_average / rent_rate_denominator_for_type
4726///     int64 persistentRentRateDenominator;
4727///     int64 tempRentRateDenominator;
4728///
4729///     // max number of entries that emit archival meta in a single ledger
4730///     uint32 maxEntriesToArchive;
4731///
4732///     // Number of snapshots to use when calculating average BucketList size
4733///     uint32 bucketListSizeWindowSampleSize;
4734///
4735///     // How often to sample the BucketList size for the average, in ledgers
4736///     uint32 bucketListWindowSamplePeriod;
4737///
4738///     // Maximum number of bytes that we scan for eviction per ledger
4739///     uint32 evictionScanSize;
4740///
4741///     // Lowest BucketList level to be scanned to evict entries
4742///     uint32 startingEvictionScanLevel;
4743/// };
4744/// ```
4745///
4746#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
4747#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
4748#[cfg_attr(
4749    all(feature = "serde", feature = "alloc"),
4750    derive(serde::Serialize, serde::Deserialize),
4751    serde(rename_all = "snake_case")
4752)]
4753#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
4754pub struct StateArchivalSettings {
4755    pub max_entry_ttl: u32,
4756    pub min_temporary_ttl: u32,
4757    pub min_persistent_ttl: u32,
4758    pub persistent_rent_rate_denominator: i64,
4759    pub temp_rent_rate_denominator: i64,
4760    pub max_entries_to_archive: u32,
4761    pub bucket_list_size_window_sample_size: u32,
4762    pub bucket_list_window_sample_period: u32,
4763    pub eviction_scan_size: u32,
4764    pub starting_eviction_scan_level: u32,
4765}
4766
4767impl ReadXdr for StateArchivalSettings {
4768    #[cfg(feature = "std")]
4769    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
4770        r.with_limited_depth(|r| {
4771            Ok(Self {
4772                max_entry_ttl: u32::read_xdr(r)?,
4773                min_temporary_ttl: u32::read_xdr(r)?,
4774                min_persistent_ttl: u32::read_xdr(r)?,
4775                persistent_rent_rate_denominator: i64::read_xdr(r)?,
4776                temp_rent_rate_denominator: i64::read_xdr(r)?,
4777                max_entries_to_archive: u32::read_xdr(r)?,
4778                bucket_list_size_window_sample_size: u32::read_xdr(r)?,
4779                bucket_list_window_sample_period: u32::read_xdr(r)?,
4780                eviction_scan_size: u32::read_xdr(r)?,
4781                starting_eviction_scan_level: u32::read_xdr(r)?,
4782            })
4783        })
4784    }
4785}
4786
4787impl WriteXdr for StateArchivalSettings {
4788    #[cfg(feature = "std")]
4789    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
4790        w.with_limited_depth(|w| {
4791            self.max_entry_ttl.write_xdr(w)?;
4792            self.min_temporary_ttl.write_xdr(w)?;
4793            self.min_persistent_ttl.write_xdr(w)?;
4794            self.persistent_rent_rate_denominator.write_xdr(w)?;
4795            self.temp_rent_rate_denominator.write_xdr(w)?;
4796            self.max_entries_to_archive.write_xdr(w)?;
4797            self.bucket_list_size_window_sample_size.write_xdr(w)?;
4798            self.bucket_list_window_sample_period.write_xdr(w)?;
4799            self.eviction_scan_size.write_xdr(w)?;
4800            self.starting_eviction_scan_level.write_xdr(w)?;
4801            Ok(())
4802        })
4803    }
4804}
4805
4806/// EvictionIterator is an XDR Struct defines as:
4807///
4808/// ```text
4809/// struct EvictionIterator {
4810///     uint32 bucketListLevel;
4811///     bool isCurrBucket;
4812///     uint64 bucketFileOffset;
4813/// };
4814/// ```
4815///
4816#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
4817#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
4818#[cfg_attr(
4819    all(feature = "serde", feature = "alloc"),
4820    derive(serde::Serialize, serde::Deserialize),
4821    serde(rename_all = "snake_case")
4822)]
4823#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
4824pub struct EvictionIterator {
4825    pub bucket_list_level: u32,
4826    pub is_curr_bucket: bool,
4827    pub bucket_file_offset: u64,
4828}
4829
4830impl ReadXdr for EvictionIterator {
4831    #[cfg(feature = "std")]
4832    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
4833        r.with_limited_depth(|r| {
4834            Ok(Self {
4835                bucket_list_level: u32::read_xdr(r)?,
4836                is_curr_bucket: bool::read_xdr(r)?,
4837                bucket_file_offset: u64::read_xdr(r)?,
4838            })
4839        })
4840    }
4841}
4842
4843impl WriteXdr for EvictionIterator {
4844    #[cfg(feature = "std")]
4845    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
4846        w.with_limited_depth(|w| {
4847            self.bucket_list_level.write_xdr(w)?;
4848            self.is_curr_bucket.write_xdr(w)?;
4849            self.bucket_file_offset.write_xdr(w)?;
4850            Ok(())
4851        })
4852    }
4853}
4854
4855/// ContractCostCountLimit is an XDR Const defines as:
4856///
4857/// ```text
4858/// const CONTRACT_COST_COUNT_LIMIT = 1024;
4859/// ```
4860///
4861pub const CONTRACT_COST_COUNT_LIMIT: u64 = 1024;
4862
4863/// ContractCostParams is an XDR Typedef defines as:
4864///
4865/// ```text
4866/// typedef ContractCostParamEntry ContractCostParams<CONTRACT_COST_COUNT_LIMIT>;
4867/// ```
4868///
4869#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
4870#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
4871#[derive(Default)]
4872#[cfg_attr(
4873    all(feature = "serde", feature = "alloc"),
4874    derive(serde::Serialize, serde::Deserialize),
4875    serde(rename_all = "snake_case")
4876)]
4877#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
4878#[derive(Debug)]
4879pub struct ContractCostParams(pub VecM<ContractCostParamEntry, 1024>);
4880
4881impl From<ContractCostParams> for VecM<ContractCostParamEntry, 1024> {
4882    #[must_use]
4883    fn from(x: ContractCostParams) -> Self {
4884        x.0
4885    }
4886}
4887
4888impl From<VecM<ContractCostParamEntry, 1024>> for ContractCostParams {
4889    #[must_use]
4890    fn from(x: VecM<ContractCostParamEntry, 1024>) -> Self {
4891        ContractCostParams(x)
4892    }
4893}
4894
4895impl AsRef<VecM<ContractCostParamEntry, 1024>> for ContractCostParams {
4896    #[must_use]
4897    fn as_ref(&self) -> &VecM<ContractCostParamEntry, 1024> {
4898        &self.0
4899    }
4900}
4901
4902impl ReadXdr for ContractCostParams {
4903    #[cfg(feature = "std")]
4904    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
4905        r.with_limited_depth(|r| {
4906            let i = VecM::<ContractCostParamEntry, 1024>::read_xdr(r)?;
4907            let v = ContractCostParams(i);
4908            Ok(v)
4909        })
4910    }
4911}
4912
4913impl WriteXdr for ContractCostParams {
4914    #[cfg(feature = "std")]
4915    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
4916        w.with_limited_depth(|w| self.0.write_xdr(w))
4917    }
4918}
4919
4920impl Deref for ContractCostParams {
4921    type Target = VecM<ContractCostParamEntry, 1024>;
4922    fn deref(&self) -> &Self::Target {
4923        &self.0
4924    }
4925}
4926
4927impl From<ContractCostParams> for Vec<ContractCostParamEntry> {
4928    #[must_use]
4929    fn from(x: ContractCostParams) -> Self {
4930        x.0 .0
4931    }
4932}
4933
4934impl TryFrom<Vec<ContractCostParamEntry>> for ContractCostParams {
4935    type Error = Error;
4936    fn try_from(x: Vec<ContractCostParamEntry>) -> Result<Self> {
4937        Ok(ContractCostParams(x.try_into()?))
4938    }
4939}
4940
4941#[cfg(feature = "alloc")]
4942impl TryFrom<&Vec<ContractCostParamEntry>> for ContractCostParams {
4943    type Error = Error;
4944    fn try_from(x: &Vec<ContractCostParamEntry>) -> Result<Self> {
4945        Ok(ContractCostParams(x.try_into()?))
4946    }
4947}
4948
4949impl AsRef<Vec<ContractCostParamEntry>> for ContractCostParams {
4950    #[must_use]
4951    fn as_ref(&self) -> &Vec<ContractCostParamEntry> {
4952        &self.0 .0
4953    }
4954}
4955
4956impl AsRef<[ContractCostParamEntry]> for ContractCostParams {
4957    #[cfg(feature = "alloc")]
4958    #[must_use]
4959    fn as_ref(&self) -> &[ContractCostParamEntry] {
4960        &self.0 .0
4961    }
4962    #[cfg(not(feature = "alloc"))]
4963    #[must_use]
4964    fn as_ref(&self) -> &[ContractCostParamEntry] {
4965        self.0 .0
4966    }
4967}
4968
4969/// ConfigSettingId is an XDR Enum defines as:
4970///
4971/// ```text
4972/// enum ConfigSettingID
4973/// {
4974///     CONFIG_SETTING_CONTRACT_MAX_SIZE_BYTES = 0,
4975///     CONFIG_SETTING_CONTRACT_COMPUTE_V0 = 1,
4976///     CONFIG_SETTING_CONTRACT_LEDGER_COST_V0 = 2,
4977///     CONFIG_SETTING_CONTRACT_HISTORICAL_DATA_V0 = 3,
4978///     CONFIG_SETTING_CONTRACT_EVENTS_V0 = 4,
4979///     CONFIG_SETTING_CONTRACT_BANDWIDTH_V0 = 5,
4980///     CONFIG_SETTING_CONTRACT_COST_PARAMS_CPU_INSTRUCTIONS = 6,
4981///     CONFIG_SETTING_CONTRACT_COST_PARAMS_MEMORY_BYTES = 7,
4982///     CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES = 8,
4983///     CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES = 9,
4984///     CONFIG_SETTING_STATE_ARCHIVAL = 10,
4985///     CONFIG_SETTING_CONTRACT_EXECUTION_LANES = 11,
4986///     CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW = 12,
4987///     CONFIG_SETTING_EVICTION_ITERATOR = 13,
4988///     CONFIG_SETTING_CONTRACT_PARALLEL_COMPUTE_V0 = 14
4989/// };
4990/// ```
4991///
4992// enum
4993#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
4994#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
4995#[cfg_attr(
4996    all(feature = "serde", feature = "alloc"),
4997    derive(serde::Serialize, serde::Deserialize),
4998    serde(rename_all = "snake_case")
4999)]
5000#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
5001#[repr(i32)]
5002pub enum ConfigSettingId {
5003    ContractMaxSizeBytes = 0,
5004    ContractComputeV0 = 1,
5005    ContractLedgerCostV0 = 2,
5006    ContractHistoricalDataV0 = 3,
5007    ContractEventsV0 = 4,
5008    ContractBandwidthV0 = 5,
5009    ContractCostParamsCpuInstructions = 6,
5010    ContractCostParamsMemoryBytes = 7,
5011    ContractDataKeySizeBytes = 8,
5012    ContractDataEntrySizeBytes = 9,
5013    StateArchival = 10,
5014    ContractExecutionLanes = 11,
5015    BucketlistSizeWindow = 12,
5016    EvictionIterator = 13,
5017    ContractParallelComputeV0 = 14,
5018}
5019
5020impl ConfigSettingId {
5021    pub const VARIANTS: [ConfigSettingId; 15] = [
5022        ConfigSettingId::ContractMaxSizeBytes,
5023        ConfigSettingId::ContractComputeV0,
5024        ConfigSettingId::ContractLedgerCostV0,
5025        ConfigSettingId::ContractHistoricalDataV0,
5026        ConfigSettingId::ContractEventsV0,
5027        ConfigSettingId::ContractBandwidthV0,
5028        ConfigSettingId::ContractCostParamsCpuInstructions,
5029        ConfigSettingId::ContractCostParamsMemoryBytes,
5030        ConfigSettingId::ContractDataKeySizeBytes,
5031        ConfigSettingId::ContractDataEntrySizeBytes,
5032        ConfigSettingId::StateArchival,
5033        ConfigSettingId::ContractExecutionLanes,
5034        ConfigSettingId::BucketlistSizeWindow,
5035        ConfigSettingId::EvictionIterator,
5036        ConfigSettingId::ContractParallelComputeV0,
5037    ];
5038    pub const VARIANTS_STR: [&'static str; 15] = [
5039        "ContractMaxSizeBytes",
5040        "ContractComputeV0",
5041        "ContractLedgerCostV0",
5042        "ContractHistoricalDataV0",
5043        "ContractEventsV0",
5044        "ContractBandwidthV0",
5045        "ContractCostParamsCpuInstructions",
5046        "ContractCostParamsMemoryBytes",
5047        "ContractDataKeySizeBytes",
5048        "ContractDataEntrySizeBytes",
5049        "StateArchival",
5050        "ContractExecutionLanes",
5051        "BucketlistSizeWindow",
5052        "EvictionIterator",
5053        "ContractParallelComputeV0",
5054    ];
5055
5056    #[must_use]
5057    pub const fn name(&self) -> &'static str {
5058        match self {
5059            Self::ContractMaxSizeBytes => "ContractMaxSizeBytes",
5060            Self::ContractComputeV0 => "ContractComputeV0",
5061            Self::ContractLedgerCostV0 => "ContractLedgerCostV0",
5062            Self::ContractHistoricalDataV0 => "ContractHistoricalDataV0",
5063            Self::ContractEventsV0 => "ContractEventsV0",
5064            Self::ContractBandwidthV0 => "ContractBandwidthV0",
5065            Self::ContractCostParamsCpuInstructions => "ContractCostParamsCpuInstructions",
5066            Self::ContractCostParamsMemoryBytes => "ContractCostParamsMemoryBytes",
5067            Self::ContractDataKeySizeBytes => "ContractDataKeySizeBytes",
5068            Self::ContractDataEntrySizeBytes => "ContractDataEntrySizeBytes",
5069            Self::StateArchival => "StateArchival",
5070            Self::ContractExecutionLanes => "ContractExecutionLanes",
5071            Self::BucketlistSizeWindow => "BucketlistSizeWindow",
5072            Self::EvictionIterator => "EvictionIterator",
5073            Self::ContractParallelComputeV0 => "ContractParallelComputeV0",
5074        }
5075    }
5076
5077    #[must_use]
5078    pub const fn variants() -> [ConfigSettingId; 15] {
5079        Self::VARIANTS
5080    }
5081}
5082
5083impl Name for ConfigSettingId {
5084    #[must_use]
5085    fn name(&self) -> &'static str {
5086        Self::name(self)
5087    }
5088}
5089
5090impl Variants<ConfigSettingId> for ConfigSettingId {
5091    fn variants() -> slice::Iter<'static, ConfigSettingId> {
5092        Self::VARIANTS.iter()
5093    }
5094}
5095
5096impl Enum for ConfigSettingId {}
5097
5098impl fmt::Display for ConfigSettingId {
5099    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
5100        f.write_str(self.name())
5101    }
5102}
5103
5104impl TryFrom<i32> for ConfigSettingId {
5105    type Error = Error;
5106
5107    fn try_from(i: i32) -> Result<Self> {
5108        let e = match i {
5109            0 => ConfigSettingId::ContractMaxSizeBytes,
5110            1 => ConfigSettingId::ContractComputeV0,
5111            2 => ConfigSettingId::ContractLedgerCostV0,
5112            3 => ConfigSettingId::ContractHistoricalDataV0,
5113            4 => ConfigSettingId::ContractEventsV0,
5114            5 => ConfigSettingId::ContractBandwidthV0,
5115            6 => ConfigSettingId::ContractCostParamsCpuInstructions,
5116            7 => ConfigSettingId::ContractCostParamsMemoryBytes,
5117            8 => ConfigSettingId::ContractDataKeySizeBytes,
5118            9 => ConfigSettingId::ContractDataEntrySizeBytes,
5119            10 => ConfigSettingId::StateArchival,
5120            11 => ConfigSettingId::ContractExecutionLanes,
5121            12 => ConfigSettingId::BucketlistSizeWindow,
5122            13 => ConfigSettingId::EvictionIterator,
5123            14 => ConfigSettingId::ContractParallelComputeV0,
5124            #[allow(unreachable_patterns)]
5125            _ => return Err(Error::Invalid),
5126        };
5127        Ok(e)
5128    }
5129}
5130
5131impl From<ConfigSettingId> for i32 {
5132    #[must_use]
5133    fn from(e: ConfigSettingId) -> Self {
5134        e as Self
5135    }
5136}
5137
5138impl ReadXdr for ConfigSettingId {
5139    #[cfg(feature = "std")]
5140    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
5141        r.with_limited_depth(|r| {
5142            let e = i32::read_xdr(r)?;
5143            let v: Self = e.try_into()?;
5144            Ok(v)
5145        })
5146    }
5147}
5148
5149impl WriteXdr for ConfigSettingId {
5150    #[cfg(feature = "std")]
5151    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
5152        w.with_limited_depth(|w| {
5153            let i: i32 = (*self).into();
5154            i.write_xdr(w)
5155        })
5156    }
5157}
5158
5159/// ConfigSettingEntry is an XDR Union defines as:
5160///
5161/// ```text
5162/// union ConfigSettingEntry switch (ConfigSettingID configSettingID)
5163/// {
5164/// case CONFIG_SETTING_CONTRACT_MAX_SIZE_BYTES:
5165///     uint32 contractMaxSizeBytes;
5166/// case CONFIG_SETTING_CONTRACT_COMPUTE_V0:
5167///     ConfigSettingContractComputeV0 contractCompute;
5168/// case CONFIG_SETTING_CONTRACT_LEDGER_COST_V0:
5169///     ConfigSettingContractLedgerCostV0 contractLedgerCost;
5170/// case CONFIG_SETTING_CONTRACT_HISTORICAL_DATA_V0:
5171///     ConfigSettingContractHistoricalDataV0 contractHistoricalData;
5172/// case CONFIG_SETTING_CONTRACT_EVENTS_V0:
5173///     ConfigSettingContractEventsV0 contractEvents;
5174/// case CONFIG_SETTING_CONTRACT_BANDWIDTH_V0:
5175///     ConfigSettingContractBandwidthV0 contractBandwidth;
5176/// case CONFIG_SETTING_CONTRACT_COST_PARAMS_CPU_INSTRUCTIONS:
5177///     ContractCostParams contractCostParamsCpuInsns;
5178/// case CONFIG_SETTING_CONTRACT_COST_PARAMS_MEMORY_BYTES:
5179///     ContractCostParams contractCostParamsMemBytes;
5180/// case CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES:
5181///     uint32 contractDataKeySizeBytes;
5182/// case CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES:
5183///     uint32 contractDataEntrySizeBytes;
5184/// case CONFIG_SETTING_STATE_ARCHIVAL:
5185///     StateArchivalSettings stateArchivalSettings;
5186/// case CONFIG_SETTING_CONTRACT_EXECUTION_LANES:
5187///     ConfigSettingContractExecutionLanesV0 contractExecutionLanes;
5188/// case CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW:
5189///     uint64 bucketListSizeWindow<>;
5190/// case CONFIG_SETTING_EVICTION_ITERATOR:
5191///     EvictionIterator evictionIterator;
5192/// case CONFIG_SETTING_CONTRACT_PARALLEL_COMPUTE_V0:
5193///     ConfigSettingContractParallelComputeV0 contractParallelCompute;
5194/// };
5195/// ```
5196///
5197// union with discriminant ConfigSettingId
5198#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
5199#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
5200#[cfg_attr(
5201    all(feature = "serde", feature = "alloc"),
5202    derive(serde::Serialize, serde::Deserialize),
5203    serde(rename_all = "snake_case")
5204)]
5205#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
5206#[allow(clippy::large_enum_variant)]
5207pub enum ConfigSettingEntry {
5208    ContractMaxSizeBytes(u32),
5209    ContractComputeV0(ConfigSettingContractComputeV0),
5210    ContractLedgerCostV0(ConfigSettingContractLedgerCostV0),
5211    ContractHistoricalDataV0(ConfigSettingContractHistoricalDataV0),
5212    ContractEventsV0(ConfigSettingContractEventsV0),
5213    ContractBandwidthV0(ConfigSettingContractBandwidthV0),
5214    ContractCostParamsCpuInstructions(ContractCostParams),
5215    ContractCostParamsMemoryBytes(ContractCostParams),
5216    ContractDataKeySizeBytes(u32),
5217    ContractDataEntrySizeBytes(u32),
5218    StateArchival(StateArchivalSettings),
5219    ContractExecutionLanes(ConfigSettingContractExecutionLanesV0),
5220    BucketlistSizeWindow(VecM<u64>),
5221    EvictionIterator(EvictionIterator),
5222    ContractParallelComputeV0(ConfigSettingContractParallelComputeV0),
5223}
5224
5225impl ConfigSettingEntry {
5226    pub const VARIANTS: [ConfigSettingId; 15] = [
5227        ConfigSettingId::ContractMaxSizeBytes,
5228        ConfigSettingId::ContractComputeV0,
5229        ConfigSettingId::ContractLedgerCostV0,
5230        ConfigSettingId::ContractHistoricalDataV0,
5231        ConfigSettingId::ContractEventsV0,
5232        ConfigSettingId::ContractBandwidthV0,
5233        ConfigSettingId::ContractCostParamsCpuInstructions,
5234        ConfigSettingId::ContractCostParamsMemoryBytes,
5235        ConfigSettingId::ContractDataKeySizeBytes,
5236        ConfigSettingId::ContractDataEntrySizeBytes,
5237        ConfigSettingId::StateArchival,
5238        ConfigSettingId::ContractExecutionLanes,
5239        ConfigSettingId::BucketlistSizeWindow,
5240        ConfigSettingId::EvictionIterator,
5241        ConfigSettingId::ContractParallelComputeV0,
5242    ];
5243    pub const VARIANTS_STR: [&'static str; 15] = [
5244        "ContractMaxSizeBytes",
5245        "ContractComputeV0",
5246        "ContractLedgerCostV0",
5247        "ContractHistoricalDataV0",
5248        "ContractEventsV0",
5249        "ContractBandwidthV0",
5250        "ContractCostParamsCpuInstructions",
5251        "ContractCostParamsMemoryBytes",
5252        "ContractDataKeySizeBytes",
5253        "ContractDataEntrySizeBytes",
5254        "StateArchival",
5255        "ContractExecutionLanes",
5256        "BucketlistSizeWindow",
5257        "EvictionIterator",
5258        "ContractParallelComputeV0",
5259    ];
5260
5261    #[must_use]
5262    pub const fn name(&self) -> &'static str {
5263        match self {
5264            Self::ContractMaxSizeBytes(_) => "ContractMaxSizeBytes",
5265            Self::ContractComputeV0(_) => "ContractComputeV0",
5266            Self::ContractLedgerCostV0(_) => "ContractLedgerCostV0",
5267            Self::ContractHistoricalDataV0(_) => "ContractHistoricalDataV0",
5268            Self::ContractEventsV0(_) => "ContractEventsV0",
5269            Self::ContractBandwidthV0(_) => "ContractBandwidthV0",
5270            Self::ContractCostParamsCpuInstructions(_) => "ContractCostParamsCpuInstructions",
5271            Self::ContractCostParamsMemoryBytes(_) => "ContractCostParamsMemoryBytes",
5272            Self::ContractDataKeySizeBytes(_) => "ContractDataKeySizeBytes",
5273            Self::ContractDataEntrySizeBytes(_) => "ContractDataEntrySizeBytes",
5274            Self::StateArchival(_) => "StateArchival",
5275            Self::ContractExecutionLanes(_) => "ContractExecutionLanes",
5276            Self::BucketlistSizeWindow(_) => "BucketlistSizeWindow",
5277            Self::EvictionIterator(_) => "EvictionIterator",
5278            Self::ContractParallelComputeV0(_) => "ContractParallelComputeV0",
5279        }
5280    }
5281
5282    #[must_use]
5283    pub const fn discriminant(&self) -> ConfigSettingId {
5284        #[allow(clippy::match_same_arms)]
5285        match self {
5286            Self::ContractMaxSizeBytes(_) => ConfigSettingId::ContractMaxSizeBytes,
5287            Self::ContractComputeV0(_) => ConfigSettingId::ContractComputeV0,
5288            Self::ContractLedgerCostV0(_) => ConfigSettingId::ContractLedgerCostV0,
5289            Self::ContractHistoricalDataV0(_) => ConfigSettingId::ContractHistoricalDataV0,
5290            Self::ContractEventsV0(_) => ConfigSettingId::ContractEventsV0,
5291            Self::ContractBandwidthV0(_) => ConfigSettingId::ContractBandwidthV0,
5292            Self::ContractCostParamsCpuInstructions(_) => {
5293                ConfigSettingId::ContractCostParamsCpuInstructions
5294            }
5295            Self::ContractCostParamsMemoryBytes(_) => {
5296                ConfigSettingId::ContractCostParamsMemoryBytes
5297            }
5298            Self::ContractDataKeySizeBytes(_) => ConfigSettingId::ContractDataKeySizeBytes,
5299            Self::ContractDataEntrySizeBytes(_) => ConfigSettingId::ContractDataEntrySizeBytes,
5300            Self::StateArchival(_) => ConfigSettingId::StateArchival,
5301            Self::ContractExecutionLanes(_) => ConfigSettingId::ContractExecutionLanes,
5302            Self::BucketlistSizeWindow(_) => ConfigSettingId::BucketlistSizeWindow,
5303            Self::EvictionIterator(_) => ConfigSettingId::EvictionIterator,
5304            Self::ContractParallelComputeV0(_) => ConfigSettingId::ContractParallelComputeV0,
5305        }
5306    }
5307
5308    #[must_use]
5309    pub const fn variants() -> [ConfigSettingId; 15] {
5310        Self::VARIANTS
5311    }
5312}
5313
5314impl Name for ConfigSettingEntry {
5315    #[must_use]
5316    fn name(&self) -> &'static str {
5317        Self::name(self)
5318    }
5319}
5320
5321impl Discriminant<ConfigSettingId> for ConfigSettingEntry {
5322    #[must_use]
5323    fn discriminant(&self) -> ConfigSettingId {
5324        Self::discriminant(self)
5325    }
5326}
5327
5328impl Variants<ConfigSettingId> for ConfigSettingEntry {
5329    fn variants() -> slice::Iter<'static, ConfigSettingId> {
5330        Self::VARIANTS.iter()
5331    }
5332}
5333
5334impl Union<ConfigSettingId> for ConfigSettingEntry {}
5335
5336impl ReadXdr for ConfigSettingEntry {
5337    #[cfg(feature = "std")]
5338    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
5339        r.with_limited_depth(|r| {
5340            let dv: ConfigSettingId = <ConfigSettingId as ReadXdr>::read_xdr(r)?;
5341            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
5342            let v = match dv {
5343                ConfigSettingId::ContractMaxSizeBytes => {
5344                    Self::ContractMaxSizeBytes(u32::read_xdr(r)?)
5345                }
5346                ConfigSettingId::ContractComputeV0 => {
5347                    Self::ContractComputeV0(ConfigSettingContractComputeV0::read_xdr(r)?)
5348                }
5349                ConfigSettingId::ContractLedgerCostV0 => {
5350                    Self::ContractLedgerCostV0(ConfigSettingContractLedgerCostV0::read_xdr(r)?)
5351                }
5352                ConfigSettingId::ContractHistoricalDataV0 => Self::ContractHistoricalDataV0(
5353                    ConfigSettingContractHistoricalDataV0::read_xdr(r)?,
5354                ),
5355                ConfigSettingId::ContractEventsV0 => {
5356                    Self::ContractEventsV0(ConfigSettingContractEventsV0::read_xdr(r)?)
5357                }
5358                ConfigSettingId::ContractBandwidthV0 => {
5359                    Self::ContractBandwidthV0(ConfigSettingContractBandwidthV0::read_xdr(r)?)
5360                }
5361                ConfigSettingId::ContractCostParamsCpuInstructions => {
5362                    Self::ContractCostParamsCpuInstructions(ContractCostParams::read_xdr(r)?)
5363                }
5364                ConfigSettingId::ContractCostParamsMemoryBytes => {
5365                    Self::ContractCostParamsMemoryBytes(ContractCostParams::read_xdr(r)?)
5366                }
5367                ConfigSettingId::ContractDataKeySizeBytes => {
5368                    Self::ContractDataKeySizeBytes(u32::read_xdr(r)?)
5369                }
5370                ConfigSettingId::ContractDataEntrySizeBytes => {
5371                    Self::ContractDataEntrySizeBytes(u32::read_xdr(r)?)
5372                }
5373                ConfigSettingId::StateArchival => {
5374                    Self::StateArchival(StateArchivalSettings::read_xdr(r)?)
5375                }
5376                ConfigSettingId::ContractExecutionLanes => Self::ContractExecutionLanes(
5377                    ConfigSettingContractExecutionLanesV0::read_xdr(r)?,
5378                ),
5379                ConfigSettingId::BucketlistSizeWindow => {
5380                    Self::BucketlistSizeWindow(VecM::<u64>::read_xdr(r)?)
5381                }
5382                ConfigSettingId::EvictionIterator => {
5383                    Self::EvictionIterator(EvictionIterator::read_xdr(r)?)
5384                }
5385                ConfigSettingId::ContractParallelComputeV0 => Self::ContractParallelComputeV0(
5386                    ConfigSettingContractParallelComputeV0::read_xdr(r)?,
5387                ),
5388                #[allow(unreachable_patterns)]
5389                _ => return Err(Error::Invalid),
5390            };
5391            Ok(v)
5392        })
5393    }
5394}
5395
5396impl WriteXdr for ConfigSettingEntry {
5397    #[cfg(feature = "std")]
5398    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
5399        w.with_limited_depth(|w| {
5400            self.discriminant().write_xdr(w)?;
5401            #[allow(clippy::match_same_arms)]
5402            match self {
5403                Self::ContractMaxSizeBytes(v) => v.write_xdr(w)?,
5404                Self::ContractComputeV0(v) => v.write_xdr(w)?,
5405                Self::ContractLedgerCostV0(v) => v.write_xdr(w)?,
5406                Self::ContractHistoricalDataV0(v) => v.write_xdr(w)?,
5407                Self::ContractEventsV0(v) => v.write_xdr(w)?,
5408                Self::ContractBandwidthV0(v) => v.write_xdr(w)?,
5409                Self::ContractCostParamsCpuInstructions(v) => v.write_xdr(w)?,
5410                Self::ContractCostParamsMemoryBytes(v) => v.write_xdr(w)?,
5411                Self::ContractDataKeySizeBytes(v) => v.write_xdr(w)?,
5412                Self::ContractDataEntrySizeBytes(v) => v.write_xdr(w)?,
5413                Self::StateArchival(v) => v.write_xdr(w)?,
5414                Self::ContractExecutionLanes(v) => v.write_xdr(w)?,
5415                Self::BucketlistSizeWindow(v) => v.write_xdr(w)?,
5416                Self::EvictionIterator(v) => v.write_xdr(w)?,
5417                Self::ContractParallelComputeV0(v) => v.write_xdr(w)?,
5418            };
5419            Ok(())
5420        })
5421    }
5422}
5423
5424/// ScEnvMetaKind is an XDR Enum defines as:
5425///
5426/// ```text
5427/// enum SCEnvMetaKind
5428/// {
5429///     SC_ENV_META_KIND_INTERFACE_VERSION = 0
5430/// };
5431/// ```
5432///
5433// enum
5434#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
5435#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
5436#[cfg_attr(
5437    all(feature = "serde", feature = "alloc"),
5438    derive(serde::Serialize, serde::Deserialize),
5439    serde(rename_all = "snake_case")
5440)]
5441#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
5442#[repr(i32)]
5443pub enum ScEnvMetaKind {
5444    ScEnvMetaKindInterfaceVersion = 0,
5445}
5446
5447impl ScEnvMetaKind {
5448    pub const VARIANTS: [ScEnvMetaKind; 1] = [ScEnvMetaKind::ScEnvMetaKindInterfaceVersion];
5449    pub const VARIANTS_STR: [&'static str; 1] = ["ScEnvMetaKindInterfaceVersion"];
5450
5451    #[must_use]
5452    pub const fn name(&self) -> &'static str {
5453        match self {
5454            Self::ScEnvMetaKindInterfaceVersion => "ScEnvMetaKindInterfaceVersion",
5455        }
5456    }
5457
5458    #[must_use]
5459    pub const fn variants() -> [ScEnvMetaKind; 1] {
5460        Self::VARIANTS
5461    }
5462}
5463
5464impl Name for ScEnvMetaKind {
5465    #[must_use]
5466    fn name(&self) -> &'static str {
5467        Self::name(self)
5468    }
5469}
5470
5471impl Variants<ScEnvMetaKind> for ScEnvMetaKind {
5472    fn variants() -> slice::Iter<'static, ScEnvMetaKind> {
5473        Self::VARIANTS.iter()
5474    }
5475}
5476
5477impl Enum for ScEnvMetaKind {}
5478
5479impl fmt::Display for ScEnvMetaKind {
5480    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
5481        f.write_str(self.name())
5482    }
5483}
5484
5485impl TryFrom<i32> for ScEnvMetaKind {
5486    type Error = Error;
5487
5488    fn try_from(i: i32) -> Result<Self> {
5489        let e = match i {
5490            0 => ScEnvMetaKind::ScEnvMetaKindInterfaceVersion,
5491            #[allow(unreachable_patterns)]
5492            _ => return Err(Error::Invalid),
5493        };
5494        Ok(e)
5495    }
5496}
5497
5498impl From<ScEnvMetaKind> for i32 {
5499    #[must_use]
5500    fn from(e: ScEnvMetaKind) -> Self {
5501        e as Self
5502    }
5503}
5504
5505impl ReadXdr for ScEnvMetaKind {
5506    #[cfg(feature = "std")]
5507    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
5508        r.with_limited_depth(|r| {
5509            let e = i32::read_xdr(r)?;
5510            let v: Self = e.try_into()?;
5511            Ok(v)
5512        })
5513    }
5514}
5515
5516impl WriteXdr for ScEnvMetaKind {
5517    #[cfg(feature = "std")]
5518    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
5519        w.with_limited_depth(|w| {
5520            let i: i32 = (*self).into();
5521            i.write_xdr(w)
5522        })
5523    }
5524}
5525
5526/// ScEnvMetaEntryInterfaceVersion is an XDR NestedStruct defines as:
5527///
5528/// ```text
5529/// struct {
5530///         uint32 protocol;
5531///         uint32 preRelease;
5532///     }
5533/// ```
5534///
5535#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
5536#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
5537#[cfg_attr(
5538    all(feature = "serde", feature = "alloc"),
5539    derive(serde::Serialize, serde::Deserialize),
5540    serde(rename_all = "snake_case")
5541)]
5542#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
5543pub struct ScEnvMetaEntryInterfaceVersion {
5544    pub protocol: u32,
5545    pub pre_release: u32,
5546}
5547
5548impl ReadXdr for ScEnvMetaEntryInterfaceVersion {
5549    #[cfg(feature = "std")]
5550    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
5551        r.with_limited_depth(|r| {
5552            Ok(Self {
5553                protocol: u32::read_xdr(r)?,
5554                pre_release: u32::read_xdr(r)?,
5555            })
5556        })
5557    }
5558}
5559
5560impl WriteXdr for ScEnvMetaEntryInterfaceVersion {
5561    #[cfg(feature = "std")]
5562    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
5563        w.with_limited_depth(|w| {
5564            self.protocol.write_xdr(w)?;
5565            self.pre_release.write_xdr(w)?;
5566            Ok(())
5567        })
5568    }
5569}
5570
5571/// ScEnvMetaEntry is an XDR Union defines as:
5572///
5573/// ```text
5574/// union SCEnvMetaEntry switch (SCEnvMetaKind kind)
5575/// {
5576/// case SC_ENV_META_KIND_INTERFACE_VERSION:
5577///     struct {
5578///         uint32 protocol;
5579///         uint32 preRelease;
5580///     } interfaceVersion;
5581/// };
5582/// ```
5583///
5584// union with discriminant ScEnvMetaKind
5585#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
5586#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
5587#[cfg_attr(
5588    all(feature = "serde", feature = "alloc"),
5589    derive(serde::Serialize, serde::Deserialize),
5590    serde(rename_all = "snake_case")
5591)]
5592#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
5593#[allow(clippy::large_enum_variant)]
5594pub enum ScEnvMetaEntry {
5595    ScEnvMetaKindInterfaceVersion(ScEnvMetaEntryInterfaceVersion),
5596}
5597
5598impl ScEnvMetaEntry {
5599    pub const VARIANTS: [ScEnvMetaKind; 1] = [ScEnvMetaKind::ScEnvMetaKindInterfaceVersion];
5600    pub const VARIANTS_STR: [&'static str; 1] = ["ScEnvMetaKindInterfaceVersion"];
5601
5602    #[must_use]
5603    pub const fn name(&self) -> &'static str {
5604        match self {
5605            Self::ScEnvMetaKindInterfaceVersion(_) => "ScEnvMetaKindInterfaceVersion",
5606        }
5607    }
5608
5609    #[must_use]
5610    pub const fn discriminant(&self) -> ScEnvMetaKind {
5611        #[allow(clippy::match_same_arms)]
5612        match self {
5613            Self::ScEnvMetaKindInterfaceVersion(_) => ScEnvMetaKind::ScEnvMetaKindInterfaceVersion,
5614        }
5615    }
5616
5617    #[must_use]
5618    pub const fn variants() -> [ScEnvMetaKind; 1] {
5619        Self::VARIANTS
5620    }
5621}
5622
5623impl Name for ScEnvMetaEntry {
5624    #[must_use]
5625    fn name(&self) -> &'static str {
5626        Self::name(self)
5627    }
5628}
5629
5630impl Discriminant<ScEnvMetaKind> for ScEnvMetaEntry {
5631    #[must_use]
5632    fn discriminant(&self) -> ScEnvMetaKind {
5633        Self::discriminant(self)
5634    }
5635}
5636
5637impl Variants<ScEnvMetaKind> for ScEnvMetaEntry {
5638    fn variants() -> slice::Iter<'static, ScEnvMetaKind> {
5639        Self::VARIANTS.iter()
5640    }
5641}
5642
5643impl Union<ScEnvMetaKind> for ScEnvMetaEntry {}
5644
5645impl ReadXdr for ScEnvMetaEntry {
5646    #[cfg(feature = "std")]
5647    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
5648        r.with_limited_depth(|r| {
5649            let dv: ScEnvMetaKind = <ScEnvMetaKind as ReadXdr>::read_xdr(r)?;
5650            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
5651            let v = match dv {
5652                ScEnvMetaKind::ScEnvMetaKindInterfaceVersion => {
5653                    Self::ScEnvMetaKindInterfaceVersion(ScEnvMetaEntryInterfaceVersion::read_xdr(
5654                        r,
5655                    )?)
5656                }
5657                #[allow(unreachable_patterns)]
5658                _ => return Err(Error::Invalid),
5659            };
5660            Ok(v)
5661        })
5662    }
5663}
5664
5665impl WriteXdr for ScEnvMetaEntry {
5666    #[cfg(feature = "std")]
5667    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
5668        w.with_limited_depth(|w| {
5669            self.discriminant().write_xdr(w)?;
5670            #[allow(clippy::match_same_arms)]
5671            match self {
5672                Self::ScEnvMetaKindInterfaceVersion(v) => v.write_xdr(w)?,
5673            };
5674            Ok(())
5675        })
5676    }
5677}
5678
5679/// ScMetaV0 is an XDR Struct defines as:
5680///
5681/// ```text
5682/// struct SCMetaV0
5683/// {
5684///     string key<>;
5685///     string val<>;
5686/// };
5687/// ```
5688///
5689#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
5690#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
5691#[cfg_attr(
5692    all(feature = "serde", feature = "alloc"),
5693    derive(serde::Serialize, serde::Deserialize),
5694    serde(rename_all = "snake_case")
5695)]
5696#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
5697pub struct ScMetaV0 {
5698    pub key: StringM,
5699    pub val: StringM,
5700}
5701
5702impl ReadXdr for ScMetaV0 {
5703    #[cfg(feature = "std")]
5704    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
5705        r.with_limited_depth(|r| {
5706            Ok(Self {
5707                key: StringM::read_xdr(r)?,
5708                val: StringM::read_xdr(r)?,
5709            })
5710        })
5711    }
5712}
5713
5714impl WriteXdr for ScMetaV0 {
5715    #[cfg(feature = "std")]
5716    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
5717        w.with_limited_depth(|w| {
5718            self.key.write_xdr(w)?;
5719            self.val.write_xdr(w)?;
5720            Ok(())
5721        })
5722    }
5723}
5724
5725/// ScMetaKind is an XDR Enum defines as:
5726///
5727/// ```text
5728/// enum SCMetaKind
5729/// {
5730///     SC_META_V0 = 0
5731/// };
5732/// ```
5733///
5734// enum
5735#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
5736#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
5737#[cfg_attr(
5738    all(feature = "serde", feature = "alloc"),
5739    derive(serde::Serialize, serde::Deserialize),
5740    serde(rename_all = "snake_case")
5741)]
5742#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
5743#[repr(i32)]
5744pub enum ScMetaKind {
5745    ScMetaV0 = 0,
5746}
5747
5748impl ScMetaKind {
5749    pub const VARIANTS: [ScMetaKind; 1] = [ScMetaKind::ScMetaV0];
5750    pub const VARIANTS_STR: [&'static str; 1] = ["ScMetaV0"];
5751
5752    #[must_use]
5753    pub const fn name(&self) -> &'static str {
5754        match self {
5755            Self::ScMetaV0 => "ScMetaV0",
5756        }
5757    }
5758
5759    #[must_use]
5760    pub const fn variants() -> [ScMetaKind; 1] {
5761        Self::VARIANTS
5762    }
5763}
5764
5765impl Name for ScMetaKind {
5766    #[must_use]
5767    fn name(&self) -> &'static str {
5768        Self::name(self)
5769    }
5770}
5771
5772impl Variants<ScMetaKind> for ScMetaKind {
5773    fn variants() -> slice::Iter<'static, ScMetaKind> {
5774        Self::VARIANTS.iter()
5775    }
5776}
5777
5778impl Enum for ScMetaKind {}
5779
5780impl fmt::Display for ScMetaKind {
5781    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
5782        f.write_str(self.name())
5783    }
5784}
5785
5786impl TryFrom<i32> for ScMetaKind {
5787    type Error = Error;
5788
5789    fn try_from(i: i32) -> Result<Self> {
5790        let e = match i {
5791            0 => ScMetaKind::ScMetaV0,
5792            #[allow(unreachable_patterns)]
5793            _ => return Err(Error::Invalid),
5794        };
5795        Ok(e)
5796    }
5797}
5798
5799impl From<ScMetaKind> for i32 {
5800    #[must_use]
5801    fn from(e: ScMetaKind) -> Self {
5802        e as Self
5803    }
5804}
5805
5806impl ReadXdr for ScMetaKind {
5807    #[cfg(feature = "std")]
5808    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
5809        r.with_limited_depth(|r| {
5810            let e = i32::read_xdr(r)?;
5811            let v: Self = e.try_into()?;
5812            Ok(v)
5813        })
5814    }
5815}
5816
5817impl WriteXdr for ScMetaKind {
5818    #[cfg(feature = "std")]
5819    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
5820        w.with_limited_depth(|w| {
5821            let i: i32 = (*self).into();
5822            i.write_xdr(w)
5823        })
5824    }
5825}
5826
5827/// ScMetaEntry is an XDR Union defines as:
5828///
5829/// ```text
5830/// union SCMetaEntry switch (SCMetaKind kind)
5831/// {
5832/// case SC_META_V0:
5833///     SCMetaV0 v0;
5834/// };
5835/// ```
5836///
5837// union with discriminant ScMetaKind
5838#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
5839#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
5840#[cfg_attr(
5841    all(feature = "serde", feature = "alloc"),
5842    derive(serde::Serialize, serde::Deserialize),
5843    serde(rename_all = "snake_case")
5844)]
5845#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
5846#[allow(clippy::large_enum_variant)]
5847pub enum ScMetaEntry {
5848    ScMetaV0(ScMetaV0),
5849}
5850
5851impl ScMetaEntry {
5852    pub const VARIANTS: [ScMetaKind; 1] = [ScMetaKind::ScMetaV0];
5853    pub const VARIANTS_STR: [&'static str; 1] = ["ScMetaV0"];
5854
5855    #[must_use]
5856    pub const fn name(&self) -> &'static str {
5857        match self {
5858            Self::ScMetaV0(_) => "ScMetaV0",
5859        }
5860    }
5861
5862    #[must_use]
5863    pub const fn discriminant(&self) -> ScMetaKind {
5864        #[allow(clippy::match_same_arms)]
5865        match self {
5866            Self::ScMetaV0(_) => ScMetaKind::ScMetaV0,
5867        }
5868    }
5869
5870    #[must_use]
5871    pub const fn variants() -> [ScMetaKind; 1] {
5872        Self::VARIANTS
5873    }
5874}
5875
5876impl Name for ScMetaEntry {
5877    #[must_use]
5878    fn name(&self) -> &'static str {
5879        Self::name(self)
5880    }
5881}
5882
5883impl Discriminant<ScMetaKind> for ScMetaEntry {
5884    #[must_use]
5885    fn discriminant(&self) -> ScMetaKind {
5886        Self::discriminant(self)
5887    }
5888}
5889
5890impl Variants<ScMetaKind> for ScMetaEntry {
5891    fn variants() -> slice::Iter<'static, ScMetaKind> {
5892        Self::VARIANTS.iter()
5893    }
5894}
5895
5896impl Union<ScMetaKind> for ScMetaEntry {}
5897
5898impl ReadXdr for ScMetaEntry {
5899    #[cfg(feature = "std")]
5900    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
5901        r.with_limited_depth(|r| {
5902            let dv: ScMetaKind = <ScMetaKind as ReadXdr>::read_xdr(r)?;
5903            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
5904            let v = match dv {
5905                ScMetaKind::ScMetaV0 => Self::ScMetaV0(ScMetaV0::read_xdr(r)?),
5906                #[allow(unreachable_patterns)]
5907                _ => return Err(Error::Invalid),
5908            };
5909            Ok(v)
5910        })
5911    }
5912}
5913
5914impl WriteXdr for ScMetaEntry {
5915    #[cfg(feature = "std")]
5916    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
5917        w.with_limited_depth(|w| {
5918            self.discriminant().write_xdr(w)?;
5919            #[allow(clippy::match_same_arms)]
5920            match self {
5921                Self::ScMetaV0(v) => v.write_xdr(w)?,
5922            };
5923            Ok(())
5924        })
5925    }
5926}
5927
5928/// ScSpecDocLimit is an XDR Const defines as:
5929///
5930/// ```text
5931/// const SC_SPEC_DOC_LIMIT = 1024;
5932/// ```
5933///
5934pub const SC_SPEC_DOC_LIMIT: u64 = 1024;
5935
5936/// ScSpecType is an XDR Enum defines as:
5937///
5938/// ```text
5939/// enum SCSpecType
5940/// {
5941///     SC_SPEC_TYPE_VAL = 0,
5942///
5943///     // Types with no parameters.
5944///     SC_SPEC_TYPE_BOOL = 1,
5945///     SC_SPEC_TYPE_VOID = 2,
5946///     SC_SPEC_TYPE_ERROR = 3,
5947///     SC_SPEC_TYPE_U32 = 4,
5948///     SC_SPEC_TYPE_I32 = 5,
5949///     SC_SPEC_TYPE_U64 = 6,
5950///     SC_SPEC_TYPE_I64 = 7,
5951///     SC_SPEC_TYPE_TIMEPOINT = 8,
5952///     SC_SPEC_TYPE_DURATION = 9,
5953///     SC_SPEC_TYPE_U128 = 10,
5954///     SC_SPEC_TYPE_I128 = 11,
5955///     SC_SPEC_TYPE_U256 = 12,
5956///     SC_SPEC_TYPE_I256 = 13,
5957///     SC_SPEC_TYPE_BYTES = 14,
5958///     SC_SPEC_TYPE_STRING = 16,
5959///     SC_SPEC_TYPE_SYMBOL = 17,
5960///     SC_SPEC_TYPE_ADDRESS = 19,
5961///
5962///     // Types with parameters.
5963///     SC_SPEC_TYPE_OPTION = 1000,
5964///     SC_SPEC_TYPE_RESULT = 1001,
5965///     SC_SPEC_TYPE_VEC = 1002,
5966///     SC_SPEC_TYPE_MAP = 1004,
5967///     SC_SPEC_TYPE_TUPLE = 1005,
5968///     SC_SPEC_TYPE_BYTES_N = 1006,
5969///
5970///     // User defined types.
5971///     SC_SPEC_TYPE_UDT = 2000
5972/// };
5973/// ```
5974///
5975// enum
5976#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
5977#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
5978#[cfg_attr(
5979    all(feature = "serde", feature = "alloc"),
5980    derive(serde::Serialize, serde::Deserialize),
5981    serde(rename_all = "snake_case")
5982)]
5983#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
5984#[repr(i32)]
5985pub enum ScSpecType {
5986    Val = 0,
5987    Bool = 1,
5988    Void = 2,
5989    Error = 3,
5990    U32 = 4,
5991    I32 = 5,
5992    U64 = 6,
5993    I64 = 7,
5994    Timepoint = 8,
5995    Duration = 9,
5996    U128 = 10,
5997    I128 = 11,
5998    U256 = 12,
5999    I256 = 13,
6000    Bytes = 14,
6001    String = 16,
6002    Symbol = 17,
6003    Address = 19,
6004    Option = 1000,
6005    Result = 1001,
6006    Vec = 1002,
6007    Map = 1004,
6008    Tuple = 1005,
6009    BytesN = 1006,
6010    Udt = 2000,
6011}
6012
6013impl ScSpecType {
6014    pub const VARIANTS: [ScSpecType; 25] = [
6015        ScSpecType::Val,
6016        ScSpecType::Bool,
6017        ScSpecType::Void,
6018        ScSpecType::Error,
6019        ScSpecType::U32,
6020        ScSpecType::I32,
6021        ScSpecType::U64,
6022        ScSpecType::I64,
6023        ScSpecType::Timepoint,
6024        ScSpecType::Duration,
6025        ScSpecType::U128,
6026        ScSpecType::I128,
6027        ScSpecType::U256,
6028        ScSpecType::I256,
6029        ScSpecType::Bytes,
6030        ScSpecType::String,
6031        ScSpecType::Symbol,
6032        ScSpecType::Address,
6033        ScSpecType::Option,
6034        ScSpecType::Result,
6035        ScSpecType::Vec,
6036        ScSpecType::Map,
6037        ScSpecType::Tuple,
6038        ScSpecType::BytesN,
6039        ScSpecType::Udt,
6040    ];
6041    pub const VARIANTS_STR: [&'static str; 25] = [
6042        "Val",
6043        "Bool",
6044        "Void",
6045        "Error",
6046        "U32",
6047        "I32",
6048        "U64",
6049        "I64",
6050        "Timepoint",
6051        "Duration",
6052        "U128",
6053        "I128",
6054        "U256",
6055        "I256",
6056        "Bytes",
6057        "String",
6058        "Symbol",
6059        "Address",
6060        "Option",
6061        "Result",
6062        "Vec",
6063        "Map",
6064        "Tuple",
6065        "BytesN",
6066        "Udt",
6067    ];
6068
6069    #[must_use]
6070    pub const fn name(&self) -> &'static str {
6071        match self {
6072            Self::Val => "Val",
6073            Self::Bool => "Bool",
6074            Self::Void => "Void",
6075            Self::Error => "Error",
6076            Self::U32 => "U32",
6077            Self::I32 => "I32",
6078            Self::U64 => "U64",
6079            Self::I64 => "I64",
6080            Self::Timepoint => "Timepoint",
6081            Self::Duration => "Duration",
6082            Self::U128 => "U128",
6083            Self::I128 => "I128",
6084            Self::U256 => "U256",
6085            Self::I256 => "I256",
6086            Self::Bytes => "Bytes",
6087            Self::String => "String",
6088            Self::Symbol => "Symbol",
6089            Self::Address => "Address",
6090            Self::Option => "Option",
6091            Self::Result => "Result",
6092            Self::Vec => "Vec",
6093            Self::Map => "Map",
6094            Self::Tuple => "Tuple",
6095            Self::BytesN => "BytesN",
6096            Self::Udt => "Udt",
6097        }
6098    }
6099
6100    #[must_use]
6101    pub const fn variants() -> [ScSpecType; 25] {
6102        Self::VARIANTS
6103    }
6104}
6105
6106impl Name for ScSpecType {
6107    #[must_use]
6108    fn name(&self) -> &'static str {
6109        Self::name(self)
6110    }
6111}
6112
6113impl Variants<ScSpecType> for ScSpecType {
6114    fn variants() -> slice::Iter<'static, ScSpecType> {
6115        Self::VARIANTS.iter()
6116    }
6117}
6118
6119impl Enum for ScSpecType {}
6120
6121impl fmt::Display for ScSpecType {
6122    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
6123        f.write_str(self.name())
6124    }
6125}
6126
6127impl TryFrom<i32> for ScSpecType {
6128    type Error = Error;
6129
6130    fn try_from(i: i32) -> Result<Self> {
6131        let e = match i {
6132            0 => ScSpecType::Val,
6133            1 => ScSpecType::Bool,
6134            2 => ScSpecType::Void,
6135            3 => ScSpecType::Error,
6136            4 => ScSpecType::U32,
6137            5 => ScSpecType::I32,
6138            6 => ScSpecType::U64,
6139            7 => ScSpecType::I64,
6140            8 => ScSpecType::Timepoint,
6141            9 => ScSpecType::Duration,
6142            10 => ScSpecType::U128,
6143            11 => ScSpecType::I128,
6144            12 => ScSpecType::U256,
6145            13 => ScSpecType::I256,
6146            14 => ScSpecType::Bytes,
6147            16 => ScSpecType::String,
6148            17 => ScSpecType::Symbol,
6149            19 => ScSpecType::Address,
6150            1000 => ScSpecType::Option,
6151            1001 => ScSpecType::Result,
6152            1002 => ScSpecType::Vec,
6153            1004 => ScSpecType::Map,
6154            1005 => ScSpecType::Tuple,
6155            1006 => ScSpecType::BytesN,
6156            2000 => ScSpecType::Udt,
6157            #[allow(unreachable_patterns)]
6158            _ => return Err(Error::Invalid),
6159        };
6160        Ok(e)
6161    }
6162}
6163
6164impl From<ScSpecType> for i32 {
6165    #[must_use]
6166    fn from(e: ScSpecType) -> Self {
6167        e as Self
6168    }
6169}
6170
6171impl ReadXdr for ScSpecType {
6172    #[cfg(feature = "std")]
6173    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
6174        r.with_limited_depth(|r| {
6175            let e = i32::read_xdr(r)?;
6176            let v: Self = e.try_into()?;
6177            Ok(v)
6178        })
6179    }
6180}
6181
6182impl WriteXdr for ScSpecType {
6183    #[cfg(feature = "std")]
6184    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
6185        w.with_limited_depth(|w| {
6186            let i: i32 = (*self).into();
6187            i.write_xdr(w)
6188        })
6189    }
6190}
6191
6192/// ScSpecTypeOption is an XDR Struct defines as:
6193///
6194/// ```text
6195/// struct SCSpecTypeOption
6196/// {
6197///     SCSpecTypeDef valueType;
6198/// };
6199/// ```
6200///
6201#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
6202#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
6203#[cfg_attr(
6204    all(feature = "serde", feature = "alloc"),
6205    derive(serde::Serialize, serde::Deserialize),
6206    serde(rename_all = "snake_case")
6207)]
6208#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
6209pub struct ScSpecTypeOption {
6210    pub value_type: Box<ScSpecTypeDef>,
6211}
6212
6213impl ReadXdr for ScSpecTypeOption {
6214    #[cfg(feature = "std")]
6215    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
6216        r.with_limited_depth(|r| {
6217            Ok(Self {
6218                value_type: Box::<ScSpecTypeDef>::read_xdr(r)?,
6219            })
6220        })
6221    }
6222}
6223
6224impl WriteXdr for ScSpecTypeOption {
6225    #[cfg(feature = "std")]
6226    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
6227        w.with_limited_depth(|w| {
6228            self.value_type.write_xdr(w)?;
6229            Ok(())
6230        })
6231    }
6232}
6233
6234/// ScSpecTypeResult is an XDR Struct defines as:
6235///
6236/// ```text
6237/// struct SCSpecTypeResult
6238/// {
6239///     SCSpecTypeDef okType;
6240///     SCSpecTypeDef errorType;
6241/// };
6242/// ```
6243///
6244#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
6245#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
6246#[cfg_attr(
6247    all(feature = "serde", feature = "alloc"),
6248    derive(serde::Serialize, serde::Deserialize),
6249    serde(rename_all = "snake_case")
6250)]
6251#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
6252pub struct ScSpecTypeResult {
6253    pub ok_type: Box<ScSpecTypeDef>,
6254    pub error_type: Box<ScSpecTypeDef>,
6255}
6256
6257impl ReadXdr for ScSpecTypeResult {
6258    #[cfg(feature = "std")]
6259    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
6260        r.with_limited_depth(|r| {
6261            Ok(Self {
6262                ok_type: Box::<ScSpecTypeDef>::read_xdr(r)?,
6263                error_type: Box::<ScSpecTypeDef>::read_xdr(r)?,
6264            })
6265        })
6266    }
6267}
6268
6269impl WriteXdr for ScSpecTypeResult {
6270    #[cfg(feature = "std")]
6271    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
6272        w.with_limited_depth(|w| {
6273            self.ok_type.write_xdr(w)?;
6274            self.error_type.write_xdr(w)?;
6275            Ok(())
6276        })
6277    }
6278}
6279
6280/// ScSpecTypeVec is an XDR Struct defines as:
6281///
6282/// ```text
6283/// struct SCSpecTypeVec
6284/// {
6285///     SCSpecTypeDef elementType;
6286/// };
6287/// ```
6288///
6289#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
6290#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
6291#[cfg_attr(
6292    all(feature = "serde", feature = "alloc"),
6293    derive(serde::Serialize, serde::Deserialize),
6294    serde(rename_all = "snake_case")
6295)]
6296#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
6297pub struct ScSpecTypeVec {
6298    pub element_type: Box<ScSpecTypeDef>,
6299}
6300
6301impl ReadXdr for ScSpecTypeVec {
6302    #[cfg(feature = "std")]
6303    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
6304        r.with_limited_depth(|r| {
6305            Ok(Self {
6306                element_type: Box::<ScSpecTypeDef>::read_xdr(r)?,
6307            })
6308        })
6309    }
6310}
6311
6312impl WriteXdr for ScSpecTypeVec {
6313    #[cfg(feature = "std")]
6314    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
6315        w.with_limited_depth(|w| {
6316            self.element_type.write_xdr(w)?;
6317            Ok(())
6318        })
6319    }
6320}
6321
6322/// ScSpecTypeMap is an XDR Struct defines as:
6323///
6324/// ```text
6325/// struct SCSpecTypeMap
6326/// {
6327///     SCSpecTypeDef keyType;
6328///     SCSpecTypeDef valueType;
6329/// };
6330/// ```
6331///
6332#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
6333#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
6334#[cfg_attr(
6335    all(feature = "serde", feature = "alloc"),
6336    derive(serde::Serialize, serde::Deserialize),
6337    serde(rename_all = "snake_case")
6338)]
6339#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
6340pub struct ScSpecTypeMap {
6341    pub key_type: Box<ScSpecTypeDef>,
6342    pub value_type: Box<ScSpecTypeDef>,
6343}
6344
6345impl ReadXdr for ScSpecTypeMap {
6346    #[cfg(feature = "std")]
6347    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
6348        r.with_limited_depth(|r| {
6349            Ok(Self {
6350                key_type: Box::<ScSpecTypeDef>::read_xdr(r)?,
6351                value_type: Box::<ScSpecTypeDef>::read_xdr(r)?,
6352            })
6353        })
6354    }
6355}
6356
6357impl WriteXdr for ScSpecTypeMap {
6358    #[cfg(feature = "std")]
6359    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
6360        w.with_limited_depth(|w| {
6361            self.key_type.write_xdr(w)?;
6362            self.value_type.write_xdr(w)?;
6363            Ok(())
6364        })
6365    }
6366}
6367
6368/// ScSpecTypeTuple is an XDR Struct defines as:
6369///
6370/// ```text
6371/// struct SCSpecTypeTuple
6372/// {
6373///     SCSpecTypeDef valueTypes<12>;
6374/// };
6375/// ```
6376///
6377#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
6378#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
6379#[cfg_attr(
6380    all(feature = "serde", feature = "alloc"),
6381    derive(serde::Serialize, serde::Deserialize),
6382    serde(rename_all = "snake_case")
6383)]
6384#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
6385pub struct ScSpecTypeTuple {
6386    pub value_types: VecM<ScSpecTypeDef, 12>,
6387}
6388
6389impl ReadXdr for ScSpecTypeTuple {
6390    #[cfg(feature = "std")]
6391    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
6392        r.with_limited_depth(|r| {
6393            Ok(Self {
6394                value_types: VecM::<ScSpecTypeDef, 12>::read_xdr(r)?,
6395            })
6396        })
6397    }
6398}
6399
6400impl WriteXdr for ScSpecTypeTuple {
6401    #[cfg(feature = "std")]
6402    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
6403        w.with_limited_depth(|w| {
6404            self.value_types.write_xdr(w)?;
6405            Ok(())
6406        })
6407    }
6408}
6409
6410/// ScSpecTypeBytesN is an XDR Struct defines as:
6411///
6412/// ```text
6413/// struct SCSpecTypeBytesN
6414/// {
6415///     uint32 n;
6416/// };
6417/// ```
6418///
6419#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
6420#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
6421#[cfg_attr(
6422    all(feature = "serde", feature = "alloc"),
6423    derive(serde::Serialize, serde::Deserialize),
6424    serde(rename_all = "snake_case")
6425)]
6426#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
6427pub struct ScSpecTypeBytesN {
6428    pub n: u32,
6429}
6430
6431impl ReadXdr for ScSpecTypeBytesN {
6432    #[cfg(feature = "std")]
6433    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
6434        r.with_limited_depth(|r| {
6435            Ok(Self {
6436                n: u32::read_xdr(r)?,
6437            })
6438        })
6439    }
6440}
6441
6442impl WriteXdr for ScSpecTypeBytesN {
6443    #[cfg(feature = "std")]
6444    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
6445        w.with_limited_depth(|w| {
6446            self.n.write_xdr(w)?;
6447            Ok(())
6448        })
6449    }
6450}
6451
6452/// ScSpecTypeUdt is an XDR Struct defines as:
6453///
6454/// ```text
6455/// struct SCSpecTypeUDT
6456/// {
6457///     string name<60>;
6458/// };
6459/// ```
6460///
6461#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
6462#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
6463#[cfg_attr(
6464    all(feature = "serde", feature = "alloc"),
6465    derive(serde::Serialize, serde::Deserialize),
6466    serde(rename_all = "snake_case")
6467)]
6468#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
6469pub struct ScSpecTypeUdt {
6470    pub name: StringM<60>,
6471}
6472
6473impl ReadXdr for ScSpecTypeUdt {
6474    #[cfg(feature = "std")]
6475    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
6476        r.with_limited_depth(|r| {
6477            Ok(Self {
6478                name: StringM::<60>::read_xdr(r)?,
6479            })
6480        })
6481    }
6482}
6483
6484impl WriteXdr for ScSpecTypeUdt {
6485    #[cfg(feature = "std")]
6486    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
6487        w.with_limited_depth(|w| {
6488            self.name.write_xdr(w)?;
6489            Ok(())
6490        })
6491    }
6492}
6493
6494/// ScSpecTypeDef is an XDR Union defines as:
6495///
6496/// ```text
6497/// union SCSpecTypeDef switch (SCSpecType type)
6498/// {
6499/// case SC_SPEC_TYPE_VAL:
6500/// case SC_SPEC_TYPE_BOOL:
6501/// case SC_SPEC_TYPE_VOID:
6502/// case SC_SPEC_TYPE_ERROR:
6503/// case SC_SPEC_TYPE_U32:
6504/// case SC_SPEC_TYPE_I32:
6505/// case SC_SPEC_TYPE_U64:
6506/// case SC_SPEC_TYPE_I64:
6507/// case SC_SPEC_TYPE_TIMEPOINT:
6508/// case SC_SPEC_TYPE_DURATION:
6509/// case SC_SPEC_TYPE_U128:
6510/// case SC_SPEC_TYPE_I128:
6511/// case SC_SPEC_TYPE_U256:
6512/// case SC_SPEC_TYPE_I256:
6513/// case SC_SPEC_TYPE_BYTES:
6514/// case SC_SPEC_TYPE_STRING:
6515/// case SC_SPEC_TYPE_SYMBOL:
6516/// case SC_SPEC_TYPE_ADDRESS:
6517///     void;
6518/// case SC_SPEC_TYPE_OPTION:
6519///     SCSpecTypeOption option;
6520/// case SC_SPEC_TYPE_RESULT:
6521///     SCSpecTypeResult result;
6522/// case SC_SPEC_TYPE_VEC:
6523///     SCSpecTypeVec vec;
6524/// case SC_SPEC_TYPE_MAP:
6525///     SCSpecTypeMap map;
6526/// case SC_SPEC_TYPE_TUPLE:
6527///     SCSpecTypeTuple tuple;
6528/// case SC_SPEC_TYPE_BYTES_N:
6529///     SCSpecTypeBytesN bytesN;
6530/// case SC_SPEC_TYPE_UDT:
6531///     SCSpecTypeUDT udt;
6532/// };
6533/// ```
6534///
6535// union with discriminant ScSpecType
6536#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
6537#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
6538#[cfg_attr(
6539    all(feature = "serde", feature = "alloc"),
6540    derive(serde::Serialize, serde::Deserialize),
6541    serde(rename_all = "snake_case")
6542)]
6543#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
6544#[allow(clippy::large_enum_variant)]
6545pub enum ScSpecTypeDef {
6546    Val,
6547    Bool,
6548    Void,
6549    Error,
6550    U32,
6551    I32,
6552    U64,
6553    I64,
6554    Timepoint,
6555    Duration,
6556    U128,
6557    I128,
6558    U256,
6559    I256,
6560    Bytes,
6561    String,
6562    Symbol,
6563    Address,
6564    Option(Box<ScSpecTypeOption>),
6565    Result(Box<ScSpecTypeResult>),
6566    Vec(Box<ScSpecTypeVec>),
6567    Map(Box<ScSpecTypeMap>),
6568    Tuple(Box<ScSpecTypeTuple>),
6569    BytesN(ScSpecTypeBytesN),
6570    Udt(ScSpecTypeUdt),
6571}
6572
6573impl ScSpecTypeDef {
6574    pub const VARIANTS: [ScSpecType; 25] = [
6575        ScSpecType::Val,
6576        ScSpecType::Bool,
6577        ScSpecType::Void,
6578        ScSpecType::Error,
6579        ScSpecType::U32,
6580        ScSpecType::I32,
6581        ScSpecType::U64,
6582        ScSpecType::I64,
6583        ScSpecType::Timepoint,
6584        ScSpecType::Duration,
6585        ScSpecType::U128,
6586        ScSpecType::I128,
6587        ScSpecType::U256,
6588        ScSpecType::I256,
6589        ScSpecType::Bytes,
6590        ScSpecType::String,
6591        ScSpecType::Symbol,
6592        ScSpecType::Address,
6593        ScSpecType::Option,
6594        ScSpecType::Result,
6595        ScSpecType::Vec,
6596        ScSpecType::Map,
6597        ScSpecType::Tuple,
6598        ScSpecType::BytesN,
6599        ScSpecType::Udt,
6600    ];
6601    pub const VARIANTS_STR: [&'static str; 25] = [
6602        "Val",
6603        "Bool",
6604        "Void",
6605        "Error",
6606        "U32",
6607        "I32",
6608        "U64",
6609        "I64",
6610        "Timepoint",
6611        "Duration",
6612        "U128",
6613        "I128",
6614        "U256",
6615        "I256",
6616        "Bytes",
6617        "String",
6618        "Symbol",
6619        "Address",
6620        "Option",
6621        "Result",
6622        "Vec",
6623        "Map",
6624        "Tuple",
6625        "BytesN",
6626        "Udt",
6627    ];
6628
6629    #[must_use]
6630    pub const fn name(&self) -> &'static str {
6631        match self {
6632            Self::Val => "Val",
6633            Self::Bool => "Bool",
6634            Self::Void => "Void",
6635            Self::Error => "Error",
6636            Self::U32 => "U32",
6637            Self::I32 => "I32",
6638            Self::U64 => "U64",
6639            Self::I64 => "I64",
6640            Self::Timepoint => "Timepoint",
6641            Self::Duration => "Duration",
6642            Self::U128 => "U128",
6643            Self::I128 => "I128",
6644            Self::U256 => "U256",
6645            Self::I256 => "I256",
6646            Self::Bytes => "Bytes",
6647            Self::String => "String",
6648            Self::Symbol => "Symbol",
6649            Self::Address => "Address",
6650            Self::Option(_) => "Option",
6651            Self::Result(_) => "Result",
6652            Self::Vec(_) => "Vec",
6653            Self::Map(_) => "Map",
6654            Self::Tuple(_) => "Tuple",
6655            Self::BytesN(_) => "BytesN",
6656            Self::Udt(_) => "Udt",
6657        }
6658    }
6659
6660    #[must_use]
6661    pub const fn discriminant(&self) -> ScSpecType {
6662        #[allow(clippy::match_same_arms)]
6663        match self {
6664            Self::Val => ScSpecType::Val,
6665            Self::Bool => ScSpecType::Bool,
6666            Self::Void => ScSpecType::Void,
6667            Self::Error => ScSpecType::Error,
6668            Self::U32 => ScSpecType::U32,
6669            Self::I32 => ScSpecType::I32,
6670            Self::U64 => ScSpecType::U64,
6671            Self::I64 => ScSpecType::I64,
6672            Self::Timepoint => ScSpecType::Timepoint,
6673            Self::Duration => ScSpecType::Duration,
6674            Self::U128 => ScSpecType::U128,
6675            Self::I128 => ScSpecType::I128,
6676            Self::U256 => ScSpecType::U256,
6677            Self::I256 => ScSpecType::I256,
6678            Self::Bytes => ScSpecType::Bytes,
6679            Self::String => ScSpecType::String,
6680            Self::Symbol => ScSpecType::Symbol,
6681            Self::Address => ScSpecType::Address,
6682            Self::Option(_) => ScSpecType::Option,
6683            Self::Result(_) => ScSpecType::Result,
6684            Self::Vec(_) => ScSpecType::Vec,
6685            Self::Map(_) => ScSpecType::Map,
6686            Self::Tuple(_) => ScSpecType::Tuple,
6687            Self::BytesN(_) => ScSpecType::BytesN,
6688            Self::Udt(_) => ScSpecType::Udt,
6689        }
6690    }
6691
6692    #[must_use]
6693    pub const fn variants() -> [ScSpecType; 25] {
6694        Self::VARIANTS
6695    }
6696}
6697
6698impl Name for ScSpecTypeDef {
6699    #[must_use]
6700    fn name(&self) -> &'static str {
6701        Self::name(self)
6702    }
6703}
6704
6705impl Discriminant<ScSpecType> for ScSpecTypeDef {
6706    #[must_use]
6707    fn discriminant(&self) -> ScSpecType {
6708        Self::discriminant(self)
6709    }
6710}
6711
6712impl Variants<ScSpecType> for ScSpecTypeDef {
6713    fn variants() -> slice::Iter<'static, ScSpecType> {
6714        Self::VARIANTS.iter()
6715    }
6716}
6717
6718impl Union<ScSpecType> for ScSpecTypeDef {}
6719
6720impl ReadXdr for ScSpecTypeDef {
6721    #[cfg(feature = "std")]
6722    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
6723        r.with_limited_depth(|r| {
6724            let dv: ScSpecType = <ScSpecType as ReadXdr>::read_xdr(r)?;
6725            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
6726            let v = match dv {
6727                ScSpecType::Val => Self::Val,
6728                ScSpecType::Bool => Self::Bool,
6729                ScSpecType::Void => Self::Void,
6730                ScSpecType::Error => Self::Error,
6731                ScSpecType::U32 => Self::U32,
6732                ScSpecType::I32 => Self::I32,
6733                ScSpecType::U64 => Self::U64,
6734                ScSpecType::I64 => Self::I64,
6735                ScSpecType::Timepoint => Self::Timepoint,
6736                ScSpecType::Duration => Self::Duration,
6737                ScSpecType::U128 => Self::U128,
6738                ScSpecType::I128 => Self::I128,
6739                ScSpecType::U256 => Self::U256,
6740                ScSpecType::I256 => Self::I256,
6741                ScSpecType::Bytes => Self::Bytes,
6742                ScSpecType::String => Self::String,
6743                ScSpecType::Symbol => Self::Symbol,
6744                ScSpecType::Address => Self::Address,
6745                ScSpecType::Option => Self::Option(Box::<ScSpecTypeOption>::read_xdr(r)?),
6746                ScSpecType::Result => Self::Result(Box::<ScSpecTypeResult>::read_xdr(r)?),
6747                ScSpecType::Vec => Self::Vec(Box::<ScSpecTypeVec>::read_xdr(r)?),
6748                ScSpecType::Map => Self::Map(Box::<ScSpecTypeMap>::read_xdr(r)?),
6749                ScSpecType::Tuple => Self::Tuple(Box::<ScSpecTypeTuple>::read_xdr(r)?),
6750                ScSpecType::BytesN => Self::BytesN(ScSpecTypeBytesN::read_xdr(r)?),
6751                ScSpecType::Udt => Self::Udt(ScSpecTypeUdt::read_xdr(r)?),
6752                #[allow(unreachable_patterns)]
6753                _ => return Err(Error::Invalid),
6754            };
6755            Ok(v)
6756        })
6757    }
6758}
6759
6760impl WriteXdr for ScSpecTypeDef {
6761    #[cfg(feature = "std")]
6762    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
6763        w.with_limited_depth(|w| {
6764            self.discriminant().write_xdr(w)?;
6765            #[allow(clippy::match_same_arms)]
6766            match self {
6767                Self::Val => ().write_xdr(w)?,
6768                Self::Bool => ().write_xdr(w)?,
6769                Self::Void => ().write_xdr(w)?,
6770                Self::Error => ().write_xdr(w)?,
6771                Self::U32 => ().write_xdr(w)?,
6772                Self::I32 => ().write_xdr(w)?,
6773                Self::U64 => ().write_xdr(w)?,
6774                Self::I64 => ().write_xdr(w)?,
6775                Self::Timepoint => ().write_xdr(w)?,
6776                Self::Duration => ().write_xdr(w)?,
6777                Self::U128 => ().write_xdr(w)?,
6778                Self::I128 => ().write_xdr(w)?,
6779                Self::U256 => ().write_xdr(w)?,
6780                Self::I256 => ().write_xdr(w)?,
6781                Self::Bytes => ().write_xdr(w)?,
6782                Self::String => ().write_xdr(w)?,
6783                Self::Symbol => ().write_xdr(w)?,
6784                Self::Address => ().write_xdr(w)?,
6785                Self::Option(v) => v.write_xdr(w)?,
6786                Self::Result(v) => v.write_xdr(w)?,
6787                Self::Vec(v) => v.write_xdr(w)?,
6788                Self::Map(v) => v.write_xdr(w)?,
6789                Self::Tuple(v) => v.write_xdr(w)?,
6790                Self::BytesN(v) => v.write_xdr(w)?,
6791                Self::Udt(v) => v.write_xdr(w)?,
6792            };
6793            Ok(())
6794        })
6795    }
6796}
6797
6798/// ScSpecUdtStructFieldV0 is an XDR Struct defines as:
6799///
6800/// ```text
6801/// struct SCSpecUDTStructFieldV0
6802/// {
6803///     string doc<SC_SPEC_DOC_LIMIT>;
6804///     string name<30>;
6805///     SCSpecTypeDef type;
6806/// };
6807/// ```
6808///
6809#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
6810#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
6811#[cfg_attr(
6812    all(feature = "serde", feature = "alloc"),
6813    derive(serde::Serialize, serde::Deserialize),
6814    serde(rename_all = "snake_case")
6815)]
6816#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
6817pub struct ScSpecUdtStructFieldV0 {
6818    pub doc: StringM<1024>,
6819    pub name: StringM<30>,
6820    pub type_: ScSpecTypeDef,
6821}
6822
6823impl ReadXdr for ScSpecUdtStructFieldV0 {
6824    #[cfg(feature = "std")]
6825    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
6826        r.with_limited_depth(|r| {
6827            Ok(Self {
6828                doc: StringM::<1024>::read_xdr(r)?,
6829                name: StringM::<30>::read_xdr(r)?,
6830                type_: ScSpecTypeDef::read_xdr(r)?,
6831            })
6832        })
6833    }
6834}
6835
6836impl WriteXdr for ScSpecUdtStructFieldV0 {
6837    #[cfg(feature = "std")]
6838    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
6839        w.with_limited_depth(|w| {
6840            self.doc.write_xdr(w)?;
6841            self.name.write_xdr(w)?;
6842            self.type_.write_xdr(w)?;
6843            Ok(())
6844        })
6845    }
6846}
6847
6848/// ScSpecUdtStructV0 is an XDR Struct defines as:
6849///
6850/// ```text
6851/// struct SCSpecUDTStructV0
6852/// {
6853///     string doc<SC_SPEC_DOC_LIMIT>;
6854///     string lib<80>;
6855///     string name<60>;
6856///     SCSpecUDTStructFieldV0 fields<40>;
6857/// };
6858/// ```
6859///
6860#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
6861#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
6862#[cfg_attr(
6863    all(feature = "serde", feature = "alloc"),
6864    derive(serde::Serialize, serde::Deserialize),
6865    serde(rename_all = "snake_case")
6866)]
6867#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
6868pub struct ScSpecUdtStructV0 {
6869    pub doc: StringM<1024>,
6870    pub lib: StringM<80>,
6871    pub name: StringM<60>,
6872    pub fields: VecM<ScSpecUdtStructFieldV0, 40>,
6873}
6874
6875impl ReadXdr for ScSpecUdtStructV0 {
6876    #[cfg(feature = "std")]
6877    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
6878        r.with_limited_depth(|r| {
6879            Ok(Self {
6880                doc: StringM::<1024>::read_xdr(r)?,
6881                lib: StringM::<80>::read_xdr(r)?,
6882                name: StringM::<60>::read_xdr(r)?,
6883                fields: VecM::<ScSpecUdtStructFieldV0, 40>::read_xdr(r)?,
6884            })
6885        })
6886    }
6887}
6888
6889impl WriteXdr for ScSpecUdtStructV0 {
6890    #[cfg(feature = "std")]
6891    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
6892        w.with_limited_depth(|w| {
6893            self.doc.write_xdr(w)?;
6894            self.lib.write_xdr(w)?;
6895            self.name.write_xdr(w)?;
6896            self.fields.write_xdr(w)?;
6897            Ok(())
6898        })
6899    }
6900}
6901
6902/// ScSpecUdtUnionCaseVoidV0 is an XDR Struct defines as:
6903///
6904/// ```text
6905/// struct SCSpecUDTUnionCaseVoidV0
6906/// {
6907///     string doc<SC_SPEC_DOC_LIMIT>;
6908///     string name<60>;
6909/// };
6910/// ```
6911///
6912#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
6913#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
6914#[cfg_attr(
6915    all(feature = "serde", feature = "alloc"),
6916    derive(serde::Serialize, serde::Deserialize),
6917    serde(rename_all = "snake_case")
6918)]
6919#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
6920pub struct ScSpecUdtUnionCaseVoidV0 {
6921    pub doc: StringM<1024>,
6922    pub name: StringM<60>,
6923}
6924
6925impl ReadXdr for ScSpecUdtUnionCaseVoidV0 {
6926    #[cfg(feature = "std")]
6927    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
6928        r.with_limited_depth(|r| {
6929            Ok(Self {
6930                doc: StringM::<1024>::read_xdr(r)?,
6931                name: StringM::<60>::read_xdr(r)?,
6932            })
6933        })
6934    }
6935}
6936
6937impl WriteXdr for ScSpecUdtUnionCaseVoidV0 {
6938    #[cfg(feature = "std")]
6939    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
6940        w.with_limited_depth(|w| {
6941            self.doc.write_xdr(w)?;
6942            self.name.write_xdr(w)?;
6943            Ok(())
6944        })
6945    }
6946}
6947
6948/// ScSpecUdtUnionCaseTupleV0 is an XDR Struct defines as:
6949///
6950/// ```text
6951/// struct SCSpecUDTUnionCaseTupleV0
6952/// {
6953///     string doc<SC_SPEC_DOC_LIMIT>;
6954///     string name<60>;
6955///     SCSpecTypeDef type<12>;
6956/// };
6957/// ```
6958///
6959#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
6960#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
6961#[cfg_attr(
6962    all(feature = "serde", feature = "alloc"),
6963    derive(serde::Serialize, serde::Deserialize),
6964    serde(rename_all = "snake_case")
6965)]
6966#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
6967pub struct ScSpecUdtUnionCaseTupleV0 {
6968    pub doc: StringM<1024>,
6969    pub name: StringM<60>,
6970    pub type_: VecM<ScSpecTypeDef, 12>,
6971}
6972
6973impl ReadXdr for ScSpecUdtUnionCaseTupleV0 {
6974    #[cfg(feature = "std")]
6975    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
6976        r.with_limited_depth(|r| {
6977            Ok(Self {
6978                doc: StringM::<1024>::read_xdr(r)?,
6979                name: StringM::<60>::read_xdr(r)?,
6980                type_: VecM::<ScSpecTypeDef, 12>::read_xdr(r)?,
6981            })
6982        })
6983    }
6984}
6985
6986impl WriteXdr for ScSpecUdtUnionCaseTupleV0 {
6987    #[cfg(feature = "std")]
6988    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
6989        w.with_limited_depth(|w| {
6990            self.doc.write_xdr(w)?;
6991            self.name.write_xdr(w)?;
6992            self.type_.write_xdr(w)?;
6993            Ok(())
6994        })
6995    }
6996}
6997
6998/// ScSpecUdtUnionCaseV0Kind is an XDR Enum defines as:
6999///
7000/// ```text
7001/// enum SCSpecUDTUnionCaseV0Kind
7002/// {
7003///     SC_SPEC_UDT_UNION_CASE_VOID_V0 = 0,
7004///     SC_SPEC_UDT_UNION_CASE_TUPLE_V0 = 1
7005/// };
7006/// ```
7007///
7008// enum
7009#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
7010#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
7011#[cfg_attr(
7012    all(feature = "serde", feature = "alloc"),
7013    derive(serde::Serialize, serde::Deserialize),
7014    serde(rename_all = "snake_case")
7015)]
7016#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
7017#[repr(i32)]
7018pub enum ScSpecUdtUnionCaseV0Kind {
7019    VoidV0 = 0,
7020    TupleV0 = 1,
7021}
7022
7023impl ScSpecUdtUnionCaseV0Kind {
7024    pub const VARIANTS: [ScSpecUdtUnionCaseV0Kind; 2] = [
7025        ScSpecUdtUnionCaseV0Kind::VoidV0,
7026        ScSpecUdtUnionCaseV0Kind::TupleV0,
7027    ];
7028    pub const VARIANTS_STR: [&'static str; 2] = ["VoidV0", "TupleV0"];
7029
7030    #[must_use]
7031    pub const fn name(&self) -> &'static str {
7032        match self {
7033            Self::VoidV0 => "VoidV0",
7034            Self::TupleV0 => "TupleV0",
7035        }
7036    }
7037
7038    #[must_use]
7039    pub const fn variants() -> [ScSpecUdtUnionCaseV0Kind; 2] {
7040        Self::VARIANTS
7041    }
7042}
7043
7044impl Name for ScSpecUdtUnionCaseV0Kind {
7045    #[must_use]
7046    fn name(&self) -> &'static str {
7047        Self::name(self)
7048    }
7049}
7050
7051impl Variants<ScSpecUdtUnionCaseV0Kind> for ScSpecUdtUnionCaseV0Kind {
7052    fn variants() -> slice::Iter<'static, ScSpecUdtUnionCaseV0Kind> {
7053        Self::VARIANTS.iter()
7054    }
7055}
7056
7057impl Enum for ScSpecUdtUnionCaseV0Kind {}
7058
7059impl fmt::Display for ScSpecUdtUnionCaseV0Kind {
7060    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
7061        f.write_str(self.name())
7062    }
7063}
7064
7065impl TryFrom<i32> for ScSpecUdtUnionCaseV0Kind {
7066    type Error = Error;
7067
7068    fn try_from(i: i32) -> Result<Self> {
7069        let e = match i {
7070            0 => ScSpecUdtUnionCaseV0Kind::VoidV0,
7071            1 => ScSpecUdtUnionCaseV0Kind::TupleV0,
7072            #[allow(unreachable_patterns)]
7073            _ => return Err(Error::Invalid),
7074        };
7075        Ok(e)
7076    }
7077}
7078
7079impl From<ScSpecUdtUnionCaseV0Kind> for i32 {
7080    #[must_use]
7081    fn from(e: ScSpecUdtUnionCaseV0Kind) -> Self {
7082        e as Self
7083    }
7084}
7085
7086impl ReadXdr for ScSpecUdtUnionCaseV0Kind {
7087    #[cfg(feature = "std")]
7088    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
7089        r.with_limited_depth(|r| {
7090            let e = i32::read_xdr(r)?;
7091            let v: Self = e.try_into()?;
7092            Ok(v)
7093        })
7094    }
7095}
7096
7097impl WriteXdr for ScSpecUdtUnionCaseV0Kind {
7098    #[cfg(feature = "std")]
7099    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
7100        w.with_limited_depth(|w| {
7101            let i: i32 = (*self).into();
7102            i.write_xdr(w)
7103        })
7104    }
7105}
7106
7107/// ScSpecUdtUnionCaseV0 is an XDR Union defines as:
7108///
7109/// ```text
7110/// union SCSpecUDTUnionCaseV0 switch (SCSpecUDTUnionCaseV0Kind kind)
7111/// {
7112/// case SC_SPEC_UDT_UNION_CASE_VOID_V0:
7113///     SCSpecUDTUnionCaseVoidV0 voidCase;
7114/// case SC_SPEC_UDT_UNION_CASE_TUPLE_V0:
7115///     SCSpecUDTUnionCaseTupleV0 tupleCase;
7116/// };
7117/// ```
7118///
7119// union with discriminant ScSpecUdtUnionCaseV0Kind
7120#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
7121#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
7122#[cfg_attr(
7123    all(feature = "serde", feature = "alloc"),
7124    derive(serde::Serialize, serde::Deserialize),
7125    serde(rename_all = "snake_case")
7126)]
7127#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
7128#[allow(clippy::large_enum_variant)]
7129pub enum ScSpecUdtUnionCaseV0 {
7130    VoidV0(ScSpecUdtUnionCaseVoidV0),
7131    TupleV0(ScSpecUdtUnionCaseTupleV0),
7132}
7133
7134impl ScSpecUdtUnionCaseV0 {
7135    pub const VARIANTS: [ScSpecUdtUnionCaseV0Kind; 2] = [
7136        ScSpecUdtUnionCaseV0Kind::VoidV0,
7137        ScSpecUdtUnionCaseV0Kind::TupleV0,
7138    ];
7139    pub const VARIANTS_STR: [&'static str; 2] = ["VoidV0", "TupleV0"];
7140
7141    #[must_use]
7142    pub const fn name(&self) -> &'static str {
7143        match self {
7144            Self::VoidV0(_) => "VoidV0",
7145            Self::TupleV0(_) => "TupleV0",
7146        }
7147    }
7148
7149    #[must_use]
7150    pub const fn discriminant(&self) -> ScSpecUdtUnionCaseV0Kind {
7151        #[allow(clippy::match_same_arms)]
7152        match self {
7153            Self::VoidV0(_) => ScSpecUdtUnionCaseV0Kind::VoidV0,
7154            Self::TupleV0(_) => ScSpecUdtUnionCaseV0Kind::TupleV0,
7155        }
7156    }
7157
7158    #[must_use]
7159    pub const fn variants() -> [ScSpecUdtUnionCaseV0Kind; 2] {
7160        Self::VARIANTS
7161    }
7162}
7163
7164impl Name for ScSpecUdtUnionCaseV0 {
7165    #[must_use]
7166    fn name(&self) -> &'static str {
7167        Self::name(self)
7168    }
7169}
7170
7171impl Discriminant<ScSpecUdtUnionCaseV0Kind> for ScSpecUdtUnionCaseV0 {
7172    #[must_use]
7173    fn discriminant(&self) -> ScSpecUdtUnionCaseV0Kind {
7174        Self::discriminant(self)
7175    }
7176}
7177
7178impl Variants<ScSpecUdtUnionCaseV0Kind> for ScSpecUdtUnionCaseV0 {
7179    fn variants() -> slice::Iter<'static, ScSpecUdtUnionCaseV0Kind> {
7180        Self::VARIANTS.iter()
7181    }
7182}
7183
7184impl Union<ScSpecUdtUnionCaseV0Kind> for ScSpecUdtUnionCaseV0 {}
7185
7186impl ReadXdr for ScSpecUdtUnionCaseV0 {
7187    #[cfg(feature = "std")]
7188    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
7189        r.with_limited_depth(|r| {
7190            let dv: ScSpecUdtUnionCaseV0Kind = <ScSpecUdtUnionCaseV0Kind as ReadXdr>::read_xdr(r)?;
7191            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
7192            let v = match dv {
7193                ScSpecUdtUnionCaseV0Kind::VoidV0 => {
7194                    Self::VoidV0(ScSpecUdtUnionCaseVoidV0::read_xdr(r)?)
7195                }
7196                ScSpecUdtUnionCaseV0Kind::TupleV0 => {
7197                    Self::TupleV0(ScSpecUdtUnionCaseTupleV0::read_xdr(r)?)
7198                }
7199                #[allow(unreachable_patterns)]
7200                _ => return Err(Error::Invalid),
7201            };
7202            Ok(v)
7203        })
7204    }
7205}
7206
7207impl WriteXdr for ScSpecUdtUnionCaseV0 {
7208    #[cfg(feature = "std")]
7209    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
7210        w.with_limited_depth(|w| {
7211            self.discriminant().write_xdr(w)?;
7212            #[allow(clippy::match_same_arms)]
7213            match self {
7214                Self::VoidV0(v) => v.write_xdr(w)?,
7215                Self::TupleV0(v) => v.write_xdr(w)?,
7216            };
7217            Ok(())
7218        })
7219    }
7220}
7221
7222/// ScSpecUdtUnionV0 is an XDR Struct defines as:
7223///
7224/// ```text
7225/// struct SCSpecUDTUnionV0
7226/// {
7227///     string doc<SC_SPEC_DOC_LIMIT>;
7228///     string lib<80>;
7229///     string name<60>;
7230///     SCSpecUDTUnionCaseV0 cases<50>;
7231/// };
7232/// ```
7233///
7234#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
7235#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
7236#[cfg_attr(
7237    all(feature = "serde", feature = "alloc"),
7238    derive(serde::Serialize, serde::Deserialize),
7239    serde(rename_all = "snake_case")
7240)]
7241#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
7242pub struct ScSpecUdtUnionV0 {
7243    pub doc: StringM<1024>,
7244    pub lib: StringM<80>,
7245    pub name: StringM<60>,
7246    pub cases: VecM<ScSpecUdtUnionCaseV0, 50>,
7247}
7248
7249impl ReadXdr for ScSpecUdtUnionV0 {
7250    #[cfg(feature = "std")]
7251    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
7252        r.with_limited_depth(|r| {
7253            Ok(Self {
7254                doc: StringM::<1024>::read_xdr(r)?,
7255                lib: StringM::<80>::read_xdr(r)?,
7256                name: StringM::<60>::read_xdr(r)?,
7257                cases: VecM::<ScSpecUdtUnionCaseV0, 50>::read_xdr(r)?,
7258            })
7259        })
7260    }
7261}
7262
7263impl WriteXdr for ScSpecUdtUnionV0 {
7264    #[cfg(feature = "std")]
7265    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
7266        w.with_limited_depth(|w| {
7267            self.doc.write_xdr(w)?;
7268            self.lib.write_xdr(w)?;
7269            self.name.write_xdr(w)?;
7270            self.cases.write_xdr(w)?;
7271            Ok(())
7272        })
7273    }
7274}
7275
7276/// ScSpecUdtEnumCaseV0 is an XDR Struct defines as:
7277///
7278/// ```text
7279/// struct SCSpecUDTEnumCaseV0
7280/// {
7281///     string doc<SC_SPEC_DOC_LIMIT>;
7282///     string name<60>;
7283///     uint32 value;
7284/// };
7285/// ```
7286///
7287#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
7288#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
7289#[cfg_attr(
7290    all(feature = "serde", feature = "alloc"),
7291    derive(serde::Serialize, serde::Deserialize),
7292    serde(rename_all = "snake_case")
7293)]
7294#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
7295pub struct ScSpecUdtEnumCaseV0 {
7296    pub doc: StringM<1024>,
7297    pub name: StringM<60>,
7298    pub value: u32,
7299}
7300
7301impl ReadXdr for ScSpecUdtEnumCaseV0 {
7302    #[cfg(feature = "std")]
7303    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
7304        r.with_limited_depth(|r| {
7305            Ok(Self {
7306                doc: StringM::<1024>::read_xdr(r)?,
7307                name: StringM::<60>::read_xdr(r)?,
7308                value: u32::read_xdr(r)?,
7309            })
7310        })
7311    }
7312}
7313
7314impl WriteXdr for ScSpecUdtEnumCaseV0 {
7315    #[cfg(feature = "std")]
7316    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
7317        w.with_limited_depth(|w| {
7318            self.doc.write_xdr(w)?;
7319            self.name.write_xdr(w)?;
7320            self.value.write_xdr(w)?;
7321            Ok(())
7322        })
7323    }
7324}
7325
7326/// ScSpecUdtEnumV0 is an XDR Struct defines as:
7327///
7328/// ```text
7329/// struct SCSpecUDTEnumV0
7330/// {
7331///     string doc<SC_SPEC_DOC_LIMIT>;
7332///     string lib<80>;
7333///     string name<60>;
7334///     SCSpecUDTEnumCaseV0 cases<50>;
7335/// };
7336/// ```
7337///
7338#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
7339#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
7340#[cfg_attr(
7341    all(feature = "serde", feature = "alloc"),
7342    derive(serde::Serialize, serde::Deserialize),
7343    serde(rename_all = "snake_case")
7344)]
7345#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
7346pub struct ScSpecUdtEnumV0 {
7347    pub doc: StringM<1024>,
7348    pub lib: StringM<80>,
7349    pub name: StringM<60>,
7350    pub cases: VecM<ScSpecUdtEnumCaseV0, 50>,
7351}
7352
7353impl ReadXdr for ScSpecUdtEnumV0 {
7354    #[cfg(feature = "std")]
7355    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
7356        r.with_limited_depth(|r| {
7357            Ok(Self {
7358                doc: StringM::<1024>::read_xdr(r)?,
7359                lib: StringM::<80>::read_xdr(r)?,
7360                name: StringM::<60>::read_xdr(r)?,
7361                cases: VecM::<ScSpecUdtEnumCaseV0, 50>::read_xdr(r)?,
7362            })
7363        })
7364    }
7365}
7366
7367impl WriteXdr for ScSpecUdtEnumV0 {
7368    #[cfg(feature = "std")]
7369    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
7370        w.with_limited_depth(|w| {
7371            self.doc.write_xdr(w)?;
7372            self.lib.write_xdr(w)?;
7373            self.name.write_xdr(w)?;
7374            self.cases.write_xdr(w)?;
7375            Ok(())
7376        })
7377    }
7378}
7379
7380/// ScSpecUdtErrorEnumCaseV0 is an XDR Struct defines as:
7381///
7382/// ```text
7383/// struct SCSpecUDTErrorEnumCaseV0
7384/// {
7385///     string doc<SC_SPEC_DOC_LIMIT>;
7386///     string name<60>;
7387///     uint32 value;
7388/// };
7389/// ```
7390///
7391#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
7392#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
7393#[cfg_attr(
7394    all(feature = "serde", feature = "alloc"),
7395    derive(serde::Serialize, serde::Deserialize),
7396    serde(rename_all = "snake_case")
7397)]
7398#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
7399pub struct ScSpecUdtErrorEnumCaseV0 {
7400    pub doc: StringM<1024>,
7401    pub name: StringM<60>,
7402    pub value: u32,
7403}
7404
7405impl ReadXdr for ScSpecUdtErrorEnumCaseV0 {
7406    #[cfg(feature = "std")]
7407    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
7408        r.with_limited_depth(|r| {
7409            Ok(Self {
7410                doc: StringM::<1024>::read_xdr(r)?,
7411                name: StringM::<60>::read_xdr(r)?,
7412                value: u32::read_xdr(r)?,
7413            })
7414        })
7415    }
7416}
7417
7418impl WriteXdr for ScSpecUdtErrorEnumCaseV0 {
7419    #[cfg(feature = "std")]
7420    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
7421        w.with_limited_depth(|w| {
7422            self.doc.write_xdr(w)?;
7423            self.name.write_xdr(w)?;
7424            self.value.write_xdr(w)?;
7425            Ok(())
7426        })
7427    }
7428}
7429
7430/// ScSpecUdtErrorEnumV0 is an XDR Struct defines as:
7431///
7432/// ```text
7433/// struct SCSpecUDTErrorEnumV0
7434/// {
7435///     string doc<SC_SPEC_DOC_LIMIT>;
7436///     string lib<80>;
7437///     string name<60>;
7438///     SCSpecUDTErrorEnumCaseV0 cases<50>;
7439/// };
7440/// ```
7441///
7442#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
7443#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
7444#[cfg_attr(
7445    all(feature = "serde", feature = "alloc"),
7446    derive(serde::Serialize, serde::Deserialize),
7447    serde(rename_all = "snake_case")
7448)]
7449#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
7450pub struct ScSpecUdtErrorEnumV0 {
7451    pub doc: StringM<1024>,
7452    pub lib: StringM<80>,
7453    pub name: StringM<60>,
7454    pub cases: VecM<ScSpecUdtErrorEnumCaseV0, 50>,
7455}
7456
7457impl ReadXdr for ScSpecUdtErrorEnumV0 {
7458    #[cfg(feature = "std")]
7459    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
7460        r.with_limited_depth(|r| {
7461            Ok(Self {
7462                doc: StringM::<1024>::read_xdr(r)?,
7463                lib: StringM::<80>::read_xdr(r)?,
7464                name: StringM::<60>::read_xdr(r)?,
7465                cases: VecM::<ScSpecUdtErrorEnumCaseV0, 50>::read_xdr(r)?,
7466            })
7467        })
7468    }
7469}
7470
7471impl WriteXdr for ScSpecUdtErrorEnumV0 {
7472    #[cfg(feature = "std")]
7473    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
7474        w.with_limited_depth(|w| {
7475            self.doc.write_xdr(w)?;
7476            self.lib.write_xdr(w)?;
7477            self.name.write_xdr(w)?;
7478            self.cases.write_xdr(w)?;
7479            Ok(())
7480        })
7481    }
7482}
7483
7484/// ScSpecFunctionInputV0 is an XDR Struct defines as:
7485///
7486/// ```text
7487/// struct SCSpecFunctionInputV0
7488/// {
7489///     string doc<SC_SPEC_DOC_LIMIT>;
7490///     string name<30>;
7491///     SCSpecTypeDef type;
7492/// };
7493/// ```
7494///
7495#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
7496#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
7497#[cfg_attr(
7498    all(feature = "serde", feature = "alloc"),
7499    derive(serde::Serialize, serde::Deserialize),
7500    serde(rename_all = "snake_case")
7501)]
7502#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
7503pub struct ScSpecFunctionInputV0 {
7504    pub doc: StringM<1024>,
7505    pub name: StringM<30>,
7506    pub type_: ScSpecTypeDef,
7507}
7508
7509impl ReadXdr for ScSpecFunctionInputV0 {
7510    #[cfg(feature = "std")]
7511    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
7512        r.with_limited_depth(|r| {
7513            Ok(Self {
7514                doc: StringM::<1024>::read_xdr(r)?,
7515                name: StringM::<30>::read_xdr(r)?,
7516                type_: ScSpecTypeDef::read_xdr(r)?,
7517            })
7518        })
7519    }
7520}
7521
7522impl WriteXdr for ScSpecFunctionInputV0 {
7523    #[cfg(feature = "std")]
7524    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
7525        w.with_limited_depth(|w| {
7526            self.doc.write_xdr(w)?;
7527            self.name.write_xdr(w)?;
7528            self.type_.write_xdr(w)?;
7529            Ok(())
7530        })
7531    }
7532}
7533
7534/// ScSpecFunctionV0 is an XDR Struct defines as:
7535///
7536/// ```text
7537/// struct SCSpecFunctionV0
7538/// {
7539///     string doc<SC_SPEC_DOC_LIMIT>;
7540///     SCSymbol name;
7541///     SCSpecFunctionInputV0 inputs<10>;
7542///     SCSpecTypeDef outputs<1>;
7543/// };
7544/// ```
7545///
7546#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
7547#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
7548#[cfg_attr(
7549    all(feature = "serde", feature = "alloc"),
7550    derive(serde::Serialize, serde::Deserialize),
7551    serde(rename_all = "snake_case")
7552)]
7553#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
7554pub struct ScSpecFunctionV0 {
7555    pub doc: StringM<1024>,
7556    pub name: ScSymbol,
7557    pub inputs: VecM<ScSpecFunctionInputV0, 10>,
7558    pub outputs: VecM<ScSpecTypeDef, 1>,
7559}
7560
7561impl ReadXdr for ScSpecFunctionV0 {
7562    #[cfg(feature = "std")]
7563    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
7564        r.with_limited_depth(|r| {
7565            Ok(Self {
7566                doc: StringM::<1024>::read_xdr(r)?,
7567                name: ScSymbol::read_xdr(r)?,
7568                inputs: VecM::<ScSpecFunctionInputV0, 10>::read_xdr(r)?,
7569                outputs: VecM::<ScSpecTypeDef, 1>::read_xdr(r)?,
7570            })
7571        })
7572    }
7573}
7574
7575impl WriteXdr for ScSpecFunctionV0 {
7576    #[cfg(feature = "std")]
7577    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
7578        w.with_limited_depth(|w| {
7579            self.doc.write_xdr(w)?;
7580            self.name.write_xdr(w)?;
7581            self.inputs.write_xdr(w)?;
7582            self.outputs.write_xdr(w)?;
7583            Ok(())
7584        })
7585    }
7586}
7587
7588/// ScSpecEntryKind is an XDR Enum defines as:
7589///
7590/// ```text
7591/// enum SCSpecEntryKind
7592/// {
7593///     SC_SPEC_ENTRY_FUNCTION_V0 = 0,
7594///     SC_SPEC_ENTRY_UDT_STRUCT_V0 = 1,
7595///     SC_SPEC_ENTRY_UDT_UNION_V0 = 2,
7596///     SC_SPEC_ENTRY_UDT_ENUM_V0 = 3,
7597///     SC_SPEC_ENTRY_UDT_ERROR_ENUM_V0 = 4
7598/// };
7599/// ```
7600///
7601// enum
7602#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
7603#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
7604#[cfg_attr(
7605    all(feature = "serde", feature = "alloc"),
7606    derive(serde::Serialize, serde::Deserialize),
7607    serde(rename_all = "snake_case")
7608)]
7609#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
7610#[repr(i32)]
7611pub enum ScSpecEntryKind {
7612    FunctionV0 = 0,
7613    UdtStructV0 = 1,
7614    UdtUnionV0 = 2,
7615    UdtEnumV0 = 3,
7616    UdtErrorEnumV0 = 4,
7617}
7618
7619impl ScSpecEntryKind {
7620    pub const VARIANTS: [ScSpecEntryKind; 5] = [
7621        ScSpecEntryKind::FunctionV0,
7622        ScSpecEntryKind::UdtStructV0,
7623        ScSpecEntryKind::UdtUnionV0,
7624        ScSpecEntryKind::UdtEnumV0,
7625        ScSpecEntryKind::UdtErrorEnumV0,
7626    ];
7627    pub const VARIANTS_STR: [&'static str; 5] = [
7628        "FunctionV0",
7629        "UdtStructV0",
7630        "UdtUnionV0",
7631        "UdtEnumV0",
7632        "UdtErrorEnumV0",
7633    ];
7634
7635    #[must_use]
7636    pub const fn name(&self) -> &'static str {
7637        match self {
7638            Self::FunctionV0 => "FunctionV0",
7639            Self::UdtStructV0 => "UdtStructV0",
7640            Self::UdtUnionV0 => "UdtUnionV0",
7641            Self::UdtEnumV0 => "UdtEnumV0",
7642            Self::UdtErrorEnumV0 => "UdtErrorEnumV0",
7643        }
7644    }
7645
7646    #[must_use]
7647    pub const fn variants() -> [ScSpecEntryKind; 5] {
7648        Self::VARIANTS
7649    }
7650}
7651
7652impl Name for ScSpecEntryKind {
7653    #[must_use]
7654    fn name(&self) -> &'static str {
7655        Self::name(self)
7656    }
7657}
7658
7659impl Variants<ScSpecEntryKind> for ScSpecEntryKind {
7660    fn variants() -> slice::Iter<'static, ScSpecEntryKind> {
7661        Self::VARIANTS.iter()
7662    }
7663}
7664
7665impl Enum for ScSpecEntryKind {}
7666
7667impl fmt::Display for ScSpecEntryKind {
7668    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
7669        f.write_str(self.name())
7670    }
7671}
7672
7673impl TryFrom<i32> for ScSpecEntryKind {
7674    type Error = Error;
7675
7676    fn try_from(i: i32) -> Result<Self> {
7677        let e = match i {
7678            0 => ScSpecEntryKind::FunctionV0,
7679            1 => ScSpecEntryKind::UdtStructV0,
7680            2 => ScSpecEntryKind::UdtUnionV0,
7681            3 => ScSpecEntryKind::UdtEnumV0,
7682            4 => ScSpecEntryKind::UdtErrorEnumV0,
7683            #[allow(unreachable_patterns)]
7684            _ => return Err(Error::Invalid),
7685        };
7686        Ok(e)
7687    }
7688}
7689
7690impl From<ScSpecEntryKind> for i32 {
7691    #[must_use]
7692    fn from(e: ScSpecEntryKind) -> Self {
7693        e as Self
7694    }
7695}
7696
7697impl ReadXdr for ScSpecEntryKind {
7698    #[cfg(feature = "std")]
7699    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
7700        r.with_limited_depth(|r| {
7701            let e = i32::read_xdr(r)?;
7702            let v: Self = e.try_into()?;
7703            Ok(v)
7704        })
7705    }
7706}
7707
7708impl WriteXdr for ScSpecEntryKind {
7709    #[cfg(feature = "std")]
7710    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
7711        w.with_limited_depth(|w| {
7712            let i: i32 = (*self).into();
7713            i.write_xdr(w)
7714        })
7715    }
7716}
7717
7718/// ScSpecEntry is an XDR Union defines as:
7719///
7720/// ```text
7721/// union SCSpecEntry switch (SCSpecEntryKind kind)
7722/// {
7723/// case SC_SPEC_ENTRY_FUNCTION_V0:
7724///     SCSpecFunctionV0 functionV0;
7725/// case SC_SPEC_ENTRY_UDT_STRUCT_V0:
7726///     SCSpecUDTStructV0 udtStructV0;
7727/// case SC_SPEC_ENTRY_UDT_UNION_V0:
7728///     SCSpecUDTUnionV0 udtUnionV0;
7729/// case SC_SPEC_ENTRY_UDT_ENUM_V0:
7730///     SCSpecUDTEnumV0 udtEnumV0;
7731/// case SC_SPEC_ENTRY_UDT_ERROR_ENUM_V0:
7732///     SCSpecUDTErrorEnumV0 udtErrorEnumV0;
7733/// };
7734/// ```
7735///
7736// union with discriminant ScSpecEntryKind
7737#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
7738#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
7739#[cfg_attr(
7740    all(feature = "serde", feature = "alloc"),
7741    derive(serde::Serialize, serde::Deserialize),
7742    serde(rename_all = "snake_case")
7743)]
7744#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
7745#[allow(clippy::large_enum_variant)]
7746pub enum ScSpecEntry {
7747    FunctionV0(ScSpecFunctionV0),
7748    UdtStructV0(ScSpecUdtStructV0),
7749    UdtUnionV0(ScSpecUdtUnionV0),
7750    UdtEnumV0(ScSpecUdtEnumV0),
7751    UdtErrorEnumV0(ScSpecUdtErrorEnumV0),
7752}
7753
7754impl ScSpecEntry {
7755    pub const VARIANTS: [ScSpecEntryKind; 5] = [
7756        ScSpecEntryKind::FunctionV0,
7757        ScSpecEntryKind::UdtStructV0,
7758        ScSpecEntryKind::UdtUnionV0,
7759        ScSpecEntryKind::UdtEnumV0,
7760        ScSpecEntryKind::UdtErrorEnumV0,
7761    ];
7762    pub const VARIANTS_STR: [&'static str; 5] = [
7763        "FunctionV0",
7764        "UdtStructV0",
7765        "UdtUnionV0",
7766        "UdtEnumV0",
7767        "UdtErrorEnumV0",
7768    ];
7769
7770    #[must_use]
7771    pub const fn name(&self) -> &'static str {
7772        match self {
7773            Self::FunctionV0(_) => "FunctionV0",
7774            Self::UdtStructV0(_) => "UdtStructV0",
7775            Self::UdtUnionV0(_) => "UdtUnionV0",
7776            Self::UdtEnumV0(_) => "UdtEnumV0",
7777            Self::UdtErrorEnumV0(_) => "UdtErrorEnumV0",
7778        }
7779    }
7780
7781    #[must_use]
7782    pub const fn discriminant(&self) -> ScSpecEntryKind {
7783        #[allow(clippy::match_same_arms)]
7784        match self {
7785            Self::FunctionV0(_) => ScSpecEntryKind::FunctionV0,
7786            Self::UdtStructV0(_) => ScSpecEntryKind::UdtStructV0,
7787            Self::UdtUnionV0(_) => ScSpecEntryKind::UdtUnionV0,
7788            Self::UdtEnumV0(_) => ScSpecEntryKind::UdtEnumV0,
7789            Self::UdtErrorEnumV0(_) => ScSpecEntryKind::UdtErrorEnumV0,
7790        }
7791    }
7792
7793    #[must_use]
7794    pub const fn variants() -> [ScSpecEntryKind; 5] {
7795        Self::VARIANTS
7796    }
7797}
7798
7799impl Name for ScSpecEntry {
7800    #[must_use]
7801    fn name(&self) -> &'static str {
7802        Self::name(self)
7803    }
7804}
7805
7806impl Discriminant<ScSpecEntryKind> for ScSpecEntry {
7807    #[must_use]
7808    fn discriminant(&self) -> ScSpecEntryKind {
7809        Self::discriminant(self)
7810    }
7811}
7812
7813impl Variants<ScSpecEntryKind> for ScSpecEntry {
7814    fn variants() -> slice::Iter<'static, ScSpecEntryKind> {
7815        Self::VARIANTS.iter()
7816    }
7817}
7818
7819impl Union<ScSpecEntryKind> for ScSpecEntry {}
7820
7821impl ReadXdr for ScSpecEntry {
7822    #[cfg(feature = "std")]
7823    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
7824        r.with_limited_depth(|r| {
7825            let dv: ScSpecEntryKind = <ScSpecEntryKind as ReadXdr>::read_xdr(r)?;
7826            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
7827            let v = match dv {
7828                ScSpecEntryKind::FunctionV0 => Self::FunctionV0(ScSpecFunctionV0::read_xdr(r)?),
7829                ScSpecEntryKind::UdtStructV0 => Self::UdtStructV0(ScSpecUdtStructV0::read_xdr(r)?),
7830                ScSpecEntryKind::UdtUnionV0 => Self::UdtUnionV0(ScSpecUdtUnionV0::read_xdr(r)?),
7831                ScSpecEntryKind::UdtEnumV0 => Self::UdtEnumV0(ScSpecUdtEnumV0::read_xdr(r)?),
7832                ScSpecEntryKind::UdtErrorEnumV0 => {
7833                    Self::UdtErrorEnumV0(ScSpecUdtErrorEnumV0::read_xdr(r)?)
7834                }
7835                #[allow(unreachable_patterns)]
7836                _ => return Err(Error::Invalid),
7837            };
7838            Ok(v)
7839        })
7840    }
7841}
7842
7843impl WriteXdr for ScSpecEntry {
7844    #[cfg(feature = "std")]
7845    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
7846        w.with_limited_depth(|w| {
7847            self.discriminant().write_xdr(w)?;
7848            #[allow(clippy::match_same_arms)]
7849            match self {
7850                Self::FunctionV0(v) => v.write_xdr(w)?,
7851                Self::UdtStructV0(v) => v.write_xdr(w)?,
7852                Self::UdtUnionV0(v) => v.write_xdr(w)?,
7853                Self::UdtEnumV0(v) => v.write_xdr(w)?,
7854                Self::UdtErrorEnumV0(v) => v.write_xdr(w)?,
7855            };
7856            Ok(())
7857        })
7858    }
7859}
7860
7861/// ScValType is an XDR Enum defines as:
7862///
7863/// ```text
7864/// enum SCValType
7865/// {
7866///     SCV_BOOL = 0,
7867///     SCV_VOID = 1,
7868///     SCV_ERROR = 2,
7869///
7870///     // 32 bits is the smallest type in WASM or XDR; no need for u8/u16.
7871///     SCV_U32 = 3,
7872///     SCV_I32 = 4,
7873///
7874///     // 64 bits is naturally supported by both WASM and XDR also.
7875///     SCV_U64 = 5,
7876///     SCV_I64 = 6,
7877///
7878///     // Time-related u64 subtypes with their own functions and formatting.
7879///     SCV_TIMEPOINT = 7,
7880///     SCV_DURATION = 8,
7881///
7882///     // 128 bits is naturally supported by Rust and we use it for Soroban
7883///     // fixed-point arithmetic prices / balances / similar "quantities". These
7884///     // are represented in XDR as a pair of 2 u64s.
7885///     SCV_U128 = 9,
7886///     SCV_I128 = 10,
7887///
7888///     // 256 bits is the size of sha256 output, ed25519 keys, and the EVM machine
7889///     // word, so for interop use we include this even though it requires a small
7890///     // amount of Rust guest and/or host library code.
7891///     SCV_U256 = 11,
7892///     SCV_I256 = 12,
7893///
7894///     // Bytes come in 3 flavors, 2 of which have meaningfully different
7895///     // formatting and validity-checking / domain-restriction.
7896///     SCV_BYTES = 13,
7897///     SCV_STRING = 14,
7898///     SCV_SYMBOL = 15,
7899///
7900///     // Vecs and maps are just polymorphic containers of other ScVals.
7901///     SCV_VEC = 16,
7902///     SCV_MAP = 17,
7903///
7904///     // Address is the universal identifier for contracts and classic
7905///     // accounts.
7906///     SCV_ADDRESS = 18,
7907///
7908///     // The following are the internal SCVal variants that are not
7909///     // exposed to the contracts.
7910///     SCV_CONTRACT_INSTANCE = 19,
7911///
7912///     // SCV_LEDGER_KEY_CONTRACT_INSTANCE and SCV_LEDGER_KEY_NONCE are unique
7913///     // symbolic SCVals used as the key for ledger entries for a contract's
7914///     // instance and an address' nonce, respectively.
7915///     SCV_LEDGER_KEY_CONTRACT_INSTANCE = 20,
7916///     SCV_LEDGER_KEY_NONCE = 21
7917/// };
7918/// ```
7919///
7920// enum
7921#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
7922#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
7923#[cfg_attr(
7924    all(feature = "serde", feature = "alloc"),
7925    derive(serde::Serialize, serde::Deserialize),
7926    serde(rename_all = "snake_case")
7927)]
7928#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
7929#[repr(i32)]
7930pub enum ScValType {
7931    Bool = 0,
7932    Void = 1,
7933    Error = 2,
7934    U32 = 3,
7935    I32 = 4,
7936    U64 = 5,
7937    I64 = 6,
7938    Timepoint = 7,
7939    Duration = 8,
7940    U128 = 9,
7941    I128 = 10,
7942    U256 = 11,
7943    I256 = 12,
7944    Bytes = 13,
7945    String = 14,
7946    Symbol = 15,
7947    Vec = 16,
7948    Map = 17,
7949    Address = 18,
7950    ContractInstance = 19,
7951    LedgerKeyContractInstance = 20,
7952    LedgerKeyNonce = 21,
7953}
7954
7955impl ScValType {
7956    pub const VARIANTS: [ScValType; 22] = [
7957        ScValType::Bool,
7958        ScValType::Void,
7959        ScValType::Error,
7960        ScValType::U32,
7961        ScValType::I32,
7962        ScValType::U64,
7963        ScValType::I64,
7964        ScValType::Timepoint,
7965        ScValType::Duration,
7966        ScValType::U128,
7967        ScValType::I128,
7968        ScValType::U256,
7969        ScValType::I256,
7970        ScValType::Bytes,
7971        ScValType::String,
7972        ScValType::Symbol,
7973        ScValType::Vec,
7974        ScValType::Map,
7975        ScValType::Address,
7976        ScValType::ContractInstance,
7977        ScValType::LedgerKeyContractInstance,
7978        ScValType::LedgerKeyNonce,
7979    ];
7980    pub const VARIANTS_STR: [&'static str; 22] = [
7981        "Bool",
7982        "Void",
7983        "Error",
7984        "U32",
7985        "I32",
7986        "U64",
7987        "I64",
7988        "Timepoint",
7989        "Duration",
7990        "U128",
7991        "I128",
7992        "U256",
7993        "I256",
7994        "Bytes",
7995        "String",
7996        "Symbol",
7997        "Vec",
7998        "Map",
7999        "Address",
8000        "ContractInstance",
8001        "LedgerKeyContractInstance",
8002        "LedgerKeyNonce",
8003    ];
8004
8005    #[must_use]
8006    pub const fn name(&self) -> &'static str {
8007        match self {
8008            Self::Bool => "Bool",
8009            Self::Void => "Void",
8010            Self::Error => "Error",
8011            Self::U32 => "U32",
8012            Self::I32 => "I32",
8013            Self::U64 => "U64",
8014            Self::I64 => "I64",
8015            Self::Timepoint => "Timepoint",
8016            Self::Duration => "Duration",
8017            Self::U128 => "U128",
8018            Self::I128 => "I128",
8019            Self::U256 => "U256",
8020            Self::I256 => "I256",
8021            Self::Bytes => "Bytes",
8022            Self::String => "String",
8023            Self::Symbol => "Symbol",
8024            Self::Vec => "Vec",
8025            Self::Map => "Map",
8026            Self::Address => "Address",
8027            Self::ContractInstance => "ContractInstance",
8028            Self::LedgerKeyContractInstance => "LedgerKeyContractInstance",
8029            Self::LedgerKeyNonce => "LedgerKeyNonce",
8030        }
8031    }
8032
8033    #[must_use]
8034    pub const fn variants() -> [ScValType; 22] {
8035        Self::VARIANTS
8036    }
8037}
8038
8039impl Name for ScValType {
8040    #[must_use]
8041    fn name(&self) -> &'static str {
8042        Self::name(self)
8043    }
8044}
8045
8046impl Variants<ScValType> for ScValType {
8047    fn variants() -> slice::Iter<'static, ScValType> {
8048        Self::VARIANTS.iter()
8049    }
8050}
8051
8052impl Enum for ScValType {}
8053
8054impl fmt::Display for ScValType {
8055    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
8056        f.write_str(self.name())
8057    }
8058}
8059
8060impl TryFrom<i32> for ScValType {
8061    type Error = Error;
8062
8063    fn try_from(i: i32) -> Result<Self> {
8064        let e = match i {
8065            0 => ScValType::Bool,
8066            1 => ScValType::Void,
8067            2 => ScValType::Error,
8068            3 => ScValType::U32,
8069            4 => ScValType::I32,
8070            5 => ScValType::U64,
8071            6 => ScValType::I64,
8072            7 => ScValType::Timepoint,
8073            8 => ScValType::Duration,
8074            9 => ScValType::U128,
8075            10 => ScValType::I128,
8076            11 => ScValType::U256,
8077            12 => ScValType::I256,
8078            13 => ScValType::Bytes,
8079            14 => ScValType::String,
8080            15 => ScValType::Symbol,
8081            16 => ScValType::Vec,
8082            17 => ScValType::Map,
8083            18 => ScValType::Address,
8084            19 => ScValType::ContractInstance,
8085            20 => ScValType::LedgerKeyContractInstance,
8086            21 => ScValType::LedgerKeyNonce,
8087            #[allow(unreachable_patterns)]
8088            _ => return Err(Error::Invalid),
8089        };
8090        Ok(e)
8091    }
8092}
8093
8094impl From<ScValType> for i32 {
8095    #[must_use]
8096    fn from(e: ScValType) -> Self {
8097        e as Self
8098    }
8099}
8100
8101impl ReadXdr for ScValType {
8102    #[cfg(feature = "std")]
8103    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
8104        r.with_limited_depth(|r| {
8105            let e = i32::read_xdr(r)?;
8106            let v: Self = e.try_into()?;
8107            Ok(v)
8108        })
8109    }
8110}
8111
8112impl WriteXdr for ScValType {
8113    #[cfg(feature = "std")]
8114    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
8115        w.with_limited_depth(|w| {
8116            let i: i32 = (*self).into();
8117            i.write_xdr(w)
8118        })
8119    }
8120}
8121
8122/// ScErrorType is an XDR Enum defines as:
8123///
8124/// ```text
8125/// enum SCErrorType
8126/// {
8127///     SCE_CONTRACT = 0,          // Contract-specific, user-defined codes.
8128///     SCE_WASM_VM = 1,           // Errors while interpreting WASM bytecode.
8129///     SCE_CONTEXT = 2,           // Errors in the contract's host context.
8130///     SCE_STORAGE = 3,           // Errors accessing host storage.
8131///     SCE_OBJECT = 4,            // Errors working with host objects.
8132///     SCE_CRYPTO = 5,            // Errors in cryptographic operations.
8133///     SCE_EVENTS = 6,            // Errors while emitting events.
8134///     SCE_BUDGET = 7,            // Errors relating to budget limits.
8135///     SCE_VALUE = 8,             // Errors working with host values or SCVals.
8136///     SCE_AUTH = 9               // Errors from the authentication subsystem.
8137/// };
8138/// ```
8139///
8140// enum
8141#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
8142#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
8143#[cfg_attr(
8144    all(feature = "serde", feature = "alloc"),
8145    derive(serde::Serialize, serde::Deserialize),
8146    serde(rename_all = "snake_case")
8147)]
8148#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
8149#[repr(i32)]
8150pub enum ScErrorType {
8151    Contract = 0,
8152    WasmVm = 1,
8153    Context = 2,
8154    Storage = 3,
8155    Object = 4,
8156    Crypto = 5,
8157    Events = 6,
8158    Budget = 7,
8159    Value = 8,
8160    Auth = 9,
8161}
8162
8163impl ScErrorType {
8164    pub const VARIANTS: [ScErrorType; 10] = [
8165        ScErrorType::Contract,
8166        ScErrorType::WasmVm,
8167        ScErrorType::Context,
8168        ScErrorType::Storage,
8169        ScErrorType::Object,
8170        ScErrorType::Crypto,
8171        ScErrorType::Events,
8172        ScErrorType::Budget,
8173        ScErrorType::Value,
8174        ScErrorType::Auth,
8175    ];
8176    pub const VARIANTS_STR: [&'static str; 10] = [
8177        "Contract", "WasmVm", "Context", "Storage", "Object", "Crypto", "Events", "Budget",
8178        "Value", "Auth",
8179    ];
8180
8181    #[must_use]
8182    pub const fn name(&self) -> &'static str {
8183        match self {
8184            Self::Contract => "Contract",
8185            Self::WasmVm => "WasmVm",
8186            Self::Context => "Context",
8187            Self::Storage => "Storage",
8188            Self::Object => "Object",
8189            Self::Crypto => "Crypto",
8190            Self::Events => "Events",
8191            Self::Budget => "Budget",
8192            Self::Value => "Value",
8193            Self::Auth => "Auth",
8194        }
8195    }
8196
8197    #[must_use]
8198    pub const fn variants() -> [ScErrorType; 10] {
8199        Self::VARIANTS
8200    }
8201}
8202
8203impl Name for ScErrorType {
8204    #[must_use]
8205    fn name(&self) -> &'static str {
8206        Self::name(self)
8207    }
8208}
8209
8210impl Variants<ScErrorType> for ScErrorType {
8211    fn variants() -> slice::Iter<'static, ScErrorType> {
8212        Self::VARIANTS.iter()
8213    }
8214}
8215
8216impl Enum for ScErrorType {}
8217
8218impl fmt::Display for ScErrorType {
8219    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
8220        f.write_str(self.name())
8221    }
8222}
8223
8224impl TryFrom<i32> for ScErrorType {
8225    type Error = Error;
8226
8227    fn try_from(i: i32) -> Result<Self> {
8228        let e = match i {
8229            0 => ScErrorType::Contract,
8230            1 => ScErrorType::WasmVm,
8231            2 => ScErrorType::Context,
8232            3 => ScErrorType::Storage,
8233            4 => ScErrorType::Object,
8234            5 => ScErrorType::Crypto,
8235            6 => ScErrorType::Events,
8236            7 => ScErrorType::Budget,
8237            8 => ScErrorType::Value,
8238            9 => ScErrorType::Auth,
8239            #[allow(unreachable_patterns)]
8240            _ => return Err(Error::Invalid),
8241        };
8242        Ok(e)
8243    }
8244}
8245
8246impl From<ScErrorType> for i32 {
8247    #[must_use]
8248    fn from(e: ScErrorType) -> Self {
8249        e as Self
8250    }
8251}
8252
8253impl ReadXdr for ScErrorType {
8254    #[cfg(feature = "std")]
8255    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
8256        r.with_limited_depth(|r| {
8257            let e = i32::read_xdr(r)?;
8258            let v: Self = e.try_into()?;
8259            Ok(v)
8260        })
8261    }
8262}
8263
8264impl WriteXdr for ScErrorType {
8265    #[cfg(feature = "std")]
8266    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
8267        w.with_limited_depth(|w| {
8268            let i: i32 = (*self).into();
8269            i.write_xdr(w)
8270        })
8271    }
8272}
8273
8274/// ScErrorCode is an XDR Enum defines as:
8275///
8276/// ```text
8277/// enum SCErrorCode
8278/// {
8279///     SCEC_ARITH_DOMAIN = 0,      // Some arithmetic was undefined (overflow, divide-by-zero).
8280///     SCEC_INDEX_BOUNDS = 1,      // Something was indexed beyond its bounds.
8281///     SCEC_INVALID_INPUT = 2,     // User provided some otherwise-bad data.
8282///     SCEC_MISSING_VALUE = 3,     // Some value was required but not provided.
8283///     SCEC_EXISTING_VALUE = 4,    // Some value was provided where not allowed.
8284///     SCEC_EXCEEDED_LIMIT = 5,    // Some arbitrary limit -- gas or otherwise -- was hit.
8285///     SCEC_INVALID_ACTION = 6,    // Data was valid but action requested was not.
8286///     SCEC_INTERNAL_ERROR = 7,    // The host detected an error in its own logic.
8287///     SCEC_UNEXPECTED_TYPE = 8,   // Some type wasn't as expected.
8288///     SCEC_UNEXPECTED_SIZE = 9    // Something's size wasn't as expected.
8289/// };
8290/// ```
8291///
8292// enum
8293#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
8294#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
8295#[cfg_attr(
8296    all(feature = "serde", feature = "alloc"),
8297    derive(serde::Serialize, serde::Deserialize),
8298    serde(rename_all = "snake_case")
8299)]
8300#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
8301#[repr(i32)]
8302pub enum ScErrorCode {
8303    ArithDomain = 0,
8304    IndexBounds = 1,
8305    InvalidInput = 2,
8306    MissingValue = 3,
8307    ExistingValue = 4,
8308    ExceededLimit = 5,
8309    InvalidAction = 6,
8310    InternalError = 7,
8311    UnexpectedType = 8,
8312    UnexpectedSize = 9,
8313}
8314
8315impl ScErrorCode {
8316    pub const VARIANTS: [ScErrorCode; 10] = [
8317        ScErrorCode::ArithDomain,
8318        ScErrorCode::IndexBounds,
8319        ScErrorCode::InvalidInput,
8320        ScErrorCode::MissingValue,
8321        ScErrorCode::ExistingValue,
8322        ScErrorCode::ExceededLimit,
8323        ScErrorCode::InvalidAction,
8324        ScErrorCode::InternalError,
8325        ScErrorCode::UnexpectedType,
8326        ScErrorCode::UnexpectedSize,
8327    ];
8328    pub const VARIANTS_STR: [&'static str; 10] = [
8329        "ArithDomain",
8330        "IndexBounds",
8331        "InvalidInput",
8332        "MissingValue",
8333        "ExistingValue",
8334        "ExceededLimit",
8335        "InvalidAction",
8336        "InternalError",
8337        "UnexpectedType",
8338        "UnexpectedSize",
8339    ];
8340
8341    #[must_use]
8342    pub const fn name(&self) -> &'static str {
8343        match self {
8344            Self::ArithDomain => "ArithDomain",
8345            Self::IndexBounds => "IndexBounds",
8346            Self::InvalidInput => "InvalidInput",
8347            Self::MissingValue => "MissingValue",
8348            Self::ExistingValue => "ExistingValue",
8349            Self::ExceededLimit => "ExceededLimit",
8350            Self::InvalidAction => "InvalidAction",
8351            Self::InternalError => "InternalError",
8352            Self::UnexpectedType => "UnexpectedType",
8353            Self::UnexpectedSize => "UnexpectedSize",
8354        }
8355    }
8356
8357    #[must_use]
8358    pub const fn variants() -> [ScErrorCode; 10] {
8359        Self::VARIANTS
8360    }
8361}
8362
8363impl Name for ScErrorCode {
8364    #[must_use]
8365    fn name(&self) -> &'static str {
8366        Self::name(self)
8367    }
8368}
8369
8370impl Variants<ScErrorCode> for ScErrorCode {
8371    fn variants() -> slice::Iter<'static, ScErrorCode> {
8372        Self::VARIANTS.iter()
8373    }
8374}
8375
8376impl Enum for ScErrorCode {}
8377
8378impl fmt::Display for ScErrorCode {
8379    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
8380        f.write_str(self.name())
8381    }
8382}
8383
8384impl TryFrom<i32> for ScErrorCode {
8385    type Error = Error;
8386
8387    fn try_from(i: i32) -> Result<Self> {
8388        let e = match i {
8389            0 => ScErrorCode::ArithDomain,
8390            1 => ScErrorCode::IndexBounds,
8391            2 => ScErrorCode::InvalidInput,
8392            3 => ScErrorCode::MissingValue,
8393            4 => ScErrorCode::ExistingValue,
8394            5 => ScErrorCode::ExceededLimit,
8395            6 => ScErrorCode::InvalidAction,
8396            7 => ScErrorCode::InternalError,
8397            8 => ScErrorCode::UnexpectedType,
8398            9 => ScErrorCode::UnexpectedSize,
8399            #[allow(unreachable_patterns)]
8400            _ => return Err(Error::Invalid),
8401        };
8402        Ok(e)
8403    }
8404}
8405
8406impl From<ScErrorCode> for i32 {
8407    #[must_use]
8408    fn from(e: ScErrorCode) -> Self {
8409        e as Self
8410    }
8411}
8412
8413impl ReadXdr for ScErrorCode {
8414    #[cfg(feature = "std")]
8415    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
8416        r.with_limited_depth(|r| {
8417            let e = i32::read_xdr(r)?;
8418            let v: Self = e.try_into()?;
8419            Ok(v)
8420        })
8421    }
8422}
8423
8424impl WriteXdr for ScErrorCode {
8425    #[cfg(feature = "std")]
8426    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
8427        w.with_limited_depth(|w| {
8428            let i: i32 = (*self).into();
8429            i.write_xdr(w)
8430        })
8431    }
8432}
8433
8434/// ScError is an XDR Union defines as:
8435///
8436/// ```text
8437/// union SCError switch (SCErrorType type)
8438/// {
8439/// case SCE_CONTRACT:
8440///     uint32 contractCode;
8441/// case SCE_WASM_VM:
8442/// case SCE_CONTEXT:
8443/// case SCE_STORAGE:
8444/// case SCE_OBJECT:
8445/// case SCE_CRYPTO:
8446/// case SCE_EVENTS:
8447/// case SCE_BUDGET:
8448/// case SCE_VALUE:
8449/// case SCE_AUTH:
8450///     SCErrorCode code;
8451/// };
8452/// ```
8453///
8454// union with discriminant ScErrorType
8455#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
8456#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
8457#[cfg_attr(
8458    all(feature = "serde", feature = "alloc"),
8459    derive(serde::Serialize, serde::Deserialize),
8460    serde(rename_all = "snake_case")
8461)]
8462#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
8463#[allow(clippy::large_enum_variant)]
8464pub enum ScError {
8465    Contract(u32),
8466    WasmVm(ScErrorCode),
8467    Context(ScErrorCode),
8468    Storage(ScErrorCode),
8469    Object(ScErrorCode),
8470    Crypto(ScErrorCode),
8471    Events(ScErrorCode),
8472    Budget(ScErrorCode),
8473    Value(ScErrorCode),
8474    Auth(ScErrorCode),
8475}
8476
8477impl ScError {
8478    pub const VARIANTS: [ScErrorType; 10] = [
8479        ScErrorType::Contract,
8480        ScErrorType::WasmVm,
8481        ScErrorType::Context,
8482        ScErrorType::Storage,
8483        ScErrorType::Object,
8484        ScErrorType::Crypto,
8485        ScErrorType::Events,
8486        ScErrorType::Budget,
8487        ScErrorType::Value,
8488        ScErrorType::Auth,
8489    ];
8490    pub const VARIANTS_STR: [&'static str; 10] = [
8491        "Contract", "WasmVm", "Context", "Storage", "Object", "Crypto", "Events", "Budget",
8492        "Value", "Auth",
8493    ];
8494
8495    #[must_use]
8496    pub const fn name(&self) -> &'static str {
8497        match self {
8498            Self::Contract(_) => "Contract",
8499            Self::WasmVm(_) => "WasmVm",
8500            Self::Context(_) => "Context",
8501            Self::Storage(_) => "Storage",
8502            Self::Object(_) => "Object",
8503            Self::Crypto(_) => "Crypto",
8504            Self::Events(_) => "Events",
8505            Self::Budget(_) => "Budget",
8506            Self::Value(_) => "Value",
8507            Self::Auth(_) => "Auth",
8508        }
8509    }
8510
8511    #[must_use]
8512    pub const fn discriminant(&self) -> ScErrorType {
8513        #[allow(clippy::match_same_arms)]
8514        match self {
8515            Self::Contract(_) => ScErrorType::Contract,
8516            Self::WasmVm(_) => ScErrorType::WasmVm,
8517            Self::Context(_) => ScErrorType::Context,
8518            Self::Storage(_) => ScErrorType::Storage,
8519            Self::Object(_) => ScErrorType::Object,
8520            Self::Crypto(_) => ScErrorType::Crypto,
8521            Self::Events(_) => ScErrorType::Events,
8522            Self::Budget(_) => ScErrorType::Budget,
8523            Self::Value(_) => ScErrorType::Value,
8524            Self::Auth(_) => ScErrorType::Auth,
8525        }
8526    }
8527
8528    #[must_use]
8529    pub const fn variants() -> [ScErrorType; 10] {
8530        Self::VARIANTS
8531    }
8532}
8533
8534impl Name for ScError {
8535    #[must_use]
8536    fn name(&self) -> &'static str {
8537        Self::name(self)
8538    }
8539}
8540
8541impl Discriminant<ScErrorType> for ScError {
8542    #[must_use]
8543    fn discriminant(&self) -> ScErrorType {
8544        Self::discriminant(self)
8545    }
8546}
8547
8548impl Variants<ScErrorType> for ScError {
8549    fn variants() -> slice::Iter<'static, ScErrorType> {
8550        Self::VARIANTS.iter()
8551    }
8552}
8553
8554impl Union<ScErrorType> for ScError {}
8555
8556impl ReadXdr for ScError {
8557    #[cfg(feature = "std")]
8558    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
8559        r.with_limited_depth(|r| {
8560            let dv: ScErrorType = <ScErrorType as ReadXdr>::read_xdr(r)?;
8561            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
8562            let v = match dv {
8563                ScErrorType::Contract => Self::Contract(u32::read_xdr(r)?),
8564                ScErrorType::WasmVm => Self::WasmVm(ScErrorCode::read_xdr(r)?),
8565                ScErrorType::Context => Self::Context(ScErrorCode::read_xdr(r)?),
8566                ScErrorType::Storage => Self::Storage(ScErrorCode::read_xdr(r)?),
8567                ScErrorType::Object => Self::Object(ScErrorCode::read_xdr(r)?),
8568                ScErrorType::Crypto => Self::Crypto(ScErrorCode::read_xdr(r)?),
8569                ScErrorType::Events => Self::Events(ScErrorCode::read_xdr(r)?),
8570                ScErrorType::Budget => Self::Budget(ScErrorCode::read_xdr(r)?),
8571                ScErrorType::Value => Self::Value(ScErrorCode::read_xdr(r)?),
8572                ScErrorType::Auth => Self::Auth(ScErrorCode::read_xdr(r)?),
8573                #[allow(unreachable_patterns)]
8574                _ => return Err(Error::Invalid),
8575            };
8576            Ok(v)
8577        })
8578    }
8579}
8580
8581impl WriteXdr for ScError {
8582    #[cfg(feature = "std")]
8583    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
8584        w.with_limited_depth(|w| {
8585            self.discriminant().write_xdr(w)?;
8586            #[allow(clippy::match_same_arms)]
8587            match self {
8588                Self::Contract(v) => v.write_xdr(w)?,
8589                Self::WasmVm(v) => v.write_xdr(w)?,
8590                Self::Context(v) => v.write_xdr(w)?,
8591                Self::Storage(v) => v.write_xdr(w)?,
8592                Self::Object(v) => v.write_xdr(w)?,
8593                Self::Crypto(v) => v.write_xdr(w)?,
8594                Self::Events(v) => v.write_xdr(w)?,
8595                Self::Budget(v) => v.write_xdr(w)?,
8596                Self::Value(v) => v.write_xdr(w)?,
8597                Self::Auth(v) => v.write_xdr(w)?,
8598            };
8599            Ok(())
8600        })
8601    }
8602}
8603
8604/// UInt128Parts is an XDR Struct defines as:
8605///
8606/// ```text
8607/// struct UInt128Parts {
8608///     uint64 hi;
8609///     uint64 lo;
8610/// };
8611/// ```
8612///
8613#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
8614#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
8615#[cfg_attr(
8616    all(feature = "serde", feature = "alloc"),
8617    derive(serde::Serialize, serde::Deserialize),
8618    serde(rename_all = "snake_case")
8619)]
8620#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
8621pub struct UInt128Parts {
8622    pub hi: u64,
8623    pub lo: u64,
8624}
8625
8626impl ReadXdr for UInt128Parts {
8627    #[cfg(feature = "std")]
8628    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
8629        r.with_limited_depth(|r| {
8630            Ok(Self {
8631                hi: u64::read_xdr(r)?,
8632                lo: u64::read_xdr(r)?,
8633            })
8634        })
8635    }
8636}
8637
8638impl WriteXdr for UInt128Parts {
8639    #[cfg(feature = "std")]
8640    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
8641        w.with_limited_depth(|w| {
8642            self.hi.write_xdr(w)?;
8643            self.lo.write_xdr(w)?;
8644            Ok(())
8645        })
8646    }
8647}
8648
8649/// Int128Parts is an XDR Struct defines as:
8650///
8651/// ```text
8652/// struct Int128Parts {
8653///     int64 hi;
8654///     uint64 lo;
8655/// };
8656/// ```
8657///
8658#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
8659#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
8660#[cfg_attr(
8661    all(feature = "serde", feature = "alloc"),
8662    derive(serde::Serialize, serde::Deserialize),
8663    serde(rename_all = "snake_case")
8664)]
8665#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
8666pub struct Int128Parts {
8667    pub hi: i64,
8668    pub lo: u64,
8669}
8670
8671impl ReadXdr for Int128Parts {
8672    #[cfg(feature = "std")]
8673    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
8674        r.with_limited_depth(|r| {
8675            Ok(Self {
8676                hi: i64::read_xdr(r)?,
8677                lo: u64::read_xdr(r)?,
8678            })
8679        })
8680    }
8681}
8682
8683impl WriteXdr for Int128Parts {
8684    #[cfg(feature = "std")]
8685    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
8686        w.with_limited_depth(|w| {
8687            self.hi.write_xdr(w)?;
8688            self.lo.write_xdr(w)?;
8689            Ok(())
8690        })
8691    }
8692}
8693
8694/// UInt256Parts is an XDR Struct defines as:
8695///
8696/// ```text
8697/// struct UInt256Parts {
8698///     uint64 hi_hi;
8699///     uint64 hi_lo;
8700///     uint64 lo_hi;
8701///     uint64 lo_lo;
8702/// };
8703/// ```
8704///
8705#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
8706#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
8707#[cfg_attr(
8708    all(feature = "serde", feature = "alloc"),
8709    derive(serde::Serialize, serde::Deserialize),
8710    serde(rename_all = "snake_case")
8711)]
8712#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
8713pub struct UInt256Parts {
8714    pub hi_hi: u64,
8715    pub hi_lo: u64,
8716    pub lo_hi: u64,
8717    pub lo_lo: u64,
8718}
8719
8720impl ReadXdr for UInt256Parts {
8721    #[cfg(feature = "std")]
8722    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
8723        r.with_limited_depth(|r| {
8724            Ok(Self {
8725                hi_hi: u64::read_xdr(r)?,
8726                hi_lo: u64::read_xdr(r)?,
8727                lo_hi: u64::read_xdr(r)?,
8728                lo_lo: u64::read_xdr(r)?,
8729            })
8730        })
8731    }
8732}
8733
8734impl WriteXdr for UInt256Parts {
8735    #[cfg(feature = "std")]
8736    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
8737        w.with_limited_depth(|w| {
8738            self.hi_hi.write_xdr(w)?;
8739            self.hi_lo.write_xdr(w)?;
8740            self.lo_hi.write_xdr(w)?;
8741            self.lo_lo.write_xdr(w)?;
8742            Ok(())
8743        })
8744    }
8745}
8746
8747/// Int256Parts is an XDR Struct defines as:
8748///
8749/// ```text
8750/// struct Int256Parts {
8751///     int64 hi_hi;
8752///     uint64 hi_lo;
8753///     uint64 lo_hi;
8754///     uint64 lo_lo;
8755/// };
8756/// ```
8757///
8758#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
8759#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
8760#[cfg_attr(
8761    all(feature = "serde", feature = "alloc"),
8762    derive(serde::Serialize, serde::Deserialize),
8763    serde(rename_all = "snake_case")
8764)]
8765#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
8766pub struct Int256Parts {
8767    pub hi_hi: i64,
8768    pub hi_lo: u64,
8769    pub lo_hi: u64,
8770    pub lo_lo: u64,
8771}
8772
8773impl ReadXdr for Int256Parts {
8774    #[cfg(feature = "std")]
8775    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
8776        r.with_limited_depth(|r| {
8777            Ok(Self {
8778                hi_hi: i64::read_xdr(r)?,
8779                hi_lo: u64::read_xdr(r)?,
8780                lo_hi: u64::read_xdr(r)?,
8781                lo_lo: u64::read_xdr(r)?,
8782            })
8783        })
8784    }
8785}
8786
8787impl WriteXdr for Int256Parts {
8788    #[cfg(feature = "std")]
8789    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
8790        w.with_limited_depth(|w| {
8791            self.hi_hi.write_xdr(w)?;
8792            self.hi_lo.write_xdr(w)?;
8793            self.lo_hi.write_xdr(w)?;
8794            self.lo_lo.write_xdr(w)?;
8795            Ok(())
8796        })
8797    }
8798}
8799
8800/// ContractExecutableType is an XDR Enum defines as:
8801///
8802/// ```text
8803/// enum ContractExecutableType
8804/// {
8805///     CONTRACT_EXECUTABLE_WASM = 0,
8806///     CONTRACT_EXECUTABLE_STELLAR_ASSET = 1
8807/// };
8808/// ```
8809///
8810// enum
8811#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
8812#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
8813#[cfg_attr(
8814    all(feature = "serde", feature = "alloc"),
8815    derive(serde::Serialize, serde::Deserialize),
8816    serde(rename_all = "snake_case")
8817)]
8818#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
8819#[repr(i32)]
8820pub enum ContractExecutableType {
8821    Wasm = 0,
8822    StellarAsset = 1,
8823}
8824
8825impl ContractExecutableType {
8826    pub const VARIANTS: [ContractExecutableType; 2] = [
8827        ContractExecutableType::Wasm,
8828        ContractExecutableType::StellarAsset,
8829    ];
8830    pub const VARIANTS_STR: [&'static str; 2] = ["Wasm", "StellarAsset"];
8831
8832    #[must_use]
8833    pub const fn name(&self) -> &'static str {
8834        match self {
8835            Self::Wasm => "Wasm",
8836            Self::StellarAsset => "StellarAsset",
8837        }
8838    }
8839
8840    #[must_use]
8841    pub const fn variants() -> [ContractExecutableType; 2] {
8842        Self::VARIANTS
8843    }
8844}
8845
8846impl Name for ContractExecutableType {
8847    #[must_use]
8848    fn name(&self) -> &'static str {
8849        Self::name(self)
8850    }
8851}
8852
8853impl Variants<ContractExecutableType> for ContractExecutableType {
8854    fn variants() -> slice::Iter<'static, ContractExecutableType> {
8855        Self::VARIANTS.iter()
8856    }
8857}
8858
8859impl Enum for ContractExecutableType {}
8860
8861impl fmt::Display for ContractExecutableType {
8862    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
8863        f.write_str(self.name())
8864    }
8865}
8866
8867impl TryFrom<i32> for ContractExecutableType {
8868    type Error = Error;
8869
8870    fn try_from(i: i32) -> Result<Self> {
8871        let e = match i {
8872            0 => ContractExecutableType::Wasm,
8873            1 => ContractExecutableType::StellarAsset,
8874            #[allow(unreachable_patterns)]
8875            _ => return Err(Error::Invalid),
8876        };
8877        Ok(e)
8878    }
8879}
8880
8881impl From<ContractExecutableType> for i32 {
8882    #[must_use]
8883    fn from(e: ContractExecutableType) -> Self {
8884        e as Self
8885    }
8886}
8887
8888impl ReadXdr for ContractExecutableType {
8889    #[cfg(feature = "std")]
8890    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
8891        r.with_limited_depth(|r| {
8892            let e = i32::read_xdr(r)?;
8893            let v: Self = e.try_into()?;
8894            Ok(v)
8895        })
8896    }
8897}
8898
8899impl WriteXdr for ContractExecutableType {
8900    #[cfg(feature = "std")]
8901    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
8902        w.with_limited_depth(|w| {
8903            let i: i32 = (*self).into();
8904            i.write_xdr(w)
8905        })
8906    }
8907}
8908
8909/// ContractExecutable is an XDR Union defines as:
8910///
8911/// ```text
8912/// union ContractExecutable switch (ContractExecutableType type)
8913/// {
8914/// case CONTRACT_EXECUTABLE_WASM:
8915///     Hash wasm_hash;
8916/// case CONTRACT_EXECUTABLE_STELLAR_ASSET:
8917///     void;
8918/// };
8919/// ```
8920///
8921// union with discriminant ContractExecutableType
8922#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
8923#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
8924#[cfg_attr(
8925    all(feature = "serde", feature = "alloc"),
8926    derive(serde::Serialize, serde::Deserialize),
8927    serde(rename_all = "snake_case")
8928)]
8929#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
8930#[allow(clippy::large_enum_variant)]
8931pub enum ContractExecutable {
8932    Wasm(Hash),
8933    StellarAsset,
8934}
8935
8936impl ContractExecutable {
8937    pub const VARIANTS: [ContractExecutableType; 2] = [
8938        ContractExecutableType::Wasm,
8939        ContractExecutableType::StellarAsset,
8940    ];
8941    pub const VARIANTS_STR: [&'static str; 2] = ["Wasm", "StellarAsset"];
8942
8943    #[must_use]
8944    pub const fn name(&self) -> &'static str {
8945        match self {
8946            Self::Wasm(_) => "Wasm",
8947            Self::StellarAsset => "StellarAsset",
8948        }
8949    }
8950
8951    #[must_use]
8952    pub const fn discriminant(&self) -> ContractExecutableType {
8953        #[allow(clippy::match_same_arms)]
8954        match self {
8955            Self::Wasm(_) => ContractExecutableType::Wasm,
8956            Self::StellarAsset => ContractExecutableType::StellarAsset,
8957        }
8958    }
8959
8960    #[must_use]
8961    pub const fn variants() -> [ContractExecutableType; 2] {
8962        Self::VARIANTS
8963    }
8964}
8965
8966impl Name for ContractExecutable {
8967    #[must_use]
8968    fn name(&self) -> &'static str {
8969        Self::name(self)
8970    }
8971}
8972
8973impl Discriminant<ContractExecutableType> for ContractExecutable {
8974    #[must_use]
8975    fn discriminant(&self) -> ContractExecutableType {
8976        Self::discriminant(self)
8977    }
8978}
8979
8980impl Variants<ContractExecutableType> for ContractExecutable {
8981    fn variants() -> slice::Iter<'static, ContractExecutableType> {
8982        Self::VARIANTS.iter()
8983    }
8984}
8985
8986impl Union<ContractExecutableType> for ContractExecutable {}
8987
8988impl ReadXdr for ContractExecutable {
8989    #[cfg(feature = "std")]
8990    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
8991        r.with_limited_depth(|r| {
8992            let dv: ContractExecutableType = <ContractExecutableType as ReadXdr>::read_xdr(r)?;
8993            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
8994            let v = match dv {
8995                ContractExecutableType::Wasm => Self::Wasm(Hash::read_xdr(r)?),
8996                ContractExecutableType::StellarAsset => Self::StellarAsset,
8997                #[allow(unreachable_patterns)]
8998                _ => return Err(Error::Invalid),
8999            };
9000            Ok(v)
9001        })
9002    }
9003}
9004
9005impl WriteXdr for ContractExecutable {
9006    #[cfg(feature = "std")]
9007    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
9008        w.with_limited_depth(|w| {
9009            self.discriminant().write_xdr(w)?;
9010            #[allow(clippy::match_same_arms)]
9011            match self {
9012                Self::Wasm(v) => v.write_xdr(w)?,
9013                Self::StellarAsset => ().write_xdr(w)?,
9014            };
9015            Ok(())
9016        })
9017    }
9018}
9019
9020/// ScAddressType is an XDR Enum defines as:
9021///
9022/// ```text
9023/// enum SCAddressType
9024/// {
9025///     SC_ADDRESS_TYPE_ACCOUNT = 0,
9026///     SC_ADDRESS_TYPE_CONTRACT = 1
9027/// };
9028/// ```
9029///
9030// enum
9031#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
9032#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
9033#[cfg_attr(
9034    all(feature = "serde", feature = "alloc"),
9035    derive(serde::Serialize, serde::Deserialize),
9036    serde(rename_all = "snake_case")
9037)]
9038#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
9039#[repr(i32)]
9040pub enum ScAddressType {
9041    Account = 0,
9042    Contract = 1,
9043}
9044
9045impl ScAddressType {
9046    pub const VARIANTS: [ScAddressType; 2] = [ScAddressType::Account, ScAddressType::Contract];
9047    pub const VARIANTS_STR: [&'static str; 2] = ["Account", "Contract"];
9048
9049    #[must_use]
9050    pub const fn name(&self) -> &'static str {
9051        match self {
9052            Self::Account => "Account",
9053            Self::Contract => "Contract",
9054        }
9055    }
9056
9057    #[must_use]
9058    pub const fn variants() -> [ScAddressType; 2] {
9059        Self::VARIANTS
9060    }
9061}
9062
9063impl Name for ScAddressType {
9064    #[must_use]
9065    fn name(&self) -> &'static str {
9066        Self::name(self)
9067    }
9068}
9069
9070impl Variants<ScAddressType> for ScAddressType {
9071    fn variants() -> slice::Iter<'static, ScAddressType> {
9072        Self::VARIANTS.iter()
9073    }
9074}
9075
9076impl Enum for ScAddressType {}
9077
9078impl fmt::Display for ScAddressType {
9079    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
9080        f.write_str(self.name())
9081    }
9082}
9083
9084impl TryFrom<i32> for ScAddressType {
9085    type Error = Error;
9086
9087    fn try_from(i: i32) -> Result<Self> {
9088        let e = match i {
9089            0 => ScAddressType::Account,
9090            1 => ScAddressType::Contract,
9091            #[allow(unreachable_patterns)]
9092            _ => return Err(Error::Invalid),
9093        };
9094        Ok(e)
9095    }
9096}
9097
9098impl From<ScAddressType> for i32 {
9099    #[must_use]
9100    fn from(e: ScAddressType) -> Self {
9101        e as Self
9102    }
9103}
9104
9105impl ReadXdr for ScAddressType {
9106    #[cfg(feature = "std")]
9107    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
9108        r.with_limited_depth(|r| {
9109            let e = i32::read_xdr(r)?;
9110            let v: Self = e.try_into()?;
9111            Ok(v)
9112        })
9113    }
9114}
9115
9116impl WriteXdr for ScAddressType {
9117    #[cfg(feature = "std")]
9118    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
9119        w.with_limited_depth(|w| {
9120            let i: i32 = (*self).into();
9121            i.write_xdr(w)
9122        })
9123    }
9124}
9125
9126/// ScAddress is an XDR Union defines as:
9127///
9128/// ```text
9129/// union SCAddress switch (SCAddressType type)
9130/// {
9131/// case SC_ADDRESS_TYPE_ACCOUNT:
9132///     AccountID accountId;
9133/// case SC_ADDRESS_TYPE_CONTRACT:
9134///     Hash contractId;
9135/// };
9136/// ```
9137///
9138// union with discriminant ScAddressType
9139#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
9140#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
9141#[cfg_attr(
9142    all(feature = "serde", feature = "alloc"),
9143    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
9144)]
9145#[allow(clippy::large_enum_variant)]
9146pub enum ScAddress {
9147    Account(AccountId),
9148    Contract(Hash),
9149}
9150
9151impl ScAddress {
9152    pub const VARIANTS: [ScAddressType; 2] = [ScAddressType::Account, ScAddressType::Contract];
9153    pub const VARIANTS_STR: [&'static str; 2] = ["Account", "Contract"];
9154
9155    #[must_use]
9156    pub const fn name(&self) -> &'static str {
9157        match self {
9158            Self::Account(_) => "Account",
9159            Self::Contract(_) => "Contract",
9160        }
9161    }
9162
9163    #[must_use]
9164    pub const fn discriminant(&self) -> ScAddressType {
9165        #[allow(clippy::match_same_arms)]
9166        match self {
9167            Self::Account(_) => ScAddressType::Account,
9168            Self::Contract(_) => ScAddressType::Contract,
9169        }
9170    }
9171
9172    #[must_use]
9173    pub const fn variants() -> [ScAddressType; 2] {
9174        Self::VARIANTS
9175    }
9176}
9177
9178impl Name for ScAddress {
9179    #[must_use]
9180    fn name(&self) -> &'static str {
9181        Self::name(self)
9182    }
9183}
9184
9185impl Discriminant<ScAddressType> for ScAddress {
9186    #[must_use]
9187    fn discriminant(&self) -> ScAddressType {
9188        Self::discriminant(self)
9189    }
9190}
9191
9192impl Variants<ScAddressType> for ScAddress {
9193    fn variants() -> slice::Iter<'static, ScAddressType> {
9194        Self::VARIANTS.iter()
9195    }
9196}
9197
9198impl Union<ScAddressType> for ScAddress {}
9199
9200impl ReadXdr for ScAddress {
9201    #[cfg(feature = "std")]
9202    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
9203        r.with_limited_depth(|r| {
9204            let dv: ScAddressType = <ScAddressType as ReadXdr>::read_xdr(r)?;
9205            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
9206            let v = match dv {
9207                ScAddressType::Account => Self::Account(AccountId::read_xdr(r)?),
9208                ScAddressType::Contract => Self::Contract(Hash::read_xdr(r)?),
9209                #[allow(unreachable_patterns)]
9210                _ => return Err(Error::Invalid),
9211            };
9212            Ok(v)
9213        })
9214    }
9215}
9216
9217impl WriteXdr for ScAddress {
9218    #[cfg(feature = "std")]
9219    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
9220        w.with_limited_depth(|w| {
9221            self.discriminant().write_xdr(w)?;
9222            #[allow(clippy::match_same_arms)]
9223            match self {
9224                Self::Account(v) => v.write_xdr(w)?,
9225                Self::Contract(v) => v.write_xdr(w)?,
9226            };
9227            Ok(())
9228        })
9229    }
9230}
9231
9232/// ScsymbolLimit is an XDR Const defines as:
9233///
9234/// ```text
9235/// const SCSYMBOL_LIMIT = 32;
9236/// ```
9237///
9238pub const SCSYMBOL_LIMIT: u64 = 32;
9239
9240/// ScVec is an XDR Typedef defines as:
9241///
9242/// ```text
9243/// typedef SCVal SCVec<>;
9244/// ```
9245///
9246#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
9247#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
9248#[derive(Default)]
9249#[cfg_attr(
9250    all(feature = "serde", feature = "alloc"),
9251    derive(serde::Serialize, serde::Deserialize),
9252    serde(rename_all = "snake_case")
9253)]
9254#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
9255#[derive(Debug)]
9256pub struct ScVec(pub VecM<ScVal>);
9257
9258impl From<ScVec> for VecM<ScVal> {
9259    #[must_use]
9260    fn from(x: ScVec) -> Self {
9261        x.0
9262    }
9263}
9264
9265impl From<VecM<ScVal>> for ScVec {
9266    #[must_use]
9267    fn from(x: VecM<ScVal>) -> Self {
9268        ScVec(x)
9269    }
9270}
9271
9272impl AsRef<VecM<ScVal>> for ScVec {
9273    #[must_use]
9274    fn as_ref(&self) -> &VecM<ScVal> {
9275        &self.0
9276    }
9277}
9278
9279impl ReadXdr for ScVec {
9280    #[cfg(feature = "std")]
9281    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
9282        r.with_limited_depth(|r| {
9283            let i = VecM::<ScVal>::read_xdr(r)?;
9284            let v = ScVec(i);
9285            Ok(v)
9286        })
9287    }
9288}
9289
9290impl WriteXdr for ScVec {
9291    #[cfg(feature = "std")]
9292    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
9293        w.with_limited_depth(|w| self.0.write_xdr(w))
9294    }
9295}
9296
9297impl Deref for ScVec {
9298    type Target = VecM<ScVal>;
9299    fn deref(&self) -> &Self::Target {
9300        &self.0
9301    }
9302}
9303
9304impl From<ScVec> for Vec<ScVal> {
9305    #[must_use]
9306    fn from(x: ScVec) -> Self {
9307        x.0 .0
9308    }
9309}
9310
9311impl TryFrom<Vec<ScVal>> for ScVec {
9312    type Error = Error;
9313    fn try_from(x: Vec<ScVal>) -> Result<Self> {
9314        Ok(ScVec(x.try_into()?))
9315    }
9316}
9317
9318#[cfg(feature = "alloc")]
9319impl TryFrom<&Vec<ScVal>> for ScVec {
9320    type Error = Error;
9321    fn try_from(x: &Vec<ScVal>) -> Result<Self> {
9322        Ok(ScVec(x.try_into()?))
9323    }
9324}
9325
9326impl AsRef<Vec<ScVal>> for ScVec {
9327    #[must_use]
9328    fn as_ref(&self) -> &Vec<ScVal> {
9329        &self.0 .0
9330    }
9331}
9332
9333impl AsRef<[ScVal]> for ScVec {
9334    #[cfg(feature = "alloc")]
9335    #[must_use]
9336    fn as_ref(&self) -> &[ScVal] {
9337        &self.0 .0
9338    }
9339    #[cfg(not(feature = "alloc"))]
9340    #[must_use]
9341    fn as_ref(&self) -> &[ScVal] {
9342        self.0 .0
9343    }
9344}
9345
9346/// ScMap is an XDR Typedef defines as:
9347///
9348/// ```text
9349/// typedef SCMapEntry SCMap<>;
9350/// ```
9351///
9352#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
9353#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
9354#[derive(Default)]
9355#[cfg_attr(
9356    all(feature = "serde", feature = "alloc"),
9357    derive(serde::Serialize, serde::Deserialize),
9358    serde(rename_all = "snake_case")
9359)]
9360#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
9361#[derive(Debug)]
9362pub struct ScMap(pub VecM<ScMapEntry>);
9363
9364impl From<ScMap> for VecM<ScMapEntry> {
9365    #[must_use]
9366    fn from(x: ScMap) -> Self {
9367        x.0
9368    }
9369}
9370
9371impl From<VecM<ScMapEntry>> for ScMap {
9372    #[must_use]
9373    fn from(x: VecM<ScMapEntry>) -> Self {
9374        ScMap(x)
9375    }
9376}
9377
9378impl AsRef<VecM<ScMapEntry>> for ScMap {
9379    #[must_use]
9380    fn as_ref(&self) -> &VecM<ScMapEntry> {
9381        &self.0
9382    }
9383}
9384
9385impl ReadXdr for ScMap {
9386    #[cfg(feature = "std")]
9387    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
9388        r.with_limited_depth(|r| {
9389            let i = VecM::<ScMapEntry>::read_xdr(r)?;
9390            let v = ScMap(i);
9391            Ok(v)
9392        })
9393    }
9394}
9395
9396impl WriteXdr for ScMap {
9397    #[cfg(feature = "std")]
9398    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
9399        w.with_limited_depth(|w| self.0.write_xdr(w))
9400    }
9401}
9402
9403impl Deref for ScMap {
9404    type Target = VecM<ScMapEntry>;
9405    fn deref(&self) -> &Self::Target {
9406        &self.0
9407    }
9408}
9409
9410impl From<ScMap> for Vec<ScMapEntry> {
9411    #[must_use]
9412    fn from(x: ScMap) -> Self {
9413        x.0 .0
9414    }
9415}
9416
9417impl TryFrom<Vec<ScMapEntry>> for ScMap {
9418    type Error = Error;
9419    fn try_from(x: Vec<ScMapEntry>) -> Result<Self> {
9420        Ok(ScMap(x.try_into()?))
9421    }
9422}
9423
9424#[cfg(feature = "alloc")]
9425impl TryFrom<&Vec<ScMapEntry>> for ScMap {
9426    type Error = Error;
9427    fn try_from(x: &Vec<ScMapEntry>) -> Result<Self> {
9428        Ok(ScMap(x.try_into()?))
9429    }
9430}
9431
9432impl AsRef<Vec<ScMapEntry>> for ScMap {
9433    #[must_use]
9434    fn as_ref(&self) -> &Vec<ScMapEntry> {
9435        &self.0 .0
9436    }
9437}
9438
9439impl AsRef<[ScMapEntry]> for ScMap {
9440    #[cfg(feature = "alloc")]
9441    #[must_use]
9442    fn as_ref(&self) -> &[ScMapEntry] {
9443        &self.0 .0
9444    }
9445    #[cfg(not(feature = "alloc"))]
9446    #[must_use]
9447    fn as_ref(&self) -> &[ScMapEntry] {
9448        self.0 .0
9449    }
9450}
9451
9452/// ScBytes is an XDR Typedef defines as:
9453///
9454/// ```text
9455/// typedef opaque SCBytes<>;
9456/// ```
9457///
9458#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
9459#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
9460#[derive(Default)]
9461#[cfg_attr(
9462    all(feature = "serde", feature = "alloc"),
9463    derive(serde::Serialize, serde::Deserialize),
9464    serde(rename_all = "snake_case")
9465)]
9466#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
9467#[derive(Debug)]
9468pub struct ScBytes(pub BytesM);
9469
9470impl From<ScBytes> for BytesM {
9471    #[must_use]
9472    fn from(x: ScBytes) -> Self {
9473        x.0
9474    }
9475}
9476
9477impl From<BytesM> for ScBytes {
9478    #[must_use]
9479    fn from(x: BytesM) -> Self {
9480        ScBytes(x)
9481    }
9482}
9483
9484impl AsRef<BytesM> for ScBytes {
9485    #[must_use]
9486    fn as_ref(&self) -> &BytesM {
9487        &self.0
9488    }
9489}
9490
9491impl ReadXdr for ScBytes {
9492    #[cfg(feature = "std")]
9493    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
9494        r.with_limited_depth(|r| {
9495            let i = BytesM::read_xdr(r)?;
9496            let v = ScBytes(i);
9497            Ok(v)
9498        })
9499    }
9500}
9501
9502impl WriteXdr for ScBytes {
9503    #[cfg(feature = "std")]
9504    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
9505        w.with_limited_depth(|w| self.0.write_xdr(w))
9506    }
9507}
9508
9509impl Deref for ScBytes {
9510    type Target = BytesM;
9511    fn deref(&self) -> &Self::Target {
9512        &self.0
9513    }
9514}
9515
9516impl From<ScBytes> for Vec<u8> {
9517    #[must_use]
9518    fn from(x: ScBytes) -> Self {
9519        x.0 .0
9520    }
9521}
9522
9523impl TryFrom<Vec<u8>> for ScBytes {
9524    type Error = Error;
9525    fn try_from(x: Vec<u8>) -> Result<Self> {
9526        Ok(ScBytes(x.try_into()?))
9527    }
9528}
9529
9530#[cfg(feature = "alloc")]
9531impl TryFrom<&Vec<u8>> for ScBytes {
9532    type Error = Error;
9533    fn try_from(x: &Vec<u8>) -> Result<Self> {
9534        Ok(ScBytes(x.try_into()?))
9535    }
9536}
9537
9538impl AsRef<Vec<u8>> for ScBytes {
9539    #[must_use]
9540    fn as_ref(&self) -> &Vec<u8> {
9541        &self.0 .0
9542    }
9543}
9544
9545impl AsRef<[u8]> for ScBytes {
9546    #[cfg(feature = "alloc")]
9547    #[must_use]
9548    fn as_ref(&self) -> &[u8] {
9549        &self.0 .0
9550    }
9551    #[cfg(not(feature = "alloc"))]
9552    #[must_use]
9553    fn as_ref(&self) -> &[u8] {
9554        self.0 .0
9555    }
9556}
9557
9558/// ScString is an XDR Typedef defines as:
9559///
9560/// ```text
9561/// typedef string SCString<>;
9562/// ```
9563///
9564#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
9565#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
9566#[derive(Default)]
9567#[cfg_attr(
9568    all(feature = "serde", feature = "alloc"),
9569    derive(serde::Serialize, serde::Deserialize),
9570    serde(rename_all = "snake_case")
9571)]
9572#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
9573#[derive(Debug)]
9574pub struct ScString(pub StringM);
9575
9576impl From<ScString> for StringM {
9577    #[must_use]
9578    fn from(x: ScString) -> Self {
9579        x.0
9580    }
9581}
9582
9583impl From<StringM> for ScString {
9584    #[must_use]
9585    fn from(x: StringM) -> Self {
9586        ScString(x)
9587    }
9588}
9589
9590impl AsRef<StringM> for ScString {
9591    #[must_use]
9592    fn as_ref(&self) -> &StringM {
9593        &self.0
9594    }
9595}
9596
9597impl ReadXdr for ScString {
9598    #[cfg(feature = "std")]
9599    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
9600        r.with_limited_depth(|r| {
9601            let i = StringM::read_xdr(r)?;
9602            let v = ScString(i);
9603            Ok(v)
9604        })
9605    }
9606}
9607
9608impl WriteXdr for ScString {
9609    #[cfg(feature = "std")]
9610    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
9611        w.with_limited_depth(|w| self.0.write_xdr(w))
9612    }
9613}
9614
9615impl Deref for ScString {
9616    type Target = StringM;
9617    fn deref(&self) -> &Self::Target {
9618        &self.0
9619    }
9620}
9621
9622impl From<ScString> for Vec<u8> {
9623    #[must_use]
9624    fn from(x: ScString) -> Self {
9625        x.0 .0
9626    }
9627}
9628
9629impl TryFrom<Vec<u8>> for ScString {
9630    type Error = Error;
9631    fn try_from(x: Vec<u8>) -> Result<Self> {
9632        Ok(ScString(x.try_into()?))
9633    }
9634}
9635
9636#[cfg(feature = "alloc")]
9637impl TryFrom<&Vec<u8>> for ScString {
9638    type Error = Error;
9639    fn try_from(x: &Vec<u8>) -> Result<Self> {
9640        Ok(ScString(x.try_into()?))
9641    }
9642}
9643
9644impl AsRef<Vec<u8>> for ScString {
9645    #[must_use]
9646    fn as_ref(&self) -> &Vec<u8> {
9647        &self.0 .0
9648    }
9649}
9650
9651impl AsRef<[u8]> for ScString {
9652    #[cfg(feature = "alloc")]
9653    #[must_use]
9654    fn as_ref(&self) -> &[u8] {
9655        &self.0 .0
9656    }
9657    #[cfg(not(feature = "alloc"))]
9658    #[must_use]
9659    fn as_ref(&self) -> &[u8] {
9660        self.0 .0
9661    }
9662}
9663
9664/// ScSymbol is an XDR Typedef defines as:
9665///
9666/// ```text
9667/// typedef string SCSymbol<SCSYMBOL_LIMIT>;
9668/// ```
9669///
9670#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
9671#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
9672#[derive(Default)]
9673#[cfg_attr(
9674    all(feature = "serde", feature = "alloc"),
9675    derive(serde::Serialize, serde::Deserialize),
9676    serde(rename_all = "snake_case")
9677)]
9678#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
9679#[derive(Debug)]
9680pub struct ScSymbol(pub StringM<32>);
9681
9682impl From<ScSymbol> for StringM<32> {
9683    #[must_use]
9684    fn from(x: ScSymbol) -> Self {
9685        x.0
9686    }
9687}
9688
9689impl From<StringM<32>> for ScSymbol {
9690    #[must_use]
9691    fn from(x: StringM<32>) -> Self {
9692        ScSymbol(x)
9693    }
9694}
9695
9696impl AsRef<StringM<32>> for ScSymbol {
9697    #[must_use]
9698    fn as_ref(&self) -> &StringM<32> {
9699        &self.0
9700    }
9701}
9702
9703impl ReadXdr for ScSymbol {
9704    #[cfg(feature = "std")]
9705    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
9706        r.with_limited_depth(|r| {
9707            let i = StringM::<32>::read_xdr(r)?;
9708            let v = ScSymbol(i);
9709            Ok(v)
9710        })
9711    }
9712}
9713
9714impl WriteXdr for ScSymbol {
9715    #[cfg(feature = "std")]
9716    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
9717        w.with_limited_depth(|w| self.0.write_xdr(w))
9718    }
9719}
9720
9721impl Deref for ScSymbol {
9722    type Target = StringM<32>;
9723    fn deref(&self) -> &Self::Target {
9724        &self.0
9725    }
9726}
9727
9728impl From<ScSymbol> for Vec<u8> {
9729    #[must_use]
9730    fn from(x: ScSymbol) -> Self {
9731        x.0 .0
9732    }
9733}
9734
9735impl TryFrom<Vec<u8>> for ScSymbol {
9736    type Error = Error;
9737    fn try_from(x: Vec<u8>) -> Result<Self> {
9738        Ok(ScSymbol(x.try_into()?))
9739    }
9740}
9741
9742#[cfg(feature = "alloc")]
9743impl TryFrom<&Vec<u8>> for ScSymbol {
9744    type Error = Error;
9745    fn try_from(x: &Vec<u8>) -> Result<Self> {
9746        Ok(ScSymbol(x.try_into()?))
9747    }
9748}
9749
9750impl AsRef<Vec<u8>> for ScSymbol {
9751    #[must_use]
9752    fn as_ref(&self) -> &Vec<u8> {
9753        &self.0 .0
9754    }
9755}
9756
9757impl AsRef<[u8]> for ScSymbol {
9758    #[cfg(feature = "alloc")]
9759    #[must_use]
9760    fn as_ref(&self) -> &[u8] {
9761        &self.0 .0
9762    }
9763    #[cfg(not(feature = "alloc"))]
9764    #[must_use]
9765    fn as_ref(&self) -> &[u8] {
9766        self.0 .0
9767    }
9768}
9769
9770/// ScNonceKey is an XDR Struct defines as:
9771///
9772/// ```text
9773/// struct SCNonceKey {
9774///     int64 nonce;
9775/// };
9776/// ```
9777///
9778#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
9779#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
9780#[cfg_attr(
9781    all(feature = "serde", feature = "alloc"),
9782    derive(serde::Serialize, serde::Deserialize),
9783    serde(rename_all = "snake_case")
9784)]
9785#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
9786pub struct ScNonceKey {
9787    pub nonce: i64,
9788}
9789
9790impl ReadXdr for ScNonceKey {
9791    #[cfg(feature = "std")]
9792    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
9793        r.with_limited_depth(|r| {
9794            Ok(Self {
9795                nonce: i64::read_xdr(r)?,
9796            })
9797        })
9798    }
9799}
9800
9801impl WriteXdr for ScNonceKey {
9802    #[cfg(feature = "std")]
9803    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
9804        w.with_limited_depth(|w| {
9805            self.nonce.write_xdr(w)?;
9806            Ok(())
9807        })
9808    }
9809}
9810
9811/// ScContractInstance is an XDR Struct defines as:
9812///
9813/// ```text
9814/// struct SCContractInstance {
9815///     ContractExecutable executable;
9816///     SCMap* storage;
9817/// };
9818/// ```
9819///
9820#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
9821#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
9822#[cfg_attr(
9823    all(feature = "serde", feature = "alloc"),
9824    derive(serde::Serialize, serde::Deserialize),
9825    serde(rename_all = "snake_case")
9826)]
9827#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
9828pub struct ScContractInstance {
9829    pub executable: ContractExecutable,
9830    pub storage: Option<ScMap>,
9831}
9832
9833impl ReadXdr for ScContractInstance {
9834    #[cfg(feature = "std")]
9835    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
9836        r.with_limited_depth(|r| {
9837            Ok(Self {
9838                executable: ContractExecutable::read_xdr(r)?,
9839                storage: Option::<ScMap>::read_xdr(r)?,
9840            })
9841        })
9842    }
9843}
9844
9845impl WriteXdr for ScContractInstance {
9846    #[cfg(feature = "std")]
9847    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
9848        w.with_limited_depth(|w| {
9849            self.executable.write_xdr(w)?;
9850            self.storage.write_xdr(w)?;
9851            Ok(())
9852        })
9853    }
9854}
9855
9856/// ScVal is an XDR Union defines as:
9857///
9858/// ```text
9859/// union SCVal switch (SCValType type)
9860/// {
9861///
9862/// case SCV_BOOL:
9863///     bool b;
9864/// case SCV_VOID:
9865///     void;
9866/// case SCV_ERROR:
9867///     SCError error;
9868///
9869/// case SCV_U32:
9870///     uint32 u32;
9871/// case SCV_I32:
9872///     int32 i32;
9873///
9874/// case SCV_U64:
9875///     uint64 u64;
9876/// case SCV_I64:
9877///     int64 i64;
9878/// case SCV_TIMEPOINT:
9879///     TimePoint timepoint;
9880/// case SCV_DURATION:
9881///     Duration duration;
9882///
9883/// case SCV_U128:
9884///     UInt128Parts u128;
9885/// case SCV_I128:
9886///     Int128Parts i128;
9887///
9888/// case SCV_U256:
9889///     UInt256Parts u256;
9890/// case SCV_I256:
9891///     Int256Parts i256;
9892///
9893/// case SCV_BYTES:
9894///     SCBytes bytes;
9895/// case SCV_STRING:
9896///     SCString str;
9897/// case SCV_SYMBOL:
9898///     SCSymbol sym;
9899///
9900/// // Vec and Map are recursive so need to live
9901/// // behind an option, due to xdrpp limitations.
9902/// case SCV_VEC:
9903///     SCVec *vec;
9904/// case SCV_MAP:
9905///     SCMap *map;
9906///
9907/// case SCV_ADDRESS:
9908///     SCAddress address;
9909///
9910/// // Special SCVals reserved for system-constructed contract-data
9911/// // ledger keys, not generally usable elsewhere.
9912/// case SCV_LEDGER_KEY_CONTRACT_INSTANCE:
9913///     void;
9914/// case SCV_LEDGER_KEY_NONCE:
9915///     SCNonceKey nonce_key;
9916///
9917/// case SCV_CONTRACT_INSTANCE:
9918///     SCContractInstance instance;
9919/// };
9920/// ```
9921///
9922// union with discriminant ScValType
9923#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
9924#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
9925#[cfg_attr(
9926    all(feature = "serde", feature = "alloc"),
9927    derive(serde::Serialize, serde::Deserialize),
9928    serde(rename_all = "snake_case")
9929)]
9930#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
9931#[allow(clippy::large_enum_variant)]
9932pub enum ScVal {
9933    Bool(bool),
9934    Void,
9935    Error(ScError),
9936    U32(u32),
9937    I32(i32),
9938    U64(u64),
9939    I64(i64),
9940    Timepoint(TimePoint),
9941    Duration(Duration),
9942    U128(UInt128Parts),
9943    I128(Int128Parts),
9944    U256(UInt256Parts),
9945    I256(Int256Parts),
9946    Bytes(ScBytes),
9947    String(ScString),
9948    Symbol(ScSymbol),
9949    Vec(Option<ScVec>),
9950    Map(Option<ScMap>),
9951    Address(ScAddress),
9952    LedgerKeyContractInstance,
9953    LedgerKeyNonce(ScNonceKey),
9954    ContractInstance(ScContractInstance),
9955}
9956
9957impl ScVal {
9958    pub const VARIANTS: [ScValType; 22] = [
9959        ScValType::Bool,
9960        ScValType::Void,
9961        ScValType::Error,
9962        ScValType::U32,
9963        ScValType::I32,
9964        ScValType::U64,
9965        ScValType::I64,
9966        ScValType::Timepoint,
9967        ScValType::Duration,
9968        ScValType::U128,
9969        ScValType::I128,
9970        ScValType::U256,
9971        ScValType::I256,
9972        ScValType::Bytes,
9973        ScValType::String,
9974        ScValType::Symbol,
9975        ScValType::Vec,
9976        ScValType::Map,
9977        ScValType::Address,
9978        ScValType::LedgerKeyContractInstance,
9979        ScValType::LedgerKeyNonce,
9980        ScValType::ContractInstance,
9981    ];
9982    pub const VARIANTS_STR: [&'static str; 22] = [
9983        "Bool",
9984        "Void",
9985        "Error",
9986        "U32",
9987        "I32",
9988        "U64",
9989        "I64",
9990        "Timepoint",
9991        "Duration",
9992        "U128",
9993        "I128",
9994        "U256",
9995        "I256",
9996        "Bytes",
9997        "String",
9998        "Symbol",
9999        "Vec",
10000        "Map",
10001        "Address",
10002        "LedgerKeyContractInstance",
10003        "LedgerKeyNonce",
10004        "ContractInstance",
10005    ];
10006
10007    #[must_use]
10008    pub const fn name(&self) -> &'static str {
10009        match self {
10010            Self::Bool(_) => "Bool",
10011            Self::Void => "Void",
10012            Self::Error(_) => "Error",
10013            Self::U32(_) => "U32",
10014            Self::I32(_) => "I32",
10015            Self::U64(_) => "U64",
10016            Self::I64(_) => "I64",
10017            Self::Timepoint(_) => "Timepoint",
10018            Self::Duration(_) => "Duration",
10019            Self::U128(_) => "U128",
10020            Self::I128(_) => "I128",
10021            Self::U256(_) => "U256",
10022            Self::I256(_) => "I256",
10023            Self::Bytes(_) => "Bytes",
10024            Self::String(_) => "String",
10025            Self::Symbol(_) => "Symbol",
10026            Self::Vec(_) => "Vec",
10027            Self::Map(_) => "Map",
10028            Self::Address(_) => "Address",
10029            Self::LedgerKeyContractInstance => "LedgerKeyContractInstance",
10030            Self::LedgerKeyNonce(_) => "LedgerKeyNonce",
10031            Self::ContractInstance(_) => "ContractInstance",
10032        }
10033    }
10034
10035    #[must_use]
10036    pub const fn discriminant(&self) -> ScValType {
10037        #[allow(clippy::match_same_arms)]
10038        match self {
10039            Self::Bool(_) => ScValType::Bool,
10040            Self::Void => ScValType::Void,
10041            Self::Error(_) => ScValType::Error,
10042            Self::U32(_) => ScValType::U32,
10043            Self::I32(_) => ScValType::I32,
10044            Self::U64(_) => ScValType::U64,
10045            Self::I64(_) => ScValType::I64,
10046            Self::Timepoint(_) => ScValType::Timepoint,
10047            Self::Duration(_) => ScValType::Duration,
10048            Self::U128(_) => ScValType::U128,
10049            Self::I128(_) => ScValType::I128,
10050            Self::U256(_) => ScValType::U256,
10051            Self::I256(_) => ScValType::I256,
10052            Self::Bytes(_) => ScValType::Bytes,
10053            Self::String(_) => ScValType::String,
10054            Self::Symbol(_) => ScValType::Symbol,
10055            Self::Vec(_) => ScValType::Vec,
10056            Self::Map(_) => ScValType::Map,
10057            Self::Address(_) => ScValType::Address,
10058            Self::LedgerKeyContractInstance => ScValType::LedgerKeyContractInstance,
10059            Self::LedgerKeyNonce(_) => ScValType::LedgerKeyNonce,
10060            Self::ContractInstance(_) => ScValType::ContractInstance,
10061        }
10062    }
10063
10064    #[must_use]
10065    pub const fn variants() -> [ScValType; 22] {
10066        Self::VARIANTS
10067    }
10068}
10069
10070impl Name for ScVal {
10071    #[must_use]
10072    fn name(&self) -> &'static str {
10073        Self::name(self)
10074    }
10075}
10076
10077impl Discriminant<ScValType> for ScVal {
10078    #[must_use]
10079    fn discriminant(&self) -> ScValType {
10080        Self::discriminant(self)
10081    }
10082}
10083
10084impl Variants<ScValType> for ScVal {
10085    fn variants() -> slice::Iter<'static, ScValType> {
10086        Self::VARIANTS.iter()
10087    }
10088}
10089
10090impl Union<ScValType> for ScVal {}
10091
10092impl ReadXdr for ScVal {
10093    #[cfg(feature = "std")]
10094    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
10095        r.with_limited_depth(|r| {
10096            let dv: ScValType = <ScValType as ReadXdr>::read_xdr(r)?;
10097            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
10098            let v = match dv {
10099                ScValType::Bool => Self::Bool(bool::read_xdr(r)?),
10100                ScValType::Void => Self::Void,
10101                ScValType::Error => Self::Error(ScError::read_xdr(r)?),
10102                ScValType::U32 => Self::U32(u32::read_xdr(r)?),
10103                ScValType::I32 => Self::I32(i32::read_xdr(r)?),
10104                ScValType::U64 => Self::U64(u64::read_xdr(r)?),
10105                ScValType::I64 => Self::I64(i64::read_xdr(r)?),
10106                ScValType::Timepoint => Self::Timepoint(TimePoint::read_xdr(r)?),
10107                ScValType::Duration => Self::Duration(Duration::read_xdr(r)?),
10108                ScValType::U128 => Self::U128(UInt128Parts::read_xdr(r)?),
10109                ScValType::I128 => Self::I128(Int128Parts::read_xdr(r)?),
10110                ScValType::U256 => Self::U256(UInt256Parts::read_xdr(r)?),
10111                ScValType::I256 => Self::I256(Int256Parts::read_xdr(r)?),
10112                ScValType::Bytes => Self::Bytes(ScBytes::read_xdr(r)?),
10113                ScValType::String => Self::String(ScString::read_xdr(r)?),
10114                ScValType::Symbol => Self::Symbol(ScSymbol::read_xdr(r)?),
10115                ScValType::Vec => Self::Vec(Option::<ScVec>::read_xdr(r)?),
10116                ScValType::Map => Self::Map(Option::<ScMap>::read_xdr(r)?),
10117                ScValType::Address => Self::Address(ScAddress::read_xdr(r)?),
10118                ScValType::LedgerKeyContractInstance => Self::LedgerKeyContractInstance,
10119                ScValType::LedgerKeyNonce => Self::LedgerKeyNonce(ScNonceKey::read_xdr(r)?),
10120                ScValType::ContractInstance => {
10121                    Self::ContractInstance(ScContractInstance::read_xdr(r)?)
10122                }
10123                #[allow(unreachable_patterns)]
10124                _ => return Err(Error::Invalid),
10125            };
10126            Ok(v)
10127        })
10128    }
10129}
10130
10131impl WriteXdr for ScVal {
10132    #[cfg(feature = "std")]
10133    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
10134        w.with_limited_depth(|w| {
10135            self.discriminant().write_xdr(w)?;
10136            #[allow(clippy::match_same_arms)]
10137            match self {
10138                Self::Bool(v) => v.write_xdr(w)?,
10139                Self::Void => ().write_xdr(w)?,
10140                Self::Error(v) => v.write_xdr(w)?,
10141                Self::U32(v) => v.write_xdr(w)?,
10142                Self::I32(v) => v.write_xdr(w)?,
10143                Self::U64(v) => v.write_xdr(w)?,
10144                Self::I64(v) => v.write_xdr(w)?,
10145                Self::Timepoint(v) => v.write_xdr(w)?,
10146                Self::Duration(v) => v.write_xdr(w)?,
10147                Self::U128(v) => v.write_xdr(w)?,
10148                Self::I128(v) => v.write_xdr(w)?,
10149                Self::U256(v) => v.write_xdr(w)?,
10150                Self::I256(v) => v.write_xdr(w)?,
10151                Self::Bytes(v) => v.write_xdr(w)?,
10152                Self::String(v) => v.write_xdr(w)?,
10153                Self::Symbol(v) => v.write_xdr(w)?,
10154                Self::Vec(v) => v.write_xdr(w)?,
10155                Self::Map(v) => v.write_xdr(w)?,
10156                Self::Address(v) => v.write_xdr(w)?,
10157                Self::LedgerKeyContractInstance => ().write_xdr(w)?,
10158                Self::LedgerKeyNonce(v) => v.write_xdr(w)?,
10159                Self::ContractInstance(v) => v.write_xdr(w)?,
10160            };
10161            Ok(())
10162        })
10163    }
10164}
10165
10166/// ScMapEntry is an XDR Struct defines as:
10167///
10168/// ```text
10169/// struct SCMapEntry
10170/// {
10171///     SCVal key;
10172///     SCVal val;
10173/// };
10174/// ```
10175///
10176#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
10177#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
10178#[cfg_attr(
10179    all(feature = "serde", feature = "alloc"),
10180    derive(serde::Serialize, serde::Deserialize),
10181    serde(rename_all = "snake_case")
10182)]
10183#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
10184pub struct ScMapEntry {
10185    pub key: ScVal,
10186    pub val: ScVal,
10187}
10188
10189impl ReadXdr for ScMapEntry {
10190    #[cfg(feature = "std")]
10191    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
10192        r.with_limited_depth(|r| {
10193            Ok(Self {
10194                key: ScVal::read_xdr(r)?,
10195                val: ScVal::read_xdr(r)?,
10196            })
10197        })
10198    }
10199}
10200
10201impl WriteXdr for ScMapEntry {
10202    #[cfg(feature = "std")]
10203    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
10204        w.with_limited_depth(|w| {
10205            self.key.write_xdr(w)?;
10206            self.val.write_xdr(w)?;
10207            Ok(())
10208        })
10209    }
10210}
10211
10212/// StoredTransactionSet is an XDR Union defines as:
10213///
10214/// ```text
10215/// union StoredTransactionSet switch (int v)
10216/// {
10217/// case 0:
10218/// 	TransactionSet txSet;
10219/// case 1:
10220/// 	GeneralizedTransactionSet generalizedTxSet;
10221/// };
10222/// ```
10223///
10224// union with discriminant i32
10225#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
10226#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
10227#[cfg_attr(
10228    all(feature = "serde", feature = "alloc"),
10229    derive(serde::Serialize, serde::Deserialize),
10230    serde(rename_all = "snake_case")
10231)]
10232#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
10233#[allow(clippy::large_enum_variant)]
10234pub enum StoredTransactionSet {
10235    V0(TransactionSet),
10236    V1(GeneralizedTransactionSet),
10237}
10238
10239impl StoredTransactionSet {
10240    pub const VARIANTS: [i32; 2] = [0, 1];
10241    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"];
10242
10243    #[must_use]
10244    pub const fn name(&self) -> &'static str {
10245        match self {
10246            Self::V0(_) => "V0",
10247            Self::V1(_) => "V1",
10248        }
10249    }
10250
10251    #[must_use]
10252    pub const fn discriminant(&self) -> i32 {
10253        #[allow(clippy::match_same_arms)]
10254        match self {
10255            Self::V0(_) => 0,
10256            Self::V1(_) => 1,
10257        }
10258    }
10259
10260    #[must_use]
10261    pub const fn variants() -> [i32; 2] {
10262        Self::VARIANTS
10263    }
10264}
10265
10266impl Name for StoredTransactionSet {
10267    #[must_use]
10268    fn name(&self) -> &'static str {
10269        Self::name(self)
10270    }
10271}
10272
10273impl Discriminant<i32> for StoredTransactionSet {
10274    #[must_use]
10275    fn discriminant(&self) -> i32 {
10276        Self::discriminant(self)
10277    }
10278}
10279
10280impl Variants<i32> for StoredTransactionSet {
10281    fn variants() -> slice::Iter<'static, i32> {
10282        Self::VARIANTS.iter()
10283    }
10284}
10285
10286impl Union<i32> for StoredTransactionSet {}
10287
10288impl ReadXdr for StoredTransactionSet {
10289    #[cfg(feature = "std")]
10290    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
10291        r.with_limited_depth(|r| {
10292            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
10293            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
10294            let v = match dv {
10295                0 => Self::V0(TransactionSet::read_xdr(r)?),
10296                1 => Self::V1(GeneralizedTransactionSet::read_xdr(r)?),
10297                #[allow(unreachable_patterns)]
10298                _ => return Err(Error::Invalid),
10299            };
10300            Ok(v)
10301        })
10302    }
10303}
10304
10305impl WriteXdr for StoredTransactionSet {
10306    #[cfg(feature = "std")]
10307    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
10308        w.with_limited_depth(|w| {
10309            self.discriminant().write_xdr(w)?;
10310            #[allow(clippy::match_same_arms)]
10311            match self {
10312                Self::V0(v) => v.write_xdr(w)?,
10313                Self::V1(v) => v.write_xdr(w)?,
10314            };
10315            Ok(())
10316        })
10317    }
10318}
10319
10320/// StoredDebugTransactionSet is an XDR Struct defines as:
10321///
10322/// ```text
10323/// struct StoredDebugTransactionSet
10324/// {
10325/// 	StoredTransactionSet txSet;
10326/// 	uint32 ledgerSeq;
10327/// 	StellarValue scpValue;
10328/// };
10329/// ```
10330///
10331#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
10332#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
10333#[cfg_attr(
10334    all(feature = "serde", feature = "alloc"),
10335    derive(serde::Serialize, serde::Deserialize),
10336    serde(rename_all = "snake_case")
10337)]
10338#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
10339pub struct StoredDebugTransactionSet {
10340    pub tx_set: StoredTransactionSet,
10341    pub ledger_seq: u32,
10342    pub scp_value: StellarValue,
10343}
10344
10345impl ReadXdr for StoredDebugTransactionSet {
10346    #[cfg(feature = "std")]
10347    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
10348        r.with_limited_depth(|r| {
10349            Ok(Self {
10350                tx_set: StoredTransactionSet::read_xdr(r)?,
10351                ledger_seq: u32::read_xdr(r)?,
10352                scp_value: StellarValue::read_xdr(r)?,
10353            })
10354        })
10355    }
10356}
10357
10358impl WriteXdr for StoredDebugTransactionSet {
10359    #[cfg(feature = "std")]
10360    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
10361        w.with_limited_depth(|w| {
10362            self.tx_set.write_xdr(w)?;
10363            self.ledger_seq.write_xdr(w)?;
10364            self.scp_value.write_xdr(w)?;
10365            Ok(())
10366        })
10367    }
10368}
10369
10370/// PersistedScpStateV0 is an XDR Struct defines as:
10371///
10372/// ```text
10373/// struct PersistedSCPStateV0
10374/// {
10375/// 	SCPEnvelope scpEnvelopes<>;
10376/// 	SCPQuorumSet quorumSets<>;
10377/// 	StoredTransactionSet txSets<>;
10378/// };
10379/// ```
10380///
10381#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
10382#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
10383#[cfg_attr(
10384    all(feature = "serde", feature = "alloc"),
10385    derive(serde::Serialize, serde::Deserialize),
10386    serde(rename_all = "snake_case")
10387)]
10388#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
10389pub struct PersistedScpStateV0 {
10390    pub scp_envelopes: VecM<ScpEnvelope>,
10391    pub quorum_sets: VecM<ScpQuorumSet>,
10392    pub tx_sets: VecM<StoredTransactionSet>,
10393}
10394
10395impl ReadXdr for PersistedScpStateV0 {
10396    #[cfg(feature = "std")]
10397    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
10398        r.with_limited_depth(|r| {
10399            Ok(Self {
10400                scp_envelopes: VecM::<ScpEnvelope>::read_xdr(r)?,
10401                quorum_sets: VecM::<ScpQuorumSet>::read_xdr(r)?,
10402                tx_sets: VecM::<StoredTransactionSet>::read_xdr(r)?,
10403            })
10404        })
10405    }
10406}
10407
10408impl WriteXdr for PersistedScpStateV0 {
10409    #[cfg(feature = "std")]
10410    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
10411        w.with_limited_depth(|w| {
10412            self.scp_envelopes.write_xdr(w)?;
10413            self.quorum_sets.write_xdr(w)?;
10414            self.tx_sets.write_xdr(w)?;
10415            Ok(())
10416        })
10417    }
10418}
10419
10420/// PersistedScpStateV1 is an XDR Struct defines as:
10421///
10422/// ```text
10423/// struct PersistedSCPStateV1
10424/// {
10425/// 	// Tx sets are saved separately
10426/// 	SCPEnvelope scpEnvelopes<>;
10427/// 	SCPQuorumSet quorumSets<>;
10428/// };
10429/// ```
10430///
10431#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
10432#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
10433#[cfg_attr(
10434    all(feature = "serde", feature = "alloc"),
10435    derive(serde::Serialize, serde::Deserialize),
10436    serde(rename_all = "snake_case")
10437)]
10438#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
10439pub struct PersistedScpStateV1 {
10440    pub scp_envelopes: VecM<ScpEnvelope>,
10441    pub quorum_sets: VecM<ScpQuorumSet>,
10442}
10443
10444impl ReadXdr for PersistedScpStateV1 {
10445    #[cfg(feature = "std")]
10446    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
10447        r.with_limited_depth(|r| {
10448            Ok(Self {
10449                scp_envelopes: VecM::<ScpEnvelope>::read_xdr(r)?,
10450                quorum_sets: VecM::<ScpQuorumSet>::read_xdr(r)?,
10451            })
10452        })
10453    }
10454}
10455
10456impl WriteXdr for PersistedScpStateV1 {
10457    #[cfg(feature = "std")]
10458    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
10459        w.with_limited_depth(|w| {
10460            self.scp_envelopes.write_xdr(w)?;
10461            self.quorum_sets.write_xdr(w)?;
10462            Ok(())
10463        })
10464    }
10465}
10466
10467/// PersistedScpState is an XDR Union defines as:
10468///
10469/// ```text
10470/// union PersistedSCPState switch (int v)
10471/// {
10472/// case 0:
10473/// 	PersistedSCPStateV0 v0;
10474/// case 1:
10475/// 	PersistedSCPStateV1 v1;
10476/// };
10477/// ```
10478///
10479// union with discriminant i32
10480#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
10481#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
10482#[cfg_attr(
10483    all(feature = "serde", feature = "alloc"),
10484    derive(serde::Serialize, serde::Deserialize),
10485    serde(rename_all = "snake_case")
10486)]
10487#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
10488#[allow(clippy::large_enum_variant)]
10489pub enum PersistedScpState {
10490    V0(PersistedScpStateV0),
10491    V1(PersistedScpStateV1),
10492}
10493
10494impl PersistedScpState {
10495    pub const VARIANTS: [i32; 2] = [0, 1];
10496    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"];
10497
10498    #[must_use]
10499    pub const fn name(&self) -> &'static str {
10500        match self {
10501            Self::V0(_) => "V0",
10502            Self::V1(_) => "V1",
10503        }
10504    }
10505
10506    #[must_use]
10507    pub const fn discriminant(&self) -> i32 {
10508        #[allow(clippy::match_same_arms)]
10509        match self {
10510            Self::V0(_) => 0,
10511            Self::V1(_) => 1,
10512        }
10513    }
10514
10515    #[must_use]
10516    pub const fn variants() -> [i32; 2] {
10517        Self::VARIANTS
10518    }
10519}
10520
10521impl Name for PersistedScpState {
10522    #[must_use]
10523    fn name(&self) -> &'static str {
10524        Self::name(self)
10525    }
10526}
10527
10528impl Discriminant<i32> for PersistedScpState {
10529    #[must_use]
10530    fn discriminant(&self) -> i32 {
10531        Self::discriminant(self)
10532    }
10533}
10534
10535impl Variants<i32> for PersistedScpState {
10536    fn variants() -> slice::Iter<'static, i32> {
10537        Self::VARIANTS.iter()
10538    }
10539}
10540
10541impl Union<i32> for PersistedScpState {}
10542
10543impl ReadXdr for PersistedScpState {
10544    #[cfg(feature = "std")]
10545    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
10546        r.with_limited_depth(|r| {
10547            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
10548            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
10549            let v = match dv {
10550                0 => Self::V0(PersistedScpStateV0::read_xdr(r)?),
10551                1 => Self::V1(PersistedScpStateV1::read_xdr(r)?),
10552                #[allow(unreachable_patterns)]
10553                _ => return Err(Error::Invalid),
10554            };
10555            Ok(v)
10556        })
10557    }
10558}
10559
10560impl WriteXdr for PersistedScpState {
10561    #[cfg(feature = "std")]
10562    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
10563        w.with_limited_depth(|w| {
10564            self.discriminant().write_xdr(w)?;
10565            #[allow(clippy::match_same_arms)]
10566            match self {
10567                Self::V0(v) => v.write_xdr(w)?,
10568                Self::V1(v) => v.write_xdr(w)?,
10569            };
10570            Ok(())
10571        })
10572    }
10573}
10574
10575/// Thresholds is an XDR Typedef defines as:
10576///
10577/// ```text
10578/// typedef opaque Thresholds[4];
10579/// ```
10580///
10581#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
10582#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
10583#[cfg_attr(
10584    all(feature = "serde", feature = "alloc"),
10585    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
10586)]
10587pub struct Thresholds(pub [u8; 4]);
10588
10589impl core::fmt::Debug for Thresholds {
10590    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
10591        let v = &self.0;
10592        write!(f, "Thresholds(")?;
10593        for b in v {
10594            write!(f, "{b:02x}")?;
10595        }
10596        write!(f, ")")?;
10597        Ok(())
10598    }
10599}
10600impl core::fmt::Display for Thresholds {
10601    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
10602        let v = &self.0;
10603        for b in v {
10604            write!(f, "{b:02x}")?;
10605        }
10606        Ok(())
10607    }
10608}
10609
10610#[cfg(feature = "alloc")]
10611impl core::str::FromStr for Thresholds {
10612    type Err = Error;
10613    fn from_str(s: &str) -> core::result::Result<Self, Self::Err> {
10614        hex::decode(s).map_err(|_| Error::InvalidHex)?.try_into()
10615    }
10616}
10617#[cfg(feature = "schemars")]
10618impl schemars::JsonSchema for Thresholds {
10619    fn schema_name() -> String {
10620        "Thresholds".to_string()
10621    }
10622
10623    fn is_referenceable() -> bool {
10624        false
10625    }
10626
10627    fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
10628        let schema = String::json_schema(gen);
10629        if let schemars::schema::Schema::Object(mut schema) = schema {
10630            schema.extensions.insert(
10631                "contentEncoding".to_owned(),
10632                serde_json::Value::String("hex".to_string()),
10633            );
10634            schema.extensions.insert(
10635                "contentMediaType".to_owned(),
10636                serde_json::Value::String("application/binary".to_string()),
10637            );
10638            let string = *schema.string.unwrap_or_default().clone();
10639            schema.string = Some(Box::new(schemars::schema::StringValidation {
10640                max_length: 4_u32.checked_mul(2).map(Some).unwrap_or_default(),
10641                min_length: 4_u32.checked_mul(2).map(Some).unwrap_or_default(),
10642                ..string
10643            }));
10644            schema.into()
10645        } else {
10646            schema
10647        }
10648    }
10649}
10650impl From<Thresholds> for [u8; 4] {
10651    #[must_use]
10652    fn from(x: Thresholds) -> Self {
10653        x.0
10654    }
10655}
10656
10657impl From<[u8; 4]> for Thresholds {
10658    #[must_use]
10659    fn from(x: [u8; 4]) -> Self {
10660        Thresholds(x)
10661    }
10662}
10663
10664impl AsRef<[u8; 4]> for Thresholds {
10665    #[must_use]
10666    fn as_ref(&self) -> &[u8; 4] {
10667        &self.0
10668    }
10669}
10670
10671impl ReadXdr for Thresholds {
10672    #[cfg(feature = "std")]
10673    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
10674        r.with_limited_depth(|r| {
10675            let i = <[u8; 4]>::read_xdr(r)?;
10676            let v = Thresholds(i);
10677            Ok(v)
10678        })
10679    }
10680}
10681
10682impl WriteXdr for Thresholds {
10683    #[cfg(feature = "std")]
10684    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
10685        w.with_limited_depth(|w| self.0.write_xdr(w))
10686    }
10687}
10688
10689impl Thresholds {
10690    #[must_use]
10691    pub fn as_slice(&self) -> &[u8] {
10692        &self.0
10693    }
10694}
10695
10696#[cfg(feature = "alloc")]
10697impl TryFrom<Vec<u8>> for Thresholds {
10698    type Error = Error;
10699    fn try_from(x: Vec<u8>) -> Result<Self> {
10700        x.as_slice().try_into()
10701    }
10702}
10703
10704#[cfg(feature = "alloc")]
10705impl TryFrom<&Vec<u8>> for Thresholds {
10706    type Error = Error;
10707    fn try_from(x: &Vec<u8>) -> Result<Self> {
10708        x.as_slice().try_into()
10709    }
10710}
10711
10712impl TryFrom<&[u8]> for Thresholds {
10713    type Error = Error;
10714    fn try_from(x: &[u8]) -> Result<Self> {
10715        Ok(Thresholds(x.try_into()?))
10716    }
10717}
10718
10719impl AsRef<[u8]> for Thresholds {
10720    #[must_use]
10721    fn as_ref(&self) -> &[u8] {
10722        &self.0
10723    }
10724}
10725
10726/// String32 is an XDR Typedef defines as:
10727///
10728/// ```text
10729/// typedef string string32<32>;
10730/// ```
10731///
10732#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
10733#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
10734#[derive(Default)]
10735#[cfg_attr(
10736    all(feature = "serde", feature = "alloc"),
10737    derive(serde::Serialize, serde::Deserialize),
10738    serde(rename_all = "snake_case")
10739)]
10740#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
10741#[derive(Debug)]
10742pub struct String32(pub StringM<32>);
10743
10744impl From<String32> for StringM<32> {
10745    #[must_use]
10746    fn from(x: String32) -> Self {
10747        x.0
10748    }
10749}
10750
10751impl From<StringM<32>> for String32 {
10752    #[must_use]
10753    fn from(x: StringM<32>) -> Self {
10754        String32(x)
10755    }
10756}
10757
10758impl AsRef<StringM<32>> for String32 {
10759    #[must_use]
10760    fn as_ref(&self) -> &StringM<32> {
10761        &self.0
10762    }
10763}
10764
10765impl ReadXdr for String32 {
10766    #[cfg(feature = "std")]
10767    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
10768        r.with_limited_depth(|r| {
10769            let i = StringM::<32>::read_xdr(r)?;
10770            let v = String32(i);
10771            Ok(v)
10772        })
10773    }
10774}
10775
10776impl WriteXdr for String32 {
10777    #[cfg(feature = "std")]
10778    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
10779        w.with_limited_depth(|w| self.0.write_xdr(w))
10780    }
10781}
10782
10783impl Deref for String32 {
10784    type Target = StringM<32>;
10785    fn deref(&self) -> &Self::Target {
10786        &self.0
10787    }
10788}
10789
10790impl From<String32> for Vec<u8> {
10791    #[must_use]
10792    fn from(x: String32) -> Self {
10793        x.0 .0
10794    }
10795}
10796
10797impl TryFrom<Vec<u8>> for String32 {
10798    type Error = Error;
10799    fn try_from(x: Vec<u8>) -> Result<Self> {
10800        Ok(String32(x.try_into()?))
10801    }
10802}
10803
10804#[cfg(feature = "alloc")]
10805impl TryFrom<&Vec<u8>> for String32 {
10806    type Error = Error;
10807    fn try_from(x: &Vec<u8>) -> Result<Self> {
10808        Ok(String32(x.try_into()?))
10809    }
10810}
10811
10812impl AsRef<Vec<u8>> for String32 {
10813    #[must_use]
10814    fn as_ref(&self) -> &Vec<u8> {
10815        &self.0 .0
10816    }
10817}
10818
10819impl AsRef<[u8]> for String32 {
10820    #[cfg(feature = "alloc")]
10821    #[must_use]
10822    fn as_ref(&self) -> &[u8] {
10823        &self.0 .0
10824    }
10825    #[cfg(not(feature = "alloc"))]
10826    #[must_use]
10827    fn as_ref(&self) -> &[u8] {
10828        self.0 .0
10829    }
10830}
10831
10832/// String64 is an XDR Typedef defines as:
10833///
10834/// ```text
10835/// typedef string string64<64>;
10836/// ```
10837///
10838#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
10839#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
10840#[derive(Default)]
10841#[cfg_attr(
10842    all(feature = "serde", feature = "alloc"),
10843    derive(serde::Serialize, serde::Deserialize),
10844    serde(rename_all = "snake_case")
10845)]
10846#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
10847#[derive(Debug)]
10848pub struct String64(pub StringM<64>);
10849
10850impl From<String64> for StringM<64> {
10851    #[must_use]
10852    fn from(x: String64) -> Self {
10853        x.0
10854    }
10855}
10856
10857impl From<StringM<64>> for String64 {
10858    #[must_use]
10859    fn from(x: StringM<64>) -> Self {
10860        String64(x)
10861    }
10862}
10863
10864impl AsRef<StringM<64>> for String64 {
10865    #[must_use]
10866    fn as_ref(&self) -> &StringM<64> {
10867        &self.0
10868    }
10869}
10870
10871impl ReadXdr for String64 {
10872    #[cfg(feature = "std")]
10873    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
10874        r.with_limited_depth(|r| {
10875            let i = StringM::<64>::read_xdr(r)?;
10876            let v = String64(i);
10877            Ok(v)
10878        })
10879    }
10880}
10881
10882impl WriteXdr for String64 {
10883    #[cfg(feature = "std")]
10884    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
10885        w.with_limited_depth(|w| self.0.write_xdr(w))
10886    }
10887}
10888
10889impl Deref for String64 {
10890    type Target = StringM<64>;
10891    fn deref(&self) -> &Self::Target {
10892        &self.0
10893    }
10894}
10895
10896impl From<String64> for Vec<u8> {
10897    #[must_use]
10898    fn from(x: String64) -> Self {
10899        x.0 .0
10900    }
10901}
10902
10903impl TryFrom<Vec<u8>> for String64 {
10904    type Error = Error;
10905    fn try_from(x: Vec<u8>) -> Result<Self> {
10906        Ok(String64(x.try_into()?))
10907    }
10908}
10909
10910#[cfg(feature = "alloc")]
10911impl TryFrom<&Vec<u8>> for String64 {
10912    type Error = Error;
10913    fn try_from(x: &Vec<u8>) -> Result<Self> {
10914        Ok(String64(x.try_into()?))
10915    }
10916}
10917
10918impl AsRef<Vec<u8>> for String64 {
10919    #[must_use]
10920    fn as_ref(&self) -> &Vec<u8> {
10921        &self.0 .0
10922    }
10923}
10924
10925impl AsRef<[u8]> for String64 {
10926    #[cfg(feature = "alloc")]
10927    #[must_use]
10928    fn as_ref(&self) -> &[u8] {
10929        &self.0 .0
10930    }
10931    #[cfg(not(feature = "alloc"))]
10932    #[must_use]
10933    fn as_ref(&self) -> &[u8] {
10934        self.0 .0
10935    }
10936}
10937
10938/// SequenceNumber is an XDR Typedef defines as:
10939///
10940/// ```text
10941/// typedef int64 SequenceNumber;
10942/// ```
10943///
10944#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
10945#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
10946#[cfg_attr(
10947    all(feature = "serde", feature = "alloc"),
10948    derive(serde::Serialize, serde::Deserialize),
10949    serde(rename_all = "snake_case")
10950)]
10951#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
10952#[derive(Debug)]
10953pub struct SequenceNumber(pub i64);
10954
10955impl From<SequenceNumber> for i64 {
10956    #[must_use]
10957    fn from(x: SequenceNumber) -> Self {
10958        x.0
10959    }
10960}
10961
10962impl From<i64> for SequenceNumber {
10963    #[must_use]
10964    fn from(x: i64) -> Self {
10965        SequenceNumber(x)
10966    }
10967}
10968
10969impl AsRef<i64> for SequenceNumber {
10970    #[must_use]
10971    fn as_ref(&self) -> &i64 {
10972        &self.0
10973    }
10974}
10975
10976impl ReadXdr for SequenceNumber {
10977    #[cfg(feature = "std")]
10978    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
10979        r.with_limited_depth(|r| {
10980            let i = i64::read_xdr(r)?;
10981            let v = SequenceNumber(i);
10982            Ok(v)
10983        })
10984    }
10985}
10986
10987impl WriteXdr for SequenceNumber {
10988    #[cfg(feature = "std")]
10989    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
10990        w.with_limited_depth(|w| self.0.write_xdr(w))
10991    }
10992}
10993
10994/// DataValue is an XDR Typedef defines as:
10995///
10996/// ```text
10997/// typedef opaque DataValue<64>;
10998/// ```
10999///
11000#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
11001#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
11002#[derive(Default)]
11003#[cfg_attr(
11004    all(feature = "serde", feature = "alloc"),
11005    derive(serde::Serialize, serde::Deserialize),
11006    serde(rename_all = "snake_case")
11007)]
11008#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
11009#[derive(Debug)]
11010pub struct DataValue(pub BytesM<64>);
11011
11012impl From<DataValue> for BytesM<64> {
11013    #[must_use]
11014    fn from(x: DataValue) -> Self {
11015        x.0
11016    }
11017}
11018
11019impl From<BytesM<64>> for DataValue {
11020    #[must_use]
11021    fn from(x: BytesM<64>) -> Self {
11022        DataValue(x)
11023    }
11024}
11025
11026impl AsRef<BytesM<64>> for DataValue {
11027    #[must_use]
11028    fn as_ref(&self) -> &BytesM<64> {
11029        &self.0
11030    }
11031}
11032
11033impl ReadXdr for DataValue {
11034    #[cfg(feature = "std")]
11035    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
11036        r.with_limited_depth(|r| {
11037            let i = BytesM::<64>::read_xdr(r)?;
11038            let v = DataValue(i);
11039            Ok(v)
11040        })
11041    }
11042}
11043
11044impl WriteXdr for DataValue {
11045    #[cfg(feature = "std")]
11046    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
11047        w.with_limited_depth(|w| self.0.write_xdr(w))
11048    }
11049}
11050
11051impl Deref for DataValue {
11052    type Target = BytesM<64>;
11053    fn deref(&self) -> &Self::Target {
11054        &self.0
11055    }
11056}
11057
11058impl From<DataValue> for Vec<u8> {
11059    #[must_use]
11060    fn from(x: DataValue) -> Self {
11061        x.0 .0
11062    }
11063}
11064
11065impl TryFrom<Vec<u8>> for DataValue {
11066    type Error = Error;
11067    fn try_from(x: Vec<u8>) -> Result<Self> {
11068        Ok(DataValue(x.try_into()?))
11069    }
11070}
11071
11072#[cfg(feature = "alloc")]
11073impl TryFrom<&Vec<u8>> for DataValue {
11074    type Error = Error;
11075    fn try_from(x: &Vec<u8>) -> Result<Self> {
11076        Ok(DataValue(x.try_into()?))
11077    }
11078}
11079
11080impl AsRef<Vec<u8>> for DataValue {
11081    #[must_use]
11082    fn as_ref(&self) -> &Vec<u8> {
11083        &self.0 .0
11084    }
11085}
11086
11087impl AsRef<[u8]> for DataValue {
11088    #[cfg(feature = "alloc")]
11089    #[must_use]
11090    fn as_ref(&self) -> &[u8] {
11091        &self.0 .0
11092    }
11093    #[cfg(not(feature = "alloc"))]
11094    #[must_use]
11095    fn as_ref(&self) -> &[u8] {
11096        self.0 .0
11097    }
11098}
11099
11100/// PoolId is an XDR Typedef defines as:
11101///
11102/// ```text
11103/// typedef Hash PoolID;
11104/// ```
11105///
11106#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
11107#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
11108#[cfg_attr(
11109    all(feature = "serde", feature = "alloc"),
11110    derive(serde::Serialize, serde::Deserialize),
11111    serde(rename_all = "snake_case")
11112)]
11113#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
11114#[derive(Debug)]
11115pub struct PoolId(pub Hash);
11116
11117impl From<PoolId> for Hash {
11118    #[must_use]
11119    fn from(x: PoolId) -> Self {
11120        x.0
11121    }
11122}
11123
11124impl From<Hash> for PoolId {
11125    #[must_use]
11126    fn from(x: Hash) -> Self {
11127        PoolId(x)
11128    }
11129}
11130
11131impl AsRef<Hash> for PoolId {
11132    #[must_use]
11133    fn as_ref(&self) -> &Hash {
11134        &self.0
11135    }
11136}
11137
11138impl ReadXdr for PoolId {
11139    #[cfg(feature = "std")]
11140    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
11141        r.with_limited_depth(|r| {
11142            let i = Hash::read_xdr(r)?;
11143            let v = PoolId(i);
11144            Ok(v)
11145        })
11146    }
11147}
11148
11149impl WriteXdr for PoolId {
11150    #[cfg(feature = "std")]
11151    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
11152        w.with_limited_depth(|w| self.0.write_xdr(w))
11153    }
11154}
11155
11156/// AssetCode4 is an XDR Typedef defines as:
11157///
11158/// ```text
11159/// typedef opaque AssetCode4[4];
11160/// ```
11161///
11162#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
11163#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
11164#[cfg_attr(
11165    all(feature = "serde", feature = "alloc"),
11166    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
11167)]
11168pub struct AssetCode4(pub [u8; 4]);
11169
11170impl core::fmt::Debug for AssetCode4 {
11171    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
11172        let v = &self.0;
11173        write!(f, "AssetCode4(")?;
11174        for b in v {
11175            write!(f, "{b:02x}")?;
11176        }
11177        write!(f, ")")?;
11178        Ok(())
11179    }
11180}
11181impl From<AssetCode4> for [u8; 4] {
11182    #[must_use]
11183    fn from(x: AssetCode4) -> Self {
11184        x.0
11185    }
11186}
11187
11188impl From<[u8; 4]> for AssetCode4 {
11189    #[must_use]
11190    fn from(x: [u8; 4]) -> Self {
11191        AssetCode4(x)
11192    }
11193}
11194
11195impl AsRef<[u8; 4]> for AssetCode4 {
11196    #[must_use]
11197    fn as_ref(&self) -> &[u8; 4] {
11198        &self.0
11199    }
11200}
11201
11202impl ReadXdr for AssetCode4 {
11203    #[cfg(feature = "std")]
11204    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
11205        r.with_limited_depth(|r| {
11206            let i = <[u8; 4]>::read_xdr(r)?;
11207            let v = AssetCode4(i);
11208            Ok(v)
11209        })
11210    }
11211}
11212
11213impl WriteXdr for AssetCode4 {
11214    #[cfg(feature = "std")]
11215    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
11216        w.with_limited_depth(|w| self.0.write_xdr(w))
11217    }
11218}
11219
11220impl AssetCode4 {
11221    #[must_use]
11222    pub fn as_slice(&self) -> &[u8] {
11223        &self.0
11224    }
11225}
11226
11227#[cfg(feature = "alloc")]
11228impl TryFrom<Vec<u8>> for AssetCode4 {
11229    type Error = Error;
11230    fn try_from(x: Vec<u8>) -> Result<Self> {
11231        x.as_slice().try_into()
11232    }
11233}
11234
11235#[cfg(feature = "alloc")]
11236impl TryFrom<&Vec<u8>> for AssetCode4 {
11237    type Error = Error;
11238    fn try_from(x: &Vec<u8>) -> Result<Self> {
11239        x.as_slice().try_into()
11240    }
11241}
11242
11243impl TryFrom<&[u8]> for AssetCode4 {
11244    type Error = Error;
11245    fn try_from(x: &[u8]) -> Result<Self> {
11246        Ok(AssetCode4(x.try_into()?))
11247    }
11248}
11249
11250impl AsRef<[u8]> for AssetCode4 {
11251    #[must_use]
11252    fn as_ref(&self) -> &[u8] {
11253        &self.0
11254    }
11255}
11256
11257/// AssetCode12 is an XDR Typedef defines as:
11258///
11259/// ```text
11260/// typedef opaque AssetCode12[12];
11261/// ```
11262///
11263#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
11264#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
11265#[cfg_attr(
11266    all(feature = "serde", feature = "alloc"),
11267    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
11268)]
11269pub struct AssetCode12(pub [u8; 12]);
11270
11271impl core::fmt::Debug for AssetCode12 {
11272    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
11273        let v = &self.0;
11274        write!(f, "AssetCode12(")?;
11275        for b in v {
11276            write!(f, "{b:02x}")?;
11277        }
11278        write!(f, ")")?;
11279        Ok(())
11280    }
11281}
11282impl From<AssetCode12> for [u8; 12] {
11283    #[must_use]
11284    fn from(x: AssetCode12) -> Self {
11285        x.0
11286    }
11287}
11288
11289impl From<[u8; 12]> for AssetCode12 {
11290    #[must_use]
11291    fn from(x: [u8; 12]) -> Self {
11292        AssetCode12(x)
11293    }
11294}
11295
11296impl AsRef<[u8; 12]> for AssetCode12 {
11297    #[must_use]
11298    fn as_ref(&self) -> &[u8; 12] {
11299        &self.0
11300    }
11301}
11302
11303impl ReadXdr for AssetCode12 {
11304    #[cfg(feature = "std")]
11305    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
11306        r.with_limited_depth(|r| {
11307            let i = <[u8; 12]>::read_xdr(r)?;
11308            let v = AssetCode12(i);
11309            Ok(v)
11310        })
11311    }
11312}
11313
11314impl WriteXdr for AssetCode12 {
11315    #[cfg(feature = "std")]
11316    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
11317        w.with_limited_depth(|w| self.0.write_xdr(w))
11318    }
11319}
11320
11321impl AssetCode12 {
11322    #[must_use]
11323    pub fn as_slice(&self) -> &[u8] {
11324        &self.0
11325    }
11326}
11327
11328#[cfg(feature = "alloc")]
11329impl TryFrom<Vec<u8>> for AssetCode12 {
11330    type Error = Error;
11331    fn try_from(x: Vec<u8>) -> Result<Self> {
11332        x.as_slice().try_into()
11333    }
11334}
11335
11336#[cfg(feature = "alloc")]
11337impl TryFrom<&Vec<u8>> for AssetCode12 {
11338    type Error = Error;
11339    fn try_from(x: &Vec<u8>) -> Result<Self> {
11340        x.as_slice().try_into()
11341    }
11342}
11343
11344impl TryFrom<&[u8]> for AssetCode12 {
11345    type Error = Error;
11346    fn try_from(x: &[u8]) -> Result<Self> {
11347        Ok(AssetCode12(x.try_into()?))
11348    }
11349}
11350
11351impl AsRef<[u8]> for AssetCode12 {
11352    #[must_use]
11353    fn as_ref(&self) -> &[u8] {
11354        &self.0
11355    }
11356}
11357
11358/// AssetType is an XDR Enum defines as:
11359///
11360/// ```text
11361/// enum AssetType
11362/// {
11363///     ASSET_TYPE_NATIVE = 0,
11364///     ASSET_TYPE_CREDIT_ALPHANUM4 = 1,
11365///     ASSET_TYPE_CREDIT_ALPHANUM12 = 2,
11366///     ASSET_TYPE_POOL_SHARE = 3
11367/// };
11368/// ```
11369///
11370// enum
11371#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
11372#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
11373#[cfg_attr(
11374    all(feature = "serde", feature = "alloc"),
11375    derive(serde::Serialize, serde::Deserialize),
11376    serde(rename_all = "snake_case")
11377)]
11378#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
11379#[repr(i32)]
11380pub enum AssetType {
11381    Native = 0,
11382    CreditAlphanum4 = 1,
11383    CreditAlphanum12 = 2,
11384    PoolShare = 3,
11385}
11386
11387impl AssetType {
11388    pub const VARIANTS: [AssetType; 4] = [
11389        AssetType::Native,
11390        AssetType::CreditAlphanum4,
11391        AssetType::CreditAlphanum12,
11392        AssetType::PoolShare,
11393    ];
11394    pub const VARIANTS_STR: [&'static str; 4] =
11395        ["Native", "CreditAlphanum4", "CreditAlphanum12", "PoolShare"];
11396
11397    #[must_use]
11398    pub const fn name(&self) -> &'static str {
11399        match self {
11400            Self::Native => "Native",
11401            Self::CreditAlphanum4 => "CreditAlphanum4",
11402            Self::CreditAlphanum12 => "CreditAlphanum12",
11403            Self::PoolShare => "PoolShare",
11404        }
11405    }
11406
11407    #[must_use]
11408    pub const fn variants() -> [AssetType; 4] {
11409        Self::VARIANTS
11410    }
11411}
11412
11413impl Name for AssetType {
11414    #[must_use]
11415    fn name(&self) -> &'static str {
11416        Self::name(self)
11417    }
11418}
11419
11420impl Variants<AssetType> for AssetType {
11421    fn variants() -> slice::Iter<'static, AssetType> {
11422        Self::VARIANTS.iter()
11423    }
11424}
11425
11426impl Enum for AssetType {}
11427
11428impl fmt::Display for AssetType {
11429    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
11430        f.write_str(self.name())
11431    }
11432}
11433
11434impl TryFrom<i32> for AssetType {
11435    type Error = Error;
11436
11437    fn try_from(i: i32) -> Result<Self> {
11438        let e = match i {
11439            0 => AssetType::Native,
11440            1 => AssetType::CreditAlphanum4,
11441            2 => AssetType::CreditAlphanum12,
11442            3 => AssetType::PoolShare,
11443            #[allow(unreachable_patterns)]
11444            _ => return Err(Error::Invalid),
11445        };
11446        Ok(e)
11447    }
11448}
11449
11450impl From<AssetType> for i32 {
11451    #[must_use]
11452    fn from(e: AssetType) -> Self {
11453        e as Self
11454    }
11455}
11456
11457impl ReadXdr for AssetType {
11458    #[cfg(feature = "std")]
11459    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
11460        r.with_limited_depth(|r| {
11461            let e = i32::read_xdr(r)?;
11462            let v: Self = e.try_into()?;
11463            Ok(v)
11464        })
11465    }
11466}
11467
11468impl WriteXdr for AssetType {
11469    #[cfg(feature = "std")]
11470    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
11471        w.with_limited_depth(|w| {
11472            let i: i32 = (*self).into();
11473            i.write_xdr(w)
11474        })
11475    }
11476}
11477
11478/// AssetCode is an XDR Union defines as:
11479///
11480/// ```text
11481/// union AssetCode switch (AssetType type)
11482/// {
11483/// case ASSET_TYPE_CREDIT_ALPHANUM4:
11484///     AssetCode4 assetCode4;
11485///
11486/// case ASSET_TYPE_CREDIT_ALPHANUM12:
11487///     AssetCode12 assetCode12;
11488///
11489///     // add other asset types here in the future
11490/// };
11491/// ```
11492///
11493// union with discriminant AssetType
11494#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
11495#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
11496#[cfg_attr(
11497    all(feature = "serde", feature = "alloc"),
11498    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
11499)]
11500#[allow(clippy::large_enum_variant)]
11501pub enum AssetCode {
11502    CreditAlphanum4(AssetCode4),
11503    CreditAlphanum12(AssetCode12),
11504}
11505
11506impl AssetCode {
11507    pub const VARIANTS: [AssetType; 2] = [AssetType::CreditAlphanum4, AssetType::CreditAlphanum12];
11508    pub const VARIANTS_STR: [&'static str; 2] = ["CreditAlphanum4", "CreditAlphanum12"];
11509
11510    #[must_use]
11511    pub const fn name(&self) -> &'static str {
11512        match self {
11513            Self::CreditAlphanum4(_) => "CreditAlphanum4",
11514            Self::CreditAlphanum12(_) => "CreditAlphanum12",
11515        }
11516    }
11517
11518    #[must_use]
11519    pub const fn discriminant(&self) -> AssetType {
11520        #[allow(clippy::match_same_arms)]
11521        match self {
11522            Self::CreditAlphanum4(_) => AssetType::CreditAlphanum4,
11523            Self::CreditAlphanum12(_) => AssetType::CreditAlphanum12,
11524        }
11525    }
11526
11527    #[must_use]
11528    pub const fn variants() -> [AssetType; 2] {
11529        Self::VARIANTS
11530    }
11531}
11532
11533impl Name for AssetCode {
11534    #[must_use]
11535    fn name(&self) -> &'static str {
11536        Self::name(self)
11537    }
11538}
11539
11540impl Discriminant<AssetType> for AssetCode {
11541    #[must_use]
11542    fn discriminant(&self) -> AssetType {
11543        Self::discriminant(self)
11544    }
11545}
11546
11547impl Variants<AssetType> for AssetCode {
11548    fn variants() -> slice::Iter<'static, AssetType> {
11549        Self::VARIANTS.iter()
11550    }
11551}
11552
11553impl Union<AssetType> for AssetCode {}
11554
11555impl ReadXdr for AssetCode {
11556    #[cfg(feature = "std")]
11557    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
11558        r.with_limited_depth(|r| {
11559            let dv: AssetType = <AssetType as ReadXdr>::read_xdr(r)?;
11560            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
11561            let v = match dv {
11562                AssetType::CreditAlphanum4 => Self::CreditAlphanum4(AssetCode4::read_xdr(r)?),
11563                AssetType::CreditAlphanum12 => Self::CreditAlphanum12(AssetCode12::read_xdr(r)?),
11564                #[allow(unreachable_patterns)]
11565                _ => return Err(Error::Invalid),
11566            };
11567            Ok(v)
11568        })
11569    }
11570}
11571
11572impl WriteXdr for AssetCode {
11573    #[cfg(feature = "std")]
11574    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
11575        w.with_limited_depth(|w| {
11576            self.discriminant().write_xdr(w)?;
11577            #[allow(clippy::match_same_arms)]
11578            match self {
11579                Self::CreditAlphanum4(v) => v.write_xdr(w)?,
11580                Self::CreditAlphanum12(v) => v.write_xdr(w)?,
11581            };
11582            Ok(())
11583        })
11584    }
11585}
11586
11587/// AlphaNum4 is an XDR Struct defines as:
11588///
11589/// ```text
11590/// struct AlphaNum4
11591/// {
11592///     AssetCode4 assetCode;
11593///     AccountID issuer;
11594/// };
11595/// ```
11596///
11597#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
11598#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
11599#[cfg_attr(
11600    all(feature = "serde", feature = "alloc"),
11601    derive(serde::Serialize, serde::Deserialize),
11602    serde(rename_all = "snake_case")
11603)]
11604#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
11605pub struct AlphaNum4 {
11606    pub asset_code: AssetCode4,
11607    pub issuer: AccountId,
11608}
11609
11610impl ReadXdr for AlphaNum4 {
11611    #[cfg(feature = "std")]
11612    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
11613        r.with_limited_depth(|r| {
11614            Ok(Self {
11615                asset_code: AssetCode4::read_xdr(r)?,
11616                issuer: AccountId::read_xdr(r)?,
11617            })
11618        })
11619    }
11620}
11621
11622impl WriteXdr for AlphaNum4 {
11623    #[cfg(feature = "std")]
11624    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
11625        w.with_limited_depth(|w| {
11626            self.asset_code.write_xdr(w)?;
11627            self.issuer.write_xdr(w)?;
11628            Ok(())
11629        })
11630    }
11631}
11632
11633/// AlphaNum12 is an XDR Struct defines as:
11634///
11635/// ```text
11636/// struct AlphaNum12
11637/// {
11638///     AssetCode12 assetCode;
11639///     AccountID issuer;
11640/// };
11641/// ```
11642///
11643#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
11644#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
11645#[cfg_attr(
11646    all(feature = "serde", feature = "alloc"),
11647    derive(serde::Serialize, serde::Deserialize),
11648    serde(rename_all = "snake_case")
11649)]
11650#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
11651pub struct AlphaNum12 {
11652    pub asset_code: AssetCode12,
11653    pub issuer: AccountId,
11654}
11655
11656impl ReadXdr for AlphaNum12 {
11657    #[cfg(feature = "std")]
11658    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
11659        r.with_limited_depth(|r| {
11660            Ok(Self {
11661                asset_code: AssetCode12::read_xdr(r)?,
11662                issuer: AccountId::read_xdr(r)?,
11663            })
11664        })
11665    }
11666}
11667
11668impl WriteXdr for AlphaNum12 {
11669    #[cfg(feature = "std")]
11670    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
11671        w.with_limited_depth(|w| {
11672            self.asset_code.write_xdr(w)?;
11673            self.issuer.write_xdr(w)?;
11674            Ok(())
11675        })
11676    }
11677}
11678
11679/// Asset is an XDR Union defines as:
11680///
11681/// ```text
11682/// union Asset switch (AssetType type)
11683/// {
11684/// case ASSET_TYPE_NATIVE: // Not credit
11685///     void;
11686///
11687/// case ASSET_TYPE_CREDIT_ALPHANUM4:
11688///     AlphaNum4 alphaNum4;
11689///
11690/// case ASSET_TYPE_CREDIT_ALPHANUM12:
11691///     AlphaNum12 alphaNum12;
11692///
11693///     // add other asset types here in the future
11694/// };
11695/// ```
11696///
11697// union with discriminant AssetType
11698#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
11699#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
11700#[cfg_attr(
11701    all(feature = "serde", feature = "alloc"),
11702    derive(serde::Serialize, serde::Deserialize),
11703    serde(rename_all = "snake_case")
11704)]
11705#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
11706#[allow(clippy::large_enum_variant)]
11707pub enum Asset {
11708    Native,
11709    CreditAlphanum4(AlphaNum4),
11710    CreditAlphanum12(AlphaNum12),
11711}
11712
11713impl Asset {
11714    pub const VARIANTS: [AssetType; 3] = [
11715        AssetType::Native,
11716        AssetType::CreditAlphanum4,
11717        AssetType::CreditAlphanum12,
11718    ];
11719    pub const VARIANTS_STR: [&'static str; 3] = ["Native", "CreditAlphanum4", "CreditAlphanum12"];
11720
11721    #[must_use]
11722    pub const fn name(&self) -> &'static str {
11723        match self {
11724            Self::Native => "Native",
11725            Self::CreditAlphanum4(_) => "CreditAlphanum4",
11726            Self::CreditAlphanum12(_) => "CreditAlphanum12",
11727        }
11728    }
11729
11730    #[must_use]
11731    pub const fn discriminant(&self) -> AssetType {
11732        #[allow(clippy::match_same_arms)]
11733        match self {
11734            Self::Native => AssetType::Native,
11735            Self::CreditAlphanum4(_) => AssetType::CreditAlphanum4,
11736            Self::CreditAlphanum12(_) => AssetType::CreditAlphanum12,
11737        }
11738    }
11739
11740    #[must_use]
11741    pub const fn variants() -> [AssetType; 3] {
11742        Self::VARIANTS
11743    }
11744}
11745
11746impl Name for Asset {
11747    #[must_use]
11748    fn name(&self) -> &'static str {
11749        Self::name(self)
11750    }
11751}
11752
11753impl Discriminant<AssetType> for Asset {
11754    #[must_use]
11755    fn discriminant(&self) -> AssetType {
11756        Self::discriminant(self)
11757    }
11758}
11759
11760impl Variants<AssetType> for Asset {
11761    fn variants() -> slice::Iter<'static, AssetType> {
11762        Self::VARIANTS.iter()
11763    }
11764}
11765
11766impl Union<AssetType> for Asset {}
11767
11768impl ReadXdr for Asset {
11769    #[cfg(feature = "std")]
11770    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
11771        r.with_limited_depth(|r| {
11772            let dv: AssetType = <AssetType as ReadXdr>::read_xdr(r)?;
11773            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
11774            let v = match dv {
11775                AssetType::Native => Self::Native,
11776                AssetType::CreditAlphanum4 => Self::CreditAlphanum4(AlphaNum4::read_xdr(r)?),
11777                AssetType::CreditAlphanum12 => Self::CreditAlphanum12(AlphaNum12::read_xdr(r)?),
11778                #[allow(unreachable_patterns)]
11779                _ => return Err(Error::Invalid),
11780            };
11781            Ok(v)
11782        })
11783    }
11784}
11785
11786impl WriteXdr for Asset {
11787    #[cfg(feature = "std")]
11788    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
11789        w.with_limited_depth(|w| {
11790            self.discriminant().write_xdr(w)?;
11791            #[allow(clippy::match_same_arms)]
11792            match self {
11793                Self::Native => ().write_xdr(w)?,
11794                Self::CreditAlphanum4(v) => v.write_xdr(w)?,
11795                Self::CreditAlphanum12(v) => v.write_xdr(w)?,
11796            };
11797            Ok(())
11798        })
11799    }
11800}
11801
11802/// Price is an XDR Struct defines as:
11803///
11804/// ```text
11805/// struct Price
11806/// {
11807///     int32 n; // numerator
11808///     int32 d; // denominator
11809/// };
11810/// ```
11811///
11812#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
11813#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
11814#[cfg_attr(
11815    all(feature = "serde", feature = "alloc"),
11816    derive(serde::Serialize, serde::Deserialize),
11817    serde(rename_all = "snake_case")
11818)]
11819#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
11820pub struct Price {
11821    pub n: i32,
11822    pub d: i32,
11823}
11824
11825impl ReadXdr for Price {
11826    #[cfg(feature = "std")]
11827    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
11828        r.with_limited_depth(|r| {
11829            Ok(Self {
11830                n: i32::read_xdr(r)?,
11831                d: i32::read_xdr(r)?,
11832            })
11833        })
11834    }
11835}
11836
11837impl WriteXdr for Price {
11838    #[cfg(feature = "std")]
11839    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
11840        w.with_limited_depth(|w| {
11841            self.n.write_xdr(w)?;
11842            self.d.write_xdr(w)?;
11843            Ok(())
11844        })
11845    }
11846}
11847
11848/// Liabilities is an XDR Struct defines as:
11849///
11850/// ```text
11851/// struct Liabilities
11852/// {
11853///     int64 buying;
11854///     int64 selling;
11855/// };
11856/// ```
11857///
11858#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
11859#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
11860#[cfg_attr(
11861    all(feature = "serde", feature = "alloc"),
11862    derive(serde::Serialize, serde::Deserialize),
11863    serde(rename_all = "snake_case")
11864)]
11865#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
11866pub struct Liabilities {
11867    pub buying: i64,
11868    pub selling: i64,
11869}
11870
11871impl ReadXdr for Liabilities {
11872    #[cfg(feature = "std")]
11873    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
11874        r.with_limited_depth(|r| {
11875            Ok(Self {
11876                buying: i64::read_xdr(r)?,
11877                selling: i64::read_xdr(r)?,
11878            })
11879        })
11880    }
11881}
11882
11883impl WriteXdr for Liabilities {
11884    #[cfg(feature = "std")]
11885    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
11886        w.with_limited_depth(|w| {
11887            self.buying.write_xdr(w)?;
11888            self.selling.write_xdr(w)?;
11889            Ok(())
11890        })
11891    }
11892}
11893
11894/// ThresholdIndexes is an XDR Enum defines as:
11895///
11896/// ```text
11897/// enum ThresholdIndexes
11898/// {
11899///     THRESHOLD_MASTER_WEIGHT = 0,
11900///     THRESHOLD_LOW = 1,
11901///     THRESHOLD_MED = 2,
11902///     THRESHOLD_HIGH = 3
11903/// };
11904/// ```
11905///
11906// enum
11907#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
11908#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
11909#[cfg_attr(
11910    all(feature = "serde", feature = "alloc"),
11911    derive(serde::Serialize, serde::Deserialize),
11912    serde(rename_all = "snake_case")
11913)]
11914#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
11915#[repr(i32)]
11916pub enum ThresholdIndexes {
11917    MasterWeight = 0,
11918    Low = 1,
11919    Med = 2,
11920    High = 3,
11921}
11922
11923impl ThresholdIndexes {
11924    pub const VARIANTS: [ThresholdIndexes; 4] = [
11925        ThresholdIndexes::MasterWeight,
11926        ThresholdIndexes::Low,
11927        ThresholdIndexes::Med,
11928        ThresholdIndexes::High,
11929    ];
11930    pub const VARIANTS_STR: [&'static str; 4] = ["MasterWeight", "Low", "Med", "High"];
11931
11932    #[must_use]
11933    pub const fn name(&self) -> &'static str {
11934        match self {
11935            Self::MasterWeight => "MasterWeight",
11936            Self::Low => "Low",
11937            Self::Med => "Med",
11938            Self::High => "High",
11939        }
11940    }
11941
11942    #[must_use]
11943    pub const fn variants() -> [ThresholdIndexes; 4] {
11944        Self::VARIANTS
11945    }
11946}
11947
11948impl Name for ThresholdIndexes {
11949    #[must_use]
11950    fn name(&self) -> &'static str {
11951        Self::name(self)
11952    }
11953}
11954
11955impl Variants<ThresholdIndexes> for ThresholdIndexes {
11956    fn variants() -> slice::Iter<'static, ThresholdIndexes> {
11957        Self::VARIANTS.iter()
11958    }
11959}
11960
11961impl Enum for ThresholdIndexes {}
11962
11963impl fmt::Display for ThresholdIndexes {
11964    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
11965        f.write_str(self.name())
11966    }
11967}
11968
11969impl TryFrom<i32> for ThresholdIndexes {
11970    type Error = Error;
11971
11972    fn try_from(i: i32) -> Result<Self> {
11973        let e = match i {
11974            0 => ThresholdIndexes::MasterWeight,
11975            1 => ThresholdIndexes::Low,
11976            2 => ThresholdIndexes::Med,
11977            3 => ThresholdIndexes::High,
11978            #[allow(unreachable_patterns)]
11979            _ => return Err(Error::Invalid),
11980        };
11981        Ok(e)
11982    }
11983}
11984
11985impl From<ThresholdIndexes> for i32 {
11986    #[must_use]
11987    fn from(e: ThresholdIndexes) -> Self {
11988        e as Self
11989    }
11990}
11991
11992impl ReadXdr for ThresholdIndexes {
11993    #[cfg(feature = "std")]
11994    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
11995        r.with_limited_depth(|r| {
11996            let e = i32::read_xdr(r)?;
11997            let v: Self = e.try_into()?;
11998            Ok(v)
11999        })
12000    }
12001}
12002
12003impl WriteXdr for ThresholdIndexes {
12004    #[cfg(feature = "std")]
12005    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
12006        w.with_limited_depth(|w| {
12007            let i: i32 = (*self).into();
12008            i.write_xdr(w)
12009        })
12010    }
12011}
12012
12013/// LedgerEntryType is an XDR Enum defines as:
12014///
12015/// ```text
12016/// enum LedgerEntryType
12017/// {
12018///     ACCOUNT = 0,
12019///     TRUSTLINE = 1,
12020///     OFFER = 2,
12021///     DATA = 3,
12022///     CLAIMABLE_BALANCE = 4,
12023///     LIQUIDITY_POOL = 5,
12024///     CONTRACT_DATA = 6,
12025///     CONTRACT_CODE = 7,
12026///     CONFIG_SETTING = 8,
12027///     TTL = 9
12028/// };
12029/// ```
12030///
12031// enum
12032#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
12033#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
12034#[cfg_attr(
12035    all(feature = "serde", feature = "alloc"),
12036    derive(serde::Serialize, serde::Deserialize),
12037    serde(rename_all = "snake_case")
12038)]
12039#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
12040#[repr(i32)]
12041pub enum LedgerEntryType {
12042    Account = 0,
12043    Trustline = 1,
12044    Offer = 2,
12045    Data = 3,
12046    ClaimableBalance = 4,
12047    LiquidityPool = 5,
12048    ContractData = 6,
12049    ContractCode = 7,
12050    ConfigSetting = 8,
12051    Ttl = 9,
12052}
12053
12054impl LedgerEntryType {
12055    pub const VARIANTS: [LedgerEntryType; 10] = [
12056        LedgerEntryType::Account,
12057        LedgerEntryType::Trustline,
12058        LedgerEntryType::Offer,
12059        LedgerEntryType::Data,
12060        LedgerEntryType::ClaimableBalance,
12061        LedgerEntryType::LiquidityPool,
12062        LedgerEntryType::ContractData,
12063        LedgerEntryType::ContractCode,
12064        LedgerEntryType::ConfigSetting,
12065        LedgerEntryType::Ttl,
12066    ];
12067    pub const VARIANTS_STR: [&'static str; 10] = [
12068        "Account",
12069        "Trustline",
12070        "Offer",
12071        "Data",
12072        "ClaimableBalance",
12073        "LiquidityPool",
12074        "ContractData",
12075        "ContractCode",
12076        "ConfigSetting",
12077        "Ttl",
12078    ];
12079
12080    #[must_use]
12081    pub const fn name(&self) -> &'static str {
12082        match self {
12083            Self::Account => "Account",
12084            Self::Trustline => "Trustline",
12085            Self::Offer => "Offer",
12086            Self::Data => "Data",
12087            Self::ClaimableBalance => "ClaimableBalance",
12088            Self::LiquidityPool => "LiquidityPool",
12089            Self::ContractData => "ContractData",
12090            Self::ContractCode => "ContractCode",
12091            Self::ConfigSetting => "ConfigSetting",
12092            Self::Ttl => "Ttl",
12093        }
12094    }
12095
12096    #[must_use]
12097    pub const fn variants() -> [LedgerEntryType; 10] {
12098        Self::VARIANTS
12099    }
12100}
12101
12102impl Name for LedgerEntryType {
12103    #[must_use]
12104    fn name(&self) -> &'static str {
12105        Self::name(self)
12106    }
12107}
12108
12109impl Variants<LedgerEntryType> for LedgerEntryType {
12110    fn variants() -> slice::Iter<'static, LedgerEntryType> {
12111        Self::VARIANTS.iter()
12112    }
12113}
12114
12115impl Enum for LedgerEntryType {}
12116
12117impl fmt::Display for LedgerEntryType {
12118    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
12119        f.write_str(self.name())
12120    }
12121}
12122
12123impl TryFrom<i32> for LedgerEntryType {
12124    type Error = Error;
12125
12126    fn try_from(i: i32) -> Result<Self> {
12127        let e = match i {
12128            0 => LedgerEntryType::Account,
12129            1 => LedgerEntryType::Trustline,
12130            2 => LedgerEntryType::Offer,
12131            3 => LedgerEntryType::Data,
12132            4 => LedgerEntryType::ClaimableBalance,
12133            5 => LedgerEntryType::LiquidityPool,
12134            6 => LedgerEntryType::ContractData,
12135            7 => LedgerEntryType::ContractCode,
12136            8 => LedgerEntryType::ConfigSetting,
12137            9 => LedgerEntryType::Ttl,
12138            #[allow(unreachable_patterns)]
12139            _ => return Err(Error::Invalid),
12140        };
12141        Ok(e)
12142    }
12143}
12144
12145impl From<LedgerEntryType> for i32 {
12146    #[must_use]
12147    fn from(e: LedgerEntryType) -> Self {
12148        e as Self
12149    }
12150}
12151
12152impl ReadXdr for LedgerEntryType {
12153    #[cfg(feature = "std")]
12154    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
12155        r.with_limited_depth(|r| {
12156            let e = i32::read_xdr(r)?;
12157            let v: Self = e.try_into()?;
12158            Ok(v)
12159        })
12160    }
12161}
12162
12163impl WriteXdr for LedgerEntryType {
12164    #[cfg(feature = "std")]
12165    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
12166        w.with_limited_depth(|w| {
12167            let i: i32 = (*self).into();
12168            i.write_xdr(w)
12169        })
12170    }
12171}
12172
12173/// Signer is an XDR Struct defines as:
12174///
12175/// ```text
12176/// struct Signer
12177/// {
12178///     SignerKey key;
12179///     uint32 weight; // really only need 1 byte
12180/// };
12181/// ```
12182///
12183#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
12184#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
12185#[cfg_attr(
12186    all(feature = "serde", feature = "alloc"),
12187    derive(serde::Serialize, serde::Deserialize),
12188    serde(rename_all = "snake_case")
12189)]
12190#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
12191pub struct Signer {
12192    pub key: SignerKey,
12193    pub weight: u32,
12194}
12195
12196impl ReadXdr for Signer {
12197    #[cfg(feature = "std")]
12198    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
12199        r.with_limited_depth(|r| {
12200            Ok(Self {
12201                key: SignerKey::read_xdr(r)?,
12202                weight: u32::read_xdr(r)?,
12203            })
12204        })
12205    }
12206}
12207
12208impl WriteXdr for Signer {
12209    #[cfg(feature = "std")]
12210    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
12211        w.with_limited_depth(|w| {
12212            self.key.write_xdr(w)?;
12213            self.weight.write_xdr(w)?;
12214            Ok(())
12215        })
12216    }
12217}
12218
12219/// AccountFlags is an XDR Enum defines as:
12220///
12221/// ```text
12222/// enum AccountFlags
12223/// { // masks for each flag
12224///
12225///     // Flags set on issuer accounts
12226///     // TrustLines are created with authorized set to "false" requiring
12227///     // the issuer to set it for each TrustLine
12228///     AUTH_REQUIRED_FLAG = 0x1,
12229///     // If set, the authorized flag in TrustLines can be cleared
12230///     // otherwise, authorization cannot be revoked
12231///     AUTH_REVOCABLE_FLAG = 0x2,
12232///     // Once set, causes all AUTH_* flags to be read-only
12233///     AUTH_IMMUTABLE_FLAG = 0x4,
12234///     // Trustlines are created with clawback enabled set to "true",
12235///     // and claimable balances created from those trustlines are created
12236///     // with clawback enabled set to "true"
12237///     AUTH_CLAWBACK_ENABLED_FLAG = 0x8
12238/// };
12239/// ```
12240///
12241// enum
12242#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
12243#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
12244#[cfg_attr(
12245    all(feature = "serde", feature = "alloc"),
12246    derive(serde::Serialize, serde::Deserialize),
12247    serde(rename_all = "snake_case")
12248)]
12249#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
12250#[repr(i32)]
12251pub enum AccountFlags {
12252    RequiredFlag = 1,
12253    RevocableFlag = 2,
12254    ImmutableFlag = 4,
12255    ClawbackEnabledFlag = 8,
12256}
12257
12258impl AccountFlags {
12259    pub const VARIANTS: [AccountFlags; 4] = [
12260        AccountFlags::RequiredFlag,
12261        AccountFlags::RevocableFlag,
12262        AccountFlags::ImmutableFlag,
12263        AccountFlags::ClawbackEnabledFlag,
12264    ];
12265    pub const VARIANTS_STR: [&'static str; 4] = [
12266        "RequiredFlag",
12267        "RevocableFlag",
12268        "ImmutableFlag",
12269        "ClawbackEnabledFlag",
12270    ];
12271
12272    #[must_use]
12273    pub const fn name(&self) -> &'static str {
12274        match self {
12275            Self::RequiredFlag => "RequiredFlag",
12276            Self::RevocableFlag => "RevocableFlag",
12277            Self::ImmutableFlag => "ImmutableFlag",
12278            Self::ClawbackEnabledFlag => "ClawbackEnabledFlag",
12279        }
12280    }
12281
12282    #[must_use]
12283    pub const fn variants() -> [AccountFlags; 4] {
12284        Self::VARIANTS
12285    }
12286}
12287
12288impl Name for AccountFlags {
12289    #[must_use]
12290    fn name(&self) -> &'static str {
12291        Self::name(self)
12292    }
12293}
12294
12295impl Variants<AccountFlags> for AccountFlags {
12296    fn variants() -> slice::Iter<'static, AccountFlags> {
12297        Self::VARIANTS.iter()
12298    }
12299}
12300
12301impl Enum for AccountFlags {}
12302
12303impl fmt::Display for AccountFlags {
12304    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
12305        f.write_str(self.name())
12306    }
12307}
12308
12309impl TryFrom<i32> for AccountFlags {
12310    type Error = Error;
12311
12312    fn try_from(i: i32) -> Result<Self> {
12313        let e = match i {
12314            1 => AccountFlags::RequiredFlag,
12315            2 => AccountFlags::RevocableFlag,
12316            4 => AccountFlags::ImmutableFlag,
12317            8 => AccountFlags::ClawbackEnabledFlag,
12318            #[allow(unreachable_patterns)]
12319            _ => return Err(Error::Invalid),
12320        };
12321        Ok(e)
12322    }
12323}
12324
12325impl From<AccountFlags> for i32 {
12326    #[must_use]
12327    fn from(e: AccountFlags) -> Self {
12328        e as Self
12329    }
12330}
12331
12332impl ReadXdr for AccountFlags {
12333    #[cfg(feature = "std")]
12334    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
12335        r.with_limited_depth(|r| {
12336            let e = i32::read_xdr(r)?;
12337            let v: Self = e.try_into()?;
12338            Ok(v)
12339        })
12340    }
12341}
12342
12343impl WriteXdr for AccountFlags {
12344    #[cfg(feature = "std")]
12345    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
12346        w.with_limited_depth(|w| {
12347            let i: i32 = (*self).into();
12348            i.write_xdr(w)
12349        })
12350    }
12351}
12352
12353/// MaskAccountFlags is an XDR Const defines as:
12354///
12355/// ```text
12356/// const MASK_ACCOUNT_FLAGS = 0x7;
12357/// ```
12358///
12359pub const MASK_ACCOUNT_FLAGS: u64 = 0x7;
12360
12361/// MaskAccountFlagsV17 is an XDR Const defines as:
12362///
12363/// ```text
12364/// const MASK_ACCOUNT_FLAGS_V17 = 0xF;
12365/// ```
12366///
12367pub const MASK_ACCOUNT_FLAGS_V17: u64 = 0xF;
12368
12369/// MaxSigners is an XDR Const defines as:
12370///
12371/// ```text
12372/// const MAX_SIGNERS = 20;
12373/// ```
12374///
12375pub const MAX_SIGNERS: u64 = 20;
12376
12377/// SponsorshipDescriptor is an XDR Typedef defines as:
12378///
12379/// ```text
12380/// typedef AccountID* SponsorshipDescriptor;
12381/// ```
12382///
12383#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
12384#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
12385#[cfg_attr(
12386    all(feature = "serde", feature = "alloc"),
12387    derive(serde::Serialize, serde::Deserialize),
12388    serde(rename_all = "snake_case")
12389)]
12390#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
12391#[derive(Debug)]
12392pub struct SponsorshipDescriptor(pub Option<AccountId>);
12393
12394impl From<SponsorshipDescriptor> for Option<AccountId> {
12395    #[must_use]
12396    fn from(x: SponsorshipDescriptor) -> Self {
12397        x.0
12398    }
12399}
12400
12401impl From<Option<AccountId>> for SponsorshipDescriptor {
12402    #[must_use]
12403    fn from(x: Option<AccountId>) -> Self {
12404        SponsorshipDescriptor(x)
12405    }
12406}
12407
12408impl AsRef<Option<AccountId>> for SponsorshipDescriptor {
12409    #[must_use]
12410    fn as_ref(&self) -> &Option<AccountId> {
12411        &self.0
12412    }
12413}
12414
12415impl ReadXdr for SponsorshipDescriptor {
12416    #[cfg(feature = "std")]
12417    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
12418        r.with_limited_depth(|r| {
12419            let i = Option::<AccountId>::read_xdr(r)?;
12420            let v = SponsorshipDescriptor(i);
12421            Ok(v)
12422        })
12423    }
12424}
12425
12426impl WriteXdr for SponsorshipDescriptor {
12427    #[cfg(feature = "std")]
12428    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
12429        w.with_limited_depth(|w| self.0.write_xdr(w))
12430    }
12431}
12432
12433/// AccountEntryExtensionV3 is an XDR Struct defines as:
12434///
12435/// ```text
12436/// struct AccountEntryExtensionV3
12437/// {
12438///     // We can use this to add more fields, or because it is first, to
12439///     // change AccountEntryExtensionV3 into a union.
12440///     ExtensionPoint ext;
12441///
12442///     // Ledger number at which `seqNum` took on its present value.
12443///     uint32 seqLedger;
12444///
12445///     // Time at which `seqNum` took on its present value.
12446///     TimePoint seqTime;
12447/// };
12448/// ```
12449///
12450#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
12451#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
12452#[cfg_attr(
12453    all(feature = "serde", feature = "alloc"),
12454    derive(serde::Serialize, serde::Deserialize),
12455    serde(rename_all = "snake_case")
12456)]
12457#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
12458pub struct AccountEntryExtensionV3 {
12459    pub ext: ExtensionPoint,
12460    pub seq_ledger: u32,
12461    pub seq_time: TimePoint,
12462}
12463
12464impl ReadXdr for AccountEntryExtensionV3 {
12465    #[cfg(feature = "std")]
12466    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
12467        r.with_limited_depth(|r| {
12468            Ok(Self {
12469                ext: ExtensionPoint::read_xdr(r)?,
12470                seq_ledger: u32::read_xdr(r)?,
12471                seq_time: TimePoint::read_xdr(r)?,
12472            })
12473        })
12474    }
12475}
12476
12477impl WriteXdr for AccountEntryExtensionV3 {
12478    #[cfg(feature = "std")]
12479    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
12480        w.with_limited_depth(|w| {
12481            self.ext.write_xdr(w)?;
12482            self.seq_ledger.write_xdr(w)?;
12483            self.seq_time.write_xdr(w)?;
12484            Ok(())
12485        })
12486    }
12487}
12488
12489/// AccountEntryExtensionV2Ext is an XDR NestedUnion defines as:
12490///
12491/// ```text
12492/// union switch (int v)
12493///     {
12494///     case 0:
12495///         void;
12496///     case 3:
12497///         AccountEntryExtensionV3 v3;
12498///     }
12499/// ```
12500///
12501// union with discriminant i32
12502#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
12503#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
12504#[cfg_attr(
12505    all(feature = "serde", feature = "alloc"),
12506    derive(serde::Serialize, serde::Deserialize),
12507    serde(rename_all = "snake_case")
12508)]
12509#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
12510#[allow(clippy::large_enum_variant)]
12511pub enum AccountEntryExtensionV2Ext {
12512    V0,
12513    V3(AccountEntryExtensionV3),
12514}
12515
12516impl AccountEntryExtensionV2Ext {
12517    pub const VARIANTS: [i32; 2] = [0, 3];
12518    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V3"];
12519
12520    #[must_use]
12521    pub const fn name(&self) -> &'static str {
12522        match self {
12523            Self::V0 => "V0",
12524            Self::V3(_) => "V3",
12525        }
12526    }
12527
12528    #[must_use]
12529    pub const fn discriminant(&self) -> i32 {
12530        #[allow(clippy::match_same_arms)]
12531        match self {
12532            Self::V0 => 0,
12533            Self::V3(_) => 3,
12534        }
12535    }
12536
12537    #[must_use]
12538    pub const fn variants() -> [i32; 2] {
12539        Self::VARIANTS
12540    }
12541}
12542
12543impl Name for AccountEntryExtensionV2Ext {
12544    #[must_use]
12545    fn name(&self) -> &'static str {
12546        Self::name(self)
12547    }
12548}
12549
12550impl Discriminant<i32> for AccountEntryExtensionV2Ext {
12551    #[must_use]
12552    fn discriminant(&self) -> i32 {
12553        Self::discriminant(self)
12554    }
12555}
12556
12557impl Variants<i32> for AccountEntryExtensionV2Ext {
12558    fn variants() -> slice::Iter<'static, i32> {
12559        Self::VARIANTS.iter()
12560    }
12561}
12562
12563impl Union<i32> for AccountEntryExtensionV2Ext {}
12564
12565impl ReadXdr for AccountEntryExtensionV2Ext {
12566    #[cfg(feature = "std")]
12567    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
12568        r.with_limited_depth(|r| {
12569            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
12570            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
12571            let v = match dv {
12572                0 => Self::V0,
12573                3 => Self::V3(AccountEntryExtensionV3::read_xdr(r)?),
12574                #[allow(unreachable_patterns)]
12575                _ => return Err(Error::Invalid),
12576            };
12577            Ok(v)
12578        })
12579    }
12580}
12581
12582impl WriteXdr for AccountEntryExtensionV2Ext {
12583    #[cfg(feature = "std")]
12584    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
12585        w.with_limited_depth(|w| {
12586            self.discriminant().write_xdr(w)?;
12587            #[allow(clippy::match_same_arms)]
12588            match self {
12589                Self::V0 => ().write_xdr(w)?,
12590                Self::V3(v) => v.write_xdr(w)?,
12591            };
12592            Ok(())
12593        })
12594    }
12595}
12596
12597/// AccountEntryExtensionV2 is an XDR Struct defines as:
12598///
12599/// ```text
12600/// struct AccountEntryExtensionV2
12601/// {
12602///     uint32 numSponsored;
12603///     uint32 numSponsoring;
12604///     SponsorshipDescriptor signerSponsoringIDs<MAX_SIGNERS>;
12605///
12606///     union switch (int v)
12607///     {
12608///     case 0:
12609///         void;
12610///     case 3:
12611///         AccountEntryExtensionV3 v3;
12612///     }
12613///     ext;
12614/// };
12615/// ```
12616///
12617#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
12618#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
12619#[cfg_attr(
12620    all(feature = "serde", feature = "alloc"),
12621    derive(serde::Serialize, serde::Deserialize),
12622    serde(rename_all = "snake_case")
12623)]
12624#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
12625pub struct AccountEntryExtensionV2 {
12626    pub num_sponsored: u32,
12627    pub num_sponsoring: u32,
12628    pub signer_sponsoring_i_ds: VecM<SponsorshipDescriptor, 20>,
12629    pub ext: AccountEntryExtensionV2Ext,
12630}
12631
12632impl ReadXdr for AccountEntryExtensionV2 {
12633    #[cfg(feature = "std")]
12634    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
12635        r.with_limited_depth(|r| {
12636            Ok(Self {
12637                num_sponsored: u32::read_xdr(r)?,
12638                num_sponsoring: u32::read_xdr(r)?,
12639                signer_sponsoring_i_ds: VecM::<SponsorshipDescriptor, 20>::read_xdr(r)?,
12640                ext: AccountEntryExtensionV2Ext::read_xdr(r)?,
12641            })
12642        })
12643    }
12644}
12645
12646impl WriteXdr for AccountEntryExtensionV2 {
12647    #[cfg(feature = "std")]
12648    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
12649        w.with_limited_depth(|w| {
12650            self.num_sponsored.write_xdr(w)?;
12651            self.num_sponsoring.write_xdr(w)?;
12652            self.signer_sponsoring_i_ds.write_xdr(w)?;
12653            self.ext.write_xdr(w)?;
12654            Ok(())
12655        })
12656    }
12657}
12658
12659/// AccountEntryExtensionV1Ext is an XDR NestedUnion defines as:
12660///
12661/// ```text
12662/// union switch (int v)
12663///     {
12664///     case 0:
12665///         void;
12666///     case 2:
12667///         AccountEntryExtensionV2 v2;
12668///     }
12669/// ```
12670///
12671// union with discriminant i32
12672#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
12673#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
12674#[cfg_attr(
12675    all(feature = "serde", feature = "alloc"),
12676    derive(serde::Serialize, serde::Deserialize),
12677    serde(rename_all = "snake_case")
12678)]
12679#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
12680#[allow(clippy::large_enum_variant)]
12681pub enum AccountEntryExtensionV1Ext {
12682    V0,
12683    V2(AccountEntryExtensionV2),
12684}
12685
12686impl AccountEntryExtensionV1Ext {
12687    pub const VARIANTS: [i32; 2] = [0, 2];
12688    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V2"];
12689
12690    #[must_use]
12691    pub const fn name(&self) -> &'static str {
12692        match self {
12693            Self::V0 => "V0",
12694            Self::V2(_) => "V2",
12695        }
12696    }
12697
12698    #[must_use]
12699    pub const fn discriminant(&self) -> i32 {
12700        #[allow(clippy::match_same_arms)]
12701        match self {
12702            Self::V0 => 0,
12703            Self::V2(_) => 2,
12704        }
12705    }
12706
12707    #[must_use]
12708    pub const fn variants() -> [i32; 2] {
12709        Self::VARIANTS
12710    }
12711}
12712
12713impl Name for AccountEntryExtensionV1Ext {
12714    #[must_use]
12715    fn name(&self) -> &'static str {
12716        Self::name(self)
12717    }
12718}
12719
12720impl Discriminant<i32> for AccountEntryExtensionV1Ext {
12721    #[must_use]
12722    fn discriminant(&self) -> i32 {
12723        Self::discriminant(self)
12724    }
12725}
12726
12727impl Variants<i32> for AccountEntryExtensionV1Ext {
12728    fn variants() -> slice::Iter<'static, i32> {
12729        Self::VARIANTS.iter()
12730    }
12731}
12732
12733impl Union<i32> for AccountEntryExtensionV1Ext {}
12734
12735impl ReadXdr for AccountEntryExtensionV1Ext {
12736    #[cfg(feature = "std")]
12737    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
12738        r.with_limited_depth(|r| {
12739            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
12740            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
12741            let v = match dv {
12742                0 => Self::V0,
12743                2 => Self::V2(AccountEntryExtensionV2::read_xdr(r)?),
12744                #[allow(unreachable_patterns)]
12745                _ => return Err(Error::Invalid),
12746            };
12747            Ok(v)
12748        })
12749    }
12750}
12751
12752impl WriteXdr for AccountEntryExtensionV1Ext {
12753    #[cfg(feature = "std")]
12754    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
12755        w.with_limited_depth(|w| {
12756            self.discriminant().write_xdr(w)?;
12757            #[allow(clippy::match_same_arms)]
12758            match self {
12759                Self::V0 => ().write_xdr(w)?,
12760                Self::V2(v) => v.write_xdr(w)?,
12761            };
12762            Ok(())
12763        })
12764    }
12765}
12766
12767/// AccountEntryExtensionV1 is an XDR Struct defines as:
12768///
12769/// ```text
12770/// struct AccountEntryExtensionV1
12771/// {
12772///     Liabilities liabilities;
12773///
12774///     union switch (int v)
12775///     {
12776///     case 0:
12777///         void;
12778///     case 2:
12779///         AccountEntryExtensionV2 v2;
12780///     }
12781///     ext;
12782/// };
12783/// ```
12784///
12785#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
12786#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
12787#[cfg_attr(
12788    all(feature = "serde", feature = "alloc"),
12789    derive(serde::Serialize, serde::Deserialize),
12790    serde(rename_all = "snake_case")
12791)]
12792#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
12793pub struct AccountEntryExtensionV1 {
12794    pub liabilities: Liabilities,
12795    pub ext: AccountEntryExtensionV1Ext,
12796}
12797
12798impl ReadXdr for AccountEntryExtensionV1 {
12799    #[cfg(feature = "std")]
12800    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
12801        r.with_limited_depth(|r| {
12802            Ok(Self {
12803                liabilities: Liabilities::read_xdr(r)?,
12804                ext: AccountEntryExtensionV1Ext::read_xdr(r)?,
12805            })
12806        })
12807    }
12808}
12809
12810impl WriteXdr for AccountEntryExtensionV1 {
12811    #[cfg(feature = "std")]
12812    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
12813        w.with_limited_depth(|w| {
12814            self.liabilities.write_xdr(w)?;
12815            self.ext.write_xdr(w)?;
12816            Ok(())
12817        })
12818    }
12819}
12820
12821/// AccountEntryExt is an XDR NestedUnion defines as:
12822///
12823/// ```text
12824/// union switch (int v)
12825///     {
12826///     case 0:
12827///         void;
12828///     case 1:
12829///         AccountEntryExtensionV1 v1;
12830///     }
12831/// ```
12832///
12833// union with discriminant i32
12834#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
12835#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
12836#[cfg_attr(
12837    all(feature = "serde", feature = "alloc"),
12838    derive(serde::Serialize, serde::Deserialize),
12839    serde(rename_all = "snake_case")
12840)]
12841#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
12842#[allow(clippy::large_enum_variant)]
12843pub enum AccountEntryExt {
12844    V0,
12845    V1(AccountEntryExtensionV1),
12846}
12847
12848impl AccountEntryExt {
12849    pub const VARIANTS: [i32; 2] = [0, 1];
12850    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"];
12851
12852    #[must_use]
12853    pub const fn name(&self) -> &'static str {
12854        match self {
12855            Self::V0 => "V0",
12856            Self::V1(_) => "V1",
12857        }
12858    }
12859
12860    #[must_use]
12861    pub const fn discriminant(&self) -> i32 {
12862        #[allow(clippy::match_same_arms)]
12863        match self {
12864            Self::V0 => 0,
12865            Self::V1(_) => 1,
12866        }
12867    }
12868
12869    #[must_use]
12870    pub const fn variants() -> [i32; 2] {
12871        Self::VARIANTS
12872    }
12873}
12874
12875impl Name for AccountEntryExt {
12876    #[must_use]
12877    fn name(&self) -> &'static str {
12878        Self::name(self)
12879    }
12880}
12881
12882impl Discriminant<i32> for AccountEntryExt {
12883    #[must_use]
12884    fn discriminant(&self) -> i32 {
12885        Self::discriminant(self)
12886    }
12887}
12888
12889impl Variants<i32> for AccountEntryExt {
12890    fn variants() -> slice::Iter<'static, i32> {
12891        Self::VARIANTS.iter()
12892    }
12893}
12894
12895impl Union<i32> for AccountEntryExt {}
12896
12897impl ReadXdr for AccountEntryExt {
12898    #[cfg(feature = "std")]
12899    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
12900        r.with_limited_depth(|r| {
12901            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
12902            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
12903            let v = match dv {
12904                0 => Self::V0,
12905                1 => Self::V1(AccountEntryExtensionV1::read_xdr(r)?),
12906                #[allow(unreachable_patterns)]
12907                _ => return Err(Error::Invalid),
12908            };
12909            Ok(v)
12910        })
12911    }
12912}
12913
12914impl WriteXdr for AccountEntryExt {
12915    #[cfg(feature = "std")]
12916    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
12917        w.with_limited_depth(|w| {
12918            self.discriminant().write_xdr(w)?;
12919            #[allow(clippy::match_same_arms)]
12920            match self {
12921                Self::V0 => ().write_xdr(w)?,
12922                Self::V1(v) => v.write_xdr(w)?,
12923            };
12924            Ok(())
12925        })
12926    }
12927}
12928
12929/// AccountEntry is an XDR Struct defines as:
12930///
12931/// ```text
12932/// struct AccountEntry
12933/// {
12934///     AccountID accountID;      // master public key for this account
12935///     int64 balance;            // in stroops
12936///     SequenceNumber seqNum;    // last sequence number used for this account
12937///     uint32 numSubEntries;     // number of sub-entries this account has
12938///                               // drives the reserve
12939///     AccountID* inflationDest; // Account to vote for during inflation
12940///     uint32 flags;             // see AccountFlags
12941///
12942///     string32 homeDomain; // can be used for reverse federation and memo lookup
12943///
12944///     // fields used for signatures
12945///     // thresholds stores unsigned bytes: [weight of master|low|medium|high]
12946///     Thresholds thresholds;
12947///
12948///     Signer signers<MAX_SIGNERS>; // possible signers for this account
12949///
12950///     // reserved for future use
12951///     union switch (int v)
12952///     {
12953///     case 0:
12954///         void;
12955///     case 1:
12956///         AccountEntryExtensionV1 v1;
12957///     }
12958///     ext;
12959/// };
12960/// ```
12961///
12962#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
12963#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
12964#[cfg_attr(
12965    all(feature = "serde", feature = "alloc"),
12966    derive(serde::Serialize, serde::Deserialize),
12967    serde(rename_all = "snake_case")
12968)]
12969#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
12970pub struct AccountEntry {
12971    pub account_id: AccountId,
12972    pub balance: i64,
12973    pub seq_num: SequenceNumber,
12974    pub num_sub_entries: u32,
12975    pub inflation_dest: Option<AccountId>,
12976    pub flags: u32,
12977    pub home_domain: String32,
12978    pub thresholds: Thresholds,
12979    pub signers: VecM<Signer, 20>,
12980    pub ext: AccountEntryExt,
12981}
12982
12983impl ReadXdr for AccountEntry {
12984    #[cfg(feature = "std")]
12985    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
12986        r.with_limited_depth(|r| {
12987            Ok(Self {
12988                account_id: AccountId::read_xdr(r)?,
12989                balance: i64::read_xdr(r)?,
12990                seq_num: SequenceNumber::read_xdr(r)?,
12991                num_sub_entries: u32::read_xdr(r)?,
12992                inflation_dest: Option::<AccountId>::read_xdr(r)?,
12993                flags: u32::read_xdr(r)?,
12994                home_domain: String32::read_xdr(r)?,
12995                thresholds: Thresholds::read_xdr(r)?,
12996                signers: VecM::<Signer, 20>::read_xdr(r)?,
12997                ext: AccountEntryExt::read_xdr(r)?,
12998            })
12999        })
13000    }
13001}
13002
13003impl WriteXdr for AccountEntry {
13004    #[cfg(feature = "std")]
13005    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
13006        w.with_limited_depth(|w| {
13007            self.account_id.write_xdr(w)?;
13008            self.balance.write_xdr(w)?;
13009            self.seq_num.write_xdr(w)?;
13010            self.num_sub_entries.write_xdr(w)?;
13011            self.inflation_dest.write_xdr(w)?;
13012            self.flags.write_xdr(w)?;
13013            self.home_domain.write_xdr(w)?;
13014            self.thresholds.write_xdr(w)?;
13015            self.signers.write_xdr(w)?;
13016            self.ext.write_xdr(w)?;
13017            Ok(())
13018        })
13019    }
13020}
13021
13022/// TrustLineFlags is an XDR Enum defines as:
13023///
13024/// ```text
13025/// enum TrustLineFlags
13026/// {
13027///     // issuer has authorized account to perform transactions with its credit
13028///     AUTHORIZED_FLAG = 1,
13029///     // issuer has authorized account to maintain and reduce liabilities for its
13030///     // credit
13031///     AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG = 2,
13032///     // issuer has specified that it may clawback its credit, and that claimable
13033///     // balances created with its credit may also be clawed back
13034///     TRUSTLINE_CLAWBACK_ENABLED_FLAG = 4
13035/// };
13036/// ```
13037///
13038// enum
13039#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
13040#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
13041#[cfg_attr(
13042    all(feature = "serde", feature = "alloc"),
13043    derive(serde::Serialize, serde::Deserialize),
13044    serde(rename_all = "snake_case")
13045)]
13046#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
13047#[repr(i32)]
13048pub enum TrustLineFlags {
13049    AuthorizedFlag = 1,
13050    AuthorizedToMaintainLiabilitiesFlag = 2,
13051    TrustlineClawbackEnabledFlag = 4,
13052}
13053
13054impl TrustLineFlags {
13055    pub const VARIANTS: [TrustLineFlags; 3] = [
13056        TrustLineFlags::AuthorizedFlag,
13057        TrustLineFlags::AuthorizedToMaintainLiabilitiesFlag,
13058        TrustLineFlags::TrustlineClawbackEnabledFlag,
13059    ];
13060    pub const VARIANTS_STR: [&'static str; 3] = [
13061        "AuthorizedFlag",
13062        "AuthorizedToMaintainLiabilitiesFlag",
13063        "TrustlineClawbackEnabledFlag",
13064    ];
13065
13066    #[must_use]
13067    pub const fn name(&self) -> &'static str {
13068        match self {
13069            Self::AuthorizedFlag => "AuthorizedFlag",
13070            Self::AuthorizedToMaintainLiabilitiesFlag => "AuthorizedToMaintainLiabilitiesFlag",
13071            Self::TrustlineClawbackEnabledFlag => "TrustlineClawbackEnabledFlag",
13072        }
13073    }
13074
13075    #[must_use]
13076    pub const fn variants() -> [TrustLineFlags; 3] {
13077        Self::VARIANTS
13078    }
13079}
13080
13081impl Name for TrustLineFlags {
13082    #[must_use]
13083    fn name(&self) -> &'static str {
13084        Self::name(self)
13085    }
13086}
13087
13088impl Variants<TrustLineFlags> for TrustLineFlags {
13089    fn variants() -> slice::Iter<'static, TrustLineFlags> {
13090        Self::VARIANTS.iter()
13091    }
13092}
13093
13094impl Enum for TrustLineFlags {}
13095
13096impl fmt::Display for TrustLineFlags {
13097    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
13098        f.write_str(self.name())
13099    }
13100}
13101
13102impl TryFrom<i32> for TrustLineFlags {
13103    type Error = Error;
13104
13105    fn try_from(i: i32) -> Result<Self> {
13106        let e = match i {
13107            1 => TrustLineFlags::AuthorizedFlag,
13108            2 => TrustLineFlags::AuthorizedToMaintainLiabilitiesFlag,
13109            4 => TrustLineFlags::TrustlineClawbackEnabledFlag,
13110            #[allow(unreachable_patterns)]
13111            _ => return Err(Error::Invalid),
13112        };
13113        Ok(e)
13114    }
13115}
13116
13117impl From<TrustLineFlags> for i32 {
13118    #[must_use]
13119    fn from(e: TrustLineFlags) -> Self {
13120        e as Self
13121    }
13122}
13123
13124impl ReadXdr for TrustLineFlags {
13125    #[cfg(feature = "std")]
13126    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
13127        r.with_limited_depth(|r| {
13128            let e = i32::read_xdr(r)?;
13129            let v: Self = e.try_into()?;
13130            Ok(v)
13131        })
13132    }
13133}
13134
13135impl WriteXdr for TrustLineFlags {
13136    #[cfg(feature = "std")]
13137    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
13138        w.with_limited_depth(|w| {
13139            let i: i32 = (*self).into();
13140            i.write_xdr(w)
13141        })
13142    }
13143}
13144
13145/// MaskTrustlineFlags is an XDR Const defines as:
13146///
13147/// ```text
13148/// const MASK_TRUSTLINE_FLAGS = 1;
13149/// ```
13150///
13151pub const MASK_TRUSTLINE_FLAGS: u64 = 1;
13152
13153/// MaskTrustlineFlagsV13 is an XDR Const defines as:
13154///
13155/// ```text
13156/// const MASK_TRUSTLINE_FLAGS_V13 = 3;
13157/// ```
13158///
13159pub const MASK_TRUSTLINE_FLAGS_V13: u64 = 3;
13160
13161/// MaskTrustlineFlagsV17 is an XDR Const defines as:
13162///
13163/// ```text
13164/// const MASK_TRUSTLINE_FLAGS_V17 = 7;
13165/// ```
13166///
13167pub const MASK_TRUSTLINE_FLAGS_V17: u64 = 7;
13168
13169/// LiquidityPoolType is an XDR Enum defines as:
13170///
13171/// ```text
13172/// enum LiquidityPoolType
13173/// {
13174///     LIQUIDITY_POOL_CONSTANT_PRODUCT = 0
13175/// };
13176/// ```
13177///
13178// enum
13179#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
13180#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
13181#[cfg_attr(
13182    all(feature = "serde", feature = "alloc"),
13183    derive(serde::Serialize, serde::Deserialize),
13184    serde(rename_all = "snake_case")
13185)]
13186#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
13187#[repr(i32)]
13188pub enum LiquidityPoolType {
13189    LiquidityPoolConstantProduct = 0,
13190}
13191
13192impl LiquidityPoolType {
13193    pub const VARIANTS: [LiquidityPoolType; 1] = [LiquidityPoolType::LiquidityPoolConstantProduct];
13194    pub const VARIANTS_STR: [&'static str; 1] = ["LiquidityPoolConstantProduct"];
13195
13196    #[must_use]
13197    pub const fn name(&self) -> &'static str {
13198        match self {
13199            Self::LiquidityPoolConstantProduct => "LiquidityPoolConstantProduct",
13200        }
13201    }
13202
13203    #[must_use]
13204    pub const fn variants() -> [LiquidityPoolType; 1] {
13205        Self::VARIANTS
13206    }
13207}
13208
13209impl Name for LiquidityPoolType {
13210    #[must_use]
13211    fn name(&self) -> &'static str {
13212        Self::name(self)
13213    }
13214}
13215
13216impl Variants<LiquidityPoolType> for LiquidityPoolType {
13217    fn variants() -> slice::Iter<'static, LiquidityPoolType> {
13218        Self::VARIANTS.iter()
13219    }
13220}
13221
13222impl Enum for LiquidityPoolType {}
13223
13224impl fmt::Display for LiquidityPoolType {
13225    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
13226        f.write_str(self.name())
13227    }
13228}
13229
13230impl TryFrom<i32> for LiquidityPoolType {
13231    type Error = Error;
13232
13233    fn try_from(i: i32) -> Result<Self> {
13234        let e = match i {
13235            0 => LiquidityPoolType::LiquidityPoolConstantProduct,
13236            #[allow(unreachable_patterns)]
13237            _ => return Err(Error::Invalid),
13238        };
13239        Ok(e)
13240    }
13241}
13242
13243impl From<LiquidityPoolType> for i32 {
13244    #[must_use]
13245    fn from(e: LiquidityPoolType) -> Self {
13246        e as Self
13247    }
13248}
13249
13250impl ReadXdr for LiquidityPoolType {
13251    #[cfg(feature = "std")]
13252    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
13253        r.with_limited_depth(|r| {
13254            let e = i32::read_xdr(r)?;
13255            let v: Self = e.try_into()?;
13256            Ok(v)
13257        })
13258    }
13259}
13260
13261impl WriteXdr for LiquidityPoolType {
13262    #[cfg(feature = "std")]
13263    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
13264        w.with_limited_depth(|w| {
13265            let i: i32 = (*self).into();
13266            i.write_xdr(w)
13267        })
13268    }
13269}
13270
13271/// TrustLineAsset is an XDR Union defines as:
13272///
13273/// ```text
13274/// union TrustLineAsset switch (AssetType type)
13275/// {
13276/// case ASSET_TYPE_NATIVE: // Not credit
13277///     void;
13278///
13279/// case ASSET_TYPE_CREDIT_ALPHANUM4:
13280///     AlphaNum4 alphaNum4;
13281///
13282/// case ASSET_TYPE_CREDIT_ALPHANUM12:
13283///     AlphaNum12 alphaNum12;
13284///
13285/// case ASSET_TYPE_POOL_SHARE:
13286///     PoolID liquidityPoolID;
13287///
13288///     // add other asset types here in the future
13289/// };
13290/// ```
13291///
13292// union with discriminant AssetType
13293#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
13294#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
13295#[cfg_attr(
13296    all(feature = "serde", feature = "alloc"),
13297    derive(serde::Serialize, serde::Deserialize),
13298    serde(rename_all = "snake_case")
13299)]
13300#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
13301#[allow(clippy::large_enum_variant)]
13302pub enum TrustLineAsset {
13303    Native,
13304    CreditAlphanum4(AlphaNum4),
13305    CreditAlphanum12(AlphaNum12),
13306    PoolShare(PoolId),
13307}
13308
13309impl TrustLineAsset {
13310    pub const VARIANTS: [AssetType; 4] = [
13311        AssetType::Native,
13312        AssetType::CreditAlphanum4,
13313        AssetType::CreditAlphanum12,
13314        AssetType::PoolShare,
13315    ];
13316    pub const VARIANTS_STR: [&'static str; 4] =
13317        ["Native", "CreditAlphanum4", "CreditAlphanum12", "PoolShare"];
13318
13319    #[must_use]
13320    pub const fn name(&self) -> &'static str {
13321        match self {
13322            Self::Native => "Native",
13323            Self::CreditAlphanum4(_) => "CreditAlphanum4",
13324            Self::CreditAlphanum12(_) => "CreditAlphanum12",
13325            Self::PoolShare(_) => "PoolShare",
13326        }
13327    }
13328
13329    #[must_use]
13330    pub const fn discriminant(&self) -> AssetType {
13331        #[allow(clippy::match_same_arms)]
13332        match self {
13333            Self::Native => AssetType::Native,
13334            Self::CreditAlphanum4(_) => AssetType::CreditAlphanum4,
13335            Self::CreditAlphanum12(_) => AssetType::CreditAlphanum12,
13336            Self::PoolShare(_) => AssetType::PoolShare,
13337        }
13338    }
13339
13340    #[must_use]
13341    pub const fn variants() -> [AssetType; 4] {
13342        Self::VARIANTS
13343    }
13344}
13345
13346impl Name for TrustLineAsset {
13347    #[must_use]
13348    fn name(&self) -> &'static str {
13349        Self::name(self)
13350    }
13351}
13352
13353impl Discriminant<AssetType> for TrustLineAsset {
13354    #[must_use]
13355    fn discriminant(&self) -> AssetType {
13356        Self::discriminant(self)
13357    }
13358}
13359
13360impl Variants<AssetType> for TrustLineAsset {
13361    fn variants() -> slice::Iter<'static, AssetType> {
13362        Self::VARIANTS.iter()
13363    }
13364}
13365
13366impl Union<AssetType> for TrustLineAsset {}
13367
13368impl ReadXdr for TrustLineAsset {
13369    #[cfg(feature = "std")]
13370    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
13371        r.with_limited_depth(|r| {
13372            let dv: AssetType = <AssetType as ReadXdr>::read_xdr(r)?;
13373            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
13374            let v = match dv {
13375                AssetType::Native => Self::Native,
13376                AssetType::CreditAlphanum4 => Self::CreditAlphanum4(AlphaNum4::read_xdr(r)?),
13377                AssetType::CreditAlphanum12 => Self::CreditAlphanum12(AlphaNum12::read_xdr(r)?),
13378                AssetType::PoolShare => Self::PoolShare(PoolId::read_xdr(r)?),
13379                #[allow(unreachable_patterns)]
13380                _ => return Err(Error::Invalid),
13381            };
13382            Ok(v)
13383        })
13384    }
13385}
13386
13387impl WriteXdr for TrustLineAsset {
13388    #[cfg(feature = "std")]
13389    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
13390        w.with_limited_depth(|w| {
13391            self.discriminant().write_xdr(w)?;
13392            #[allow(clippy::match_same_arms)]
13393            match self {
13394                Self::Native => ().write_xdr(w)?,
13395                Self::CreditAlphanum4(v) => v.write_xdr(w)?,
13396                Self::CreditAlphanum12(v) => v.write_xdr(w)?,
13397                Self::PoolShare(v) => v.write_xdr(w)?,
13398            };
13399            Ok(())
13400        })
13401    }
13402}
13403
13404/// TrustLineEntryExtensionV2Ext is an XDR NestedUnion defines as:
13405///
13406/// ```text
13407/// union switch (int v)
13408///     {
13409///     case 0:
13410///         void;
13411///     }
13412/// ```
13413///
13414// union with discriminant i32
13415#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
13416#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
13417#[cfg_attr(
13418    all(feature = "serde", feature = "alloc"),
13419    derive(serde::Serialize, serde::Deserialize),
13420    serde(rename_all = "snake_case")
13421)]
13422#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
13423#[allow(clippy::large_enum_variant)]
13424pub enum TrustLineEntryExtensionV2Ext {
13425    V0,
13426}
13427
13428impl TrustLineEntryExtensionV2Ext {
13429    pub const VARIANTS: [i32; 1] = [0];
13430    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
13431
13432    #[must_use]
13433    pub const fn name(&self) -> &'static str {
13434        match self {
13435            Self::V0 => "V0",
13436        }
13437    }
13438
13439    #[must_use]
13440    pub const fn discriminant(&self) -> i32 {
13441        #[allow(clippy::match_same_arms)]
13442        match self {
13443            Self::V0 => 0,
13444        }
13445    }
13446
13447    #[must_use]
13448    pub const fn variants() -> [i32; 1] {
13449        Self::VARIANTS
13450    }
13451}
13452
13453impl Name for TrustLineEntryExtensionV2Ext {
13454    #[must_use]
13455    fn name(&self) -> &'static str {
13456        Self::name(self)
13457    }
13458}
13459
13460impl Discriminant<i32> for TrustLineEntryExtensionV2Ext {
13461    #[must_use]
13462    fn discriminant(&self) -> i32 {
13463        Self::discriminant(self)
13464    }
13465}
13466
13467impl Variants<i32> for TrustLineEntryExtensionV2Ext {
13468    fn variants() -> slice::Iter<'static, i32> {
13469        Self::VARIANTS.iter()
13470    }
13471}
13472
13473impl Union<i32> for TrustLineEntryExtensionV2Ext {}
13474
13475impl ReadXdr for TrustLineEntryExtensionV2Ext {
13476    #[cfg(feature = "std")]
13477    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
13478        r.with_limited_depth(|r| {
13479            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
13480            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
13481            let v = match dv {
13482                0 => Self::V0,
13483                #[allow(unreachable_patterns)]
13484                _ => return Err(Error::Invalid),
13485            };
13486            Ok(v)
13487        })
13488    }
13489}
13490
13491impl WriteXdr for TrustLineEntryExtensionV2Ext {
13492    #[cfg(feature = "std")]
13493    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
13494        w.with_limited_depth(|w| {
13495            self.discriminant().write_xdr(w)?;
13496            #[allow(clippy::match_same_arms)]
13497            match self {
13498                Self::V0 => ().write_xdr(w)?,
13499            };
13500            Ok(())
13501        })
13502    }
13503}
13504
13505/// TrustLineEntryExtensionV2 is an XDR Struct defines as:
13506///
13507/// ```text
13508/// struct TrustLineEntryExtensionV2
13509/// {
13510///     int32 liquidityPoolUseCount;
13511///
13512///     union switch (int v)
13513///     {
13514///     case 0:
13515///         void;
13516///     }
13517///     ext;
13518/// };
13519/// ```
13520///
13521#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
13522#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
13523#[cfg_attr(
13524    all(feature = "serde", feature = "alloc"),
13525    derive(serde::Serialize, serde::Deserialize),
13526    serde(rename_all = "snake_case")
13527)]
13528#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
13529pub struct TrustLineEntryExtensionV2 {
13530    pub liquidity_pool_use_count: i32,
13531    pub ext: TrustLineEntryExtensionV2Ext,
13532}
13533
13534impl ReadXdr for TrustLineEntryExtensionV2 {
13535    #[cfg(feature = "std")]
13536    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
13537        r.with_limited_depth(|r| {
13538            Ok(Self {
13539                liquidity_pool_use_count: i32::read_xdr(r)?,
13540                ext: TrustLineEntryExtensionV2Ext::read_xdr(r)?,
13541            })
13542        })
13543    }
13544}
13545
13546impl WriteXdr for TrustLineEntryExtensionV2 {
13547    #[cfg(feature = "std")]
13548    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
13549        w.with_limited_depth(|w| {
13550            self.liquidity_pool_use_count.write_xdr(w)?;
13551            self.ext.write_xdr(w)?;
13552            Ok(())
13553        })
13554    }
13555}
13556
13557/// TrustLineEntryV1Ext is an XDR NestedUnion defines as:
13558///
13559/// ```text
13560/// union switch (int v)
13561///             {
13562///             case 0:
13563///                 void;
13564///             case 2:
13565///                 TrustLineEntryExtensionV2 v2;
13566///             }
13567/// ```
13568///
13569// union with discriminant i32
13570#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
13571#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
13572#[cfg_attr(
13573    all(feature = "serde", feature = "alloc"),
13574    derive(serde::Serialize, serde::Deserialize),
13575    serde(rename_all = "snake_case")
13576)]
13577#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
13578#[allow(clippy::large_enum_variant)]
13579pub enum TrustLineEntryV1Ext {
13580    V0,
13581    V2(TrustLineEntryExtensionV2),
13582}
13583
13584impl TrustLineEntryV1Ext {
13585    pub const VARIANTS: [i32; 2] = [0, 2];
13586    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V2"];
13587
13588    #[must_use]
13589    pub const fn name(&self) -> &'static str {
13590        match self {
13591            Self::V0 => "V0",
13592            Self::V2(_) => "V2",
13593        }
13594    }
13595
13596    #[must_use]
13597    pub const fn discriminant(&self) -> i32 {
13598        #[allow(clippy::match_same_arms)]
13599        match self {
13600            Self::V0 => 0,
13601            Self::V2(_) => 2,
13602        }
13603    }
13604
13605    #[must_use]
13606    pub const fn variants() -> [i32; 2] {
13607        Self::VARIANTS
13608    }
13609}
13610
13611impl Name for TrustLineEntryV1Ext {
13612    #[must_use]
13613    fn name(&self) -> &'static str {
13614        Self::name(self)
13615    }
13616}
13617
13618impl Discriminant<i32> for TrustLineEntryV1Ext {
13619    #[must_use]
13620    fn discriminant(&self) -> i32 {
13621        Self::discriminant(self)
13622    }
13623}
13624
13625impl Variants<i32> for TrustLineEntryV1Ext {
13626    fn variants() -> slice::Iter<'static, i32> {
13627        Self::VARIANTS.iter()
13628    }
13629}
13630
13631impl Union<i32> for TrustLineEntryV1Ext {}
13632
13633impl ReadXdr for TrustLineEntryV1Ext {
13634    #[cfg(feature = "std")]
13635    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
13636        r.with_limited_depth(|r| {
13637            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
13638            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
13639            let v = match dv {
13640                0 => Self::V0,
13641                2 => Self::V2(TrustLineEntryExtensionV2::read_xdr(r)?),
13642                #[allow(unreachable_patterns)]
13643                _ => return Err(Error::Invalid),
13644            };
13645            Ok(v)
13646        })
13647    }
13648}
13649
13650impl WriteXdr for TrustLineEntryV1Ext {
13651    #[cfg(feature = "std")]
13652    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
13653        w.with_limited_depth(|w| {
13654            self.discriminant().write_xdr(w)?;
13655            #[allow(clippy::match_same_arms)]
13656            match self {
13657                Self::V0 => ().write_xdr(w)?,
13658                Self::V2(v) => v.write_xdr(w)?,
13659            };
13660            Ok(())
13661        })
13662    }
13663}
13664
13665/// TrustLineEntryV1 is an XDR NestedStruct defines as:
13666///
13667/// ```text
13668/// struct
13669///         {
13670///             Liabilities liabilities;
13671///
13672///             union switch (int v)
13673///             {
13674///             case 0:
13675///                 void;
13676///             case 2:
13677///                 TrustLineEntryExtensionV2 v2;
13678///             }
13679///             ext;
13680///         }
13681/// ```
13682///
13683#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
13684#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
13685#[cfg_attr(
13686    all(feature = "serde", feature = "alloc"),
13687    derive(serde::Serialize, serde::Deserialize),
13688    serde(rename_all = "snake_case")
13689)]
13690#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
13691pub struct TrustLineEntryV1 {
13692    pub liabilities: Liabilities,
13693    pub ext: TrustLineEntryV1Ext,
13694}
13695
13696impl ReadXdr for TrustLineEntryV1 {
13697    #[cfg(feature = "std")]
13698    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
13699        r.with_limited_depth(|r| {
13700            Ok(Self {
13701                liabilities: Liabilities::read_xdr(r)?,
13702                ext: TrustLineEntryV1Ext::read_xdr(r)?,
13703            })
13704        })
13705    }
13706}
13707
13708impl WriteXdr for TrustLineEntryV1 {
13709    #[cfg(feature = "std")]
13710    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
13711        w.with_limited_depth(|w| {
13712            self.liabilities.write_xdr(w)?;
13713            self.ext.write_xdr(w)?;
13714            Ok(())
13715        })
13716    }
13717}
13718
13719/// TrustLineEntryExt is an XDR NestedUnion defines as:
13720///
13721/// ```text
13722/// union switch (int v)
13723///     {
13724///     case 0:
13725///         void;
13726///     case 1:
13727///         struct
13728///         {
13729///             Liabilities liabilities;
13730///
13731///             union switch (int v)
13732///             {
13733///             case 0:
13734///                 void;
13735///             case 2:
13736///                 TrustLineEntryExtensionV2 v2;
13737///             }
13738///             ext;
13739///         } v1;
13740///     }
13741/// ```
13742///
13743// union with discriminant i32
13744#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
13745#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
13746#[cfg_attr(
13747    all(feature = "serde", feature = "alloc"),
13748    derive(serde::Serialize, serde::Deserialize),
13749    serde(rename_all = "snake_case")
13750)]
13751#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
13752#[allow(clippy::large_enum_variant)]
13753pub enum TrustLineEntryExt {
13754    V0,
13755    V1(TrustLineEntryV1),
13756}
13757
13758impl TrustLineEntryExt {
13759    pub const VARIANTS: [i32; 2] = [0, 1];
13760    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"];
13761
13762    #[must_use]
13763    pub const fn name(&self) -> &'static str {
13764        match self {
13765            Self::V0 => "V0",
13766            Self::V1(_) => "V1",
13767        }
13768    }
13769
13770    #[must_use]
13771    pub const fn discriminant(&self) -> i32 {
13772        #[allow(clippy::match_same_arms)]
13773        match self {
13774            Self::V0 => 0,
13775            Self::V1(_) => 1,
13776        }
13777    }
13778
13779    #[must_use]
13780    pub const fn variants() -> [i32; 2] {
13781        Self::VARIANTS
13782    }
13783}
13784
13785impl Name for TrustLineEntryExt {
13786    #[must_use]
13787    fn name(&self) -> &'static str {
13788        Self::name(self)
13789    }
13790}
13791
13792impl Discriminant<i32> for TrustLineEntryExt {
13793    #[must_use]
13794    fn discriminant(&self) -> i32 {
13795        Self::discriminant(self)
13796    }
13797}
13798
13799impl Variants<i32> for TrustLineEntryExt {
13800    fn variants() -> slice::Iter<'static, i32> {
13801        Self::VARIANTS.iter()
13802    }
13803}
13804
13805impl Union<i32> for TrustLineEntryExt {}
13806
13807impl ReadXdr for TrustLineEntryExt {
13808    #[cfg(feature = "std")]
13809    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
13810        r.with_limited_depth(|r| {
13811            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
13812            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
13813            let v = match dv {
13814                0 => Self::V0,
13815                1 => Self::V1(TrustLineEntryV1::read_xdr(r)?),
13816                #[allow(unreachable_patterns)]
13817                _ => return Err(Error::Invalid),
13818            };
13819            Ok(v)
13820        })
13821    }
13822}
13823
13824impl WriteXdr for TrustLineEntryExt {
13825    #[cfg(feature = "std")]
13826    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
13827        w.with_limited_depth(|w| {
13828            self.discriminant().write_xdr(w)?;
13829            #[allow(clippy::match_same_arms)]
13830            match self {
13831                Self::V0 => ().write_xdr(w)?,
13832                Self::V1(v) => v.write_xdr(w)?,
13833            };
13834            Ok(())
13835        })
13836    }
13837}
13838
13839/// TrustLineEntry is an XDR Struct defines as:
13840///
13841/// ```text
13842/// struct TrustLineEntry
13843/// {
13844///     AccountID accountID;  // account this trustline belongs to
13845///     TrustLineAsset asset; // type of asset (with issuer)
13846///     int64 balance;        // how much of this asset the user has.
13847///                           // Asset defines the unit for this;
13848///
13849///     int64 limit;  // balance cannot be above this
13850///     uint32 flags; // see TrustLineFlags
13851///
13852///     // reserved for future use
13853///     union switch (int v)
13854///     {
13855///     case 0:
13856///         void;
13857///     case 1:
13858///         struct
13859///         {
13860///             Liabilities liabilities;
13861///
13862///             union switch (int v)
13863///             {
13864///             case 0:
13865///                 void;
13866///             case 2:
13867///                 TrustLineEntryExtensionV2 v2;
13868///             }
13869///             ext;
13870///         } v1;
13871///     }
13872///     ext;
13873/// };
13874/// ```
13875///
13876#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
13877#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
13878#[cfg_attr(
13879    all(feature = "serde", feature = "alloc"),
13880    derive(serde::Serialize, serde::Deserialize),
13881    serde(rename_all = "snake_case")
13882)]
13883#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
13884pub struct TrustLineEntry {
13885    pub account_id: AccountId,
13886    pub asset: TrustLineAsset,
13887    pub balance: i64,
13888    pub limit: i64,
13889    pub flags: u32,
13890    pub ext: TrustLineEntryExt,
13891}
13892
13893impl ReadXdr for TrustLineEntry {
13894    #[cfg(feature = "std")]
13895    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
13896        r.with_limited_depth(|r| {
13897            Ok(Self {
13898                account_id: AccountId::read_xdr(r)?,
13899                asset: TrustLineAsset::read_xdr(r)?,
13900                balance: i64::read_xdr(r)?,
13901                limit: i64::read_xdr(r)?,
13902                flags: u32::read_xdr(r)?,
13903                ext: TrustLineEntryExt::read_xdr(r)?,
13904            })
13905        })
13906    }
13907}
13908
13909impl WriteXdr for TrustLineEntry {
13910    #[cfg(feature = "std")]
13911    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
13912        w.with_limited_depth(|w| {
13913            self.account_id.write_xdr(w)?;
13914            self.asset.write_xdr(w)?;
13915            self.balance.write_xdr(w)?;
13916            self.limit.write_xdr(w)?;
13917            self.flags.write_xdr(w)?;
13918            self.ext.write_xdr(w)?;
13919            Ok(())
13920        })
13921    }
13922}
13923
13924/// OfferEntryFlags is an XDR Enum defines as:
13925///
13926/// ```text
13927/// enum OfferEntryFlags
13928/// {
13929///     // an offer with this flag will not act on and take a reverse offer of equal
13930///     // price
13931///     PASSIVE_FLAG = 1
13932/// };
13933/// ```
13934///
13935// enum
13936#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
13937#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
13938#[cfg_attr(
13939    all(feature = "serde", feature = "alloc"),
13940    derive(serde::Serialize, serde::Deserialize),
13941    serde(rename_all = "snake_case")
13942)]
13943#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
13944#[repr(i32)]
13945pub enum OfferEntryFlags {
13946    PassiveFlag = 1,
13947}
13948
13949impl OfferEntryFlags {
13950    pub const VARIANTS: [OfferEntryFlags; 1] = [OfferEntryFlags::PassiveFlag];
13951    pub const VARIANTS_STR: [&'static str; 1] = ["PassiveFlag"];
13952
13953    #[must_use]
13954    pub const fn name(&self) -> &'static str {
13955        match self {
13956            Self::PassiveFlag => "PassiveFlag",
13957        }
13958    }
13959
13960    #[must_use]
13961    pub const fn variants() -> [OfferEntryFlags; 1] {
13962        Self::VARIANTS
13963    }
13964}
13965
13966impl Name for OfferEntryFlags {
13967    #[must_use]
13968    fn name(&self) -> &'static str {
13969        Self::name(self)
13970    }
13971}
13972
13973impl Variants<OfferEntryFlags> for OfferEntryFlags {
13974    fn variants() -> slice::Iter<'static, OfferEntryFlags> {
13975        Self::VARIANTS.iter()
13976    }
13977}
13978
13979impl Enum for OfferEntryFlags {}
13980
13981impl fmt::Display for OfferEntryFlags {
13982    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
13983        f.write_str(self.name())
13984    }
13985}
13986
13987impl TryFrom<i32> for OfferEntryFlags {
13988    type Error = Error;
13989
13990    fn try_from(i: i32) -> Result<Self> {
13991        let e = match i {
13992            1 => OfferEntryFlags::PassiveFlag,
13993            #[allow(unreachable_patterns)]
13994            _ => return Err(Error::Invalid),
13995        };
13996        Ok(e)
13997    }
13998}
13999
14000impl From<OfferEntryFlags> for i32 {
14001    #[must_use]
14002    fn from(e: OfferEntryFlags) -> Self {
14003        e as Self
14004    }
14005}
14006
14007impl ReadXdr for OfferEntryFlags {
14008    #[cfg(feature = "std")]
14009    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
14010        r.with_limited_depth(|r| {
14011            let e = i32::read_xdr(r)?;
14012            let v: Self = e.try_into()?;
14013            Ok(v)
14014        })
14015    }
14016}
14017
14018impl WriteXdr for OfferEntryFlags {
14019    #[cfg(feature = "std")]
14020    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
14021        w.with_limited_depth(|w| {
14022            let i: i32 = (*self).into();
14023            i.write_xdr(w)
14024        })
14025    }
14026}
14027
14028/// MaskOfferentryFlags is an XDR Const defines as:
14029///
14030/// ```text
14031/// const MASK_OFFERENTRY_FLAGS = 1;
14032/// ```
14033///
14034pub const MASK_OFFERENTRY_FLAGS: u64 = 1;
14035
14036/// OfferEntryExt is an XDR NestedUnion defines as:
14037///
14038/// ```text
14039/// union switch (int v)
14040///     {
14041///     case 0:
14042///         void;
14043///     }
14044/// ```
14045///
14046// union with discriminant i32
14047#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
14048#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
14049#[cfg_attr(
14050    all(feature = "serde", feature = "alloc"),
14051    derive(serde::Serialize, serde::Deserialize),
14052    serde(rename_all = "snake_case")
14053)]
14054#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
14055#[allow(clippy::large_enum_variant)]
14056pub enum OfferEntryExt {
14057    V0,
14058}
14059
14060impl OfferEntryExt {
14061    pub const VARIANTS: [i32; 1] = [0];
14062    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
14063
14064    #[must_use]
14065    pub const fn name(&self) -> &'static str {
14066        match self {
14067            Self::V0 => "V0",
14068        }
14069    }
14070
14071    #[must_use]
14072    pub const fn discriminant(&self) -> i32 {
14073        #[allow(clippy::match_same_arms)]
14074        match self {
14075            Self::V0 => 0,
14076        }
14077    }
14078
14079    #[must_use]
14080    pub const fn variants() -> [i32; 1] {
14081        Self::VARIANTS
14082    }
14083}
14084
14085impl Name for OfferEntryExt {
14086    #[must_use]
14087    fn name(&self) -> &'static str {
14088        Self::name(self)
14089    }
14090}
14091
14092impl Discriminant<i32> for OfferEntryExt {
14093    #[must_use]
14094    fn discriminant(&self) -> i32 {
14095        Self::discriminant(self)
14096    }
14097}
14098
14099impl Variants<i32> for OfferEntryExt {
14100    fn variants() -> slice::Iter<'static, i32> {
14101        Self::VARIANTS.iter()
14102    }
14103}
14104
14105impl Union<i32> for OfferEntryExt {}
14106
14107impl ReadXdr for OfferEntryExt {
14108    #[cfg(feature = "std")]
14109    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
14110        r.with_limited_depth(|r| {
14111            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
14112            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
14113            let v = match dv {
14114                0 => Self::V0,
14115                #[allow(unreachable_patterns)]
14116                _ => return Err(Error::Invalid),
14117            };
14118            Ok(v)
14119        })
14120    }
14121}
14122
14123impl WriteXdr for OfferEntryExt {
14124    #[cfg(feature = "std")]
14125    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
14126        w.with_limited_depth(|w| {
14127            self.discriminant().write_xdr(w)?;
14128            #[allow(clippy::match_same_arms)]
14129            match self {
14130                Self::V0 => ().write_xdr(w)?,
14131            };
14132            Ok(())
14133        })
14134    }
14135}
14136
14137/// OfferEntry is an XDR Struct defines as:
14138///
14139/// ```text
14140/// struct OfferEntry
14141/// {
14142///     AccountID sellerID;
14143///     int64 offerID;
14144///     Asset selling; // A
14145///     Asset buying;  // B
14146///     int64 amount;  // amount of A
14147///
14148///     /* price for this offer:
14149///         price of A in terms of B
14150///         price=AmountB/AmountA=priceNumerator/priceDenominator
14151///         price is after fees
14152///     */
14153///     Price price;
14154///     uint32 flags; // see OfferEntryFlags
14155///
14156///     // reserved for future use
14157///     union switch (int v)
14158///     {
14159///     case 0:
14160///         void;
14161///     }
14162///     ext;
14163/// };
14164/// ```
14165///
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))]
14174pub struct OfferEntry {
14175    pub seller_id: AccountId,
14176    pub offer_id: i64,
14177    pub selling: Asset,
14178    pub buying: Asset,
14179    pub amount: i64,
14180    pub price: Price,
14181    pub flags: u32,
14182    pub ext: OfferEntryExt,
14183}
14184
14185impl ReadXdr for OfferEntry {
14186    #[cfg(feature = "std")]
14187    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
14188        r.with_limited_depth(|r| {
14189            Ok(Self {
14190                seller_id: AccountId::read_xdr(r)?,
14191                offer_id: i64::read_xdr(r)?,
14192                selling: Asset::read_xdr(r)?,
14193                buying: Asset::read_xdr(r)?,
14194                amount: i64::read_xdr(r)?,
14195                price: Price::read_xdr(r)?,
14196                flags: u32::read_xdr(r)?,
14197                ext: OfferEntryExt::read_xdr(r)?,
14198            })
14199        })
14200    }
14201}
14202
14203impl WriteXdr for OfferEntry {
14204    #[cfg(feature = "std")]
14205    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
14206        w.with_limited_depth(|w| {
14207            self.seller_id.write_xdr(w)?;
14208            self.offer_id.write_xdr(w)?;
14209            self.selling.write_xdr(w)?;
14210            self.buying.write_xdr(w)?;
14211            self.amount.write_xdr(w)?;
14212            self.price.write_xdr(w)?;
14213            self.flags.write_xdr(w)?;
14214            self.ext.write_xdr(w)?;
14215            Ok(())
14216        })
14217    }
14218}
14219
14220/// DataEntryExt is an XDR NestedUnion defines as:
14221///
14222/// ```text
14223/// union switch (int v)
14224///     {
14225///     case 0:
14226///         void;
14227///     }
14228/// ```
14229///
14230// union with discriminant i32
14231#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
14232#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
14233#[cfg_attr(
14234    all(feature = "serde", feature = "alloc"),
14235    derive(serde::Serialize, serde::Deserialize),
14236    serde(rename_all = "snake_case")
14237)]
14238#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
14239#[allow(clippy::large_enum_variant)]
14240pub enum DataEntryExt {
14241    V0,
14242}
14243
14244impl DataEntryExt {
14245    pub const VARIANTS: [i32; 1] = [0];
14246    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
14247
14248    #[must_use]
14249    pub const fn name(&self) -> &'static str {
14250        match self {
14251            Self::V0 => "V0",
14252        }
14253    }
14254
14255    #[must_use]
14256    pub const fn discriminant(&self) -> i32 {
14257        #[allow(clippy::match_same_arms)]
14258        match self {
14259            Self::V0 => 0,
14260        }
14261    }
14262
14263    #[must_use]
14264    pub const fn variants() -> [i32; 1] {
14265        Self::VARIANTS
14266    }
14267}
14268
14269impl Name for DataEntryExt {
14270    #[must_use]
14271    fn name(&self) -> &'static str {
14272        Self::name(self)
14273    }
14274}
14275
14276impl Discriminant<i32> for DataEntryExt {
14277    #[must_use]
14278    fn discriminant(&self) -> i32 {
14279        Self::discriminant(self)
14280    }
14281}
14282
14283impl Variants<i32> for DataEntryExt {
14284    fn variants() -> slice::Iter<'static, i32> {
14285        Self::VARIANTS.iter()
14286    }
14287}
14288
14289impl Union<i32> for DataEntryExt {}
14290
14291impl ReadXdr for DataEntryExt {
14292    #[cfg(feature = "std")]
14293    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
14294        r.with_limited_depth(|r| {
14295            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
14296            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
14297            let v = match dv {
14298                0 => Self::V0,
14299                #[allow(unreachable_patterns)]
14300                _ => return Err(Error::Invalid),
14301            };
14302            Ok(v)
14303        })
14304    }
14305}
14306
14307impl WriteXdr for DataEntryExt {
14308    #[cfg(feature = "std")]
14309    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
14310        w.with_limited_depth(|w| {
14311            self.discriminant().write_xdr(w)?;
14312            #[allow(clippy::match_same_arms)]
14313            match self {
14314                Self::V0 => ().write_xdr(w)?,
14315            };
14316            Ok(())
14317        })
14318    }
14319}
14320
14321/// DataEntry is an XDR Struct defines as:
14322///
14323/// ```text
14324/// struct DataEntry
14325/// {
14326///     AccountID accountID; // account this data belongs to
14327///     string64 dataName;
14328///     DataValue dataValue;
14329///
14330///     // reserved for future use
14331///     union switch (int v)
14332///     {
14333///     case 0:
14334///         void;
14335///     }
14336///     ext;
14337/// };
14338/// ```
14339///
14340#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
14341#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
14342#[cfg_attr(
14343    all(feature = "serde", feature = "alloc"),
14344    derive(serde::Serialize, serde::Deserialize),
14345    serde(rename_all = "snake_case")
14346)]
14347#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
14348pub struct DataEntry {
14349    pub account_id: AccountId,
14350    pub data_name: String64,
14351    pub data_value: DataValue,
14352    pub ext: DataEntryExt,
14353}
14354
14355impl ReadXdr for DataEntry {
14356    #[cfg(feature = "std")]
14357    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
14358        r.with_limited_depth(|r| {
14359            Ok(Self {
14360                account_id: AccountId::read_xdr(r)?,
14361                data_name: String64::read_xdr(r)?,
14362                data_value: DataValue::read_xdr(r)?,
14363                ext: DataEntryExt::read_xdr(r)?,
14364            })
14365        })
14366    }
14367}
14368
14369impl WriteXdr for DataEntry {
14370    #[cfg(feature = "std")]
14371    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
14372        w.with_limited_depth(|w| {
14373            self.account_id.write_xdr(w)?;
14374            self.data_name.write_xdr(w)?;
14375            self.data_value.write_xdr(w)?;
14376            self.ext.write_xdr(w)?;
14377            Ok(())
14378        })
14379    }
14380}
14381
14382/// ClaimPredicateType is an XDR Enum defines as:
14383///
14384/// ```text
14385/// enum ClaimPredicateType
14386/// {
14387///     CLAIM_PREDICATE_UNCONDITIONAL = 0,
14388///     CLAIM_PREDICATE_AND = 1,
14389///     CLAIM_PREDICATE_OR = 2,
14390///     CLAIM_PREDICATE_NOT = 3,
14391///     CLAIM_PREDICATE_BEFORE_ABSOLUTE_TIME = 4,
14392///     CLAIM_PREDICATE_BEFORE_RELATIVE_TIME = 5
14393/// };
14394/// ```
14395///
14396// enum
14397#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
14398#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
14399#[cfg_attr(
14400    all(feature = "serde", feature = "alloc"),
14401    derive(serde::Serialize, serde::Deserialize),
14402    serde(rename_all = "snake_case")
14403)]
14404#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
14405#[repr(i32)]
14406pub enum ClaimPredicateType {
14407    Unconditional = 0,
14408    And = 1,
14409    Or = 2,
14410    Not = 3,
14411    BeforeAbsoluteTime = 4,
14412    BeforeRelativeTime = 5,
14413}
14414
14415impl ClaimPredicateType {
14416    pub const VARIANTS: [ClaimPredicateType; 6] = [
14417        ClaimPredicateType::Unconditional,
14418        ClaimPredicateType::And,
14419        ClaimPredicateType::Or,
14420        ClaimPredicateType::Not,
14421        ClaimPredicateType::BeforeAbsoluteTime,
14422        ClaimPredicateType::BeforeRelativeTime,
14423    ];
14424    pub const VARIANTS_STR: [&'static str; 6] = [
14425        "Unconditional",
14426        "And",
14427        "Or",
14428        "Not",
14429        "BeforeAbsoluteTime",
14430        "BeforeRelativeTime",
14431    ];
14432
14433    #[must_use]
14434    pub const fn name(&self) -> &'static str {
14435        match self {
14436            Self::Unconditional => "Unconditional",
14437            Self::And => "And",
14438            Self::Or => "Or",
14439            Self::Not => "Not",
14440            Self::BeforeAbsoluteTime => "BeforeAbsoluteTime",
14441            Self::BeforeRelativeTime => "BeforeRelativeTime",
14442        }
14443    }
14444
14445    #[must_use]
14446    pub const fn variants() -> [ClaimPredicateType; 6] {
14447        Self::VARIANTS
14448    }
14449}
14450
14451impl Name for ClaimPredicateType {
14452    #[must_use]
14453    fn name(&self) -> &'static str {
14454        Self::name(self)
14455    }
14456}
14457
14458impl Variants<ClaimPredicateType> for ClaimPredicateType {
14459    fn variants() -> slice::Iter<'static, ClaimPredicateType> {
14460        Self::VARIANTS.iter()
14461    }
14462}
14463
14464impl Enum for ClaimPredicateType {}
14465
14466impl fmt::Display for ClaimPredicateType {
14467    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
14468        f.write_str(self.name())
14469    }
14470}
14471
14472impl TryFrom<i32> for ClaimPredicateType {
14473    type Error = Error;
14474
14475    fn try_from(i: i32) -> Result<Self> {
14476        let e = match i {
14477            0 => ClaimPredicateType::Unconditional,
14478            1 => ClaimPredicateType::And,
14479            2 => ClaimPredicateType::Or,
14480            3 => ClaimPredicateType::Not,
14481            4 => ClaimPredicateType::BeforeAbsoluteTime,
14482            5 => ClaimPredicateType::BeforeRelativeTime,
14483            #[allow(unreachable_patterns)]
14484            _ => return Err(Error::Invalid),
14485        };
14486        Ok(e)
14487    }
14488}
14489
14490impl From<ClaimPredicateType> for i32 {
14491    #[must_use]
14492    fn from(e: ClaimPredicateType) -> Self {
14493        e as Self
14494    }
14495}
14496
14497impl ReadXdr for ClaimPredicateType {
14498    #[cfg(feature = "std")]
14499    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
14500        r.with_limited_depth(|r| {
14501            let e = i32::read_xdr(r)?;
14502            let v: Self = e.try_into()?;
14503            Ok(v)
14504        })
14505    }
14506}
14507
14508impl WriteXdr for ClaimPredicateType {
14509    #[cfg(feature = "std")]
14510    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
14511        w.with_limited_depth(|w| {
14512            let i: i32 = (*self).into();
14513            i.write_xdr(w)
14514        })
14515    }
14516}
14517
14518/// ClaimPredicate is an XDR Union defines as:
14519///
14520/// ```text
14521/// union ClaimPredicate switch (ClaimPredicateType type)
14522/// {
14523/// case CLAIM_PREDICATE_UNCONDITIONAL:
14524///     void;
14525/// case CLAIM_PREDICATE_AND:
14526///     ClaimPredicate andPredicates<2>;
14527/// case CLAIM_PREDICATE_OR:
14528///     ClaimPredicate orPredicates<2>;
14529/// case CLAIM_PREDICATE_NOT:
14530///     ClaimPredicate* notPredicate;
14531/// case CLAIM_PREDICATE_BEFORE_ABSOLUTE_TIME:
14532///     int64 absBefore; // Predicate will be true if closeTime < absBefore
14533/// case CLAIM_PREDICATE_BEFORE_RELATIVE_TIME:
14534///     int64 relBefore; // Seconds since closeTime of the ledger in which the
14535///                      // ClaimableBalanceEntry was created
14536/// };
14537/// ```
14538///
14539// union with discriminant ClaimPredicateType
14540#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
14541#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
14542#[cfg_attr(
14543    all(feature = "serde", feature = "alloc"),
14544    derive(serde::Serialize, serde::Deserialize),
14545    serde(rename_all = "snake_case")
14546)]
14547#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
14548#[allow(clippy::large_enum_variant)]
14549pub enum ClaimPredicate {
14550    Unconditional,
14551    And(VecM<ClaimPredicate, 2>),
14552    Or(VecM<ClaimPredicate, 2>),
14553    Not(Option<Box<ClaimPredicate>>),
14554    BeforeAbsoluteTime(i64),
14555    BeforeRelativeTime(i64),
14556}
14557
14558impl ClaimPredicate {
14559    pub const VARIANTS: [ClaimPredicateType; 6] = [
14560        ClaimPredicateType::Unconditional,
14561        ClaimPredicateType::And,
14562        ClaimPredicateType::Or,
14563        ClaimPredicateType::Not,
14564        ClaimPredicateType::BeforeAbsoluteTime,
14565        ClaimPredicateType::BeforeRelativeTime,
14566    ];
14567    pub const VARIANTS_STR: [&'static str; 6] = [
14568        "Unconditional",
14569        "And",
14570        "Or",
14571        "Not",
14572        "BeforeAbsoluteTime",
14573        "BeforeRelativeTime",
14574    ];
14575
14576    #[must_use]
14577    pub const fn name(&self) -> &'static str {
14578        match self {
14579            Self::Unconditional => "Unconditional",
14580            Self::And(_) => "And",
14581            Self::Or(_) => "Or",
14582            Self::Not(_) => "Not",
14583            Self::BeforeAbsoluteTime(_) => "BeforeAbsoluteTime",
14584            Self::BeforeRelativeTime(_) => "BeforeRelativeTime",
14585        }
14586    }
14587
14588    #[must_use]
14589    pub const fn discriminant(&self) -> ClaimPredicateType {
14590        #[allow(clippy::match_same_arms)]
14591        match self {
14592            Self::Unconditional => ClaimPredicateType::Unconditional,
14593            Self::And(_) => ClaimPredicateType::And,
14594            Self::Or(_) => ClaimPredicateType::Or,
14595            Self::Not(_) => ClaimPredicateType::Not,
14596            Self::BeforeAbsoluteTime(_) => ClaimPredicateType::BeforeAbsoluteTime,
14597            Self::BeforeRelativeTime(_) => ClaimPredicateType::BeforeRelativeTime,
14598        }
14599    }
14600
14601    #[must_use]
14602    pub const fn variants() -> [ClaimPredicateType; 6] {
14603        Self::VARIANTS
14604    }
14605}
14606
14607impl Name for ClaimPredicate {
14608    #[must_use]
14609    fn name(&self) -> &'static str {
14610        Self::name(self)
14611    }
14612}
14613
14614impl Discriminant<ClaimPredicateType> for ClaimPredicate {
14615    #[must_use]
14616    fn discriminant(&self) -> ClaimPredicateType {
14617        Self::discriminant(self)
14618    }
14619}
14620
14621impl Variants<ClaimPredicateType> for ClaimPredicate {
14622    fn variants() -> slice::Iter<'static, ClaimPredicateType> {
14623        Self::VARIANTS.iter()
14624    }
14625}
14626
14627impl Union<ClaimPredicateType> for ClaimPredicate {}
14628
14629impl ReadXdr for ClaimPredicate {
14630    #[cfg(feature = "std")]
14631    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
14632        r.with_limited_depth(|r| {
14633            let dv: ClaimPredicateType = <ClaimPredicateType as ReadXdr>::read_xdr(r)?;
14634            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
14635            let v = match dv {
14636                ClaimPredicateType::Unconditional => Self::Unconditional,
14637                ClaimPredicateType::And => Self::And(VecM::<ClaimPredicate, 2>::read_xdr(r)?),
14638                ClaimPredicateType::Or => Self::Or(VecM::<ClaimPredicate, 2>::read_xdr(r)?),
14639                ClaimPredicateType::Not => Self::Not(Option::<Box<ClaimPredicate>>::read_xdr(r)?),
14640                ClaimPredicateType::BeforeAbsoluteTime => {
14641                    Self::BeforeAbsoluteTime(i64::read_xdr(r)?)
14642                }
14643                ClaimPredicateType::BeforeRelativeTime => {
14644                    Self::BeforeRelativeTime(i64::read_xdr(r)?)
14645                }
14646                #[allow(unreachable_patterns)]
14647                _ => return Err(Error::Invalid),
14648            };
14649            Ok(v)
14650        })
14651    }
14652}
14653
14654impl WriteXdr for ClaimPredicate {
14655    #[cfg(feature = "std")]
14656    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
14657        w.with_limited_depth(|w| {
14658            self.discriminant().write_xdr(w)?;
14659            #[allow(clippy::match_same_arms)]
14660            match self {
14661                Self::Unconditional => ().write_xdr(w)?,
14662                Self::And(v) => v.write_xdr(w)?,
14663                Self::Or(v) => v.write_xdr(w)?,
14664                Self::Not(v) => v.write_xdr(w)?,
14665                Self::BeforeAbsoluteTime(v) => v.write_xdr(w)?,
14666                Self::BeforeRelativeTime(v) => v.write_xdr(w)?,
14667            };
14668            Ok(())
14669        })
14670    }
14671}
14672
14673/// ClaimantType is an XDR Enum defines as:
14674///
14675/// ```text
14676/// enum ClaimantType
14677/// {
14678///     CLAIMANT_TYPE_V0 = 0
14679/// };
14680/// ```
14681///
14682// enum
14683#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
14684#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
14685#[cfg_attr(
14686    all(feature = "serde", feature = "alloc"),
14687    derive(serde::Serialize, serde::Deserialize),
14688    serde(rename_all = "snake_case")
14689)]
14690#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
14691#[repr(i32)]
14692pub enum ClaimantType {
14693    ClaimantTypeV0 = 0,
14694}
14695
14696impl ClaimantType {
14697    pub const VARIANTS: [ClaimantType; 1] = [ClaimantType::ClaimantTypeV0];
14698    pub const VARIANTS_STR: [&'static str; 1] = ["ClaimantTypeV0"];
14699
14700    #[must_use]
14701    pub const fn name(&self) -> &'static str {
14702        match self {
14703            Self::ClaimantTypeV0 => "ClaimantTypeV0",
14704        }
14705    }
14706
14707    #[must_use]
14708    pub const fn variants() -> [ClaimantType; 1] {
14709        Self::VARIANTS
14710    }
14711}
14712
14713impl Name for ClaimantType {
14714    #[must_use]
14715    fn name(&self) -> &'static str {
14716        Self::name(self)
14717    }
14718}
14719
14720impl Variants<ClaimantType> for ClaimantType {
14721    fn variants() -> slice::Iter<'static, ClaimantType> {
14722        Self::VARIANTS.iter()
14723    }
14724}
14725
14726impl Enum for ClaimantType {}
14727
14728impl fmt::Display for ClaimantType {
14729    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
14730        f.write_str(self.name())
14731    }
14732}
14733
14734impl TryFrom<i32> for ClaimantType {
14735    type Error = Error;
14736
14737    fn try_from(i: i32) -> Result<Self> {
14738        let e = match i {
14739            0 => ClaimantType::ClaimantTypeV0,
14740            #[allow(unreachable_patterns)]
14741            _ => return Err(Error::Invalid),
14742        };
14743        Ok(e)
14744    }
14745}
14746
14747impl From<ClaimantType> for i32 {
14748    #[must_use]
14749    fn from(e: ClaimantType) -> Self {
14750        e as Self
14751    }
14752}
14753
14754impl ReadXdr for ClaimantType {
14755    #[cfg(feature = "std")]
14756    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
14757        r.with_limited_depth(|r| {
14758            let e = i32::read_xdr(r)?;
14759            let v: Self = e.try_into()?;
14760            Ok(v)
14761        })
14762    }
14763}
14764
14765impl WriteXdr for ClaimantType {
14766    #[cfg(feature = "std")]
14767    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
14768        w.with_limited_depth(|w| {
14769            let i: i32 = (*self).into();
14770            i.write_xdr(w)
14771        })
14772    }
14773}
14774
14775/// ClaimantV0 is an XDR NestedStruct defines as:
14776///
14777/// ```text
14778/// struct
14779///     {
14780///         AccountID destination;    // The account that can use this condition
14781///         ClaimPredicate predicate; // Claimable if predicate is true
14782///     }
14783/// ```
14784///
14785#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
14786#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
14787#[cfg_attr(
14788    all(feature = "serde", feature = "alloc"),
14789    derive(serde::Serialize, serde::Deserialize),
14790    serde(rename_all = "snake_case")
14791)]
14792#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
14793pub struct ClaimantV0 {
14794    pub destination: AccountId,
14795    pub predicate: ClaimPredicate,
14796}
14797
14798impl ReadXdr for ClaimantV0 {
14799    #[cfg(feature = "std")]
14800    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
14801        r.with_limited_depth(|r| {
14802            Ok(Self {
14803                destination: AccountId::read_xdr(r)?,
14804                predicate: ClaimPredicate::read_xdr(r)?,
14805            })
14806        })
14807    }
14808}
14809
14810impl WriteXdr for ClaimantV0 {
14811    #[cfg(feature = "std")]
14812    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
14813        w.with_limited_depth(|w| {
14814            self.destination.write_xdr(w)?;
14815            self.predicate.write_xdr(w)?;
14816            Ok(())
14817        })
14818    }
14819}
14820
14821/// Claimant is an XDR Union defines as:
14822///
14823/// ```text
14824/// union Claimant switch (ClaimantType type)
14825/// {
14826/// case CLAIMANT_TYPE_V0:
14827///     struct
14828///     {
14829///         AccountID destination;    // The account that can use this condition
14830///         ClaimPredicate predicate; // Claimable if predicate is true
14831///     } v0;
14832/// };
14833/// ```
14834///
14835// union with discriminant ClaimantType
14836#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
14837#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
14838#[cfg_attr(
14839    all(feature = "serde", feature = "alloc"),
14840    derive(serde::Serialize, serde::Deserialize),
14841    serde(rename_all = "snake_case")
14842)]
14843#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
14844#[allow(clippy::large_enum_variant)]
14845pub enum Claimant {
14846    ClaimantTypeV0(ClaimantV0),
14847}
14848
14849impl Claimant {
14850    pub const VARIANTS: [ClaimantType; 1] = [ClaimantType::ClaimantTypeV0];
14851    pub const VARIANTS_STR: [&'static str; 1] = ["ClaimantTypeV0"];
14852
14853    #[must_use]
14854    pub const fn name(&self) -> &'static str {
14855        match self {
14856            Self::ClaimantTypeV0(_) => "ClaimantTypeV0",
14857        }
14858    }
14859
14860    #[must_use]
14861    pub const fn discriminant(&self) -> ClaimantType {
14862        #[allow(clippy::match_same_arms)]
14863        match self {
14864            Self::ClaimantTypeV0(_) => ClaimantType::ClaimantTypeV0,
14865        }
14866    }
14867
14868    #[must_use]
14869    pub const fn variants() -> [ClaimantType; 1] {
14870        Self::VARIANTS
14871    }
14872}
14873
14874impl Name for Claimant {
14875    #[must_use]
14876    fn name(&self) -> &'static str {
14877        Self::name(self)
14878    }
14879}
14880
14881impl Discriminant<ClaimantType> for Claimant {
14882    #[must_use]
14883    fn discriminant(&self) -> ClaimantType {
14884        Self::discriminant(self)
14885    }
14886}
14887
14888impl Variants<ClaimantType> for Claimant {
14889    fn variants() -> slice::Iter<'static, ClaimantType> {
14890        Self::VARIANTS.iter()
14891    }
14892}
14893
14894impl Union<ClaimantType> for Claimant {}
14895
14896impl ReadXdr for Claimant {
14897    #[cfg(feature = "std")]
14898    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
14899        r.with_limited_depth(|r| {
14900            let dv: ClaimantType = <ClaimantType as ReadXdr>::read_xdr(r)?;
14901            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
14902            let v = match dv {
14903                ClaimantType::ClaimantTypeV0 => Self::ClaimantTypeV0(ClaimantV0::read_xdr(r)?),
14904                #[allow(unreachable_patterns)]
14905                _ => return Err(Error::Invalid),
14906            };
14907            Ok(v)
14908        })
14909    }
14910}
14911
14912impl WriteXdr for Claimant {
14913    #[cfg(feature = "std")]
14914    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
14915        w.with_limited_depth(|w| {
14916            self.discriminant().write_xdr(w)?;
14917            #[allow(clippy::match_same_arms)]
14918            match self {
14919                Self::ClaimantTypeV0(v) => v.write_xdr(w)?,
14920            };
14921            Ok(())
14922        })
14923    }
14924}
14925
14926/// ClaimableBalanceIdType is an XDR Enum defines as:
14927///
14928/// ```text
14929/// enum ClaimableBalanceIDType
14930/// {
14931///     CLAIMABLE_BALANCE_ID_TYPE_V0 = 0
14932/// };
14933/// ```
14934///
14935// enum
14936#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
14937#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
14938#[cfg_attr(
14939    all(feature = "serde", feature = "alloc"),
14940    derive(serde::Serialize, serde::Deserialize),
14941    serde(rename_all = "snake_case")
14942)]
14943#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
14944#[repr(i32)]
14945pub enum ClaimableBalanceIdType {
14946    ClaimableBalanceIdTypeV0 = 0,
14947}
14948
14949impl ClaimableBalanceIdType {
14950    pub const VARIANTS: [ClaimableBalanceIdType; 1] =
14951        [ClaimableBalanceIdType::ClaimableBalanceIdTypeV0];
14952    pub const VARIANTS_STR: [&'static str; 1] = ["ClaimableBalanceIdTypeV0"];
14953
14954    #[must_use]
14955    pub const fn name(&self) -> &'static str {
14956        match self {
14957            Self::ClaimableBalanceIdTypeV0 => "ClaimableBalanceIdTypeV0",
14958        }
14959    }
14960
14961    #[must_use]
14962    pub const fn variants() -> [ClaimableBalanceIdType; 1] {
14963        Self::VARIANTS
14964    }
14965}
14966
14967impl Name for ClaimableBalanceIdType {
14968    #[must_use]
14969    fn name(&self) -> &'static str {
14970        Self::name(self)
14971    }
14972}
14973
14974impl Variants<ClaimableBalanceIdType> for ClaimableBalanceIdType {
14975    fn variants() -> slice::Iter<'static, ClaimableBalanceIdType> {
14976        Self::VARIANTS.iter()
14977    }
14978}
14979
14980impl Enum for ClaimableBalanceIdType {}
14981
14982impl fmt::Display for ClaimableBalanceIdType {
14983    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
14984        f.write_str(self.name())
14985    }
14986}
14987
14988impl TryFrom<i32> for ClaimableBalanceIdType {
14989    type Error = Error;
14990
14991    fn try_from(i: i32) -> Result<Self> {
14992        let e = match i {
14993            0 => ClaimableBalanceIdType::ClaimableBalanceIdTypeV0,
14994            #[allow(unreachable_patterns)]
14995            _ => return Err(Error::Invalid),
14996        };
14997        Ok(e)
14998    }
14999}
15000
15001impl From<ClaimableBalanceIdType> for i32 {
15002    #[must_use]
15003    fn from(e: ClaimableBalanceIdType) -> Self {
15004        e as Self
15005    }
15006}
15007
15008impl ReadXdr for ClaimableBalanceIdType {
15009    #[cfg(feature = "std")]
15010    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
15011        r.with_limited_depth(|r| {
15012            let e = i32::read_xdr(r)?;
15013            let v: Self = e.try_into()?;
15014            Ok(v)
15015        })
15016    }
15017}
15018
15019impl WriteXdr for ClaimableBalanceIdType {
15020    #[cfg(feature = "std")]
15021    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
15022        w.with_limited_depth(|w| {
15023            let i: i32 = (*self).into();
15024            i.write_xdr(w)
15025        })
15026    }
15027}
15028
15029/// ClaimableBalanceId is an XDR Union defines as:
15030///
15031/// ```text
15032/// union ClaimableBalanceID switch (ClaimableBalanceIDType type)
15033/// {
15034/// case CLAIMABLE_BALANCE_ID_TYPE_V0:
15035///     Hash v0;
15036/// };
15037/// ```
15038///
15039// union with discriminant ClaimableBalanceIdType
15040#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
15041#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
15042#[cfg_attr(
15043    all(feature = "serde", feature = "alloc"),
15044    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
15045)]
15046#[allow(clippy::large_enum_variant)]
15047pub enum ClaimableBalanceId {
15048    ClaimableBalanceIdTypeV0(Hash),
15049}
15050
15051impl ClaimableBalanceId {
15052    pub const VARIANTS: [ClaimableBalanceIdType; 1] =
15053        [ClaimableBalanceIdType::ClaimableBalanceIdTypeV0];
15054    pub const VARIANTS_STR: [&'static str; 1] = ["ClaimableBalanceIdTypeV0"];
15055
15056    #[must_use]
15057    pub const fn name(&self) -> &'static str {
15058        match self {
15059            Self::ClaimableBalanceIdTypeV0(_) => "ClaimableBalanceIdTypeV0",
15060        }
15061    }
15062
15063    #[must_use]
15064    pub const fn discriminant(&self) -> ClaimableBalanceIdType {
15065        #[allow(clippy::match_same_arms)]
15066        match self {
15067            Self::ClaimableBalanceIdTypeV0(_) => ClaimableBalanceIdType::ClaimableBalanceIdTypeV0,
15068        }
15069    }
15070
15071    #[must_use]
15072    pub const fn variants() -> [ClaimableBalanceIdType; 1] {
15073        Self::VARIANTS
15074    }
15075}
15076
15077impl Name for ClaimableBalanceId {
15078    #[must_use]
15079    fn name(&self) -> &'static str {
15080        Self::name(self)
15081    }
15082}
15083
15084impl Discriminant<ClaimableBalanceIdType> for ClaimableBalanceId {
15085    #[must_use]
15086    fn discriminant(&self) -> ClaimableBalanceIdType {
15087        Self::discriminant(self)
15088    }
15089}
15090
15091impl Variants<ClaimableBalanceIdType> for ClaimableBalanceId {
15092    fn variants() -> slice::Iter<'static, ClaimableBalanceIdType> {
15093        Self::VARIANTS.iter()
15094    }
15095}
15096
15097impl Union<ClaimableBalanceIdType> for ClaimableBalanceId {}
15098
15099impl ReadXdr for ClaimableBalanceId {
15100    #[cfg(feature = "std")]
15101    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
15102        r.with_limited_depth(|r| {
15103            let dv: ClaimableBalanceIdType = <ClaimableBalanceIdType as ReadXdr>::read_xdr(r)?;
15104            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
15105            let v = match dv {
15106                ClaimableBalanceIdType::ClaimableBalanceIdTypeV0 => {
15107                    Self::ClaimableBalanceIdTypeV0(Hash::read_xdr(r)?)
15108                }
15109                #[allow(unreachable_patterns)]
15110                _ => return Err(Error::Invalid),
15111            };
15112            Ok(v)
15113        })
15114    }
15115}
15116
15117impl WriteXdr for ClaimableBalanceId {
15118    #[cfg(feature = "std")]
15119    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
15120        w.with_limited_depth(|w| {
15121            self.discriminant().write_xdr(w)?;
15122            #[allow(clippy::match_same_arms)]
15123            match self {
15124                Self::ClaimableBalanceIdTypeV0(v) => v.write_xdr(w)?,
15125            };
15126            Ok(())
15127        })
15128    }
15129}
15130
15131/// ClaimableBalanceFlags is an XDR Enum defines as:
15132///
15133/// ```text
15134/// enum ClaimableBalanceFlags
15135/// {
15136///     // If set, the issuer account of the asset held by the claimable balance may
15137///     // clawback the claimable balance
15138///     CLAIMABLE_BALANCE_CLAWBACK_ENABLED_FLAG = 0x1
15139/// };
15140/// ```
15141///
15142// enum
15143#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
15144#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
15145#[cfg_attr(
15146    all(feature = "serde", feature = "alloc"),
15147    derive(serde::Serialize, serde::Deserialize),
15148    serde(rename_all = "snake_case")
15149)]
15150#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
15151#[repr(i32)]
15152pub enum ClaimableBalanceFlags {
15153    ClaimableBalanceClawbackEnabledFlag = 1,
15154}
15155
15156impl ClaimableBalanceFlags {
15157    pub const VARIANTS: [ClaimableBalanceFlags; 1] =
15158        [ClaimableBalanceFlags::ClaimableBalanceClawbackEnabledFlag];
15159    pub const VARIANTS_STR: [&'static str; 1] = ["ClaimableBalanceClawbackEnabledFlag"];
15160
15161    #[must_use]
15162    pub const fn name(&self) -> &'static str {
15163        match self {
15164            Self::ClaimableBalanceClawbackEnabledFlag => "ClaimableBalanceClawbackEnabledFlag",
15165        }
15166    }
15167
15168    #[must_use]
15169    pub const fn variants() -> [ClaimableBalanceFlags; 1] {
15170        Self::VARIANTS
15171    }
15172}
15173
15174impl Name for ClaimableBalanceFlags {
15175    #[must_use]
15176    fn name(&self) -> &'static str {
15177        Self::name(self)
15178    }
15179}
15180
15181impl Variants<ClaimableBalanceFlags> for ClaimableBalanceFlags {
15182    fn variants() -> slice::Iter<'static, ClaimableBalanceFlags> {
15183        Self::VARIANTS.iter()
15184    }
15185}
15186
15187impl Enum for ClaimableBalanceFlags {}
15188
15189impl fmt::Display for ClaimableBalanceFlags {
15190    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
15191        f.write_str(self.name())
15192    }
15193}
15194
15195impl TryFrom<i32> for ClaimableBalanceFlags {
15196    type Error = Error;
15197
15198    fn try_from(i: i32) -> Result<Self> {
15199        let e = match i {
15200            1 => ClaimableBalanceFlags::ClaimableBalanceClawbackEnabledFlag,
15201            #[allow(unreachable_patterns)]
15202            _ => return Err(Error::Invalid),
15203        };
15204        Ok(e)
15205    }
15206}
15207
15208impl From<ClaimableBalanceFlags> for i32 {
15209    #[must_use]
15210    fn from(e: ClaimableBalanceFlags) -> Self {
15211        e as Self
15212    }
15213}
15214
15215impl ReadXdr for ClaimableBalanceFlags {
15216    #[cfg(feature = "std")]
15217    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
15218        r.with_limited_depth(|r| {
15219            let e = i32::read_xdr(r)?;
15220            let v: Self = e.try_into()?;
15221            Ok(v)
15222        })
15223    }
15224}
15225
15226impl WriteXdr for ClaimableBalanceFlags {
15227    #[cfg(feature = "std")]
15228    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
15229        w.with_limited_depth(|w| {
15230            let i: i32 = (*self).into();
15231            i.write_xdr(w)
15232        })
15233    }
15234}
15235
15236/// MaskClaimableBalanceFlags is an XDR Const defines as:
15237///
15238/// ```text
15239/// const MASK_CLAIMABLE_BALANCE_FLAGS = 0x1;
15240/// ```
15241///
15242pub const MASK_CLAIMABLE_BALANCE_FLAGS: u64 = 0x1;
15243
15244/// ClaimableBalanceEntryExtensionV1Ext is an XDR NestedUnion defines as:
15245///
15246/// ```text
15247/// union switch (int v)
15248///     {
15249///     case 0:
15250///         void;
15251///     }
15252/// ```
15253///
15254// union with discriminant i32
15255#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
15256#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
15257#[cfg_attr(
15258    all(feature = "serde", feature = "alloc"),
15259    derive(serde::Serialize, serde::Deserialize),
15260    serde(rename_all = "snake_case")
15261)]
15262#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
15263#[allow(clippy::large_enum_variant)]
15264pub enum ClaimableBalanceEntryExtensionV1Ext {
15265    V0,
15266}
15267
15268impl ClaimableBalanceEntryExtensionV1Ext {
15269    pub const VARIANTS: [i32; 1] = [0];
15270    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
15271
15272    #[must_use]
15273    pub const fn name(&self) -> &'static str {
15274        match self {
15275            Self::V0 => "V0",
15276        }
15277    }
15278
15279    #[must_use]
15280    pub const fn discriminant(&self) -> i32 {
15281        #[allow(clippy::match_same_arms)]
15282        match self {
15283            Self::V0 => 0,
15284        }
15285    }
15286
15287    #[must_use]
15288    pub const fn variants() -> [i32; 1] {
15289        Self::VARIANTS
15290    }
15291}
15292
15293impl Name for ClaimableBalanceEntryExtensionV1Ext {
15294    #[must_use]
15295    fn name(&self) -> &'static str {
15296        Self::name(self)
15297    }
15298}
15299
15300impl Discriminant<i32> for ClaimableBalanceEntryExtensionV1Ext {
15301    #[must_use]
15302    fn discriminant(&self) -> i32 {
15303        Self::discriminant(self)
15304    }
15305}
15306
15307impl Variants<i32> for ClaimableBalanceEntryExtensionV1Ext {
15308    fn variants() -> slice::Iter<'static, i32> {
15309        Self::VARIANTS.iter()
15310    }
15311}
15312
15313impl Union<i32> for ClaimableBalanceEntryExtensionV1Ext {}
15314
15315impl ReadXdr for ClaimableBalanceEntryExtensionV1Ext {
15316    #[cfg(feature = "std")]
15317    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
15318        r.with_limited_depth(|r| {
15319            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
15320            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
15321            let v = match dv {
15322                0 => Self::V0,
15323                #[allow(unreachable_patterns)]
15324                _ => return Err(Error::Invalid),
15325            };
15326            Ok(v)
15327        })
15328    }
15329}
15330
15331impl WriteXdr for ClaimableBalanceEntryExtensionV1Ext {
15332    #[cfg(feature = "std")]
15333    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
15334        w.with_limited_depth(|w| {
15335            self.discriminant().write_xdr(w)?;
15336            #[allow(clippy::match_same_arms)]
15337            match self {
15338                Self::V0 => ().write_xdr(w)?,
15339            };
15340            Ok(())
15341        })
15342    }
15343}
15344
15345/// ClaimableBalanceEntryExtensionV1 is an XDR Struct defines as:
15346///
15347/// ```text
15348/// struct ClaimableBalanceEntryExtensionV1
15349/// {
15350///     union switch (int v)
15351///     {
15352///     case 0:
15353///         void;
15354///     }
15355///     ext;
15356///
15357///     uint32 flags; // see ClaimableBalanceFlags
15358/// };
15359/// ```
15360///
15361#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
15362#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
15363#[cfg_attr(
15364    all(feature = "serde", feature = "alloc"),
15365    derive(serde::Serialize, serde::Deserialize),
15366    serde(rename_all = "snake_case")
15367)]
15368#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
15369pub struct ClaimableBalanceEntryExtensionV1 {
15370    pub ext: ClaimableBalanceEntryExtensionV1Ext,
15371    pub flags: u32,
15372}
15373
15374impl ReadXdr for ClaimableBalanceEntryExtensionV1 {
15375    #[cfg(feature = "std")]
15376    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
15377        r.with_limited_depth(|r| {
15378            Ok(Self {
15379                ext: ClaimableBalanceEntryExtensionV1Ext::read_xdr(r)?,
15380                flags: u32::read_xdr(r)?,
15381            })
15382        })
15383    }
15384}
15385
15386impl WriteXdr for ClaimableBalanceEntryExtensionV1 {
15387    #[cfg(feature = "std")]
15388    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
15389        w.with_limited_depth(|w| {
15390            self.ext.write_xdr(w)?;
15391            self.flags.write_xdr(w)?;
15392            Ok(())
15393        })
15394    }
15395}
15396
15397/// ClaimableBalanceEntryExt is an XDR NestedUnion defines as:
15398///
15399/// ```text
15400/// union switch (int v)
15401///     {
15402///     case 0:
15403///         void;
15404///     case 1:
15405///         ClaimableBalanceEntryExtensionV1 v1;
15406///     }
15407/// ```
15408///
15409// union with discriminant i32
15410#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
15411#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
15412#[cfg_attr(
15413    all(feature = "serde", feature = "alloc"),
15414    derive(serde::Serialize, serde::Deserialize),
15415    serde(rename_all = "snake_case")
15416)]
15417#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
15418#[allow(clippy::large_enum_variant)]
15419pub enum ClaimableBalanceEntryExt {
15420    V0,
15421    V1(ClaimableBalanceEntryExtensionV1),
15422}
15423
15424impl ClaimableBalanceEntryExt {
15425    pub const VARIANTS: [i32; 2] = [0, 1];
15426    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"];
15427
15428    #[must_use]
15429    pub const fn name(&self) -> &'static str {
15430        match self {
15431            Self::V0 => "V0",
15432            Self::V1(_) => "V1",
15433        }
15434    }
15435
15436    #[must_use]
15437    pub const fn discriminant(&self) -> i32 {
15438        #[allow(clippy::match_same_arms)]
15439        match self {
15440            Self::V0 => 0,
15441            Self::V1(_) => 1,
15442        }
15443    }
15444
15445    #[must_use]
15446    pub const fn variants() -> [i32; 2] {
15447        Self::VARIANTS
15448    }
15449}
15450
15451impl Name for ClaimableBalanceEntryExt {
15452    #[must_use]
15453    fn name(&self) -> &'static str {
15454        Self::name(self)
15455    }
15456}
15457
15458impl Discriminant<i32> for ClaimableBalanceEntryExt {
15459    #[must_use]
15460    fn discriminant(&self) -> i32 {
15461        Self::discriminant(self)
15462    }
15463}
15464
15465impl Variants<i32> for ClaimableBalanceEntryExt {
15466    fn variants() -> slice::Iter<'static, i32> {
15467        Self::VARIANTS.iter()
15468    }
15469}
15470
15471impl Union<i32> for ClaimableBalanceEntryExt {}
15472
15473impl ReadXdr for ClaimableBalanceEntryExt {
15474    #[cfg(feature = "std")]
15475    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
15476        r.with_limited_depth(|r| {
15477            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
15478            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
15479            let v = match dv {
15480                0 => Self::V0,
15481                1 => Self::V1(ClaimableBalanceEntryExtensionV1::read_xdr(r)?),
15482                #[allow(unreachable_patterns)]
15483                _ => return Err(Error::Invalid),
15484            };
15485            Ok(v)
15486        })
15487    }
15488}
15489
15490impl WriteXdr for ClaimableBalanceEntryExt {
15491    #[cfg(feature = "std")]
15492    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
15493        w.with_limited_depth(|w| {
15494            self.discriminant().write_xdr(w)?;
15495            #[allow(clippy::match_same_arms)]
15496            match self {
15497                Self::V0 => ().write_xdr(w)?,
15498                Self::V1(v) => v.write_xdr(w)?,
15499            };
15500            Ok(())
15501        })
15502    }
15503}
15504
15505/// ClaimableBalanceEntry is an XDR Struct defines as:
15506///
15507/// ```text
15508/// struct ClaimableBalanceEntry
15509/// {
15510///     // Unique identifier for this ClaimableBalanceEntry
15511///     ClaimableBalanceID balanceID;
15512///
15513///     // List of claimants with associated predicate
15514///     Claimant claimants<10>;
15515///
15516///     // Any asset including native
15517///     Asset asset;
15518///
15519///     // Amount of asset
15520///     int64 amount;
15521///
15522///     // reserved for future use
15523///     union switch (int v)
15524///     {
15525///     case 0:
15526///         void;
15527///     case 1:
15528///         ClaimableBalanceEntryExtensionV1 v1;
15529///     }
15530///     ext;
15531/// };
15532/// ```
15533///
15534#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
15535#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
15536#[cfg_attr(
15537    all(feature = "serde", feature = "alloc"),
15538    derive(serde::Serialize, serde::Deserialize),
15539    serde(rename_all = "snake_case")
15540)]
15541#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
15542pub struct ClaimableBalanceEntry {
15543    pub balance_id: ClaimableBalanceId,
15544    pub claimants: VecM<Claimant, 10>,
15545    pub asset: Asset,
15546    pub amount: i64,
15547    pub ext: ClaimableBalanceEntryExt,
15548}
15549
15550impl ReadXdr for ClaimableBalanceEntry {
15551    #[cfg(feature = "std")]
15552    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
15553        r.with_limited_depth(|r| {
15554            Ok(Self {
15555                balance_id: ClaimableBalanceId::read_xdr(r)?,
15556                claimants: VecM::<Claimant, 10>::read_xdr(r)?,
15557                asset: Asset::read_xdr(r)?,
15558                amount: i64::read_xdr(r)?,
15559                ext: ClaimableBalanceEntryExt::read_xdr(r)?,
15560            })
15561        })
15562    }
15563}
15564
15565impl WriteXdr for ClaimableBalanceEntry {
15566    #[cfg(feature = "std")]
15567    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
15568        w.with_limited_depth(|w| {
15569            self.balance_id.write_xdr(w)?;
15570            self.claimants.write_xdr(w)?;
15571            self.asset.write_xdr(w)?;
15572            self.amount.write_xdr(w)?;
15573            self.ext.write_xdr(w)?;
15574            Ok(())
15575        })
15576    }
15577}
15578
15579/// LiquidityPoolConstantProductParameters is an XDR Struct defines as:
15580///
15581/// ```text
15582/// struct LiquidityPoolConstantProductParameters
15583/// {
15584///     Asset assetA; // assetA < assetB
15585///     Asset assetB;
15586///     int32 fee; // Fee is in basis points, so the actual rate is (fee/100)%
15587/// };
15588/// ```
15589///
15590#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
15591#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
15592#[cfg_attr(
15593    all(feature = "serde", feature = "alloc"),
15594    derive(serde::Serialize, serde::Deserialize),
15595    serde(rename_all = "snake_case")
15596)]
15597#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
15598pub struct LiquidityPoolConstantProductParameters {
15599    pub asset_a: Asset,
15600    pub asset_b: Asset,
15601    pub fee: i32,
15602}
15603
15604impl ReadXdr for LiquidityPoolConstantProductParameters {
15605    #[cfg(feature = "std")]
15606    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
15607        r.with_limited_depth(|r| {
15608            Ok(Self {
15609                asset_a: Asset::read_xdr(r)?,
15610                asset_b: Asset::read_xdr(r)?,
15611                fee: i32::read_xdr(r)?,
15612            })
15613        })
15614    }
15615}
15616
15617impl WriteXdr for LiquidityPoolConstantProductParameters {
15618    #[cfg(feature = "std")]
15619    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
15620        w.with_limited_depth(|w| {
15621            self.asset_a.write_xdr(w)?;
15622            self.asset_b.write_xdr(w)?;
15623            self.fee.write_xdr(w)?;
15624            Ok(())
15625        })
15626    }
15627}
15628
15629/// LiquidityPoolEntryConstantProduct is an XDR NestedStruct defines as:
15630///
15631/// ```text
15632/// struct
15633///         {
15634///             LiquidityPoolConstantProductParameters params;
15635///
15636///             int64 reserveA;        // amount of A in the pool
15637///             int64 reserveB;        // amount of B in the pool
15638///             int64 totalPoolShares; // total number of pool shares issued
15639///             int64 poolSharesTrustLineCount; // number of trust lines for the
15640///                                             // associated pool shares
15641///         }
15642/// ```
15643///
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))]
15652pub struct LiquidityPoolEntryConstantProduct {
15653    pub params: LiquidityPoolConstantProductParameters,
15654    pub reserve_a: i64,
15655    pub reserve_b: i64,
15656    pub total_pool_shares: i64,
15657    pub pool_shares_trust_line_count: i64,
15658}
15659
15660impl ReadXdr for LiquidityPoolEntryConstantProduct {
15661    #[cfg(feature = "std")]
15662    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
15663        r.with_limited_depth(|r| {
15664            Ok(Self {
15665                params: LiquidityPoolConstantProductParameters::read_xdr(r)?,
15666                reserve_a: i64::read_xdr(r)?,
15667                reserve_b: i64::read_xdr(r)?,
15668                total_pool_shares: i64::read_xdr(r)?,
15669                pool_shares_trust_line_count: i64::read_xdr(r)?,
15670            })
15671        })
15672    }
15673}
15674
15675impl WriteXdr for LiquidityPoolEntryConstantProduct {
15676    #[cfg(feature = "std")]
15677    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
15678        w.with_limited_depth(|w| {
15679            self.params.write_xdr(w)?;
15680            self.reserve_a.write_xdr(w)?;
15681            self.reserve_b.write_xdr(w)?;
15682            self.total_pool_shares.write_xdr(w)?;
15683            self.pool_shares_trust_line_count.write_xdr(w)?;
15684            Ok(())
15685        })
15686    }
15687}
15688
15689/// LiquidityPoolEntryBody is an XDR NestedUnion defines as:
15690///
15691/// ```text
15692/// union switch (LiquidityPoolType type)
15693///     {
15694///     case LIQUIDITY_POOL_CONSTANT_PRODUCT:
15695///         struct
15696///         {
15697///             LiquidityPoolConstantProductParameters params;
15698///
15699///             int64 reserveA;        // amount of A in the pool
15700///             int64 reserveB;        // amount of B in the pool
15701///             int64 totalPoolShares; // total number of pool shares issued
15702///             int64 poolSharesTrustLineCount; // number of trust lines for the
15703///                                             // associated pool shares
15704///         } constantProduct;
15705///     }
15706/// ```
15707///
15708// union with discriminant LiquidityPoolType
15709#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
15710#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
15711#[cfg_attr(
15712    all(feature = "serde", feature = "alloc"),
15713    derive(serde::Serialize, serde::Deserialize),
15714    serde(rename_all = "snake_case")
15715)]
15716#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
15717#[allow(clippy::large_enum_variant)]
15718pub enum LiquidityPoolEntryBody {
15719    LiquidityPoolConstantProduct(LiquidityPoolEntryConstantProduct),
15720}
15721
15722impl LiquidityPoolEntryBody {
15723    pub const VARIANTS: [LiquidityPoolType; 1] = [LiquidityPoolType::LiquidityPoolConstantProduct];
15724    pub const VARIANTS_STR: [&'static str; 1] = ["LiquidityPoolConstantProduct"];
15725
15726    #[must_use]
15727    pub const fn name(&self) -> &'static str {
15728        match self {
15729            Self::LiquidityPoolConstantProduct(_) => "LiquidityPoolConstantProduct",
15730        }
15731    }
15732
15733    #[must_use]
15734    pub const fn discriminant(&self) -> LiquidityPoolType {
15735        #[allow(clippy::match_same_arms)]
15736        match self {
15737            Self::LiquidityPoolConstantProduct(_) => {
15738                LiquidityPoolType::LiquidityPoolConstantProduct
15739            }
15740        }
15741    }
15742
15743    #[must_use]
15744    pub const fn variants() -> [LiquidityPoolType; 1] {
15745        Self::VARIANTS
15746    }
15747}
15748
15749impl Name for LiquidityPoolEntryBody {
15750    #[must_use]
15751    fn name(&self) -> &'static str {
15752        Self::name(self)
15753    }
15754}
15755
15756impl Discriminant<LiquidityPoolType> for LiquidityPoolEntryBody {
15757    #[must_use]
15758    fn discriminant(&self) -> LiquidityPoolType {
15759        Self::discriminant(self)
15760    }
15761}
15762
15763impl Variants<LiquidityPoolType> for LiquidityPoolEntryBody {
15764    fn variants() -> slice::Iter<'static, LiquidityPoolType> {
15765        Self::VARIANTS.iter()
15766    }
15767}
15768
15769impl Union<LiquidityPoolType> for LiquidityPoolEntryBody {}
15770
15771impl ReadXdr for LiquidityPoolEntryBody {
15772    #[cfg(feature = "std")]
15773    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
15774        r.with_limited_depth(|r| {
15775            let dv: LiquidityPoolType = <LiquidityPoolType as ReadXdr>::read_xdr(r)?;
15776            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
15777            let v = match dv {
15778                LiquidityPoolType::LiquidityPoolConstantProduct => {
15779                    Self::LiquidityPoolConstantProduct(LiquidityPoolEntryConstantProduct::read_xdr(
15780                        r,
15781                    )?)
15782                }
15783                #[allow(unreachable_patterns)]
15784                _ => return Err(Error::Invalid),
15785            };
15786            Ok(v)
15787        })
15788    }
15789}
15790
15791impl WriteXdr for LiquidityPoolEntryBody {
15792    #[cfg(feature = "std")]
15793    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
15794        w.with_limited_depth(|w| {
15795            self.discriminant().write_xdr(w)?;
15796            #[allow(clippy::match_same_arms)]
15797            match self {
15798                Self::LiquidityPoolConstantProduct(v) => v.write_xdr(w)?,
15799            };
15800            Ok(())
15801        })
15802    }
15803}
15804
15805/// LiquidityPoolEntry is an XDR Struct defines as:
15806///
15807/// ```text
15808/// struct LiquidityPoolEntry
15809/// {
15810///     PoolID liquidityPoolID;
15811///
15812///     union switch (LiquidityPoolType type)
15813///     {
15814///     case LIQUIDITY_POOL_CONSTANT_PRODUCT:
15815///         struct
15816///         {
15817///             LiquidityPoolConstantProductParameters params;
15818///
15819///             int64 reserveA;        // amount of A in the pool
15820///             int64 reserveB;        // amount of B in the pool
15821///             int64 totalPoolShares; // total number of pool shares issued
15822///             int64 poolSharesTrustLineCount; // number of trust lines for the
15823///                                             // associated pool shares
15824///         } constantProduct;
15825///     }
15826///     body;
15827/// };
15828/// ```
15829///
15830#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
15831#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
15832#[cfg_attr(
15833    all(feature = "serde", feature = "alloc"),
15834    derive(serde::Serialize, serde::Deserialize),
15835    serde(rename_all = "snake_case")
15836)]
15837#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
15838pub struct LiquidityPoolEntry {
15839    pub liquidity_pool_id: PoolId,
15840    pub body: LiquidityPoolEntryBody,
15841}
15842
15843impl ReadXdr for LiquidityPoolEntry {
15844    #[cfg(feature = "std")]
15845    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
15846        r.with_limited_depth(|r| {
15847            Ok(Self {
15848                liquidity_pool_id: PoolId::read_xdr(r)?,
15849                body: LiquidityPoolEntryBody::read_xdr(r)?,
15850            })
15851        })
15852    }
15853}
15854
15855impl WriteXdr for LiquidityPoolEntry {
15856    #[cfg(feature = "std")]
15857    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
15858        w.with_limited_depth(|w| {
15859            self.liquidity_pool_id.write_xdr(w)?;
15860            self.body.write_xdr(w)?;
15861            Ok(())
15862        })
15863    }
15864}
15865
15866/// ContractDataDurability is an XDR Enum defines as:
15867///
15868/// ```text
15869/// enum ContractDataDurability {
15870///     TEMPORARY = 0,
15871///     PERSISTENT = 1
15872/// };
15873/// ```
15874///
15875// enum
15876#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
15877#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
15878#[cfg_attr(
15879    all(feature = "serde", feature = "alloc"),
15880    derive(serde::Serialize, serde::Deserialize),
15881    serde(rename_all = "snake_case")
15882)]
15883#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
15884#[repr(i32)]
15885pub enum ContractDataDurability {
15886    Temporary = 0,
15887    Persistent = 1,
15888}
15889
15890impl ContractDataDurability {
15891    pub const VARIANTS: [ContractDataDurability; 2] = [
15892        ContractDataDurability::Temporary,
15893        ContractDataDurability::Persistent,
15894    ];
15895    pub const VARIANTS_STR: [&'static str; 2] = ["Temporary", "Persistent"];
15896
15897    #[must_use]
15898    pub const fn name(&self) -> &'static str {
15899        match self {
15900            Self::Temporary => "Temporary",
15901            Self::Persistent => "Persistent",
15902        }
15903    }
15904
15905    #[must_use]
15906    pub const fn variants() -> [ContractDataDurability; 2] {
15907        Self::VARIANTS
15908    }
15909}
15910
15911impl Name for ContractDataDurability {
15912    #[must_use]
15913    fn name(&self) -> &'static str {
15914        Self::name(self)
15915    }
15916}
15917
15918impl Variants<ContractDataDurability> for ContractDataDurability {
15919    fn variants() -> slice::Iter<'static, ContractDataDurability> {
15920        Self::VARIANTS.iter()
15921    }
15922}
15923
15924impl Enum for ContractDataDurability {}
15925
15926impl fmt::Display for ContractDataDurability {
15927    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
15928        f.write_str(self.name())
15929    }
15930}
15931
15932impl TryFrom<i32> for ContractDataDurability {
15933    type Error = Error;
15934
15935    fn try_from(i: i32) -> Result<Self> {
15936        let e = match i {
15937            0 => ContractDataDurability::Temporary,
15938            1 => ContractDataDurability::Persistent,
15939            #[allow(unreachable_patterns)]
15940            _ => return Err(Error::Invalid),
15941        };
15942        Ok(e)
15943    }
15944}
15945
15946impl From<ContractDataDurability> for i32 {
15947    #[must_use]
15948    fn from(e: ContractDataDurability) -> Self {
15949        e as Self
15950    }
15951}
15952
15953impl ReadXdr for ContractDataDurability {
15954    #[cfg(feature = "std")]
15955    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
15956        r.with_limited_depth(|r| {
15957            let e = i32::read_xdr(r)?;
15958            let v: Self = e.try_into()?;
15959            Ok(v)
15960        })
15961    }
15962}
15963
15964impl WriteXdr for ContractDataDurability {
15965    #[cfg(feature = "std")]
15966    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
15967        w.with_limited_depth(|w| {
15968            let i: i32 = (*self).into();
15969            i.write_xdr(w)
15970        })
15971    }
15972}
15973
15974/// ContractDataEntry is an XDR Struct defines as:
15975///
15976/// ```text
15977/// struct ContractDataEntry {
15978///     ExtensionPoint ext;
15979///
15980///     SCAddress contract;
15981///     SCVal key;
15982///     ContractDataDurability durability;
15983///     SCVal val;
15984/// };
15985/// ```
15986///
15987#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
15988#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
15989#[cfg_attr(
15990    all(feature = "serde", feature = "alloc"),
15991    derive(serde::Serialize, serde::Deserialize),
15992    serde(rename_all = "snake_case")
15993)]
15994#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
15995pub struct ContractDataEntry {
15996    pub ext: ExtensionPoint,
15997    pub contract: ScAddress,
15998    pub key: ScVal,
15999    pub durability: ContractDataDurability,
16000    pub val: ScVal,
16001}
16002
16003impl ReadXdr for ContractDataEntry {
16004    #[cfg(feature = "std")]
16005    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
16006        r.with_limited_depth(|r| {
16007            Ok(Self {
16008                ext: ExtensionPoint::read_xdr(r)?,
16009                contract: ScAddress::read_xdr(r)?,
16010                key: ScVal::read_xdr(r)?,
16011                durability: ContractDataDurability::read_xdr(r)?,
16012                val: ScVal::read_xdr(r)?,
16013            })
16014        })
16015    }
16016}
16017
16018impl WriteXdr for ContractDataEntry {
16019    #[cfg(feature = "std")]
16020    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
16021        w.with_limited_depth(|w| {
16022            self.ext.write_xdr(w)?;
16023            self.contract.write_xdr(w)?;
16024            self.key.write_xdr(w)?;
16025            self.durability.write_xdr(w)?;
16026            self.val.write_xdr(w)?;
16027            Ok(())
16028        })
16029    }
16030}
16031
16032/// ContractCodeCostInputs is an XDR Struct defines as:
16033///
16034/// ```text
16035/// struct ContractCodeCostInputs {
16036///     ExtensionPoint ext;
16037///     uint32 nInstructions;
16038///     uint32 nFunctions;
16039///     uint32 nGlobals;
16040///     uint32 nTableEntries;
16041///     uint32 nTypes;
16042///     uint32 nDataSegments;
16043///     uint32 nElemSegments;
16044///     uint32 nImports;
16045///     uint32 nExports;
16046///     uint32 nDataSegmentBytes;
16047/// };
16048/// ```
16049///
16050#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
16051#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
16052#[cfg_attr(
16053    all(feature = "serde", feature = "alloc"),
16054    derive(serde::Serialize, serde::Deserialize),
16055    serde(rename_all = "snake_case")
16056)]
16057#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
16058pub struct ContractCodeCostInputs {
16059    pub ext: ExtensionPoint,
16060    pub n_instructions: u32,
16061    pub n_functions: u32,
16062    pub n_globals: u32,
16063    pub n_table_entries: u32,
16064    pub n_types: u32,
16065    pub n_data_segments: u32,
16066    pub n_elem_segments: u32,
16067    pub n_imports: u32,
16068    pub n_exports: u32,
16069    pub n_data_segment_bytes: u32,
16070}
16071
16072impl ReadXdr for ContractCodeCostInputs {
16073    #[cfg(feature = "std")]
16074    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
16075        r.with_limited_depth(|r| {
16076            Ok(Self {
16077                ext: ExtensionPoint::read_xdr(r)?,
16078                n_instructions: u32::read_xdr(r)?,
16079                n_functions: u32::read_xdr(r)?,
16080                n_globals: u32::read_xdr(r)?,
16081                n_table_entries: u32::read_xdr(r)?,
16082                n_types: u32::read_xdr(r)?,
16083                n_data_segments: u32::read_xdr(r)?,
16084                n_elem_segments: u32::read_xdr(r)?,
16085                n_imports: u32::read_xdr(r)?,
16086                n_exports: u32::read_xdr(r)?,
16087                n_data_segment_bytes: u32::read_xdr(r)?,
16088            })
16089        })
16090    }
16091}
16092
16093impl WriteXdr for ContractCodeCostInputs {
16094    #[cfg(feature = "std")]
16095    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
16096        w.with_limited_depth(|w| {
16097            self.ext.write_xdr(w)?;
16098            self.n_instructions.write_xdr(w)?;
16099            self.n_functions.write_xdr(w)?;
16100            self.n_globals.write_xdr(w)?;
16101            self.n_table_entries.write_xdr(w)?;
16102            self.n_types.write_xdr(w)?;
16103            self.n_data_segments.write_xdr(w)?;
16104            self.n_elem_segments.write_xdr(w)?;
16105            self.n_imports.write_xdr(w)?;
16106            self.n_exports.write_xdr(w)?;
16107            self.n_data_segment_bytes.write_xdr(w)?;
16108            Ok(())
16109        })
16110    }
16111}
16112
16113/// ContractCodeEntryV1 is an XDR NestedStruct defines as:
16114///
16115/// ```text
16116/// struct
16117///             {
16118///                 ExtensionPoint ext;
16119///                 ContractCodeCostInputs costInputs;
16120///             }
16121/// ```
16122///
16123#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
16124#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
16125#[cfg_attr(
16126    all(feature = "serde", feature = "alloc"),
16127    derive(serde::Serialize, serde::Deserialize),
16128    serde(rename_all = "snake_case")
16129)]
16130#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
16131pub struct ContractCodeEntryV1 {
16132    pub ext: ExtensionPoint,
16133    pub cost_inputs: ContractCodeCostInputs,
16134}
16135
16136impl ReadXdr for ContractCodeEntryV1 {
16137    #[cfg(feature = "std")]
16138    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
16139        r.with_limited_depth(|r| {
16140            Ok(Self {
16141                ext: ExtensionPoint::read_xdr(r)?,
16142                cost_inputs: ContractCodeCostInputs::read_xdr(r)?,
16143            })
16144        })
16145    }
16146}
16147
16148impl WriteXdr for ContractCodeEntryV1 {
16149    #[cfg(feature = "std")]
16150    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
16151        w.with_limited_depth(|w| {
16152            self.ext.write_xdr(w)?;
16153            self.cost_inputs.write_xdr(w)?;
16154            Ok(())
16155        })
16156    }
16157}
16158
16159/// ContractCodeEntryExt is an XDR NestedUnion defines as:
16160///
16161/// ```text
16162/// union switch (int v)
16163///     {
16164///         case 0:
16165///             void;
16166///         case 1:
16167///             struct
16168///             {
16169///                 ExtensionPoint ext;
16170///                 ContractCodeCostInputs costInputs;
16171///             } v1;
16172///     }
16173/// ```
16174///
16175// union with discriminant i32
16176#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
16177#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
16178#[cfg_attr(
16179    all(feature = "serde", feature = "alloc"),
16180    derive(serde::Serialize, serde::Deserialize),
16181    serde(rename_all = "snake_case")
16182)]
16183#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
16184#[allow(clippy::large_enum_variant)]
16185pub enum ContractCodeEntryExt {
16186    V0,
16187    V1(ContractCodeEntryV1),
16188}
16189
16190impl ContractCodeEntryExt {
16191    pub const VARIANTS: [i32; 2] = [0, 1];
16192    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"];
16193
16194    #[must_use]
16195    pub const fn name(&self) -> &'static str {
16196        match self {
16197            Self::V0 => "V0",
16198            Self::V1(_) => "V1",
16199        }
16200    }
16201
16202    #[must_use]
16203    pub const fn discriminant(&self) -> i32 {
16204        #[allow(clippy::match_same_arms)]
16205        match self {
16206            Self::V0 => 0,
16207            Self::V1(_) => 1,
16208        }
16209    }
16210
16211    #[must_use]
16212    pub const fn variants() -> [i32; 2] {
16213        Self::VARIANTS
16214    }
16215}
16216
16217impl Name for ContractCodeEntryExt {
16218    #[must_use]
16219    fn name(&self) -> &'static str {
16220        Self::name(self)
16221    }
16222}
16223
16224impl Discriminant<i32> for ContractCodeEntryExt {
16225    #[must_use]
16226    fn discriminant(&self) -> i32 {
16227        Self::discriminant(self)
16228    }
16229}
16230
16231impl Variants<i32> for ContractCodeEntryExt {
16232    fn variants() -> slice::Iter<'static, i32> {
16233        Self::VARIANTS.iter()
16234    }
16235}
16236
16237impl Union<i32> for ContractCodeEntryExt {}
16238
16239impl ReadXdr for ContractCodeEntryExt {
16240    #[cfg(feature = "std")]
16241    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
16242        r.with_limited_depth(|r| {
16243            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
16244            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
16245            let v = match dv {
16246                0 => Self::V0,
16247                1 => Self::V1(ContractCodeEntryV1::read_xdr(r)?),
16248                #[allow(unreachable_patterns)]
16249                _ => return Err(Error::Invalid),
16250            };
16251            Ok(v)
16252        })
16253    }
16254}
16255
16256impl WriteXdr for ContractCodeEntryExt {
16257    #[cfg(feature = "std")]
16258    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
16259        w.with_limited_depth(|w| {
16260            self.discriminant().write_xdr(w)?;
16261            #[allow(clippy::match_same_arms)]
16262            match self {
16263                Self::V0 => ().write_xdr(w)?,
16264                Self::V1(v) => v.write_xdr(w)?,
16265            };
16266            Ok(())
16267        })
16268    }
16269}
16270
16271/// ContractCodeEntry is an XDR Struct defines as:
16272///
16273/// ```text
16274/// struct ContractCodeEntry {
16275///     union switch (int v)
16276///     {
16277///         case 0:
16278///             void;
16279///         case 1:
16280///             struct
16281///             {
16282///                 ExtensionPoint ext;
16283///                 ContractCodeCostInputs costInputs;
16284///             } v1;
16285///     } ext;
16286///
16287///     Hash hash;
16288///     opaque code<>;
16289/// };
16290/// ```
16291///
16292#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
16293#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
16294#[cfg_attr(
16295    all(feature = "serde", feature = "alloc"),
16296    derive(serde::Serialize, serde::Deserialize),
16297    serde(rename_all = "snake_case")
16298)]
16299#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
16300pub struct ContractCodeEntry {
16301    pub ext: ContractCodeEntryExt,
16302    pub hash: Hash,
16303    pub code: BytesM,
16304}
16305
16306impl ReadXdr for ContractCodeEntry {
16307    #[cfg(feature = "std")]
16308    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
16309        r.with_limited_depth(|r| {
16310            Ok(Self {
16311                ext: ContractCodeEntryExt::read_xdr(r)?,
16312                hash: Hash::read_xdr(r)?,
16313                code: BytesM::read_xdr(r)?,
16314            })
16315        })
16316    }
16317}
16318
16319impl WriteXdr for ContractCodeEntry {
16320    #[cfg(feature = "std")]
16321    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
16322        w.with_limited_depth(|w| {
16323            self.ext.write_xdr(w)?;
16324            self.hash.write_xdr(w)?;
16325            self.code.write_xdr(w)?;
16326            Ok(())
16327        })
16328    }
16329}
16330
16331/// TtlEntry is an XDR Struct defines as:
16332///
16333/// ```text
16334/// struct TTLEntry {
16335///     // Hash of the LedgerKey that is associated with this TTLEntry
16336///     Hash keyHash;
16337///     uint32 liveUntilLedgerSeq;
16338/// };
16339/// ```
16340///
16341#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
16342#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
16343#[cfg_attr(
16344    all(feature = "serde", feature = "alloc"),
16345    derive(serde::Serialize, serde::Deserialize),
16346    serde(rename_all = "snake_case")
16347)]
16348#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
16349pub struct TtlEntry {
16350    pub key_hash: Hash,
16351    pub live_until_ledger_seq: u32,
16352}
16353
16354impl ReadXdr for TtlEntry {
16355    #[cfg(feature = "std")]
16356    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
16357        r.with_limited_depth(|r| {
16358            Ok(Self {
16359                key_hash: Hash::read_xdr(r)?,
16360                live_until_ledger_seq: u32::read_xdr(r)?,
16361            })
16362        })
16363    }
16364}
16365
16366impl WriteXdr for TtlEntry {
16367    #[cfg(feature = "std")]
16368    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
16369        w.with_limited_depth(|w| {
16370            self.key_hash.write_xdr(w)?;
16371            self.live_until_ledger_seq.write_xdr(w)?;
16372            Ok(())
16373        })
16374    }
16375}
16376
16377/// LedgerEntryExtensionV1Ext is an XDR NestedUnion defines as:
16378///
16379/// ```text
16380/// union switch (int v)
16381///     {
16382///     case 0:
16383///         void;
16384///     }
16385/// ```
16386///
16387// union with discriminant i32
16388#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
16389#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
16390#[cfg_attr(
16391    all(feature = "serde", feature = "alloc"),
16392    derive(serde::Serialize, serde::Deserialize),
16393    serde(rename_all = "snake_case")
16394)]
16395#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
16396#[allow(clippy::large_enum_variant)]
16397pub enum LedgerEntryExtensionV1Ext {
16398    V0,
16399}
16400
16401impl LedgerEntryExtensionV1Ext {
16402    pub const VARIANTS: [i32; 1] = [0];
16403    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
16404
16405    #[must_use]
16406    pub const fn name(&self) -> &'static str {
16407        match self {
16408            Self::V0 => "V0",
16409        }
16410    }
16411
16412    #[must_use]
16413    pub const fn discriminant(&self) -> i32 {
16414        #[allow(clippy::match_same_arms)]
16415        match self {
16416            Self::V0 => 0,
16417        }
16418    }
16419
16420    #[must_use]
16421    pub const fn variants() -> [i32; 1] {
16422        Self::VARIANTS
16423    }
16424}
16425
16426impl Name for LedgerEntryExtensionV1Ext {
16427    #[must_use]
16428    fn name(&self) -> &'static str {
16429        Self::name(self)
16430    }
16431}
16432
16433impl Discriminant<i32> for LedgerEntryExtensionV1Ext {
16434    #[must_use]
16435    fn discriminant(&self) -> i32 {
16436        Self::discriminant(self)
16437    }
16438}
16439
16440impl Variants<i32> for LedgerEntryExtensionV1Ext {
16441    fn variants() -> slice::Iter<'static, i32> {
16442        Self::VARIANTS.iter()
16443    }
16444}
16445
16446impl Union<i32> for LedgerEntryExtensionV1Ext {}
16447
16448impl ReadXdr for LedgerEntryExtensionV1Ext {
16449    #[cfg(feature = "std")]
16450    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
16451        r.with_limited_depth(|r| {
16452            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
16453            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
16454            let v = match dv {
16455                0 => Self::V0,
16456                #[allow(unreachable_patterns)]
16457                _ => return Err(Error::Invalid),
16458            };
16459            Ok(v)
16460        })
16461    }
16462}
16463
16464impl WriteXdr for LedgerEntryExtensionV1Ext {
16465    #[cfg(feature = "std")]
16466    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
16467        w.with_limited_depth(|w| {
16468            self.discriminant().write_xdr(w)?;
16469            #[allow(clippy::match_same_arms)]
16470            match self {
16471                Self::V0 => ().write_xdr(w)?,
16472            };
16473            Ok(())
16474        })
16475    }
16476}
16477
16478/// LedgerEntryExtensionV1 is an XDR Struct defines as:
16479///
16480/// ```text
16481/// struct LedgerEntryExtensionV1
16482/// {
16483///     SponsorshipDescriptor sponsoringID;
16484///
16485///     union switch (int v)
16486///     {
16487///     case 0:
16488///         void;
16489///     }
16490///     ext;
16491/// };
16492/// ```
16493///
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))]
16502pub struct LedgerEntryExtensionV1 {
16503    pub sponsoring_id: SponsorshipDescriptor,
16504    pub ext: LedgerEntryExtensionV1Ext,
16505}
16506
16507impl ReadXdr for LedgerEntryExtensionV1 {
16508    #[cfg(feature = "std")]
16509    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
16510        r.with_limited_depth(|r| {
16511            Ok(Self {
16512                sponsoring_id: SponsorshipDescriptor::read_xdr(r)?,
16513                ext: LedgerEntryExtensionV1Ext::read_xdr(r)?,
16514            })
16515        })
16516    }
16517}
16518
16519impl WriteXdr for LedgerEntryExtensionV1 {
16520    #[cfg(feature = "std")]
16521    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
16522        w.with_limited_depth(|w| {
16523            self.sponsoring_id.write_xdr(w)?;
16524            self.ext.write_xdr(w)?;
16525            Ok(())
16526        })
16527    }
16528}
16529
16530/// LedgerEntryData is an XDR NestedUnion defines as:
16531///
16532/// ```text
16533/// union switch (LedgerEntryType type)
16534///     {
16535///     case ACCOUNT:
16536///         AccountEntry account;
16537///     case TRUSTLINE:
16538///         TrustLineEntry trustLine;
16539///     case OFFER:
16540///         OfferEntry offer;
16541///     case DATA:
16542///         DataEntry data;
16543///     case CLAIMABLE_BALANCE:
16544///         ClaimableBalanceEntry claimableBalance;
16545///     case LIQUIDITY_POOL:
16546///         LiquidityPoolEntry liquidityPool;
16547///     case CONTRACT_DATA:
16548///         ContractDataEntry contractData;
16549///     case CONTRACT_CODE:
16550///         ContractCodeEntry contractCode;
16551///     case CONFIG_SETTING:
16552///         ConfigSettingEntry configSetting;
16553///     case TTL:
16554///         TTLEntry ttl;
16555///     }
16556/// ```
16557///
16558// union with discriminant LedgerEntryType
16559#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
16560#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
16561#[cfg_attr(
16562    all(feature = "serde", feature = "alloc"),
16563    derive(serde::Serialize, serde::Deserialize),
16564    serde(rename_all = "snake_case")
16565)]
16566#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
16567#[allow(clippy::large_enum_variant)]
16568pub enum LedgerEntryData {
16569    Account(AccountEntry),
16570    Trustline(TrustLineEntry),
16571    Offer(OfferEntry),
16572    Data(DataEntry),
16573    ClaimableBalance(ClaimableBalanceEntry),
16574    LiquidityPool(LiquidityPoolEntry),
16575    ContractData(ContractDataEntry),
16576    ContractCode(ContractCodeEntry),
16577    ConfigSetting(ConfigSettingEntry),
16578    Ttl(TtlEntry),
16579}
16580
16581impl LedgerEntryData {
16582    pub const VARIANTS: [LedgerEntryType; 10] = [
16583        LedgerEntryType::Account,
16584        LedgerEntryType::Trustline,
16585        LedgerEntryType::Offer,
16586        LedgerEntryType::Data,
16587        LedgerEntryType::ClaimableBalance,
16588        LedgerEntryType::LiquidityPool,
16589        LedgerEntryType::ContractData,
16590        LedgerEntryType::ContractCode,
16591        LedgerEntryType::ConfigSetting,
16592        LedgerEntryType::Ttl,
16593    ];
16594    pub const VARIANTS_STR: [&'static str; 10] = [
16595        "Account",
16596        "Trustline",
16597        "Offer",
16598        "Data",
16599        "ClaimableBalance",
16600        "LiquidityPool",
16601        "ContractData",
16602        "ContractCode",
16603        "ConfigSetting",
16604        "Ttl",
16605    ];
16606
16607    #[must_use]
16608    pub const fn name(&self) -> &'static str {
16609        match self {
16610            Self::Account(_) => "Account",
16611            Self::Trustline(_) => "Trustline",
16612            Self::Offer(_) => "Offer",
16613            Self::Data(_) => "Data",
16614            Self::ClaimableBalance(_) => "ClaimableBalance",
16615            Self::LiquidityPool(_) => "LiquidityPool",
16616            Self::ContractData(_) => "ContractData",
16617            Self::ContractCode(_) => "ContractCode",
16618            Self::ConfigSetting(_) => "ConfigSetting",
16619            Self::Ttl(_) => "Ttl",
16620        }
16621    }
16622
16623    #[must_use]
16624    pub const fn discriminant(&self) -> LedgerEntryType {
16625        #[allow(clippy::match_same_arms)]
16626        match self {
16627            Self::Account(_) => LedgerEntryType::Account,
16628            Self::Trustline(_) => LedgerEntryType::Trustline,
16629            Self::Offer(_) => LedgerEntryType::Offer,
16630            Self::Data(_) => LedgerEntryType::Data,
16631            Self::ClaimableBalance(_) => LedgerEntryType::ClaimableBalance,
16632            Self::LiquidityPool(_) => LedgerEntryType::LiquidityPool,
16633            Self::ContractData(_) => LedgerEntryType::ContractData,
16634            Self::ContractCode(_) => LedgerEntryType::ContractCode,
16635            Self::ConfigSetting(_) => LedgerEntryType::ConfigSetting,
16636            Self::Ttl(_) => LedgerEntryType::Ttl,
16637        }
16638    }
16639
16640    #[must_use]
16641    pub const fn variants() -> [LedgerEntryType; 10] {
16642        Self::VARIANTS
16643    }
16644}
16645
16646impl Name for LedgerEntryData {
16647    #[must_use]
16648    fn name(&self) -> &'static str {
16649        Self::name(self)
16650    }
16651}
16652
16653impl Discriminant<LedgerEntryType> for LedgerEntryData {
16654    #[must_use]
16655    fn discriminant(&self) -> LedgerEntryType {
16656        Self::discriminant(self)
16657    }
16658}
16659
16660impl Variants<LedgerEntryType> for LedgerEntryData {
16661    fn variants() -> slice::Iter<'static, LedgerEntryType> {
16662        Self::VARIANTS.iter()
16663    }
16664}
16665
16666impl Union<LedgerEntryType> for LedgerEntryData {}
16667
16668impl ReadXdr for LedgerEntryData {
16669    #[cfg(feature = "std")]
16670    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
16671        r.with_limited_depth(|r| {
16672            let dv: LedgerEntryType = <LedgerEntryType as ReadXdr>::read_xdr(r)?;
16673            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
16674            let v = match dv {
16675                LedgerEntryType::Account => Self::Account(AccountEntry::read_xdr(r)?),
16676                LedgerEntryType::Trustline => Self::Trustline(TrustLineEntry::read_xdr(r)?),
16677                LedgerEntryType::Offer => Self::Offer(OfferEntry::read_xdr(r)?),
16678                LedgerEntryType::Data => Self::Data(DataEntry::read_xdr(r)?),
16679                LedgerEntryType::ClaimableBalance => {
16680                    Self::ClaimableBalance(ClaimableBalanceEntry::read_xdr(r)?)
16681                }
16682                LedgerEntryType::LiquidityPool => {
16683                    Self::LiquidityPool(LiquidityPoolEntry::read_xdr(r)?)
16684                }
16685                LedgerEntryType::ContractData => {
16686                    Self::ContractData(ContractDataEntry::read_xdr(r)?)
16687                }
16688                LedgerEntryType::ContractCode => {
16689                    Self::ContractCode(ContractCodeEntry::read_xdr(r)?)
16690                }
16691                LedgerEntryType::ConfigSetting => {
16692                    Self::ConfigSetting(ConfigSettingEntry::read_xdr(r)?)
16693                }
16694                LedgerEntryType::Ttl => Self::Ttl(TtlEntry::read_xdr(r)?),
16695                #[allow(unreachable_patterns)]
16696                _ => return Err(Error::Invalid),
16697            };
16698            Ok(v)
16699        })
16700    }
16701}
16702
16703impl WriteXdr for LedgerEntryData {
16704    #[cfg(feature = "std")]
16705    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
16706        w.with_limited_depth(|w| {
16707            self.discriminant().write_xdr(w)?;
16708            #[allow(clippy::match_same_arms)]
16709            match self {
16710                Self::Account(v) => v.write_xdr(w)?,
16711                Self::Trustline(v) => v.write_xdr(w)?,
16712                Self::Offer(v) => v.write_xdr(w)?,
16713                Self::Data(v) => v.write_xdr(w)?,
16714                Self::ClaimableBalance(v) => v.write_xdr(w)?,
16715                Self::LiquidityPool(v) => v.write_xdr(w)?,
16716                Self::ContractData(v) => v.write_xdr(w)?,
16717                Self::ContractCode(v) => v.write_xdr(w)?,
16718                Self::ConfigSetting(v) => v.write_xdr(w)?,
16719                Self::Ttl(v) => v.write_xdr(w)?,
16720            };
16721            Ok(())
16722        })
16723    }
16724}
16725
16726/// LedgerEntryExt is an XDR NestedUnion defines as:
16727///
16728/// ```text
16729/// union switch (int v)
16730///     {
16731///     case 0:
16732///         void;
16733///     case 1:
16734///         LedgerEntryExtensionV1 v1;
16735///     }
16736/// ```
16737///
16738// union with discriminant i32
16739#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
16740#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
16741#[cfg_attr(
16742    all(feature = "serde", feature = "alloc"),
16743    derive(serde::Serialize, serde::Deserialize),
16744    serde(rename_all = "snake_case")
16745)]
16746#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
16747#[allow(clippy::large_enum_variant)]
16748pub enum LedgerEntryExt {
16749    V0,
16750    V1(LedgerEntryExtensionV1),
16751}
16752
16753impl LedgerEntryExt {
16754    pub const VARIANTS: [i32; 2] = [0, 1];
16755    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"];
16756
16757    #[must_use]
16758    pub const fn name(&self) -> &'static str {
16759        match self {
16760            Self::V0 => "V0",
16761            Self::V1(_) => "V1",
16762        }
16763    }
16764
16765    #[must_use]
16766    pub const fn discriminant(&self) -> i32 {
16767        #[allow(clippy::match_same_arms)]
16768        match self {
16769            Self::V0 => 0,
16770            Self::V1(_) => 1,
16771        }
16772    }
16773
16774    #[must_use]
16775    pub const fn variants() -> [i32; 2] {
16776        Self::VARIANTS
16777    }
16778}
16779
16780impl Name for LedgerEntryExt {
16781    #[must_use]
16782    fn name(&self) -> &'static str {
16783        Self::name(self)
16784    }
16785}
16786
16787impl Discriminant<i32> for LedgerEntryExt {
16788    #[must_use]
16789    fn discriminant(&self) -> i32 {
16790        Self::discriminant(self)
16791    }
16792}
16793
16794impl Variants<i32> for LedgerEntryExt {
16795    fn variants() -> slice::Iter<'static, i32> {
16796        Self::VARIANTS.iter()
16797    }
16798}
16799
16800impl Union<i32> for LedgerEntryExt {}
16801
16802impl ReadXdr for LedgerEntryExt {
16803    #[cfg(feature = "std")]
16804    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
16805        r.with_limited_depth(|r| {
16806            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
16807            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
16808            let v = match dv {
16809                0 => Self::V0,
16810                1 => Self::V1(LedgerEntryExtensionV1::read_xdr(r)?),
16811                #[allow(unreachable_patterns)]
16812                _ => return Err(Error::Invalid),
16813            };
16814            Ok(v)
16815        })
16816    }
16817}
16818
16819impl WriteXdr for LedgerEntryExt {
16820    #[cfg(feature = "std")]
16821    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
16822        w.with_limited_depth(|w| {
16823            self.discriminant().write_xdr(w)?;
16824            #[allow(clippy::match_same_arms)]
16825            match self {
16826                Self::V0 => ().write_xdr(w)?,
16827                Self::V1(v) => v.write_xdr(w)?,
16828            };
16829            Ok(())
16830        })
16831    }
16832}
16833
16834/// LedgerEntry is an XDR Struct defines as:
16835///
16836/// ```text
16837/// struct LedgerEntry
16838/// {
16839///     uint32 lastModifiedLedgerSeq; // ledger the LedgerEntry was last changed
16840///
16841///     union switch (LedgerEntryType type)
16842///     {
16843///     case ACCOUNT:
16844///         AccountEntry account;
16845///     case TRUSTLINE:
16846///         TrustLineEntry trustLine;
16847///     case OFFER:
16848///         OfferEntry offer;
16849///     case DATA:
16850///         DataEntry data;
16851///     case CLAIMABLE_BALANCE:
16852///         ClaimableBalanceEntry claimableBalance;
16853///     case LIQUIDITY_POOL:
16854///         LiquidityPoolEntry liquidityPool;
16855///     case CONTRACT_DATA:
16856///         ContractDataEntry contractData;
16857///     case CONTRACT_CODE:
16858///         ContractCodeEntry contractCode;
16859///     case CONFIG_SETTING:
16860///         ConfigSettingEntry configSetting;
16861///     case TTL:
16862///         TTLEntry ttl;
16863///     }
16864///     data;
16865///
16866///     // reserved for future use
16867///     union switch (int v)
16868///     {
16869///     case 0:
16870///         void;
16871///     case 1:
16872///         LedgerEntryExtensionV1 v1;
16873///     }
16874///     ext;
16875/// };
16876/// ```
16877///
16878#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
16879#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
16880#[cfg_attr(
16881    all(feature = "serde", feature = "alloc"),
16882    derive(serde::Serialize, serde::Deserialize),
16883    serde(rename_all = "snake_case")
16884)]
16885#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
16886pub struct LedgerEntry {
16887    pub last_modified_ledger_seq: u32,
16888    pub data: LedgerEntryData,
16889    pub ext: LedgerEntryExt,
16890}
16891
16892impl ReadXdr for LedgerEntry {
16893    #[cfg(feature = "std")]
16894    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
16895        r.with_limited_depth(|r| {
16896            Ok(Self {
16897                last_modified_ledger_seq: u32::read_xdr(r)?,
16898                data: LedgerEntryData::read_xdr(r)?,
16899                ext: LedgerEntryExt::read_xdr(r)?,
16900            })
16901        })
16902    }
16903}
16904
16905impl WriteXdr for LedgerEntry {
16906    #[cfg(feature = "std")]
16907    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
16908        w.with_limited_depth(|w| {
16909            self.last_modified_ledger_seq.write_xdr(w)?;
16910            self.data.write_xdr(w)?;
16911            self.ext.write_xdr(w)?;
16912            Ok(())
16913        })
16914    }
16915}
16916
16917/// LedgerKeyAccount is an XDR NestedStruct defines as:
16918///
16919/// ```text
16920/// struct
16921///     {
16922///         AccountID accountID;
16923///     }
16924/// ```
16925///
16926#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
16927#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
16928#[cfg_attr(
16929    all(feature = "serde", feature = "alloc"),
16930    derive(serde::Serialize, serde::Deserialize),
16931    serde(rename_all = "snake_case")
16932)]
16933#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
16934pub struct LedgerKeyAccount {
16935    pub account_id: AccountId,
16936}
16937
16938impl ReadXdr for LedgerKeyAccount {
16939    #[cfg(feature = "std")]
16940    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
16941        r.with_limited_depth(|r| {
16942            Ok(Self {
16943                account_id: AccountId::read_xdr(r)?,
16944            })
16945        })
16946    }
16947}
16948
16949impl WriteXdr for LedgerKeyAccount {
16950    #[cfg(feature = "std")]
16951    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
16952        w.with_limited_depth(|w| {
16953            self.account_id.write_xdr(w)?;
16954            Ok(())
16955        })
16956    }
16957}
16958
16959/// LedgerKeyTrustLine is an XDR NestedStruct defines as:
16960///
16961/// ```text
16962/// struct
16963///     {
16964///         AccountID accountID;
16965///         TrustLineAsset asset;
16966///     }
16967/// ```
16968///
16969#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
16970#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
16971#[cfg_attr(
16972    all(feature = "serde", feature = "alloc"),
16973    derive(serde::Serialize, serde::Deserialize),
16974    serde(rename_all = "snake_case")
16975)]
16976#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
16977pub struct LedgerKeyTrustLine {
16978    pub account_id: AccountId,
16979    pub asset: TrustLineAsset,
16980}
16981
16982impl ReadXdr for LedgerKeyTrustLine {
16983    #[cfg(feature = "std")]
16984    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
16985        r.with_limited_depth(|r| {
16986            Ok(Self {
16987                account_id: AccountId::read_xdr(r)?,
16988                asset: TrustLineAsset::read_xdr(r)?,
16989            })
16990        })
16991    }
16992}
16993
16994impl WriteXdr for LedgerKeyTrustLine {
16995    #[cfg(feature = "std")]
16996    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
16997        w.with_limited_depth(|w| {
16998            self.account_id.write_xdr(w)?;
16999            self.asset.write_xdr(w)?;
17000            Ok(())
17001        })
17002    }
17003}
17004
17005/// LedgerKeyOffer is an XDR NestedStruct defines as:
17006///
17007/// ```text
17008/// struct
17009///     {
17010///         AccountID sellerID;
17011///         int64 offerID;
17012///     }
17013/// ```
17014///
17015#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
17016#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
17017#[cfg_attr(
17018    all(feature = "serde", feature = "alloc"),
17019    derive(serde::Serialize, serde::Deserialize),
17020    serde(rename_all = "snake_case")
17021)]
17022#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
17023pub struct LedgerKeyOffer {
17024    pub seller_id: AccountId,
17025    pub offer_id: i64,
17026}
17027
17028impl ReadXdr for LedgerKeyOffer {
17029    #[cfg(feature = "std")]
17030    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
17031        r.with_limited_depth(|r| {
17032            Ok(Self {
17033                seller_id: AccountId::read_xdr(r)?,
17034                offer_id: i64::read_xdr(r)?,
17035            })
17036        })
17037    }
17038}
17039
17040impl WriteXdr for LedgerKeyOffer {
17041    #[cfg(feature = "std")]
17042    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
17043        w.with_limited_depth(|w| {
17044            self.seller_id.write_xdr(w)?;
17045            self.offer_id.write_xdr(w)?;
17046            Ok(())
17047        })
17048    }
17049}
17050
17051/// LedgerKeyData is an XDR NestedStruct defines as:
17052///
17053/// ```text
17054/// struct
17055///     {
17056///         AccountID accountID;
17057///         string64 dataName;
17058///     }
17059/// ```
17060///
17061#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
17062#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
17063#[cfg_attr(
17064    all(feature = "serde", feature = "alloc"),
17065    derive(serde::Serialize, serde::Deserialize),
17066    serde(rename_all = "snake_case")
17067)]
17068#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
17069pub struct LedgerKeyData {
17070    pub account_id: AccountId,
17071    pub data_name: String64,
17072}
17073
17074impl ReadXdr for LedgerKeyData {
17075    #[cfg(feature = "std")]
17076    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
17077        r.with_limited_depth(|r| {
17078            Ok(Self {
17079                account_id: AccountId::read_xdr(r)?,
17080                data_name: String64::read_xdr(r)?,
17081            })
17082        })
17083    }
17084}
17085
17086impl WriteXdr for LedgerKeyData {
17087    #[cfg(feature = "std")]
17088    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
17089        w.with_limited_depth(|w| {
17090            self.account_id.write_xdr(w)?;
17091            self.data_name.write_xdr(w)?;
17092            Ok(())
17093        })
17094    }
17095}
17096
17097/// LedgerKeyClaimableBalance is an XDR NestedStruct defines as:
17098///
17099/// ```text
17100/// struct
17101///     {
17102///         ClaimableBalanceID balanceID;
17103///     }
17104/// ```
17105///
17106#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
17107#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
17108#[cfg_attr(
17109    all(feature = "serde", feature = "alloc"),
17110    derive(serde::Serialize, serde::Deserialize),
17111    serde(rename_all = "snake_case")
17112)]
17113#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
17114pub struct LedgerKeyClaimableBalance {
17115    pub balance_id: ClaimableBalanceId,
17116}
17117
17118impl ReadXdr for LedgerKeyClaimableBalance {
17119    #[cfg(feature = "std")]
17120    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
17121        r.with_limited_depth(|r| {
17122            Ok(Self {
17123                balance_id: ClaimableBalanceId::read_xdr(r)?,
17124            })
17125        })
17126    }
17127}
17128
17129impl WriteXdr for LedgerKeyClaimableBalance {
17130    #[cfg(feature = "std")]
17131    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
17132        w.with_limited_depth(|w| {
17133            self.balance_id.write_xdr(w)?;
17134            Ok(())
17135        })
17136    }
17137}
17138
17139/// LedgerKeyLiquidityPool is an XDR NestedStruct defines as:
17140///
17141/// ```text
17142/// struct
17143///     {
17144///         PoolID liquidityPoolID;
17145///     }
17146/// ```
17147///
17148#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
17149#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
17150#[cfg_attr(
17151    all(feature = "serde", feature = "alloc"),
17152    derive(serde::Serialize, serde::Deserialize),
17153    serde(rename_all = "snake_case")
17154)]
17155#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
17156pub struct LedgerKeyLiquidityPool {
17157    pub liquidity_pool_id: PoolId,
17158}
17159
17160impl ReadXdr for LedgerKeyLiquidityPool {
17161    #[cfg(feature = "std")]
17162    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
17163        r.with_limited_depth(|r| {
17164            Ok(Self {
17165                liquidity_pool_id: PoolId::read_xdr(r)?,
17166            })
17167        })
17168    }
17169}
17170
17171impl WriteXdr for LedgerKeyLiquidityPool {
17172    #[cfg(feature = "std")]
17173    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
17174        w.with_limited_depth(|w| {
17175            self.liquidity_pool_id.write_xdr(w)?;
17176            Ok(())
17177        })
17178    }
17179}
17180
17181/// LedgerKeyContractData is an XDR NestedStruct defines as:
17182///
17183/// ```text
17184/// struct
17185///     {
17186///         SCAddress contract;
17187///         SCVal key;
17188///         ContractDataDurability durability;
17189///     }
17190/// ```
17191///
17192#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
17193#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
17194#[cfg_attr(
17195    all(feature = "serde", feature = "alloc"),
17196    derive(serde::Serialize, serde::Deserialize),
17197    serde(rename_all = "snake_case")
17198)]
17199#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
17200pub struct LedgerKeyContractData {
17201    pub contract: ScAddress,
17202    pub key: ScVal,
17203    pub durability: ContractDataDurability,
17204}
17205
17206impl ReadXdr for LedgerKeyContractData {
17207    #[cfg(feature = "std")]
17208    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
17209        r.with_limited_depth(|r| {
17210            Ok(Self {
17211                contract: ScAddress::read_xdr(r)?,
17212                key: ScVal::read_xdr(r)?,
17213                durability: ContractDataDurability::read_xdr(r)?,
17214            })
17215        })
17216    }
17217}
17218
17219impl WriteXdr for LedgerKeyContractData {
17220    #[cfg(feature = "std")]
17221    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
17222        w.with_limited_depth(|w| {
17223            self.contract.write_xdr(w)?;
17224            self.key.write_xdr(w)?;
17225            self.durability.write_xdr(w)?;
17226            Ok(())
17227        })
17228    }
17229}
17230
17231/// LedgerKeyContractCode is an XDR NestedStruct defines as:
17232///
17233/// ```text
17234/// struct
17235///     {
17236///         Hash hash;
17237///     }
17238/// ```
17239///
17240#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
17241#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
17242#[cfg_attr(
17243    all(feature = "serde", feature = "alloc"),
17244    derive(serde::Serialize, serde::Deserialize),
17245    serde(rename_all = "snake_case")
17246)]
17247#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
17248pub struct LedgerKeyContractCode {
17249    pub hash: Hash,
17250}
17251
17252impl ReadXdr for LedgerKeyContractCode {
17253    #[cfg(feature = "std")]
17254    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
17255        r.with_limited_depth(|r| {
17256            Ok(Self {
17257                hash: Hash::read_xdr(r)?,
17258            })
17259        })
17260    }
17261}
17262
17263impl WriteXdr for LedgerKeyContractCode {
17264    #[cfg(feature = "std")]
17265    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
17266        w.with_limited_depth(|w| {
17267            self.hash.write_xdr(w)?;
17268            Ok(())
17269        })
17270    }
17271}
17272
17273/// LedgerKeyConfigSetting is an XDR NestedStruct defines as:
17274///
17275/// ```text
17276/// struct
17277///     {
17278///         ConfigSettingID configSettingID;
17279///     }
17280/// ```
17281///
17282#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
17283#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
17284#[cfg_attr(
17285    all(feature = "serde", feature = "alloc"),
17286    derive(serde::Serialize, serde::Deserialize),
17287    serde(rename_all = "snake_case")
17288)]
17289#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
17290pub struct LedgerKeyConfigSetting {
17291    pub config_setting_id: ConfigSettingId,
17292}
17293
17294impl ReadXdr for LedgerKeyConfigSetting {
17295    #[cfg(feature = "std")]
17296    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
17297        r.with_limited_depth(|r| {
17298            Ok(Self {
17299                config_setting_id: ConfigSettingId::read_xdr(r)?,
17300            })
17301        })
17302    }
17303}
17304
17305impl WriteXdr for LedgerKeyConfigSetting {
17306    #[cfg(feature = "std")]
17307    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
17308        w.with_limited_depth(|w| {
17309            self.config_setting_id.write_xdr(w)?;
17310            Ok(())
17311        })
17312    }
17313}
17314
17315/// LedgerKeyTtl is an XDR NestedStruct defines as:
17316///
17317/// ```text
17318/// struct
17319///     {
17320///         // Hash of the LedgerKey that is associated with this TTLEntry
17321///         Hash keyHash;
17322///     }
17323/// ```
17324///
17325#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
17326#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
17327#[cfg_attr(
17328    all(feature = "serde", feature = "alloc"),
17329    derive(serde::Serialize, serde::Deserialize),
17330    serde(rename_all = "snake_case")
17331)]
17332#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
17333pub struct LedgerKeyTtl {
17334    pub key_hash: Hash,
17335}
17336
17337impl ReadXdr for LedgerKeyTtl {
17338    #[cfg(feature = "std")]
17339    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
17340        r.with_limited_depth(|r| {
17341            Ok(Self {
17342                key_hash: Hash::read_xdr(r)?,
17343            })
17344        })
17345    }
17346}
17347
17348impl WriteXdr for LedgerKeyTtl {
17349    #[cfg(feature = "std")]
17350    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
17351        w.with_limited_depth(|w| {
17352            self.key_hash.write_xdr(w)?;
17353            Ok(())
17354        })
17355    }
17356}
17357
17358/// LedgerKey is an XDR Union defines as:
17359///
17360/// ```text
17361/// union LedgerKey switch (LedgerEntryType type)
17362/// {
17363/// case ACCOUNT:
17364///     struct
17365///     {
17366///         AccountID accountID;
17367///     } account;
17368///
17369/// case TRUSTLINE:
17370///     struct
17371///     {
17372///         AccountID accountID;
17373///         TrustLineAsset asset;
17374///     } trustLine;
17375///
17376/// case OFFER:
17377///     struct
17378///     {
17379///         AccountID sellerID;
17380///         int64 offerID;
17381///     } offer;
17382///
17383/// case DATA:
17384///     struct
17385///     {
17386///         AccountID accountID;
17387///         string64 dataName;
17388///     } data;
17389///
17390/// case CLAIMABLE_BALANCE:
17391///     struct
17392///     {
17393///         ClaimableBalanceID balanceID;
17394///     } claimableBalance;
17395///
17396/// case LIQUIDITY_POOL:
17397///     struct
17398///     {
17399///         PoolID liquidityPoolID;
17400///     } liquidityPool;
17401/// case CONTRACT_DATA:
17402///     struct
17403///     {
17404///         SCAddress contract;
17405///         SCVal key;
17406///         ContractDataDurability durability;
17407///     } contractData;
17408/// case CONTRACT_CODE:
17409///     struct
17410///     {
17411///         Hash hash;
17412///     } contractCode;
17413/// case CONFIG_SETTING:
17414///     struct
17415///     {
17416///         ConfigSettingID configSettingID;
17417///     } configSetting;
17418/// case TTL:
17419///     struct
17420///     {
17421///         // Hash of the LedgerKey that is associated with this TTLEntry
17422///         Hash keyHash;
17423///     } ttl;
17424/// };
17425/// ```
17426///
17427// union with discriminant LedgerEntryType
17428#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
17429#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
17430#[cfg_attr(
17431    all(feature = "serde", feature = "alloc"),
17432    derive(serde::Serialize, serde::Deserialize),
17433    serde(rename_all = "snake_case")
17434)]
17435#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
17436#[allow(clippy::large_enum_variant)]
17437pub enum LedgerKey {
17438    Account(LedgerKeyAccount),
17439    Trustline(LedgerKeyTrustLine),
17440    Offer(LedgerKeyOffer),
17441    Data(LedgerKeyData),
17442    ClaimableBalance(LedgerKeyClaimableBalance),
17443    LiquidityPool(LedgerKeyLiquidityPool),
17444    ContractData(LedgerKeyContractData),
17445    ContractCode(LedgerKeyContractCode),
17446    ConfigSetting(LedgerKeyConfigSetting),
17447    Ttl(LedgerKeyTtl),
17448}
17449
17450impl LedgerKey {
17451    pub const VARIANTS: [LedgerEntryType; 10] = [
17452        LedgerEntryType::Account,
17453        LedgerEntryType::Trustline,
17454        LedgerEntryType::Offer,
17455        LedgerEntryType::Data,
17456        LedgerEntryType::ClaimableBalance,
17457        LedgerEntryType::LiquidityPool,
17458        LedgerEntryType::ContractData,
17459        LedgerEntryType::ContractCode,
17460        LedgerEntryType::ConfigSetting,
17461        LedgerEntryType::Ttl,
17462    ];
17463    pub const VARIANTS_STR: [&'static str; 10] = [
17464        "Account",
17465        "Trustline",
17466        "Offer",
17467        "Data",
17468        "ClaimableBalance",
17469        "LiquidityPool",
17470        "ContractData",
17471        "ContractCode",
17472        "ConfigSetting",
17473        "Ttl",
17474    ];
17475
17476    #[must_use]
17477    pub const fn name(&self) -> &'static str {
17478        match self {
17479            Self::Account(_) => "Account",
17480            Self::Trustline(_) => "Trustline",
17481            Self::Offer(_) => "Offer",
17482            Self::Data(_) => "Data",
17483            Self::ClaimableBalance(_) => "ClaimableBalance",
17484            Self::LiquidityPool(_) => "LiquidityPool",
17485            Self::ContractData(_) => "ContractData",
17486            Self::ContractCode(_) => "ContractCode",
17487            Self::ConfigSetting(_) => "ConfigSetting",
17488            Self::Ttl(_) => "Ttl",
17489        }
17490    }
17491
17492    #[must_use]
17493    pub const fn discriminant(&self) -> LedgerEntryType {
17494        #[allow(clippy::match_same_arms)]
17495        match self {
17496            Self::Account(_) => LedgerEntryType::Account,
17497            Self::Trustline(_) => LedgerEntryType::Trustline,
17498            Self::Offer(_) => LedgerEntryType::Offer,
17499            Self::Data(_) => LedgerEntryType::Data,
17500            Self::ClaimableBalance(_) => LedgerEntryType::ClaimableBalance,
17501            Self::LiquidityPool(_) => LedgerEntryType::LiquidityPool,
17502            Self::ContractData(_) => LedgerEntryType::ContractData,
17503            Self::ContractCode(_) => LedgerEntryType::ContractCode,
17504            Self::ConfigSetting(_) => LedgerEntryType::ConfigSetting,
17505            Self::Ttl(_) => LedgerEntryType::Ttl,
17506        }
17507    }
17508
17509    #[must_use]
17510    pub const fn variants() -> [LedgerEntryType; 10] {
17511        Self::VARIANTS
17512    }
17513}
17514
17515impl Name for LedgerKey {
17516    #[must_use]
17517    fn name(&self) -> &'static str {
17518        Self::name(self)
17519    }
17520}
17521
17522impl Discriminant<LedgerEntryType> for LedgerKey {
17523    #[must_use]
17524    fn discriminant(&self) -> LedgerEntryType {
17525        Self::discriminant(self)
17526    }
17527}
17528
17529impl Variants<LedgerEntryType> for LedgerKey {
17530    fn variants() -> slice::Iter<'static, LedgerEntryType> {
17531        Self::VARIANTS.iter()
17532    }
17533}
17534
17535impl Union<LedgerEntryType> for LedgerKey {}
17536
17537impl ReadXdr for LedgerKey {
17538    #[cfg(feature = "std")]
17539    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
17540        r.with_limited_depth(|r| {
17541            let dv: LedgerEntryType = <LedgerEntryType as ReadXdr>::read_xdr(r)?;
17542            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
17543            let v = match dv {
17544                LedgerEntryType::Account => Self::Account(LedgerKeyAccount::read_xdr(r)?),
17545                LedgerEntryType::Trustline => Self::Trustline(LedgerKeyTrustLine::read_xdr(r)?),
17546                LedgerEntryType::Offer => Self::Offer(LedgerKeyOffer::read_xdr(r)?),
17547                LedgerEntryType::Data => Self::Data(LedgerKeyData::read_xdr(r)?),
17548                LedgerEntryType::ClaimableBalance => {
17549                    Self::ClaimableBalance(LedgerKeyClaimableBalance::read_xdr(r)?)
17550                }
17551                LedgerEntryType::LiquidityPool => {
17552                    Self::LiquidityPool(LedgerKeyLiquidityPool::read_xdr(r)?)
17553                }
17554                LedgerEntryType::ContractData => {
17555                    Self::ContractData(LedgerKeyContractData::read_xdr(r)?)
17556                }
17557                LedgerEntryType::ContractCode => {
17558                    Self::ContractCode(LedgerKeyContractCode::read_xdr(r)?)
17559                }
17560                LedgerEntryType::ConfigSetting => {
17561                    Self::ConfigSetting(LedgerKeyConfigSetting::read_xdr(r)?)
17562                }
17563                LedgerEntryType::Ttl => Self::Ttl(LedgerKeyTtl::read_xdr(r)?),
17564                #[allow(unreachable_patterns)]
17565                _ => return Err(Error::Invalid),
17566            };
17567            Ok(v)
17568        })
17569    }
17570}
17571
17572impl WriteXdr for LedgerKey {
17573    #[cfg(feature = "std")]
17574    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
17575        w.with_limited_depth(|w| {
17576            self.discriminant().write_xdr(w)?;
17577            #[allow(clippy::match_same_arms)]
17578            match self {
17579                Self::Account(v) => v.write_xdr(w)?,
17580                Self::Trustline(v) => v.write_xdr(w)?,
17581                Self::Offer(v) => v.write_xdr(w)?,
17582                Self::Data(v) => v.write_xdr(w)?,
17583                Self::ClaimableBalance(v) => v.write_xdr(w)?,
17584                Self::LiquidityPool(v) => v.write_xdr(w)?,
17585                Self::ContractData(v) => v.write_xdr(w)?,
17586                Self::ContractCode(v) => v.write_xdr(w)?,
17587                Self::ConfigSetting(v) => v.write_xdr(w)?,
17588                Self::Ttl(v) => v.write_xdr(w)?,
17589            };
17590            Ok(())
17591        })
17592    }
17593}
17594
17595/// EnvelopeType is an XDR Enum defines as:
17596///
17597/// ```text
17598/// enum EnvelopeType
17599/// {
17600///     ENVELOPE_TYPE_TX_V0 = 0,
17601///     ENVELOPE_TYPE_SCP = 1,
17602///     ENVELOPE_TYPE_TX = 2,
17603///     ENVELOPE_TYPE_AUTH = 3,
17604///     ENVELOPE_TYPE_SCPVALUE = 4,
17605///     ENVELOPE_TYPE_TX_FEE_BUMP = 5,
17606///     ENVELOPE_TYPE_OP_ID = 6,
17607///     ENVELOPE_TYPE_POOL_REVOKE_OP_ID = 7,
17608///     ENVELOPE_TYPE_CONTRACT_ID = 8,
17609///     ENVELOPE_TYPE_SOROBAN_AUTHORIZATION = 9
17610/// };
17611/// ```
17612///
17613// enum
17614#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
17615#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
17616#[cfg_attr(
17617    all(feature = "serde", feature = "alloc"),
17618    derive(serde::Serialize, serde::Deserialize),
17619    serde(rename_all = "snake_case")
17620)]
17621#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
17622#[repr(i32)]
17623pub enum EnvelopeType {
17624    TxV0 = 0,
17625    Scp = 1,
17626    Tx = 2,
17627    Auth = 3,
17628    Scpvalue = 4,
17629    TxFeeBump = 5,
17630    OpId = 6,
17631    PoolRevokeOpId = 7,
17632    ContractId = 8,
17633    SorobanAuthorization = 9,
17634}
17635
17636impl EnvelopeType {
17637    pub const VARIANTS: [EnvelopeType; 10] = [
17638        EnvelopeType::TxV0,
17639        EnvelopeType::Scp,
17640        EnvelopeType::Tx,
17641        EnvelopeType::Auth,
17642        EnvelopeType::Scpvalue,
17643        EnvelopeType::TxFeeBump,
17644        EnvelopeType::OpId,
17645        EnvelopeType::PoolRevokeOpId,
17646        EnvelopeType::ContractId,
17647        EnvelopeType::SorobanAuthorization,
17648    ];
17649    pub const VARIANTS_STR: [&'static str; 10] = [
17650        "TxV0",
17651        "Scp",
17652        "Tx",
17653        "Auth",
17654        "Scpvalue",
17655        "TxFeeBump",
17656        "OpId",
17657        "PoolRevokeOpId",
17658        "ContractId",
17659        "SorobanAuthorization",
17660    ];
17661
17662    #[must_use]
17663    pub const fn name(&self) -> &'static str {
17664        match self {
17665            Self::TxV0 => "TxV0",
17666            Self::Scp => "Scp",
17667            Self::Tx => "Tx",
17668            Self::Auth => "Auth",
17669            Self::Scpvalue => "Scpvalue",
17670            Self::TxFeeBump => "TxFeeBump",
17671            Self::OpId => "OpId",
17672            Self::PoolRevokeOpId => "PoolRevokeOpId",
17673            Self::ContractId => "ContractId",
17674            Self::SorobanAuthorization => "SorobanAuthorization",
17675        }
17676    }
17677
17678    #[must_use]
17679    pub const fn variants() -> [EnvelopeType; 10] {
17680        Self::VARIANTS
17681    }
17682}
17683
17684impl Name for EnvelopeType {
17685    #[must_use]
17686    fn name(&self) -> &'static str {
17687        Self::name(self)
17688    }
17689}
17690
17691impl Variants<EnvelopeType> for EnvelopeType {
17692    fn variants() -> slice::Iter<'static, EnvelopeType> {
17693        Self::VARIANTS.iter()
17694    }
17695}
17696
17697impl Enum for EnvelopeType {}
17698
17699impl fmt::Display for EnvelopeType {
17700    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
17701        f.write_str(self.name())
17702    }
17703}
17704
17705impl TryFrom<i32> for EnvelopeType {
17706    type Error = Error;
17707
17708    fn try_from(i: i32) -> Result<Self> {
17709        let e = match i {
17710            0 => EnvelopeType::TxV0,
17711            1 => EnvelopeType::Scp,
17712            2 => EnvelopeType::Tx,
17713            3 => EnvelopeType::Auth,
17714            4 => EnvelopeType::Scpvalue,
17715            5 => EnvelopeType::TxFeeBump,
17716            6 => EnvelopeType::OpId,
17717            7 => EnvelopeType::PoolRevokeOpId,
17718            8 => EnvelopeType::ContractId,
17719            9 => EnvelopeType::SorobanAuthorization,
17720            #[allow(unreachable_patterns)]
17721            _ => return Err(Error::Invalid),
17722        };
17723        Ok(e)
17724    }
17725}
17726
17727impl From<EnvelopeType> for i32 {
17728    #[must_use]
17729    fn from(e: EnvelopeType) -> Self {
17730        e as Self
17731    }
17732}
17733
17734impl ReadXdr for EnvelopeType {
17735    #[cfg(feature = "std")]
17736    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
17737        r.with_limited_depth(|r| {
17738            let e = i32::read_xdr(r)?;
17739            let v: Self = e.try_into()?;
17740            Ok(v)
17741        })
17742    }
17743}
17744
17745impl WriteXdr for EnvelopeType {
17746    #[cfg(feature = "std")]
17747    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
17748        w.with_limited_depth(|w| {
17749            let i: i32 = (*self).into();
17750            i.write_xdr(w)
17751        })
17752    }
17753}
17754
17755/// BucketListType is an XDR Enum defines as:
17756///
17757/// ```text
17758/// enum BucketListType
17759/// {
17760///     LIVE = 0,
17761///     HOT_ARCHIVE = 1,
17762///     COLD_ARCHIVE = 2
17763/// };
17764/// ```
17765///
17766// enum
17767#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
17768#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
17769#[cfg_attr(
17770    all(feature = "serde", feature = "alloc"),
17771    derive(serde::Serialize, serde::Deserialize),
17772    serde(rename_all = "snake_case")
17773)]
17774#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
17775#[repr(i32)]
17776pub enum BucketListType {
17777    Live = 0,
17778    HotArchive = 1,
17779    ColdArchive = 2,
17780}
17781
17782impl BucketListType {
17783    pub const VARIANTS: [BucketListType; 3] = [
17784        BucketListType::Live,
17785        BucketListType::HotArchive,
17786        BucketListType::ColdArchive,
17787    ];
17788    pub const VARIANTS_STR: [&'static str; 3] = ["Live", "HotArchive", "ColdArchive"];
17789
17790    #[must_use]
17791    pub const fn name(&self) -> &'static str {
17792        match self {
17793            Self::Live => "Live",
17794            Self::HotArchive => "HotArchive",
17795            Self::ColdArchive => "ColdArchive",
17796        }
17797    }
17798
17799    #[must_use]
17800    pub const fn variants() -> [BucketListType; 3] {
17801        Self::VARIANTS
17802    }
17803}
17804
17805impl Name for BucketListType {
17806    #[must_use]
17807    fn name(&self) -> &'static str {
17808        Self::name(self)
17809    }
17810}
17811
17812impl Variants<BucketListType> for BucketListType {
17813    fn variants() -> slice::Iter<'static, BucketListType> {
17814        Self::VARIANTS.iter()
17815    }
17816}
17817
17818impl Enum for BucketListType {}
17819
17820impl fmt::Display for BucketListType {
17821    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
17822        f.write_str(self.name())
17823    }
17824}
17825
17826impl TryFrom<i32> for BucketListType {
17827    type Error = Error;
17828
17829    fn try_from(i: i32) -> Result<Self> {
17830        let e = match i {
17831            0 => BucketListType::Live,
17832            1 => BucketListType::HotArchive,
17833            2 => BucketListType::ColdArchive,
17834            #[allow(unreachable_patterns)]
17835            _ => return Err(Error::Invalid),
17836        };
17837        Ok(e)
17838    }
17839}
17840
17841impl From<BucketListType> for i32 {
17842    #[must_use]
17843    fn from(e: BucketListType) -> Self {
17844        e as Self
17845    }
17846}
17847
17848impl ReadXdr for BucketListType {
17849    #[cfg(feature = "std")]
17850    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
17851        r.with_limited_depth(|r| {
17852            let e = i32::read_xdr(r)?;
17853            let v: Self = e.try_into()?;
17854            Ok(v)
17855        })
17856    }
17857}
17858
17859impl WriteXdr for BucketListType {
17860    #[cfg(feature = "std")]
17861    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
17862        w.with_limited_depth(|w| {
17863            let i: i32 = (*self).into();
17864            i.write_xdr(w)
17865        })
17866    }
17867}
17868
17869/// BucketEntryType is an XDR Enum defines as:
17870///
17871/// ```text
17872/// enum BucketEntryType
17873/// {
17874///     METAENTRY =
17875///         -1, // At-and-after protocol 11: bucket metadata, should come first.
17876///     LIVEENTRY = 0, // Before protocol 11: created-or-updated;
17877///                    // At-and-after protocol 11: only updated.
17878///     DEADENTRY = 1,
17879///     INITENTRY = 2 // At-and-after protocol 11: only created.
17880/// };
17881/// ```
17882///
17883// enum
17884#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
17885#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
17886#[cfg_attr(
17887    all(feature = "serde", feature = "alloc"),
17888    derive(serde::Serialize, serde::Deserialize),
17889    serde(rename_all = "snake_case")
17890)]
17891#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
17892#[repr(i32)]
17893pub enum BucketEntryType {
17894    Metaentry = -1,
17895    Liveentry = 0,
17896    Deadentry = 1,
17897    Initentry = 2,
17898}
17899
17900impl BucketEntryType {
17901    pub const VARIANTS: [BucketEntryType; 4] = [
17902        BucketEntryType::Metaentry,
17903        BucketEntryType::Liveentry,
17904        BucketEntryType::Deadentry,
17905        BucketEntryType::Initentry,
17906    ];
17907    pub const VARIANTS_STR: [&'static str; 4] =
17908        ["Metaentry", "Liveentry", "Deadentry", "Initentry"];
17909
17910    #[must_use]
17911    pub const fn name(&self) -> &'static str {
17912        match self {
17913            Self::Metaentry => "Metaentry",
17914            Self::Liveentry => "Liveentry",
17915            Self::Deadentry => "Deadentry",
17916            Self::Initentry => "Initentry",
17917        }
17918    }
17919
17920    #[must_use]
17921    pub const fn variants() -> [BucketEntryType; 4] {
17922        Self::VARIANTS
17923    }
17924}
17925
17926impl Name for BucketEntryType {
17927    #[must_use]
17928    fn name(&self) -> &'static str {
17929        Self::name(self)
17930    }
17931}
17932
17933impl Variants<BucketEntryType> for BucketEntryType {
17934    fn variants() -> slice::Iter<'static, BucketEntryType> {
17935        Self::VARIANTS.iter()
17936    }
17937}
17938
17939impl Enum for BucketEntryType {}
17940
17941impl fmt::Display for BucketEntryType {
17942    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
17943        f.write_str(self.name())
17944    }
17945}
17946
17947impl TryFrom<i32> for BucketEntryType {
17948    type Error = Error;
17949
17950    fn try_from(i: i32) -> Result<Self> {
17951        let e = match i {
17952            -1 => BucketEntryType::Metaentry,
17953            0 => BucketEntryType::Liveentry,
17954            1 => BucketEntryType::Deadentry,
17955            2 => BucketEntryType::Initentry,
17956            #[allow(unreachable_patterns)]
17957            _ => return Err(Error::Invalid),
17958        };
17959        Ok(e)
17960    }
17961}
17962
17963impl From<BucketEntryType> for i32 {
17964    #[must_use]
17965    fn from(e: BucketEntryType) -> Self {
17966        e as Self
17967    }
17968}
17969
17970impl ReadXdr for BucketEntryType {
17971    #[cfg(feature = "std")]
17972    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
17973        r.with_limited_depth(|r| {
17974            let e = i32::read_xdr(r)?;
17975            let v: Self = e.try_into()?;
17976            Ok(v)
17977        })
17978    }
17979}
17980
17981impl WriteXdr for BucketEntryType {
17982    #[cfg(feature = "std")]
17983    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
17984        w.with_limited_depth(|w| {
17985            let i: i32 = (*self).into();
17986            i.write_xdr(w)
17987        })
17988    }
17989}
17990
17991/// HotArchiveBucketEntryType is an XDR Enum defines as:
17992///
17993/// ```text
17994/// enum HotArchiveBucketEntryType
17995/// {
17996///     HOT_ARCHIVE_METAENTRY = -1, // Bucket metadata, should come first.
17997///     HOT_ARCHIVE_ARCHIVED = 0,   // Entry is Archived
17998///     HOT_ARCHIVE_LIVE = 1,       // Entry was previously HOT_ARCHIVE_ARCHIVED, or HOT_ARCHIVE_DELETED, but
17999///                                 // has been added back to the live BucketList.
18000///                                 // Does not need to be persisted.
18001///     HOT_ARCHIVE_DELETED = 2     // Entry deleted (Note: must be persisted in archive)
18002/// };
18003/// ```
18004///
18005// enum
18006#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
18007#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
18008#[cfg_attr(
18009    all(feature = "serde", feature = "alloc"),
18010    derive(serde::Serialize, serde::Deserialize),
18011    serde(rename_all = "snake_case")
18012)]
18013#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
18014#[repr(i32)]
18015pub enum HotArchiveBucketEntryType {
18016    Metaentry = -1,
18017    Archived = 0,
18018    Live = 1,
18019    Deleted = 2,
18020}
18021
18022impl HotArchiveBucketEntryType {
18023    pub const VARIANTS: [HotArchiveBucketEntryType; 4] = [
18024        HotArchiveBucketEntryType::Metaentry,
18025        HotArchiveBucketEntryType::Archived,
18026        HotArchiveBucketEntryType::Live,
18027        HotArchiveBucketEntryType::Deleted,
18028    ];
18029    pub const VARIANTS_STR: [&'static str; 4] = ["Metaentry", "Archived", "Live", "Deleted"];
18030
18031    #[must_use]
18032    pub const fn name(&self) -> &'static str {
18033        match self {
18034            Self::Metaentry => "Metaentry",
18035            Self::Archived => "Archived",
18036            Self::Live => "Live",
18037            Self::Deleted => "Deleted",
18038        }
18039    }
18040
18041    #[must_use]
18042    pub const fn variants() -> [HotArchiveBucketEntryType; 4] {
18043        Self::VARIANTS
18044    }
18045}
18046
18047impl Name for HotArchiveBucketEntryType {
18048    #[must_use]
18049    fn name(&self) -> &'static str {
18050        Self::name(self)
18051    }
18052}
18053
18054impl Variants<HotArchiveBucketEntryType> for HotArchiveBucketEntryType {
18055    fn variants() -> slice::Iter<'static, HotArchiveBucketEntryType> {
18056        Self::VARIANTS.iter()
18057    }
18058}
18059
18060impl Enum for HotArchiveBucketEntryType {}
18061
18062impl fmt::Display for HotArchiveBucketEntryType {
18063    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
18064        f.write_str(self.name())
18065    }
18066}
18067
18068impl TryFrom<i32> for HotArchiveBucketEntryType {
18069    type Error = Error;
18070
18071    fn try_from(i: i32) -> Result<Self> {
18072        let e = match i {
18073            -1 => HotArchiveBucketEntryType::Metaentry,
18074            0 => HotArchiveBucketEntryType::Archived,
18075            1 => HotArchiveBucketEntryType::Live,
18076            2 => HotArchiveBucketEntryType::Deleted,
18077            #[allow(unreachable_patterns)]
18078            _ => return Err(Error::Invalid),
18079        };
18080        Ok(e)
18081    }
18082}
18083
18084impl From<HotArchiveBucketEntryType> for i32 {
18085    #[must_use]
18086    fn from(e: HotArchiveBucketEntryType) -> Self {
18087        e as Self
18088    }
18089}
18090
18091impl ReadXdr for HotArchiveBucketEntryType {
18092    #[cfg(feature = "std")]
18093    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
18094        r.with_limited_depth(|r| {
18095            let e = i32::read_xdr(r)?;
18096            let v: Self = e.try_into()?;
18097            Ok(v)
18098        })
18099    }
18100}
18101
18102impl WriteXdr for HotArchiveBucketEntryType {
18103    #[cfg(feature = "std")]
18104    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
18105        w.with_limited_depth(|w| {
18106            let i: i32 = (*self).into();
18107            i.write_xdr(w)
18108        })
18109    }
18110}
18111
18112/// ColdArchiveBucketEntryType is an XDR Enum defines as:
18113///
18114/// ```text
18115/// enum ColdArchiveBucketEntryType
18116/// {
18117///     COLD_ARCHIVE_METAENTRY     = -1,  // Bucket metadata, should come first.
18118///     COLD_ARCHIVE_ARCHIVED_LEAF = 0,   // Full LedgerEntry that was archived during the epoch
18119///     COLD_ARCHIVE_DELETED_LEAF  = 1,   // LedgerKey that was deleted during the epoch
18120///     COLD_ARCHIVE_BOUNDARY_LEAF = 2,   // Dummy leaf representing low/high bound
18121///     COLD_ARCHIVE_HASH          = 3    // Intermediary Merkle hash entry
18122/// };
18123/// ```
18124///
18125// enum
18126#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
18127#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
18128#[cfg_attr(
18129    all(feature = "serde", feature = "alloc"),
18130    derive(serde::Serialize, serde::Deserialize),
18131    serde(rename_all = "snake_case")
18132)]
18133#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
18134#[repr(i32)]
18135pub enum ColdArchiveBucketEntryType {
18136    Metaentry = -1,
18137    ArchivedLeaf = 0,
18138    DeletedLeaf = 1,
18139    BoundaryLeaf = 2,
18140    Hash = 3,
18141}
18142
18143impl ColdArchiveBucketEntryType {
18144    pub const VARIANTS: [ColdArchiveBucketEntryType; 5] = [
18145        ColdArchiveBucketEntryType::Metaentry,
18146        ColdArchiveBucketEntryType::ArchivedLeaf,
18147        ColdArchiveBucketEntryType::DeletedLeaf,
18148        ColdArchiveBucketEntryType::BoundaryLeaf,
18149        ColdArchiveBucketEntryType::Hash,
18150    ];
18151    pub const VARIANTS_STR: [&'static str; 5] = [
18152        "Metaentry",
18153        "ArchivedLeaf",
18154        "DeletedLeaf",
18155        "BoundaryLeaf",
18156        "Hash",
18157    ];
18158
18159    #[must_use]
18160    pub const fn name(&self) -> &'static str {
18161        match self {
18162            Self::Metaentry => "Metaentry",
18163            Self::ArchivedLeaf => "ArchivedLeaf",
18164            Self::DeletedLeaf => "DeletedLeaf",
18165            Self::BoundaryLeaf => "BoundaryLeaf",
18166            Self::Hash => "Hash",
18167        }
18168    }
18169
18170    #[must_use]
18171    pub const fn variants() -> [ColdArchiveBucketEntryType; 5] {
18172        Self::VARIANTS
18173    }
18174}
18175
18176impl Name for ColdArchiveBucketEntryType {
18177    #[must_use]
18178    fn name(&self) -> &'static str {
18179        Self::name(self)
18180    }
18181}
18182
18183impl Variants<ColdArchiveBucketEntryType> for ColdArchiveBucketEntryType {
18184    fn variants() -> slice::Iter<'static, ColdArchiveBucketEntryType> {
18185        Self::VARIANTS.iter()
18186    }
18187}
18188
18189impl Enum for ColdArchiveBucketEntryType {}
18190
18191impl fmt::Display for ColdArchiveBucketEntryType {
18192    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
18193        f.write_str(self.name())
18194    }
18195}
18196
18197impl TryFrom<i32> for ColdArchiveBucketEntryType {
18198    type Error = Error;
18199
18200    fn try_from(i: i32) -> Result<Self> {
18201        let e = match i {
18202            -1 => ColdArchiveBucketEntryType::Metaentry,
18203            0 => ColdArchiveBucketEntryType::ArchivedLeaf,
18204            1 => ColdArchiveBucketEntryType::DeletedLeaf,
18205            2 => ColdArchiveBucketEntryType::BoundaryLeaf,
18206            3 => ColdArchiveBucketEntryType::Hash,
18207            #[allow(unreachable_patterns)]
18208            _ => return Err(Error::Invalid),
18209        };
18210        Ok(e)
18211    }
18212}
18213
18214impl From<ColdArchiveBucketEntryType> for i32 {
18215    #[must_use]
18216    fn from(e: ColdArchiveBucketEntryType) -> Self {
18217        e as Self
18218    }
18219}
18220
18221impl ReadXdr for ColdArchiveBucketEntryType {
18222    #[cfg(feature = "std")]
18223    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
18224        r.with_limited_depth(|r| {
18225            let e = i32::read_xdr(r)?;
18226            let v: Self = e.try_into()?;
18227            Ok(v)
18228        })
18229    }
18230}
18231
18232impl WriteXdr for ColdArchiveBucketEntryType {
18233    #[cfg(feature = "std")]
18234    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
18235        w.with_limited_depth(|w| {
18236            let i: i32 = (*self).into();
18237            i.write_xdr(w)
18238        })
18239    }
18240}
18241
18242/// BucketMetadataExt is an XDR NestedUnion defines as:
18243///
18244/// ```text
18245/// union switch (int v)
18246///     {
18247///     case 0:
18248///         void;
18249///     case 1:
18250///         BucketListType bucketListType;
18251///     }
18252/// ```
18253///
18254// union with discriminant i32
18255#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
18256#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
18257#[cfg_attr(
18258    all(feature = "serde", feature = "alloc"),
18259    derive(serde::Serialize, serde::Deserialize),
18260    serde(rename_all = "snake_case")
18261)]
18262#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
18263#[allow(clippy::large_enum_variant)]
18264pub enum BucketMetadataExt {
18265    V0,
18266    V1(BucketListType),
18267}
18268
18269impl BucketMetadataExt {
18270    pub const VARIANTS: [i32; 2] = [0, 1];
18271    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"];
18272
18273    #[must_use]
18274    pub const fn name(&self) -> &'static str {
18275        match self {
18276            Self::V0 => "V0",
18277            Self::V1(_) => "V1",
18278        }
18279    }
18280
18281    #[must_use]
18282    pub const fn discriminant(&self) -> i32 {
18283        #[allow(clippy::match_same_arms)]
18284        match self {
18285            Self::V0 => 0,
18286            Self::V1(_) => 1,
18287        }
18288    }
18289
18290    #[must_use]
18291    pub const fn variants() -> [i32; 2] {
18292        Self::VARIANTS
18293    }
18294}
18295
18296impl Name for BucketMetadataExt {
18297    #[must_use]
18298    fn name(&self) -> &'static str {
18299        Self::name(self)
18300    }
18301}
18302
18303impl Discriminant<i32> for BucketMetadataExt {
18304    #[must_use]
18305    fn discriminant(&self) -> i32 {
18306        Self::discriminant(self)
18307    }
18308}
18309
18310impl Variants<i32> for BucketMetadataExt {
18311    fn variants() -> slice::Iter<'static, i32> {
18312        Self::VARIANTS.iter()
18313    }
18314}
18315
18316impl Union<i32> for BucketMetadataExt {}
18317
18318impl ReadXdr for BucketMetadataExt {
18319    #[cfg(feature = "std")]
18320    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
18321        r.with_limited_depth(|r| {
18322            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
18323            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
18324            let v = match dv {
18325                0 => Self::V0,
18326                1 => Self::V1(BucketListType::read_xdr(r)?),
18327                #[allow(unreachable_patterns)]
18328                _ => return Err(Error::Invalid),
18329            };
18330            Ok(v)
18331        })
18332    }
18333}
18334
18335impl WriteXdr for BucketMetadataExt {
18336    #[cfg(feature = "std")]
18337    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
18338        w.with_limited_depth(|w| {
18339            self.discriminant().write_xdr(w)?;
18340            #[allow(clippy::match_same_arms)]
18341            match self {
18342                Self::V0 => ().write_xdr(w)?,
18343                Self::V1(v) => v.write_xdr(w)?,
18344            };
18345            Ok(())
18346        })
18347    }
18348}
18349
18350/// BucketMetadata is an XDR Struct defines as:
18351///
18352/// ```text
18353/// struct BucketMetadata
18354/// {
18355///     // Indicates the protocol version used to create / merge this bucket.
18356///     uint32 ledgerVersion;
18357///
18358///     // reserved for future use
18359///     union switch (int v)
18360///     {
18361///     case 0:
18362///         void;
18363///     case 1:
18364///         BucketListType bucketListType;
18365///     }
18366///     ext;
18367/// };
18368/// ```
18369///
18370#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
18371#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
18372#[cfg_attr(
18373    all(feature = "serde", feature = "alloc"),
18374    derive(serde::Serialize, serde::Deserialize),
18375    serde(rename_all = "snake_case")
18376)]
18377#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
18378pub struct BucketMetadata {
18379    pub ledger_version: u32,
18380    pub ext: BucketMetadataExt,
18381}
18382
18383impl ReadXdr for BucketMetadata {
18384    #[cfg(feature = "std")]
18385    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
18386        r.with_limited_depth(|r| {
18387            Ok(Self {
18388                ledger_version: u32::read_xdr(r)?,
18389                ext: BucketMetadataExt::read_xdr(r)?,
18390            })
18391        })
18392    }
18393}
18394
18395impl WriteXdr for BucketMetadata {
18396    #[cfg(feature = "std")]
18397    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
18398        w.with_limited_depth(|w| {
18399            self.ledger_version.write_xdr(w)?;
18400            self.ext.write_xdr(w)?;
18401            Ok(())
18402        })
18403    }
18404}
18405
18406/// BucketEntry is an XDR Union defines as:
18407///
18408/// ```text
18409/// union BucketEntry switch (BucketEntryType type)
18410/// {
18411/// case LIVEENTRY:
18412/// case INITENTRY:
18413///     LedgerEntry liveEntry;
18414///
18415/// case DEADENTRY:
18416///     LedgerKey deadEntry;
18417/// case METAENTRY:
18418///     BucketMetadata metaEntry;
18419/// };
18420/// ```
18421///
18422// union with discriminant BucketEntryType
18423#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
18424#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
18425#[cfg_attr(
18426    all(feature = "serde", feature = "alloc"),
18427    derive(serde::Serialize, serde::Deserialize),
18428    serde(rename_all = "snake_case")
18429)]
18430#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
18431#[allow(clippy::large_enum_variant)]
18432pub enum BucketEntry {
18433    Liveentry(LedgerEntry),
18434    Initentry(LedgerEntry),
18435    Deadentry(LedgerKey),
18436    Metaentry(BucketMetadata),
18437}
18438
18439impl BucketEntry {
18440    pub const VARIANTS: [BucketEntryType; 4] = [
18441        BucketEntryType::Liveentry,
18442        BucketEntryType::Initentry,
18443        BucketEntryType::Deadentry,
18444        BucketEntryType::Metaentry,
18445    ];
18446    pub const VARIANTS_STR: [&'static str; 4] =
18447        ["Liveentry", "Initentry", "Deadentry", "Metaentry"];
18448
18449    #[must_use]
18450    pub const fn name(&self) -> &'static str {
18451        match self {
18452            Self::Liveentry(_) => "Liveentry",
18453            Self::Initentry(_) => "Initentry",
18454            Self::Deadentry(_) => "Deadentry",
18455            Self::Metaentry(_) => "Metaentry",
18456        }
18457    }
18458
18459    #[must_use]
18460    pub const fn discriminant(&self) -> BucketEntryType {
18461        #[allow(clippy::match_same_arms)]
18462        match self {
18463            Self::Liveentry(_) => BucketEntryType::Liveentry,
18464            Self::Initentry(_) => BucketEntryType::Initentry,
18465            Self::Deadentry(_) => BucketEntryType::Deadentry,
18466            Self::Metaentry(_) => BucketEntryType::Metaentry,
18467        }
18468    }
18469
18470    #[must_use]
18471    pub const fn variants() -> [BucketEntryType; 4] {
18472        Self::VARIANTS
18473    }
18474}
18475
18476impl Name for BucketEntry {
18477    #[must_use]
18478    fn name(&self) -> &'static str {
18479        Self::name(self)
18480    }
18481}
18482
18483impl Discriminant<BucketEntryType> for BucketEntry {
18484    #[must_use]
18485    fn discriminant(&self) -> BucketEntryType {
18486        Self::discriminant(self)
18487    }
18488}
18489
18490impl Variants<BucketEntryType> for BucketEntry {
18491    fn variants() -> slice::Iter<'static, BucketEntryType> {
18492        Self::VARIANTS.iter()
18493    }
18494}
18495
18496impl Union<BucketEntryType> for BucketEntry {}
18497
18498impl ReadXdr for BucketEntry {
18499    #[cfg(feature = "std")]
18500    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
18501        r.with_limited_depth(|r| {
18502            let dv: BucketEntryType = <BucketEntryType as ReadXdr>::read_xdr(r)?;
18503            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
18504            let v = match dv {
18505                BucketEntryType::Liveentry => Self::Liveentry(LedgerEntry::read_xdr(r)?),
18506                BucketEntryType::Initentry => Self::Initentry(LedgerEntry::read_xdr(r)?),
18507                BucketEntryType::Deadentry => Self::Deadentry(LedgerKey::read_xdr(r)?),
18508                BucketEntryType::Metaentry => Self::Metaentry(BucketMetadata::read_xdr(r)?),
18509                #[allow(unreachable_patterns)]
18510                _ => return Err(Error::Invalid),
18511            };
18512            Ok(v)
18513        })
18514    }
18515}
18516
18517impl WriteXdr for BucketEntry {
18518    #[cfg(feature = "std")]
18519    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
18520        w.with_limited_depth(|w| {
18521            self.discriminant().write_xdr(w)?;
18522            #[allow(clippy::match_same_arms)]
18523            match self {
18524                Self::Liveentry(v) => v.write_xdr(w)?,
18525                Self::Initentry(v) => v.write_xdr(w)?,
18526                Self::Deadentry(v) => v.write_xdr(w)?,
18527                Self::Metaentry(v) => v.write_xdr(w)?,
18528            };
18529            Ok(())
18530        })
18531    }
18532}
18533
18534/// HotArchiveBucketEntry is an XDR Union defines as:
18535///
18536/// ```text
18537/// union HotArchiveBucketEntry switch (HotArchiveBucketEntryType type)
18538/// {
18539/// case HOT_ARCHIVE_ARCHIVED:
18540///     LedgerEntry archivedEntry;
18541///
18542/// case HOT_ARCHIVE_LIVE:
18543/// case HOT_ARCHIVE_DELETED:
18544///     LedgerKey key;
18545/// case HOT_ARCHIVE_METAENTRY:
18546///     BucketMetadata metaEntry;
18547/// };
18548/// ```
18549///
18550// union with discriminant HotArchiveBucketEntryType
18551#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
18552#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
18553#[cfg_attr(
18554    all(feature = "serde", feature = "alloc"),
18555    derive(serde::Serialize, serde::Deserialize),
18556    serde(rename_all = "snake_case")
18557)]
18558#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
18559#[allow(clippy::large_enum_variant)]
18560pub enum HotArchiveBucketEntry {
18561    Archived(LedgerEntry),
18562    Live(LedgerKey),
18563    Deleted(LedgerKey),
18564    Metaentry(BucketMetadata),
18565}
18566
18567impl HotArchiveBucketEntry {
18568    pub const VARIANTS: [HotArchiveBucketEntryType; 4] = [
18569        HotArchiveBucketEntryType::Archived,
18570        HotArchiveBucketEntryType::Live,
18571        HotArchiveBucketEntryType::Deleted,
18572        HotArchiveBucketEntryType::Metaentry,
18573    ];
18574    pub const VARIANTS_STR: [&'static str; 4] = ["Archived", "Live", "Deleted", "Metaentry"];
18575
18576    #[must_use]
18577    pub const fn name(&self) -> &'static str {
18578        match self {
18579            Self::Archived(_) => "Archived",
18580            Self::Live(_) => "Live",
18581            Self::Deleted(_) => "Deleted",
18582            Self::Metaentry(_) => "Metaentry",
18583        }
18584    }
18585
18586    #[must_use]
18587    pub const fn discriminant(&self) -> HotArchiveBucketEntryType {
18588        #[allow(clippy::match_same_arms)]
18589        match self {
18590            Self::Archived(_) => HotArchiveBucketEntryType::Archived,
18591            Self::Live(_) => HotArchiveBucketEntryType::Live,
18592            Self::Deleted(_) => HotArchiveBucketEntryType::Deleted,
18593            Self::Metaentry(_) => HotArchiveBucketEntryType::Metaentry,
18594        }
18595    }
18596
18597    #[must_use]
18598    pub const fn variants() -> [HotArchiveBucketEntryType; 4] {
18599        Self::VARIANTS
18600    }
18601}
18602
18603impl Name for HotArchiveBucketEntry {
18604    #[must_use]
18605    fn name(&self) -> &'static str {
18606        Self::name(self)
18607    }
18608}
18609
18610impl Discriminant<HotArchiveBucketEntryType> for HotArchiveBucketEntry {
18611    #[must_use]
18612    fn discriminant(&self) -> HotArchiveBucketEntryType {
18613        Self::discriminant(self)
18614    }
18615}
18616
18617impl Variants<HotArchiveBucketEntryType> for HotArchiveBucketEntry {
18618    fn variants() -> slice::Iter<'static, HotArchiveBucketEntryType> {
18619        Self::VARIANTS.iter()
18620    }
18621}
18622
18623impl Union<HotArchiveBucketEntryType> for HotArchiveBucketEntry {}
18624
18625impl ReadXdr for HotArchiveBucketEntry {
18626    #[cfg(feature = "std")]
18627    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
18628        r.with_limited_depth(|r| {
18629            let dv: HotArchiveBucketEntryType =
18630                <HotArchiveBucketEntryType as ReadXdr>::read_xdr(r)?;
18631            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
18632            let v = match dv {
18633                HotArchiveBucketEntryType::Archived => Self::Archived(LedgerEntry::read_xdr(r)?),
18634                HotArchiveBucketEntryType::Live => Self::Live(LedgerKey::read_xdr(r)?),
18635                HotArchiveBucketEntryType::Deleted => Self::Deleted(LedgerKey::read_xdr(r)?),
18636                HotArchiveBucketEntryType::Metaentry => {
18637                    Self::Metaentry(BucketMetadata::read_xdr(r)?)
18638                }
18639                #[allow(unreachable_patterns)]
18640                _ => return Err(Error::Invalid),
18641            };
18642            Ok(v)
18643        })
18644    }
18645}
18646
18647impl WriteXdr for HotArchiveBucketEntry {
18648    #[cfg(feature = "std")]
18649    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
18650        w.with_limited_depth(|w| {
18651            self.discriminant().write_xdr(w)?;
18652            #[allow(clippy::match_same_arms)]
18653            match self {
18654                Self::Archived(v) => v.write_xdr(w)?,
18655                Self::Live(v) => v.write_xdr(w)?,
18656                Self::Deleted(v) => v.write_xdr(w)?,
18657                Self::Metaentry(v) => v.write_xdr(w)?,
18658            };
18659            Ok(())
18660        })
18661    }
18662}
18663
18664/// ColdArchiveArchivedLeaf is an XDR Struct defines as:
18665///
18666/// ```text
18667/// struct ColdArchiveArchivedLeaf
18668/// {
18669///     uint32 index;
18670///     LedgerEntry archivedEntry;
18671/// };
18672/// ```
18673///
18674#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
18675#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
18676#[cfg_attr(
18677    all(feature = "serde", feature = "alloc"),
18678    derive(serde::Serialize, serde::Deserialize),
18679    serde(rename_all = "snake_case")
18680)]
18681#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
18682pub struct ColdArchiveArchivedLeaf {
18683    pub index: u32,
18684    pub archived_entry: LedgerEntry,
18685}
18686
18687impl ReadXdr for ColdArchiveArchivedLeaf {
18688    #[cfg(feature = "std")]
18689    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
18690        r.with_limited_depth(|r| {
18691            Ok(Self {
18692                index: u32::read_xdr(r)?,
18693                archived_entry: LedgerEntry::read_xdr(r)?,
18694            })
18695        })
18696    }
18697}
18698
18699impl WriteXdr for ColdArchiveArchivedLeaf {
18700    #[cfg(feature = "std")]
18701    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
18702        w.with_limited_depth(|w| {
18703            self.index.write_xdr(w)?;
18704            self.archived_entry.write_xdr(w)?;
18705            Ok(())
18706        })
18707    }
18708}
18709
18710/// ColdArchiveDeletedLeaf is an XDR Struct defines as:
18711///
18712/// ```text
18713/// struct ColdArchiveDeletedLeaf
18714/// {
18715///     uint32 index;
18716///     LedgerKey deletedKey;
18717/// };
18718/// ```
18719///
18720#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
18721#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
18722#[cfg_attr(
18723    all(feature = "serde", feature = "alloc"),
18724    derive(serde::Serialize, serde::Deserialize),
18725    serde(rename_all = "snake_case")
18726)]
18727#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
18728pub struct ColdArchiveDeletedLeaf {
18729    pub index: u32,
18730    pub deleted_key: LedgerKey,
18731}
18732
18733impl ReadXdr for ColdArchiveDeletedLeaf {
18734    #[cfg(feature = "std")]
18735    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
18736        r.with_limited_depth(|r| {
18737            Ok(Self {
18738                index: u32::read_xdr(r)?,
18739                deleted_key: LedgerKey::read_xdr(r)?,
18740            })
18741        })
18742    }
18743}
18744
18745impl WriteXdr for ColdArchiveDeletedLeaf {
18746    #[cfg(feature = "std")]
18747    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
18748        w.with_limited_depth(|w| {
18749            self.index.write_xdr(w)?;
18750            self.deleted_key.write_xdr(w)?;
18751            Ok(())
18752        })
18753    }
18754}
18755
18756/// ColdArchiveBoundaryLeaf is an XDR Struct defines as:
18757///
18758/// ```text
18759/// struct ColdArchiveBoundaryLeaf
18760/// {
18761///     uint32 index;
18762///     bool isLowerBound;
18763/// };
18764/// ```
18765///
18766#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
18767#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
18768#[cfg_attr(
18769    all(feature = "serde", feature = "alloc"),
18770    derive(serde::Serialize, serde::Deserialize),
18771    serde(rename_all = "snake_case")
18772)]
18773#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
18774pub struct ColdArchiveBoundaryLeaf {
18775    pub index: u32,
18776    pub is_lower_bound: bool,
18777}
18778
18779impl ReadXdr for ColdArchiveBoundaryLeaf {
18780    #[cfg(feature = "std")]
18781    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
18782        r.with_limited_depth(|r| {
18783            Ok(Self {
18784                index: u32::read_xdr(r)?,
18785                is_lower_bound: bool::read_xdr(r)?,
18786            })
18787        })
18788    }
18789}
18790
18791impl WriteXdr for ColdArchiveBoundaryLeaf {
18792    #[cfg(feature = "std")]
18793    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
18794        w.with_limited_depth(|w| {
18795            self.index.write_xdr(w)?;
18796            self.is_lower_bound.write_xdr(w)?;
18797            Ok(())
18798        })
18799    }
18800}
18801
18802/// ColdArchiveHashEntry is an XDR Struct defines as:
18803///
18804/// ```text
18805/// struct ColdArchiveHashEntry
18806/// {
18807///     uint32 index;
18808///     uint32 level;
18809///     Hash hash;
18810/// };
18811/// ```
18812///
18813#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
18814#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
18815#[cfg_attr(
18816    all(feature = "serde", feature = "alloc"),
18817    derive(serde::Serialize, serde::Deserialize),
18818    serde(rename_all = "snake_case")
18819)]
18820#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
18821pub struct ColdArchiveHashEntry {
18822    pub index: u32,
18823    pub level: u32,
18824    pub hash: Hash,
18825}
18826
18827impl ReadXdr for ColdArchiveHashEntry {
18828    #[cfg(feature = "std")]
18829    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
18830        r.with_limited_depth(|r| {
18831            Ok(Self {
18832                index: u32::read_xdr(r)?,
18833                level: u32::read_xdr(r)?,
18834                hash: Hash::read_xdr(r)?,
18835            })
18836        })
18837    }
18838}
18839
18840impl WriteXdr for ColdArchiveHashEntry {
18841    #[cfg(feature = "std")]
18842    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
18843        w.with_limited_depth(|w| {
18844            self.index.write_xdr(w)?;
18845            self.level.write_xdr(w)?;
18846            self.hash.write_xdr(w)?;
18847            Ok(())
18848        })
18849    }
18850}
18851
18852/// ColdArchiveBucketEntry is an XDR Union defines as:
18853///
18854/// ```text
18855/// union ColdArchiveBucketEntry switch (ColdArchiveBucketEntryType type)
18856/// {
18857/// case COLD_ARCHIVE_METAENTRY:
18858///     BucketMetadata metaEntry;
18859/// case COLD_ARCHIVE_ARCHIVED_LEAF:
18860///     ColdArchiveArchivedLeaf archivedLeaf;
18861/// case COLD_ARCHIVE_DELETED_LEAF:
18862///     ColdArchiveDeletedLeaf deletedLeaf;
18863/// case COLD_ARCHIVE_BOUNDARY_LEAF:
18864///     ColdArchiveBoundaryLeaf boundaryLeaf;
18865/// case COLD_ARCHIVE_HASH:
18866///     ColdArchiveHashEntry hashEntry;
18867/// };
18868/// ```
18869///
18870// union with discriminant ColdArchiveBucketEntryType
18871#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
18872#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
18873#[cfg_attr(
18874    all(feature = "serde", feature = "alloc"),
18875    derive(serde::Serialize, serde::Deserialize),
18876    serde(rename_all = "snake_case")
18877)]
18878#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
18879#[allow(clippy::large_enum_variant)]
18880pub enum ColdArchiveBucketEntry {
18881    Metaentry(BucketMetadata),
18882    ArchivedLeaf(ColdArchiveArchivedLeaf),
18883    DeletedLeaf(ColdArchiveDeletedLeaf),
18884    BoundaryLeaf(ColdArchiveBoundaryLeaf),
18885    Hash(ColdArchiveHashEntry),
18886}
18887
18888impl ColdArchiveBucketEntry {
18889    pub const VARIANTS: [ColdArchiveBucketEntryType; 5] = [
18890        ColdArchiveBucketEntryType::Metaentry,
18891        ColdArchiveBucketEntryType::ArchivedLeaf,
18892        ColdArchiveBucketEntryType::DeletedLeaf,
18893        ColdArchiveBucketEntryType::BoundaryLeaf,
18894        ColdArchiveBucketEntryType::Hash,
18895    ];
18896    pub const VARIANTS_STR: [&'static str; 5] = [
18897        "Metaentry",
18898        "ArchivedLeaf",
18899        "DeletedLeaf",
18900        "BoundaryLeaf",
18901        "Hash",
18902    ];
18903
18904    #[must_use]
18905    pub const fn name(&self) -> &'static str {
18906        match self {
18907            Self::Metaentry(_) => "Metaentry",
18908            Self::ArchivedLeaf(_) => "ArchivedLeaf",
18909            Self::DeletedLeaf(_) => "DeletedLeaf",
18910            Self::BoundaryLeaf(_) => "BoundaryLeaf",
18911            Self::Hash(_) => "Hash",
18912        }
18913    }
18914
18915    #[must_use]
18916    pub const fn discriminant(&self) -> ColdArchiveBucketEntryType {
18917        #[allow(clippy::match_same_arms)]
18918        match self {
18919            Self::Metaentry(_) => ColdArchiveBucketEntryType::Metaentry,
18920            Self::ArchivedLeaf(_) => ColdArchiveBucketEntryType::ArchivedLeaf,
18921            Self::DeletedLeaf(_) => ColdArchiveBucketEntryType::DeletedLeaf,
18922            Self::BoundaryLeaf(_) => ColdArchiveBucketEntryType::BoundaryLeaf,
18923            Self::Hash(_) => ColdArchiveBucketEntryType::Hash,
18924        }
18925    }
18926
18927    #[must_use]
18928    pub const fn variants() -> [ColdArchiveBucketEntryType; 5] {
18929        Self::VARIANTS
18930    }
18931}
18932
18933impl Name for ColdArchiveBucketEntry {
18934    #[must_use]
18935    fn name(&self) -> &'static str {
18936        Self::name(self)
18937    }
18938}
18939
18940impl Discriminant<ColdArchiveBucketEntryType> for ColdArchiveBucketEntry {
18941    #[must_use]
18942    fn discriminant(&self) -> ColdArchiveBucketEntryType {
18943        Self::discriminant(self)
18944    }
18945}
18946
18947impl Variants<ColdArchiveBucketEntryType> for ColdArchiveBucketEntry {
18948    fn variants() -> slice::Iter<'static, ColdArchiveBucketEntryType> {
18949        Self::VARIANTS.iter()
18950    }
18951}
18952
18953impl Union<ColdArchiveBucketEntryType> for ColdArchiveBucketEntry {}
18954
18955impl ReadXdr for ColdArchiveBucketEntry {
18956    #[cfg(feature = "std")]
18957    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
18958        r.with_limited_depth(|r| {
18959            let dv: ColdArchiveBucketEntryType =
18960                <ColdArchiveBucketEntryType as ReadXdr>::read_xdr(r)?;
18961            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
18962            let v = match dv {
18963                ColdArchiveBucketEntryType::Metaentry => {
18964                    Self::Metaentry(BucketMetadata::read_xdr(r)?)
18965                }
18966                ColdArchiveBucketEntryType::ArchivedLeaf => {
18967                    Self::ArchivedLeaf(ColdArchiveArchivedLeaf::read_xdr(r)?)
18968                }
18969                ColdArchiveBucketEntryType::DeletedLeaf => {
18970                    Self::DeletedLeaf(ColdArchiveDeletedLeaf::read_xdr(r)?)
18971                }
18972                ColdArchiveBucketEntryType::BoundaryLeaf => {
18973                    Self::BoundaryLeaf(ColdArchiveBoundaryLeaf::read_xdr(r)?)
18974                }
18975                ColdArchiveBucketEntryType::Hash => Self::Hash(ColdArchiveHashEntry::read_xdr(r)?),
18976                #[allow(unreachable_patterns)]
18977                _ => return Err(Error::Invalid),
18978            };
18979            Ok(v)
18980        })
18981    }
18982}
18983
18984impl WriteXdr for ColdArchiveBucketEntry {
18985    #[cfg(feature = "std")]
18986    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
18987        w.with_limited_depth(|w| {
18988            self.discriminant().write_xdr(w)?;
18989            #[allow(clippy::match_same_arms)]
18990            match self {
18991                Self::Metaentry(v) => v.write_xdr(w)?,
18992                Self::ArchivedLeaf(v) => v.write_xdr(w)?,
18993                Self::DeletedLeaf(v) => v.write_xdr(w)?,
18994                Self::BoundaryLeaf(v) => v.write_xdr(w)?,
18995                Self::Hash(v) => v.write_xdr(w)?,
18996            };
18997            Ok(())
18998        })
18999    }
19000}
19001
19002/// UpgradeType is an XDR Typedef defines as:
19003///
19004/// ```text
19005/// typedef opaque UpgradeType<128>;
19006/// ```
19007///
19008#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
19009#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
19010#[derive(Default)]
19011#[cfg_attr(
19012    all(feature = "serde", feature = "alloc"),
19013    derive(serde::Serialize, serde::Deserialize),
19014    serde(rename_all = "snake_case")
19015)]
19016#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
19017#[derive(Debug)]
19018pub struct UpgradeType(pub BytesM<128>);
19019
19020impl From<UpgradeType> for BytesM<128> {
19021    #[must_use]
19022    fn from(x: UpgradeType) -> Self {
19023        x.0
19024    }
19025}
19026
19027impl From<BytesM<128>> for UpgradeType {
19028    #[must_use]
19029    fn from(x: BytesM<128>) -> Self {
19030        UpgradeType(x)
19031    }
19032}
19033
19034impl AsRef<BytesM<128>> for UpgradeType {
19035    #[must_use]
19036    fn as_ref(&self) -> &BytesM<128> {
19037        &self.0
19038    }
19039}
19040
19041impl ReadXdr for UpgradeType {
19042    #[cfg(feature = "std")]
19043    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
19044        r.with_limited_depth(|r| {
19045            let i = BytesM::<128>::read_xdr(r)?;
19046            let v = UpgradeType(i);
19047            Ok(v)
19048        })
19049    }
19050}
19051
19052impl WriteXdr for UpgradeType {
19053    #[cfg(feature = "std")]
19054    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
19055        w.with_limited_depth(|w| self.0.write_xdr(w))
19056    }
19057}
19058
19059impl Deref for UpgradeType {
19060    type Target = BytesM<128>;
19061    fn deref(&self) -> &Self::Target {
19062        &self.0
19063    }
19064}
19065
19066impl From<UpgradeType> for Vec<u8> {
19067    #[must_use]
19068    fn from(x: UpgradeType) -> Self {
19069        x.0 .0
19070    }
19071}
19072
19073impl TryFrom<Vec<u8>> for UpgradeType {
19074    type Error = Error;
19075    fn try_from(x: Vec<u8>) -> Result<Self> {
19076        Ok(UpgradeType(x.try_into()?))
19077    }
19078}
19079
19080#[cfg(feature = "alloc")]
19081impl TryFrom<&Vec<u8>> for UpgradeType {
19082    type Error = Error;
19083    fn try_from(x: &Vec<u8>) -> Result<Self> {
19084        Ok(UpgradeType(x.try_into()?))
19085    }
19086}
19087
19088impl AsRef<Vec<u8>> for UpgradeType {
19089    #[must_use]
19090    fn as_ref(&self) -> &Vec<u8> {
19091        &self.0 .0
19092    }
19093}
19094
19095impl AsRef<[u8]> for UpgradeType {
19096    #[cfg(feature = "alloc")]
19097    #[must_use]
19098    fn as_ref(&self) -> &[u8] {
19099        &self.0 .0
19100    }
19101    #[cfg(not(feature = "alloc"))]
19102    #[must_use]
19103    fn as_ref(&self) -> &[u8] {
19104        self.0 .0
19105    }
19106}
19107
19108/// StellarValueType is an XDR Enum defines as:
19109///
19110/// ```text
19111/// enum StellarValueType
19112/// {
19113///     STELLAR_VALUE_BASIC = 0,
19114///     STELLAR_VALUE_SIGNED = 1
19115/// };
19116/// ```
19117///
19118// enum
19119#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
19120#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
19121#[cfg_attr(
19122    all(feature = "serde", feature = "alloc"),
19123    derive(serde::Serialize, serde::Deserialize),
19124    serde(rename_all = "snake_case")
19125)]
19126#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
19127#[repr(i32)]
19128pub enum StellarValueType {
19129    Basic = 0,
19130    Signed = 1,
19131}
19132
19133impl StellarValueType {
19134    pub const VARIANTS: [StellarValueType; 2] = [StellarValueType::Basic, StellarValueType::Signed];
19135    pub const VARIANTS_STR: [&'static str; 2] = ["Basic", "Signed"];
19136
19137    #[must_use]
19138    pub const fn name(&self) -> &'static str {
19139        match self {
19140            Self::Basic => "Basic",
19141            Self::Signed => "Signed",
19142        }
19143    }
19144
19145    #[must_use]
19146    pub const fn variants() -> [StellarValueType; 2] {
19147        Self::VARIANTS
19148    }
19149}
19150
19151impl Name for StellarValueType {
19152    #[must_use]
19153    fn name(&self) -> &'static str {
19154        Self::name(self)
19155    }
19156}
19157
19158impl Variants<StellarValueType> for StellarValueType {
19159    fn variants() -> slice::Iter<'static, StellarValueType> {
19160        Self::VARIANTS.iter()
19161    }
19162}
19163
19164impl Enum for StellarValueType {}
19165
19166impl fmt::Display for StellarValueType {
19167    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
19168        f.write_str(self.name())
19169    }
19170}
19171
19172impl TryFrom<i32> for StellarValueType {
19173    type Error = Error;
19174
19175    fn try_from(i: i32) -> Result<Self> {
19176        let e = match i {
19177            0 => StellarValueType::Basic,
19178            1 => StellarValueType::Signed,
19179            #[allow(unreachable_patterns)]
19180            _ => return Err(Error::Invalid),
19181        };
19182        Ok(e)
19183    }
19184}
19185
19186impl From<StellarValueType> for i32 {
19187    #[must_use]
19188    fn from(e: StellarValueType) -> Self {
19189        e as Self
19190    }
19191}
19192
19193impl ReadXdr for StellarValueType {
19194    #[cfg(feature = "std")]
19195    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
19196        r.with_limited_depth(|r| {
19197            let e = i32::read_xdr(r)?;
19198            let v: Self = e.try_into()?;
19199            Ok(v)
19200        })
19201    }
19202}
19203
19204impl WriteXdr for StellarValueType {
19205    #[cfg(feature = "std")]
19206    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
19207        w.with_limited_depth(|w| {
19208            let i: i32 = (*self).into();
19209            i.write_xdr(w)
19210        })
19211    }
19212}
19213
19214/// LedgerCloseValueSignature is an XDR Struct defines as:
19215///
19216/// ```text
19217/// struct LedgerCloseValueSignature
19218/// {
19219///     NodeID nodeID;       // which node introduced the value
19220///     Signature signature; // nodeID's signature
19221/// };
19222/// ```
19223///
19224#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
19225#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
19226#[cfg_attr(
19227    all(feature = "serde", feature = "alloc"),
19228    derive(serde::Serialize, serde::Deserialize),
19229    serde(rename_all = "snake_case")
19230)]
19231#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
19232pub struct LedgerCloseValueSignature {
19233    pub node_id: NodeId,
19234    pub signature: Signature,
19235}
19236
19237impl ReadXdr for LedgerCloseValueSignature {
19238    #[cfg(feature = "std")]
19239    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
19240        r.with_limited_depth(|r| {
19241            Ok(Self {
19242                node_id: NodeId::read_xdr(r)?,
19243                signature: Signature::read_xdr(r)?,
19244            })
19245        })
19246    }
19247}
19248
19249impl WriteXdr for LedgerCloseValueSignature {
19250    #[cfg(feature = "std")]
19251    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
19252        w.with_limited_depth(|w| {
19253            self.node_id.write_xdr(w)?;
19254            self.signature.write_xdr(w)?;
19255            Ok(())
19256        })
19257    }
19258}
19259
19260/// StellarValueExt is an XDR NestedUnion defines as:
19261///
19262/// ```text
19263/// union switch (StellarValueType v)
19264///     {
19265///     case STELLAR_VALUE_BASIC:
19266///         void;
19267///     case STELLAR_VALUE_SIGNED:
19268///         LedgerCloseValueSignature lcValueSignature;
19269///     }
19270/// ```
19271///
19272// union with discriminant StellarValueType
19273#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
19274#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
19275#[cfg_attr(
19276    all(feature = "serde", feature = "alloc"),
19277    derive(serde::Serialize, serde::Deserialize),
19278    serde(rename_all = "snake_case")
19279)]
19280#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
19281#[allow(clippy::large_enum_variant)]
19282pub enum StellarValueExt {
19283    Basic,
19284    Signed(LedgerCloseValueSignature),
19285}
19286
19287impl StellarValueExt {
19288    pub const VARIANTS: [StellarValueType; 2] = [StellarValueType::Basic, StellarValueType::Signed];
19289    pub const VARIANTS_STR: [&'static str; 2] = ["Basic", "Signed"];
19290
19291    #[must_use]
19292    pub const fn name(&self) -> &'static str {
19293        match self {
19294            Self::Basic => "Basic",
19295            Self::Signed(_) => "Signed",
19296        }
19297    }
19298
19299    #[must_use]
19300    pub const fn discriminant(&self) -> StellarValueType {
19301        #[allow(clippy::match_same_arms)]
19302        match self {
19303            Self::Basic => StellarValueType::Basic,
19304            Self::Signed(_) => StellarValueType::Signed,
19305        }
19306    }
19307
19308    #[must_use]
19309    pub const fn variants() -> [StellarValueType; 2] {
19310        Self::VARIANTS
19311    }
19312}
19313
19314impl Name for StellarValueExt {
19315    #[must_use]
19316    fn name(&self) -> &'static str {
19317        Self::name(self)
19318    }
19319}
19320
19321impl Discriminant<StellarValueType> for StellarValueExt {
19322    #[must_use]
19323    fn discriminant(&self) -> StellarValueType {
19324        Self::discriminant(self)
19325    }
19326}
19327
19328impl Variants<StellarValueType> for StellarValueExt {
19329    fn variants() -> slice::Iter<'static, StellarValueType> {
19330        Self::VARIANTS.iter()
19331    }
19332}
19333
19334impl Union<StellarValueType> for StellarValueExt {}
19335
19336impl ReadXdr for StellarValueExt {
19337    #[cfg(feature = "std")]
19338    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
19339        r.with_limited_depth(|r| {
19340            let dv: StellarValueType = <StellarValueType as ReadXdr>::read_xdr(r)?;
19341            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
19342            let v = match dv {
19343                StellarValueType::Basic => Self::Basic,
19344                StellarValueType::Signed => Self::Signed(LedgerCloseValueSignature::read_xdr(r)?),
19345                #[allow(unreachable_patterns)]
19346                _ => return Err(Error::Invalid),
19347            };
19348            Ok(v)
19349        })
19350    }
19351}
19352
19353impl WriteXdr for StellarValueExt {
19354    #[cfg(feature = "std")]
19355    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
19356        w.with_limited_depth(|w| {
19357            self.discriminant().write_xdr(w)?;
19358            #[allow(clippy::match_same_arms)]
19359            match self {
19360                Self::Basic => ().write_xdr(w)?,
19361                Self::Signed(v) => v.write_xdr(w)?,
19362            };
19363            Ok(())
19364        })
19365    }
19366}
19367
19368/// StellarValue is an XDR Struct defines as:
19369///
19370/// ```text
19371/// struct StellarValue
19372/// {
19373///     Hash txSetHash;      // transaction set to apply to previous ledger
19374///     TimePoint closeTime; // network close time
19375///
19376///     // upgrades to apply to the previous ledger (usually empty)
19377///     // this is a vector of encoded 'LedgerUpgrade' so that nodes can drop
19378///     // unknown steps during consensus if needed.
19379///     // see notes below on 'LedgerUpgrade' for more detail
19380///     // max size is dictated by number of upgrade types (+ room for future)
19381///     UpgradeType upgrades<6>;
19382///
19383///     // reserved for future use
19384///     union switch (StellarValueType v)
19385///     {
19386///     case STELLAR_VALUE_BASIC:
19387///         void;
19388///     case STELLAR_VALUE_SIGNED:
19389///         LedgerCloseValueSignature lcValueSignature;
19390///     }
19391///     ext;
19392/// };
19393/// ```
19394///
19395#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
19396#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
19397#[cfg_attr(
19398    all(feature = "serde", feature = "alloc"),
19399    derive(serde::Serialize, serde::Deserialize),
19400    serde(rename_all = "snake_case")
19401)]
19402#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
19403pub struct StellarValue {
19404    pub tx_set_hash: Hash,
19405    pub close_time: TimePoint,
19406    pub upgrades: VecM<UpgradeType, 6>,
19407    pub ext: StellarValueExt,
19408}
19409
19410impl ReadXdr for StellarValue {
19411    #[cfg(feature = "std")]
19412    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
19413        r.with_limited_depth(|r| {
19414            Ok(Self {
19415                tx_set_hash: Hash::read_xdr(r)?,
19416                close_time: TimePoint::read_xdr(r)?,
19417                upgrades: VecM::<UpgradeType, 6>::read_xdr(r)?,
19418                ext: StellarValueExt::read_xdr(r)?,
19419            })
19420        })
19421    }
19422}
19423
19424impl WriteXdr for StellarValue {
19425    #[cfg(feature = "std")]
19426    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
19427        w.with_limited_depth(|w| {
19428            self.tx_set_hash.write_xdr(w)?;
19429            self.close_time.write_xdr(w)?;
19430            self.upgrades.write_xdr(w)?;
19431            self.ext.write_xdr(w)?;
19432            Ok(())
19433        })
19434    }
19435}
19436
19437/// MaskLedgerHeaderFlags is an XDR Const defines as:
19438///
19439/// ```text
19440/// const MASK_LEDGER_HEADER_FLAGS = 0x7;
19441/// ```
19442///
19443pub const MASK_LEDGER_HEADER_FLAGS: u64 = 0x7;
19444
19445/// LedgerHeaderFlags is an XDR Enum defines as:
19446///
19447/// ```text
19448/// enum LedgerHeaderFlags
19449/// {
19450///     DISABLE_LIQUIDITY_POOL_TRADING_FLAG = 0x1,
19451///     DISABLE_LIQUIDITY_POOL_DEPOSIT_FLAG = 0x2,
19452///     DISABLE_LIQUIDITY_POOL_WITHDRAWAL_FLAG = 0x4
19453/// };
19454/// ```
19455///
19456// enum
19457#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
19458#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
19459#[cfg_attr(
19460    all(feature = "serde", feature = "alloc"),
19461    derive(serde::Serialize, serde::Deserialize),
19462    serde(rename_all = "snake_case")
19463)]
19464#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
19465#[repr(i32)]
19466pub enum LedgerHeaderFlags {
19467    TradingFlag = 1,
19468    DepositFlag = 2,
19469    WithdrawalFlag = 4,
19470}
19471
19472impl LedgerHeaderFlags {
19473    pub const VARIANTS: [LedgerHeaderFlags; 3] = [
19474        LedgerHeaderFlags::TradingFlag,
19475        LedgerHeaderFlags::DepositFlag,
19476        LedgerHeaderFlags::WithdrawalFlag,
19477    ];
19478    pub const VARIANTS_STR: [&'static str; 3] = ["TradingFlag", "DepositFlag", "WithdrawalFlag"];
19479
19480    #[must_use]
19481    pub const fn name(&self) -> &'static str {
19482        match self {
19483            Self::TradingFlag => "TradingFlag",
19484            Self::DepositFlag => "DepositFlag",
19485            Self::WithdrawalFlag => "WithdrawalFlag",
19486        }
19487    }
19488
19489    #[must_use]
19490    pub const fn variants() -> [LedgerHeaderFlags; 3] {
19491        Self::VARIANTS
19492    }
19493}
19494
19495impl Name for LedgerHeaderFlags {
19496    #[must_use]
19497    fn name(&self) -> &'static str {
19498        Self::name(self)
19499    }
19500}
19501
19502impl Variants<LedgerHeaderFlags> for LedgerHeaderFlags {
19503    fn variants() -> slice::Iter<'static, LedgerHeaderFlags> {
19504        Self::VARIANTS.iter()
19505    }
19506}
19507
19508impl Enum for LedgerHeaderFlags {}
19509
19510impl fmt::Display for LedgerHeaderFlags {
19511    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
19512        f.write_str(self.name())
19513    }
19514}
19515
19516impl TryFrom<i32> for LedgerHeaderFlags {
19517    type Error = Error;
19518
19519    fn try_from(i: i32) -> Result<Self> {
19520        let e = match i {
19521            1 => LedgerHeaderFlags::TradingFlag,
19522            2 => LedgerHeaderFlags::DepositFlag,
19523            4 => LedgerHeaderFlags::WithdrawalFlag,
19524            #[allow(unreachable_patterns)]
19525            _ => return Err(Error::Invalid),
19526        };
19527        Ok(e)
19528    }
19529}
19530
19531impl From<LedgerHeaderFlags> for i32 {
19532    #[must_use]
19533    fn from(e: LedgerHeaderFlags) -> Self {
19534        e as Self
19535    }
19536}
19537
19538impl ReadXdr for LedgerHeaderFlags {
19539    #[cfg(feature = "std")]
19540    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
19541        r.with_limited_depth(|r| {
19542            let e = i32::read_xdr(r)?;
19543            let v: Self = e.try_into()?;
19544            Ok(v)
19545        })
19546    }
19547}
19548
19549impl WriteXdr for LedgerHeaderFlags {
19550    #[cfg(feature = "std")]
19551    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
19552        w.with_limited_depth(|w| {
19553            let i: i32 = (*self).into();
19554            i.write_xdr(w)
19555        })
19556    }
19557}
19558
19559/// LedgerHeaderExtensionV1Ext is an XDR NestedUnion defines as:
19560///
19561/// ```text
19562/// union switch (int v)
19563///     {
19564///     case 0:
19565///         void;
19566///     }
19567/// ```
19568///
19569// union with discriminant i32
19570#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
19571#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
19572#[cfg_attr(
19573    all(feature = "serde", feature = "alloc"),
19574    derive(serde::Serialize, serde::Deserialize),
19575    serde(rename_all = "snake_case")
19576)]
19577#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
19578#[allow(clippy::large_enum_variant)]
19579pub enum LedgerHeaderExtensionV1Ext {
19580    V0,
19581}
19582
19583impl LedgerHeaderExtensionV1Ext {
19584    pub const VARIANTS: [i32; 1] = [0];
19585    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
19586
19587    #[must_use]
19588    pub const fn name(&self) -> &'static str {
19589        match self {
19590            Self::V0 => "V0",
19591        }
19592    }
19593
19594    #[must_use]
19595    pub const fn discriminant(&self) -> i32 {
19596        #[allow(clippy::match_same_arms)]
19597        match self {
19598            Self::V0 => 0,
19599        }
19600    }
19601
19602    #[must_use]
19603    pub const fn variants() -> [i32; 1] {
19604        Self::VARIANTS
19605    }
19606}
19607
19608impl Name for LedgerHeaderExtensionV1Ext {
19609    #[must_use]
19610    fn name(&self) -> &'static str {
19611        Self::name(self)
19612    }
19613}
19614
19615impl Discriminant<i32> for LedgerHeaderExtensionV1Ext {
19616    #[must_use]
19617    fn discriminant(&self) -> i32 {
19618        Self::discriminant(self)
19619    }
19620}
19621
19622impl Variants<i32> for LedgerHeaderExtensionV1Ext {
19623    fn variants() -> slice::Iter<'static, i32> {
19624        Self::VARIANTS.iter()
19625    }
19626}
19627
19628impl Union<i32> for LedgerHeaderExtensionV1Ext {}
19629
19630impl ReadXdr for LedgerHeaderExtensionV1Ext {
19631    #[cfg(feature = "std")]
19632    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
19633        r.with_limited_depth(|r| {
19634            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
19635            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
19636            let v = match dv {
19637                0 => Self::V0,
19638                #[allow(unreachable_patterns)]
19639                _ => return Err(Error::Invalid),
19640            };
19641            Ok(v)
19642        })
19643    }
19644}
19645
19646impl WriteXdr for LedgerHeaderExtensionV1Ext {
19647    #[cfg(feature = "std")]
19648    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
19649        w.with_limited_depth(|w| {
19650            self.discriminant().write_xdr(w)?;
19651            #[allow(clippy::match_same_arms)]
19652            match self {
19653                Self::V0 => ().write_xdr(w)?,
19654            };
19655            Ok(())
19656        })
19657    }
19658}
19659
19660/// LedgerHeaderExtensionV1 is an XDR Struct defines as:
19661///
19662/// ```text
19663/// struct LedgerHeaderExtensionV1
19664/// {
19665///     uint32 flags; // LedgerHeaderFlags
19666///
19667///     union switch (int v)
19668///     {
19669///     case 0:
19670///         void;
19671///     }
19672///     ext;
19673/// };
19674/// ```
19675///
19676#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
19677#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
19678#[cfg_attr(
19679    all(feature = "serde", feature = "alloc"),
19680    derive(serde::Serialize, serde::Deserialize),
19681    serde(rename_all = "snake_case")
19682)]
19683#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
19684pub struct LedgerHeaderExtensionV1 {
19685    pub flags: u32,
19686    pub ext: LedgerHeaderExtensionV1Ext,
19687}
19688
19689impl ReadXdr for LedgerHeaderExtensionV1 {
19690    #[cfg(feature = "std")]
19691    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
19692        r.with_limited_depth(|r| {
19693            Ok(Self {
19694                flags: u32::read_xdr(r)?,
19695                ext: LedgerHeaderExtensionV1Ext::read_xdr(r)?,
19696            })
19697        })
19698    }
19699}
19700
19701impl WriteXdr for LedgerHeaderExtensionV1 {
19702    #[cfg(feature = "std")]
19703    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
19704        w.with_limited_depth(|w| {
19705            self.flags.write_xdr(w)?;
19706            self.ext.write_xdr(w)?;
19707            Ok(())
19708        })
19709    }
19710}
19711
19712/// LedgerHeaderExt is an XDR NestedUnion defines as:
19713///
19714/// ```text
19715/// union switch (int v)
19716///     {
19717///     case 0:
19718///         void;
19719///     case 1:
19720///         LedgerHeaderExtensionV1 v1;
19721///     }
19722/// ```
19723///
19724// union with discriminant i32
19725#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
19726#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
19727#[cfg_attr(
19728    all(feature = "serde", feature = "alloc"),
19729    derive(serde::Serialize, serde::Deserialize),
19730    serde(rename_all = "snake_case")
19731)]
19732#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
19733#[allow(clippy::large_enum_variant)]
19734pub enum LedgerHeaderExt {
19735    V0,
19736    V1(LedgerHeaderExtensionV1),
19737}
19738
19739impl LedgerHeaderExt {
19740    pub const VARIANTS: [i32; 2] = [0, 1];
19741    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"];
19742
19743    #[must_use]
19744    pub const fn name(&self) -> &'static str {
19745        match self {
19746            Self::V0 => "V0",
19747            Self::V1(_) => "V1",
19748        }
19749    }
19750
19751    #[must_use]
19752    pub const fn discriminant(&self) -> i32 {
19753        #[allow(clippy::match_same_arms)]
19754        match self {
19755            Self::V0 => 0,
19756            Self::V1(_) => 1,
19757        }
19758    }
19759
19760    #[must_use]
19761    pub const fn variants() -> [i32; 2] {
19762        Self::VARIANTS
19763    }
19764}
19765
19766impl Name for LedgerHeaderExt {
19767    #[must_use]
19768    fn name(&self) -> &'static str {
19769        Self::name(self)
19770    }
19771}
19772
19773impl Discriminant<i32> for LedgerHeaderExt {
19774    #[must_use]
19775    fn discriminant(&self) -> i32 {
19776        Self::discriminant(self)
19777    }
19778}
19779
19780impl Variants<i32> for LedgerHeaderExt {
19781    fn variants() -> slice::Iter<'static, i32> {
19782        Self::VARIANTS.iter()
19783    }
19784}
19785
19786impl Union<i32> for LedgerHeaderExt {}
19787
19788impl ReadXdr for LedgerHeaderExt {
19789    #[cfg(feature = "std")]
19790    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
19791        r.with_limited_depth(|r| {
19792            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
19793            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
19794            let v = match dv {
19795                0 => Self::V0,
19796                1 => Self::V1(LedgerHeaderExtensionV1::read_xdr(r)?),
19797                #[allow(unreachable_patterns)]
19798                _ => return Err(Error::Invalid),
19799            };
19800            Ok(v)
19801        })
19802    }
19803}
19804
19805impl WriteXdr for LedgerHeaderExt {
19806    #[cfg(feature = "std")]
19807    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
19808        w.with_limited_depth(|w| {
19809            self.discriminant().write_xdr(w)?;
19810            #[allow(clippy::match_same_arms)]
19811            match self {
19812                Self::V0 => ().write_xdr(w)?,
19813                Self::V1(v) => v.write_xdr(w)?,
19814            };
19815            Ok(())
19816        })
19817    }
19818}
19819
19820/// LedgerHeader is an XDR Struct defines as:
19821///
19822/// ```text
19823/// struct LedgerHeader
19824/// {
19825///     uint32 ledgerVersion;    // the protocol version of the ledger
19826///     Hash previousLedgerHash; // hash of the previous ledger header
19827///     StellarValue scpValue;   // what consensus agreed to
19828///     Hash txSetResultHash;    // the TransactionResultSet that led to this ledger
19829///     Hash bucketListHash;     // hash of the ledger state
19830///
19831///     uint32 ledgerSeq; // sequence number of this ledger
19832///
19833///     int64 totalCoins; // total number of stroops in existence.
19834///                       // 10,000,000 stroops in 1 XLM
19835///
19836///     int64 feePool;       // fees burned since last inflation run
19837///     uint32 inflationSeq; // inflation sequence number
19838///
19839///     uint64 idPool; // last used global ID, used for generating objects
19840///
19841///     uint32 baseFee;     // base fee per operation in stroops
19842///     uint32 baseReserve; // account base reserve in stroops
19843///
19844///     uint32 maxTxSetSize; // maximum size a transaction set can be
19845///
19846///     Hash skipList[4]; // hashes of ledgers in the past. allows you to jump back
19847///                       // in time without walking the chain back ledger by ledger
19848///                       // each slot contains the oldest ledger that is mod of
19849///                       // either 50  5000  50000 or 500000 depending on index
19850///                       // skipList[0] mod(50), skipList[1] mod(5000), etc
19851///
19852///     // reserved for future use
19853///     union switch (int v)
19854///     {
19855///     case 0:
19856///         void;
19857///     case 1:
19858///         LedgerHeaderExtensionV1 v1;
19859///     }
19860///     ext;
19861/// };
19862/// ```
19863///
19864#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
19865#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
19866#[cfg_attr(
19867    all(feature = "serde", feature = "alloc"),
19868    derive(serde::Serialize, serde::Deserialize),
19869    serde(rename_all = "snake_case")
19870)]
19871#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
19872pub struct LedgerHeader {
19873    pub ledger_version: u32,
19874    pub previous_ledger_hash: Hash,
19875    pub scp_value: StellarValue,
19876    pub tx_set_result_hash: Hash,
19877    pub bucket_list_hash: Hash,
19878    pub ledger_seq: u32,
19879    pub total_coins: i64,
19880    pub fee_pool: i64,
19881    pub inflation_seq: u32,
19882    pub id_pool: u64,
19883    pub base_fee: u32,
19884    pub base_reserve: u32,
19885    pub max_tx_set_size: u32,
19886    pub skip_list: [Hash; 4],
19887    pub ext: LedgerHeaderExt,
19888}
19889
19890impl ReadXdr for LedgerHeader {
19891    #[cfg(feature = "std")]
19892    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
19893        r.with_limited_depth(|r| {
19894            Ok(Self {
19895                ledger_version: u32::read_xdr(r)?,
19896                previous_ledger_hash: Hash::read_xdr(r)?,
19897                scp_value: StellarValue::read_xdr(r)?,
19898                tx_set_result_hash: Hash::read_xdr(r)?,
19899                bucket_list_hash: Hash::read_xdr(r)?,
19900                ledger_seq: u32::read_xdr(r)?,
19901                total_coins: i64::read_xdr(r)?,
19902                fee_pool: i64::read_xdr(r)?,
19903                inflation_seq: u32::read_xdr(r)?,
19904                id_pool: u64::read_xdr(r)?,
19905                base_fee: u32::read_xdr(r)?,
19906                base_reserve: u32::read_xdr(r)?,
19907                max_tx_set_size: u32::read_xdr(r)?,
19908                skip_list: <[Hash; 4]>::read_xdr(r)?,
19909                ext: LedgerHeaderExt::read_xdr(r)?,
19910            })
19911        })
19912    }
19913}
19914
19915impl WriteXdr for LedgerHeader {
19916    #[cfg(feature = "std")]
19917    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
19918        w.with_limited_depth(|w| {
19919            self.ledger_version.write_xdr(w)?;
19920            self.previous_ledger_hash.write_xdr(w)?;
19921            self.scp_value.write_xdr(w)?;
19922            self.tx_set_result_hash.write_xdr(w)?;
19923            self.bucket_list_hash.write_xdr(w)?;
19924            self.ledger_seq.write_xdr(w)?;
19925            self.total_coins.write_xdr(w)?;
19926            self.fee_pool.write_xdr(w)?;
19927            self.inflation_seq.write_xdr(w)?;
19928            self.id_pool.write_xdr(w)?;
19929            self.base_fee.write_xdr(w)?;
19930            self.base_reserve.write_xdr(w)?;
19931            self.max_tx_set_size.write_xdr(w)?;
19932            self.skip_list.write_xdr(w)?;
19933            self.ext.write_xdr(w)?;
19934            Ok(())
19935        })
19936    }
19937}
19938
19939/// LedgerUpgradeType is an XDR Enum defines as:
19940///
19941/// ```text
19942/// enum LedgerUpgradeType
19943/// {
19944///     LEDGER_UPGRADE_VERSION = 1,
19945///     LEDGER_UPGRADE_BASE_FEE = 2,
19946///     LEDGER_UPGRADE_MAX_TX_SET_SIZE = 3,
19947///     LEDGER_UPGRADE_BASE_RESERVE = 4,
19948///     LEDGER_UPGRADE_FLAGS = 5,
19949///     LEDGER_UPGRADE_CONFIG = 6,
19950///     LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE = 7
19951/// };
19952/// ```
19953///
19954// enum
19955#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
19956#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
19957#[cfg_attr(
19958    all(feature = "serde", feature = "alloc"),
19959    derive(serde::Serialize, serde::Deserialize),
19960    serde(rename_all = "snake_case")
19961)]
19962#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
19963#[repr(i32)]
19964pub enum LedgerUpgradeType {
19965    Version = 1,
19966    BaseFee = 2,
19967    MaxTxSetSize = 3,
19968    BaseReserve = 4,
19969    Flags = 5,
19970    Config = 6,
19971    MaxSorobanTxSetSize = 7,
19972}
19973
19974impl LedgerUpgradeType {
19975    pub const VARIANTS: [LedgerUpgradeType; 7] = [
19976        LedgerUpgradeType::Version,
19977        LedgerUpgradeType::BaseFee,
19978        LedgerUpgradeType::MaxTxSetSize,
19979        LedgerUpgradeType::BaseReserve,
19980        LedgerUpgradeType::Flags,
19981        LedgerUpgradeType::Config,
19982        LedgerUpgradeType::MaxSorobanTxSetSize,
19983    ];
19984    pub const VARIANTS_STR: [&'static str; 7] = [
19985        "Version",
19986        "BaseFee",
19987        "MaxTxSetSize",
19988        "BaseReserve",
19989        "Flags",
19990        "Config",
19991        "MaxSorobanTxSetSize",
19992    ];
19993
19994    #[must_use]
19995    pub const fn name(&self) -> &'static str {
19996        match self {
19997            Self::Version => "Version",
19998            Self::BaseFee => "BaseFee",
19999            Self::MaxTxSetSize => "MaxTxSetSize",
20000            Self::BaseReserve => "BaseReserve",
20001            Self::Flags => "Flags",
20002            Self::Config => "Config",
20003            Self::MaxSorobanTxSetSize => "MaxSorobanTxSetSize",
20004        }
20005    }
20006
20007    #[must_use]
20008    pub const fn variants() -> [LedgerUpgradeType; 7] {
20009        Self::VARIANTS
20010    }
20011}
20012
20013impl Name for LedgerUpgradeType {
20014    #[must_use]
20015    fn name(&self) -> &'static str {
20016        Self::name(self)
20017    }
20018}
20019
20020impl Variants<LedgerUpgradeType> for LedgerUpgradeType {
20021    fn variants() -> slice::Iter<'static, LedgerUpgradeType> {
20022        Self::VARIANTS.iter()
20023    }
20024}
20025
20026impl Enum for LedgerUpgradeType {}
20027
20028impl fmt::Display for LedgerUpgradeType {
20029    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
20030        f.write_str(self.name())
20031    }
20032}
20033
20034impl TryFrom<i32> for LedgerUpgradeType {
20035    type Error = Error;
20036
20037    fn try_from(i: i32) -> Result<Self> {
20038        let e = match i {
20039            1 => LedgerUpgradeType::Version,
20040            2 => LedgerUpgradeType::BaseFee,
20041            3 => LedgerUpgradeType::MaxTxSetSize,
20042            4 => LedgerUpgradeType::BaseReserve,
20043            5 => LedgerUpgradeType::Flags,
20044            6 => LedgerUpgradeType::Config,
20045            7 => LedgerUpgradeType::MaxSorobanTxSetSize,
20046            #[allow(unreachable_patterns)]
20047            _ => return Err(Error::Invalid),
20048        };
20049        Ok(e)
20050    }
20051}
20052
20053impl From<LedgerUpgradeType> for i32 {
20054    #[must_use]
20055    fn from(e: LedgerUpgradeType) -> Self {
20056        e as Self
20057    }
20058}
20059
20060impl ReadXdr for LedgerUpgradeType {
20061    #[cfg(feature = "std")]
20062    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
20063        r.with_limited_depth(|r| {
20064            let e = i32::read_xdr(r)?;
20065            let v: Self = e.try_into()?;
20066            Ok(v)
20067        })
20068    }
20069}
20070
20071impl WriteXdr for LedgerUpgradeType {
20072    #[cfg(feature = "std")]
20073    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
20074        w.with_limited_depth(|w| {
20075            let i: i32 = (*self).into();
20076            i.write_xdr(w)
20077        })
20078    }
20079}
20080
20081/// ConfigUpgradeSetKey is an XDR Struct defines as:
20082///
20083/// ```text
20084/// struct ConfigUpgradeSetKey {
20085///     Hash contractID;
20086///     Hash contentHash;
20087/// };
20088/// ```
20089///
20090#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
20091#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
20092#[cfg_attr(
20093    all(feature = "serde", feature = "alloc"),
20094    derive(serde::Serialize, serde::Deserialize),
20095    serde(rename_all = "snake_case")
20096)]
20097#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
20098pub struct ConfigUpgradeSetKey {
20099    pub contract_id: Hash,
20100    pub content_hash: Hash,
20101}
20102
20103impl ReadXdr for ConfigUpgradeSetKey {
20104    #[cfg(feature = "std")]
20105    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
20106        r.with_limited_depth(|r| {
20107            Ok(Self {
20108                contract_id: Hash::read_xdr(r)?,
20109                content_hash: Hash::read_xdr(r)?,
20110            })
20111        })
20112    }
20113}
20114
20115impl WriteXdr for ConfigUpgradeSetKey {
20116    #[cfg(feature = "std")]
20117    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
20118        w.with_limited_depth(|w| {
20119            self.contract_id.write_xdr(w)?;
20120            self.content_hash.write_xdr(w)?;
20121            Ok(())
20122        })
20123    }
20124}
20125
20126/// LedgerUpgrade is an XDR Union defines as:
20127///
20128/// ```text
20129/// union LedgerUpgrade switch (LedgerUpgradeType type)
20130/// {
20131/// case LEDGER_UPGRADE_VERSION:
20132///     uint32 newLedgerVersion; // update ledgerVersion
20133/// case LEDGER_UPGRADE_BASE_FEE:
20134///     uint32 newBaseFee; // update baseFee
20135/// case LEDGER_UPGRADE_MAX_TX_SET_SIZE:
20136///     uint32 newMaxTxSetSize; // update maxTxSetSize
20137/// case LEDGER_UPGRADE_BASE_RESERVE:
20138///     uint32 newBaseReserve; // update baseReserve
20139/// case LEDGER_UPGRADE_FLAGS:
20140///     uint32 newFlags; // update flags
20141/// case LEDGER_UPGRADE_CONFIG:
20142///     // Update arbitrary `ConfigSetting` entries identified by the key.
20143///     ConfigUpgradeSetKey newConfig;
20144/// case LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE:
20145///     // Update ConfigSettingContractExecutionLanesV0.ledgerMaxTxCount without
20146///     // using `LEDGER_UPGRADE_CONFIG`.
20147///     uint32 newMaxSorobanTxSetSize;
20148/// };
20149/// ```
20150///
20151// union with discriminant LedgerUpgradeType
20152#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
20153#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
20154#[cfg_attr(
20155    all(feature = "serde", feature = "alloc"),
20156    derive(serde::Serialize, serde::Deserialize),
20157    serde(rename_all = "snake_case")
20158)]
20159#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
20160#[allow(clippy::large_enum_variant)]
20161pub enum LedgerUpgrade {
20162    Version(u32),
20163    BaseFee(u32),
20164    MaxTxSetSize(u32),
20165    BaseReserve(u32),
20166    Flags(u32),
20167    Config(ConfigUpgradeSetKey),
20168    MaxSorobanTxSetSize(u32),
20169}
20170
20171impl LedgerUpgrade {
20172    pub const VARIANTS: [LedgerUpgradeType; 7] = [
20173        LedgerUpgradeType::Version,
20174        LedgerUpgradeType::BaseFee,
20175        LedgerUpgradeType::MaxTxSetSize,
20176        LedgerUpgradeType::BaseReserve,
20177        LedgerUpgradeType::Flags,
20178        LedgerUpgradeType::Config,
20179        LedgerUpgradeType::MaxSorobanTxSetSize,
20180    ];
20181    pub const VARIANTS_STR: [&'static str; 7] = [
20182        "Version",
20183        "BaseFee",
20184        "MaxTxSetSize",
20185        "BaseReserve",
20186        "Flags",
20187        "Config",
20188        "MaxSorobanTxSetSize",
20189    ];
20190
20191    #[must_use]
20192    pub const fn name(&self) -> &'static str {
20193        match self {
20194            Self::Version(_) => "Version",
20195            Self::BaseFee(_) => "BaseFee",
20196            Self::MaxTxSetSize(_) => "MaxTxSetSize",
20197            Self::BaseReserve(_) => "BaseReserve",
20198            Self::Flags(_) => "Flags",
20199            Self::Config(_) => "Config",
20200            Self::MaxSorobanTxSetSize(_) => "MaxSorobanTxSetSize",
20201        }
20202    }
20203
20204    #[must_use]
20205    pub const fn discriminant(&self) -> LedgerUpgradeType {
20206        #[allow(clippy::match_same_arms)]
20207        match self {
20208            Self::Version(_) => LedgerUpgradeType::Version,
20209            Self::BaseFee(_) => LedgerUpgradeType::BaseFee,
20210            Self::MaxTxSetSize(_) => LedgerUpgradeType::MaxTxSetSize,
20211            Self::BaseReserve(_) => LedgerUpgradeType::BaseReserve,
20212            Self::Flags(_) => LedgerUpgradeType::Flags,
20213            Self::Config(_) => LedgerUpgradeType::Config,
20214            Self::MaxSorobanTxSetSize(_) => LedgerUpgradeType::MaxSorobanTxSetSize,
20215        }
20216    }
20217
20218    #[must_use]
20219    pub const fn variants() -> [LedgerUpgradeType; 7] {
20220        Self::VARIANTS
20221    }
20222}
20223
20224impl Name for LedgerUpgrade {
20225    #[must_use]
20226    fn name(&self) -> &'static str {
20227        Self::name(self)
20228    }
20229}
20230
20231impl Discriminant<LedgerUpgradeType> for LedgerUpgrade {
20232    #[must_use]
20233    fn discriminant(&self) -> LedgerUpgradeType {
20234        Self::discriminant(self)
20235    }
20236}
20237
20238impl Variants<LedgerUpgradeType> for LedgerUpgrade {
20239    fn variants() -> slice::Iter<'static, LedgerUpgradeType> {
20240        Self::VARIANTS.iter()
20241    }
20242}
20243
20244impl Union<LedgerUpgradeType> for LedgerUpgrade {}
20245
20246impl ReadXdr for LedgerUpgrade {
20247    #[cfg(feature = "std")]
20248    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
20249        r.with_limited_depth(|r| {
20250            let dv: LedgerUpgradeType = <LedgerUpgradeType as ReadXdr>::read_xdr(r)?;
20251            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
20252            let v = match dv {
20253                LedgerUpgradeType::Version => Self::Version(u32::read_xdr(r)?),
20254                LedgerUpgradeType::BaseFee => Self::BaseFee(u32::read_xdr(r)?),
20255                LedgerUpgradeType::MaxTxSetSize => Self::MaxTxSetSize(u32::read_xdr(r)?),
20256                LedgerUpgradeType::BaseReserve => Self::BaseReserve(u32::read_xdr(r)?),
20257                LedgerUpgradeType::Flags => Self::Flags(u32::read_xdr(r)?),
20258                LedgerUpgradeType::Config => Self::Config(ConfigUpgradeSetKey::read_xdr(r)?),
20259                LedgerUpgradeType::MaxSorobanTxSetSize => {
20260                    Self::MaxSorobanTxSetSize(u32::read_xdr(r)?)
20261                }
20262                #[allow(unreachable_patterns)]
20263                _ => return Err(Error::Invalid),
20264            };
20265            Ok(v)
20266        })
20267    }
20268}
20269
20270impl WriteXdr for LedgerUpgrade {
20271    #[cfg(feature = "std")]
20272    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
20273        w.with_limited_depth(|w| {
20274            self.discriminant().write_xdr(w)?;
20275            #[allow(clippy::match_same_arms)]
20276            match self {
20277                Self::Version(v) => v.write_xdr(w)?,
20278                Self::BaseFee(v) => v.write_xdr(w)?,
20279                Self::MaxTxSetSize(v) => v.write_xdr(w)?,
20280                Self::BaseReserve(v) => v.write_xdr(w)?,
20281                Self::Flags(v) => v.write_xdr(w)?,
20282                Self::Config(v) => v.write_xdr(w)?,
20283                Self::MaxSorobanTxSetSize(v) => v.write_xdr(w)?,
20284            };
20285            Ok(())
20286        })
20287    }
20288}
20289
20290/// ConfigUpgradeSet is an XDR Struct defines as:
20291///
20292/// ```text
20293/// struct ConfigUpgradeSet {
20294///     ConfigSettingEntry updatedEntry<>;
20295/// };
20296/// ```
20297///
20298#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
20299#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
20300#[cfg_attr(
20301    all(feature = "serde", feature = "alloc"),
20302    derive(serde::Serialize, serde::Deserialize),
20303    serde(rename_all = "snake_case")
20304)]
20305#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
20306pub struct ConfigUpgradeSet {
20307    pub updated_entry: VecM<ConfigSettingEntry>,
20308}
20309
20310impl ReadXdr for ConfigUpgradeSet {
20311    #[cfg(feature = "std")]
20312    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
20313        r.with_limited_depth(|r| {
20314            Ok(Self {
20315                updated_entry: VecM::<ConfigSettingEntry>::read_xdr(r)?,
20316            })
20317        })
20318    }
20319}
20320
20321impl WriteXdr for ConfigUpgradeSet {
20322    #[cfg(feature = "std")]
20323    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
20324        w.with_limited_depth(|w| {
20325            self.updated_entry.write_xdr(w)?;
20326            Ok(())
20327        })
20328    }
20329}
20330
20331/// TxSetComponentType is an XDR Enum defines as:
20332///
20333/// ```text
20334/// enum TxSetComponentType
20335/// {
20336///   // txs with effective fee <= bid derived from a base fee (if any).
20337///   // If base fee is not specified, no discount is applied.
20338///   TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE = 0
20339/// };
20340/// ```
20341///
20342// enum
20343#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
20344#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
20345#[cfg_attr(
20346    all(feature = "serde", feature = "alloc"),
20347    derive(serde::Serialize, serde::Deserialize),
20348    serde(rename_all = "snake_case")
20349)]
20350#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
20351#[repr(i32)]
20352pub enum TxSetComponentType {
20353    TxsetCompTxsMaybeDiscountedFee = 0,
20354}
20355
20356impl TxSetComponentType {
20357    pub const VARIANTS: [TxSetComponentType; 1] =
20358        [TxSetComponentType::TxsetCompTxsMaybeDiscountedFee];
20359    pub const VARIANTS_STR: [&'static str; 1] = ["TxsetCompTxsMaybeDiscountedFee"];
20360
20361    #[must_use]
20362    pub const fn name(&self) -> &'static str {
20363        match self {
20364            Self::TxsetCompTxsMaybeDiscountedFee => "TxsetCompTxsMaybeDiscountedFee",
20365        }
20366    }
20367
20368    #[must_use]
20369    pub const fn variants() -> [TxSetComponentType; 1] {
20370        Self::VARIANTS
20371    }
20372}
20373
20374impl Name for TxSetComponentType {
20375    #[must_use]
20376    fn name(&self) -> &'static str {
20377        Self::name(self)
20378    }
20379}
20380
20381impl Variants<TxSetComponentType> for TxSetComponentType {
20382    fn variants() -> slice::Iter<'static, TxSetComponentType> {
20383        Self::VARIANTS.iter()
20384    }
20385}
20386
20387impl Enum for TxSetComponentType {}
20388
20389impl fmt::Display for TxSetComponentType {
20390    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
20391        f.write_str(self.name())
20392    }
20393}
20394
20395impl TryFrom<i32> for TxSetComponentType {
20396    type Error = Error;
20397
20398    fn try_from(i: i32) -> Result<Self> {
20399        let e = match i {
20400            0 => TxSetComponentType::TxsetCompTxsMaybeDiscountedFee,
20401            #[allow(unreachable_patterns)]
20402            _ => return Err(Error::Invalid),
20403        };
20404        Ok(e)
20405    }
20406}
20407
20408impl From<TxSetComponentType> for i32 {
20409    #[must_use]
20410    fn from(e: TxSetComponentType) -> Self {
20411        e as Self
20412    }
20413}
20414
20415impl ReadXdr for TxSetComponentType {
20416    #[cfg(feature = "std")]
20417    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
20418        r.with_limited_depth(|r| {
20419            let e = i32::read_xdr(r)?;
20420            let v: Self = e.try_into()?;
20421            Ok(v)
20422        })
20423    }
20424}
20425
20426impl WriteXdr for TxSetComponentType {
20427    #[cfg(feature = "std")]
20428    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
20429        w.with_limited_depth(|w| {
20430            let i: i32 = (*self).into();
20431            i.write_xdr(w)
20432        })
20433    }
20434}
20435
20436/// TxExecutionThread is an XDR Typedef defines as:
20437///
20438/// ```text
20439/// typedef TransactionEnvelope TxExecutionThread<>;
20440/// ```
20441///
20442#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
20443#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
20444#[derive(Default)]
20445#[cfg_attr(
20446    all(feature = "serde", feature = "alloc"),
20447    derive(serde::Serialize, serde::Deserialize),
20448    serde(rename_all = "snake_case")
20449)]
20450#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
20451#[derive(Debug)]
20452pub struct TxExecutionThread(pub VecM<TransactionEnvelope>);
20453
20454impl From<TxExecutionThread> for VecM<TransactionEnvelope> {
20455    #[must_use]
20456    fn from(x: TxExecutionThread) -> Self {
20457        x.0
20458    }
20459}
20460
20461impl From<VecM<TransactionEnvelope>> for TxExecutionThread {
20462    #[must_use]
20463    fn from(x: VecM<TransactionEnvelope>) -> Self {
20464        TxExecutionThread(x)
20465    }
20466}
20467
20468impl AsRef<VecM<TransactionEnvelope>> for TxExecutionThread {
20469    #[must_use]
20470    fn as_ref(&self) -> &VecM<TransactionEnvelope> {
20471        &self.0
20472    }
20473}
20474
20475impl ReadXdr for TxExecutionThread {
20476    #[cfg(feature = "std")]
20477    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
20478        r.with_limited_depth(|r| {
20479            let i = VecM::<TransactionEnvelope>::read_xdr(r)?;
20480            let v = TxExecutionThread(i);
20481            Ok(v)
20482        })
20483    }
20484}
20485
20486impl WriteXdr for TxExecutionThread {
20487    #[cfg(feature = "std")]
20488    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
20489        w.with_limited_depth(|w| self.0.write_xdr(w))
20490    }
20491}
20492
20493impl Deref for TxExecutionThread {
20494    type Target = VecM<TransactionEnvelope>;
20495    fn deref(&self) -> &Self::Target {
20496        &self.0
20497    }
20498}
20499
20500impl From<TxExecutionThread> for Vec<TransactionEnvelope> {
20501    #[must_use]
20502    fn from(x: TxExecutionThread) -> Self {
20503        x.0 .0
20504    }
20505}
20506
20507impl TryFrom<Vec<TransactionEnvelope>> for TxExecutionThread {
20508    type Error = Error;
20509    fn try_from(x: Vec<TransactionEnvelope>) -> Result<Self> {
20510        Ok(TxExecutionThread(x.try_into()?))
20511    }
20512}
20513
20514#[cfg(feature = "alloc")]
20515impl TryFrom<&Vec<TransactionEnvelope>> for TxExecutionThread {
20516    type Error = Error;
20517    fn try_from(x: &Vec<TransactionEnvelope>) -> Result<Self> {
20518        Ok(TxExecutionThread(x.try_into()?))
20519    }
20520}
20521
20522impl AsRef<Vec<TransactionEnvelope>> for TxExecutionThread {
20523    #[must_use]
20524    fn as_ref(&self) -> &Vec<TransactionEnvelope> {
20525        &self.0 .0
20526    }
20527}
20528
20529impl AsRef<[TransactionEnvelope]> for TxExecutionThread {
20530    #[cfg(feature = "alloc")]
20531    #[must_use]
20532    fn as_ref(&self) -> &[TransactionEnvelope] {
20533        &self.0 .0
20534    }
20535    #[cfg(not(feature = "alloc"))]
20536    #[must_use]
20537    fn as_ref(&self) -> &[TransactionEnvelope] {
20538        self.0 .0
20539    }
20540}
20541
20542/// ParallelTxExecutionStage is an XDR Typedef defines as:
20543///
20544/// ```text
20545/// typedef TxExecutionThread ParallelTxExecutionStage<>;
20546/// ```
20547///
20548#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
20549#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
20550#[derive(Default)]
20551#[cfg_attr(
20552    all(feature = "serde", feature = "alloc"),
20553    derive(serde::Serialize, serde::Deserialize),
20554    serde(rename_all = "snake_case")
20555)]
20556#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
20557#[derive(Debug)]
20558pub struct ParallelTxExecutionStage(pub VecM<TxExecutionThread>);
20559
20560impl From<ParallelTxExecutionStage> for VecM<TxExecutionThread> {
20561    #[must_use]
20562    fn from(x: ParallelTxExecutionStage) -> Self {
20563        x.0
20564    }
20565}
20566
20567impl From<VecM<TxExecutionThread>> for ParallelTxExecutionStage {
20568    #[must_use]
20569    fn from(x: VecM<TxExecutionThread>) -> Self {
20570        ParallelTxExecutionStage(x)
20571    }
20572}
20573
20574impl AsRef<VecM<TxExecutionThread>> for ParallelTxExecutionStage {
20575    #[must_use]
20576    fn as_ref(&self) -> &VecM<TxExecutionThread> {
20577        &self.0
20578    }
20579}
20580
20581impl ReadXdr for ParallelTxExecutionStage {
20582    #[cfg(feature = "std")]
20583    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
20584        r.with_limited_depth(|r| {
20585            let i = VecM::<TxExecutionThread>::read_xdr(r)?;
20586            let v = ParallelTxExecutionStage(i);
20587            Ok(v)
20588        })
20589    }
20590}
20591
20592impl WriteXdr for ParallelTxExecutionStage {
20593    #[cfg(feature = "std")]
20594    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
20595        w.with_limited_depth(|w| self.0.write_xdr(w))
20596    }
20597}
20598
20599impl Deref for ParallelTxExecutionStage {
20600    type Target = VecM<TxExecutionThread>;
20601    fn deref(&self) -> &Self::Target {
20602        &self.0
20603    }
20604}
20605
20606impl From<ParallelTxExecutionStage> for Vec<TxExecutionThread> {
20607    #[must_use]
20608    fn from(x: ParallelTxExecutionStage) -> Self {
20609        x.0 .0
20610    }
20611}
20612
20613impl TryFrom<Vec<TxExecutionThread>> for ParallelTxExecutionStage {
20614    type Error = Error;
20615    fn try_from(x: Vec<TxExecutionThread>) -> Result<Self> {
20616        Ok(ParallelTxExecutionStage(x.try_into()?))
20617    }
20618}
20619
20620#[cfg(feature = "alloc")]
20621impl TryFrom<&Vec<TxExecutionThread>> for ParallelTxExecutionStage {
20622    type Error = Error;
20623    fn try_from(x: &Vec<TxExecutionThread>) -> Result<Self> {
20624        Ok(ParallelTxExecutionStage(x.try_into()?))
20625    }
20626}
20627
20628impl AsRef<Vec<TxExecutionThread>> for ParallelTxExecutionStage {
20629    #[must_use]
20630    fn as_ref(&self) -> &Vec<TxExecutionThread> {
20631        &self.0 .0
20632    }
20633}
20634
20635impl AsRef<[TxExecutionThread]> for ParallelTxExecutionStage {
20636    #[cfg(feature = "alloc")]
20637    #[must_use]
20638    fn as_ref(&self) -> &[TxExecutionThread] {
20639        &self.0 .0
20640    }
20641    #[cfg(not(feature = "alloc"))]
20642    #[must_use]
20643    fn as_ref(&self) -> &[TxExecutionThread] {
20644        self.0 .0
20645    }
20646}
20647
20648/// ParallelTxsComponent is an XDR Struct defines as:
20649///
20650/// ```text
20651/// struct ParallelTxsComponent
20652/// {
20653///   int64* baseFee;
20654///   ParallelTxExecutionStage executionStages<>;
20655/// };
20656/// ```
20657///
20658#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
20659#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
20660#[cfg_attr(
20661    all(feature = "serde", feature = "alloc"),
20662    derive(serde::Serialize, serde::Deserialize),
20663    serde(rename_all = "snake_case")
20664)]
20665#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
20666pub struct ParallelTxsComponent {
20667    pub base_fee: Option<i64>,
20668    pub execution_stages: VecM<ParallelTxExecutionStage>,
20669}
20670
20671impl ReadXdr for ParallelTxsComponent {
20672    #[cfg(feature = "std")]
20673    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
20674        r.with_limited_depth(|r| {
20675            Ok(Self {
20676                base_fee: Option::<i64>::read_xdr(r)?,
20677                execution_stages: VecM::<ParallelTxExecutionStage>::read_xdr(r)?,
20678            })
20679        })
20680    }
20681}
20682
20683impl WriteXdr for ParallelTxsComponent {
20684    #[cfg(feature = "std")]
20685    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
20686        w.with_limited_depth(|w| {
20687            self.base_fee.write_xdr(w)?;
20688            self.execution_stages.write_xdr(w)?;
20689            Ok(())
20690        })
20691    }
20692}
20693
20694/// TxSetComponentTxsMaybeDiscountedFee is an XDR NestedStruct defines as:
20695///
20696/// ```text
20697/// struct
20698///   {
20699///     int64* baseFee;
20700///     TransactionEnvelope txs<>;
20701///   }
20702/// ```
20703///
20704#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
20705#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
20706#[cfg_attr(
20707    all(feature = "serde", feature = "alloc"),
20708    derive(serde::Serialize, serde::Deserialize),
20709    serde(rename_all = "snake_case")
20710)]
20711#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
20712pub struct TxSetComponentTxsMaybeDiscountedFee {
20713    pub base_fee: Option<i64>,
20714    pub txs: VecM<TransactionEnvelope>,
20715}
20716
20717impl ReadXdr for TxSetComponentTxsMaybeDiscountedFee {
20718    #[cfg(feature = "std")]
20719    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
20720        r.with_limited_depth(|r| {
20721            Ok(Self {
20722                base_fee: Option::<i64>::read_xdr(r)?,
20723                txs: VecM::<TransactionEnvelope>::read_xdr(r)?,
20724            })
20725        })
20726    }
20727}
20728
20729impl WriteXdr for TxSetComponentTxsMaybeDiscountedFee {
20730    #[cfg(feature = "std")]
20731    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
20732        w.with_limited_depth(|w| {
20733            self.base_fee.write_xdr(w)?;
20734            self.txs.write_xdr(w)?;
20735            Ok(())
20736        })
20737    }
20738}
20739
20740/// TxSetComponent is an XDR Union defines as:
20741///
20742/// ```text
20743/// union TxSetComponent switch (TxSetComponentType type)
20744/// {
20745/// case TXSET_COMP_TXS_MAYBE_DISCOUNTED_FEE:
20746///   struct
20747///   {
20748///     int64* baseFee;
20749///     TransactionEnvelope txs<>;
20750///   } txsMaybeDiscountedFee;
20751/// };
20752/// ```
20753///
20754// union with discriminant TxSetComponentType
20755#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
20756#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
20757#[cfg_attr(
20758    all(feature = "serde", feature = "alloc"),
20759    derive(serde::Serialize, serde::Deserialize),
20760    serde(rename_all = "snake_case")
20761)]
20762#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
20763#[allow(clippy::large_enum_variant)]
20764pub enum TxSetComponent {
20765    TxsetCompTxsMaybeDiscountedFee(TxSetComponentTxsMaybeDiscountedFee),
20766}
20767
20768impl TxSetComponent {
20769    pub const VARIANTS: [TxSetComponentType; 1] =
20770        [TxSetComponentType::TxsetCompTxsMaybeDiscountedFee];
20771    pub const VARIANTS_STR: [&'static str; 1] = ["TxsetCompTxsMaybeDiscountedFee"];
20772
20773    #[must_use]
20774    pub const fn name(&self) -> &'static str {
20775        match self {
20776            Self::TxsetCompTxsMaybeDiscountedFee(_) => "TxsetCompTxsMaybeDiscountedFee",
20777        }
20778    }
20779
20780    #[must_use]
20781    pub const fn discriminant(&self) -> TxSetComponentType {
20782        #[allow(clippy::match_same_arms)]
20783        match self {
20784            Self::TxsetCompTxsMaybeDiscountedFee(_) => {
20785                TxSetComponentType::TxsetCompTxsMaybeDiscountedFee
20786            }
20787        }
20788    }
20789
20790    #[must_use]
20791    pub const fn variants() -> [TxSetComponentType; 1] {
20792        Self::VARIANTS
20793    }
20794}
20795
20796impl Name for TxSetComponent {
20797    #[must_use]
20798    fn name(&self) -> &'static str {
20799        Self::name(self)
20800    }
20801}
20802
20803impl Discriminant<TxSetComponentType> for TxSetComponent {
20804    #[must_use]
20805    fn discriminant(&self) -> TxSetComponentType {
20806        Self::discriminant(self)
20807    }
20808}
20809
20810impl Variants<TxSetComponentType> for TxSetComponent {
20811    fn variants() -> slice::Iter<'static, TxSetComponentType> {
20812        Self::VARIANTS.iter()
20813    }
20814}
20815
20816impl Union<TxSetComponentType> for TxSetComponent {}
20817
20818impl ReadXdr for TxSetComponent {
20819    #[cfg(feature = "std")]
20820    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
20821        r.with_limited_depth(|r| {
20822            let dv: TxSetComponentType = <TxSetComponentType as ReadXdr>::read_xdr(r)?;
20823            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
20824            let v = match dv {
20825                TxSetComponentType::TxsetCompTxsMaybeDiscountedFee => {
20826                    Self::TxsetCompTxsMaybeDiscountedFee(
20827                        TxSetComponentTxsMaybeDiscountedFee::read_xdr(r)?,
20828                    )
20829                }
20830                #[allow(unreachable_patterns)]
20831                _ => return Err(Error::Invalid),
20832            };
20833            Ok(v)
20834        })
20835    }
20836}
20837
20838impl WriteXdr for TxSetComponent {
20839    #[cfg(feature = "std")]
20840    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
20841        w.with_limited_depth(|w| {
20842            self.discriminant().write_xdr(w)?;
20843            #[allow(clippy::match_same_arms)]
20844            match self {
20845                Self::TxsetCompTxsMaybeDiscountedFee(v) => v.write_xdr(w)?,
20846            };
20847            Ok(())
20848        })
20849    }
20850}
20851
20852/// TransactionPhase is an XDR Union defines as:
20853///
20854/// ```text
20855/// union TransactionPhase switch (int v)
20856/// {
20857/// case 0:
20858///     TxSetComponent v0Components<>;
20859/// case 1:
20860///     ParallelTxsComponent parallelTxsComponent;
20861/// };
20862/// ```
20863///
20864// union with discriminant i32
20865#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
20866#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
20867#[cfg_attr(
20868    all(feature = "serde", feature = "alloc"),
20869    derive(serde::Serialize, serde::Deserialize),
20870    serde(rename_all = "snake_case")
20871)]
20872#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
20873#[allow(clippy::large_enum_variant)]
20874pub enum TransactionPhase {
20875    V0(VecM<TxSetComponent>),
20876    V1(ParallelTxsComponent),
20877}
20878
20879impl TransactionPhase {
20880    pub const VARIANTS: [i32; 2] = [0, 1];
20881    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"];
20882
20883    #[must_use]
20884    pub const fn name(&self) -> &'static str {
20885        match self {
20886            Self::V0(_) => "V0",
20887            Self::V1(_) => "V1",
20888        }
20889    }
20890
20891    #[must_use]
20892    pub const fn discriminant(&self) -> i32 {
20893        #[allow(clippy::match_same_arms)]
20894        match self {
20895            Self::V0(_) => 0,
20896            Self::V1(_) => 1,
20897        }
20898    }
20899
20900    #[must_use]
20901    pub const fn variants() -> [i32; 2] {
20902        Self::VARIANTS
20903    }
20904}
20905
20906impl Name for TransactionPhase {
20907    #[must_use]
20908    fn name(&self) -> &'static str {
20909        Self::name(self)
20910    }
20911}
20912
20913impl Discriminant<i32> for TransactionPhase {
20914    #[must_use]
20915    fn discriminant(&self) -> i32 {
20916        Self::discriminant(self)
20917    }
20918}
20919
20920impl Variants<i32> for TransactionPhase {
20921    fn variants() -> slice::Iter<'static, i32> {
20922        Self::VARIANTS.iter()
20923    }
20924}
20925
20926impl Union<i32> for TransactionPhase {}
20927
20928impl ReadXdr for TransactionPhase {
20929    #[cfg(feature = "std")]
20930    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
20931        r.with_limited_depth(|r| {
20932            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
20933            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
20934            let v = match dv {
20935                0 => Self::V0(VecM::<TxSetComponent>::read_xdr(r)?),
20936                1 => Self::V1(ParallelTxsComponent::read_xdr(r)?),
20937                #[allow(unreachable_patterns)]
20938                _ => return Err(Error::Invalid),
20939            };
20940            Ok(v)
20941        })
20942    }
20943}
20944
20945impl WriteXdr for TransactionPhase {
20946    #[cfg(feature = "std")]
20947    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
20948        w.with_limited_depth(|w| {
20949            self.discriminant().write_xdr(w)?;
20950            #[allow(clippy::match_same_arms)]
20951            match self {
20952                Self::V0(v) => v.write_xdr(w)?,
20953                Self::V1(v) => v.write_xdr(w)?,
20954            };
20955            Ok(())
20956        })
20957    }
20958}
20959
20960/// TransactionSet is an XDR Struct defines as:
20961///
20962/// ```text
20963/// struct TransactionSet
20964/// {
20965///     Hash previousLedgerHash;
20966///     TransactionEnvelope txs<>;
20967/// };
20968/// ```
20969///
20970#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
20971#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
20972#[cfg_attr(
20973    all(feature = "serde", feature = "alloc"),
20974    derive(serde::Serialize, serde::Deserialize),
20975    serde(rename_all = "snake_case")
20976)]
20977#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
20978pub struct TransactionSet {
20979    pub previous_ledger_hash: Hash,
20980    pub txs: VecM<TransactionEnvelope>,
20981}
20982
20983impl ReadXdr for TransactionSet {
20984    #[cfg(feature = "std")]
20985    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
20986        r.with_limited_depth(|r| {
20987            Ok(Self {
20988                previous_ledger_hash: Hash::read_xdr(r)?,
20989                txs: VecM::<TransactionEnvelope>::read_xdr(r)?,
20990            })
20991        })
20992    }
20993}
20994
20995impl WriteXdr for TransactionSet {
20996    #[cfg(feature = "std")]
20997    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
20998        w.with_limited_depth(|w| {
20999            self.previous_ledger_hash.write_xdr(w)?;
21000            self.txs.write_xdr(w)?;
21001            Ok(())
21002        })
21003    }
21004}
21005
21006/// TransactionSetV1 is an XDR Struct defines as:
21007///
21008/// ```text
21009/// struct TransactionSetV1
21010/// {
21011///     Hash previousLedgerHash;
21012///     TransactionPhase phases<>;
21013/// };
21014/// ```
21015///
21016#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
21017#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
21018#[cfg_attr(
21019    all(feature = "serde", feature = "alloc"),
21020    derive(serde::Serialize, serde::Deserialize),
21021    serde(rename_all = "snake_case")
21022)]
21023#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
21024pub struct TransactionSetV1 {
21025    pub previous_ledger_hash: Hash,
21026    pub phases: VecM<TransactionPhase>,
21027}
21028
21029impl ReadXdr for TransactionSetV1 {
21030    #[cfg(feature = "std")]
21031    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
21032        r.with_limited_depth(|r| {
21033            Ok(Self {
21034                previous_ledger_hash: Hash::read_xdr(r)?,
21035                phases: VecM::<TransactionPhase>::read_xdr(r)?,
21036            })
21037        })
21038    }
21039}
21040
21041impl WriteXdr for TransactionSetV1 {
21042    #[cfg(feature = "std")]
21043    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
21044        w.with_limited_depth(|w| {
21045            self.previous_ledger_hash.write_xdr(w)?;
21046            self.phases.write_xdr(w)?;
21047            Ok(())
21048        })
21049    }
21050}
21051
21052/// GeneralizedTransactionSet is an XDR Union defines as:
21053///
21054/// ```text
21055/// union GeneralizedTransactionSet switch (int v)
21056/// {
21057/// // We consider the legacy TransactionSet to be v0.
21058/// case 1:
21059///     TransactionSetV1 v1TxSet;
21060/// };
21061/// ```
21062///
21063// union with discriminant i32
21064#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
21065#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
21066#[cfg_attr(
21067    all(feature = "serde", feature = "alloc"),
21068    derive(serde::Serialize, serde::Deserialize),
21069    serde(rename_all = "snake_case")
21070)]
21071#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
21072#[allow(clippy::large_enum_variant)]
21073pub enum GeneralizedTransactionSet {
21074    V1(TransactionSetV1),
21075}
21076
21077impl GeneralizedTransactionSet {
21078    pub const VARIANTS: [i32; 1] = [1];
21079    pub const VARIANTS_STR: [&'static str; 1] = ["V1"];
21080
21081    #[must_use]
21082    pub const fn name(&self) -> &'static str {
21083        match self {
21084            Self::V1(_) => "V1",
21085        }
21086    }
21087
21088    #[must_use]
21089    pub const fn discriminant(&self) -> i32 {
21090        #[allow(clippy::match_same_arms)]
21091        match self {
21092            Self::V1(_) => 1,
21093        }
21094    }
21095
21096    #[must_use]
21097    pub const fn variants() -> [i32; 1] {
21098        Self::VARIANTS
21099    }
21100}
21101
21102impl Name for GeneralizedTransactionSet {
21103    #[must_use]
21104    fn name(&self) -> &'static str {
21105        Self::name(self)
21106    }
21107}
21108
21109impl Discriminant<i32> for GeneralizedTransactionSet {
21110    #[must_use]
21111    fn discriminant(&self) -> i32 {
21112        Self::discriminant(self)
21113    }
21114}
21115
21116impl Variants<i32> for GeneralizedTransactionSet {
21117    fn variants() -> slice::Iter<'static, i32> {
21118        Self::VARIANTS.iter()
21119    }
21120}
21121
21122impl Union<i32> for GeneralizedTransactionSet {}
21123
21124impl ReadXdr for GeneralizedTransactionSet {
21125    #[cfg(feature = "std")]
21126    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
21127        r.with_limited_depth(|r| {
21128            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
21129            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
21130            let v = match dv {
21131                1 => Self::V1(TransactionSetV1::read_xdr(r)?),
21132                #[allow(unreachable_patterns)]
21133                _ => return Err(Error::Invalid),
21134            };
21135            Ok(v)
21136        })
21137    }
21138}
21139
21140impl WriteXdr for GeneralizedTransactionSet {
21141    #[cfg(feature = "std")]
21142    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
21143        w.with_limited_depth(|w| {
21144            self.discriminant().write_xdr(w)?;
21145            #[allow(clippy::match_same_arms)]
21146            match self {
21147                Self::V1(v) => v.write_xdr(w)?,
21148            };
21149            Ok(())
21150        })
21151    }
21152}
21153
21154/// TransactionResultPair is an XDR Struct defines as:
21155///
21156/// ```text
21157/// struct TransactionResultPair
21158/// {
21159///     Hash transactionHash;
21160///     TransactionResult result; // result for the transaction
21161/// };
21162/// ```
21163///
21164#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
21165#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
21166#[cfg_attr(
21167    all(feature = "serde", feature = "alloc"),
21168    derive(serde::Serialize, serde::Deserialize),
21169    serde(rename_all = "snake_case")
21170)]
21171#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
21172pub struct TransactionResultPair {
21173    pub transaction_hash: Hash,
21174    pub result: TransactionResult,
21175}
21176
21177impl ReadXdr for TransactionResultPair {
21178    #[cfg(feature = "std")]
21179    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
21180        r.with_limited_depth(|r| {
21181            Ok(Self {
21182                transaction_hash: Hash::read_xdr(r)?,
21183                result: TransactionResult::read_xdr(r)?,
21184            })
21185        })
21186    }
21187}
21188
21189impl WriteXdr for TransactionResultPair {
21190    #[cfg(feature = "std")]
21191    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
21192        w.with_limited_depth(|w| {
21193            self.transaction_hash.write_xdr(w)?;
21194            self.result.write_xdr(w)?;
21195            Ok(())
21196        })
21197    }
21198}
21199
21200/// TransactionResultSet is an XDR Struct defines as:
21201///
21202/// ```text
21203/// struct TransactionResultSet
21204/// {
21205///     TransactionResultPair results<>;
21206/// };
21207/// ```
21208///
21209#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
21210#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
21211#[cfg_attr(
21212    all(feature = "serde", feature = "alloc"),
21213    derive(serde::Serialize, serde::Deserialize),
21214    serde(rename_all = "snake_case")
21215)]
21216#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
21217pub struct TransactionResultSet {
21218    pub results: VecM<TransactionResultPair>,
21219}
21220
21221impl ReadXdr for TransactionResultSet {
21222    #[cfg(feature = "std")]
21223    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
21224        r.with_limited_depth(|r| {
21225            Ok(Self {
21226                results: VecM::<TransactionResultPair>::read_xdr(r)?,
21227            })
21228        })
21229    }
21230}
21231
21232impl WriteXdr for TransactionResultSet {
21233    #[cfg(feature = "std")]
21234    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
21235        w.with_limited_depth(|w| {
21236            self.results.write_xdr(w)?;
21237            Ok(())
21238        })
21239    }
21240}
21241
21242/// TransactionHistoryEntryExt is an XDR NestedUnion defines as:
21243///
21244/// ```text
21245/// union switch (int v)
21246///     {
21247///     case 0:
21248///         void;
21249///     case 1:
21250///         GeneralizedTransactionSet generalizedTxSet;
21251///     }
21252/// ```
21253///
21254// union with discriminant i32
21255#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
21256#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
21257#[cfg_attr(
21258    all(feature = "serde", feature = "alloc"),
21259    derive(serde::Serialize, serde::Deserialize),
21260    serde(rename_all = "snake_case")
21261)]
21262#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
21263#[allow(clippy::large_enum_variant)]
21264pub enum TransactionHistoryEntryExt {
21265    V0,
21266    V1(GeneralizedTransactionSet),
21267}
21268
21269impl TransactionHistoryEntryExt {
21270    pub const VARIANTS: [i32; 2] = [0, 1];
21271    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"];
21272
21273    #[must_use]
21274    pub const fn name(&self) -> &'static str {
21275        match self {
21276            Self::V0 => "V0",
21277            Self::V1(_) => "V1",
21278        }
21279    }
21280
21281    #[must_use]
21282    pub const fn discriminant(&self) -> i32 {
21283        #[allow(clippy::match_same_arms)]
21284        match self {
21285            Self::V0 => 0,
21286            Self::V1(_) => 1,
21287        }
21288    }
21289
21290    #[must_use]
21291    pub const fn variants() -> [i32; 2] {
21292        Self::VARIANTS
21293    }
21294}
21295
21296impl Name for TransactionHistoryEntryExt {
21297    #[must_use]
21298    fn name(&self) -> &'static str {
21299        Self::name(self)
21300    }
21301}
21302
21303impl Discriminant<i32> for TransactionHistoryEntryExt {
21304    #[must_use]
21305    fn discriminant(&self) -> i32 {
21306        Self::discriminant(self)
21307    }
21308}
21309
21310impl Variants<i32> for TransactionHistoryEntryExt {
21311    fn variants() -> slice::Iter<'static, i32> {
21312        Self::VARIANTS.iter()
21313    }
21314}
21315
21316impl Union<i32> for TransactionHistoryEntryExt {}
21317
21318impl ReadXdr for TransactionHistoryEntryExt {
21319    #[cfg(feature = "std")]
21320    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
21321        r.with_limited_depth(|r| {
21322            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
21323            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
21324            let v = match dv {
21325                0 => Self::V0,
21326                1 => Self::V1(GeneralizedTransactionSet::read_xdr(r)?),
21327                #[allow(unreachable_patterns)]
21328                _ => return Err(Error::Invalid),
21329            };
21330            Ok(v)
21331        })
21332    }
21333}
21334
21335impl WriteXdr for TransactionHistoryEntryExt {
21336    #[cfg(feature = "std")]
21337    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
21338        w.with_limited_depth(|w| {
21339            self.discriminant().write_xdr(w)?;
21340            #[allow(clippy::match_same_arms)]
21341            match self {
21342                Self::V0 => ().write_xdr(w)?,
21343                Self::V1(v) => v.write_xdr(w)?,
21344            };
21345            Ok(())
21346        })
21347    }
21348}
21349
21350/// TransactionHistoryEntry is an XDR Struct defines as:
21351///
21352/// ```text
21353/// struct TransactionHistoryEntry
21354/// {
21355///     uint32 ledgerSeq;
21356///     TransactionSet txSet;
21357///
21358///     // when v != 0, txSet must be empty
21359///     union switch (int v)
21360///     {
21361///     case 0:
21362///         void;
21363///     case 1:
21364///         GeneralizedTransactionSet generalizedTxSet;
21365///     }
21366///     ext;
21367/// };
21368/// ```
21369///
21370#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
21371#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
21372#[cfg_attr(
21373    all(feature = "serde", feature = "alloc"),
21374    derive(serde::Serialize, serde::Deserialize),
21375    serde(rename_all = "snake_case")
21376)]
21377#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
21378pub struct TransactionHistoryEntry {
21379    pub ledger_seq: u32,
21380    pub tx_set: TransactionSet,
21381    pub ext: TransactionHistoryEntryExt,
21382}
21383
21384impl ReadXdr for TransactionHistoryEntry {
21385    #[cfg(feature = "std")]
21386    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
21387        r.with_limited_depth(|r| {
21388            Ok(Self {
21389                ledger_seq: u32::read_xdr(r)?,
21390                tx_set: TransactionSet::read_xdr(r)?,
21391                ext: TransactionHistoryEntryExt::read_xdr(r)?,
21392            })
21393        })
21394    }
21395}
21396
21397impl WriteXdr for TransactionHistoryEntry {
21398    #[cfg(feature = "std")]
21399    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
21400        w.with_limited_depth(|w| {
21401            self.ledger_seq.write_xdr(w)?;
21402            self.tx_set.write_xdr(w)?;
21403            self.ext.write_xdr(w)?;
21404            Ok(())
21405        })
21406    }
21407}
21408
21409/// TransactionHistoryResultEntryExt is an XDR NestedUnion defines as:
21410///
21411/// ```text
21412/// union switch (int v)
21413///     {
21414///     case 0:
21415///         void;
21416///     }
21417/// ```
21418///
21419// union with discriminant i32
21420#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
21421#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
21422#[cfg_attr(
21423    all(feature = "serde", feature = "alloc"),
21424    derive(serde::Serialize, serde::Deserialize),
21425    serde(rename_all = "snake_case")
21426)]
21427#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
21428#[allow(clippy::large_enum_variant)]
21429pub enum TransactionHistoryResultEntryExt {
21430    V0,
21431}
21432
21433impl TransactionHistoryResultEntryExt {
21434    pub const VARIANTS: [i32; 1] = [0];
21435    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
21436
21437    #[must_use]
21438    pub const fn name(&self) -> &'static str {
21439        match self {
21440            Self::V0 => "V0",
21441        }
21442    }
21443
21444    #[must_use]
21445    pub const fn discriminant(&self) -> i32 {
21446        #[allow(clippy::match_same_arms)]
21447        match self {
21448            Self::V0 => 0,
21449        }
21450    }
21451
21452    #[must_use]
21453    pub const fn variants() -> [i32; 1] {
21454        Self::VARIANTS
21455    }
21456}
21457
21458impl Name for TransactionHistoryResultEntryExt {
21459    #[must_use]
21460    fn name(&self) -> &'static str {
21461        Self::name(self)
21462    }
21463}
21464
21465impl Discriminant<i32> for TransactionHistoryResultEntryExt {
21466    #[must_use]
21467    fn discriminant(&self) -> i32 {
21468        Self::discriminant(self)
21469    }
21470}
21471
21472impl Variants<i32> for TransactionHistoryResultEntryExt {
21473    fn variants() -> slice::Iter<'static, i32> {
21474        Self::VARIANTS.iter()
21475    }
21476}
21477
21478impl Union<i32> for TransactionHistoryResultEntryExt {}
21479
21480impl ReadXdr for TransactionHistoryResultEntryExt {
21481    #[cfg(feature = "std")]
21482    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
21483        r.with_limited_depth(|r| {
21484            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
21485            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
21486            let v = match dv {
21487                0 => Self::V0,
21488                #[allow(unreachable_patterns)]
21489                _ => return Err(Error::Invalid),
21490            };
21491            Ok(v)
21492        })
21493    }
21494}
21495
21496impl WriteXdr for TransactionHistoryResultEntryExt {
21497    #[cfg(feature = "std")]
21498    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
21499        w.with_limited_depth(|w| {
21500            self.discriminant().write_xdr(w)?;
21501            #[allow(clippy::match_same_arms)]
21502            match self {
21503                Self::V0 => ().write_xdr(w)?,
21504            };
21505            Ok(())
21506        })
21507    }
21508}
21509
21510/// TransactionHistoryResultEntry is an XDR Struct defines as:
21511///
21512/// ```text
21513/// struct TransactionHistoryResultEntry
21514/// {
21515///     uint32 ledgerSeq;
21516///     TransactionResultSet txResultSet;
21517///
21518///     // reserved for future use
21519///     union switch (int v)
21520///     {
21521///     case 0:
21522///         void;
21523///     }
21524///     ext;
21525/// };
21526/// ```
21527///
21528#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
21529#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
21530#[cfg_attr(
21531    all(feature = "serde", feature = "alloc"),
21532    derive(serde::Serialize, serde::Deserialize),
21533    serde(rename_all = "snake_case")
21534)]
21535#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
21536pub struct TransactionHistoryResultEntry {
21537    pub ledger_seq: u32,
21538    pub tx_result_set: TransactionResultSet,
21539    pub ext: TransactionHistoryResultEntryExt,
21540}
21541
21542impl ReadXdr for TransactionHistoryResultEntry {
21543    #[cfg(feature = "std")]
21544    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
21545        r.with_limited_depth(|r| {
21546            Ok(Self {
21547                ledger_seq: u32::read_xdr(r)?,
21548                tx_result_set: TransactionResultSet::read_xdr(r)?,
21549                ext: TransactionHistoryResultEntryExt::read_xdr(r)?,
21550            })
21551        })
21552    }
21553}
21554
21555impl WriteXdr for TransactionHistoryResultEntry {
21556    #[cfg(feature = "std")]
21557    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
21558        w.with_limited_depth(|w| {
21559            self.ledger_seq.write_xdr(w)?;
21560            self.tx_result_set.write_xdr(w)?;
21561            self.ext.write_xdr(w)?;
21562            Ok(())
21563        })
21564    }
21565}
21566
21567/// LedgerHeaderHistoryEntryExt is an XDR NestedUnion defines as:
21568///
21569/// ```text
21570/// union switch (int v)
21571///     {
21572///     case 0:
21573///         void;
21574///     }
21575/// ```
21576///
21577// union with discriminant i32
21578#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
21579#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
21580#[cfg_attr(
21581    all(feature = "serde", feature = "alloc"),
21582    derive(serde::Serialize, serde::Deserialize),
21583    serde(rename_all = "snake_case")
21584)]
21585#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
21586#[allow(clippy::large_enum_variant)]
21587pub enum LedgerHeaderHistoryEntryExt {
21588    V0,
21589}
21590
21591impl LedgerHeaderHistoryEntryExt {
21592    pub const VARIANTS: [i32; 1] = [0];
21593    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
21594
21595    #[must_use]
21596    pub const fn name(&self) -> &'static str {
21597        match self {
21598            Self::V0 => "V0",
21599        }
21600    }
21601
21602    #[must_use]
21603    pub const fn discriminant(&self) -> i32 {
21604        #[allow(clippy::match_same_arms)]
21605        match self {
21606            Self::V0 => 0,
21607        }
21608    }
21609
21610    #[must_use]
21611    pub const fn variants() -> [i32; 1] {
21612        Self::VARIANTS
21613    }
21614}
21615
21616impl Name for LedgerHeaderHistoryEntryExt {
21617    #[must_use]
21618    fn name(&self) -> &'static str {
21619        Self::name(self)
21620    }
21621}
21622
21623impl Discriminant<i32> for LedgerHeaderHistoryEntryExt {
21624    #[must_use]
21625    fn discriminant(&self) -> i32 {
21626        Self::discriminant(self)
21627    }
21628}
21629
21630impl Variants<i32> for LedgerHeaderHistoryEntryExt {
21631    fn variants() -> slice::Iter<'static, i32> {
21632        Self::VARIANTS.iter()
21633    }
21634}
21635
21636impl Union<i32> for LedgerHeaderHistoryEntryExt {}
21637
21638impl ReadXdr for LedgerHeaderHistoryEntryExt {
21639    #[cfg(feature = "std")]
21640    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
21641        r.with_limited_depth(|r| {
21642            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
21643            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
21644            let v = match dv {
21645                0 => Self::V0,
21646                #[allow(unreachable_patterns)]
21647                _ => return Err(Error::Invalid),
21648            };
21649            Ok(v)
21650        })
21651    }
21652}
21653
21654impl WriteXdr for LedgerHeaderHistoryEntryExt {
21655    #[cfg(feature = "std")]
21656    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
21657        w.with_limited_depth(|w| {
21658            self.discriminant().write_xdr(w)?;
21659            #[allow(clippy::match_same_arms)]
21660            match self {
21661                Self::V0 => ().write_xdr(w)?,
21662            };
21663            Ok(())
21664        })
21665    }
21666}
21667
21668/// LedgerHeaderHistoryEntry is an XDR Struct defines as:
21669///
21670/// ```text
21671/// struct LedgerHeaderHistoryEntry
21672/// {
21673///     Hash hash;
21674///     LedgerHeader header;
21675///
21676///     // reserved for future use
21677///     union switch (int v)
21678///     {
21679///     case 0:
21680///         void;
21681///     }
21682///     ext;
21683/// };
21684/// ```
21685///
21686#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
21687#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
21688#[cfg_attr(
21689    all(feature = "serde", feature = "alloc"),
21690    derive(serde::Serialize, serde::Deserialize),
21691    serde(rename_all = "snake_case")
21692)]
21693#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
21694pub struct LedgerHeaderHistoryEntry {
21695    pub hash: Hash,
21696    pub header: LedgerHeader,
21697    pub ext: LedgerHeaderHistoryEntryExt,
21698}
21699
21700impl ReadXdr for LedgerHeaderHistoryEntry {
21701    #[cfg(feature = "std")]
21702    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
21703        r.with_limited_depth(|r| {
21704            Ok(Self {
21705                hash: Hash::read_xdr(r)?,
21706                header: LedgerHeader::read_xdr(r)?,
21707                ext: LedgerHeaderHistoryEntryExt::read_xdr(r)?,
21708            })
21709        })
21710    }
21711}
21712
21713impl WriteXdr for LedgerHeaderHistoryEntry {
21714    #[cfg(feature = "std")]
21715    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
21716        w.with_limited_depth(|w| {
21717            self.hash.write_xdr(w)?;
21718            self.header.write_xdr(w)?;
21719            self.ext.write_xdr(w)?;
21720            Ok(())
21721        })
21722    }
21723}
21724
21725/// LedgerScpMessages is an XDR Struct defines as:
21726///
21727/// ```text
21728/// struct LedgerSCPMessages
21729/// {
21730///     uint32 ledgerSeq;
21731///     SCPEnvelope messages<>;
21732/// };
21733/// ```
21734///
21735#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
21736#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
21737#[cfg_attr(
21738    all(feature = "serde", feature = "alloc"),
21739    derive(serde::Serialize, serde::Deserialize),
21740    serde(rename_all = "snake_case")
21741)]
21742#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
21743pub struct LedgerScpMessages {
21744    pub ledger_seq: u32,
21745    pub messages: VecM<ScpEnvelope>,
21746}
21747
21748impl ReadXdr for LedgerScpMessages {
21749    #[cfg(feature = "std")]
21750    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
21751        r.with_limited_depth(|r| {
21752            Ok(Self {
21753                ledger_seq: u32::read_xdr(r)?,
21754                messages: VecM::<ScpEnvelope>::read_xdr(r)?,
21755            })
21756        })
21757    }
21758}
21759
21760impl WriteXdr for LedgerScpMessages {
21761    #[cfg(feature = "std")]
21762    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
21763        w.with_limited_depth(|w| {
21764            self.ledger_seq.write_xdr(w)?;
21765            self.messages.write_xdr(w)?;
21766            Ok(())
21767        })
21768    }
21769}
21770
21771/// ScpHistoryEntryV0 is an XDR Struct defines as:
21772///
21773/// ```text
21774/// struct SCPHistoryEntryV0
21775/// {
21776///     SCPQuorumSet quorumSets<>; // additional quorum sets used by ledgerMessages
21777///     LedgerSCPMessages ledgerMessages;
21778/// };
21779/// ```
21780///
21781#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
21782#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
21783#[cfg_attr(
21784    all(feature = "serde", feature = "alloc"),
21785    derive(serde::Serialize, serde::Deserialize),
21786    serde(rename_all = "snake_case")
21787)]
21788#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
21789pub struct ScpHistoryEntryV0 {
21790    pub quorum_sets: VecM<ScpQuorumSet>,
21791    pub ledger_messages: LedgerScpMessages,
21792}
21793
21794impl ReadXdr for ScpHistoryEntryV0 {
21795    #[cfg(feature = "std")]
21796    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
21797        r.with_limited_depth(|r| {
21798            Ok(Self {
21799                quorum_sets: VecM::<ScpQuorumSet>::read_xdr(r)?,
21800                ledger_messages: LedgerScpMessages::read_xdr(r)?,
21801            })
21802        })
21803    }
21804}
21805
21806impl WriteXdr for ScpHistoryEntryV0 {
21807    #[cfg(feature = "std")]
21808    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
21809        w.with_limited_depth(|w| {
21810            self.quorum_sets.write_xdr(w)?;
21811            self.ledger_messages.write_xdr(w)?;
21812            Ok(())
21813        })
21814    }
21815}
21816
21817/// ScpHistoryEntry is an XDR Union defines as:
21818///
21819/// ```text
21820/// union SCPHistoryEntry switch (int v)
21821/// {
21822/// case 0:
21823///     SCPHistoryEntryV0 v0;
21824/// };
21825/// ```
21826///
21827// union with discriminant i32
21828#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
21829#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
21830#[cfg_attr(
21831    all(feature = "serde", feature = "alloc"),
21832    derive(serde::Serialize, serde::Deserialize),
21833    serde(rename_all = "snake_case")
21834)]
21835#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
21836#[allow(clippy::large_enum_variant)]
21837pub enum ScpHistoryEntry {
21838    V0(ScpHistoryEntryV0),
21839}
21840
21841impl ScpHistoryEntry {
21842    pub const VARIANTS: [i32; 1] = [0];
21843    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
21844
21845    #[must_use]
21846    pub const fn name(&self) -> &'static str {
21847        match self {
21848            Self::V0(_) => "V0",
21849        }
21850    }
21851
21852    #[must_use]
21853    pub const fn discriminant(&self) -> i32 {
21854        #[allow(clippy::match_same_arms)]
21855        match self {
21856            Self::V0(_) => 0,
21857        }
21858    }
21859
21860    #[must_use]
21861    pub const fn variants() -> [i32; 1] {
21862        Self::VARIANTS
21863    }
21864}
21865
21866impl Name for ScpHistoryEntry {
21867    #[must_use]
21868    fn name(&self) -> &'static str {
21869        Self::name(self)
21870    }
21871}
21872
21873impl Discriminant<i32> for ScpHistoryEntry {
21874    #[must_use]
21875    fn discriminant(&self) -> i32 {
21876        Self::discriminant(self)
21877    }
21878}
21879
21880impl Variants<i32> for ScpHistoryEntry {
21881    fn variants() -> slice::Iter<'static, i32> {
21882        Self::VARIANTS.iter()
21883    }
21884}
21885
21886impl Union<i32> for ScpHistoryEntry {}
21887
21888impl ReadXdr for ScpHistoryEntry {
21889    #[cfg(feature = "std")]
21890    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
21891        r.with_limited_depth(|r| {
21892            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
21893            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
21894            let v = match dv {
21895                0 => Self::V0(ScpHistoryEntryV0::read_xdr(r)?),
21896                #[allow(unreachable_patterns)]
21897                _ => return Err(Error::Invalid),
21898            };
21899            Ok(v)
21900        })
21901    }
21902}
21903
21904impl WriteXdr for ScpHistoryEntry {
21905    #[cfg(feature = "std")]
21906    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
21907        w.with_limited_depth(|w| {
21908            self.discriminant().write_xdr(w)?;
21909            #[allow(clippy::match_same_arms)]
21910            match self {
21911                Self::V0(v) => v.write_xdr(w)?,
21912            };
21913            Ok(())
21914        })
21915    }
21916}
21917
21918/// LedgerEntryChangeType is an XDR Enum defines as:
21919///
21920/// ```text
21921/// enum LedgerEntryChangeType
21922/// {
21923///     LEDGER_ENTRY_CREATED  = 0, // entry was added to the ledger
21924///     LEDGER_ENTRY_UPDATED  = 1, // entry was modified in the ledger
21925///     LEDGER_ENTRY_REMOVED  = 2, // entry was removed from the ledger
21926///     LEDGER_ENTRY_STATE    = 3, // value of the entry
21927///     LEDGER_ENTRY_RESTORED = 4  // archived entry was restored in the ledger
21928/// };
21929/// ```
21930///
21931// enum
21932#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
21933#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
21934#[cfg_attr(
21935    all(feature = "serde", feature = "alloc"),
21936    derive(serde::Serialize, serde::Deserialize),
21937    serde(rename_all = "snake_case")
21938)]
21939#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
21940#[repr(i32)]
21941pub enum LedgerEntryChangeType {
21942    Created = 0,
21943    Updated = 1,
21944    Removed = 2,
21945    State = 3,
21946    Restored = 4,
21947}
21948
21949impl LedgerEntryChangeType {
21950    pub const VARIANTS: [LedgerEntryChangeType; 5] = [
21951        LedgerEntryChangeType::Created,
21952        LedgerEntryChangeType::Updated,
21953        LedgerEntryChangeType::Removed,
21954        LedgerEntryChangeType::State,
21955        LedgerEntryChangeType::Restored,
21956    ];
21957    pub const VARIANTS_STR: [&'static str; 5] =
21958        ["Created", "Updated", "Removed", "State", "Restored"];
21959
21960    #[must_use]
21961    pub const fn name(&self) -> &'static str {
21962        match self {
21963            Self::Created => "Created",
21964            Self::Updated => "Updated",
21965            Self::Removed => "Removed",
21966            Self::State => "State",
21967            Self::Restored => "Restored",
21968        }
21969    }
21970
21971    #[must_use]
21972    pub const fn variants() -> [LedgerEntryChangeType; 5] {
21973        Self::VARIANTS
21974    }
21975}
21976
21977impl Name for LedgerEntryChangeType {
21978    #[must_use]
21979    fn name(&self) -> &'static str {
21980        Self::name(self)
21981    }
21982}
21983
21984impl Variants<LedgerEntryChangeType> for LedgerEntryChangeType {
21985    fn variants() -> slice::Iter<'static, LedgerEntryChangeType> {
21986        Self::VARIANTS.iter()
21987    }
21988}
21989
21990impl Enum for LedgerEntryChangeType {}
21991
21992impl fmt::Display for LedgerEntryChangeType {
21993    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
21994        f.write_str(self.name())
21995    }
21996}
21997
21998impl TryFrom<i32> for LedgerEntryChangeType {
21999    type Error = Error;
22000
22001    fn try_from(i: i32) -> Result<Self> {
22002        let e = match i {
22003            0 => LedgerEntryChangeType::Created,
22004            1 => LedgerEntryChangeType::Updated,
22005            2 => LedgerEntryChangeType::Removed,
22006            3 => LedgerEntryChangeType::State,
22007            4 => LedgerEntryChangeType::Restored,
22008            #[allow(unreachable_patterns)]
22009            _ => return Err(Error::Invalid),
22010        };
22011        Ok(e)
22012    }
22013}
22014
22015impl From<LedgerEntryChangeType> for i32 {
22016    #[must_use]
22017    fn from(e: LedgerEntryChangeType) -> Self {
22018        e as Self
22019    }
22020}
22021
22022impl ReadXdr for LedgerEntryChangeType {
22023    #[cfg(feature = "std")]
22024    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
22025        r.with_limited_depth(|r| {
22026            let e = i32::read_xdr(r)?;
22027            let v: Self = e.try_into()?;
22028            Ok(v)
22029        })
22030    }
22031}
22032
22033impl WriteXdr for LedgerEntryChangeType {
22034    #[cfg(feature = "std")]
22035    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
22036        w.with_limited_depth(|w| {
22037            let i: i32 = (*self).into();
22038            i.write_xdr(w)
22039        })
22040    }
22041}
22042
22043/// LedgerEntryChange is an XDR Union defines as:
22044///
22045/// ```text
22046/// union LedgerEntryChange switch (LedgerEntryChangeType type)
22047/// {
22048/// case LEDGER_ENTRY_CREATED:
22049///     LedgerEntry created;
22050/// case LEDGER_ENTRY_UPDATED:
22051///     LedgerEntry updated;
22052/// case LEDGER_ENTRY_REMOVED:
22053///     LedgerKey removed;
22054/// case LEDGER_ENTRY_STATE:
22055///     LedgerEntry state;
22056/// case LEDGER_ENTRY_RESTORED:
22057///     LedgerEntry restored;
22058/// };
22059/// ```
22060///
22061// union with discriminant LedgerEntryChangeType
22062#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
22063#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
22064#[cfg_attr(
22065    all(feature = "serde", feature = "alloc"),
22066    derive(serde::Serialize, serde::Deserialize),
22067    serde(rename_all = "snake_case")
22068)]
22069#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
22070#[allow(clippy::large_enum_variant)]
22071pub enum LedgerEntryChange {
22072    Created(LedgerEntry),
22073    Updated(LedgerEntry),
22074    Removed(LedgerKey),
22075    State(LedgerEntry),
22076    Restored(LedgerEntry),
22077}
22078
22079impl LedgerEntryChange {
22080    pub const VARIANTS: [LedgerEntryChangeType; 5] = [
22081        LedgerEntryChangeType::Created,
22082        LedgerEntryChangeType::Updated,
22083        LedgerEntryChangeType::Removed,
22084        LedgerEntryChangeType::State,
22085        LedgerEntryChangeType::Restored,
22086    ];
22087    pub const VARIANTS_STR: [&'static str; 5] =
22088        ["Created", "Updated", "Removed", "State", "Restored"];
22089
22090    #[must_use]
22091    pub const fn name(&self) -> &'static str {
22092        match self {
22093            Self::Created(_) => "Created",
22094            Self::Updated(_) => "Updated",
22095            Self::Removed(_) => "Removed",
22096            Self::State(_) => "State",
22097            Self::Restored(_) => "Restored",
22098        }
22099    }
22100
22101    #[must_use]
22102    pub const fn discriminant(&self) -> LedgerEntryChangeType {
22103        #[allow(clippy::match_same_arms)]
22104        match self {
22105            Self::Created(_) => LedgerEntryChangeType::Created,
22106            Self::Updated(_) => LedgerEntryChangeType::Updated,
22107            Self::Removed(_) => LedgerEntryChangeType::Removed,
22108            Self::State(_) => LedgerEntryChangeType::State,
22109            Self::Restored(_) => LedgerEntryChangeType::Restored,
22110        }
22111    }
22112
22113    #[must_use]
22114    pub const fn variants() -> [LedgerEntryChangeType; 5] {
22115        Self::VARIANTS
22116    }
22117}
22118
22119impl Name for LedgerEntryChange {
22120    #[must_use]
22121    fn name(&self) -> &'static str {
22122        Self::name(self)
22123    }
22124}
22125
22126impl Discriminant<LedgerEntryChangeType> for LedgerEntryChange {
22127    #[must_use]
22128    fn discriminant(&self) -> LedgerEntryChangeType {
22129        Self::discriminant(self)
22130    }
22131}
22132
22133impl Variants<LedgerEntryChangeType> for LedgerEntryChange {
22134    fn variants() -> slice::Iter<'static, LedgerEntryChangeType> {
22135        Self::VARIANTS.iter()
22136    }
22137}
22138
22139impl Union<LedgerEntryChangeType> for LedgerEntryChange {}
22140
22141impl ReadXdr for LedgerEntryChange {
22142    #[cfg(feature = "std")]
22143    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
22144        r.with_limited_depth(|r| {
22145            let dv: LedgerEntryChangeType = <LedgerEntryChangeType as ReadXdr>::read_xdr(r)?;
22146            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
22147            let v = match dv {
22148                LedgerEntryChangeType::Created => Self::Created(LedgerEntry::read_xdr(r)?),
22149                LedgerEntryChangeType::Updated => Self::Updated(LedgerEntry::read_xdr(r)?),
22150                LedgerEntryChangeType::Removed => Self::Removed(LedgerKey::read_xdr(r)?),
22151                LedgerEntryChangeType::State => Self::State(LedgerEntry::read_xdr(r)?),
22152                LedgerEntryChangeType::Restored => Self::Restored(LedgerEntry::read_xdr(r)?),
22153                #[allow(unreachable_patterns)]
22154                _ => return Err(Error::Invalid),
22155            };
22156            Ok(v)
22157        })
22158    }
22159}
22160
22161impl WriteXdr for LedgerEntryChange {
22162    #[cfg(feature = "std")]
22163    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
22164        w.with_limited_depth(|w| {
22165            self.discriminant().write_xdr(w)?;
22166            #[allow(clippy::match_same_arms)]
22167            match self {
22168                Self::Created(v) => v.write_xdr(w)?,
22169                Self::Updated(v) => v.write_xdr(w)?,
22170                Self::Removed(v) => v.write_xdr(w)?,
22171                Self::State(v) => v.write_xdr(w)?,
22172                Self::Restored(v) => v.write_xdr(w)?,
22173            };
22174            Ok(())
22175        })
22176    }
22177}
22178
22179/// LedgerEntryChanges is an XDR Typedef defines as:
22180///
22181/// ```text
22182/// typedef LedgerEntryChange LedgerEntryChanges<>;
22183/// ```
22184///
22185#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
22186#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
22187#[derive(Default)]
22188#[cfg_attr(
22189    all(feature = "serde", feature = "alloc"),
22190    derive(serde::Serialize, serde::Deserialize),
22191    serde(rename_all = "snake_case")
22192)]
22193#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
22194#[derive(Debug)]
22195pub struct LedgerEntryChanges(pub VecM<LedgerEntryChange>);
22196
22197impl From<LedgerEntryChanges> for VecM<LedgerEntryChange> {
22198    #[must_use]
22199    fn from(x: LedgerEntryChanges) -> Self {
22200        x.0
22201    }
22202}
22203
22204impl From<VecM<LedgerEntryChange>> for LedgerEntryChanges {
22205    #[must_use]
22206    fn from(x: VecM<LedgerEntryChange>) -> Self {
22207        LedgerEntryChanges(x)
22208    }
22209}
22210
22211impl AsRef<VecM<LedgerEntryChange>> for LedgerEntryChanges {
22212    #[must_use]
22213    fn as_ref(&self) -> &VecM<LedgerEntryChange> {
22214        &self.0
22215    }
22216}
22217
22218impl ReadXdr for LedgerEntryChanges {
22219    #[cfg(feature = "std")]
22220    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
22221        r.with_limited_depth(|r| {
22222            let i = VecM::<LedgerEntryChange>::read_xdr(r)?;
22223            let v = LedgerEntryChanges(i);
22224            Ok(v)
22225        })
22226    }
22227}
22228
22229impl WriteXdr for LedgerEntryChanges {
22230    #[cfg(feature = "std")]
22231    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
22232        w.with_limited_depth(|w| self.0.write_xdr(w))
22233    }
22234}
22235
22236impl Deref for LedgerEntryChanges {
22237    type Target = VecM<LedgerEntryChange>;
22238    fn deref(&self) -> &Self::Target {
22239        &self.0
22240    }
22241}
22242
22243impl From<LedgerEntryChanges> for Vec<LedgerEntryChange> {
22244    #[must_use]
22245    fn from(x: LedgerEntryChanges) -> Self {
22246        x.0 .0
22247    }
22248}
22249
22250impl TryFrom<Vec<LedgerEntryChange>> for LedgerEntryChanges {
22251    type Error = Error;
22252    fn try_from(x: Vec<LedgerEntryChange>) -> Result<Self> {
22253        Ok(LedgerEntryChanges(x.try_into()?))
22254    }
22255}
22256
22257#[cfg(feature = "alloc")]
22258impl TryFrom<&Vec<LedgerEntryChange>> for LedgerEntryChanges {
22259    type Error = Error;
22260    fn try_from(x: &Vec<LedgerEntryChange>) -> Result<Self> {
22261        Ok(LedgerEntryChanges(x.try_into()?))
22262    }
22263}
22264
22265impl AsRef<Vec<LedgerEntryChange>> for LedgerEntryChanges {
22266    #[must_use]
22267    fn as_ref(&self) -> &Vec<LedgerEntryChange> {
22268        &self.0 .0
22269    }
22270}
22271
22272impl AsRef<[LedgerEntryChange]> for LedgerEntryChanges {
22273    #[cfg(feature = "alloc")]
22274    #[must_use]
22275    fn as_ref(&self) -> &[LedgerEntryChange] {
22276        &self.0 .0
22277    }
22278    #[cfg(not(feature = "alloc"))]
22279    #[must_use]
22280    fn as_ref(&self) -> &[LedgerEntryChange] {
22281        self.0 .0
22282    }
22283}
22284
22285/// OperationMeta is an XDR Struct defines as:
22286///
22287/// ```text
22288/// struct OperationMeta
22289/// {
22290///     LedgerEntryChanges changes;
22291/// };
22292/// ```
22293///
22294#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
22295#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
22296#[cfg_attr(
22297    all(feature = "serde", feature = "alloc"),
22298    derive(serde::Serialize, serde::Deserialize),
22299    serde(rename_all = "snake_case")
22300)]
22301#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
22302pub struct OperationMeta {
22303    pub changes: LedgerEntryChanges,
22304}
22305
22306impl ReadXdr for OperationMeta {
22307    #[cfg(feature = "std")]
22308    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
22309        r.with_limited_depth(|r| {
22310            Ok(Self {
22311                changes: LedgerEntryChanges::read_xdr(r)?,
22312            })
22313        })
22314    }
22315}
22316
22317impl WriteXdr for OperationMeta {
22318    #[cfg(feature = "std")]
22319    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
22320        w.with_limited_depth(|w| {
22321            self.changes.write_xdr(w)?;
22322            Ok(())
22323        })
22324    }
22325}
22326
22327/// TransactionMetaV1 is an XDR Struct defines as:
22328///
22329/// ```text
22330/// struct TransactionMetaV1
22331/// {
22332///     LedgerEntryChanges txChanges; // tx level changes if any
22333///     OperationMeta operations<>;   // meta for each operation
22334/// };
22335/// ```
22336///
22337#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
22338#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
22339#[cfg_attr(
22340    all(feature = "serde", feature = "alloc"),
22341    derive(serde::Serialize, serde::Deserialize),
22342    serde(rename_all = "snake_case")
22343)]
22344#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
22345pub struct TransactionMetaV1 {
22346    pub tx_changes: LedgerEntryChanges,
22347    pub operations: VecM<OperationMeta>,
22348}
22349
22350impl ReadXdr for TransactionMetaV1 {
22351    #[cfg(feature = "std")]
22352    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
22353        r.with_limited_depth(|r| {
22354            Ok(Self {
22355                tx_changes: LedgerEntryChanges::read_xdr(r)?,
22356                operations: VecM::<OperationMeta>::read_xdr(r)?,
22357            })
22358        })
22359    }
22360}
22361
22362impl WriteXdr for TransactionMetaV1 {
22363    #[cfg(feature = "std")]
22364    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
22365        w.with_limited_depth(|w| {
22366            self.tx_changes.write_xdr(w)?;
22367            self.operations.write_xdr(w)?;
22368            Ok(())
22369        })
22370    }
22371}
22372
22373/// TransactionMetaV2 is an XDR Struct defines as:
22374///
22375/// ```text
22376/// struct TransactionMetaV2
22377/// {
22378///     LedgerEntryChanges txChangesBefore; // tx level changes before operations
22379///                                         // are applied if any
22380///     OperationMeta operations<>;         // meta for each operation
22381///     LedgerEntryChanges txChangesAfter;  // tx level changes after operations are
22382///                                         // applied if any
22383/// };
22384/// ```
22385///
22386#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
22387#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
22388#[cfg_attr(
22389    all(feature = "serde", feature = "alloc"),
22390    derive(serde::Serialize, serde::Deserialize),
22391    serde(rename_all = "snake_case")
22392)]
22393#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
22394pub struct TransactionMetaV2 {
22395    pub tx_changes_before: LedgerEntryChanges,
22396    pub operations: VecM<OperationMeta>,
22397    pub tx_changes_after: LedgerEntryChanges,
22398}
22399
22400impl ReadXdr for TransactionMetaV2 {
22401    #[cfg(feature = "std")]
22402    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
22403        r.with_limited_depth(|r| {
22404            Ok(Self {
22405                tx_changes_before: LedgerEntryChanges::read_xdr(r)?,
22406                operations: VecM::<OperationMeta>::read_xdr(r)?,
22407                tx_changes_after: LedgerEntryChanges::read_xdr(r)?,
22408            })
22409        })
22410    }
22411}
22412
22413impl WriteXdr for TransactionMetaV2 {
22414    #[cfg(feature = "std")]
22415    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
22416        w.with_limited_depth(|w| {
22417            self.tx_changes_before.write_xdr(w)?;
22418            self.operations.write_xdr(w)?;
22419            self.tx_changes_after.write_xdr(w)?;
22420            Ok(())
22421        })
22422    }
22423}
22424
22425/// ContractEventType is an XDR Enum defines as:
22426///
22427/// ```text
22428/// enum ContractEventType
22429/// {
22430///     SYSTEM = 0,
22431///     CONTRACT = 1,
22432///     DIAGNOSTIC = 2
22433/// };
22434/// ```
22435///
22436// enum
22437#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
22438#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
22439#[cfg_attr(
22440    all(feature = "serde", feature = "alloc"),
22441    derive(serde::Serialize, serde::Deserialize),
22442    serde(rename_all = "snake_case")
22443)]
22444#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
22445#[repr(i32)]
22446pub enum ContractEventType {
22447    System = 0,
22448    Contract = 1,
22449    Diagnostic = 2,
22450}
22451
22452impl ContractEventType {
22453    pub const VARIANTS: [ContractEventType; 3] = [
22454        ContractEventType::System,
22455        ContractEventType::Contract,
22456        ContractEventType::Diagnostic,
22457    ];
22458    pub const VARIANTS_STR: [&'static str; 3] = ["System", "Contract", "Diagnostic"];
22459
22460    #[must_use]
22461    pub const fn name(&self) -> &'static str {
22462        match self {
22463            Self::System => "System",
22464            Self::Contract => "Contract",
22465            Self::Diagnostic => "Diagnostic",
22466        }
22467    }
22468
22469    #[must_use]
22470    pub const fn variants() -> [ContractEventType; 3] {
22471        Self::VARIANTS
22472    }
22473}
22474
22475impl Name for ContractEventType {
22476    #[must_use]
22477    fn name(&self) -> &'static str {
22478        Self::name(self)
22479    }
22480}
22481
22482impl Variants<ContractEventType> for ContractEventType {
22483    fn variants() -> slice::Iter<'static, ContractEventType> {
22484        Self::VARIANTS.iter()
22485    }
22486}
22487
22488impl Enum for ContractEventType {}
22489
22490impl fmt::Display for ContractEventType {
22491    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
22492        f.write_str(self.name())
22493    }
22494}
22495
22496impl TryFrom<i32> for ContractEventType {
22497    type Error = Error;
22498
22499    fn try_from(i: i32) -> Result<Self> {
22500        let e = match i {
22501            0 => ContractEventType::System,
22502            1 => ContractEventType::Contract,
22503            2 => ContractEventType::Diagnostic,
22504            #[allow(unreachable_patterns)]
22505            _ => return Err(Error::Invalid),
22506        };
22507        Ok(e)
22508    }
22509}
22510
22511impl From<ContractEventType> for i32 {
22512    #[must_use]
22513    fn from(e: ContractEventType) -> Self {
22514        e as Self
22515    }
22516}
22517
22518impl ReadXdr for ContractEventType {
22519    #[cfg(feature = "std")]
22520    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
22521        r.with_limited_depth(|r| {
22522            let e = i32::read_xdr(r)?;
22523            let v: Self = e.try_into()?;
22524            Ok(v)
22525        })
22526    }
22527}
22528
22529impl WriteXdr for ContractEventType {
22530    #[cfg(feature = "std")]
22531    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
22532        w.with_limited_depth(|w| {
22533            let i: i32 = (*self).into();
22534            i.write_xdr(w)
22535        })
22536    }
22537}
22538
22539/// ContractEventV0 is an XDR NestedStruct defines as:
22540///
22541/// ```text
22542/// struct
22543///         {
22544///             SCVal topics<>;
22545///             SCVal data;
22546///         }
22547/// ```
22548///
22549#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
22550#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
22551#[cfg_attr(
22552    all(feature = "serde", feature = "alloc"),
22553    derive(serde::Serialize, serde::Deserialize),
22554    serde(rename_all = "snake_case")
22555)]
22556#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
22557pub struct ContractEventV0 {
22558    pub topics: VecM<ScVal>,
22559    pub data: ScVal,
22560}
22561
22562impl ReadXdr for ContractEventV0 {
22563    #[cfg(feature = "std")]
22564    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
22565        r.with_limited_depth(|r| {
22566            Ok(Self {
22567                topics: VecM::<ScVal>::read_xdr(r)?,
22568                data: ScVal::read_xdr(r)?,
22569            })
22570        })
22571    }
22572}
22573
22574impl WriteXdr for ContractEventV0 {
22575    #[cfg(feature = "std")]
22576    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
22577        w.with_limited_depth(|w| {
22578            self.topics.write_xdr(w)?;
22579            self.data.write_xdr(w)?;
22580            Ok(())
22581        })
22582    }
22583}
22584
22585/// ContractEventBody is an XDR NestedUnion defines as:
22586///
22587/// ```text
22588/// union switch (int v)
22589///     {
22590///     case 0:
22591///         struct
22592///         {
22593///             SCVal topics<>;
22594///             SCVal data;
22595///         } v0;
22596///     }
22597/// ```
22598///
22599// union with discriminant i32
22600#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
22601#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
22602#[cfg_attr(
22603    all(feature = "serde", feature = "alloc"),
22604    derive(serde::Serialize, serde::Deserialize),
22605    serde(rename_all = "snake_case")
22606)]
22607#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
22608#[allow(clippy::large_enum_variant)]
22609pub enum ContractEventBody {
22610    V0(ContractEventV0),
22611}
22612
22613impl ContractEventBody {
22614    pub const VARIANTS: [i32; 1] = [0];
22615    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
22616
22617    #[must_use]
22618    pub const fn name(&self) -> &'static str {
22619        match self {
22620            Self::V0(_) => "V0",
22621        }
22622    }
22623
22624    #[must_use]
22625    pub const fn discriminant(&self) -> i32 {
22626        #[allow(clippy::match_same_arms)]
22627        match self {
22628            Self::V0(_) => 0,
22629        }
22630    }
22631
22632    #[must_use]
22633    pub const fn variants() -> [i32; 1] {
22634        Self::VARIANTS
22635    }
22636}
22637
22638impl Name for ContractEventBody {
22639    #[must_use]
22640    fn name(&self) -> &'static str {
22641        Self::name(self)
22642    }
22643}
22644
22645impl Discriminant<i32> for ContractEventBody {
22646    #[must_use]
22647    fn discriminant(&self) -> i32 {
22648        Self::discriminant(self)
22649    }
22650}
22651
22652impl Variants<i32> for ContractEventBody {
22653    fn variants() -> slice::Iter<'static, i32> {
22654        Self::VARIANTS.iter()
22655    }
22656}
22657
22658impl Union<i32> for ContractEventBody {}
22659
22660impl ReadXdr for ContractEventBody {
22661    #[cfg(feature = "std")]
22662    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
22663        r.with_limited_depth(|r| {
22664            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
22665            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
22666            let v = match dv {
22667                0 => Self::V0(ContractEventV0::read_xdr(r)?),
22668                #[allow(unreachable_patterns)]
22669                _ => return Err(Error::Invalid),
22670            };
22671            Ok(v)
22672        })
22673    }
22674}
22675
22676impl WriteXdr for ContractEventBody {
22677    #[cfg(feature = "std")]
22678    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
22679        w.with_limited_depth(|w| {
22680            self.discriminant().write_xdr(w)?;
22681            #[allow(clippy::match_same_arms)]
22682            match self {
22683                Self::V0(v) => v.write_xdr(w)?,
22684            };
22685            Ok(())
22686        })
22687    }
22688}
22689
22690/// ContractEvent is an XDR Struct defines as:
22691///
22692/// ```text
22693/// struct ContractEvent
22694/// {
22695///     // We can use this to add more fields, or because it
22696///     // is first, to change ContractEvent into a union.
22697///     ExtensionPoint ext;
22698///
22699///     Hash* contractID;
22700///     ContractEventType type;
22701///
22702///     union switch (int v)
22703///     {
22704///     case 0:
22705///         struct
22706///         {
22707///             SCVal topics<>;
22708///             SCVal data;
22709///         } v0;
22710///     }
22711///     body;
22712/// };
22713/// ```
22714///
22715#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
22716#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
22717#[cfg_attr(
22718    all(feature = "serde", feature = "alloc"),
22719    derive(serde::Serialize, serde::Deserialize),
22720    serde(rename_all = "snake_case")
22721)]
22722#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
22723pub struct ContractEvent {
22724    pub ext: ExtensionPoint,
22725    pub contract_id: Option<Hash>,
22726    pub type_: ContractEventType,
22727    pub body: ContractEventBody,
22728}
22729
22730impl ReadXdr for ContractEvent {
22731    #[cfg(feature = "std")]
22732    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
22733        r.with_limited_depth(|r| {
22734            Ok(Self {
22735                ext: ExtensionPoint::read_xdr(r)?,
22736                contract_id: Option::<Hash>::read_xdr(r)?,
22737                type_: ContractEventType::read_xdr(r)?,
22738                body: ContractEventBody::read_xdr(r)?,
22739            })
22740        })
22741    }
22742}
22743
22744impl WriteXdr for ContractEvent {
22745    #[cfg(feature = "std")]
22746    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
22747        w.with_limited_depth(|w| {
22748            self.ext.write_xdr(w)?;
22749            self.contract_id.write_xdr(w)?;
22750            self.type_.write_xdr(w)?;
22751            self.body.write_xdr(w)?;
22752            Ok(())
22753        })
22754    }
22755}
22756
22757/// DiagnosticEvent is an XDR Struct defines as:
22758///
22759/// ```text
22760/// struct DiagnosticEvent
22761/// {
22762///     bool inSuccessfulContractCall;
22763///     ContractEvent event;
22764/// };
22765/// ```
22766///
22767#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
22768#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
22769#[cfg_attr(
22770    all(feature = "serde", feature = "alloc"),
22771    derive(serde::Serialize, serde::Deserialize),
22772    serde(rename_all = "snake_case")
22773)]
22774#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
22775pub struct DiagnosticEvent {
22776    pub in_successful_contract_call: bool,
22777    pub event: ContractEvent,
22778}
22779
22780impl ReadXdr for DiagnosticEvent {
22781    #[cfg(feature = "std")]
22782    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
22783        r.with_limited_depth(|r| {
22784            Ok(Self {
22785                in_successful_contract_call: bool::read_xdr(r)?,
22786                event: ContractEvent::read_xdr(r)?,
22787            })
22788        })
22789    }
22790}
22791
22792impl WriteXdr for DiagnosticEvent {
22793    #[cfg(feature = "std")]
22794    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
22795        w.with_limited_depth(|w| {
22796            self.in_successful_contract_call.write_xdr(w)?;
22797            self.event.write_xdr(w)?;
22798            Ok(())
22799        })
22800    }
22801}
22802
22803/// SorobanTransactionMetaExtV1 is an XDR Struct defines as:
22804///
22805/// ```text
22806/// struct SorobanTransactionMetaExtV1
22807/// {
22808///     ExtensionPoint ext;
22809///
22810///     // The following are the components of the overall Soroban resource fee
22811///     // charged for the transaction.
22812///     // The following relation holds:
22813///     // `resourceFeeCharged = totalNonRefundableResourceFeeCharged + totalRefundableResourceFeeCharged`
22814///     // where `resourceFeeCharged` is the overall fee charged for the
22815///     // transaction. Also, `resourceFeeCharged` <= `sorobanData.resourceFee`
22816///     // i.e.we never charge more than the declared resource fee.
22817///     // The inclusion fee for charged the Soroban transaction can be found using
22818///     // the following equation:
22819///     // `result.feeCharged = resourceFeeCharged + inclusionFeeCharged`.
22820///
22821///     // Total amount (in stroops) that has been charged for non-refundable
22822///     // Soroban resources.
22823///     // Non-refundable resources are charged based on the usage declared in
22824///     // the transaction envelope (such as `instructions`, `readBytes` etc.) and
22825///     // is charged regardless of the success of the transaction.
22826///     int64 totalNonRefundableResourceFeeCharged;
22827///     // Total amount (in stroops) that has been charged for refundable
22828///     // Soroban resource fees.
22829///     // Currently this comprises the rent fee (`rentFeeCharged`) and the
22830///     // fee for the events and return value.
22831///     // Refundable resources are charged based on the actual resources usage.
22832///     // Since currently refundable resources are only used for the successful
22833///     // transactions, this will be `0` for failed transactions.
22834///     int64 totalRefundableResourceFeeCharged;
22835///     // Amount (in stroops) that has been charged for rent.
22836///     // This is a part of `totalNonRefundableResourceFeeCharged`.
22837///     int64 rentFeeCharged;
22838/// };
22839/// ```
22840///
22841#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
22842#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
22843#[cfg_attr(
22844    all(feature = "serde", feature = "alloc"),
22845    derive(serde::Serialize, serde::Deserialize),
22846    serde(rename_all = "snake_case")
22847)]
22848#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
22849pub struct SorobanTransactionMetaExtV1 {
22850    pub ext: ExtensionPoint,
22851    pub total_non_refundable_resource_fee_charged: i64,
22852    pub total_refundable_resource_fee_charged: i64,
22853    pub rent_fee_charged: i64,
22854}
22855
22856impl ReadXdr for SorobanTransactionMetaExtV1 {
22857    #[cfg(feature = "std")]
22858    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
22859        r.with_limited_depth(|r| {
22860            Ok(Self {
22861                ext: ExtensionPoint::read_xdr(r)?,
22862                total_non_refundable_resource_fee_charged: i64::read_xdr(r)?,
22863                total_refundable_resource_fee_charged: i64::read_xdr(r)?,
22864                rent_fee_charged: i64::read_xdr(r)?,
22865            })
22866        })
22867    }
22868}
22869
22870impl WriteXdr for SorobanTransactionMetaExtV1 {
22871    #[cfg(feature = "std")]
22872    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
22873        w.with_limited_depth(|w| {
22874            self.ext.write_xdr(w)?;
22875            self.total_non_refundable_resource_fee_charged
22876                .write_xdr(w)?;
22877            self.total_refundable_resource_fee_charged.write_xdr(w)?;
22878            self.rent_fee_charged.write_xdr(w)?;
22879            Ok(())
22880        })
22881    }
22882}
22883
22884/// SorobanTransactionMetaExt is an XDR Union defines as:
22885///
22886/// ```text
22887/// union SorobanTransactionMetaExt switch (int v)
22888/// {
22889/// case 0:
22890///     void;
22891/// case 1:
22892///     SorobanTransactionMetaExtV1 v1;
22893/// };
22894/// ```
22895///
22896// union with discriminant i32
22897#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
22898#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
22899#[cfg_attr(
22900    all(feature = "serde", feature = "alloc"),
22901    derive(serde::Serialize, serde::Deserialize),
22902    serde(rename_all = "snake_case")
22903)]
22904#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
22905#[allow(clippy::large_enum_variant)]
22906pub enum SorobanTransactionMetaExt {
22907    V0,
22908    V1(SorobanTransactionMetaExtV1),
22909}
22910
22911impl SorobanTransactionMetaExt {
22912    pub const VARIANTS: [i32; 2] = [0, 1];
22913    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"];
22914
22915    #[must_use]
22916    pub const fn name(&self) -> &'static str {
22917        match self {
22918            Self::V0 => "V0",
22919            Self::V1(_) => "V1",
22920        }
22921    }
22922
22923    #[must_use]
22924    pub const fn discriminant(&self) -> i32 {
22925        #[allow(clippy::match_same_arms)]
22926        match self {
22927            Self::V0 => 0,
22928            Self::V1(_) => 1,
22929        }
22930    }
22931
22932    #[must_use]
22933    pub const fn variants() -> [i32; 2] {
22934        Self::VARIANTS
22935    }
22936}
22937
22938impl Name for SorobanTransactionMetaExt {
22939    #[must_use]
22940    fn name(&self) -> &'static str {
22941        Self::name(self)
22942    }
22943}
22944
22945impl Discriminant<i32> for SorobanTransactionMetaExt {
22946    #[must_use]
22947    fn discriminant(&self) -> i32 {
22948        Self::discriminant(self)
22949    }
22950}
22951
22952impl Variants<i32> for SorobanTransactionMetaExt {
22953    fn variants() -> slice::Iter<'static, i32> {
22954        Self::VARIANTS.iter()
22955    }
22956}
22957
22958impl Union<i32> for SorobanTransactionMetaExt {}
22959
22960impl ReadXdr for SorobanTransactionMetaExt {
22961    #[cfg(feature = "std")]
22962    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
22963        r.with_limited_depth(|r| {
22964            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
22965            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
22966            let v = match dv {
22967                0 => Self::V0,
22968                1 => Self::V1(SorobanTransactionMetaExtV1::read_xdr(r)?),
22969                #[allow(unreachable_patterns)]
22970                _ => return Err(Error::Invalid),
22971            };
22972            Ok(v)
22973        })
22974    }
22975}
22976
22977impl WriteXdr for SorobanTransactionMetaExt {
22978    #[cfg(feature = "std")]
22979    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
22980        w.with_limited_depth(|w| {
22981            self.discriminant().write_xdr(w)?;
22982            #[allow(clippy::match_same_arms)]
22983            match self {
22984                Self::V0 => ().write_xdr(w)?,
22985                Self::V1(v) => v.write_xdr(w)?,
22986            };
22987            Ok(())
22988        })
22989    }
22990}
22991
22992/// SorobanTransactionMeta is an XDR Struct defines as:
22993///
22994/// ```text
22995/// struct SorobanTransactionMeta
22996/// {
22997///     SorobanTransactionMetaExt ext;
22998///
22999///     ContractEvent events<>;             // custom events populated by the
23000///                                         // contracts themselves.
23001///     SCVal returnValue;                  // return value of the host fn invocation
23002///
23003///     // Diagnostics events that are not hashed.
23004///     // This will contain all contract and diagnostic events. Even ones
23005///     // that were emitted in a failed contract call.
23006///     DiagnosticEvent diagnosticEvents<>;
23007/// };
23008/// ```
23009///
23010#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
23011#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
23012#[cfg_attr(
23013    all(feature = "serde", feature = "alloc"),
23014    derive(serde::Serialize, serde::Deserialize),
23015    serde(rename_all = "snake_case")
23016)]
23017#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
23018pub struct SorobanTransactionMeta {
23019    pub ext: SorobanTransactionMetaExt,
23020    pub events: VecM<ContractEvent>,
23021    pub return_value: ScVal,
23022    pub diagnostic_events: VecM<DiagnosticEvent>,
23023}
23024
23025impl ReadXdr for SorobanTransactionMeta {
23026    #[cfg(feature = "std")]
23027    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
23028        r.with_limited_depth(|r| {
23029            Ok(Self {
23030                ext: SorobanTransactionMetaExt::read_xdr(r)?,
23031                events: VecM::<ContractEvent>::read_xdr(r)?,
23032                return_value: ScVal::read_xdr(r)?,
23033                diagnostic_events: VecM::<DiagnosticEvent>::read_xdr(r)?,
23034            })
23035        })
23036    }
23037}
23038
23039impl WriteXdr for SorobanTransactionMeta {
23040    #[cfg(feature = "std")]
23041    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
23042        w.with_limited_depth(|w| {
23043            self.ext.write_xdr(w)?;
23044            self.events.write_xdr(w)?;
23045            self.return_value.write_xdr(w)?;
23046            self.diagnostic_events.write_xdr(w)?;
23047            Ok(())
23048        })
23049    }
23050}
23051
23052/// TransactionMetaV3 is an XDR Struct defines as:
23053///
23054/// ```text
23055/// struct TransactionMetaV3
23056/// {
23057///     ExtensionPoint ext;
23058///
23059///     LedgerEntryChanges txChangesBefore;  // tx level changes before operations
23060///                                          // are applied if any
23061///     OperationMeta operations<>;          // meta for each operation
23062///     LedgerEntryChanges txChangesAfter;   // tx level changes after operations are
23063///                                          // applied if any
23064///     SorobanTransactionMeta* sorobanMeta; // Soroban-specific meta (only for
23065///                                          // Soroban transactions).
23066/// };
23067/// ```
23068///
23069#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
23070#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
23071#[cfg_attr(
23072    all(feature = "serde", feature = "alloc"),
23073    derive(serde::Serialize, serde::Deserialize),
23074    serde(rename_all = "snake_case")
23075)]
23076#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
23077pub struct TransactionMetaV3 {
23078    pub ext: ExtensionPoint,
23079    pub tx_changes_before: LedgerEntryChanges,
23080    pub operations: VecM<OperationMeta>,
23081    pub tx_changes_after: LedgerEntryChanges,
23082    pub soroban_meta: Option<SorobanTransactionMeta>,
23083}
23084
23085impl ReadXdr for TransactionMetaV3 {
23086    #[cfg(feature = "std")]
23087    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
23088        r.with_limited_depth(|r| {
23089            Ok(Self {
23090                ext: ExtensionPoint::read_xdr(r)?,
23091                tx_changes_before: LedgerEntryChanges::read_xdr(r)?,
23092                operations: VecM::<OperationMeta>::read_xdr(r)?,
23093                tx_changes_after: LedgerEntryChanges::read_xdr(r)?,
23094                soroban_meta: Option::<SorobanTransactionMeta>::read_xdr(r)?,
23095            })
23096        })
23097    }
23098}
23099
23100impl WriteXdr for TransactionMetaV3 {
23101    #[cfg(feature = "std")]
23102    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
23103        w.with_limited_depth(|w| {
23104            self.ext.write_xdr(w)?;
23105            self.tx_changes_before.write_xdr(w)?;
23106            self.operations.write_xdr(w)?;
23107            self.tx_changes_after.write_xdr(w)?;
23108            self.soroban_meta.write_xdr(w)?;
23109            Ok(())
23110        })
23111    }
23112}
23113
23114/// InvokeHostFunctionSuccessPreImage is an XDR Struct defines as:
23115///
23116/// ```text
23117/// struct InvokeHostFunctionSuccessPreImage
23118/// {
23119///     SCVal returnValue;
23120///     ContractEvent events<>;
23121/// };
23122/// ```
23123///
23124#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
23125#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
23126#[cfg_attr(
23127    all(feature = "serde", feature = "alloc"),
23128    derive(serde::Serialize, serde::Deserialize),
23129    serde(rename_all = "snake_case")
23130)]
23131#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
23132pub struct InvokeHostFunctionSuccessPreImage {
23133    pub return_value: ScVal,
23134    pub events: VecM<ContractEvent>,
23135}
23136
23137impl ReadXdr for InvokeHostFunctionSuccessPreImage {
23138    #[cfg(feature = "std")]
23139    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
23140        r.with_limited_depth(|r| {
23141            Ok(Self {
23142                return_value: ScVal::read_xdr(r)?,
23143                events: VecM::<ContractEvent>::read_xdr(r)?,
23144            })
23145        })
23146    }
23147}
23148
23149impl WriteXdr for InvokeHostFunctionSuccessPreImage {
23150    #[cfg(feature = "std")]
23151    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
23152        w.with_limited_depth(|w| {
23153            self.return_value.write_xdr(w)?;
23154            self.events.write_xdr(w)?;
23155            Ok(())
23156        })
23157    }
23158}
23159
23160/// TransactionMeta is an XDR Union defines as:
23161///
23162/// ```text
23163/// union TransactionMeta switch (int v)
23164/// {
23165/// case 0:
23166///     OperationMeta operations<>;
23167/// case 1:
23168///     TransactionMetaV1 v1;
23169/// case 2:
23170///     TransactionMetaV2 v2;
23171/// case 3:
23172///     TransactionMetaV3 v3;
23173/// };
23174/// ```
23175///
23176// union with discriminant i32
23177#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
23178#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
23179#[cfg_attr(
23180    all(feature = "serde", feature = "alloc"),
23181    derive(serde::Serialize, serde::Deserialize),
23182    serde(rename_all = "snake_case")
23183)]
23184#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
23185#[allow(clippy::large_enum_variant)]
23186pub enum TransactionMeta {
23187    V0(VecM<OperationMeta>),
23188    V1(TransactionMetaV1),
23189    V2(TransactionMetaV2),
23190    V3(TransactionMetaV3),
23191}
23192
23193impl TransactionMeta {
23194    pub const VARIANTS: [i32; 4] = [0, 1, 2, 3];
23195    pub const VARIANTS_STR: [&'static str; 4] = ["V0", "V1", "V2", "V3"];
23196
23197    #[must_use]
23198    pub const fn name(&self) -> &'static str {
23199        match self {
23200            Self::V0(_) => "V0",
23201            Self::V1(_) => "V1",
23202            Self::V2(_) => "V2",
23203            Self::V3(_) => "V3",
23204        }
23205    }
23206
23207    #[must_use]
23208    pub const fn discriminant(&self) -> i32 {
23209        #[allow(clippy::match_same_arms)]
23210        match self {
23211            Self::V0(_) => 0,
23212            Self::V1(_) => 1,
23213            Self::V2(_) => 2,
23214            Self::V3(_) => 3,
23215        }
23216    }
23217
23218    #[must_use]
23219    pub const fn variants() -> [i32; 4] {
23220        Self::VARIANTS
23221    }
23222}
23223
23224impl Name for TransactionMeta {
23225    #[must_use]
23226    fn name(&self) -> &'static str {
23227        Self::name(self)
23228    }
23229}
23230
23231impl Discriminant<i32> for TransactionMeta {
23232    #[must_use]
23233    fn discriminant(&self) -> i32 {
23234        Self::discriminant(self)
23235    }
23236}
23237
23238impl Variants<i32> for TransactionMeta {
23239    fn variants() -> slice::Iter<'static, i32> {
23240        Self::VARIANTS.iter()
23241    }
23242}
23243
23244impl Union<i32> for TransactionMeta {}
23245
23246impl ReadXdr for TransactionMeta {
23247    #[cfg(feature = "std")]
23248    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
23249        r.with_limited_depth(|r| {
23250            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
23251            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
23252            let v = match dv {
23253                0 => Self::V0(VecM::<OperationMeta>::read_xdr(r)?),
23254                1 => Self::V1(TransactionMetaV1::read_xdr(r)?),
23255                2 => Self::V2(TransactionMetaV2::read_xdr(r)?),
23256                3 => Self::V3(TransactionMetaV3::read_xdr(r)?),
23257                #[allow(unreachable_patterns)]
23258                _ => return Err(Error::Invalid),
23259            };
23260            Ok(v)
23261        })
23262    }
23263}
23264
23265impl WriteXdr for TransactionMeta {
23266    #[cfg(feature = "std")]
23267    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
23268        w.with_limited_depth(|w| {
23269            self.discriminant().write_xdr(w)?;
23270            #[allow(clippy::match_same_arms)]
23271            match self {
23272                Self::V0(v) => v.write_xdr(w)?,
23273                Self::V1(v) => v.write_xdr(w)?,
23274                Self::V2(v) => v.write_xdr(w)?,
23275                Self::V3(v) => v.write_xdr(w)?,
23276            };
23277            Ok(())
23278        })
23279    }
23280}
23281
23282/// TransactionResultMeta is an XDR Struct defines as:
23283///
23284/// ```text
23285/// struct TransactionResultMeta
23286/// {
23287///     TransactionResultPair result;
23288///     LedgerEntryChanges feeProcessing;
23289///     TransactionMeta txApplyProcessing;
23290/// };
23291/// ```
23292///
23293#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
23294#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
23295#[cfg_attr(
23296    all(feature = "serde", feature = "alloc"),
23297    derive(serde::Serialize, serde::Deserialize),
23298    serde(rename_all = "snake_case")
23299)]
23300#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
23301pub struct TransactionResultMeta {
23302    pub result: TransactionResultPair,
23303    pub fee_processing: LedgerEntryChanges,
23304    pub tx_apply_processing: TransactionMeta,
23305}
23306
23307impl ReadXdr for TransactionResultMeta {
23308    #[cfg(feature = "std")]
23309    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
23310        r.with_limited_depth(|r| {
23311            Ok(Self {
23312                result: TransactionResultPair::read_xdr(r)?,
23313                fee_processing: LedgerEntryChanges::read_xdr(r)?,
23314                tx_apply_processing: TransactionMeta::read_xdr(r)?,
23315            })
23316        })
23317    }
23318}
23319
23320impl WriteXdr for TransactionResultMeta {
23321    #[cfg(feature = "std")]
23322    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
23323        w.with_limited_depth(|w| {
23324            self.result.write_xdr(w)?;
23325            self.fee_processing.write_xdr(w)?;
23326            self.tx_apply_processing.write_xdr(w)?;
23327            Ok(())
23328        })
23329    }
23330}
23331
23332/// UpgradeEntryMeta is an XDR Struct defines as:
23333///
23334/// ```text
23335/// struct UpgradeEntryMeta
23336/// {
23337///     LedgerUpgrade upgrade;
23338///     LedgerEntryChanges changes;
23339/// };
23340/// ```
23341///
23342#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
23343#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
23344#[cfg_attr(
23345    all(feature = "serde", feature = "alloc"),
23346    derive(serde::Serialize, serde::Deserialize),
23347    serde(rename_all = "snake_case")
23348)]
23349#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
23350pub struct UpgradeEntryMeta {
23351    pub upgrade: LedgerUpgrade,
23352    pub changes: LedgerEntryChanges,
23353}
23354
23355impl ReadXdr for UpgradeEntryMeta {
23356    #[cfg(feature = "std")]
23357    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
23358        r.with_limited_depth(|r| {
23359            Ok(Self {
23360                upgrade: LedgerUpgrade::read_xdr(r)?,
23361                changes: LedgerEntryChanges::read_xdr(r)?,
23362            })
23363        })
23364    }
23365}
23366
23367impl WriteXdr for UpgradeEntryMeta {
23368    #[cfg(feature = "std")]
23369    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
23370        w.with_limited_depth(|w| {
23371            self.upgrade.write_xdr(w)?;
23372            self.changes.write_xdr(w)?;
23373            Ok(())
23374        })
23375    }
23376}
23377
23378/// LedgerCloseMetaV0 is an XDR Struct defines as:
23379///
23380/// ```text
23381/// struct LedgerCloseMetaV0
23382/// {
23383///     LedgerHeaderHistoryEntry ledgerHeader;
23384///     // NB: txSet is sorted in "Hash order"
23385///     TransactionSet txSet;
23386///
23387///     // NB: transactions are sorted in apply order here
23388///     // fees for all transactions are processed first
23389///     // followed by applying transactions
23390///     TransactionResultMeta txProcessing<>;
23391///
23392///     // upgrades are applied last
23393///     UpgradeEntryMeta upgradesProcessing<>;
23394///
23395///     // other misc information attached to the ledger close
23396///     SCPHistoryEntry scpInfo<>;
23397/// };
23398/// ```
23399///
23400#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
23401#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
23402#[cfg_attr(
23403    all(feature = "serde", feature = "alloc"),
23404    derive(serde::Serialize, serde::Deserialize),
23405    serde(rename_all = "snake_case")
23406)]
23407#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
23408pub struct LedgerCloseMetaV0 {
23409    pub ledger_header: LedgerHeaderHistoryEntry,
23410    pub tx_set: TransactionSet,
23411    pub tx_processing: VecM<TransactionResultMeta>,
23412    pub upgrades_processing: VecM<UpgradeEntryMeta>,
23413    pub scp_info: VecM<ScpHistoryEntry>,
23414}
23415
23416impl ReadXdr for LedgerCloseMetaV0 {
23417    #[cfg(feature = "std")]
23418    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
23419        r.with_limited_depth(|r| {
23420            Ok(Self {
23421                ledger_header: LedgerHeaderHistoryEntry::read_xdr(r)?,
23422                tx_set: TransactionSet::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            })
23427        })
23428    }
23429}
23430
23431impl WriteXdr for LedgerCloseMetaV0 {
23432    #[cfg(feature = "std")]
23433    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
23434        w.with_limited_depth(|w| {
23435            self.ledger_header.write_xdr(w)?;
23436            self.tx_set.write_xdr(w)?;
23437            self.tx_processing.write_xdr(w)?;
23438            self.upgrades_processing.write_xdr(w)?;
23439            self.scp_info.write_xdr(w)?;
23440            Ok(())
23441        })
23442    }
23443}
23444
23445/// LedgerCloseMetaExtV1 is an XDR Struct defines as:
23446///
23447/// ```text
23448/// struct LedgerCloseMetaExtV1
23449/// {
23450///     ExtensionPoint ext;
23451///     int64 sorobanFeeWrite1KB;
23452/// };
23453/// ```
23454///
23455#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
23456#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
23457#[cfg_attr(
23458    all(feature = "serde", feature = "alloc"),
23459    derive(serde::Serialize, serde::Deserialize),
23460    serde(rename_all = "snake_case")
23461)]
23462#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
23463pub struct LedgerCloseMetaExtV1 {
23464    pub ext: ExtensionPoint,
23465    pub soroban_fee_write1_kb: i64,
23466}
23467
23468impl ReadXdr for LedgerCloseMetaExtV1 {
23469    #[cfg(feature = "std")]
23470    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
23471        r.with_limited_depth(|r| {
23472            Ok(Self {
23473                ext: ExtensionPoint::read_xdr(r)?,
23474                soroban_fee_write1_kb: i64::read_xdr(r)?,
23475            })
23476        })
23477    }
23478}
23479
23480impl WriteXdr for LedgerCloseMetaExtV1 {
23481    #[cfg(feature = "std")]
23482    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
23483        w.with_limited_depth(|w| {
23484            self.ext.write_xdr(w)?;
23485            self.soroban_fee_write1_kb.write_xdr(w)?;
23486            Ok(())
23487        })
23488    }
23489}
23490
23491/// LedgerCloseMetaExtV2 is an XDR Struct defines as:
23492///
23493/// ```text
23494/// struct LedgerCloseMetaExtV2
23495/// {
23496///     ExtensionPoint ext;
23497///     int64 sorobanFeeWrite1KB;
23498///
23499///     uint32 currentArchivalEpoch;
23500///
23501///     // The last epoch currently stored by validators
23502///     // Any entry restored from an epoch older than this will
23503///     // require a proof.
23504///     uint32 lastArchivalEpochPersisted;
23505/// };
23506/// ```
23507///
23508#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
23509#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
23510#[cfg_attr(
23511    all(feature = "serde", feature = "alloc"),
23512    derive(serde::Serialize, serde::Deserialize),
23513    serde(rename_all = "snake_case")
23514)]
23515#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
23516pub struct LedgerCloseMetaExtV2 {
23517    pub ext: ExtensionPoint,
23518    pub soroban_fee_write1_kb: i64,
23519    pub current_archival_epoch: u32,
23520    pub last_archival_epoch_persisted: u32,
23521}
23522
23523impl ReadXdr for LedgerCloseMetaExtV2 {
23524    #[cfg(feature = "std")]
23525    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
23526        r.with_limited_depth(|r| {
23527            Ok(Self {
23528                ext: ExtensionPoint::read_xdr(r)?,
23529                soroban_fee_write1_kb: i64::read_xdr(r)?,
23530                current_archival_epoch: u32::read_xdr(r)?,
23531                last_archival_epoch_persisted: u32::read_xdr(r)?,
23532            })
23533        })
23534    }
23535}
23536
23537impl WriteXdr for LedgerCloseMetaExtV2 {
23538    #[cfg(feature = "std")]
23539    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
23540        w.with_limited_depth(|w| {
23541            self.ext.write_xdr(w)?;
23542            self.soroban_fee_write1_kb.write_xdr(w)?;
23543            self.current_archival_epoch.write_xdr(w)?;
23544            self.last_archival_epoch_persisted.write_xdr(w)?;
23545            Ok(())
23546        })
23547    }
23548}
23549
23550/// LedgerCloseMetaExt is an XDR Union defines as:
23551///
23552/// ```text
23553/// union LedgerCloseMetaExt switch (int v)
23554/// {
23555/// case 0:
23556///     void;
23557/// case 1:
23558///     LedgerCloseMetaExtV1 v1;
23559/// case 2:
23560///     LedgerCloseMetaExtV2 v2;
23561/// };
23562/// ```
23563///
23564// union with discriminant i32
23565#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
23566#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
23567#[cfg_attr(
23568    all(feature = "serde", feature = "alloc"),
23569    derive(serde::Serialize, serde::Deserialize),
23570    serde(rename_all = "snake_case")
23571)]
23572#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
23573#[allow(clippy::large_enum_variant)]
23574pub enum LedgerCloseMetaExt {
23575    V0,
23576    V1(LedgerCloseMetaExtV1),
23577    V2(LedgerCloseMetaExtV2),
23578}
23579
23580impl LedgerCloseMetaExt {
23581    pub const VARIANTS: [i32; 3] = [0, 1, 2];
23582    pub const VARIANTS_STR: [&'static str; 3] = ["V0", "V1", "V2"];
23583
23584    #[must_use]
23585    pub const fn name(&self) -> &'static str {
23586        match self {
23587            Self::V0 => "V0",
23588            Self::V1(_) => "V1",
23589            Self::V2(_) => "V2",
23590        }
23591    }
23592
23593    #[must_use]
23594    pub const fn discriminant(&self) -> i32 {
23595        #[allow(clippy::match_same_arms)]
23596        match self {
23597            Self::V0 => 0,
23598            Self::V1(_) => 1,
23599            Self::V2(_) => 2,
23600        }
23601    }
23602
23603    #[must_use]
23604    pub const fn variants() -> [i32; 3] {
23605        Self::VARIANTS
23606    }
23607}
23608
23609impl Name for LedgerCloseMetaExt {
23610    #[must_use]
23611    fn name(&self) -> &'static str {
23612        Self::name(self)
23613    }
23614}
23615
23616impl Discriminant<i32> for LedgerCloseMetaExt {
23617    #[must_use]
23618    fn discriminant(&self) -> i32 {
23619        Self::discriminant(self)
23620    }
23621}
23622
23623impl Variants<i32> for LedgerCloseMetaExt {
23624    fn variants() -> slice::Iter<'static, i32> {
23625        Self::VARIANTS.iter()
23626    }
23627}
23628
23629impl Union<i32> for LedgerCloseMetaExt {}
23630
23631impl ReadXdr for LedgerCloseMetaExt {
23632    #[cfg(feature = "std")]
23633    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
23634        r.with_limited_depth(|r| {
23635            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
23636            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
23637            let v = match dv {
23638                0 => Self::V0,
23639                1 => Self::V1(LedgerCloseMetaExtV1::read_xdr(r)?),
23640                2 => Self::V2(LedgerCloseMetaExtV2::read_xdr(r)?),
23641                #[allow(unreachable_patterns)]
23642                _ => return Err(Error::Invalid),
23643            };
23644            Ok(v)
23645        })
23646    }
23647}
23648
23649impl WriteXdr for LedgerCloseMetaExt {
23650    #[cfg(feature = "std")]
23651    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
23652        w.with_limited_depth(|w| {
23653            self.discriminant().write_xdr(w)?;
23654            #[allow(clippy::match_same_arms)]
23655            match self {
23656                Self::V0 => ().write_xdr(w)?,
23657                Self::V1(v) => v.write_xdr(w)?,
23658                Self::V2(v) => v.write_xdr(w)?,
23659            };
23660            Ok(())
23661        })
23662    }
23663}
23664
23665/// LedgerCloseMetaV1 is an XDR Struct defines as:
23666///
23667/// ```text
23668/// struct LedgerCloseMetaV1
23669/// {
23670///     LedgerCloseMetaExt ext;
23671///
23672///     LedgerHeaderHistoryEntry ledgerHeader;
23673///
23674///     GeneralizedTransactionSet txSet;
23675///
23676///     // NB: transactions are sorted in apply order here
23677///     // fees for all transactions are processed first
23678///     // followed by applying transactions
23679///     TransactionResultMeta txProcessing<>;
23680///
23681///     // upgrades are applied last
23682///     UpgradeEntryMeta upgradesProcessing<>;
23683///
23684///     // other misc information attached to the ledger close
23685///     SCPHistoryEntry scpInfo<>;
23686///
23687///     // Size in bytes of BucketList, to support downstream
23688///     // systems calculating storage fees correctly.
23689///     uint64 totalByteSizeOfBucketList;
23690///
23691///     // Temp keys and all TTL keys that are being evicted at this ledger.
23692///     // Note that this can contain TTL keys for both persistent and temporary
23693///     // entries, but the name is kept for legacy reasons.
23694///     LedgerKey evictedTemporaryLedgerKeys<>;
23695///
23696///     // Archived persistent ledger entries that are being
23697///     // evicted at this ledger.
23698///     LedgerEntry evictedPersistentLedgerEntries<>;
23699/// };
23700/// ```
23701///
23702#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
23703#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
23704#[cfg_attr(
23705    all(feature = "serde", feature = "alloc"),
23706    derive(serde::Serialize, serde::Deserialize),
23707    serde(rename_all = "snake_case")
23708)]
23709#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
23710pub struct LedgerCloseMetaV1 {
23711    pub ext: LedgerCloseMetaExt,
23712    pub ledger_header: LedgerHeaderHistoryEntry,
23713    pub tx_set: GeneralizedTransactionSet,
23714    pub tx_processing: VecM<TransactionResultMeta>,
23715    pub upgrades_processing: VecM<UpgradeEntryMeta>,
23716    pub scp_info: VecM<ScpHistoryEntry>,
23717    pub total_byte_size_of_bucket_list: u64,
23718    pub evicted_temporary_ledger_keys: VecM<LedgerKey>,
23719    pub evicted_persistent_ledger_entries: VecM<LedgerEntry>,
23720}
23721
23722impl ReadXdr for LedgerCloseMetaV1 {
23723    #[cfg(feature = "std")]
23724    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
23725        r.with_limited_depth(|r| {
23726            Ok(Self {
23727                ext: LedgerCloseMetaExt::read_xdr(r)?,
23728                ledger_header: LedgerHeaderHistoryEntry::read_xdr(r)?,
23729                tx_set: GeneralizedTransactionSet::read_xdr(r)?,
23730                tx_processing: VecM::<TransactionResultMeta>::read_xdr(r)?,
23731                upgrades_processing: VecM::<UpgradeEntryMeta>::read_xdr(r)?,
23732                scp_info: VecM::<ScpHistoryEntry>::read_xdr(r)?,
23733                total_byte_size_of_bucket_list: u64::read_xdr(r)?,
23734                evicted_temporary_ledger_keys: VecM::<LedgerKey>::read_xdr(r)?,
23735                evicted_persistent_ledger_entries: VecM::<LedgerEntry>::read_xdr(r)?,
23736            })
23737        })
23738    }
23739}
23740
23741impl WriteXdr for LedgerCloseMetaV1 {
23742    #[cfg(feature = "std")]
23743    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
23744        w.with_limited_depth(|w| {
23745            self.ext.write_xdr(w)?;
23746            self.ledger_header.write_xdr(w)?;
23747            self.tx_set.write_xdr(w)?;
23748            self.tx_processing.write_xdr(w)?;
23749            self.upgrades_processing.write_xdr(w)?;
23750            self.scp_info.write_xdr(w)?;
23751            self.total_byte_size_of_bucket_list.write_xdr(w)?;
23752            self.evicted_temporary_ledger_keys.write_xdr(w)?;
23753            self.evicted_persistent_ledger_entries.write_xdr(w)?;
23754            Ok(())
23755        })
23756    }
23757}
23758
23759/// LedgerCloseMeta is an XDR Union defines as:
23760///
23761/// ```text
23762/// union LedgerCloseMeta switch (int v)
23763/// {
23764/// case 0:
23765///     LedgerCloseMetaV0 v0;
23766/// case 1:
23767///     LedgerCloseMetaV1 v1;
23768/// };
23769/// ```
23770///
23771// union with discriminant i32
23772#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
23773#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
23774#[cfg_attr(
23775    all(feature = "serde", feature = "alloc"),
23776    derive(serde::Serialize, serde::Deserialize),
23777    serde(rename_all = "snake_case")
23778)]
23779#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
23780#[allow(clippy::large_enum_variant)]
23781pub enum LedgerCloseMeta {
23782    V0(LedgerCloseMetaV0),
23783    V1(LedgerCloseMetaV1),
23784}
23785
23786impl LedgerCloseMeta {
23787    pub const VARIANTS: [i32; 2] = [0, 1];
23788    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"];
23789
23790    #[must_use]
23791    pub const fn name(&self) -> &'static str {
23792        match self {
23793            Self::V0(_) => "V0",
23794            Self::V1(_) => "V1",
23795        }
23796    }
23797
23798    #[must_use]
23799    pub const fn discriminant(&self) -> i32 {
23800        #[allow(clippy::match_same_arms)]
23801        match self {
23802            Self::V0(_) => 0,
23803            Self::V1(_) => 1,
23804        }
23805    }
23806
23807    #[must_use]
23808    pub const fn variants() -> [i32; 2] {
23809        Self::VARIANTS
23810    }
23811}
23812
23813impl Name for LedgerCloseMeta {
23814    #[must_use]
23815    fn name(&self) -> &'static str {
23816        Self::name(self)
23817    }
23818}
23819
23820impl Discriminant<i32> for LedgerCloseMeta {
23821    #[must_use]
23822    fn discriminant(&self) -> i32 {
23823        Self::discriminant(self)
23824    }
23825}
23826
23827impl Variants<i32> for LedgerCloseMeta {
23828    fn variants() -> slice::Iter<'static, i32> {
23829        Self::VARIANTS.iter()
23830    }
23831}
23832
23833impl Union<i32> for LedgerCloseMeta {}
23834
23835impl ReadXdr for LedgerCloseMeta {
23836    #[cfg(feature = "std")]
23837    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
23838        r.with_limited_depth(|r| {
23839            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
23840            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
23841            let v = match dv {
23842                0 => Self::V0(LedgerCloseMetaV0::read_xdr(r)?),
23843                1 => Self::V1(LedgerCloseMetaV1::read_xdr(r)?),
23844                #[allow(unreachable_patterns)]
23845                _ => return Err(Error::Invalid),
23846            };
23847            Ok(v)
23848        })
23849    }
23850}
23851
23852impl WriteXdr for LedgerCloseMeta {
23853    #[cfg(feature = "std")]
23854    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
23855        w.with_limited_depth(|w| {
23856            self.discriminant().write_xdr(w)?;
23857            #[allow(clippy::match_same_arms)]
23858            match self {
23859                Self::V0(v) => v.write_xdr(w)?,
23860                Self::V1(v) => v.write_xdr(w)?,
23861            };
23862            Ok(())
23863        })
23864    }
23865}
23866
23867/// ErrorCode is an XDR Enum defines as:
23868///
23869/// ```text
23870/// enum ErrorCode
23871/// {
23872///     ERR_MISC = 0, // Unspecific error
23873///     ERR_DATA = 1, // Malformed data
23874///     ERR_CONF = 2, // Misconfiguration error
23875///     ERR_AUTH = 3, // Authentication failure
23876///     ERR_LOAD = 4  // System overloaded
23877/// };
23878/// ```
23879///
23880// enum
23881#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
23882#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
23883#[cfg_attr(
23884    all(feature = "serde", feature = "alloc"),
23885    derive(serde::Serialize, serde::Deserialize),
23886    serde(rename_all = "snake_case")
23887)]
23888#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
23889#[repr(i32)]
23890pub enum ErrorCode {
23891    Misc = 0,
23892    Data = 1,
23893    Conf = 2,
23894    Auth = 3,
23895    Load = 4,
23896}
23897
23898impl ErrorCode {
23899    pub const VARIANTS: [ErrorCode; 5] = [
23900        ErrorCode::Misc,
23901        ErrorCode::Data,
23902        ErrorCode::Conf,
23903        ErrorCode::Auth,
23904        ErrorCode::Load,
23905    ];
23906    pub const VARIANTS_STR: [&'static str; 5] = ["Misc", "Data", "Conf", "Auth", "Load"];
23907
23908    #[must_use]
23909    pub const fn name(&self) -> &'static str {
23910        match self {
23911            Self::Misc => "Misc",
23912            Self::Data => "Data",
23913            Self::Conf => "Conf",
23914            Self::Auth => "Auth",
23915            Self::Load => "Load",
23916        }
23917    }
23918
23919    #[must_use]
23920    pub const fn variants() -> [ErrorCode; 5] {
23921        Self::VARIANTS
23922    }
23923}
23924
23925impl Name for ErrorCode {
23926    #[must_use]
23927    fn name(&self) -> &'static str {
23928        Self::name(self)
23929    }
23930}
23931
23932impl Variants<ErrorCode> for ErrorCode {
23933    fn variants() -> slice::Iter<'static, ErrorCode> {
23934        Self::VARIANTS.iter()
23935    }
23936}
23937
23938impl Enum for ErrorCode {}
23939
23940impl fmt::Display for ErrorCode {
23941    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
23942        f.write_str(self.name())
23943    }
23944}
23945
23946impl TryFrom<i32> for ErrorCode {
23947    type Error = Error;
23948
23949    fn try_from(i: i32) -> Result<Self> {
23950        let e = match i {
23951            0 => ErrorCode::Misc,
23952            1 => ErrorCode::Data,
23953            2 => ErrorCode::Conf,
23954            3 => ErrorCode::Auth,
23955            4 => ErrorCode::Load,
23956            #[allow(unreachable_patterns)]
23957            _ => return Err(Error::Invalid),
23958        };
23959        Ok(e)
23960    }
23961}
23962
23963impl From<ErrorCode> for i32 {
23964    #[must_use]
23965    fn from(e: ErrorCode) -> Self {
23966        e as Self
23967    }
23968}
23969
23970impl ReadXdr for ErrorCode {
23971    #[cfg(feature = "std")]
23972    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
23973        r.with_limited_depth(|r| {
23974            let e = i32::read_xdr(r)?;
23975            let v: Self = e.try_into()?;
23976            Ok(v)
23977        })
23978    }
23979}
23980
23981impl WriteXdr for ErrorCode {
23982    #[cfg(feature = "std")]
23983    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
23984        w.with_limited_depth(|w| {
23985            let i: i32 = (*self).into();
23986            i.write_xdr(w)
23987        })
23988    }
23989}
23990
23991/// SError is an XDR Struct defines as:
23992///
23993/// ```text
23994/// struct Error
23995/// {
23996///     ErrorCode code;
23997///     string msg<100>;
23998/// };
23999/// ```
24000///
24001#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
24002#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
24003#[cfg_attr(
24004    all(feature = "serde", feature = "alloc"),
24005    derive(serde::Serialize, serde::Deserialize),
24006    serde(rename_all = "snake_case")
24007)]
24008#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
24009pub struct SError {
24010    pub code: ErrorCode,
24011    pub msg: StringM<100>,
24012}
24013
24014impl ReadXdr for SError {
24015    #[cfg(feature = "std")]
24016    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
24017        r.with_limited_depth(|r| {
24018            Ok(Self {
24019                code: ErrorCode::read_xdr(r)?,
24020                msg: StringM::<100>::read_xdr(r)?,
24021            })
24022        })
24023    }
24024}
24025
24026impl WriteXdr for SError {
24027    #[cfg(feature = "std")]
24028    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
24029        w.with_limited_depth(|w| {
24030            self.code.write_xdr(w)?;
24031            self.msg.write_xdr(w)?;
24032            Ok(())
24033        })
24034    }
24035}
24036
24037/// SendMore is an XDR Struct defines as:
24038///
24039/// ```text
24040/// struct SendMore
24041/// {
24042///     uint32 numMessages;
24043/// };
24044/// ```
24045///
24046#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
24047#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
24048#[cfg_attr(
24049    all(feature = "serde", feature = "alloc"),
24050    derive(serde::Serialize, serde::Deserialize),
24051    serde(rename_all = "snake_case")
24052)]
24053#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
24054pub struct SendMore {
24055    pub num_messages: u32,
24056}
24057
24058impl ReadXdr for SendMore {
24059    #[cfg(feature = "std")]
24060    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
24061        r.with_limited_depth(|r| {
24062            Ok(Self {
24063                num_messages: u32::read_xdr(r)?,
24064            })
24065        })
24066    }
24067}
24068
24069impl WriteXdr for SendMore {
24070    #[cfg(feature = "std")]
24071    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
24072        w.with_limited_depth(|w| {
24073            self.num_messages.write_xdr(w)?;
24074            Ok(())
24075        })
24076    }
24077}
24078
24079/// SendMoreExtended is an XDR Struct defines as:
24080///
24081/// ```text
24082/// struct SendMoreExtended
24083/// {
24084///     uint32 numMessages;
24085///     uint32 numBytes;
24086/// };
24087/// ```
24088///
24089#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
24090#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
24091#[cfg_attr(
24092    all(feature = "serde", feature = "alloc"),
24093    derive(serde::Serialize, serde::Deserialize),
24094    serde(rename_all = "snake_case")
24095)]
24096#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
24097pub struct SendMoreExtended {
24098    pub num_messages: u32,
24099    pub num_bytes: u32,
24100}
24101
24102impl ReadXdr for SendMoreExtended {
24103    #[cfg(feature = "std")]
24104    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
24105        r.with_limited_depth(|r| {
24106            Ok(Self {
24107                num_messages: u32::read_xdr(r)?,
24108                num_bytes: u32::read_xdr(r)?,
24109            })
24110        })
24111    }
24112}
24113
24114impl WriteXdr for SendMoreExtended {
24115    #[cfg(feature = "std")]
24116    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
24117        w.with_limited_depth(|w| {
24118            self.num_messages.write_xdr(w)?;
24119            self.num_bytes.write_xdr(w)?;
24120            Ok(())
24121        })
24122    }
24123}
24124
24125/// AuthCert is an XDR Struct defines as:
24126///
24127/// ```text
24128/// struct AuthCert
24129/// {
24130///     Curve25519Public pubkey;
24131///     uint64 expiration;
24132///     Signature sig;
24133/// };
24134/// ```
24135///
24136#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
24137#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
24138#[cfg_attr(
24139    all(feature = "serde", feature = "alloc"),
24140    derive(serde::Serialize, serde::Deserialize),
24141    serde(rename_all = "snake_case")
24142)]
24143#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
24144pub struct AuthCert {
24145    pub pubkey: Curve25519Public,
24146    pub expiration: u64,
24147    pub sig: Signature,
24148}
24149
24150impl ReadXdr for AuthCert {
24151    #[cfg(feature = "std")]
24152    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
24153        r.with_limited_depth(|r| {
24154            Ok(Self {
24155                pubkey: Curve25519Public::read_xdr(r)?,
24156                expiration: u64::read_xdr(r)?,
24157                sig: Signature::read_xdr(r)?,
24158            })
24159        })
24160    }
24161}
24162
24163impl WriteXdr for AuthCert {
24164    #[cfg(feature = "std")]
24165    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
24166        w.with_limited_depth(|w| {
24167            self.pubkey.write_xdr(w)?;
24168            self.expiration.write_xdr(w)?;
24169            self.sig.write_xdr(w)?;
24170            Ok(())
24171        })
24172    }
24173}
24174
24175/// Hello is an XDR Struct defines as:
24176///
24177/// ```text
24178/// struct Hello
24179/// {
24180///     uint32 ledgerVersion;
24181///     uint32 overlayVersion;
24182///     uint32 overlayMinVersion;
24183///     Hash networkID;
24184///     string versionStr<100>;
24185///     int listeningPort;
24186///     NodeID peerID;
24187///     AuthCert cert;
24188///     uint256 nonce;
24189/// };
24190/// ```
24191///
24192#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
24193#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
24194#[cfg_attr(
24195    all(feature = "serde", feature = "alloc"),
24196    derive(serde::Serialize, serde::Deserialize),
24197    serde(rename_all = "snake_case")
24198)]
24199#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
24200pub struct Hello {
24201    pub ledger_version: u32,
24202    pub overlay_version: u32,
24203    pub overlay_min_version: u32,
24204    pub network_id: Hash,
24205    pub version_str: StringM<100>,
24206    pub listening_port: i32,
24207    pub peer_id: NodeId,
24208    pub cert: AuthCert,
24209    pub nonce: Uint256,
24210}
24211
24212impl ReadXdr for Hello {
24213    #[cfg(feature = "std")]
24214    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
24215        r.with_limited_depth(|r| {
24216            Ok(Self {
24217                ledger_version: u32::read_xdr(r)?,
24218                overlay_version: u32::read_xdr(r)?,
24219                overlay_min_version: u32::read_xdr(r)?,
24220                network_id: Hash::read_xdr(r)?,
24221                version_str: StringM::<100>::read_xdr(r)?,
24222                listening_port: i32::read_xdr(r)?,
24223                peer_id: NodeId::read_xdr(r)?,
24224                cert: AuthCert::read_xdr(r)?,
24225                nonce: Uint256::read_xdr(r)?,
24226            })
24227        })
24228    }
24229}
24230
24231impl WriteXdr for Hello {
24232    #[cfg(feature = "std")]
24233    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
24234        w.with_limited_depth(|w| {
24235            self.ledger_version.write_xdr(w)?;
24236            self.overlay_version.write_xdr(w)?;
24237            self.overlay_min_version.write_xdr(w)?;
24238            self.network_id.write_xdr(w)?;
24239            self.version_str.write_xdr(w)?;
24240            self.listening_port.write_xdr(w)?;
24241            self.peer_id.write_xdr(w)?;
24242            self.cert.write_xdr(w)?;
24243            self.nonce.write_xdr(w)?;
24244            Ok(())
24245        })
24246    }
24247}
24248
24249/// AuthMsgFlagFlowControlBytesRequested is an XDR Const defines as:
24250///
24251/// ```text
24252/// const AUTH_MSG_FLAG_FLOW_CONTROL_BYTES_REQUESTED = 200;
24253/// ```
24254///
24255pub const AUTH_MSG_FLAG_FLOW_CONTROL_BYTES_REQUESTED: u64 = 200;
24256
24257/// Auth is an XDR Struct defines as:
24258///
24259/// ```text
24260/// struct Auth
24261/// {
24262///     int flags;
24263/// };
24264/// ```
24265///
24266#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
24267#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
24268#[cfg_attr(
24269    all(feature = "serde", feature = "alloc"),
24270    derive(serde::Serialize, serde::Deserialize),
24271    serde(rename_all = "snake_case")
24272)]
24273#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
24274pub struct Auth {
24275    pub flags: i32,
24276}
24277
24278impl ReadXdr for Auth {
24279    #[cfg(feature = "std")]
24280    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
24281        r.with_limited_depth(|r| {
24282            Ok(Self {
24283                flags: i32::read_xdr(r)?,
24284            })
24285        })
24286    }
24287}
24288
24289impl WriteXdr for Auth {
24290    #[cfg(feature = "std")]
24291    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
24292        w.with_limited_depth(|w| {
24293            self.flags.write_xdr(w)?;
24294            Ok(())
24295        })
24296    }
24297}
24298
24299/// IpAddrType is an XDR Enum defines as:
24300///
24301/// ```text
24302/// enum IPAddrType
24303/// {
24304///     IPv4 = 0,
24305///     IPv6 = 1
24306/// };
24307/// ```
24308///
24309// enum
24310#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
24311#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
24312#[cfg_attr(
24313    all(feature = "serde", feature = "alloc"),
24314    derive(serde::Serialize, serde::Deserialize),
24315    serde(rename_all = "snake_case")
24316)]
24317#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
24318#[repr(i32)]
24319pub enum IpAddrType {
24320    IPv4 = 0,
24321    IPv6 = 1,
24322}
24323
24324impl IpAddrType {
24325    pub const VARIANTS: [IpAddrType; 2] = [IpAddrType::IPv4, IpAddrType::IPv6];
24326    pub const VARIANTS_STR: [&'static str; 2] = ["IPv4", "IPv6"];
24327
24328    #[must_use]
24329    pub const fn name(&self) -> &'static str {
24330        match self {
24331            Self::IPv4 => "IPv4",
24332            Self::IPv6 => "IPv6",
24333        }
24334    }
24335
24336    #[must_use]
24337    pub const fn variants() -> [IpAddrType; 2] {
24338        Self::VARIANTS
24339    }
24340}
24341
24342impl Name for IpAddrType {
24343    #[must_use]
24344    fn name(&self) -> &'static str {
24345        Self::name(self)
24346    }
24347}
24348
24349impl Variants<IpAddrType> for IpAddrType {
24350    fn variants() -> slice::Iter<'static, IpAddrType> {
24351        Self::VARIANTS.iter()
24352    }
24353}
24354
24355impl Enum for IpAddrType {}
24356
24357impl fmt::Display for IpAddrType {
24358    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
24359        f.write_str(self.name())
24360    }
24361}
24362
24363impl TryFrom<i32> for IpAddrType {
24364    type Error = Error;
24365
24366    fn try_from(i: i32) -> Result<Self> {
24367        let e = match i {
24368            0 => IpAddrType::IPv4,
24369            1 => IpAddrType::IPv6,
24370            #[allow(unreachable_patterns)]
24371            _ => return Err(Error::Invalid),
24372        };
24373        Ok(e)
24374    }
24375}
24376
24377impl From<IpAddrType> for i32 {
24378    #[must_use]
24379    fn from(e: IpAddrType) -> Self {
24380        e as Self
24381    }
24382}
24383
24384impl ReadXdr for IpAddrType {
24385    #[cfg(feature = "std")]
24386    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
24387        r.with_limited_depth(|r| {
24388            let e = i32::read_xdr(r)?;
24389            let v: Self = e.try_into()?;
24390            Ok(v)
24391        })
24392    }
24393}
24394
24395impl WriteXdr for IpAddrType {
24396    #[cfg(feature = "std")]
24397    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
24398        w.with_limited_depth(|w| {
24399            let i: i32 = (*self).into();
24400            i.write_xdr(w)
24401        })
24402    }
24403}
24404
24405/// PeerAddressIp is an XDR NestedUnion defines as:
24406///
24407/// ```text
24408/// union switch (IPAddrType type)
24409///     {
24410///     case IPv4:
24411///         opaque ipv4[4];
24412///     case IPv6:
24413///         opaque ipv6[16];
24414///     }
24415/// ```
24416///
24417// union with discriminant IpAddrType
24418#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
24419#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
24420#[cfg_attr(
24421    all(feature = "serde", feature = "alloc"),
24422    derive(serde::Serialize, serde::Deserialize),
24423    serde(rename_all = "snake_case")
24424)]
24425#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
24426#[allow(clippy::large_enum_variant)]
24427pub enum PeerAddressIp {
24428    IPv4([u8; 4]),
24429    IPv6([u8; 16]),
24430}
24431
24432impl PeerAddressIp {
24433    pub const VARIANTS: [IpAddrType; 2] = [IpAddrType::IPv4, IpAddrType::IPv6];
24434    pub const VARIANTS_STR: [&'static str; 2] = ["IPv4", "IPv6"];
24435
24436    #[must_use]
24437    pub const fn name(&self) -> &'static str {
24438        match self {
24439            Self::IPv4(_) => "IPv4",
24440            Self::IPv6(_) => "IPv6",
24441        }
24442    }
24443
24444    #[must_use]
24445    pub const fn discriminant(&self) -> IpAddrType {
24446        #[allow(clippy::match_same_arms)]
24447        match self {
24448            Self::IPv4(_) => IpAddrType::IPv4,
24449            Self::IPv6(_) => IpAddrType::IPv6,
24450        }
24451    }
24452
24453    #[must_use]
24454    pub const fn variants() -> [IpAddrType; 2] {
24455        Self::VARIANTS
24456    }
24457}
24458
24459impl Name for PeerAddressIp {
24460    #[must_use]
24461    fn name(&self) -> &'static str {
24462        Self::name(self)
24463    }
24464}
24465
24466impl Discriminant<IpAddrType> for PeerAddressIp {
24467    #[must_use]
24468    fn discriminant(&self) -> IpAddrType {
24469        Self::discriminant(self)
24470    }
24471}
24472
24473impl Variants<IpAddrType> for PeerAddressIp {
24474    fn variants() -> slice::Iter<'static, IpAddrType> {
24475        Self::VARIANTS.iter()
24476    }
24477}
24478
24479impl Union<IpAddrType> for PeerAddressIp {}
24480
24481impl ReadXdr for PeerAddressIp {
24482    #[cfg(feature = "std")]
24483    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
24484        r.with_limited_depth(|r| {
24485            let dv: IpAddrType = <IpAddrType as ReadXdr>::read_xdr(r)?;
24486            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
24487            let v = match dv {
24488                IpAddrType::IPv4 => Self::IPv4(<[u8; 4]>::read_xdr(r)?),
24489                IpAddrType::IPv6 => Self::IPv6(<[u8; 16]>::read_xdr(r)?),
24490                #[allow(unreachable_patterns)]
24491                _ => return Err(Error::Invalid),
24492            };
24493            Ok(v)
24494        })
24495    }
24496}
24497
24498impl WriteXdr for PeerAddressIp {
24499    #[cfg(feature = "std")]
24500    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
24501        w.with_limited_depth(|w| {
24502            self.discriminant().write_xdr(w)?;
24503            #[allow(clippy::match_same_arms)]
24504            match self {
24505                Self::IPv4(v) => v.write_xdr(w)?,
24506                Self::IPv6(v) => v.write_xdr(w)?,
24507            };
24508            Ok(())
24509        })
24510    }
24511}
24512
24513/// PeerAddress is an XDR Struct defines as:
24514///
24515/// ```text
24516/// struct PeerAddress
24517/// {
24518///     union switch (IPAddrType type)
24519///     {
24520///     case IPv4:
24521///         opaque ipv4[4];
24522///     case IPv6:
24523///         opaque ipv6[16];
24524///     }
24525///     ip;
24526///     uint32 port;
24527///     uint32 numFailures;
24528/// };
24529/// ```
24530///
24531#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
24532#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
24533#[cfg_attr(
24534    all(feature = "serde", feature = "alloc"),
24535    derive(serde::Serialize, serde::Deserialize),
24536    serde(rename_all = "snake_case")
24537)]
24538#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
24539pub struct PeerAddress {
24540    pub ip: PeerAddressIp,
24541    pub port: u32,
24542    pub num_failures: u32,
24543}
24544
24545impl ReadXdr for PeerAddress {
24546    #[cfg(feature = "std")]
24547    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
24548        r.with_limited_depth(|r| {
24549            Ok(Self {
24550                ip: PeerAddressIp::read_xdr(r)?,
24551                port: u32::read_xdr(r)?,
24552                num_failures: u32::read_xdr(r)?,
24553            })
24554        })
24555    }
24556}
24557
24558impl WriteXdr for PeerAddress {
24559    #[cfg(feature = "std")]
24560    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
24561        w.with_limited_depth(|w| {
24562            self.ip.write_xdr(w)?;
24563            self.port.write_xdr(w)?;
24564            self.num_failures.write_xdr(w)?;
24565            Ok(())
24566        })
24567    }
24568}
24569
24570/// MessageType is an XDR Enum defines as:
24571///
24572/// ```text
24573/// enum MessageType
24574/// {
24575///     ERROR_MSG = 0,
24576///     AUTH = 2,
24577///     DONT_HAVE = 3,
24578///
24579///     GET_PEERS = 4, // gets a list of peers this guy knows about
24580///     PEERS = 5,
24581///
24582///     GET_TX_SET = 6, // gets a particular txset by hash
24583///     TX_SET = 7,
24584///     GENERALIZED_TX_SET = 17,
24585///
24586///     TRANSACTION = 8, // pass on a tx you have heard about
24587///
24588///     // SCP
24589///     GET_SCP_QUORUMSET = 9,
24590///     SCP_QUORUMSET = 10,
24591///     SCP_MESSAGE = 11,
24592///     GET_SCP_STATE = 12,
24593///
24594///     // new messages
24595///     HELLO = 13,
24596///
24597///     SURVEY_REQUEST = 14,
24598///     SURVEY_RESPONSE = 15,
24599///
24600///     SEND_MORE = 16,
24601///     SEND_MORE_EXTENDED = 20,
24602///
24603///     FLOOD_ADVERT = 18,
24604///     FLOOD_DEMAND = 19,
24605///
24606///     TIME_SLICED_SURVEY_REQUEST = 21,
24607///     TIME_SLICED_SURVEY_RESPONSE = 22,
24608///     TIME_SLICED_SURVEY_START_COLLECTING = 23,
24609///     TIME_SLICED_SURVEY_STOP_COLLECTING = 24
24610/// };
24611/// ```
24612///
24613// enum
24614#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
24615#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
24616#[cfg_attr(
24617    all(feature = "serde", feature = "alloc"),
24618    derive(serde::Serialize, serde::Deserialize),
24619    serde(rename_all = "snake_case")
24620)]
24621#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
24622#[repr(i32)]
24623pub enum MessageType {
24624    ErrorMsg = 0,
24625    Auth = 2,
24626    DontHave = 3,
24627    GetPeers = 4,
24628    Peers = 5,
24629    GetTxSet = 6,
24630    TxSet = 7,
24631    GeneralizedTxSet = 17,
24632    Transaction = 8,
24633    GetScpQuorumset = 9,
24634    ScpQuorumset = 10,
24635    ScpMessage = 11,
24636    GetScpState = 12,
24637    Hello = 13,
24638    SurveyRequest = 14,
24639    SurveyResponse = 15,
24640    SendMore = 16,
24641    SendMoreExtended = 20,
24642    FloodAdvert = 18,
24643    FloodDemand = 19,
24644    TimeSlicedSurveyRequest = 21,
24645    TimeSlicedSurveyResponse = 22,
24646    TimeSlicedSurveyStartCollecting = 23,
24647    TimeSlicedSurveyStopCollecting = 24,
24648}
24649
24650impl MessageType {
24651    pub const VARIANTS: [MessageType; 24] = [
24652        MessageType::ErrorMsg,
24653        MessageType::Auth,
24654        MessageType::DontHave,
24655        MessageType::GetPeers,
24656        MessageType::Peers,
24657        MessageType::GetTxSet,
24658        MessageType::TxSet,
24659        MessageType::GeneralizedTxSet,
24660        MessageType::Transaction,
24661        MessageType::GetScpQuorumset,
24662        MessageType::ScpQuorumset,
24663        MessageType::ScpMessage,
24664        MessageType::GetScpState,
24665        MessageType::Hello,
24666        MessageType::SurveyRequest,
24667        MessageType::SurveyResponse,
24668        MessageType::SendMore,
24669        MessageType::SendMoreExtended,
24670        MessageType::FloodAdvert,
24671        MessageType::FloodDemand,
24672        MessageType::TimeSlicedSurveyRequest,
24673        MessageType::TimeSlicedSurveyResponse,
24674        MessageType::TimeSlicedSurveyStartCollecting,
24675        MessageType::TimeSlicedSurveyStopCollecting,
24676    ];
24677    pub const VARIANTS_STR: [&'static str; 24] = [
24678        "ErrorMsg",
24679        "Auth",
24680        "DontHave",
24681        "GetPeers",
24682        "Peers",
24683        "GetTxSet",
24684        "TxSet",
24685        "GeneralizedTxSet",
24686        "Transaction",
24687        "GetScpQuorumset",
24688        "ScpQuorumset",
24689        "ScpMessage",
24690        "GetScpState",
24691        "Hello",
24692        "SurveyRequest",
24693        "SurveyResponse",
24694        "SendMore",
24695        "SendMoreExtended",
24696        "FloodAdvert",
24697        "FloodDemand",
24698        "TimeSlicedSurveyRequest",
24699        "TimeSlicedSurveyResponse",
24700        "TimeSlicedSurveyStartCollecting",
24701        "TimeSlicedSurveyStopCollecting",
24702    ];
24703
24704    #[must_use]
24705    pub const fn name(&self) -> &'static str {
24706        match self {
24707            Self::ErrorMsg => "ErrorMsg",
24708            Self::Auth => "Auth",
24709            Self::DontHave => "DontHave",
24710            Self::GetPeers => "GetPeers",
24711            Self::Peers => "Peers",
24712            Self::GetTxSet => "GetTxSet",
24713            Self::TxSet => "TxSet",
24714            Self::GeneralizedTxSet => "GeneralizedTxSet",
24715            Self::Transaction => "Transaction",
24716            Self::GetScpQuorumset => "GetScpQuorumset",
24717            Self::ScpQuorumset => "ScpQuorumset",
24718            Self::ScpMessage => "ScpMessage",
24719            Self::GetScpState => "GetScpState",
24720            Self::Hello => "Hello",
24721            Self::SurveyRequest => "SurveyRequest",
24722            Self::SurveyResponse => "SurveyResponse",
24723            Self::SendMore => "SendMore",
24724            Self::SendMoreExtended => "SendMoreExtended",
24725            Self::FloodAdvert => "FloodAdvert",
24726            Self::FloodDemand => "FloodDemand",
24727            Self::TimeSlicedSurveyRequest => "TimeSlicedSurveyRequest",
24728            Self::TimeSlicedSurveyResponse => "TimeSlicedSurveyResponse",
24729            Self::TimeSlicedSurveyStartCollecting => "TimeSlicedSurveyStartCollecting",
24730            Self::TimeSlicedSurveyStopCollecting => "TimeSlicedSurveyStopCollecting",
24731        }
24732    }
24733
24734    #[must_use]
24735    pub const fn variants() -> [MessageType; 24] {
24736        Self::VARIANTS
24737    }
24738}
24739
24740impl Name for MessageType {
24741    #[must_use]
24742    fn name(&self) -> &'static str {
24743        Self::name(self)
24744    }
24745}
24746
24747impl Variants<MessageType> for MessageType {
24748    fn variants() -> slice::Iter<'static, MessageType> {
24749        Self::VARIANTS.iter()
24750    }
24751}
24752
24753impl Enum for MessageType {}
24754
24755impl fmt::Display for MessageType {
24756    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
24757        f.write_str(self.name())
24758    }
24759}
24760
24761impl TryFrom<i32> for MessageType {
24762    type Error = Error;
24763
24764    fn try_from(i: i32) -> Result<Self> {
24765        let e = match i {
24766            0 => MessageType::ErrorMsg,
24767            2 => MessageType::Auth,
24768            3 => MessageType::DontHave,
24769            4 => MessageType::GetPeers,
24770            5 => MessageType::Peers,
24771            6 => MessageType::GetTxSet,
24772            7 => MessageType::TxSet,
24773            17 => MessageType::GeneralizedTxSet,
24774            8 => MessageType::Transaction,
24775            9 => MessageType::GetScpQuorumset,
24776            10 => MessageType::ScpQuorumset,
24777            11 => MessageType::ScpMessage,
24778            12 => MessageType::GetScpState,
24779            13 => MessageType::Hello,
24780            14 => MessageType::SurveyRequest,
24781            15 => MessageType::SurveyResponse,
24782            16 => MessageType::SendMore,
24783            20 => MessageType::SendMoreExtended,
24784            18 => MessageType::FloodAdvert,
24785            19 => MessageType::FloodDemand,
24786            21 => MessageType::TimeSlicedSurveyRequest,
24787            22 => MessageType::TimeSlicedSurveyResponse,
24788            23 => MessageType::TimeSlicedSurveyStartCollecting,
24789            24 => MessageType::TimeSlicedSurveyStopCollecting,
24790            #[allow(unreachable_patterns)]
24791            _ => return Err(Error::Invalid),
24792        };
24793        Ok(e)
24794    }
24795}
24796
24797impl From<MessageType> for i32 {
24798    #[must_use]
24799    fn from(e: MessageType) -> Self {
24800        e as Self
24801    }
24802}
24803
24804impl ReadXdr for MessageType {
24805    #[cfg(feature = "std")]
24806    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
24807        r.with_limited_depth(|r| {
24808            let e = i32::read_xdr(r)?;
24809            let v: Self = e.try_into()?;
24810            Ok(v)
24811        })
24812    }
24813}
24814
24815impl WriteXdr for MessageType {
24816    #[cfg(feature = "std")]
24817    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
24818        w.with_limited_depth(|w| {
24819            let i: i32 = (*self).into();
24820            i.write_xdr(w)
24821        })
24822    }
24823}
24824
24825/// DontHave is an XDR Struct defines as:
24826///
24827/// ```text
24828/// struct DontHave
24829/// {
24830///     MessageType type;
24831///     uint256 reqHash;
24832/// };
24833/// ```
24834///
24835#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
24836#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
24837#[cfg_attr(
24838    all(feature = "serde", feature = "alloc"),
24839    derive(serde::Serialize, serde::Deserialize),
24840    serde(rename_all = "snake_case")
24841)]
24842#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
24843pub struct DontHave {
24844    pub type_: MessageType,
24845    pub req_hash: Uint256,
24846}
24847
24848impl ReadXdr for DontHave {
24849    #[cfg(feature = "std")]
24850    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
24851        r.with_limited_depth(|r| {
24852            Ok(Self {
24853                type_: MessageType::read_xdr(r)?,
24854                req_hash: Uint256::read_xdr(r)?,
24855            })
24856        })
24857    }
24858}
24859
24860impl WriteXdr for DontHave {
24861    #[cfg(feature = "std")]
24862    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
24863        w.with_limited_depth(|w| {
24864            self.type_.write_xdr(w)?;
24865            self.req_hash.write_xdr(w)?;
24866            Ok(())
24867        })
24868    }
24869}
24870
24871/// SurveyMessageCommandType is an XDR Enum defines as:
24872///
24873/// ```text
24874/// enum SurveyMessageCommandType
24875/// {
24876///     SURVEY_TOPOLOGY = 0,
24877///     TIME_SLICED_SURVEY_TOPOLOGY = 1
24878/// };
24879/// ```
24880///
24881// enum
24882#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
24883#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
24884#[cfg_attr(
24885    all(feature = "serde", feature = "alloc"),
24886    derive(serde::Serialize, serde::Deserialize),
24887    serde(rename_all = "snake_case")
24888)]
24889#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
24890#[repr(i32)]
24891pub enum SurveyMessageCommandType {
24892    SurveyTopology = 0,
24893    TimeSlicedSurveyTopology = 1,
24894}
24895
24896impl SurveyMessageCommandType {
24897    pub const VARIANTS: [SurveyMessageCommandType; 2] = [
24898        SurveyMessageCommandType::SurveyTopology,
24899        SurveyMessageCommandType::TimeSlicedSurveyTopology,
24900    ];
24901    pub const VARIANTS_STR: [&'static str; 2] = ["SurveyTopology", "TimeSlicedSurveyTopology"];
24902
24903    #[must_use]
24904    pub const fn name(&self) -> &'static str {
24905        match self {
24906            Self::SurveyTopology => "SurveyTopology",
24907            Self::TimeSlicedSurveyTopology => "TimeSlicedSurveyTopology",
24908        }
24909    }
24910
24911    #[must_use]
24912    pub const fn variants() -> [SurveyMessageCommandType; 2] {
24913        Self::VARIANTS
24914    }
24915}
24916
24917impl Name for SurveyMessageCommandType {
24918    #[must_use]
24919    fn name(&self) -> &'static str {
24920        Self::name(self)
24921    }
24922}
24923
24924impl Variants<SurveyMessageCommandType> for SurveyMessageCommandType {
24925    fn variants() -> slice::Iter<'static, SurveyMessageCommandType> {
24926        Self::VARIANTS.iter()
24927    }
24928}
24929
24930impl Enum for SurveyMessageCommandType {}
24931
24932impl fmt::Display for SurveyMessageCommandType {
24933    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
24934        f.write_str(self.name())
24935    }
24936}
24937
24938impl TryFrom<i32> for SurveyMessageCommandType {
24939    type Error = Error;
24940
24941    fn try_from(i: i32) -> Result<Self> {
24942        let e = match i {
24943            0 => SurveyMessageCommandType::SurveyTopology,
24944            1 => SurveyMessageCommandType::TimeSlicedSurveyTopology,
24945            #[allow(unreachable_patterns)]
24946            _ => return Err(Error::Invalid),
24947        };
24948        Ok(e)
24949    }
24950}
24951
24952impl From<SurveyMessageCommandType> for i32 {
24953    #[must_use]
24954    fn from(e: SurveyMessageCommandType) -> Self {
24955        e as Self
24956    }
24957}
24958
24959impl ReadXdr for SurveyMessageCommandType {
24960    #[cfg(feature = "std")]
24961    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
24962        r.with_limited_depth(|r| {
24963            let e = i32::read_xdr(r)?;
24964            let v: Self = e.try_into()?;
24965            Ok(v)
24966        })
24967    }
24968}
24969
24970impl WriteXdr for SurveyMessageCommandType {
24971    #[cfg(feature = "std")]
24972    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
24973        w.with_limited_depth(|w| {
24974            let i: i32 = (*self).into();
24975            i.write_xdr(w)
24976        })
24977    }
24978}
24979
24980/// SurveyMessageResponseType is an XDR Enum defines as:
24981///
24982/// ```text
24983/// enum SurveyMessageResponseType
24984/// {
24985///     SURVEY_TOPOLOGY_RESPONSE_V0 = 0,
24986///     SURVEY_TOPOLOGY_RESPONSE_V1 = 1,
24987///     SURVEY_TOPOLOGY_RESPONSE_V2 = 2
24988/// };
24989/// ```
24990///
24991// enum
24992#[derive(Clone, Copy, 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))]
25000#[repr(i32)]
25001pub enum SurveyMessageResponseType {
25002    V0 = 0,
25003    V1 = 1,
25004    V2 = 2,
25005}
25006
25007impl SurveyMessageResponseType {
25008    pub const VARIANTS: [SurveyMessageResponseType; 3] = [
25009        SurveyMessageResponseType::V0,
25010        SurveyMessageResponseType::V1,
25011        SurveyMessageResponseType::V2,
25012    ];
25013    pub const VARIANTS_STR: [&'static str; 3] = ["V0", "V1", "V2"];
25014
25015    #[must_use]
25016    pub const fn name(&self) -> &'static str {
25017        match self {
25018            Self::V0 => "V0",
25019            Self::V1 => "V1",
25020            Self::V2 => "V2",
25021        }
25022    }
25023
25024    #[must_use]
25025    pub const fn variants() -> [SurveyMessageResponseType; 3] {
25026        Self::VARIANTS
25027    }
25028}
25029
25030impl Name for SurveyMessageResponseType {
25031    #[must_use]
25032    fn name(&self) -> &'static str {
25033        Self::name(self)
25034    }
25035}
25036
25037impl Variants<SurveyMessageResponseType> for SurveyMessageResponseType {
25038    fn variants() -> slice::Iter<'static, SurveyMessageResponseType> {
25039        Self::VARIANTS.iter()
25040    }
25041}
25042
25043impl Enum for SurveyMessageResponseType {}
25044
25045impl fmt::Display for SurveyMessageResponseType {
25046    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
25047        f.write_str(self.name())
25048    }
25049}
25050
25051impl TryFrom<i32> for SurveyMessageResponseType {
25052    type Error = Error;
25053
25054    fn try_from(i: i32) -> Result<Self> {
25055        let e = match i {
25056            0 => SurveyMessageResponseType::V0,
25057            1 => SurveyMessageResponseType::V1,
25058            2 => SurveyMessageResponseType::V2,
25059            #[allow(unreachable_patterns)]
25060            _ => return Err(Error::Invalid),
25061        };
25062        Ok(e)
25063    }
25064}
25065
25066impl From<SurveyMessageResponseType> for i32 {
25067    #[must_use]
25068    fn from(e: SurveyMessageResponseType) -> Self {
25069        e as Self
25070    }
25071}
25072
25073impl ReadXdr for SurveyMessageResponseType {
25074    #[cfg(feature = "std")]
25075    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
25076        r.with_limited_depth(|r| {
25077            let e = i32::read_xdr(r)?;
25078            let v: Self = e.try_into()?;
25079            Ok(v)
25080        })
25081    }
25082}
25083
25084impl WriteXdr for SurveyMessageResponseType {
25085    #[cfg(feature = "std")]
25086    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
25087        w.with_limited_depth(|w| {
25088            let i: i32 = (*self).into();
25089            i.write_xdr(w)
25090        })
25091    }
25092}
25093
25094/// TimeSlicedSurveyStartCollectingMessage is an XDR Struct defines as:
25095///
25096/// ```text
25097/// struct TimeSlicedSurveyStartCollectingMessage
25098/// {
25099///     NodeID surveyorID;
25100///     uint32 nonce;
25101///     uint32 ledgerNum;
25102/// };
25103/// ```
25104///
25105#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
25106#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
25107#[cfg_attr(
25108    all(feature = "serde", feature = "alloc"),
25109    derive(serde::Serialize, serde::Deserialize),
25110    serde(rename_all = "snake_case")
25111)]
25112#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25113pub struct TimeSlicedSurveyStartCollectingMessage {
25114    pub surveyor_id: NodeId,
25115    pub nonce: u32,
25116    pub ledger_num: u32,
25117}
25118
25119impl ReadXdr for TimeSlicedSurveyStartCollectingMessage {
25120    #[cfg(feature = "std")]
25121    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
25122        r.with_limited_depth(|r| {
25123            Ok(Self {
25124                surveyor_id: NodeId::read_xdr(r)?,
25125                nonce: u32::read_xdr(r)?,
25126                ledger_num: u32::read_xdr(r)?,
25127            })
25128        })
25129    }
25130}
25131
25132impl WriteXdr for TimeSlicedSurveyStartCollectingMessage {
25133    #[cfg(feature = "std")]
25134    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
25135        w.with_limited_depth(|w| {
25136            self.surveyor_id.write_xdr(w)?;
25137            self.nonce.write_xdr(w)?;
25138            self.ledger_num.write_xdr(w)?;
25139            Ok(())
25140        })
25141    }
25142}
25143
25144/// SignedTimeSlicedSurveyStartCollectingMessage is an XDR Struct defines as:
25145///
25146/// ```text
25147/// struct SignedTimeSlicedSurveyStartCollectingMessage
25148/// {
25149///     Signature signature;
25150///     TimeSlicedSurveyStartCollectingMessage startCollecting;
25151/// };
25152/// ```
25153///
25154#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
25155#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
25156#[cfg_attr(
25157    all(feature = "serde", feature = "alloc"),
25158    derive(serde::Serialize, serde::Deserialize),
25159    serde(rename_all = "snake_case")
25160)]
25161#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25162pub struct SignedTimeSlicedSurveyStartCollectingMessage {
25163    pub signature: Signature,
25164    pub start_collecting: TimeSlicedSurveyStartCollectingMessage,
25165}
25166
25167impl ReadXdr for SignedTimeSlicedSurveyStartCollectingMessage {
25168    #[cfg(feature = "std")]
25169    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
25170        r.with_limited_depth(|r| {
25171            Ok(Self {
25172                signature: Signature::read_xdr(r)?,
25173                start_collecting: TimeSlicedSurveyStartCollectingMessage::read_xdr(r)?,
25174            })
25175        })
25176    }
25177}
25178
25179impl WriteXdr for SignedTimeSlicedSurveyStartCollectingMessage {
25180    #[cfg(feature = "std")]
25181    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
25182        w.with_limited_depth(|w| {
25183            self.signature.write_xdr(w)?;
25184            self.start_collecting.write_xdr(w)?;
25185            Ok(())
25186        })
25187    }
25188}
25189
25190/// TimeSlicedSurveyStopCollectingMessage is an XDR Struct defines as:
25191///
25192/// ```text
25193/// struct TimeSlicedSurveyStopCollectingMessage
25194/// {
25195///     NodeID surveyorID;
25196///     uint32 nonce;
25197///     uint32 ledgerNum;
25198/// };
25199/// ```
25200///
25201#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
25202#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
25203#[cfg_attr(
25204    all(feature = "serde", feature = "alloc"),
25205    derive(serde::Serialize, serde::Deserialize),
25206    serde(rename_all = "snake_case")
25207)]
25208#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25209pub struct TimeSlicedSurveyStopCollectingMessage {
25210    pub surveyor_id: NodeId,
25211    pub nonce: u32,
25212    pub ledger_num: u32,
25213}
25214
25215impl ReadXdr for TimeSlicedSurveyStopCollectingMessage {
25216    #[cfg(feature = "std")]
25217    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
25218        r.with_limited_depth(|r| {
25219            Ok(Self {
25220                surveyor_id: NodeId::read_xdr(r)?,
25221                nonce: u32::read_xdr(r)?,
25222                ledger_num: u32::read_xdr(r)?,
25223            })
25224        })
25225    }
25226}
25227
25228impl WriteXdr for TimeSlicedSurveyStopCollectingMessage {
25229    #[cfg(feature = "std")]
25230    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
25231        w.with_limited_depth(|w| {
25232            self.surveyor_id.write_xdr(w)?;
25233            self.nonce.write_xdr(w)?;
25234            self.ledger_num.write_xdr(w)?;
25235            Ok(())
25236        })
25237    }
25238}
25239
25240/// SignedTimeSlicedSurveyStopCollectingMessage is an XDR Struct defines as:
25241///
25242/// ```text
25243/// struct SignedTimeSlicedSurveyStopCollectingMessage
25244/// {
25245///     Signature signature;
25246///     TimeSlicedSurveyStopCollectingMessage stopCollecting;
25247/// };
25248/// ```
25249///
25250#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
25251#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
25252#[cfg_attr(
25253    all(feature = "serde", feature = "alloc"),
25254    derive(serde::Serialize, serde::Deserialize),
25255    serde(rename_all = "snake_case")
25256)]
25257#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25258pub struct SignedTimeSlicedSurveyStopCollectingMessage {
25259    pub signature: Signature,
25260    pub stop_collecting: TimeSlicedSurveyStopCollectingMessage,
25261}
25262
25263impl ReadXdr for SignedTimeSlicedSurveyStopCollectingMessage {
25264    #[cfg(feature = "std")]
25265    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
25266        r.with_limited_depth(|r| {
25267            Ok(Self {
25268                signature: Signature::read_xdr(r)?,
25269                stop_collecting: TimeSlicedSurveyStopCollectingMessage::read_xdr(r)?,
25270            })
25271        })
25272    }
25273}
25274
25275impl WriteXdr for SignedTimeSlicedSurveyStopCollectingMessage {
25276    #[cfg(feature = "std")]
25277    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
25278        w.with_limited_depth(|w| {
25279            self.signature.write_xdr(w)?;
25280            self.stop_collecting.write_xdr(w)?;
25281            Ok(())
25282        })
25283    }
25284}
25285
25286/// SurveyRequestMessage is an XDR Struct defines as:
25287///
25288/// ```text
25289/// struct SurveyRequestMessage
25290/// {
25291///     NodeID surveyorPeerID;
25292///     NodeID surveyedPeerID;
25293///     uint32 ledgerNum;
25294///     Curve25519Public encryptionKey;
25295///     SurveyMessageCommandType commandType;
25296/// };
25297/// ```
25298///
25299#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
25300#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
25301#[cfg_attr(
25302    all(feature = "serde", feature = "alloc"),
25303    derive(serde::Serialize, serde::Deserialize),
25304    serde(rename_all = "snake_case")
25305)]
25306#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25307pub struct SurveyRequestMessage {
25308    pub surveyor_peer_id: NodeId,
25309    pub surveyed_peer_id: NodeId,
25310    pub ledger_num: u32,
25311    pub encryption_key: Curve25519Public,
25312    pub command_type: SurveyMessageCommandType,
25313}
25314
25315impl ReadXdr for SurveyRequestMessage {
25316    #[cfg(feature = "std")]
25317    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
25318        r.with_limited_depth(|r| {
25319            Ok(Self {
25320                surveyor_peer_id: NodeId::read_xdr(r)?,
25321                surveyed_peer_id: NodeId::read_xdr(r)?,
25322                ledger_num: u32::read_xdr(r)?,
25323                encryption_key: Curve25519Public::read_xdr(r)?,
25324                command_type: SurveyMessageCommandType::read_xdr(r)?,
25325            })
25326        })
25327    }
25328}
25329
25330impl WriteXdr for SurveyRequestMessage {
25331    #[cfg(feature = "std")]
25332    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
25333        w.with_limited_depth(|w| {
25334            self.surveyor_peer_id.write_xdr(w)?;
25335            self.surveyed_peer_id.write_xdr(w)?;
25336            self.ledger_num.write_xdr(w)?;
25337            self.encryption_key.write_xdr(w)?;
25338            self.command_type.write_xdr(w)?;
25339            Ok(())
25340        })
25341    }
25342}
25343
25344/// TimeSlicedSurveyRequestMessage is an XDR Struct defines as:
25345///
25346/// ```text
25347/// struct TimeSlicedSurveyRequestMessage
25348/// {
25349///     SurveyRequestMessage request;
25350///     uint32 nonce;
25351///     uint32 inboundPeersIndex;
25352///     uint32 outboundPeersIndex;
25353/// };
25354/// ```
25355///
25356#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
25357#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
25358#[cfg_attr(
25359    all(feature = "serde", feature = "alloc"),
25360    derive(serde::Serialize, serde::Deserialize),
25361    serde(rename_all = "snake_case")
25362)]
25363#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25364pub struct TimeSlicedSurveyRequestMessage {
25365    pub request: SurveyRequestMessage,
25366    pub nonce: u32,
25367    pub inbound_peers_index: u32,
25368    pub outbound_peers_index: u32,
25369}
25370
25371impl ReadXdr for TimeSlicedSurveyRequestMessage {
25372    #[cfg(feature = "std")]
25373    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
25374        r.with_limited_depth(|r| {
25375            Ok(Self {
25376                request: SurveyRequestMessage::read_xdr(r)?,
25377                nonce: u32::read_xdr(r)?,
25378                inbound_peers_index: u32::read_xdr(r)?,
25379                outbound_peers_index: u32::read_xdr(r)?,
25380            })
25381        })
25382    }
25383}
25384
25385impl WriteXdr for TimeSlicedSurveyRequestMessage {
25386    #[cfg(feature = "std")]
25387    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
25388        w.with_limited_depth(|w| {
25389            self.request.write_xdr(w)?;
25390            self.nonce.write_xdr(w)?;
25391            self.inbound_peers_index.write_xdr(w)?;
25392            self.outbound_peers_index.write_xdr(w)?;
25393            Ok(())
25394        })
25395    }
25396}
25397
25398/// SignedSurveyRequestMessage is an XDR Struct defines as:
25399///
25400/// ```text
25401/// struct SignedSurveyRequestMessage
25402/// {
25403///     Signature requestSignature;
25404///     SurveyRequestMessage request;
25405/// };
25406/// ```
25407///
25408#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
25409#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
25410#[cfg_attr(
25411    all(feature = "serde", feature = "alloc"),
25412    derive(serde::Serialize, serde::Deserialize),
25413    serde(rename_all = "snake_case")
25414)]
25415#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25416pub struct SignedSurveyRequestMessage {
25417    pub request_signature: Signature,
25418    pub request: SurveyRequestMessage,
25419}
25420
25421impl ReadXdr for SignedSurveyRequestMessage {
25422    #[cfg(feature = "std")]
25423    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
25424        r.with_limited_depth(|r| {
25425            Ok(Self {
25426                request_signature: Signature::read_xdr(r)?,
25427                request: SurveyRequestMessage::read_xdr(r)?,
25428            })
25429        })
25430    }
25431}
25432
25433impl WriteXdr for SignedSurveyRequestMessage {
25434    #[cfg(feature = "std")]
25435    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
25436        w.with_limited_depth(|w| {
25437            self.request_signature.write_xdr(w)?;
25438            self.request.write_xdr(w)?;
25439            Ok(())
25440        })
25441    }
25442}
25443
25444/// SignedTimeSlicedSurveyRequestMessage is an XDR Struct defines as:
25445///
25446/// ```text
25447/// struct SignedTimeSlicedSurveyRequestMessage
25448/// {
25449///     Signature requestSignature;
25450///     TimeSlicedSurveyRequestMessage request;
25451/// };
25452/// ```
25453///
25454#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
25455#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
25456#[cfg_attr(
25457    all(feature = "serde", feature = "alloc"),
25458    derive(serde::Serialize, serde::Deserialize),
25459    serde(rename_all = "snake_case")
25460)]
25461#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25462pub struct SignedTimeSlicedSurveyRequestMessage {
25463    pub request_signature: Signature,
25464    pub request: TimeSlicedSurveyRequestMessage,
25465}
25466
25467impl ReadXdr for SignedTimeSlicedSurveyRequestMessage {
25468    #[cfg(feature = "std")]
25469    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
25470        r.with_limited_depth(|r| {
25471            Ok(Self {
25472                request_signature: Signature::read_xdr(r)?,
25473                request: TimeSlicedSurveyRequestMessage::read_xdr(r)?,
25474            })
25475        })
25476    }
25477}
25478
25479impl WriteXdr for SignedTimeSlicedSurveyRequestMessage {
25480    #[cfg(feature = "std")]
25481    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
25482        w.with_limited_depth(|w| {
25483            self.request_signature.write_xdr(w)?;
25484            self.request.write_xdr(w)?;
25485            Ok(())
25486        })
25487    }
25488}
25489
25490/// EncryptedBody is an XDR Typedef defines as:
25491///
25492/// ```text
25493/// typedef opaque EncryptedBody<64000>;
25494/// ```
25495///
25496#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
25497#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
25498#[derive(Default)]
25499#[cfg_attr(
25500    all(feature = "serde", feature = "alloc"),
25501    derive(serde::Serialize, serde::Deserialize),
25502    serde(rename_all = "snake_case")
25503)]
25504#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25505#[derive(Debug)]
25506pub struct EncryptedBody(pub BytesM<64000>);
25507
25508impl From<EncryptedBody> for BytesM<64000> {
25509    #[must_use]
25510    fn from(x: EncryptedBody) -> Self {
25511        x.0
25512    }
25513}
25514
25515impl From<BytesM<64000>> for EncryptedBody {
25516    #[must_use]
25517    fn from(x: BytesM<64000>) -> Self {
25518        EncryptedBody(x)
25519    }
25520}
25521
25522impl AsRef<BytesM<64000>> for EncryptedBody {
25523    #[must_use]
25524    fn as_ref(&self) -> &BytesM<64000> {
25525        &self.0
25526    }
25527}
25528
25529impl ReadXdr for EncryptedBody {
25530    #[cfg(feature = "std")]
25531    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
25532        r.with_limited_depth(|r| {
25533            let i = BytesM::<64000>::read_xdr(r)?;
25534            let v = EncryptedBody(i);
25535            Ok(v)
25536        })
25537    }
25538}
25539
25540impl WriteXdr for EncryptedBody {
25541    #[cfg(feature = "std")]
25542    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
25543        w.with_limited_depth(|w| self.0.write_xdr(w))
25544    }
25545}
25546
25547impl Deref for EncryptedBody {
25548    type Target = BytesM<64000>;
25549    fn deref(&self) -> &Self::Target {
25550        &self.0
25551    }
25552}
25553
25554impl From<EncryptedBody> for Vec<u8> {
25555    #[must_use]
25556    fn from(x: EncryptedBody) -> Self {
25557        x.0 .0
25558    }
25559}
25560
25561impl TryFrom<Vec<u8>> for EncryptedBody {
25562    type Error = Error;
25563    fn try_from(x: Vec<u8>) -> Result<Self> {
25564        Ok(EncryptedBody(x.try_into()?))
25565    }
25566}
25567
25568#[cfg(feature = "alloc")]
25569impl TryFrom<&Vec<u8>> for EncryptedBody {
25570    type Error = Error;
25571    fn try_from(x: &Vec<u8>) -> Result<Self> {
25572        Ok(EncryptedBody(x.try_into()?))
25573    }
25574}
25575
25576impl AsRef<Vec<u8>> for EncryptedBody {
25577    #[must_use]
25578    fn as_ref(&self) -> &Vec<u8> {
25579        &self.0 .0
25580    }
25581}
25582
25583impl AsRef<[u8]> for EncryptedBody {
25584    #[cfg(feature = "alloc")]
25585    #[must_use]
25586    fn as_ref(&self) -> &[u8] {
25587        &self.0 .0
25588    }
25589    #[cfg(not(feature = "alloc"))]
25590    #[must_use]
25591    fn as_ref(&self) -> &[u8] {
25592        self.0 .0
25593    }
25594}
25595
25596/// SurveyResponseMessage is an XDR Struct defines as:
25597///
25598/// ```text
25599/// struct SurveyResponseMessage
25600/// {
25601///     NodeID surveyorPeerID;
25602///     NodeID surveyedPeerID;
25603///     uint32 ledgerNum;
25604///     SurveyMessageCommandType commandType;
25605///     EncryptedBody encryptedBody;
25606/// };
25607/// ```
25608///
25609#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
25610#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
25611#[cfg_attr(
25612    all(feature = "serde", feature = "alloc"),
25613    derive(serde::Serialize, serde::Deserialize),
25614    serde(rename_all = "snake_case")
25615)]
25616#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25617pub struct SurveyResponseMessage {
25618    pub surveyor_peer_id: NodeId,
25619    pub surveyed_peer_id: NodeId,
25620    pub ledger_num: u32,
25621    pub command_type: SurveyMessageCommandType,
25622    pub encrypted_body: EncryptedBody,
25623}
25624
25625impl ReadXdr for SurveyResponseMessage {
25626    #[cfg(feature = "std")]
25627    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
25628        r.with_limited_depth(|r| {
25629            Ok(Self {
25630                surveyor_peer_id: NodeId::read_xdr(r)?,
25631                surveyed_peer_id: NodeId::read_xdr(r)?,
25632                ledger_num: u32::read_xdr(r)?,
25633                command_type: SurveyMessageCommandType::read_xdr(r)?,
25634                encrypted_body: EncryptedBody::read_xdr(r)?,
25635            })
25636        })
25637    }
25638}
25639
25640impl WriteXdr for SurveyResponseMessage {
25641    #[cfg(feature = "std")]
25642    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
25643        w.with_limited_depth(|w| {
25644            self.surveyor_peer_id.write_xdr(w)?;
25645            self.surveyed_peer_id.write_xdr(w)?;
25646            self.ledger_num.write_xdr(w)?;
25647            self.command_type.write_xdr(w)?;
25648            self.encrypted_body.write_xdr(w)?;
25649            Ok(())
25650        })
25651    }
25652}
25653
25654/// TimeSlicedSurveyResponseMessage is an XDR Struct defines as:
25655///
25656/// ```text
25657/// struct TimeSlicedSurveyResponseMessage
25658/// {
25659///     SurveyResponseMessage response;
25660///     uint32 nonce;
25661/// };
25662/// ```
25663///
25664#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
25665#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
25666#[cfg_attr(
25667    all(feature = "serde", feature = "alloc"),
25668    derive(serde::Serialize, serde::Deserialize),
25669    serde(rename_all = "snake_case")
25670)]
25671#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25672pub struct TimeSlicedSurveyResponseMessage {
25673    pub response: SurveyResponseMessage,
25674    pub nonce: u32,
25675}
25676
25677impl ReadXdr for TimeSlicedSurveyResponseMessage {
25678    #[cfg(feature = "std")]
25679    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
25680        r.with_limited_depth(|r| {
25681            Ok(Self {
25682                response: SurveyResponseMessage::read_xdr(r)?,
25683                nonce: u32::read_xdr(r)?,
25684            })
25685        })
25686    }
25687}
25688
25689impl WriteXdr for TimeSlicedSurveyResponseMessage {
25690    #[cfg(feature = "std")]
25691    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
25692        w.with_limited_depth(|w| {
25693            self.response.write_xdr(w)?;
25694            self.nonce.write_xdr(w)?;
25695            Ok(())
25696        })
25697    }
25698}
25699
25700/// SignedSurveyResponseMessage is an XDR Struct defines as:
25701///
25702/// ```text
25703/// struct SignedSurveyResponseMessage
25704/// {
25705///     Signature responseSignature;
25706///     SurveyResponseMessage response;
25707/// };
25708/// ```
25709///
25710#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
25711#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
25712#[cfg_attr(
25713    all(feature = "serde", feature = "alloc"),
25714    derive(serde::Serialize, serde::Deserialize),
25715    serde(rename_all = "snake_case")
25716)]
25717#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25718pub struct SignedSurveyResponseMessage {
25719    pub response_signature: Signature,
25720    pub response: SurveyResponseMessage,
25721}
25722
25723impl ReadXdr for SignedSurveyResponseMessage {
25724    #[cfg(feature = "std")]
25725    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
25726        r.with_limited_depth(|r| {
25727            Ok(Self {
25728                response_signature: Signature::read_xdr(r)?,
25729                response: SurveyResponseMessage::read_xdr(r)?,
25730            })
25731        })
25732    }
25733}
25734
25735impl WriteXdr for SignedSurveyResponseMessage {
25736    #[cfg(feature = "std")]
25737    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
25738        w.with_limited_depth(|w| {
25739            self.response_signature.write_xdr(w)?;
25740            self.response.write_xdr(w)?;
25741            Ok(())
25742        })
25743    }
25744}
25745
25746/// SignedTimeSlicedSurveyResponseMessage is an XDR Struct defines as:
25747///
25748/// ```text
25749/// struct SignedTimeSlicedSurveyResponseMessage
25750/// {
25751///     Signature responseSignature;
25752///     TimeSlicedSurveyResponseMessage response;
25753/// };
25754/// ```
25755///
25756#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
25757#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
25758#[cfg_attr(
25759    all(feature = "serde", feature = "alloc"),
25760    derive(serde::Serialize, serde::Deserialize),
25761    serde(rename_all = "snake_case")
25762)]
25763#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25764pub struct SignedTimeSlicedSurveyResponseMessage {
25765    pub response_signature: Signature,
25766    pub response: TimeSlicedSurveyResponseMessage,
25767}
25768
25769impl ReadXdr for SignedTimeSlicedSurveyResponseMessage {
25770    #[cfg(feature = "std")]
25771    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
25772        r.with_limited_depth(|r| {
25773            Ok(Self {
25774                response_signature: Signature::read_xdr(r)?,
25775                response: TimeSlicedSurveyResponseMessage::read_xdr(r)?,
25776            })
25777        })
25778    }
25779}
25780
25781impl WriteXdr for SignedTimeSlicedSurveyResponseMessage {
25782    #[cfg(feature = "std")]
25783    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
25784        w.with_limited_depth(|w| {
25785            self.response_signature.write_xdr(w)?;
25786            self.response.write_xdr(w)?;
25787            Ok(())
25788        })
25789    }
25790}
25791
25792/// PeerStats is an XDR Struct defines as:
25793///
25794/// ```text
25795/// struct PeerStats
25796/// {
25797///     NodeID id;
25798///     string versionStr<100>;
25799///     uint64 messagesRead;
25800///     uint64 messagesWritten;
25801///     uint64 bytesRead;
25802///     uint64 bytesWritten;
25803///     uint64 secondsConnected;
25804///
25805///     uint64 uniqueFloodBytesRecv;
25806///     uint64 duplicateFloodBytesRecv;
25807///     uint64 uniqueFetchBytesRecv;
25808///     uint64 duplicateFetchBytesRecv;
25809///
25810///     uint64 uniqueFloodMessageRecv;
25811///     uint64 duplicateFloodMessageRecv;
25812///     uint64 uniqueFetchMessageRecv;
25813///     uint64 duplicateFetchMessageRecv;
25814/// };
25815/// ```
25816///
25817#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
25818#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
25819#[cfg_attr(
25820    all(feature = "serde", feature = "alloc"),
25821    derive(serde::Serialize, serde::Deserialize),
25822    serde(rename_all = "snake_case")
25823)]
25824#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25825pub struct PeerStats {
25826    pub id: NodeId,
25827    pub version_str: StringM<100>,
25828    pub messages_read: u64,
25829    pub messages_written: u64,
25830    pub bytes_read: u64,
25831    pub bytes_written: u64,
25832    pub seconds_connected: u64,
25833    pub unique_flood_bytes_recv: u64,
25834    pub duplicate_flood_bytes_recv: u64,
25835    pub unique_fetch_bytes_recv: u64,
25836    pub duplicate_fetch_bytes_recv: u64,
25837    pub unique_flood_message_recv: u64,
25838    pub duplicate_flood_message_recv: u64,
25839    pub unique_fetch_message_recv: u64,
25840    pub duplicate_fetch_message_recv: u64,
25841}
25842
25843impl ReadXdr for PeerStats {
25844    #[cfg(feature = "std")]
25845    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
25846        r.with_limited_depth(|r| {
25847            Ok(Self {
25848                id: NodeId::read_xdr(r)?,
25849                version_str: StringM::<100>::read_xdr(r)?,
25850                messages_read: u64::read_xdr(r)?,
25851                messages_written: u64::read_xdr(r)?,
25852                bytes_read: u64::read_xdr(r)?,
25853                bytes_written: u64::read_xdr(r)?,
25854                seconds_connected: u64::read_xdr(r)?,
25855                unique_flood_bytes_recv: u64::read_xdr(r)?,
25856                duplicate_flood_bytes_recv: u64::read_xdr(r)?,
25857                unique_fetch_bytes_recv: u64::read_xdr(r)?,
25858                duplicate_fetch_bytes_recv: u64::read_xdr(r)?,
25859                unique_flood_message_recv: u64::read_xdr(r)?,
25860                duplicate_flood_message_recv: u64::read_xdr(r)?,
25861                unique_fetch_message_recv: u64::read_xdr(r)?,
25862                duplicate_fetch_message_recv: u64::read_xdr(r)?,
25863            })
25864        })
25865    }
25866}
25867
25868impl WriteXdr for PeerStats {
25869    #[cfg(feature = "std")]
25870    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
25871        w.with_limited_depth(|w| {
25872            self.id.write_xdr(w)?;
25873            self.version_str.write_xdr(w)?;
25874            self.messages_read.write_xdr(w)?;
25875            self.messages_written.write_xdr(w)?;
25876            self.bytes_read.write_xdr(w)?;
25877            self.bytes_written.write_xdr(w)?;
25878            self.seconds_connected.write_xdr(w)?;
25879            self.unique_flood_bytes_recv.write_xdr(w)?;
25880            self.duplicate_flood_bytes_recv.write_xdr(w)?;
25881            self.unique_fetch_bytes_recv.write_xdr(w)?;
25882            self.duplicate_fetch_bytes_recv.write_xdr(w)?;
25883            self.unique_flood_message_recv.write_xdr(w)?;
25884            self.duplicate_flood_message_recv.write_xdr(w)?;
25885            self.unique_fetch_message_recv.write_xdr(w)?;
25886            self.duplicate_fetch_message_recv.write_xdr(w)?;
25887            Ok(())
25888        })
25889    }
25890}
25891
25892/// PeerStatList is an XDR Typedef defines as:
25893///
25894/// ```text
25895/// typedef PeerStats PeerStatList<25>;
25896/// ```
25897///
25898#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
25899#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
25900#[derive(Default)]
25901#[cfg_attr(
25902    all(feature = "serde", feature = "alloc"),
25903    derive(serde::Serialize, serde::Deserialize),
25904    serde(rename_all = "snake_case")
25905)]
25906#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25907#[derive(Debug)]
25908pub struct PeerStatList(pub VecM<PeerStats, 25>);
25909
25910impl From<PeerStatList> for VecM<PeerStats, 25> {
25911    #[must_use]
25912    fn from(x: PeerStatList) -> Self {
25913        x.0
25914    }
25915}
25916
25917impl From<VecM<PeerStats, 25>> for PeerStatList {
25918    #[must_use]
25919    fn from(x: VecM<PeerStats, 25>) -> Self {
25920        PeerStatList(x)
25921    }
25922}
25923
25924impl AsRef<VecM<PeerStats, 25>> for PeerStatList {
25925    #[must_use]
25926    fn as_ref(&self) -> &VecM<PeerStats, 25> {
25927        &self.0
25928    }
25929}
25930
25931impl ReadXdr for PeerStatList {
25932    #[cfg(feature = "std")]
25933    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
25934        r.with_limited_depth(|r| {
25935            let i = VecM::<PeerStats, 25>::read_xdr(r)?;
25936            let v = PeerStatList(i);
25937            Ok(v)
25938        })
25939    }
25940}
25941
25942impl WriteXdr for PeerStatList {
25943    #[cfg(feature = "std")]
25944    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
25945        w.with_limited_depth(|w| self.0.write_xdr(w))
25946    }
25947}
25948
25949impl Deref for PeerStatList {
25950    type Target = VecM<PeerStats, 25>;
25951    fn deref(&self) -> &Self::Target {
25952        &self.0
25953    }
25954}
25955
25956impl From<PeerStatList> for Vec<PeerStats> {
25957    #[must_use]
25958    fn from(x: PeerStatList) -> Self {
25959        x.0 .0
25960    }
25961}
25962
25963impl TryFrom<Vec<PeerStats>> for PeerStatList {
25964    type Error = Error;
25965    fn try_from(x: Vec<PeerStats>) -> Result<Self> {
25966        Ok(PeerStatList(x.try_into()?))
25967    }
25968}
25969
25970#[cfg(feature = "alloc")]
25971impl TryFrom<&Vec<PeerStats>> for PeerStatList {
25972    type Error = Error;
25973    fn try_from(x: &Vec<PeerStats>) -> Result<Self> {
25974        Ok(PeerStatList(x.try_into()?))
25975    }
25976}
25977
25978impl AsRef<Vec<PeerStats>> for PeerStatList {
25979    #[must_use]
25980    fn as_ref(&self) -> &Vec<PeerStats> {
25981        &self.0 .0
25982    }
25983}
25984
25985impl AsRef<[PeerStats]> for PeerStatList {
25986    #[cfg(feature = "alloc")]
25987    #[must_use]
25988    fn as_ref(&self) -> &[PeerStats] {
25989        &self.0 .0
25990    }
25991    #[cfg(not(feature = "alloc"))]
25992    #[must_use]
25993    fn as_ref(&self) -> &[PeerStats] {
25994        self.0 .0
25995    }
25996}
25997
25998/// TimeSlicedNodeData is an XDR Struct defines as:
25999///
26000/// ```text
26001/// struct TimeSlicedNodeData
26002/// {
26003///     uint32 addedAuthenticatedPeers;
26004///     uint32 droppedAuthenticatedPeers;
26005///     uint32 totalInboundPeerCount;
26006///     uint32 totalOutboundPeerCount;
26007///
26008///     // SCP stats
26009///     uint32 p75SCPFirstToSelfLatencyMs;
26010///     uint32 p75SCPSelfToOtherLatencyMs;
26011///
26012///     // How many times the node lost sync in the time slice
26013///     uint32 lostSyncCount;
26014///
26015///     // Config data
26016///     bool isValidator;
26017///     uint32 maxInboundPeerCount;
26018///     uint32 maxOutboundPeerCount;
26019/// };
26020/// ```
26021///
26022#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
26023#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
26024#[cfg_attr(
26025    all(feature = "serde", feature = "alloc"),
26026    derive(serde::Serialize, serde::Deserialize),
26027    serde(rename_all = "snake_case")
26028)]
26029#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
26030pub struct TimeSlicedNodeData {
26031    pub added_authenticated_peers: u32,
26032    pub dropped_authenticated_peers: u32,
26033    pub total_inbound_peer_count: u32,
26034    pub total_outbound_peer_count: u32,
26035    pub p75_scp_first_to_self_latency_ms: u32,
26036    pub p75_scp_self_to_other_latency_ms: u32,
26037    pub lost_sync_count: u32,
26038    pub is_validator: bool,
26039    pub max_inbound_peer_count: u32,
26040    pub max_outbound_peer_count: u32,
26041}
26042
26043impl ReadXdr for TimeSlicedNodeData {
26044    #[cfg(feature = "std")]
26045    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
26046        r.with_limited_depth(|r| {
26047            Ok(Self {
26048                added_authenticated_peers: u32::read_xdr(r)?,
26049                dropped_authenticated_peers: u32::read_xdr(r)?,
26050                total_inbound_peer_count: u32::read_xdr(r)?,
26051                total_outbound_peer_count: u32::read_xdr(r)?,
26052                p75_scp_first_to_self_latency_ms: u32::read_xdr(r)?,
26053                p75_scp_self_to_other_latency_ms: u32::read_xdr(r)?,
26054                lost_sync_count: u32::read_xdr(r)?,
26055                is_validator: bool::read_xdr(r)?,
26056                max_inbound_peer_count: u32::read_xdr(r)?,
26057                max_outbound_peer_count: u32::read_xdr(r)?,
26058            })
26059        })
26060    }
26061}
26062
26063impl WriteXdr for TimeSlicedNodeData {
26064    #[cfg(feature = "std")]
26065    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
26066        w.with_limited_depth(|w| {
26067            self.added_authenticated_peers.write_xdr(w)?;
26068            self.dropped_authenticated_peers.write_xdr(w)?;
26069            self.total_inbound_peer_count.write_xdr(w)?;
26070            self.total_outbound_peer_count.write_xdr(w)?;
26071            self.p75_scp_first_to_self_latency_ms.write_xdr(w)?;
26072            self.p75_scp_self_to_other_latency_ms.write_xdr(w)?;
26073            self.lost_sync_count.write_xdr(w)?;
26074            self.is_validator.write_xdr(w)?;
26075            self.max_inbound_peer_count.write_xdr(w)?;
26076            self.max_outbound_peer_count.write_xdr(w)?;
26077            Ok(())
26078        })
26079    }
26080}
26081
26082/// TimeSlicedPeerData is an XDR Struct defines as:
26083///
26084/// ```text
26085/// struct TimeSlicedPeerData
26086/// {
26087///     PeerStats peerStats;
26088///     uint32 averageLatencyMs;
26089/// };
26090/// ```
26091///
26092#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
26093#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
26094#[cfg_attr(
26095    all(feature = "serde", feature = "alloc"),
26096    derive(serde::Serialize, serde::Deserialize),
26097    serde(rename_all = "snake_case")
26098)]
26099#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
26100pub struct TimeSlicedPeerData {
26101    pub peer_stats: PeerStats,
26102    pub average_latency_ms: u32,
26103}
26104
26105impl ReadXdr for TimeSlicedPeerData {
26106    #[cfg(feature = "std")]
26107    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
26108        r.with_limited_depth(|r| {
26109            Ok(Self {
26110                peer_stats: PeerStats::read_xdr(r)?,
26111                average_latency_ms: u32::read_xdr(r)?,
26112            })
26113        })
26114    }
26115}
26116
26117impl WriteXdr for TimeSlicedPeerData {
26118    #[cfg(feature = "std")]
26119    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
26120        w.with_limited_depth(|w| {
26121            self.peer_stats.write_xdr(w)?;
26122            self.average_latency_ms.write_xdr(w)?;
26123            Ok(())
26124        })
26125    }
26126}
26127
26128/// TimeSlicedPeerDataList is an XDR Typedef defines as:
26129///
26130/// ```text
26131/// typedef TimeSlicedPeerData TimeSlicedPeerDataList<25>;
26132/// ```
26133///
26134#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
26135#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
26136#[derive(Default)]
26137#[cfg_attr(
26138    all(feature = "serde", feature = "alloc"),
26139    derive(serde::Serialize, serde::Deserialize),
26140    serde(rename_all = "snake_case")
26141)]
26142#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
26143#[derive(Debug)]
26144pub struct TimeSlicedPeerDataList(pub VecM<TimeSlicedPeerData, 25>);
26145
26146impl From<TimeSlicedPeerDataList> for VecM<TimeSlicedPeerData, 25> {
26147    #[must_use]
26148    fn from(x: TimeSlicedPeerDataList) -> Self {
26149        x.0
26150    }
26151}
26152
26153impl From<VecM<TimeSlicedPeerData, 25>> for TimeSlicedPeerDataList {
26154    #[must_use]
26155    fn from(x: VecM<TimeSlicedPeerData, 25>) -> Self {
26156        TimeSlicedPeerDataList(x)
26157    }
26158}
26159
26160impl AsRef<VecM<TimeSlicedPeerData, 25>> for TimeSlicedPeerDataList {
26161    #[must_use]
26162    fn as_ref(&self) -> &VecM<TimeSlicedPeerData, 25> {
26163        &self.0
26164    }
26165}
26166
26167impl ReadXdr for TimeSlicedPeerDataList {
26168    #[cfg(feature = "std")]
26169    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
26170        r.with_limited_depth(|r| {
26171            let i = VecM::<TimeSlicedPeerData, 25>::read_xdr(r)?;
26172            let v = TimeSlicedPeerDataList(i);
26173            Ok(v)
26174        })
26175    }
26176}
26177
26178impl WriteXdr for TimeSlicedPeerDataList {
26179    #[cfg(feature = "std")]
26180    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
26181        w.with_limited_depth(|w| self.0.write_xdr(w))
26182    }
26183}
26184
26185impl Deref for TimeSlicedPeerDataList {
26186    type Target = VecM<TimeSlicedPeerData, 25>;
26187    fn deref(&self) -> &Self::Target {
26188        &self.0
26189    }
26190}
26191
26192impl From<TimeSlicedPeerDataList> for Vec<TimeSlicedPeerData> {
26193    #[must_use]
26194    fn from(x: TimeSlicedPeerDataList) -> Self {
26195        x.0 .0
26196    }
26197}
26198
26199impl TryFrom<Vec<TimeSlicedPeerData>> for TimeSlicedPeerDataList {
26200    type Error = Error;
26201    fn try_from(x: Vec<TimeSlicedPeerData>) -> Result<Self> {
26202        Ok(TimeSlicedPeerDataList(x.try_into()?))
26203    }
26204}
26205
26206#[cfg(feature = "alloc")]
26207impl TryFrom<&Vec<TimeSlicedPeerData>> for TimeSlicedPeerDataList {
26208    type Error = Error;
26209    fn try_from(x: &Vec<TimeSlicedPeerData>) -> Result<Self> {
26210        Ok(TimeSlicedPeerDataList(x.try_into()?))
26211    }
26212}
26213
26214impl AsRef<Vec<TimeSlicedPeerData>> for TimeSlicedPeerDataList {
26215    #[must_use]
26216    fn as_ref(&self) -> &Vec<TimeSlicedPeerData> {
26217        &self.0 .0
26218    }
26219}
26220
26221impl AsRef<[TimeSlicedPeerData]> for TimeSlicedPeerDataList {
26222    #[cfg(feature = "alloc")]
26223    #[must_use]
26224    fn as_ref(&self) -> &[TimeSlicedPeerData] {
26225        &self.0 .0
26226    }
26227    #[cfg(not(feature = "alloc"))]
26228    #[must_use]
26229    fn as_ref(&self) -> &[TimeSlicedPeerData] {
26230        self.0 .0
26231    }
26232}
26233
26234/// TopologyResponseBodyV0 is an XDR Struct defines as:
26235///
26236/// ```text
26237/// struct TopologyResponseBodyV0
26238/// {
26239///     PeerStatList inboundPeers;
26240///     PeerStatList outboundPeers;
26241///
26242///     uint32 totalInboundPeerCount;
26243///     uint32 totalOutboundPeerCount;
26244/// };
26245/// ```
26246///
26247#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
26248#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
26249#[cfg_attr(
26250    all(feature = "serde", feature = "alloc"),
26251    derive(serde::Serialize, serde::Deserialize),
26252    serde(rename_all = "snake_case")
26253)]
26254#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
26255pub struct TopologyResponseBodyV0 {
26256    pub inbound_peers: PeerStatList,
26257    pub outbound_peers: PeerStatList,
26258    pub total_inbound_peer_count: u32,
26259    pub total_outbound_peer_count: u32,
26260}
26261
26262impl ReadXdr for TopologyResponseBodyV0 {
26263    #[cfg(feature = "std")]
26264    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
26265        r.with_limited_depth(|r| {
26266            Ok(Self {
26267                inbound_peers: PeerStatList::read_xdr(r)?,
26268                outbound_peers: PeerStatList::read_xdr(r)?,
26269                total_inbound_peer_count: u32::read_xdr(r)?,
26270                total_outbound_peer_count: u32::read_xdr(r)?,
26271            })
26272        })
26273    }
26274}
26275
26276impl WriteXdr for TopologyResponseBodyV0 {
26277    #[cfg(feature = "std")]
26278    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
26279        w.with_limited_depth(|w| {
26280            self.inbound_peers.write_xdr(w)?;
26281            self.outbound_peers.write_xdr(w)?;
26282            self.total_inbound_peer_count.write_xdr(w)?;
26283            self.total_outbound_peer_count.write_xdr(w)?;
26284            Ok(())
26285        })
26286    }
26287}
26288
26289/// TopologyResponseBodyV1 is an XDR Struct defines as:
26290///
26291/// ```text
26292/// struct TopologyResponseBodyV1
26293/// {
26294///     PeerStatList inboundPeers;
26295///     PeerStatList outboundPeers;
26296///
26297///     uint32 totalInboundPeerCount;
26298///     uint32 totalOutboundPeerCount;
26299///
26300///     uint32 maxInboundPeerCount;
26301///     uint32 maxOutboundPeerCount;
26302/// };
26303/// ```
26304///
26305#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
26306#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
26307#[cfg_attr(
26308    all(feature = "serde", feature = "alloc"),
26309    derive(serde::Serialize, serde::Deserialize),
26310    serde(rename_all = "snake_case")
26311)]
26312#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
26313pub struct TopologyResponseBodyV1 {
26314    pub inbound_peers: PeerStatList,
26315    pub outbound_peers: PeerStatList,
26316    pub total_inbound_peer_count: u32,
26317    pub total_outbound_peer_count: u32,
26318    pub max_inbound_peer_count: u32,
26319    pub max_outbound_peer_count: u32,
26320}
26321
26322impl ReadXdr for TopologyResponseBodyV1 {
26323    #[cfg(feature = "std")]
26324    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
26325        r.with_limited_depth(|r| {
26326            Ok(Self {
26327                inbound_peers: PeerStatList::read_xdr(r)?,
26328                outbound_peers: PeerStatList::read_xdr(r)?,
26329                total_inbound_peer_count: u32::read_xdr(r)?,
26330                total_outbound_peer_count: u32::read_xdr(r)?,
26331                max_inbound_peer_count: u32::read_xdr(r)?,
26332                max_outbound_peer_count: u32::read_xdr(r)?,
26333            })
26334        })
26335    }
26336}
26337
26338impl WriteXdr for TopologyResponseBodyV1 {
26339    #[cfg(feature = "std")]
26340    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
26341        w.with_limited_depth(|w| {
26342            self.inbound_peers.write_xdr(w)?;
26343            self.outbound_peers.write_xdr(w)?;
26344            self.total_inbound_peer_count.write_xdr(w)?;
26345            self.total_outbound_peer_count.write_xdr(w)?;
26346            self.max_inbound_peer_count.write_xdr(w)?;
26347            self.max_outbound_peer_count.write_xdr(w)?;
26348            Ok(())
26349        })
26350    }
26351}
26352
26353/// TopologyResponseBodyV2 is an XDR Struct defines as:
26354///
26355/// ```text
26356/// struct TopologyResponseBodyV2
26357/// {
26358///     TimeSlicedPeerDataList inboundPeers;
26359///     TimeSlicedPeerDataList outboundPeers;
26360///     TimeSlicedNodeData nodeData;
26361/// };
26362/// ```
26363///
26364#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
26365#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
26366#[cfg_attr(
26367    all(feature = "serde", feature = "alloc"),
26368    derive(serde::Serialize, serde::Deserialize),
26369    serde(rename_all = "snake_case")
26370)]
26371#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
26372pub struct TopologyResponseBodyV2 {
26373    pub inbound_peers: TimeSlicedPeerDataList,
26374    pub outbound_peers: TimeSlicedPeerDataList,
26375    pub node_data: TimeSlicedNodeData,
26376}
26377
26378impl ReadXdr for TopologyResponseBodyV2 {
26379    #[cfg(feature = "std")]
26380    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
26381        r.with_limited_depth(|r| {
26382            Ok(Self {
26383                inbound_peers: TimeSlicedPeerDataList::read_xdr(r)?,
26384                outbound_peers: TimeSlicedPeerDataList::read_xdr(r)?,
26385                node_data: TimeSlicedNodeData::read_xdr(r)?,
26386            })
26387        })
26388    }
26389}
26390
26391impl WriteXdr for TopologyResponseBodyV2 {
26392    #[cfg(feature = "std")]
26393    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
26394        w.with_limited_depth(|w| {
26395            self.inbound_peers.write_xdr(w)?;
26396            self.outbound_peers.write_xdr(w)?;
26397            self.node_data.write_xdr(w)?;
26398            Ok(())
26399        })
26400    }
26401}
26402
26403/// SurveyResponseBody is an XDR Union defines as:
26404///
26405/// ```text
26406/// union SurveyResponseBody switch (SurveyMessageResponseType type)
26407/// {
26408/// case SURVEY_TOPOLOGY_RESPONSE_V0:
26409///     TopologyResponseBodyV0 topologyResponseBodyV0;
26410/// case SURVEY_TOPOLOGY_RESPONSE_V1:
26411///     TopologyResponseBodyV1 topologyResponseBodyV1;
26412/// case SURVEY_TOPOLOGY_RESPONSE_V2:
26413///     TopologyResponseBodyV2 topologyResponseBodyV2;
26414/// };
26415/// ```
26416///
26417// union with discriminant SurveyMessageResponseType
26418#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
26419#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
26420#[cfg_attr(
26421    all(feature = "serde", feature = "alloc"),
26422    derive(serde::Serialize, serde::Deserialize),
26423    serde(rename_all = "snake_case")
26424)]
26425#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
26426#[allow(clippy::large_enum_variant)]
26427pub enum SurveyResponseBody {
26428    V0(TopologyResponseBodyV0),
26429    V1(TopologyResponseBodyV1),
26430    V2(TopologyResponseBodyV2),
26431}
26432
26433impl SurveyResponseBody {
26434    pub const VARIANTS: [SurveyMessageResponseType; 3] = [
26435        SurveyMessageResponseType::V0,
26436        SurveyMessageResponseType::V1,
26437        SurveyMessageResponseType::V2,
26438    ];
26439    pub const VARIANTS_STR: [&'static str; 3] = ["V0", "V1", "V2"];
26440
26441    #[must_use]
26442    pub const fn name(&self) -> &'static str {
26443        match self {
26444            Self::V0(_) => "V0",
26445            Self::V1(_) => "V1",
26446            Self::V2(_) => "V2",
26447        }
26448    }
26449
26450    #[must_use]
26451    pub const fn discriminant(&self) -> SurveyMessageResponseType {
26452        #[allow(clippy::match_same_arms)]
26453        match self {
26454            Self::V0(_) => SurveyMessageResponseType::V0,
26455            Self::V1(_) => SurveyMessageResponseType::V1,
26456            Self::V2(_) => SurveyMessageResponseType::V2,
26457        }
26458    }
26459
26460    #[must_use]
26461    pub const fn variants() -> [SurveyMessageResponseType; 3] {
26462        Self::VARIANTS
26463    }
26464}
26465
26466impl Name for SurveyResponseBody {
26467    #[must_use]
26468    fn name(&self) -> &'static str {
26469        Self::name(self)
26470    }
26471}
26472
26473impl Discriminant<SurveyMessageResponseType> for SurveyResponseBody {
26474    #[must_use]
26475    fn discriminant(&self) -> SurveyMessageResponseType {
26476        Self::discriminant(self)
26477    }
26478}
26479
26480impl Variants<SurveyMessageResponseType> for SurveyResponseBody {
26481    fn variants() -> slice::Iter<'static, SurveyMessageResponseType> {
26482        Self::VARIANTS.iter()
26483    }
26484}
26485
26486impl Union<SurveyMessageResponseType> for SurveyResponseBody {}
26487
26488impl ReadXdr for SurveyResponseBody {
26489    #[cfg(feature = "std")]
26490    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
26491        r.with_limited_depth(|r| {
26492            let dv: SurveyMessageResponseType =
26493                <SurveyMessageResponseType as ReadXdr>::read_xdr(r)?;
26494            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
26495            let v = match dv {
26496                SurveyMessageResponseType::V0 => Self::V0(TopologyResponseBodyV0::read_xdr(r)?),
26497                SurveyMessageResponseType::V1 => Self::V1(TopologyResponseBodyV1::read_xdr(r)?),
26498                SurveyMessageResponseType::V2 => Self::V2(TopologyResponseBodyV2::read_xdr(r)?),
26499                #[allow(unreachable_patterns)]
26500                _ => return Err(Error::Invalid),
26501            };
26502            Ok(v)
26503        })
26504    }
26505}
26506
26507impl WriteXdr for SurveyResponseBody {
26508    #[cfg(feature = "std")]
26509    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
26510        w.with_limited_depth(|w| {
26511            self.discriminant().write_xdr(w)?;
26512            #[allow(clippy::match_same_arms)]
26513            match self {
26514                Self::V0(v) => v.write_xdr(w)?,
26515                Self::V1(v) => v.write_xdr(w)?,
26516                Self::V2(v) => v.write_xdr(w)?,
26517            };
26518            Ok(())
26519        })
26520    }
26521}
26522
26523/// TxAdvertVectorMaxSize is an XDR Const defines as:
26524///
26525/// ```text
26526/// const TX_ADVERT_VECTOR_MAX_SIZE = 1000;
26527/// ```
26528///
26529pub const TX_ADVERT_VECTOR_MAX_SIZE: u64 = 1000;
26530
26531/// TxAdvertVector is an XDR Typedef defines as:
26532///
26533/// ```text
26534/// typedef Hash TxAdvertVector<TX_ADVERT_VECTOR_MAX_SIZE>;
26535/// ```
26536///
26537#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
26538#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
26539#[derive(Default)]
26540#[cfg_attr(
26541    all(feature = "serde", feature = "alloc"),
26542    derive(serde::Serialize, serde::Deserialize),
26543    serde(rename_all = "snake_case")
26544)]
26545#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
26546#[derive(Debug)]
26547pub struct TxAdvertVector(pub VecM<Hash, 1000>);
26548
26549impl From<TxAdvertVector> for VecM<Hash, 1000> {
26550    #[must_use]
26551    fn from(x: TxAdvertVector) -> Self {
26552        x.0
26553    }
26554}
26555
26556impl From<VecM<Hash, 1000>> for TxAdvertVector {
26557    #[must_use]
26558    fn from(x: VecM<Hash, 1000>) -> Self {
26559        TxAdvertVector(x)
26560    }
26561}
26562
26563impl AsRef<VecM<Hash, 1000>> for TxAdvertVector {
26564    #[must_use]
26565    fn as_ref(&self) -> &VecM<Hash, 1000> {
26566        &self.0
26567    }
26568}
26569
26570impl ReadXdr for TxAdvertVector {
26571    #[cfg(feature = "std")]
26572    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
26573        r.with_limited_depth(|r| {
26574            let i = VecM::<Hash, 1000>::read_xdr(r)?;
26575            let v = TxAdvertVector(i);
26576            Ok(v)
26577        })
26578    }
26579}
26580
26581impl WriteXdr for TxAdvertVector {
26582    #[cfg(feature = "std")]
26583    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
26584        w.with_limited_depth(|w| self.0.write_xdr(w))
26585    }
26586}
26587
26588impl Deref for TxAdvertVector {
26589    type Target = VecM<Hash, 1000>;
26590    fn deref(&self) -> &Self::Target {
26591        &self.0
26592    }
26593}
26594
26595impl From<TxAdvertVector> for Vec<Hash> {
26596    #[must_use]
26597    fn from(x: TxAdvertVector) -> Self {
26598        x.0 .0
26599    }
26600}
26601
26602impl TryFrom<Vec<Hash>> for TxAdvertVector {
26603    type Error = Error;
26604    fn try_from(x: Vec<Hash>) -> Result<Self> {
26605        Ok(TxAdvertVector(x.try_into()?))
26606    }
26607}
26608
26609#[cfg(feature = "alloc")]
26610impl TryFrom<&Vec<Hash>> for TxAdvertVector {
26611    type Error = Error;
26612    fn try_from(x: &Vec<Hash>) -> Result<Self> {
26613        Ok(TxAdvertVector(x.try_into()?))
26614    }
26615}
26616
26617impl AsRef<Vec<Hash>> for TxAdvertVector {
26618    #[must_use]
26619    fn as_ref(&self) -> &Vec<Hash> {
26620        &self.0 .0
26621    }
26622}
26623
26624impl AsRef<[Hash]> for TxAdvertVector {
26625    #[cfg(feature = "alloc")]
26626    #[must_use]
26627    fn as_ref(&self) -> &[Hash] {
26628        &self.0 .0
26629    }
26630    #[cfg(not(feature = "alloc"))]
26631    #[must_use]
26632    fn as_ref(&self) -> &[Hash] {
26633        self.0 .0
26634    }
26635}
26636
26637/// FloodAdvert is an XDR Struct defines as:
26638///
26639/// ```text
26640/// struct FloodAdvert
26641/// {
26642///     TxAdvertVector txHashes;
26643/// };
26644/// ```
26645///
26646#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
26647#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
26648#[cfg_attr(
26649    all(feature = "serde", feature = "alloc"),
26650    derive(serde::Serialize, serde::Deserialize),
26651    serde(rename_all = "snake_case")
26652)]
26653#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
26654pub struct FloodAdvert {
26655    pub tx_hashes: TxAdvertVector,
26656}
26657
26658impl ReadXdr for FloodAdvert {
26659    #[cfg(feature = "std")]
26660    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
26661        r.with_limited_depth(|r| {
26662            Ok(Self {
26663                tx_hashes: TxAdvertVector::read_xdr(r)?,
26664            })
26665        })
26666    }
26667}
26668
26669impl WriteXdr for FloodAdvert {
26670    #[cfg(feature = "std")]
26671    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
26672        w.with_limited_depth(|w| {
26673            self.tx_hashes.write_xdr(w)?;
26674            Ok(())
26675        })
26676    }
26677}
26678
26679/// TxDemandVectorMaxSize is an XDR Const defines as:
26680///
26681/// ```text
26682/// const TX_DEMAND_VECTOR_MAX_SIZE = 1000;
26683/// ```
26684///
26685pub const TX_DEMAND_VECTOR_MAX_SIZE: u64 = 1000;
26686
26687/// TxDemandVector is an XDR Typedef defines as:
26688///
26689/// ```text
26690/// typedef Hash TxDemandVector<TX_DEMAND_VECTOR_MAX_SIZE>;
26691/// ```
26692///
26693#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
26694#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
26695#[derive(Default)]
26696#[cfg_attr(
26697    all(feature = "serde", feature = "alloc"),
26698    derive(serde::Serialize, serde::Deserialize),
26699    serde(rename_all = "snake_case")
26700)]
26701#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
26702#[derive(Debug)]
26703pub struct TxDemandVector(pub VecM<Hash, 1000>);
26704
26705impl From<TxDemandVector> for VecM<Hash, 1000> {
26706    #[must_use]
26707    fn from(x: TxDemandVector) -> Self {
26708        x.0
26709    }
26710}
26711
26712impl From<VecM<Hash, 1000>> for TxDemandVector {
26713    #[must_use]
26714    fn from(x: VecM<Hash, 1000>) -> Self {
26715        TxDemandVector(x)
26716    }
26717}
26718
26719impl AsRef<VecM<Hash, 1000>> for TxDemandVector {
26720    #[must_use]
26721    fn as_ref(&self) -> &VecM<Hash, 1000> {
26722        &self.0
26723    }
26724}
26725
26726impl ReadXdr for TxDemandVector {
26727    #[cfg(feature = "std")]
26728    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
26729        r.with_limited_depth(|r| {
26730            let i = VecM::<Hash, 1000>::read_xdr(r)?;
26731            let v = TxDemandVector(i);
26732            Ok(v)
26733        })
26734    }
26735}
26736
26737impl WriteXdr for TxDemandVector {
26738    #[cfg(feature = "std")]
26739    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
26740        w.with_limited_depth(|w| self.0.write_xdr(w))
26741    }
26742}
26743
26744impl Deref for TxDemandVector {
26745    type Target = VecM<Hash, 1000>;
26746    fn deref(&self) -> &Self::Target {
26747        &self.0
26748    }
26749}
26750
26751impl From<TxDemandVector> for Vec<Hash> {
26752    #[must_use]
26753    fn from(x: TxDemandVector) -> Self {
26754        x.0 .0
26755    }
26756}
26757
26758impl TryFrom<Vec<Hash>> for TxDemandVector {
26759    type Error = Error;
26760    fn try_from(x: Vec<Hash>) -> Result<Self> {
26761        Ok(TxDemandVector(x.try_into()?))
26762    }
26763}
26764
26765#[cfg(feature = "alloc")]
26766impl TryFrom<&Vec<Hash>> for TxDemandVector {
26767    type Error = Error;
26768    fn try_from(x: &Vec<Hash>) -> Result<Self> {
26769        Ok(TxDemandVector(x.try_into()?))
26770    }
26771}
26772
26773impl AsRef<Vec<Hash>> for TxDemandVector {
26774    #[must_use]
26775    fn as_ref(&self) -> &Vec<Hash> {
26776        &self.0 .0
26777    }
26778}
26779
26780impl AsRef<[Hash]> for TxDemandVector {
26781    #[cfg(feature = "alloc")]
26782    #[must_use]
26783    fn as_ref(&self) -> &[Hash] {
26784        &self.0 .0
26785    }
26786    #[cfg(not(feature = "alloc"))]
26787    #[must_use]
26788    fn as_ref(&self) -> &[Hash] {
26789        self.0 .0
26790    }
26791}
26792
26793/// FloodDemand is an XDR Struct defines as:
26794///
26795/// ```text
26796/// struct FloodDemand
26797/// {
26798///     TxDemandVector txHashes;
26799/// };
26800/// ```
26801///
26802#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
26803#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
26804#[cfg_attr(
26805    all(feature = "serde", feature = "alloc"),
26806    derive(serde::Serialize, serde::Deserialize),
26807    serde(rename_all = "snake_case")
26808)]
26809#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
26810pub struct FloodDemand {
26811    pub tx_hashes: TxDemandVector,
26812}
26813
26814impl ReadXdr for FloodDemand {
26815    #[cfg(feature = "std")]
26816    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
26817        r.with_limited_depth(|r| {
26818            Ok(Self {
26819                tx_hashes: TxDemandVector::read_xdr(r)?,
26820            })
26821        })
26822    }
26823}
26824
26825impl WriteXdr for FloodDemand {
26826    #[cfg(feature = "std")]
26827    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
26828        w.with_limited_depth(|w| {
26829            self.tx_hashes.write_xdr(w)?;
26830            Ok(())
26831        })
26832    }
26833}
26834
26835/// StellarMessage is an XDR Union defines as:
26836///
26837/// ```text
26838/// union StellarMessage switch (MessageType type)
26839/// {
26840/// case ERROR_MSG:
26841///     Error error;
26842/// case HELLO:
26843///     Hello hello;
26844/// case AUTH:
26845///     Auth auth;
26846/// case DONT_HAVE:
26847///     DontHave dontHave;
26848/// case GET_PEERS:
26849///     void;
26850/// case PEERS:
26851///     PeerAddress peers<100>;
26852///
26853/// case GET_TX_SET:
26854///     uint256 txSetHash;
26855/// case TX_SET:
26856///     TransactionSet txSet;
26857/// case GENERALIZED_TX_SET:
26858///     GeneralizedTransactionSet generalizedTxSet;
26859///
26860/// case TRANSACTION:
26861///     TransactionEnvelope transaction;
26862///
26863/// case SURVEY_REQUEST:
26864///     SignedSurveyRequestMessage signedSurveyRequestMessage;
26865///
26866/// case SURVEY_RESPONSE:
26867///     SignedSurveyResponseMessage signedSurveyResponseMessage;
26868///
26869/// case TIME_SLICED_SURVEY_REQUEST:
26870///     SignedTimeSlicedSurveyRequestMessage signedTimeSlicedSurveyRequestMessage;
26871///
26872/// case TIME_SLICED_SURVEY_RESPONSE:
26873///     SignedTimeSlicedSurveyResponseMessage signedTimeSlicedSurveyResponseMessage;
26874///
26875/// case TIME_SLICED_SURVEY_START_COLLECTING:
26876///     SignedTimeSlicedSurveyStartCollectingMessage
26877///         signedTimeSlicedSurveyStartCollectingMessage;
26878///
26879/// case TIME_SLICED_SURVEY_STOP_COLLECTING:
26880///     SignedTimeSlicedSurveyStopCollectingMessage
26881///         signedTimeSlicedSurveyStopCollectingMessage;
26882///
26883/// // SCP
26884/// case GET_SCP_QUORUMSET:
26885///     uint256 qSetHash;
26886/// case SCP_QUORUMSET:
26887///     SCPQuorumSet qSet;
26888/// case SCP_MESSAGE:
26889///     SCPEnvelope envelope;
26890/// case GET_SCP_STATE:
26891///     uint32 getSCPLedgerSeq; // ledger seq requested ; if 0, requests the latest
26892/// case SEND_MORE:
26893///     SendMore sendMoreMessage;
26894/// case SEND_MORE_EXTENDED:
26895///     SendMoreExtended sendMoreExtendedMessage;
26896/// // Pull mode
26897/// case FLOOD_ADVERT:
26898///      FloodAdvert floodAdvert;
26899/// case FLOOD_DEMAND:
26900///      FloodDemand floodDemand;
26901/// };
26902/// ```
26903///
26904// union with discriminant MessageType
26905#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
26906#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
26907#[cfg_attr(
26908    all(feature = "serde", feature = "alloc"),
26909    derive(serde::Serialize, serde::Deserialize),
26910    serde(rename_all = "snake_case")
26911)]
26912#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
26913#[allow(clippy::large_enum_variant)]
26914pub enum StellarMessage {
26915    ErrorMsg(SError),
26916    Hello(Hello),
26917    Auth(Auth),
26918    DontHave(DontHave),
26919    GetPeers,
26920    Peers(VecM<PeerAddress, 100>),
26921    GetTxSet(Uint256),
26922    TxSet(TransactionSet),
26923    GeneralizedTxSet(GeneralizedTransactionSet),
26924    Transaction(TransactionEnvelope),
26925    SurveyRequest(SignedSurveyRequestMessage),
26926    SurveyResponse(SignedSurveyResponseMessage),
26927    TimeSlicedSurveyRequest(SignedTimeSlicedSurveyRequestMessage),
26928    TimeSlicedSurveyResponse(SignedTimeSlicedSurveyResponseMessage),
26929    TimeSlicedSurveyStartCollecting(SignedTimeSlicedSurveyStartCollectingMessage),
26930    TimeSlicedSurveyStopCollecting(SignedTimeSlicedSurveyStopCollectingMessage),
26931    GetScpQuorumset(Uint256),
26932    ScpQuorumset(ScpQuorumSet),
26933    ScpMessage(ScpEnvelope),
26934    GetScpState(u32),
26935    SendMore(SendMore),
26936    SendMoreExtended(SendMoreExtended),
26937    FloodAdvert(FloodAdvert),
26938    FloodDemand(FloodDemand),
26939}
26940
26941impl StellarMessage {
26942    pub const VARIANTS: [MessageType; 24] = [
26943        MessageType::ErrorMsg,
26944        MessageType::Hello,
26945        MessageType::Auth,
26946        MessageType::DontHave,
26947        MessageType::GetPeers,
26948        MessageType::Peers,
26949        MessageType::GetTxSet,
26950        MessageType::TxSet,
26951        MessageType::GeneralizedTxSet,
26952        MessageType::Transaction,
26953        MessageType::SurveyRequest,
26954        MessageType::SurveyResponse,
26955        MessageType::TimeSlicedSurveyRequest,
26956        MessageType::TimeSlicedSurveyResponse,
26957        MessageType::TimeSlicedSurveyStartCollecting,
26958        MessageType::TimeSlicedSurveyStopCollecting,
26959        MessageType::GetScpQuorumset,
26960        MessageType::ScpQuorumset,
26961        MessageType::ScpMessage,
26962        MessageType::GetScpState,
26963        MessageType::SendMore,
26964        MessageType::SendMoreExtended,
26965        MessageType::FloodAdvert,
26966        MessageType::FloodDemand,
26967    ];
26968    pub const VARIANTS_STR: [&'static str; 24] = [
26969        "ErrorMsg",
26970        "Hello",
26971        "Auth",
26972        "DontHave",
26973        "GetPeers",
26974        "Peers",
26975        "GetTxSet",
26976        "TxSet",
26977        "GeneralizedTxSet",
26978        "Transaction",
26979        "SurveyRequest",
26980        "SurveyResponse",
26981        "TimeSlicedSurveyRequest",
26982        "TimeSlicedSurveyResponse",
26983        "TimeSlicedSurveyStartCollecting",
26984        "TimeSlicedSurveyStopCollecting",
26985        "GetScpQuorumset",
26986        "ScpQuorumset",
26987        "ScpMessage",
26988        "GetScpState",
26989        "SendMore",
26990        "SendMoreExtended",
26991        "FloodAdvert",
26992        "FloodDemand",
26993    ];
26994
26995    #[must_use]
26996    pub const fn name(&self) -> &'static str {
26997        match self {
26998            Self::ErrorMsg(_) => "ErrorMsg",
26999            Self::Hello(_) => "Hello",
27000            Self::Auth(_) => "Auth",
27001            Self::DontHave(_) => "DontHave",
27002            Self::GetPeers => "GetPeers",
27003            Self::Peers(_) => "Peers",
27004            Self::GetTxSet(_) => "GetTxSet",
27005            Self::TxSet(_) => "TxSet",
27006            Self::GeneralizedTxSet(_) => "GeneralizedTxSet",
27007            Self::Transaction(_) => "Transaction",
27008            Self::SurveyRequest(_) => "SurveyRequest",
27009            Self::SurveyResponse(_) => "SurveyResponse",
27010            Self::TimeSlicedSurveyRequest(_) => "TimeSlicedSurveyRequest",
27011            Self::TimeSlicedSurveyResponse(_) => "TimeSlicedSurveyResponse",
27012            Self::TimeSlicedSurveyStartCollecting(_) => "TimeSlicedSurveyStartCollecting",
27013            Self::TimeSlicedSurveyStopCollecting(_) => "TimeSlicedSurveyStopCollecting",
27014            Self::GetScpQuorumset(_) => "GetScpQuorumset",
27015            Self::ScpQuorumset(_) => "ScpQuorumset",
27016            Self::ScpMessage(_) => "ScpMessage",
27017            Self::GetScpState(_) => "GetScpState",
27018            Self::SendMore(_) => "SendMore",
27019            Self::SendMoreExtended(_) => "SendMoreExtended",
27020            Self::FloodAdvert(_) => "FloodAdvert",
27021            Self::FloodDemand(_) => "FloodDemand",
27022        }
27023    }
27024
27025    #[must_use]
27026    pub const fn discriminant(&self) -> MessageType {
27027        #[allow(clippy::match_same_arms)]
27028        match self {
27029            Self::ErrorMsg(_) => MessageType::ErrorMsg,
27030            Self::Hello(_) => MessageType::Hello,
27031            Self::Auth(_) => MessageType::Auth,
27032            Self::DontHave(_) => MessageType::DontHave,
27033            Self::GetPeers => MessageType::GetPeers,
27034            Self::Peers(_) => MessageType::Peers,
27035            Self::GetTxSet(_) => MessageType::GetTxSet,
27036            Self::TxSet(_) => MessageType::TxSet,
27037            Self::GeneralizedTxSet(_) => MessageType::GeneralizedTxSet,
27038            Self::Transaction(_) => MessageType::Transaction,
27039            Self::SurveyRequest(_) => MessageType::SurveyRequest,
27040            Self::SurveyResponse(_) => MessageType::SurveyResponse,
27041            Self::TimeSlicedSurveyRequest(_) => MessageType::TimeSlicedSurveyRequest,
27042            Self::TimeSlicedSurveyResponse(_) => MessageType::TimeSlicedSurveyResponse,
27043            Self::TimeSlicedSurveyStartCollecting(_) => {
27044                MessageType::TimeSlicedSurveyStartCollecting
27045            }
27046            Self::TimeSlicedSurveyStopCollecting(_) => MessageType::TimeSlicedSurveyStopCollecting,
27047            Self::GetScpQuorumset(_) => MessageType::GetScpQuorumset,
27048            Self::ScpQuorumset(_) => MessageType::ScpQuorumset,
27049            Self::ScpMessage(_) => MessageType::ScpMessage,
27050            Self::GetScpState(_) => MessageType::GetScpState,
27051            Self::SendMore(_) => MessageType::SendMore,
27052            Self::SendMoreExtended(_) => MessageType::SendMoreExtended,
27053            Self::FloodAdvert(_) => MessageType::FloodAdvert,
27054            Self::FloodDemand(_) => MessageType::FloodDemand,
27055        }
27056    }
27057
27058    #[must_use]
27059    pub const fn variants() -> [MessageType; 24] {
27060        Self::VARIANTS
27061    }
27062}
27063
27064impl Name for StellarMessage {
27065    #[must_use]
27066    fn name(&self) -> &'static str {
27067        Self::name(self)
27068    }
27069}
27070
27071impl Discriminant<MessageType> for StellarMessage {
27072    #[must_use]
27073    fn discriminant(&self) -> MessageType {
27074        Self::discriminant(self)
27075    }
27076}
27077
27078impl Variants<MessageType> for StellarMessage {
27079    fn variants() -> slice::Iter<'static, MessageType> {
27080        Self::VARIANTS.iter()
27081    }
27082}
27083
27084impl Union<MessageType> for StellarMessage {}
27085
27086impl ReadXdr for StellarMessage {
27087    #[cfg(feature = "std")]
27088    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
27089        r.with_limited_depth(|r| {
27090            let dv: MessageType = <MessageType as ReadXdr>::read_xdr(r)?;
27091            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
27092            let v = match dv {
27093                MessageType::ErrorMsg => Self::ErrorMsg(SError::read_xdr(r)?),
27094                MessageType::Hello => Self::Hello(Hello::read_xdr(r)?),
27095                MessageType::Auth => Self::Auth(Auth::read_xdr(r)?),
27096                MessageType::DontHave => Self::DontHave(DontHave::read_xdr(r)?),
27097                MessageType::GetPeers => Self::GetPeers,
27098                MessageType::Peers => Self::Peers(VecM::<PeerAddress, 100>::read_xdr(r)?),
27099                MessageType::GetTxSet => Self::GetTxSet(Uint256::read_xdr(r)?),
27100                MessageType::TxSet => Self::TxSet(TransactionSet::read_xdr(r)?),
27101                MessageType::GeneralizedTxSet => {
27102                    Self::GeneralizedTxSet(GeneralizedTransactionSet::read_xdr(r)?)
27103                }
27104                MessageType::Transaction => Self::Transaction(TransactionEnvelope::read_xdr(r)?),
27105                MessageType::SurveyRequest => {
27106                    Self::SurveyRequest(SignedSurveyRequestMessage::read_xdr(r)?)
27107                }
27108                MessageType::SurveyResponse => {
27109                    Self::SurveyResponse(SignedSurveyResponseMessage::read_xdr(r)?)
27110                }
27111                MessageType::TimeSlicedSurveyRequest => Self::TimeSlicedSurveyRequest(
27112                    SignedTimeSlicedSurveyRequestMessage::read_xdr(r)?,
27113                ),
27114                MessageType::TimeSlicedSurveyResponse => Self::TimeSlicedSurveyResponse(
27115                    SignedTimeSlicedSurveyResponseMessage::read_xdr(r)?,
27116                ),
27117                MessageType::TimeSlicedSurveyStartCollecting => {
27118                    Self::TimeSlicedSurveyStartCollecting(
27119                        SignedTimeSlicedSurveyStartCollectingMessage::read_xdr(r)?,
27120                    )
27121                }
27122                MessageType::TimeSlicedSurveyStopCollecting => {
27123                    Self::TimeSlicedSurveyStopCollecting(
27124                        SignedTimeSlicedSurveyStopCollectingMessage::read_xdr(r)?,
27125                    )
27126                }
27127                MessageType::GetScpQuorumset => Self::GetScpQuorumset(Uint256::read_xdr(r)?),
27128                MessageType::ScpQuorumset => Self::ScpQuorumset(ScpQuorumSet::read_xdr(r)?),
27129                MessageType::ScpMessage => Self::ScpMessage(ScpEnvelope::read_xdr(r)?),
27130                MessageType::GetScpState => Self::GetScpState(u32::read_xdr(r)?),
27131                MessageType::SendMore => Self::SendMore(SendMore::read_xdr(r)?),
27132                MessageType::SendMoreExtended => {
27133                    Self::SendMoreExtended(SendMoreExtended::read_xdr(r)?)
27134                }
27135                MessageType::FloodAdvert => Self::FloodAdvert(FloodAdvert::read_xdr(r)?),
27136                MessageType::FloodDemand => Self::FloodDemand(FloodDemand::read_xdr(r)?),
27137                #[allow(unreachable_patterns)]
27138                _ => return Err(Error::Invalid),
27139            };
27140            Ok(v)
27141        })
27142    }
27143}
27144
27145impl WriteXdr for StellarMessage {
27146    #[cfg(feature = "std")]
27147    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
27148        w.with_limited_depth(|w| {
27149            self.discriminant().write_xdr(w)?;
27150            #[allow(clippy::match_same_arms)]
27151            match self {
27152                Self::ErrorMsg(v) => v.write_xdr(w)?,
27153                Self::Hello(v) => v.write_xdr(w)?,
27154                Self::Auth(v) => v.write_xdr(w)?,
27155                Self::DontHave(v) => v.write_xdr(w)?,
27156                Self::GetPeers => ().write_xdr(w)?,
27157                Self::Peers(v) => v.write_xdr(w)?,
27158                Self::GetTxSet(v) => v.write_xdr(w)?,
27159                Self::TxSet(v) => v.write_xdr(w)?,
27160                Self::GeneralizedTxSet(v) => v.write_xdr(w)?,
27161                Self::Transaction(v) => v.write_xdr(w)?,
27162                Self::SurveyRequest(v) => v.write_xdr(w)?,
27163                Self::SurveyResponse(v) => v.write_xdr(w)?,
27164                Self::TimeSlicedSurveyRequest(v) => v.write_xdr(w)?,
27165                Self::TimeSlicedSurveyResponse(v) => v.write_xdr(w)?,
27166                Self::TimeSlicedSurveyStartCollecting(v) => v.write_xdr(w)?,
27167                Self::TimeSlicedSurveyStopCollecting(v) => v.write_xdr(w)?,
27168                Self::GetScpQuorumset(v) => v.write_xdr(w)?,
27169                Self::ScpQuorumset(v) => v.write_xdr(w)?,
27170                Self::ScpMessage(v) => v.write_xdr(w)?,
27171                Self::GetScpState(v) => v.write_xdr(w)?,
27172                Self::SendMore(v) => v.write_xdr(w)?,
27173                Self::SendMoreExtended(v) => v.write_xdr(w)?,
27174                Self::FloodAdvert(v) => v.write_xdr(w)?,
27175                Self::FloodDemand(v) => v.write_xdr(w)?,
27176            };
27177            Ok(())
27178        })
27179    }
27180}
27181
27182/// AuthenticatedMessageV0 is an XDR NestedStruct defines as:
27183///
27184/// ```text
27185/// struct
27186///     {
27187///         uint64 sequence;
27188///         StellarMessage message;
27189///         HmacSha256Mac mac;
27190///     }
27191/// ```
27192///
27193#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
27194#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
27195#[cfg_attr(
27196    all(feature = "serde", feature = "alloc"),
27197    derive(serde::Serialize, serde::Deserialize),
27198    serde(rename_all = "snake_case")
27199)]
27200#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
27201pub struct AuthenticatedMessageV0 {
27202    pub sequence: u64,
27203    pub message: StellarMessage,
27204    pub mac: HmacSha256Mac,
27205}
27206
27207impl ReadXdr for AuthenticatedMessageV0 {
27208    #[cfg(feature = "std")]
27209    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
27210        r.with_limited_depth(|r| {
27211            Ok(Self {
27212                sequence: u64::read_xdr(r)?,
27213                message: StellarMessage::read_xdr(r)?,
27214                mac: HmacSha256Mac::read_xdr(r)?,
27215            })
27216        })
27217    }
27218}
27219
27220impl WriteXdr for AuthenticatedMessageV0 {
27221    #[cfg(feature = "std")]
27222    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
27223        w.with_limited_depth(|w| {
27224            self.sequence.write_xdr(w)?;
27225            self.message.write_xdr(w)?;
27226            self.mac.write_xdr(w)?;
27227            Ok(())
27228        })
27229    }
27230}
27231
27232/// AuthenticatedMessage is an XDR Union defines as:
27233///
27234/// ```text
27235/// union AuthenticatedMessage switch (uint32 v)
27236/// {
27237/// case 0:
27238///     struct
27239///     {
27240///         uint64 sequence;
27241///         StellarMessage message;
27242///         HmacSha256Mac mac;
27243///     } v0;
27244/// };
27245/// ```
27246///
27247// union with discriminant u32
27248#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
27249#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
27250#[cfg_attr(
27251    all(feature = "serde", feature = "alloc"),
27252    derive(serde::Serialize, serde::Deserialize),
27253    serde(rename_all = "snake_case")
27254)]
27255#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
27256#[allow(clippy::large_enum_variant)]
27257pub enum AuthenticatedMessage {
27258    V0(AuthenticatedMessageV0),
27259}
27260
27261impl AuthenticatedMessage {
27262    pub const VARIANTS: [u32; 1] = [0];
27263    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
27264
27265    #[must_use]
27266    pub const fn name(&self) -> &'static str {
27267        match self {
27268            Self::V0(_) => "V0",
27269        }
27270    }
27271
27272    #[must_use]
27273    pub const fn discriminant(&self) -> u32 {
27274        #[allow(clippy::match_same_arms)]
27275        match self {
27276            Self::V0(_) => 0,
27277        }
27278    }
27279
27280    #[must_use]
27281    pub const fn variants() -> [u32; 1] {
27282        Self::VARIANTS
27283    }
27284}
27285
27286impl Name for AuthenticatedMessage {
27287    #[must_use]
27288    fn name(&self) -> &'static str {
27289        Self::name(self)
27290    }
27291}
27292
27293impl Discriminant<u32> for AuthenticatedMessage {
27294    #[must_use]
27295    fn discriminant(&self) -> u32 {
27296        Self::discriminant(self)
27297    }
27298}
27299
27300impl Variants<u32> for AuthenticatedMessage {
27301    fn variants() -> slice::Iter<'static, u32> {
27302        Self::VARIANTS.iter()
27303    }
27304}
27305
27306impl Union<u32> for AuthenticatedMessage {}
27307
27308impl ReadXdr for AuthenticatedMessage {
27309    #[cfg(feature = "std")]
27310    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
27311        r.with_limited_depth(|r| {
27312            let dv: u32 = <u32 as ReadXdr>::read_xdr(r)?;
27313            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
27314            let v = match dv {
27315                0 => Self::V0(AuthenticatedMessageV0::read_xdr(r)?),
27316                #[allow(unreachable_patterns)]
27317                _ => return Err(Error::Invalid),
27318            };
27319            Ok(v)
27320        })
27321    }
27322}
27323
27324impl WriteXdr for AuthenticatedMessage {
27325    #[cfg(feature = "std")]
27326    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
27327        w.with_limited_depth(|w| {
27328            self.discriminant().write_xdr(w)?;
27329            #[allow(clippy::match_same_arms)]
27330            match self {
27331                Self::V0(v) => v.write_xdr(w)?,
27332            };
27333            Ok(())
27334        })
27335    }
27336}
27337
27338/// MaxOpsPerTx is an XDR Const defines as:
27339///
27340/// ```text
27341/// const MAX_OPS_PER_TX = 100;
27342/// ```
27343///
27344pub const MAX_OPS_PER_TX: u64 = 100;
27345
27346/// LiquidityPoolParameters is an XDR Union defines as:
27347///
27348/// ```text
27349/// union LiquidityPoolParameters switch (LiquidityPoolType type)
27350/// {
27351/// case LIQUIDITY_POOL_CONSTANT_PRODUCT:
27352///     LiquidityPoolConstantProductParameters constantProduct;
27353/// };
27354/// ```
27355///
27356// union with discriminant LiquidityPoolType
27357#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
27358#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
27359#[cfg_attr(
27360    all(feature = "serde", feature = "alloc"),
27361    derive(serde::Serialize, serde::Deserialize),
27362    serde(rename_all = "snake_case")
27363)]
27364#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
27365#[allow(clippy::large_enum_variant)]
27366pub enum LiquidityPoolParameters {
27367    LiquidityPoolConstantProduct(LiquidityPoolConstantProductParameters),
27368}
27369
27370impl LiquidityPoolParameters {
27371    pub const VARIANTS: [LiquidityPoolType; 1] = [LiquidityPoolType::LiquidityPoolConstantProduct];
27372    pub const VARIANTS_STR: [&'static str; 1] = ["LiquidityPoolConstantProduct"];
27373
27374    #[must_use]
27375    pub const fn name(&self) -> &'static str {
27376        match self {
27377            Self::LiquidityPoolConstantProduct(_) => "LiquidityPoolConstantProduct",
27378        }
27379    }
27380
27381    #[must_use]
27382    pub const fn discriminant(&self) -> LiquidityPoolType {
27383        #[allow(clippy::match_same_arms)]
27384        match self {
27385            Self::LiquidityPoolConstantProduct(_) => {
27386                LiquidityPoolType::LiquidityPoolConstantProduct
27387            }
27388        }
27389    }
27390
27391    #[must_use]
27392    pub const fn variants() -> [LiquidityPoolType; 1] {
27393        Self::VARIANTS
27394    }
27395}
27396
27397impl Name for LiquidityPoolParameters {
27398    #[must_use]
27399    fn name(&self) -> &'static str {
27400        Self::name(self)
27401    }
27402}
27403
27404impl Discriminant<LiquidityPoolType> for LiquidityPoolParameters {
27405    #[must_use]
27406    fn discriminant(&self) -> LiquidityPoolType {
27407        Self::discriminant(self)
27408    }
27409}
27410
27411impl Variants<LiquidityPoolType> for LiquidityPoolParameters {
27412    fn variants() -> slice::Iter<'static, LiquidityPoolType> {
27413        Self::VARIANTS.iter()
27414    }
27415}
27416
27417impl Union<LiquidityPoolType> for LiquidityPoolParameters {}
27418
27419impl ReadXdr for LiquidityPoolParameters {
27420    #[cfg(feature = "std")]
27421    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
27422        r.with_limited_depth(|r| {
27423            let dv: LiquidityPoolType = <LiquidityPoolType as ReadXdr>::read_xdr(r)?;
27424            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
27425            let v = match dv {
27426                LiquidityPoolType::LiquidityPoolConstantProduct => {
27427                    Self::LiquidityPoolConstantProduct(
27428                        LiquidityPoolConstantProductParameters::read_xdr(r)?,
27429                    )
27430                }
27431                #[allow(unreachable_patterns)]
27432                _ => return Err(Error::Invalid),
27433            };
27434            Ok(v)
27435        })
27436    }
27437}
27438
27439impl WriteXdr for LiquidityPoolParameters {
27440    #[cfg(feature = "std")]
27441    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
27442        w.with_limited_depth(|w| {
27443            self.discriminant().write_xdr(w)?;
27444            #[allow(clippy::match_same_arms)]
27445            match self {
27446                Self::LiquidityPoolConstantProduct(v) => v.write_xdr(w)?,
27447            };
27448            Ok(())
27449        })
27450    }
27451}
27452
27453/// MuxedAccountMed25519 is an XDR NestedStruct defines as:
27454///
27455/// ```text
27456/// struct
27457///     {
27458///         uint64 id;
27459///         uint256 ed25519;
27460///     }
27461/// ```
27462///
27463#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
27464#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
27465#[cfg_attr(
27466    all(feature = "serde", feature = "alloc"),
27467    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
27468)]
27469pub struct MuxedAccountMed25519 {
27470    pub id: u64,
27471    pub ed25519: Uint256,
27472}
27473
27474impl ReadXdr for MuxedAccountMed25519 {
27475    #[cfg(feature = "std")]
27476    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
27477        r.with_limited_depth(|r| {
27478            Ok(Self {
27479                id: u64::read_xdr(r)?,
27480                ed25519: Uint256::read_xdr(r)?,
27481            })
27482        })
27483    }
27484}
27485
27486impl WriteXdr for MuxedAccountMed25519 {
27487    #[cfg(feature = "std")]
27488    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
27489        w.with_limited_depth(|w| {
27490            self.id.write_xdr(w)?;
27491            self.ed25519.write_xdr(w)?;
27492            Ok(())
27493        })
27494    }
27495}
27496
27497/// MuxedAccount is an XDR Union defines as:
27498///
27499/// ```text
27500/// union MuxedAccount switch (CryptoKeyType type)
27501/// {
27502/// case KEY_TYPE_ED25519:
27503///     uint256 ed25519;
27504/// case KEY_TYPE_MUXED_ED25519:
27505///     struct
27506///     {
27507///         uint64 id;
27508///         uint256 ed25519;
27509///     } med25519;
27510/// };
27511/// ```
27512///
27513// union with discriminant CryptoKeyType
27514#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
27515#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
27516#[cfg_attr(
27517    all(feature = "serde", feature = "alloc"),
27518    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
27519)]
27520#[allow(clippy::large_enum_variant)]
27521pub enum MuxedAccount {
27522    Ed25519(Uint256),
27523    MuxedEd25519(MuxedAccountMed25519),
27524}
27525
27526impl MuxedAccount {
27527    pub const VARIANTS: [CryptoKeyType; 2] = [CryptoKeyType::Ed25519, CryptoKeyType::MuxedEd25519];
27528    pub const VARIANTS_STR: [&'static str; 2] = ["Ed25519", "MuxedEd25519"];
27529
27530    #[must_use]
27531    pub const fn name(&self) -> &'static str {
27532        match self {
27533            Self::Ed25519(_) => "Ed25519",
27534            Self::MuxedEd25519(_) => "MuxedEd25519",
27535        }
27536    }
27537
27538    #[must_use]
27539    pub const fn discriminant(&self) -> CryptoKeyType {
27540        #[allow(clippy::match_same_arms)]
27541        match self {
27542            Self::Ed25519(_) => CryptoKeyType::Ed25519,
27543            Self::MuxedEd25519(_) => CryptoKeyType::MuxedEd25519,
27544        }
27545    }
27546
27547    #[must_use]
27548    pub const fn variants() -> [CryptoKeyType; 2] {
27549        Self::VARIANTS
27550    }
27551}
27552
27553impl Name for MuxedAccount {
27554    #[must_use]
27555    fn name(&self) -> &'static str {
27556        Self::name(self)
27557    }
27558}
27559
27560impl Discriminant<CryptoKeyType> for MuxedAccount {
27561    #[must_use]
27562    fn discriminant(&self) -> CryptoKeyType {
27563        Self::discriminant(self)
27564    }
27565}
27566
27567impl Variants<CryptoKeyType> for MuxedAccount {
27568    fn variants() -> slice::Iter<'static, CryptoKeyType> {
27569        Self::VARIANTS.iter()
27570    }
27571}
27572
27573impl Union<CryptoKeyType> for MuxedAccount {}
27574
27575impl ReadXdr for MuxedAccount {
27576    #[cfg(feature = "std")]
27577    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
27578        r.with_limited_depth(|r| {
27579            let dv: CryptoKeyType = <CryptoKeyType as ReadXdr>::read_xdr(r)?;
27580            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
27581            let v = match dv {
27582                CryptoKeyType::Ed25519 => Self::Ed25519(Uint256::read_xdr(r)?),
27583                CryptoKeyType::MuxedEd25519 => {
27584                    Self::MuxedEd25519(MuxedAccountMed25519::read_xdr(r)?)
27585                }
27586                #[allow(unreachable_patterns)]
27587                _ => return Err(Error::Invalid),
27588            };
27589            Ok(v)
27590        })
27591    }
27592}
27593
27594impl WriteXdr for MuxedAccount {
27595    #[cfg(feature = "std")]
27596    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
27597        w.with_limited_depth(|w| {
27598            self.discriminant().write_xdr(w)?;
27599            #[allow(clippy::match_same_arms)]
27600            match self {
27601                Self::Ed25519(v) => v.write_xdr(w)?,
27602                Self::MuxedEd25519(v) => v.write_xdr(w)?,
27603            };
27604            Ok(())
27605        })
27606    }
27607}
27608
27609/// DecoratedSignature is an XDR Struct defines as:
27610///
27611/// ```text
27612/// struct DecoratedSignature
27613/// {
27614///     SignatureHint hint;  // last 4 bytes of the public key, used as a hint
27615///     Signature signature; // actual signature
27616/// };
27617/// ```
27618///
27619#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
27620#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
27621#[cfg_attr(
27622    all(feature = "serde", feature = "alloc"),
27623    derive(serde::Serialize, serde::Deserialize),
27624    serde(rename_all = "snake_case")
27625)]
27626#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
27627pub struct DecoratedSignature {
27628    pub hint: SignatureHint,
27629    pub signature: Signature,
27630}
27631
27632impl ReadXdr for DecoratedSignature {
27633    #[cfg(feature = "std")]
27634    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
27635        r.with_limited_depth(|r| {
27636            Ok(Self {
27637                hint: SignatureHint::read_xdr(r)?,
27638                signature: Signature::read_xdr(r)?,
27639            })
27640        })
27641    }
27642}
27643
27644impl WriteXdr for DecoratedSignature {
27645    #[cfg(feature = "std")]
27646    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
27647        w.with_limited_depth(|w| {
27648            self.hint.write_xdr(w)?;
27649            self.signature.write_xdr(w)?;
27650            Ok(())
27651        })
27652    }
27653}
27654
27655/// OperationType is an XDR Enum defines as:
27656///
27657/// ```text
27658/// enum OperationType
27659/// {
27660///     CREATE_ACCOUNT = 0,
27661///     PAYMENT = 1,
27662///     PATH_PAYMENT_STRICT_RECEIVE = 2,
27663///     MANAGE_SELL_OFFER = 3,
27664///     CREATE_PASSIVE_SELL_OFFER = 4,
27665///     SET_OPTIONS = 5,
27666///     CHANGE_TRUST = 6,
27667///     ALLOW_TRUST = 7,
27668///     ACCOUNT_MERGE = 8,
27669///     INFLATION = 9,
27670///     MANAGE_DATA = 10,
27671///     BUMP_SEQUENCE = 11,
27672///     MANAGE_BUY_OFFER = 12,
27673///     PATH_PAYMENT_STRICT_SEND = 13,
27674///     CREATE_CLAIMABLE_BALANCE = 14,
27675///     CLAIM_CLAIMABLE_BALANCE = 15,
27676///     BEGIN_SPONSORING_FUTURE_RESERVES = 16,
27677///     END_SPONSORING_FUTURE_RESERVES = 17,
27678///     REVOKE_SPONSORSHIP = 18,
27679///     CLAWBACK = 19,
27680///     CLAWBACK_CLAIMABLE_BALANCE = 20,
27681///     SET_TRUST_LINE_FLAGS = 21,
27682///     LIQUIDITY_POOL_DEPOSIT = 22,
27683///     LIQUIDITY_POOL_WITHDRAW = 23,
27684///     INVOKE_HOST_FUNCTION = 24,
27685///     EXTEND_FOOTPRINT_TTL = 25,
27686///     RESTORE_FOOTPRINT = 26
27687/// };
27688/// ```
27689///
27690// enum
27691#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
27692#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
27693#[cfg_attr(
27694    all(feature = "serde", feature = "alloc"),
27695    derive(serde::Serialize, serde::Deserialize),
27696    serde(rename_all = "snake_case")
27697)]
27698#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
27699#[repr(i32)]
27700pub enum OperationType {
27701    CreateAccount = 0,
27702    Payment = 1,
27703    PathPaymentStrictReceive = 2,
27704    ManageSellOffer = 3,
27705    CreatePassiveSellOffer = 4,
27706    SetOptions = 5,
27707    ChangeTrust = 6,
27708    AllowTrust = 7,
27709    AccountMerge = 8,
27710    Inflation = 9,
27711    ManageData = 10,
27712    BumpSequence = 11,
27713    ManageBuyOffer = 12,
27714    PathPaymentStrictSend = 13,
27715    CreateClaimableBalance = 14,
27716    ClaimClaimableBalance = 15,
27717    BeginSponsoringFutureReserves = 16,
27718    EndSponsoringFutureReserves = 17,
27719    RevokeSponsorship = 18,
27720    Clawback = 19,
27721    ClawbackClaimableBalance = 20,
27722    SetTrustLineFlags = 21,
27723    LiquidityPoolDeposit = 22,
27724    LiquidityPoolWithdraw = 23,
27725    InvokeHostFunction = 24,
27726    ExtendFootprintTtl = 25,
27727    RestoreFootprint = 26,
27728}
27729
27730impl OperationType {
27731    pub const VARIANTS: [OperationType; 27] = [
27732        OperationType::CreateAccount,
27733        OperationType::Payment,
27734        OperationType::PathPaymentStrictReceive,
27735        OperationType::ManageSellOffer,
27736        OperationType::CreatePassiveSellOffer,
27737        OperationType::SetOptions,
27738        OperationType::ChangeTrust,
27739        OperationType::AllowTrust,
27740        OperationType::AccountMerge,
27741        OperationType::Inflation,
27742        OperationType::ManageData,
27743        OperationType::BumpSequence,
27744        OperationType::ManageBuyOffer,
27745        OperationType::PathPaymentStrictSend,
27746        OperationType::CreateClaimableBalance,
27747        OperationType::ClaimClaimableBalance,
27748        OperationType::BeginSponsoringFutureReserves,
27749        OperationType::EndSponsoringFutureReserves,
27750        OperationType::RevokeSponsorship,
27751        OperationType::Clawback,
27752        OperationType::ClawbackClaimableBalance,
27753        OperationType::SetTrustLineFlags,
27754        OperationType::LiquidityPoolDeposit,
27755        OperationType::LiquidityPoolWithdraw,
27756        OperationType::InvokeHostFunction,
27757        OperationType::ExtendFootprintTtl,
27758        OperationType::RestoreFootprint,
27759    ];
27760    pub const VARIANTS_STR: [&'static str; 27] = [
27761        "CreateAccount",
27762        "Payment",
27763        "PathPaymentStrictReceive",
27764        "ManageSellOffer",
27765        "CreatePassiveSellOffer",
27766        "SetOptions",
27767        "ChangeTrust",
27768        "AllowTrust",
27769        "AccountMerge",
27770        "Inflation",
27771        "ManageData",
27772        "BumpSequence",
27773        "ManageBuyOffer",
27774        "PathPaymentStrictSend",
27775        "CreateClaimableBalance",
27776        "ClaimClaimableBalance",
27777        "BeginSponsoringFutureReserves",
27778        "EndSponsoringFutureReserves",
27779        "RevokeSponsorship",
27780        "Clawback",
27781        "ClawbackClaimableBalance",
27782        "SetTrustLineFlags",
27783        "LiquidityPoolDeposit",
27784        "LiquidityPoolWithdraw",
27785        "InvokeHostFunction",
27786        "ExtendFootprintTtl",
27787        "RestoreFootprint",
27788    ];
27789
27790    #[must_use]
27791    pub const fn name(&self) -> &'static str {
27792        match self {
27793            Self::CreateAccount => "CreateAccount",
27794            Self::Payment => "Payment",
27795            Self::PathPaymentStrictReceive => "PathPaymentStrictReceive",
27796            Self::ManageSellOffer => "ManageSellOffer",
27797            Self::CreatePassiveSellOffer => "CreatePassiveSellOffer",
27798            Self::SetOptions => "SetOptions",
27799            Self::ChangeTrust => "ChangeTrust",
27800            Self::AllowTrust => "AllowTrust",
27801            Self::AccountMerge => "AccountMerge",
27802            Self::Inflation => "Inflation",
27803            Self::ManageData => "ManageData",
27804            Self::BumpSequence => "BumpSequence",
27805            Self::ManageBuyOffer => "ManageBuyOffer",
27806            Self::PathPaymentStrictSend => "PathPaymentStrictSend",
27807            Self::CreateClaimableBalance => "CreateClaimableBalance",
27808            Self::ClaimClaimableBalance => "ClaimClaimableBalance",
27809            Self::BeginSponsoringFutureReserves => "BeginSponsoringFutureReserves",
27810            Self::EndSponsoringFutureReserves => "EndSponsoringFutureReserves",
27811            Self::RevokeSponsorship => "RevokeSponsorship",
27812            Self::Clawback => "Clawback",
27813            Self::ClawbackClaimableBalance => "ClawbackClaimableBalance",
27814            Self::SetTrustLineFlags => "SetTrustLineFlags",
27815            Self::LiquidityPoolDeposit => "LiquidityPoolDeposit",
27816            Self::LiquidityPoolWithdraw => "LiquidityPoolWithdraw",
27817            Self::InvokeHostFunction => "InvokeHostFunction",
27818            Self::ExtendFootprintTtl => "ExtendFootprintTtl",
27819            Self::RestoreFootprint => "RestoreFootprint",
27820        }
27821    }
27822
27823    #[must_use]
27824    pub const fn variants() -> [OperationType; 27] {
27825        Self::VARIANTS
27826    }
27827}
27828
27829impl Name for OperationType {
27830    #[must_use]
27831    fn name(&self) -> &'static str {
27832        Self::name(self)
27833    }
27834}
27835
27836impl Variants<OperationType> for OperationType {
27837    fn variants() -> slice::Iter<'static, OperationType> {
27838        Self::VARIANTS.iter()
27839    }
27840}
27841
27842impl Enum for OperationType {}
27843
27844impl fmt::Display for OperationType {
27845    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
27846        f.write_str(self.name())
27847    }
27848}
27849
27850impl TryFrom<i32> for OperationType {
27851    type Error = Error;
27852
27853    fn try_from(i: i32) -> Result<Self> {
27854        let e = match i {
27855            0 => OperationType::CreateAccount,
27856            1 => OperationType::Payment,
27857            2 => OperationType::PathPaymentStrictReceive,
27858            3 => OperationType::ManageSellOffer,
27859            4 => OperationType::CreatePassiveSellOffer,
27860            5 => OperationType::SetOptions,
27861            6 => OperationType::ChangeTrust,
27862            7 => OperationType::AllowTrust,
27863            8 => OperationType::AccountMerge,
27864            9 => OperationType::Inflation,
27865            10 => OperationType::ManageData,
27866            11 => OperationType::BumpSequence,
27867            12 => OperationType::ManageBuyOffer,
27868            13 => OperationType::PathPaymentStrictSend,
27869            14 => OperationType::CreateClaimableBalance,
27870            15 => OperationType::ClaimClaimableBalance,
27871            16 => OperationType::BeginSponsoringFutureReserves,
27872            17 => OperationType::EndSponsoringFutureReserves,
27873            18 => OperationType::RevokeSponsorship,
27874            19 => OperationType::Clawback,
27875            20 => OperationType::ClawbackClaimableBalance,
27876            21 => OperationType::SetTrustLineFlags,
27877            22 => OperationType::LiquidityPoolDeposit,
27878            23 => OperationType::LiquidityPoolWithdraw,
27879            24 => OperationType::InvokeHostFunction,
27880            25 => OperationType::ExtendFootprintTtl,
27881            26 => OperationType::RestoreFootprint,
27882            #[allow(unreachable_patterns)]
27883            _ => return Err(Error::Invalid),
27884        };
27885        Ok(e)
27886    }
27887}
27888
27889impl From<OperationType> for i32 {
27890    #[must_use]
27891    fn from(e: OperationType) -> Self {
27892        e as Self
27893    }
27894}
27895
27896impl ReadXdr for OperationType {
27897    #[cfg(feature = "std")]
27898    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
27899        r.with_limited_depth(|r| {
27900            let e = i32::read_xdr(r)?;
27901            let v: Self = e.try_into()?;
27902            Ok(v)
27903        })
27904    }
27905}
27906
27907impl WriteXdr for OperationType {
27908    #[cfg(feature = "std")]
27909    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
27910        w.with_limited_depth(|w| {
27911            let i: i32 = (*self).into();
27912            i.write_xdr(w)
27913        })
27914    }
27915}
27916
27917/// CreateAccountOp is an XDR Struct defines as:
27918///
27919/// ```text
27920/// struct CreateAccountOp
27921/// {
27922///     AccountID destination; // account to create
27923///     int64 startingBalance; // amount they end up with
27924/// };
27925/// ```
27926///
27927#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
27928#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
27929#[cfg_attr(
27930    all(feature = "serde", feature = "alloc"),
27931    derive(serde::Serialize, serde::Deserialize),
27932    serde(rename_all = "snake_case")
27933)]
27934#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
27935pub struct CreateAccountOp {
27936    pub destination: AccountId,
27937    pub starting_balance: i64,
27938}
27939
27940impl ReadXdr for CreateAccountOp {
27941    #[cfg(feature = "std")]
27942    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
27943        r.with_limited_depth(|r| {
27944            Ok(Self {
27945                destination: AccountId::read_xdr(r)?,
27946                starting_balance: i64::read_xdr(r)?,
27947            })
27948        })
27949    }
27950}
27951
27952impl WriteXdr for CreateAccountOp {
27953    #[cfg(feature = "std")]
27954    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
27955        w.with_limited_depth(|w| {
27956            self.destination.write_xdr(w)?;
27957            self.starting_balance.write_xdr(w)?;
27958            Ok(())
27959        })
27960    }
27961}
27962
27963/// PaymentOp is an XDR Struct defines as:
27964///
27965/// ```text
27966/// struct PaymentOp
27967/// {
27968///     MuxedAccount destination; // recipient of the payment
27969///     Asset asset;              // what they end up with
27970///     int64 amount;             // amount they end up with
27971/// };
27972/// ```
27973///
27974#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
27975#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
27976#[cfg_attr(
27977    all(feature = "serde", feature = "alloc"),
27978    derive(serde::Serialize, serde::Deserialize),
27979    serde(rename_all = "snake_case")
27980)]
27981#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
27982pub struct PaymentOp {
27983    pub destination: MuxedAccount,
27984    pub asset: Asset,
27985    pub amount: i64,
27986}
27987
27988impl ReadXdr for PaymentOp {
27989    #[cfg(feature = "std")]
27990    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
27991        r.with_limited_depth(|r| {
27992            Ok(Self {
27993                destination: MuxedAccount::read_xdr(r)?,
27994                asset: Asset::read_xdr(r)?,
27995                amount: i64::read_xdr(r)?,
27996            })
27997        })
27998    }
27999}
28000
28001impl WriteXdr for PaymentOp {
28002    #[cfg(feature = "std")]
28003    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28004        w.with_limited_depth(|w| {
28005            self.destination.write_xdr(w)?;
28006            self.asset.write_xdr(w)?;
28007            self.amount.write_xdr(w)?;
28008            Ok(())
28009        })
28010    }
28011}
28012
28013/// PathPaymentStrictReceiveOp is an XDR Struct defines as:
28014///
28015/// ```text
28016/// struct PathPaymentStrictReceiveOp
28017/// {
28018///     Asset sendAsset; // asset we pay with
28019///     int64 sendMax;   // the maximum amount of sendAsset to
28020///                      // send (excluding fees).
28021///                      // The operation will fail if can't be met
28022///
28023///     MuxedAccount destination; // recipient of the payment
28024///     Asset destAsset;          // what they end up with
28025///     int64 destAmount;         // amount they end up with
28026///
28027///     Asset path<5>; // additional hops it must go through to get there
28028/// };
28029/// ```
28030///
28031#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28032#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28033#[cfg_attr(
28034    all(feature = "serde", feature = "alloc"),
28035    derive(serde::Serialize, serde::Deserialize),
28036    serde(rename_all = "snake_case")
28037)]
28038#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28039pub struct PathPaymentStrictReceiveOp {
28040    pub send_asset: Asset,
28041    pub send_max: i64,
28042    pub destination: MuxedAccount,
28043    pub dest_asset: Asset,
28044    pub dest_amount: i64,
28045    pub path: VecM<Asset, 5>,
28046}
28047
28048impl ReadXdr for PathPaymentStrictReceiveOp {
28049    #[cfg(feature = "std")]
28050    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
28051        r.with_limited_depth(|r| {
28052            Ok(Self {
28053                send_asset: Asset::read_xdr(r)?,
28054                send_max: i64::read_xdr(r)?,
28055                destination: MuxedAccount::read_xdr(r)?,
28056                dest_asset: Asset::read_xdr(r)?,
28057                dest_amount: i64::read_xdr(r)?,
28058                path: VecM::<Asset, 5>::read_xdr(r)?,
28059            })
28060        })
28061    }
28062}
28063
28064impl WriteXdr for PathPaymentStrictReceiveOp {
28065    #[cfg(feature = "std")]
28066    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28067        w.with_limited_depth(|w| {
28068            self.send_asset.write_xdr(w)?;
28069            self.send_max.write_xdr(w)?;
28070            self.destination.write_xdr(w)?;
28071            self.dest_asset.write_xdr(w)?;
28072            self.dest_amount.write_xdr(w)?;
28073            self.path.write_xdr(w)?;
28074            Ok(())
28075        })
28076    }
28077}
28078
28079/// PathPaymentStrictSendOp is an XDR Struct defines as:
28080///
28081/// ```text
28082/// struct PathPaymentStrictSendOp
28083/// {
28084///     Asset sendAsset;  // asset we pay with
28085///     int64 sendAmount; // amount of sendAsset to send (excluding fees)
28086///
28087///     MuxedAccount destination; // recipient of the payment
28088///     Asset destAsset;          // what they end up with
28089///     int64 destMin;            // the minimum amount of dest asset to
28090///                               // be received
28091///                               // The operation will fail if it can't be met
28092///
28093///     Asset path<5>; // additional hops it must go through to get there
28094/// };
28095/// ```
28096///
28097#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28098#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28099#[cfg_attr(
28100    all(feature = "serde", feature = "alloc"),
28101    derive(serde::Serialize, serde::Deserialize),
28102    serde(rename_all = "snake_case")
28103)]
28104#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28105pub struct PathPaymentStrictSendOp {
28106    pub send_asset: Asset,
28107    pub send_amount: i64,
28108    pub destination: MuxedAccount,
28109    pub dest_asset: Asset,
28110    pub dest_min: i64,
28111    pub path: VecM<Asset, 5>,
28112}
28113
28114impl ReadXdr for PathPaymentStrictSendOp {
28115    #[cfg(feature = "std")]
28116    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
28117        r.with_limited_depth(|r| {
28118            Ok(Self {
28119                send_asset: Asset::read_xdr(r)?,
28120                send_amount: i64::read_xdr(r)?,
28121                destination: MuxedAccount::read_xdr(r)?,
28122                dest_asset: Asset::read_xdr(r)?,
28123                dest_min: i64::read_xdr(r)?,
28124                path: VecM::<Asset, 5>::read_xdr(r)?,
28125            })
28126        })
28127    }
28128}
28129
28130impl WriteXdr for PathPaymentStrictSendOp {
28131    #[cfg(feature = "std")]
28132    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28133        w.with_limited_depth(|w| {
28134            self.send_asset.write_xdr(w)?;
28135            self.send_amount.write_xdr(w)?;
28136            self.destination.write_xdr(w)?;
28137            self.dest_asset.write_xdr(w)?;
28138            self.dest_min.write_xdr(w)?;
28139            self.path.write_xdr(w)?;
28140            Ok(())
28141        })
28142    }
28143}
28144
28145/// ManageSellOfferOp is an XDR Struct defines as:
28146///
28147/// ```text
28148/// struct ManageSellOfferOp
28149/// {
28150///     Asset selling;
28151///     Asset buying;
28152///     int64 amount; // amount being sold. if set to 0, delete the offer
28153///     Price price;  // price of thing being sold in terms of what you are buying
28154///
28155///     // 0=create a new offer, otherwise edit an existing offer
28156///     int64 offerID;
28157/// };
28158/// ```
28159///
28160#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28161#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28162#[cfg_attr(
28163    all(feature = "serde", feature = "alloc"),
28164    derive(serde::Serialize, serde::Deserialize),
28165    serde(rename_all = "snake_case")
28166)]
28167#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28168pub struct ManageSellOfferOp {
28169    pub selling: Asset,
28170    pub buying: Asset,
28171    pub amount: i64,
28172    pub price: Price,
28173    pub offer_id: i64,
28174}
28175
28176impl ReadXdr for ManageSellOfferOp {
28177    #[cfg(feature = "std")]
28178    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
28179        r.with_limited_depth(|r| {
28180            Ok(Self {
28181                selling: Asset::read_xdr(r)?,
28182                buying: Asset::read_xdr(r)?,
28183                amount: i64::read_xdr(r)?,
28184                price: Price::read_xdr(r)?,
28185                offer_id: i64::read_xdr(r)?,
28186            })
28187        })
28188    }
28189}
28190
28191impl WriteXdr for ManageSellOfferOp {
28192    #[cfg(feature = "std")]
28193    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28194        w.with_limited_depth(|w| {
28195            self.selling.write_xdr(w)?;
28196            self.buying.write_xdr(w)?;
28197            self.amount.write_xdr(w)?;
28198            self.price.write_xdr(w)?;
28199            self.offer_id.write_xdr(w)?;
28200            Ok(())
28201        })
28202    }
28203}
28204
28205/// ManageBuyOfferOp is an XDR Struct defines as:
28206///
28207/// ```text
28208/// struct ManageBuyOfferOp
28209/// {
28210///     Asset selling;
28211///     Asset buying;
28212///     int64 buyAmount; // amount being bought. if set to 0, delete the offer
28213///     Price price;     // price of thing being bought in terms of what you are
28214///                      // selling
28215///
28216///     // 0=create a new offer, otherwise edit an existing offer
28217///     int64 offerID;
28218/// };
28219/// ```
28220///
28221#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28222#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28223#[cfg_attr(
28224    all(feature = "serde", feature = "alloc"),
28225    derive(serde::Serialize, serde::Deserialize),
28226    serde(rename_all = "snake_case")
28227)]
28228#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28229pub struct ManageBuyOfferOp {
28230    pub selling: Asset,
28231    pub buying: Asset,
28232    pub buy_amount: i64,
28233    pub price: Price,
28234    pub offer_id: i64,
28235}
28236
28237impl ReadXdr for ManageBuyOfferOp {
28238    #[cfg(feature = "std")]
28239    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
28240        r.with_limited_depth(|r| {
28241            Ok(Self {
28242                selling: Asset::read_xdr(r)?,
28243                buying: Asset::read_xdr(r)?,
28244                buy_amount: i64::read_xdr(r)?,
28245                price: Price::read_xdr(r)?,
28246                offer_id: i64::read_xdr(r)?,
28247            })
28248        })
28249    }
28250}
28251
28252impl WriteXdr for ManageBuyOfferOp {
28253    #[cfg(feature = "std")]
28254    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28255        w.with_limited_depth(|w| {
28256            self.selling.write_xdr(w)?;
28257            self.buying.write_xdr(w)?;
28258            self.buy_amount.write_xdr(w)?;
28259            self.price.write_xdr(w)?;
28260            self.offer_id.write_xdr(w)?;
28261            Ok(())
28262        })
28263    }
28264}
28265
28266/// CreatePassiveSellOfferOp is an XDR Struct defines as:
28267///
28268/// ```text
28269/// struct CreatePassiveSellOfferOp
28270/// {
28271///     Asset selling; // A
28272///     Asset buying;  // B
28273///     int64 amount;  // amount taker gets
28274///     Price price;   // cost of A in terms of B
28275/// };
28276/// ```
28277///
28278#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28279#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28280#[cfg_attr(
28281    all(feature = "serde", feature = "alloc"),
28282    derive(serde::Serialize, serde::Deserialize),
28283    serde(rename_all = "snake_case")
28284)]
28285#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28286pub struct CreatePassiveSellOfferOp {
28287    pub selling: Asset,
28288    pub buying: Asset,
28289    pub amount: i64,
28290    pub price: Price,
28291}
28292
28293impl ReadXdr for CreatePassiveSellOfferOp {
28294    #[cfg(feature = "std")]
28295    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
28296        r.with_limited_depth(|r| {
28297            Ok(Self {
28298                selling: Asset::read_xdr(r)?,
28299                buying: Asset::read_xdr(r)?,
28300                amount: i64::read_xdr(r)?,
28301                price: Price::read_xdr(r)?,
28302            })
28303        })
28304    }
28305}
28306
28307impl WriteXdr for CreatePassiveSellOfferOp {
28308    #[cfg(feature = "std")]
28309    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28310        w.with_limited_depth(|w| {
28311            self.selling.write_xdr(w)?;
28312            self.buying.write_xdr(w)?;
28313            self.amount.write_xdr(w)?;
28314            self.price.write_xdr(w)?;
28315            Ok(())
28316        })
28317    }
28318}
28319
28320/// SetOptionsOp is an XDR Struct defines as:
28321///
28322/// ```text
28323/// struct SetOptionsOp
28324/// {
28325///     AccountID* inflationDest; // sets the inflation destination
28326///
28327///     uint32* clearFlags; // which flags to clear
28328///     uint32* setFlags;   // which flags to set
28329///
28330///     // account threshold manipulation
28331///     uint32* masterWeight; // weight of the master account
28332///     uint32* lowThreshold;
28333///     uint32* medThreshold;
28334///     uint32* highThreshold;
28335///
28336///     string32* homeDomain; // sets the home domain
28337///
28338///     // Add, update or remove a signer for the account
28339///     // signer is deleted if the weight is 0
28340///     Signer* signer;
28341/// };
28342/// ```
28343///
28344#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28345#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28346#[cfg_attr(
28347    all(feature = "serde", feature = "alloc"),
28348    derive(serde::Serialize, serde::Deserialize),
28349    serde(rename_all = "snake_case")
28350)]
28351#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28352pub struct SetOptionsOp {
28353    pub inflation_dest: Option<AccountId>,
28354    pub clear_flags: Option<u32>,
28355    pub set_flags: Option<u32>,
28356    pub master_weight: Option<u32>,
28357    pub low_threshold: Option<u32>,
28358    pub med_threshold: Option<u32>,
28359    pub high_threshold: Option<u32>,
28360    pub home_domain: Option<String32>,
28361    pub signer: Option<Signer>,
28362}
28363
28364impl ReadXdr for SetOptionsOp {
28365    #[cfg(feature = "std")]
28366    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
28367        r.with_limited_depth(|r| {
28368            Ok(Self {
28369                inflation_dest: Option::<AccountId>::read_xdr(r)?,
28370                clear_flags: Option::<u32>::read_xdr(r)?,
28371                set_flags: Option::<u32>::read_xdr(r)?,
28372                master_weight: Option::<u32>::read_xdr(r)?,
28373                low_threshold: Option::<u32>::read_xdr(r)?,
28374                med_threshold: Option::<u32>::read_xdr(r)?,
28375                high_threshold: Option::<u32>::read_xdr(r)?,
28376                home_domain: Option::<String32>::read_xdr(r)?,
28377                signer: Option::<Signer>::read_xdr(r)?,
28378            })
28379        })
28380    }
28381}
28382
28383impl WriteXdr for SetOptionsOp {
28384    #[cfg(feature = "std")]
28385    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28386        w.with_limited_depth(|w| {
28387            self.inflation_dest.write_xdr(w)?;
28388            self.clear_flags.write_xdr(w)?;
28389            self.set_flags.write_xdr(w)?;
28390            self.master_weight.write_xdr(w)?;
28391            self.low_threshold.write_xdr(w)?;
28392            self.med_threshold.write_xdr(w)?;
28393            self.high_threshold.write_xdr(w)?;
28394            self.home_domain.write_xdr(w)?;
28395            self.signer.write_xdr(w)?;
28396            Ok(())
28397        })
28398    }
28399}
28400
28401/// ChangeTrustAsset is an XDR Union defines as:
28402///
28403/// ```text
28404/// union ChangeTrustAsset switch (AssetType type)
28405/// {
28406/// case ASSET_TYPE_NATIVE: // Not credit
28407///     void;
28408///
28409/// case ASSET_TYPE_CREDIT_ALPHANUM4:
28410///     AlphaNum4 alphaNum4;
28411///
28412/// case ASSET_TYPE_CREDIT_ALPHANUM12:
28413///     AlphaNum12 alphaNum12;
28414///
28415/// case ASSET_TYPE_POOL_SHARE:
28416///     LiquidityPoolParameters liquidityPool;
28417///
28418///     // add other asset types here in the future
28419/// };
28420/// ```
28421///
28422// union with discriminant AssetType
28423#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28424#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28425#[cfg_attr(
28426    all(feature = "serde", feature = "alloc"),
28427    derive(serde::Serialize, serde::Deserialize),
28428    serde(rename_all = "snake_case")
28429)]
28430#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28431#[allow(clippy::large_enum_variant)]
28432pub enum ChangeTrustAsset {
28433    Native,
28434    CreditAlphanum4(AlphaNum4),
28435    CreditAlphanum12(AlphaNum12),
28436    PoolShare(LiquidityPoolParameters),
28437}
28438
28439impl ChangeTrustAsset {
28440    pub const VARIANTS: [AssetType; 4] = [
28441        AssetType::Native,
28442        AssetType::CreditAlphanum4,
28443        AssetType::CreditAlphanum12,
28444        AssetType::PoolShare,
28445    ];
28446    pub const VARIANTS_STR: [&'static str; 4] =
28447        ["Native", "CreditAlphanum4", "CreditAlphanum12", "PoolShare"];
28448
28449    #[must_use]
28450    pub const fn name(&self) -> &'static str {
28451        match self {
28452            Self::Native => "Native",
28453            Self::CreditAlphanum4(_) => "CreditAlphanum4",
28454            Self::CreditAlphanum12(_) => "CreditAlphanum12",
28455            Self::PoolShare(_) => "PoolShare",
28456        }
28457    }
28458
28459    #[must_use]
28460    pub const fn discriminant(&self) -> AssetType {
28461        #[allow(clippy::match_same_arms)]
28462        match self {
28463            Self::Native => AssetType::Native,
28464            Self::CreditAlphanum4(_) => AssetType::CreditAlphanum4,
28465            Self::CreditAlphanum12(_) => AssetType::CreditAlphanum12,
28466            Self::PoolShare(_) => AssetType::PoolShare,
28467        }
28468    }
28469
28470    #[must_use]
28471    pub const fn variants() -> [AssetType; 4] {
28472        Self::VARIANTS
28473    }
28474}
28475
28476impl Name for ChangeTrustAsset {
28477    #[must_use]
28478    fn name(&self) -> &'static str {
28479        Self::name(self)
28480    }
28481}
28482
28483impl Discriminant<AssetType> for ChangeTrustAsset {
28484    #[must_use]
28485    fn discriminant(&self) -> AssetType {
28486        Self::discriminant(self)
28487    }
28488}
28489
28490impl Variants<AssetType> for ChangeTrustAsset {
28491    fn variants() -> slice::Iter<'static, AssetType> {
28492        Self::VARIANTS.iter()
28493    }
28494}
28495
28496impl Union<AssetType> for ChangeTrustAsset {}
28497
28498impl ReadXdr for ChangeTrustAsset {
28499    #[cfg(feature = "std")]
28500    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
28501        r.with_limited_depth(|r| {
28502            let dv: AssetType = <AssetType as ReadXdr>::read_xdr(r)?;
28503            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
28504            let v = match dv {
28505                AssetType::Native => Self::Native,
28506                AssetType::CreditAlphanum4 => Self::CreditAlphanum4(AlphaNum4::read_xdr(r)?),
28507                AssetType::CreditAlphanum12 => Self::CreditAlphanum12(AlphaNum12::read_xdr(r)?),
28508                AssetType::PoolShare => Self::PoolShare(LiquidityPoolParameters::read_xdr(r)?),
28509                #[allow(unreachable_patterns)]
28510                _ => return Err(Error::Invalid),
28511            };
28512            Ok(v)
28513        })
28514    }
28515}
28516
28517impl WriteXdr for ChangeTrustAsset {
28518    #[cfg(feature = "std")]
28519    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28520        w.with_limited_depth(|w| {
28521            self.discriminant().write_xdr(w)?;
28522            #[allow(clippy::match_same_arms)]
28523            match self {
28524                Self::Native => ().write_xdr(w)?,
28525                Self::CreditAlphanum4(v) => v.write_xdr(w)?,
28526                Self::CreditAlphanum12(v) => v.write_xdr(w)?,
28527                Self::PoolShare(v) => v.write_xdr(w)?,
28528            };
28529            Ok(())
28530        })
28531    }
28532}
28533
28534/// ChangeTrustOp is an XDR Struct defines as:
28535///
28536/// ```text
28537/// struct ChangeTrustOp
28538/// {
28539///     ChangeTrustAsset line;
28540///
28541///     // if limit is set to 0, deletes the trust line
28542///     int64 limit;
28543/// };
28544/// ```
28545///
28546#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28547#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28548#[cfg_attr(
28549    all(feature = "serde", feature = "alloc"),
28550    derive(serde::Serialize, serde::Deserialize),
28551    serde(rename_all = "snake_case")
28552)]
28553#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28554pub struct ChangeTrustOp {
28555    pub line: ChangeTrustAsset,
28556    pub limit: i64,
28557}
28558
28559impl ReadXdr for ChangeTrustOp {
28560    #[cfg(feature = "std")]
28561    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
28562        r.with_limited_depth(|r| {
28563            Ok(Self {
28564                line: ChangeTrustAsset::read_xdr(r)?,
28565                limit: i64::read_xdr(r)?,
28566            })
28567        })
28568    }
28569}
28570
28571impl WriteXdr for ChangeTrustOp {
28572    #[cfg(feature = "std")]
28573    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28574        w.with_limited_depth(|w| {
28575            self.line.write_xdr(w)?;
28576            self.limit.write_xdr(w)?;
28577            Ok(())
28578        })
28579    }
28580}
28581
28582/// AllowTrustOp is an XDR Struct defines as:
28583///
28584/// ```text
28585/// struct AllowTrustOp
28586/// {
28587///     AccountID trustor;
28588///     AssetCode asset;
28589///
28590///     // One of 0, AUTHORIZED_FLAG, or AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG
28591///     uint32 authorize;
28592/// };
28593/// ```
28594///
28595#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28596#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28597#[cfg_attr(
28598    all(feature = "serde", feature = "alloc"),
28599    derive(serde::Serialize, serde::Deserialize),
28600    serde(rename_all = "snake_case")
28601)]
28602#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28603pub struct AllowTrustOp {
28604    pub trustor: AccountId,
28605    pub asset: AssetCode,
28606    pub authorize: u32,
28607}
28608
28609impl ReadXdr for AllowTrustOp {
28610    #[cfg(feature = "std")]
28611    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
28612        r.with_limited_depth(|r| {
28613            Ok(Self {
28614                trustor: AccountId::read_xdr(r)?,
28615                asset: AssetCode::read_xdr(r)?,
28616                authorize: u32::read_xdr(r)?,
28617            })
28618        })
28619    }
28620}
28621
28622impl WriteXdr for AllowTrustOp {
28623    #[cfg(feature = "std")]
28624    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28625        w.with_limited_depth(|w| {
28626            self.trustor.write_xdr(w)?;
28627            self.asset.write_xdr(w)?;
28628            self.authorize.write_xdr(w)?;
28629            Ok(())
28630        })
28631    }
28632}
28633
28634/// ManageDataOp is an XDR Struct defines as:
28635///
28636/// ```text
28637/// struct ManageDataOp
28638/// {
28639///     string64 dataName;
28640///     DataValue* dataValue; // set to null to clear
28641/// };
28642/// ```
28643///
28644#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28645#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28646#[cfg_attr(
28647    all(feature = "serde", feature = "alloc"),
28648    derive(serde::Serialize, serde::Deserialize),
28649    serde(rename_all = "snake_case")
28650)]
28651#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28652pub struct ManageDataOp {
28653    pub data_name: String64,
28654    pub data_value: Option<DataValue>,
28655}
28656
28657impl ReadXdr for ManageDataOp {
28658    #[cfg(feature = "std")]
28659    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
28660        r.with_limited_depth(|r| {
28661            Ok(Self {
28662                data_name: String64::read_xdr(r)?,
28663                data_value: Option::<DataValue>::read_xdr(r)?,
28664            })
28665        })
28666    }
28667}
28668
28669impl WriteXdr for ManageDataOp {
28670    #[cfg(feature = "std")]
28671    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28672        w.with_limited_depth(|w| {
28673            self.data_name.write_xdr(w)?;
28674            self.data_value.write_xdr(w)?;
28675            Ok(())
28676        })
28677    }
28678}
28679
28680/// BumpSequenceOp is an XDR Struct defines as:
28681///
28682/// ```text
28683/// struct BumpSequenceOp
28684/// {
28685///     SequenceNumber bumpTo;
28686/// };
28687/// ```
28688///
28689#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28690#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28691#[cfg_attr(
28692    all(feature = "serde", feature = "alloc"),
28693    derive(serde::Serialize, serde::Deserialize),
28694    serde(rename_all = "snake_case")
28695)]
28696#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28697pub struct BumpSequenceOp {
28698    pub bump_to: SequenceNumber,
28699}
28700
28701impl ReadXdr for BumpSequenceOp {
28702    #[cfg(feature = "std")]
28703    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
28704        r.with_limited_depth(|r| {
28705            Ok(Self {
28706                bump_to: SequenceNumber::read_xdr(r)?,
28707            })
28708        })
28709    }
28710}
28711
28712impl WriteXdr for BumpSequenceOp {
28713    #[cfg(feature = "std")]
28714    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28715        w.with_limited_depth(|w| {
28716            self.bump_to.write_xdr(w)?;
28717            Ok(())
28718        })
28719    }
28720}
28721
28722/// CreateClaimableBalanceOp is an XDR Struct defines as:
28723///
28724/// ```text
28725/// struct CreateClaimableBalanceOp
28726/// {
28727///     Asset asset;
28728///     int64 amount;
28729///     Claimant claimants<10>;
28730/// };
28731/// ```
28732///
28733#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28734#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28735#[cfg_attr(
28736    all(feature = "serde", feature = "alloc"),
28737    derive(serde::Serialize, serde::Deserialize),
28738    serde(rename_all = "snake_case")
28739)]
28740#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28741pub struct CreateClaimableBalanceOp {
28742    pub asset: Asset,
28743    pub amount: i64,
28744    pub claimants: VecM<Claimant, 10>,
28745}
28746
28747impl ReadXdr for CreateClaimableBalanceOp {
28748    #[cfg(feature = "std")]
28749    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
28750        r.with_limited_depth(|r| {
28751            Ok(Self {
28752                asset: Asset::read_xdr(r)?,
28753                amount: i64::read_xdr(r)?,
28754                claimants: VecM::<Claimant, 10>::read_xdr(r)?,
28755            })
28756        })
28757    }
28758}
28759
28760impl WriteXdr for CreateClaimableBalanceOp {
28761    #[cfg(feature = "std")]
28762    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28763        w.with_limited_depth(|w| {
28764            self.asset.write_xdr(w)?;
28765            self.amount.write_xdr(w)?;
28766            self.claimants.write_xdr(w)?;
28767            Ok(())
28768        })
28769    }
28770}
28771
28772/// ClaimClaimableBalanceOp is an XDR Struct defines as:
28773///
28774/// ```text
28775/// struct ClaimClaimableBalanceOp
28776/// {
28777///     ClaimableBalanceID balanceID;
28778/// };
28779/// ```
28780///
28781#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28782#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28783#[cfg_attr(
28784    all(feature = "serde", feature = "alloc"),
28785    derive(serde::Serialize, serde::Deserialize),
28786    serde(rename_all = "snake_case")
28787)]
28788#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28789pub struct ClaimClaimableBalanceOp {
28790    pub balance_id: ClaimableBalanceId,
28791}
28792
28793impl ReadXdr for ClaimClaimableBalanceOp {
28794    #[cfg(feature = "std")]
28795    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
28796        r.with_limited_depth(|r| {
28797            Ok(Self {
28798                balance_id: ClaimableBalanceId::read_xdr(r)?,
28799            })
28800        })
28801    }
28802}
28803
28804impl WriteXdr for ClaimClaimableBalanceOp {
28805    #[cfg(feature = "std")]
28806    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28807        w.with_limited_depth(|w| {
28808            self.balance_id.write_xdr(w)?;
28809            Ok(())
28810        })
28811    }
28812}
28813
28814/// BeginSponsoringFutureReservesOp is an XDR Struct defines as:
28815///
28816/// ```text
28817/// struct BeginSponsoringFutureReservesOp
28818/// {
28819///     AccountID sponsoredID;
28820/// };
28821/// ```
28822///
28823#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28824#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28825#[cfg_attr(
28826    all(feature = "serde", feature = "alloc"),
28827    derive(serde::Serialize, serde::Deserialize),
28828    serde(rename_all = "snake_case")
28829)]
28830#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28831pub struct BeginSponsoringFutureReservesOp {
28832    pub sponsored_id: AccountId,
28833}
28834
28835impl ReadXdr for BeginSponsoringFutureReservesOp {
28836    #[cfg(feature = "std")]
28837    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
28838        r.with_limited_depth(|r| {
28839            Ok(Self {
28840                sponsored_id: AccountId::read_xdr(r)?,
28841            })
28842        })
28843    }
28844}
28845
28846impl WriteXdr for BeginSponsoringFutureReservesOp {
28847    #[cfg(feature = "std")]
28848    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28849        w.with_limited_depth(|w| {
28850            self.sponsored_id.write_xdr(w)?;
28851            Ok(())
28852        })
28853    }
28854}
28855
28856/// RevokeSponsorshipType is an XDR Enum defines as:
28857///
28858/// ```text
28859/// enum RevokeSponsorshipType
28860/// {
28861///     REVOKE_SPONSORSHIP_LEDGER_ENTRY = 0,
28862///     REVOKE_SPONSORSHIP_SIGNER = 1
28863/// };
28864/// ```
28865///
28866// enum
28867#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28868#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28869#[cfg_attr(
28870    all(feature = "serde", feature = "alloc"),
28871    derive(serde::Serialize, serde::Deserialize),
28872    serde(rename_all = "snake_case")
28873)]
28874#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28875#[repr(i32)]
28876pub enum RevokeSponsorshipType {
28877    LedgerEntry = 0,
28878    Signer = 1,
28879}
28880
28881impl RevokeSponsorshipType {
28882    pub const VARIANTS: [RevokeSponsorshipType; 2] = [
28883        RevokeSponsorshipType::LedgerEntry,
28884        RevokeSponsorshipType::Signer,
28885    ];
28886    pub const VARIANTS_STR: [&'static str; 2] = ["LedgerEntry", "Signer"];
28887
28888    #[must_use]
28889    pub const fn name(&self) -> &'static str {
28890        match self {
28891            Self::LedgerEntry => "LedgerEntry",
28892            Self::Signer => "Signer",
28893        }
28894    }
28895
28896    #[must_use]
28897    pub const fn variants() -> [RevokeSponsorshipType; 2] {
28898        Self::VARIANTS
28899    }
28900}
28901
28902impl Name for RevokeSponsorshipType {
28903    #[must_use]
28904    fn name(&self) -> &'static str {
28905        Self::name(self)
28906    }
28907}
28908
28909impl Variants<RevokeSponsorshipType> for RevokeSponsorshipType {
28910    fn variants() -> slice::Iter<'static, RevokeSponsorshipType> {
28911        Self::VARIANTS.iter()
28912    }
28913}
28914
28915impl Enum for RevokeSponsorshipType {}
28916
28917impl fmt::Display for RevokeSponsorshipType {
28918    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
28919        f.write_str(self.name())
28920    }
28921}
28922
28923impl TryFrom<i32> for RevokeSponsorshipType {
28924    type Error = Error;
28925
28926    fn try_from(i: i32) -> Result<Self> {
28927        let e = match i {
28928            0 => RevokeSponsorshipType::LedgerEntry,
28929            1 => RevokeSponsorshipType::Signer,
28930            #[allow(unreachable_patterns)]
28931            _ => return Err(Error::Invalid),
28932        };
28933        Ok(e)
28934    }
28935}
28936
28937impl From<RevokeSponsorshipType> for i32 {
28938    #[must_use]
28939    fn from(e: RevokeSponsorshipType) -> Self {
28940        e as Self
28941    }
28942}
28943
28944impl ReadXdr for RevokeSponsorshipType {
28945    #[cfg(feature = "std")]
28946    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
28947        r.with_limited_depth(|r| {
28948            let e = i32::read_xdr(r)?;
28949            let v: Self = e.try_into()?;
28950            Ok(v)
28951        })
28952    }
28953}
28954
28955impl WriteXdr for RevokeSponsorshipType {
28956    #[cfg(feature = "std")]
28957    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
28958        w.with_limited_depth(|w| {
28959            let i: i32 = (*self).into();
28960            i.write_xdr(w)
28961        })
28962    }
28963}
28964
28965/// RevokeSponsorshipOpSigner is an XDR NestedStruct defines as:
28966///
28967/// ```text
28968/// struct
28969///     {
28970///         AccountID accountID;
28971///         SignerKey signerKey;
28972///     }
28973/// ```
28974///
28975#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
28976#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
28977#[cfg_attr(
28978    all(feature = "serde", feature = "alloc"),
28979    derive(serde::Serialize, serde::Deserialize),
28980    serde(rename_all = "snake_case")
28981)]
28982#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28983pub struct RevokeSponsorshipOpSigner {
28984    pub account_id: AccountId,
28985    pub signer_key: SignerKey,
28986}
28987
28988impl ReadXdr for RevokeSponsorshipOpSigner {
28989    #[cfg(feature = "std")]
28990    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
28991        r.with_limited_depth(|r| {
28992            Ok(Self {
28993                account_id: AccountId::read_xdr(r)?,
28994                signer_key: SignerKey::read_xdr(r)?,
28995            })
28996        })
28997    }
28998}
28999
29000impl WriteXdr for RevokeSponsorshipOpSigner {
29001    #[cfg(feature = "std")]
29002    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
29003        w.with_limited_depth(|w| {
29004            self.account_id.write_xdr(w)?;
29005            self.signer_key.write_xdr(w)?;
29006            Ok(())
29007        })
29008    }
29009}
29010
29011/// RevokeSponsorshipOp is an XDR Union defines as:
29012///
29013/// ```text
29014/// union RevokeSponsorshipOp switch (RevokeSponsorshipType type)
29015/// {
29016/// case REVOKE_SPONSORSHIP_LEDGER_ENTRY:
29017///     LedgerKey ledgerKey;
29018/// case REVOKE_SPONSORSHIP_SIGNER:
29019///     struct
29020///     {
29021///         AccountID accountID;
29022///         SignerKey signerKey;
29023///     } signer;
29024/// };
29025/// ```
29026///
29027// union with discriminant RevokeSponsorshipType
29028#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
29029#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
29030#[cfg_attr(
29031    all(feature = "serde", feature = "alloc"),
29032    derive(serde::Serialize, serde::Deserialize),
29033    serde(rename_all = "snake_case")
29034)]
29035#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
29036#[allow(clippy::large_enum_variant)]
29037pub enum RevokeSponsorshipOp {
29038    LedgerEntry(LedgerKey),
29039    Signer(RevokeSponsorshipOpSigner),
29040}
29041
29042impl RevokeSponsorshipOp {
29043    pub const VARIANTS: [RevokeSponsorshipType; 2] = [
29044        RevokeSponsorshipType::LedgerEntry,
29045        RevokeSponsorshipType::Signer,
29046    ];
29047    pub const VARIANTS_STR: [&'static str; 2] = ["LedgerEntry", "Signer"];
29048
29049    #[must_use]
29050    pub const fn name(&self) -> &'static str {
29051        match self {
29052            Self::LedgerEntry(_) => "LedgerEntry",
29053            Self::Signer(_) => "Signer",
29054        }
29055    }
29056
29057    #[must_use]
29058    pub const fn discriminant(&self) -> RevokeSponsorshipType {
29059        #[allow(clippy::match_same_arms)]
29060        match self {
29061            Self::LedgerEntry(_) => RevokeSponsorshipType::LedgerEntry,
29062            Self::Signer(_) => RevokeSponsorshipType::Signer,
29063        }
29064    }
29065
29066    #[must_use]
29067    pub const fn variants() -> [RevokeSponsorshipType; 2] {
29068        Self::VARIANTS
29069    }
29070}
29071
29072impl Name for RevokeSponsorshipOp {
29073    #[must_use]
29074    fn name(&self) -> &'static str {
29075        Self::name(self)
29076    }
29077}
29078
29079impl Discriminant<RevokeSponsorshipType> for RevokeSponsorshipOp {
29080    #[must_use]
29081    fn discriminant(&self) -> RevokeSponsorshipType {
29082        Self::discriminant(self)
29083    }
29084}
29085
29086impl Variants<RevokeSponsorshipType> for RevokeSponsorshipOp {
29087    fn variants() -> slice::Iter<'static, RevokeSponsorshipType> {
29088        Self::VARIANTS.iter()
29089    }
29090}
29091
29092impl Union<RevokeSponsorshipType> for RevokeSponsorshipOp {}
29093
29094impl ReadXdr for RevokeSponsorshipOp {
29095    #[cfg(feature = "std")]
29096    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
29097        r.with_limited_depth(|r| {
29098            let dv: RevokeSponsorshipType = <RevokeSponsorshipType as ReadXdr>::read_xdr(r)?;
29099            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
29100            let v = match dv {
29101                RevokeSponsorshipType::LedgerEntry => Self::LedgerEntry(LedgerKey::read_xdr(r)?),
29102                RevokeSponsorshipType::Signer => {
29103                    Self::Signer(RevokeSponsorshipOpSigner::read_xdr(r)?)
29104                }
29105                #[allow(unreachable_patterns)]
29106                _ => return Err(Error::Invalid),
29107            };
29108            Ok(v)
29109        })
29110    }
29111}
29112
29113impl WriteXdr for RevokeSponsorshipOp {
29114    #[cfg(feature = "std")]
29115    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
29116        w.with_limited_depth(|w| {
29117            self.discriminant().write_xdr(w)?;
29118            #[allow(clippy::match_same_arms)]
29119            match self {
29120                Self::LedgerEntry(v) => v.write_xdr(w)?,
29121                Self::Signer(v) => v.write_xdr(w)?,
29122            };
29123            Ok(())
29124        })
29125    }
29126}
29127
29128/// ClawbackOp is an XDR Struct defines as:
29129///
29130/// ```text
29131/// struct ClawbackOp
29132/// {
29133///     Asset asset;
29134///     MuxedAccount from;
29135///     int64 amount;
29136/// };
29137/// ```
29138///
29139#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
29140#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
29141#[cfg_attr(
29142    all(feature = "serde", feature = "alloc"),
29143    derive(serde::Serialize, serde::Deserialize),
29144    serde(rename_all = "snake_case")
29145)]
29146#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
29147pub struct ClawbackOp {
29148    pub asset: Asset,
29149    pub from: MuxedAccount,
29150    pub amount: i64,
29151}
29152
29153impl ReadXdr for ClawbackOp {
29154    #[cfg(feature = "std")]
29155    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
29156        r.with_limited_depth(|r| {
29157            Ok(Self {
29158                asset: Asset::read_xdr(r)?,
29159                from: MuxedAccount::read_xdr(r)?,
29160                amount: i64::read_xdr(r)?,
29161            })
29162        })
29163    }
29164}
29165
29166impl WriteXdr for ClawbackOp {
29167    #[cfg(feature = "std")]
29168    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
29169        w.with_limited_depth(|w| {
29170            self.asset.write_xdr(w)?;
29171            self.from.write_xdr(w)?;
29172            self.amount.write_xdr(w)?;
29173            Ok(())
29174        })
29175    }
29176}
29177
29178/// ClawbackClaimableBalanceOp is an XDR Struct defines as:
29179///
29180/// ```text
29181/// struct ClawbackClaimableBalanceOp
29182/// {
29183///     ClaimableBalanceID balanceID;
29184/// };
29185/// ```
29186///
29187#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
29188#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
29189#[cfg_attr(
29190    all(feature = "serde", feature = "alloc"),
29191    derive(serde::Serialize, serde::Deserialize),
29192    serde(rename_all = "snake_case")
29193)]
29194#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
29195pub struct ClawbackClaimableBalanceOp {
29196    pub balance_id: ClaimableBalanceId,
29197}
29198
29199impl ReadXdr for ClawbackClaimableBalanceOp {
29200    #[cfg(feature = "std")]
29201    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
29202        r.with_limited_depth(|r| {
29203            Ok(Self {
29204                balance_id: ClaimableBalanceId::read_xdr(r)?,
29205            })
29206        })
29207    }
29208}
29209
29210impl WriteXdr for ClawbackClaimableBalanceOp {
29211    #[cfg(feature = "std")]
29212    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
29213        w.with_limited_depth(|w| {
29214            self.balance_id.write_xdr(w)?;
29215            Ok(())
29216        })
29217    }
29218}
29219
29220/// SetTrustLineFlagsOp is an XDR Struct defines as:
29221///
29222/// ```text
29223/// struct SetTrustLineFlagsOp
29224/// {
29225///     AccountID trustor;
29226///     Asset asset;
29227///
29228///     uint32 clearFlags; // which flags to clear
29229///     uint32 setFlags;   // which flags to set
29230/// };
29231/// ```
29232///
29233#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
29234#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
29235#[cfg_attr(
29236    all(feature = "serde", feature = "alloc"),
29237    derive(serde::Serialize, serde::Deserialize),
29238    serde(rename_all = "snake_case")
29239)]
29240#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
29241pub struct SetTrustLineFlagsOp {
29242    pub trustor: AccountId,
29243    pub asset: Asset,
29244    pub clear_flags: u32,
29245    pub set_flags: u32,
29246}
29247
29248impl ReadXdr for SetTrustLineFlagsOp {
29249    #[cfg(feature = "std")]
29250    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
29251        r.with_limited_depth(|r| {
29252            Ok(Self {
29253                trustor: AccountId::read_xdr(r)?,
29254                asset: Asset::read_xdr(r)?,
29255                clear_flags: u32::read_xdr(r)?,
29256                set_flags: u32::read_xdr(r)?,
29257            })
29258        })
29259    }
29260}
29261
29262impl WriteXdr for SetTrustLineFlagsOp {
29263    #[cfg(feature = "std")]
29264    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
29265        w.with_limited_depth(|w| {
29266            self.trustor.write_xdr(w)?;
29267            self.asset.write_xdr(w)?;
29268            self.clear_flags.write_xdr(w)?;
29269            self.set_flags.write_xdr(w)?;
29270            Ok(())
29271        })
29272    }
29273}
29274
29275/// LiquidityPoolFeeV18 is an XDR Const defines as:
29276///
29277/// ```text
29278/// const LIQUIDITY_POOL_FEE_V18 = 30;
29279/// ```
29280///
29281pub const LIQUIDITY_POOL_FEE_V18: u64 = 30;
29282
29283/// LiquidityPoolDepositOp is an XDR Struct defines as:
29284///
29285/// ```text
29286/// struct LiquidityPoolDepositOp
29287/// {
29288///     PoolID liquidityPoolID;
29289///     int64 maxAmountA; // maximum amount of first asset to deposit
29290///     int64 maxAmountB; // maximum amount of second asset to deposit
29291///     Price minPrice;   // minimum depositA/depositB
29292///     Price maxPrice;   // maximum depositA/depositB
29293/// };
29294/// ```
29295///
29296#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
29297#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
29298#[cfg_attr(
29299    all(feature = "serde", feature = "alloc"),
29300    derive(serde::Serialize, serde::Deserialize),
29301    serde(rename_all = "snake_case")
29302)]
29303#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
29304pub struct LiquidityPoolDepositOp {
29305    pub liquidity_pool_id: PoolId,
29306    pub max_amount_a: i64,
29307    pub max_amount_b: i64,
29308    pub min_price: Price,
29309    pub max_price: Price,
29310}
29311
29312impl ReadXdr for LiquidityPoolDepositOp {
29313    #[cfg(feature = "std")]
29314    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
29315        r.with_limited_depth(|r| {
29316            Ok(Self {
29317                liquidity_pool_id: PoolId::read_xdr(r)?,
29318                max_amount_a: i64::read_xdr(r)?,
29319                max_amount_b: i64::read_xdr(r)?,
29320                min_price: Price::read_xdr(r)?,
29321                max_price: Price::read_xdr(r)?,
29322            })
29323        })
29324    }
29325}
29326
29327impl WriteXdr for LiquidityPoolDepositOp {
29328    #[cfg(feature = "std")]
29329    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
29330        w.with_limited_depth(|w| {
29331            self.liquidity_pool_id.write_xdr(w)?;
29332            self.max_amount_a.write_xdr(w)?;
29333            self.max_amount_b.write_xdr(w)?;
29334            self.min_price.write_xdr(w)?;
29335            self.max_price.write_xdr(w)?;
29336            Ok(())
29337        })
29338    }
29339}
29340
29341/// LiquidityPoolWithdrawOp is an XDR Struct defines as:
29342///
29343/// ```text
29344/// struct LiquidityPoolWithdrawOp
29345/// {
29346///     PoolID liquidityPoolID;
29347///     int64 amount;     // amount of pool shares to withdraw
29348///     int64 minAmountA; // minimum amount of first asset to withdraw
29349///     int64 minAmountB; // minimum amount of second asset to withdraw
29350/// };
29351/// ```
29352///
29353#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
29354#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
29355#[cfg_attr(
29356    all(feature = "serde", feature = "alloc"),
29357    derive(serde::Serialize, serde::Deserialize),
29358    serde(rename_all = "snake_case")
29359)]
29360#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
29361pub struct LiquidityPoolWithdrawOp {
29362    pub liquidity_pool_id: PoolId,
29363    pub amount: i64,
29364    pub min_amount_a: i64,
29365    pub min_amount_b: i64,
29366}
29367
29368impl ReadXdr for LiquidityPoolWithdrawOp {
29369    #[cfg(feature = "std")]
29370    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
29371        r.with_limited_depth(|r| {
29372            Ok(Self {
29373                liquidity_pool_id: PoolId::read_xdr(r)?,
29374                amount: i64::read_xdr(r)?,
29375                min_amount_a: i64::read_xdr(r)?,
29376                min_amount_b: i64::read_xdr(r)?,
29377            })
29378        })
29379    }
29380}
29381
29382impl WriteXdr for LiquidityPoolWithdrawOp {
29383    #[cfg(feature = "std")]
29384    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
29385        w.with_limited_depth(|w| {
29386            self.liquidity_pool_id.write_xdr(w)?;
29387            self.amount.write_xdr(w)?;
29388            self.min_amount_a.write_xdr(w)?;
29389            self.min_amount_b.write_xdr(w)?;
29390            Ok(())
29391        })
29392    }
29393}
29394
29395/// HostFunctionType is an XDR Enum defines as:
29396///
29397/// ```text
29398/// enum HostFunctionType
29399/// {
29400///     HOST_FUNCTION_TYPE_INVOKE_CONTRACT = 0,
29401///     HOST_FUNCTION_TYPE_CREATE_CONTRACT = 1,
29402///     HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM = 2,
29403///     HOST_FUNCTION_TYPE_CREATE_CONTRACT_V2 = 3
29404/// };
29405/// ```
29406///
29407// enum
29408#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
29409#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
29410#[cfg_attr(
29411    all(feature = "serde", feature = "alloc"),
29412    derive(serde::Serialize, serde::Deserialize),
29413    serde(rename_all = "snake_case")
29414)]
29415#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
29416#[repr(i32)]
29417pub enum HostFunctionType {
29418    InvokeContract = 0,
29419    CreateContract = 1,
29420    UploadContractWasm = 2,
29421    CreateContractV2 = 3,
29422}
29423
29424impl HostFunctionType {
29425    pub const VARIANTS: [HostFunctionType; 4] = [
29426        HostFunctionType::InvokeContract,
29427        HostFunctionType::CreateContract,
29428        HostFunctionType::UploadContractWasm,
29429        HostFunctionType::CreateContractV2,
29430    ];
29431    pub const VARIANTS_STR: [&'static str; 4] = [
29432        "InvokeContract",
29433        "CreateContract",
29434        "UploadContractWasm",
29435        "CreateContractV2",
29436    ];
29437
29438    #[must_use]
29439    pub const fn name(&self) -> &'static str {
29440        match self {
29441            Self::InvokeContract => "InvokeContract",
29442            Self::CreateContract => "CreateContract",
29443            Self::UploadContractWasm => "UploadContractWasm",
29444            Self::CreateContractV2 => "CreateContractV2",
29445        }
29446    }
29447
29448    #[must_use]
29449    pub const fn variants() -> [HostFunctionType; 4] {
29450        Self::VARIANTS
29451    }
29452}
29453
29454impl Name for HostFunctionType {
29455    #[must_use]
29456    fn name(&self) -> &'static str {
29457        Self::name(self)
29458    }
29459}
29460
29461impl Variants<HostFunctionType> for HostFunctionType {
29462    fn variants() -> slice::Iter<'static, HostFunctionType> {
29463        Self::VARIANTS.iter()
29464    }
29465}
29466
29467impl Enum for HostFunctionType {}
29468
29469impl fmt::Display for HostFunctionType {
29470    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
29471        f.write_str(self.name())
29472    }
29473}
29474
29475impl TryFrom<i32> for HostFunctionType {
29476    type Error = Error;
29477
29478    fn try_from(i: i32) -> Result<Self> {
29479        let e = match i {
29480            0 => HostFunctionType::InvokeContract,
29481            1 => HostFunctionType::CreateContract,
29482            2 => HostFunctionType::UploadContractWasm,
29483            3 => HostFunctionType::CreateContractV2,
29484            #[allow(unreachable_patterns)]
29485            _ => return Err(Error::Invalid),
29486        };
29487        Ok(e)
29488    }
29489}
29490
29491impl From<HostFunctionType> for i32 {
29492    #[must_use]
29493    fn from(e: HostFunctionType) -> Self {
29494        e as Self
29495    }
29496}
29497
29498impl ReadXdr for HostFunctionType {
29499    #[cfg(feature = "std")]
29500    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
29501        r.with_limited_depth(|r| {
29502            let e = i32::read_xdr(r)?;
29503            let v: Self = e.try_into()?;
29504            Ok(v)
29505        })
29506    }
29507}
29508
29509impl WriteXdr for HostFunctionType {
29510    #[cfg(feature = "std")]
29511    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
29512        w.with_limited_depth(|w| {
29513            let i: i32 = (*self).into();
29514            i.write_xdr(w)
29515        })
29516    }
29517}
29518
29519/// ContractIdPreimageType is an XDR Enum defines as:
29520///
29521/// ```text
29522/// enum ContractIDPreimageType
29523/// {
29524///     CONTRACT_ID_PREIMAGE_FROM_ADDRESS = 0,
29525///     CONTRACT_ID_PREIMAGE_FROM_ASSET = 1
29526/// };
29527/// ```
29528///
29529// enum
29530#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
29531#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
29532#[cfg_attr(
29533    all(feature = "serde", feature = "alloc"),
29534    derive(serde::Serialize, serde::Deserialize),
29535    serde(rename_all = "snake_case")
29536)]
29537#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
29538#[repr(i32)]
29539pub enum ContractIdPreimageType {
29540    Address = 0,
29541    Asset = 1,
29542}
29543
29544impl ContractIdPreimageType {
29545    pub const VARIANTS: [ContractIdPreimageType; 2] = [
29546        ContractIdPreimageType::Address,
29547        ContractIdPreimageType::Asset,
29548    ];
29549    pub const VARIANTS_STR: [&'static str; 2] = ["Address", "Asset"];
29550
29551    #[must_use]
29552    pub const fn name(&self) -> &'static str {
29553        match self {
29554            Self::Address => "Address",
29555            Self::Asset => "Asset",
29556        }
29557    }
29558
29559    #[must_use]
29560    pub const fn variants() -> [ContractIdPreimageType; 2] {
29561        Self::VARIANTS
29562    }
29563}
29564
29565impl Name for ContractIdPreimageType {
29566    #[must_use]
29567    fn name(&self) -> &'static str {
29568        Self::name(self)
29569    }
29570}
29571
29572impl Variants<ContractIdPreimageType> for ContractIdPreimageType {
29573    fn variants() -> slice::Iter<'static, ContractIdPreimageType> {
29574        Self::VARIANTS.iter()
29575    }
29576}
29577
29578impl Enum for ContractIdPreimageType {}
29579
29580impl fmt::Display for ContractIdPreimageType {
29581    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
29582        f.write_str(self.name())
29583    }
29584}
29585
29586impl TryFrom<i32> for ContractIdPreimageType {
29587    type Error = Error;
29588
29589    fn try_from(i: i32) -> Result<Self> {
29590        let e = match i {
29591            0 => ContractIdPreimageType::Address,
29592            1 => ContractIdPreimageType::Asset,
29593            #[allow(unreachable_patterns)]
29594            _ => return Err(Error::Invalid),
29595        };
29596        Ok(e)
29597    }
29598}
29599
29600impl From<ContractIdPreimageType> for i32 {
29601    #[must_use]
29602    fn from(e: ContractIdPreimageType) -> Self {
29603        e as Self
29604    }
29605}
29606
29607impl ReadXdr for ContractIdPreimageType {
29608    #[cfg(feature = "std")]
29609    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
29610        r.with_limited_depth(|r| {
29611            let e = i32::read_xdr(r)?;
29612            let v: Self = e.try_into()?;
29613            Ok(v)
29614        })
29615    }
29616}
29617
29618impl WriteXdr for ContractIdPreimageType {
29619    #[cfg(feature = "std")]
29620    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
29621        w.with_limited_depth(|w| {
29622            let i: i32 = (*self).into();
29623            i.write_xdr(w)
29624        })
29625    }
29626}
29627
29628/// ContractIdPreimageFromAddress is an XDR NestedStruct defines as:
29629///
29630/// ```text
29631/// struct
29632///     {
29633///         SCAddress address;
29634///         uint256 salt;
29635///     }
29636/// ```
29637///
29638#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
29639#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
29640#[cfg_attr(
29641    all(feature = "serde", feature = "alloc"),
29642    derive(serde::Serialize, serde::Deserialize),
29643    serde(rename_all = "snake_case")
29644)]
29645#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
29646pub struct ContractIdPreimageFromAddress {
29647    pub address: ScAddress,
29648    pub salt: Uint256,
29649}
29650
29651impl ReadXdr for ContractIdPreimageFromAddress {
29652    #[cfg(feature = "std")]
29653    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
29654        r.with_limited_depth(|r| {
29655            Ok(Self {
29656                address: ScAddress::read_xdr(r)?,
29657                salt: Uint256::read_xdr(r)?,
29658            })
29659        })
29660    }
29661}
29662
29663impl WriteXdr for ContractIdPreimageFromAddress {
29664    #[cfg(feature = "std")]
29665    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
29666        w.with_limited_depth(|w| {
29667            self.address.write_xdr(w)?;
29668            self.salt.write_xdr(w)?;
29669            Ok(())
29670        })
29671    }
29672}
29673
29674/// ContractIdPreimage is an XDR Union defines as:
29675///
29676/// ```text
29677/// union ContractIDPreimage switch (ContractIDPreimageType type)
29678/// {
29679/// case CONTRACT_ID_PREIMAGE_FROM_ADDRESS:
29680///     struct
29681///     {
29682///         SCAddress address;
29683///         uint256 salt;
29684///     } fromAddress;
29685/// case CONTRACT_ID_PREIMAGE_FROM_ASSET:
29686///     Asset fromAsset;
29687/// };
29688/// ```
29689///
29690// union with discriminant ContractIdPreimageType
29691#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
29692#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
29693#[cfg_attr(
29694    all(feature = "serde", feature = "alloc"),
29695    derive(serde::Serialize, serde::Deserialize),
29696    serde(rename_all = "snake_case")
29697)]
29698#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
29699#[allow(clippy::large_enum_variant)]
29700pub enum ContractIdPreimage {
29701    Address(ContractIdPreimageFromAddress),
29702    Asset(Asset),
29703}
29704
29705impl ContractIdPreimage {
29706    pub const VARIANTS: [ContractIdPreimageType; 2] = [
29707        ContractIdPreimageType::Address,
29708        ContractIdPreimageType::Asset,
29709    ];
29710    pub const VARIANTS_STR: [&'static str; 2] = ["Address", "Asset"];
29711
29712    #[must_use]
29713    pub const fn name(&self) -> &'static str {
29714        match self {
29715            Self::Address(_) => "Address",
29716            Self::Asset(_) => "Asset",
29717        }
29718    }
29719
29720    #[must_use]
29721    pub const fn discriminant(&self) -> ContractIdPreimageType {
29722        #[allow(clippy::match_same_arms)]
29723        match self {
29724            Self::Address(_) => ContractIdPreimageType::Address,
29725            Self::Asset(_) => ContractIdPreimageType::Asset,
29726        }
29727    }
29728
29729    #[must_use]
29730    pub const fn variants() -> [ContractIdPreimageType; 2] {
29731        Self::VARIANTS
29732    }
29733}
29734
29735impl Name for ContractIdPreimage {
29736    #[must_use]
29737    fn name(&self) -> &'static str {
29738        Self::name(self)
29739    }
29740}
29741
29742impl Discriminant<ContractIdPreimageType> for ContractIdPreimage {
29743    #[must_use]
29744    fn discriminant(&self) -> ContractIdPreimageType {
29745        Self::discriminant(self)
29746    }
29747}
29748
29749impl Variants<ContractIdPreimageType> for ContractIdPreimage {
29750    fn variants() -> slice::Iter<'static, ContractIdPreimageType> {
29751        Self::VARIANTS.iter()
29752    }
29753}
29754
29755impl Union<ContractIdPreimageType> for ContractIdPreimage {}
29756
29757impl ReadXdr for ContractIdPreimage {
29758    #[cfg(feature = "std")]
29759    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
29760        r.with_limited_depth(|r| {
29761            let dv: ContractIdPreimageType = <ContractIdPreimageType as ReadXdr>::read_xdr(r)?;
29762            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
29763            let v = match dv {
29764                ContractIdPreimageType::Address => {
29765                    Self::Address(ContractIdPreimageFromAddress::read_xdr(r)?)
29766                }
29767                ContractIdPreimageType::Asset => Self::Asset(Asset::read_xdr(r)?),
29768                #[allow(unreachable_patterns)]
29769                _ => return Err(Error::Invalid),
29770            };
29771            Ok(v)
29772        })
29773    }
29774}
29775
29776impl WriteXdr for ContractIdPreimage {
29777    #[cfg(feature = "std")]
29778    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
29779        w.with_limited_depth(|w| {
29780            self.discriminant().write_xdr(w)?;
29781            #[allow(clippy::match_same_arms)]
29782            match self {
29783                Self::Address(v) => v.write_xdr(w)?,
29784                Self::Asset(v) => v.write_xdr(w)?,
29785            };
29786            Ok(())
29787        })
29788    }
29789}
29790
29791/// CreateContractArgs is an XDR Struct defines as:
29792///
29793/// ```text
29794/// struct CreateContractArgs
29795/// {
29796///     ContractIDPreimage contractIDPreimage;
29797///     ContractExecutable executable;
29798/// };
29799/// ```
29800///
29801#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
29802#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
29803#[cfg_attr(
29804    all(feature = "serde", feature = "alloc"),
29805    derive(serde::Serialize, serde::Deserialize),
29806    serde(rename_all = "snake_case")
29807)]
29808#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
29809pub struct CreateContractArgs {
29810    pub contract_id_preimage: ContractIdPreimage,
29811    pub executable: ContractExecutable,
29812}
29813
29814impl ReadXdr for CreateContractArgs {
29815    #[cfg(feature = "std")]
29816    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
29817        r.with_limited_depth(|r| {
29818            Ok(Self {
29819                contract_id_preimage: ContractIdPreimage::read_xdr(r)?,
29820                executable: ContractExecutable::read_xdr(r)?,
29821            })
29822        })
29823    }
29824}
29825
29826impl WriteXdr for CreateContractArgs {
29827    #[cfg(feature = "std")]
29828    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
29829        w.with_limited_depth(|w| {
29830            self.contract_id_preimage.write_xdr(w)?;
29831            self.executable.write_xdr(w)?;
29832            Ok(())
29833        })
29834    }
29835}
29836
29837/// CreateContractArgsV2 is an XDR Struct defines as:
29838///
29839/// ```text
29840/// struct CreateContractArgsV2
29841/// {
29842///     ContractIDPreimage contractIDPreimage;
29843///     ContractExecutable executable;
29844///     // Arguments of the contract's constructor.
29845///     SCVal constructorArgs<>;
29846/// };
29847/// ```
29848///
29849#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
29850#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
29851#[cfg_attr(
29852    all(feature = "serde", feature = "alloc"),
29853    derive(serde::Serialize, serde::Deserialize),
29854    serde(rename_all = "snake_case")
29855)]
29856#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
29857pub struct CreateContractArgsV2 {
29858    pub contract_id_preimage: ContractIdPreimage,
29859    pub executable: ContractExecutable,
29860    pub constructor_args: VecM<ScVal>,
29861}
29862
29863impl ReadXdr for CreateContractArgsV2 {
29864    #[cfg(feature = "std")]
29865    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
29866        r.with_limited_depth(|r| {
29867            Ok(Self {
29868                contract_id_preimage: ContractIdPreimage::read_xdr(r)?,
29869                executable: ContractExecutable::read_xdr(r)?,
29870                constructor_args: VecM::<ScVal>::read_xdr(r)?,
29871            })
29872        })
29873    }
29874}
29875
29876impl WriteXdr for CreateContractArgsV2 {
29877    #[cfg(feature = "std")]
29878    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
29879        w.with_limited_depth(|w| {
29880            self.contract_id_preimage.write_xdr(w)?;
29881            self.executable.write_xdr(w)?;
29882            self.constructor_args.write_xdr(w)?;
29883            Ok(())
29884        })
29885    }
29886}
29887
29888/// InvokeContractArgs is an XDR Struct defines as:
29889///
29890/// ```text
29891/// struct InvokeContractArgs {
29892///     SCAddress contractAddress;
29893///     SCSymbol functionName;
29894///     SCVal args<>;
29895/// };
29896/// ```
29897///
29898#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
29899#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
29900#[cfg_attr(
29901    all(feature = "serde", feature = "alloc"),
29902    derive(serde::Serialize, serde::Deserialize),
29903    serde(rename_all = "snake_case")
29904)]
29905#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
29906pub struct InvokeContractArgs {
29907    pub contract_address: ScAddress,
29908    pub function_name: ScSymbol,
29909    pub args: VecM<ScVal>,
29910}
29911
29912impl ReadXdr for InvokeContractArgs {
29913    #[cfg(feature = "std")]
29914    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
29915        r.with_limited_depth(|r| {
29916            Ok(Self {
29917                contract_address: ScAddress::read_xdr(r)?,
29918                function_name: ScSymbol::read_xdr(r)?,
29919                args: VecM::<ScVal>::read_xdr(r)?,
29920            })
29921        })
29922    }
29923}
29924
29925impl WriteXdr for InvokeContractArgs {
29926    #[cfg(feature = "std")]
29927    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
29928        w.with_limited_depth(|w| {
29929            self.contract_address.write_xdr(w)?;
29930            self.function_name.write_xdr(w)?;
29931            self.args.write_xdr(w)?;
29932            Ok(())
29933        })
29934    }
29935}
29936
29937/// HostFunction is an XDR Union defines as:
29938///
29939/// ```text
29940/// union HostFunction switch (HostFunctionType type)
29941/// {
29942/// case HOST_FUNCTION_TYPE_INVOKE_CONTRACT:
29943///     InvokeContractArgs invokeContract;
29944/// case HOST_FUNCTION_TYPE_CREATE_CONTRACT:
29945///     CreateContractArgs createContract;
29946/// case HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM:
29947///     opaque wasm<>;
29948/// case HOST_FUNCTION_TYPE_CREATE_CONTRACT_V2:
29949///     CreateContractArgsV2 createContractV2;
29950/// };
29951/// ```
29952///
29953// union with discriminant HostFunctionType
29954#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
29955#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
29956#[cfg_attr(
29957    all(feature = "serde", feature = "alloc"),
29958    derive(serde::Serialize, serde::Deserialize),
29959    serde(rename_all = "snake_case")
29960)]
29961#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
29962#[allow(clippy::large_enum_variant)]
29963pub enum HostFunction {
29964    InvokeContract(InvokeContractArgs),
29965    CreateContract(CreateContractArgs),
29966    UploadContractWasm(BytesM),
29967    CreateContractV2(CreateContractArgsV2),
29968}
29969
29970impl HostFunction {
29971    pub const VARIANTS: [HostFunctionType; 4] = [
29972        HostFunctionType::InvokeContract,
29973        HostFunctionType::CreateContract,
29974        HostFunctionType::UploadContractWasm,
29975        HostFunctionType::CreateContractV2,
29976    ];
29977    pub const VARIANTS_STR: [&'static str; 4] = [
29978        "InvokeContract",
29979        "CreateContract",
29980        "UploadContractWasm",
29981        "CreateContractV2",
29982    ];
29983
29984    #[must_use]
29985    pub const fn name(&self) -> &'static str {
29986        match self {
29987            Self::InvokeContract(_) => "InvokeContract",
29988            Self::CreateContract(_) => "CreateContract",
29989            Self::UploadContractWasm(_) => "UploadContractWasm",
29990            Self::CreateContractV2(_) => "CreateContractV2",
29991        }
29992    }
29993
29994    #[must_use]
29995    pub const fn discriminant(&self) -> HostFunctionType {
29996        #[allow(clippy::match_same_arms)]
29997        match self {
29998            Self::InvokeContract(_) => HostFunctionType::InvokeContract,
29999            Self::CreateContract(_) => HostFunctionType::CreateContract,
30000            Self::UploadContractWasm(_) => HostFunctionType::UploadContractWasm,
30001            Self::CreateContractV2(_) => HostFunctionType::CreateContractV2,
30002        }
30003    }
30004
30005    #[must_use]
30006    pub const fn variants() -> [HostFunctionType; 4] {
30007        Self::VARIANTS
30008    }
30009}
30010
30011impl Name for HostFunction {
30012    #[must_use]
30013    fn name(&self) -> &'static str {
30014        Self::name(self)
30015    }
30016}
30017
30018impl Discriminant<HostFunctionType> for HostFunction {
30019    #[must_use]
30020    fn discriminant(&self) -> HostFunctionType {
30021        Self::discriminant(self)
30022    }
30023}
30024
30025impl Variants<HostFunctionType> for HostFunction {
30026    fn variants() -> slice::Iter<'static, HostFunctionType> {
30027        Self::VARIANTS.iter()
30028    }
30029}
30030
30031impl Union<HostFunctionType> for HostFunction {}
30032
30033impl ReadXdr for HostFunction {
30034    #[cfg(feature = "std")]
30035    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
30036        r.with_limited_depth(|r| {
30037            let dv: HostFunctionType = <HostFunctionType as ReadXdr>::read_xdr(r)?;
30038            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
30039            let v = match dv {
30040                HostFunctionType::InvokeContract => {
30041                    Self::InvokeContract(InvokeContractArgs::read_xdr(r)?)
30042                }
30043                HostFunctionType::CreateContract => {
30044                    Self::CreateContract(CreateContractArgs::read_xdr(r)?)
30045                }
30046                HostFunctionType::UploadContractWasm => {
30047                    Self::UploadContractWasm(BytesM::read_xdr(r)?)
30048                }
30049                HostFunctionType::CreateContractV2 => {
30050                    Self::CreateContractV2(CreateContractArgsV2::read_xdr(r)?)
30051                }
30052                #[allow(unreachable_patterns)]
30053                _ => return Err(Error::Invalid),
30054            };
30055            Ok(v)
30056        })
30057    }
30058}
30059
30060impl WriteXdr for HostFunction {
30061    #[cfg(feature = "std")]
30062    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
30063        w.with_limited_depth(|w| {
30064            self.discriminant().write_xdr(w)?;
30065            #[allow(clippy::match_same_arms)]
30066            match self {
30067                Self::InvokeContract(v) => v.write_xdr(w)?,
30068                Self::CreateContract(v) => v.write_xdr(w)?,
30069                Self::UploadContractWasm(v) => v.write_xdr(w)?,
30070                Self::CreateContractV2(v) => v.write_xdr(w)?,
30071            };
30072            Ok(())
30073        })
30074    }
30075}
30076
30077/// SorobanAuthorizedFunctionType is an XDR Enum defines as:
30078///
30079/// ```text
30080/// enum SorobanAuthorizedFunctionType
30081/// {
30082///     SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN = 0,
30083///     SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN = 1,
30084///     SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN = 2
30085/// };
30086/// ```
30087///
30088// enum
30089#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
30090#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
30091#[cfg_attr(
30092    all(feature = "serde", feature = "alloc"),
30093    derive(serde::Serialize, serde::Deserialize),
30094    serde(rename_all = "snake_case")
30095)]
30096#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
30097#[repr(i32)]
30098pub enum SorobanAuthorizedFunctionType {
30099    ContractFn = 0,
30100    CreateContractHostFn = 1,
30101    CreateContractV2HostFn = 2,
30102}
30103
30104impl SorobanAuthorizedFunctionType {
30105    pub const VARIANTS: [SorobanAuthorizedFunctionType; 3] = [
30106        SorobanAuthorizedFunctionType::ContractFn,
30107        SorobanAuthorizedFunctionType::CreateContractHostFn,
30108        SorobanAuthorizedFunctionType::CreateContractV2HostFn,
30109    ];
30110    pub const VARIANTS_STR: [&'static str; 3] = [
30111        "ContractFn",
30112        "CreateContractHostFn",
30113        "CreateContractV2HostFn",
30114    ];
30115
30116    #[must_use]
30117    pub const fn name(&self) -> &'static str {
30118        match self {
30119            Self::ContractFn => "ContractFn",
30120            Self::CreateContractHostFn => "CreateContractHostFn",
30121            Self::CreateContractV2HostFn => "CreateContractV2HostFn",
30122        }
30123    }
30124
30125    #[must_use]
30126    pub const fn variants() -> [SorobanAuthorizedFunctionType; 3] {
30127        Self::VARIANTS
30128    }
30129}
30130
30131impl Name for SorobanAuthorizedFunctionType {
30132    #[must_use]
30133    fn name(&self) -> &'static str {
30134        Self::name(self)
30135    }
30136}
30137
30138impl Variants<SorobanAuthorizedFunctionType> for SorobanAuthorizedFunctionType {
30139    fn variants() -> slice::Iter<'static, SorobanAuthorizedFunctionType> {
30140        Self::VARIANTS.iter()
30141    }
30142}
30143
30144impl Enum for SorobanAuthorizedFunctionType {}
30145
30146impl fmt::Display for SorobanAuthorizedFunctionType {
30147    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
30148        f.write_str(self.name())
30149    }
30150}
30151
30152impl TryFrom<i32> for SorobanAuthorizedFunctionType {
30153    type Error = Error;
30154
30155    fn try_from(i: i32) -> Result<Self> {
30156        let e = match i {
30157            0 => SorobanAuthorizedFunctionType::ContractFn,
30158            1 => SorobanAuthorizedFunctionType::CreateContractHostFn,
30159            2 => SorobanAuthorizedFunctionType::CreateContractV2HostFn,
30160            #[allow(unreachable_patterns)]
30161            _ => return Err(Error::Invalid),
30162        };
30163        Ok(e)
30164    }
30165}
30166
30167impl From<SorobanAuthorizedFunctionType> for i32 {
30168    #[must_use]
30169    fn from(e: SorobanAuthorizedFunctionType) -> Self {
30170        e as Self
30171    }
30172}
30173
30174impl ReadXdr for SorobanAuthorizedFunctionType {
30175    #[cfg(feature = "std")]
30176    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
30177        r.with_limited_depth(|r| {
30178            let e = i32::read_xdr(r)?;
30179            let v: Self = e.try_into()?;
30180            Ok(v)
30181        })
30182    }
30183}
30184
30185impl WriteXdr for SorobanAuthorizedFunctionType {
30186    #[cfg(feature = "std")]
30187    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
30188        w.with_limited_depth(|w| {
30189            let i: i32 = (*self).into();
30190            i.write_xdr(w)
30191        })
30192    }
30193}
30194
30195/// SorobanAuthorizedFunction is an XDR Union defines as:
30196///
30197/// ```text
30198/// union SorobanAuthorizedFunction switch (SorobanAuthorizedFunctionType type)
30199/// {
30200/// case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN:
30201///     InvokeContractArgs contractFn;
30202/// // This variant of auth payload for creating new contract instances
30203/// // doesn't allow specifying the constructor arguments, creating contracts
30204/// // with constructors that take arguments is only possible by authorizing
30205/// // `SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN`
30206/// // (protocol 22+).
30207/// case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN:
30208///     CreateContractArgs createContractHostFn;
30209/// // This variant of auth payload for creating new contract instances
30210/// // is only accepted in and after protocol 22. It allows authorizing the
30211/// // contract constructor arguments.
30212/// case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN:
30213///     CreateContractArgsV2 createContractV2HostFn;
30214/// };
30215/// ```
30216///
30217// union with discriminant SorobanAuthorizedFunctionType
30218#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
30219#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
30220#[cfg_attr(
30221    all(feature = "serde", feature = "alloc"),
30222    derive(serde::Serialize, serde::Deserialize),
30223    serde(rename_all = "snake_case")
30224)]
30225#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
30226#[allow(clippy::large_enum_variant)]
30227pub enum SorobanAuthorizedFunction {
30228    ContractFn(InvokeContractArgs),
30229    CreateContractHostFn(CreateContractArgs),
30230    CreateContractV2HostFn(CreateContractArgsV2),
30231}
30232
30233impl SorobanAuthorizedFunction {
30234    pub const VARIANTS: [SorobanAuthorizedFunctionType; 3] = [
30235        SorobanAuthorizedFunctionType::ContractFn,
30236        SorobanAuthorizedFunctionType::CreateContractHostFn,
30237        SorobanAuthorizedFunctionType::CreateContractV2HostFn,
30238    ];
30239    pub const VARIANTS_STR: [&'static str; 3] = [
30240        "ContractFn",
30241        "CreateContractHostFn",
30242        "CreateContractV2HostFn",
30243    ];
30244
30245    #[must_use]
30246    pub const fn name(&self) -> &'static str {
30247        match self {
30248            Self::ContractFn(_) => "ContractFn",
30249            Self::CreateContractHostFn(_) => "CreateContractHostFn",
30250            Self::CreateContractV2HostFn(_) => "CreateContractV2HostFn",
30251        }
30252    }
30253
30254    #[must_use]
30255    pub const fn discriminant(&self) -> SorobanAuthorizedFunctionType {
30256        #[allow(clippy::match_same_arms)]
30257        match self {
30258            Self::ContractFn(_) => SorobanAuthorizedFunctionType::ContractFn,
30259            Self::CreateContractHostFn(_) => SorobanAuthorizedFunctionType::CreateContractHostFn,
30260            Self::CreateContractV2HostFn(_) => {
30261                SorobanAuthorizedFunctionType::CreateContractV2HostFn
30262            }
30263        }
30264    }
30265
30266    #[must_use]
30267    pub const fn variants() -> [SorobanAuthorizedFunctionType; 3] {
30268        Self::VARIANTS
30269    }
30270}
30271
30272impl Name for SorobanAuthorizedFunction {
30273    #[must_use]
30274    fn name(&self) -> &'static str {
30275        Self::name(self)
30276    }
30277}
30278
30279impl Discriminant<SorobanAuthorizedFunctionType> for SorobanAuthorizedFunction {
30280    #[must_use]
30281    fn discriminant(&self) -> SorobanAuthorizedFunctionType {
30282        Self::discriminant(self)
30283    }
30284}
30285
30286impl Variants<SorobanAuthorizedFunctionType> for SorobanAuthorizedFunction {
30287    fn variants() -> slice::Iter<'static, SorobanAuthorizedFunctionType> {
30288        Self::VARIANTS.iter()
30289    }
30290}
30291
30292impl Union<SorobanAuthorizedFunctionType> for SorobanAuthorizedFunction {}
30293
30294impl ReadXdr for SorobanAuthorizedFunction {
30295    #[cfg(feature = "std")]
30296    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
30297        r.with_limited_depth(|r| {
30298            let dv: SorobanAuthorizedFunctionType =
30299                <SorobanAuthorizedFunctionType as ReadXdr>::read_xdr(r)?;
30300            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
30301            let v = match dv {
30302                SorobanAuthorizedFunctionType::ContractFn => {
30303                    Self::ContractFn(InvokeContractArgs::read_xdr(r)?)
30304                }
30305                SorobanAuthorizedFunctionType::CreateContractHostFn => {
30306                    Self::CreateContractHostFn(CreateContractArgs::read_xdr(r)?)
30307                }
30308                SorobanAuthorizedFunctionType::CreateContractV2HostFn => {
30309                    Self::CreateContractV2HostFn(CreateContractArgsV2::read_xdr(r)?)
30310                }
30311                #[allow(unreachable_patterns)]
30312                _ => return Err(Error::Invalid),
30313            };
30314            Ok(v)
30315        })
30316    }
30317}
30318
30319impl WriteXdr for SorobanAuthorizedFunction {
30320    #[cfg(feature = "std")]
30321    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
30322        w.with_limited_depth(|w| {
30323            self.discriminant().write_xdr(w)?;
30324            #[allow(clippy::match_same_arms)]
30325            match self {
30326                Self::ContractFn(v) => v.write_xdr(w)?,
30327                Self::CreateContractHostFn(v) => v.write_xdr(w)?,
30328                Self::CreateContractV2HostFn(v) => v.write_xdr(w)?,
30329            };
30330            Ok(())
30331        })
30332    }
30333}
30334
30335/// SorobanAuthorizedInvocation is an XDR Struct defines as:
30336///
30337/// ```text
30338/// struct SorobanAuthorizedInvocation
30339/// {
30340///     SorobanAuthorizedFunction function;
30341///     SorobanAuthorizedInvocation subInvocations<>;
30342/// };
30343/// ```
30344///
30345#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
30346#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
30347#[cfg_attr(
30348    all(feature = "serde", feature = "alloc"),
30349    derive(serde::Serialize, serde::Deserialize),
30350    serde(rename_all = "snake_case")
30351)]
30352#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
30353pub struct SorobanAuthorizedInvocation {
30354    pub function: SorobanAuthorizedFunction,
30355    pub sub_invocations: VecM<SorobanAuthorizedInvocation>,
30356}
30357
30358impl ReadXdr for SorobanAuthorizedInvocation {
30359    #[cfg(feature = "std")]
30360    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
30361        r.with_limited_depth(|r| {
30362            Ok(Self {
30363                function: SorobanAuthorizedFunction::read_xdr(r)?,
30364                sub_invocations: VecM::<SorobanAuthorizedInvocation>::read_xdr(r)?,
30365            })
30366        })
30367    }
30368}
30369
30370impl WriteXdr for SorobanAuthorizedInvocation {
30371    #[cfg(feature = "std")]
30372    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
30373        w.with_limited_depth(|w| {
30374            self.function.write_xdr(w)?;
30375            self.sub_invocations.write_xdr(w)?;
30376            Ok(())
30377        })
30378    }
30379}
30380
30381/// SorobanAddressCredentials is an XDR Struct defines as:
30382///
30383/// ```text
30384/// struct SorobanAddressCredentials
30385/// {
30386///     SCAddress address;
30387///     int64 nonce;
30388///     uint32 signatureExpirationLedger;    
30389///     SCVal signature;
30390/// };
30391/// ```
30392///
30393#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
30394#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
30395#[cfg_attr(
30396    all(feature = "serde", feature = "alloc"),
30397    derive(serde::Serialize, serde::Deserialize),
30398    serde(rename_all = "snake_case")
30399)]
30400#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
30401pub struct SorobanAddressCredentials {
30402    pub address: ScAddress,
30403    pub nonce: i64,
30404    pub signature_expiration_ledger: u32,
30405    pub signature: ScVal,
30406}
30407
30408impl ReadXdr for SorobanAddressCredentials {
30409    #[cfg(feature = "std")]
30410    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
30411        r.with_limited_depth(|r| {
30412            Ok(Self {
30413                address: ScAddress::read_xdr(r)?,
30414                nonce: i64::read_xdr(r)?,
30415                signature_expiration_ledger: u32::read_xdr(r)?,
30416                signature: ScVal::read_xdr(r)?,
30417            })
30418        })
30419    }
30420}
30421
30422impl WriteXdr for SorobanAddressCredentials {
30423    #[cfg(feature = "std")]
30424    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
30425        w.with_limited_depth(|w| {
30426            self.address.write_xdr(w)?;
30427            self.nonce.write_xdr(w)?;
30428            self.signature_expiration_ledger.write_xdr(w)?;
30429            self.signature.write_xdr(w)?;
30430            Ok(())
30431        })
30432    }
30433}
30434
30435/// SorobanCredentialsType is an XDR Enum defines as:
30436///
30437/// ```text
30438/// enum SorobanCredentialsType
30439/// {
30440///     SOROBAN_CREDENTIALS_SOURCE_ACCOUNT = 0,
30441///     SOROBAN_CREDENTIALS_ADDRESS = 1
30442/// };
30443/// ```
30444///
30445// enum
30446#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
30447#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
30448#[cfg_attr(
30449    all(feature = "serde", feature = "alloc"),
30450    derive(serde::Serialize, serde::Deserialize),
30451    serde(rename_all = "snake_case")
30452)]
30453#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
30454#[repr(i32)]
30455pub enum SorobanCredentialsType {
30456    SourceAccount = 0,
30457    Address = 1,
30458}
30459
30460impl SorobanCredentialsType {
30461    pub const VARIANTS: [SorobanCredentialsType; 2] = [
30462        SorobanCredentialsType::SourceAccount,
30463        SorobanCredentialsType::Address,
30464    ];
30465    pub const VARIANTS_STR: [&'static str; 2] = ["SourceAccount", "Address"];
30466
30467    #[must_use]
30468    pub const fn name(&self) -> &'static str {
30469        match self {
30470            Self::SourceAccount => "SourceAccount",
30471            Self::Address => "Address",
30472        }
30473    }
30474
30475    #[must_use]
30476    pub const fn variants() -> [SorobanCredentialsType; 2] {
30477        Self::VARIANTS
30478    }
30479}
30480
30481impl Name for SorobanCredentialsType {
30482    #[must_use]
30483    fn name(&self) -> &'static str {
30484        Self::name(self)
30485    }
30486}
30487
30488impl Variants<SorobanCredentialsType> for SorobanCredentialsType {
30489    fn variants() -> slice::Iter<'static, SorobanCredentialsType> {
30490        Self::VARIANTS.iter()
30491    }
30492}
30493
30494impl Enum for SorobanCredentialsType {}
30495
30496impl fmt::Display for SorobanCredentialsType {
30497    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
30498        f.write_str(self.name())
30499    }
30500}
30501
30502impl TryFrom<i32> for SorobanCredentialsType {
30503    type Error = Error;
30504
30505    fn try_from(i: i32) -> Result<Self> {
30506        let e = match i {
30507            0 => SorobanCredentialsType::SourceAccount,
30508            1 => SorobanCredentialsType::Address,
30509            #[allow(unreachable_patterns)]
30510            _ => return Err(Error::Invalid),
30511        };
30512        Ok(e)
30513    }
30514}
30515
30516impl From<SorobanCredentialsType> for i32 {
30517    #[must_use]
30518    fn from(e: SorobanCredentialsType) -> Self {
30519        e as Self
30520    }
30521}
30522
30523impl ReadXdr for SorobanCredentialsType {
30524    #[cfg(feature = "std")]
30525    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
30526        r.with_limited_depth(|r| {
30527            let e = i32::read_xdr(r)?;
30528            let v: Self = e.try_into()?;
30529            Ok(v)
30530        })
30531    }
30532}
30533
30534impl WriteXdr for SorobanCredentialsType {
30535    #[cfg(feature = "std")]
30536    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
30537        w.with_limited_depth(|w| {
30538            let i: i32 = (*self).into();
30539            i.write_xdr(w)
30540        })
30541    }
30542}
30543
30544/// SorobanCredentials is an XDR Union defines as:
30545///
30546/// ```text
30547/// union SorobanCredentials switch (SorobanCredentialsType type)
30548/// {
30549/// case SOROBAN_CREDENTIALS_SOURCE_ACCOUNT:
30550///     void;
30551/// case SOROBAN_CREDENTIALS_ADDRESS:
30552///     SorobanAddressCredentials address;
30553/// };
30554/// ```
30555///
30556// union with discriminant SorobanCredentialsType
30557#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
30558#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
30559#[cfg_attr(
30560    all(feature = "serde", feature = "alloc"),
30561    derive(serde::Serialize, serde::Deserialize),
30562    serde(rename_all = "snake_case")
30563)]
30564#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
30565#[allow(clippy::large_enum_variant)]
30566pub enum SorobanCredentials {
30567    SourceAccount,
30568    Address(SorobanAddressCredentials),
30569}
30570
30571impl SorobanCredentials {
30572    pub const VARIANTS: [SorobanCredentialsType; 2] = [
30573        SorobanCredentialsType::SourceAccount,
30574        SorobanCredentialsType::Address,
30575    ];
30576    pub const VARIANTS_STR: [&'static str; 2] = ["SourceAccount", "Address"];
30577
30578    #[must_use]
30579    pub const fn name(&self) -> &'static str {
30580        match self {
30581            Self::SourceAccount => "SourceAccount",
30582            Self::Address(_) => "Address",
30583        }
30584    }
30585
30586    #[must_use]
30587    pub const fn discriminant(&self) -> SorobanCredentialsType {
30588        #[allow(clippy::match_same_arms)]
30589        match self {
30590            Self::SourceAccount => SorobanCredentialsType::SourceAccount,
30591            Self::Address(_) => SorobanCredentialsType::Address,
30592        }
30593    }
30594
30595    #[must_use]
30596    pub const fn variants() -> [SorobanCredentialsType; 2] {
30597        Self::VARIANTS
30598    }
30599}
30600
30601impl Name for SorobanCredentials {
30602    #[must_use]
30603    fn name(&self) -> &'static str {
30604        Self::name(self)
30605    }
30606}
30607
30608impl Discriminant<SorobanCredentialsType> for SorobanCredentials {
30609    #[must_use]
30610    fn discriminant(&self) -> SorobanCredentialsType {
30611        Self::discriminant(self)
30612    }
30613}
30614
30615impl Variants<SorobanCredentialsType> for SorobanCredentials {
30616    fn variants() -> slice::Iter<'static, SorobanCredentialsType> {
30617        Self::VARIANTS.iter()
30618    }
30619}
30620
30621impl Union<SorobanCredentialsType> for SorobanCredentials {}
30622
30623impl ReadXdr for SorobanCredentials {
30624    #[cfg(feature = "std")]
30625    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
30626        r.with_limited_depth(|r| {
30627            let dv: SorobanCredentialsType = <SorobanCredentialsType as ReadXdr>::read_xdr(r)?;
30628            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
30629            let v = match dv {
30630                SorobanCredentialsType::SourceAccount => Self::SourceAccount,
30631                SorobanCredentialsType::Address => {
30632                    Self::Address(SorobanAddressCredentials::read_xdr(r)?)
30633                }
30634                #[allow(unreachable_patterns)]
30635                _ => return Err(Error::Invalid),
30636            };
30637            Ok(v)
30638        })
30639    }
30640}
30641
30642impl WriteXdr for SorobanCredentials {
30643    #[cfg(feature = "std")]
30644    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
30645        w.with_limited_depth(|w| {
30646            self.discriminant().write_xdr(w)?;
30647            #[allow(clippy::match_same_arms)]
30648            match self {
30649                Self::SourceAccount => ().write_xdr(w)?,
30650                Self::Address(v) => v.write_xdr(w)?,
30651            };
30652            Ok(())
30653        })
30654    }
30655}
30656
30657/// SorobanAuthorizationEntry is an XDR Struct defines as:
30658///
30659/// ```text
30660/// struct SorobanAuthorizationEntry
30661/// {
30662///     SorobanCredentials credentials;
30663///     SorobanAuthorizedInvocation rootInvocation;
30664/// };
30665/// ```
30666///
30667#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
30668#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
30669#[cfg_attr(
30670    all(feature = "serde", feature = "alloc"),
30671    derive(serde::Serialize, serde::Deserialize),
30672    serde(rename_all = "snake_case")
30673)]
30674#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
30675pub struct SorobanAuthorizationEntry {
30676    pub credentials: SorobanCredentials,
30677    pub root_invocation: SorobanAuthorizedInvocation,
30678}
30679
30680impl ReadXdr for SorobanAuthorizationEntry {
30681    #[cfg(feature = "std")]
30682    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
30683        r.with_limited_depth(|r| {
30684            Ok(Self {
30685                credentials: SorobanCredentials::read_xdr(r)?,
30686                root_invocation: SorobanAuthorizedInvocation::read_xdr(r)?,
30687            })
30688        })
30689    }
30690}
30691
30692impl WriteXdr for SorobanAuthorizationEntry {
30693    #[cfg(feature = "std")]
30694    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
30695        w.with_limited_depth(|w| {
30696            self.credentials.write_xdr(w)?;
30697            self.root_invocation.write_xdr(w)?;
30698            Ok(())
30699        })
30700    }
30701}
30702
30703/// InvokeHostFunctionOp is an XDR Struct defines as:
30704///
30705/// ```text
30706/// struct InvokeHostFunctionOp
30707/// {
30708///     // Host function to invoke.
30709///     HostFunction hostFunction;
30710///     // Per-address authorizations for this host function.
30711///     SorobanAuthorizationEntry auth<>;
30712/// };
30713/// ```
30714///
30715#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
30716#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
30717#[cfg_attr(
30718    all(feature = "serde", feature = "alloc"),
30719    derive(serde::Serialize, serde::Deserialize),
30720    serde(rename_all = "snake_case")
30721)]
30722#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
30723pub struct InvokeHostFunctionOp {
30724    pub host_function: HostFunction,
30725    pub auth: VecM<SorobanAuthorizationEntry>,
30726}
30727
30728impl ReadXdr for InvokeHostFunctionOp {
30729    #[cfg(feature = "std")]
30730    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
30731        r.with_limited_depth(|r| {
30732            Ok(Self {
30733                host_function: HostFunction::read_xdr(r)?,
30734                auth: VecM::<SorobanAuthorizationEntry>::read_xdr(r)?,
30735            })
30736        })
30737    }
30738}
30739
30740impl WriteXdr for InvokeHostFunctionOp {
30741    #[cfg(feature = "std")]
30742    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
30743        w.with_limited_depth(|w| {
30744            self.host_function.write_xdr(w)?;
30745            self.auth.write_xdr(w)?;
30746            Ok(())
30747        })
30748    }
30749}
30750
30751/// ExtendFootprintTtlOp is an XDR Struct defines as:
30752///
30753/// ```text
30754/// struct ExtendFootprintTTLOp
30755/// {
30756///     ExtensionPoint ext;
30757///     uint32 extendTo;
30758/// };
30759/// ```
30760///
30761#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
30762#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
30763#[cfg_attr(
30764    all(feature = "serde", feature = "alloc"),
30765    derive(serde::Serialize, serde::Deserialize),
30766    serde(rename_all = "snake_case")
30767)]
30768#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
30769pub struct ExtendFootprintTtlOp {
30770    pub ext: ExtensionPoint,
30771    pub extend_to: u32,
30772}
30773
30774impl ReadXdr for ExtendFootprintTtlOp {
30775    #[cfg(feature = "std")]
30776    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
30777        r.with_limited_depth(|r| {
30778            Ok(Self {
30779                ext: ExtensionPoint::read_xdr(r)?,
30780                extend_to: u32::read_xdr(r)?,
30781            })
30782        })
30783    }
30784}
30785
30786impl WriteXdr for ExtendFootprintTtlOp {
30787    #[cfg(feature = "std")]
30788    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
30789        w.with_limited_depth(|w| {
30790            self.ext.write_xdr(w)?;
30791            self.extend_to.write_xdr(w)?;
30792            Ok(())
30793        })
30794    }
30795}
30796
30797/// RestoreFootprintOp is an XDR Struct defines as:
30798///
30799/// ```text
30800/// struct RestoreFootprintOp
30801/// {
30802///     ExtensionPoint ext;
30803/// };
30804/// ```
30805///
30806#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
30807#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
30808#[cfg_attr(
30809    all(feature = "serde", feature = "alloc"),
30810    derive(serde::Serialize, serde::Deserialize),
30811    serde(rename_all = "snake_case")
30812)]
30813#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
30814pub struct RestoreFootprintOp {
30815    pub ext: ExtensionPoint,
30816}
30817
30818impl ReadXdr for RestoreFootprintOp {
30819    #[cfg(feature = "std")]
30820    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
30821        r.with_limited_depth(|r| {
30822            Ok(Self {
30823                ext: ExtensionPoint::read_xdr(r)?,
30824            })
30825        })
30826    }
30827}
30828
30829impl WriteXdr for RestoreFootprintOp {
30830    #[cfg(feature = "std")]
30831    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
30832        w.with_limited_depth(|w| {
30833            self.ext.write_xdr(w)?;
30834            Ok(())
30835        })
30836    }
30837}
30838
30839/// OperationBody is an XDR NestedUnion defines as:
30840///
30841/// ```text
30842/// union switch (OperationType type)
30843///     {
30844///     case CREATE_ACCOUNT:
30845///         CreateAccountOp createAccountOp;
30846///     case PAYMENT:
30847///         PaymentOp paymentOp;
30848///     case PATH_PAYMENT_STRICT_RECEIVE:
30849///         PathPaymentStrictReceiveOp pathPaymentStrictReceiveOp;
30850///     case MANAGE_SELL_OFFER:
30851///         ManageSellOfferOp manageSellOfferOp;
30852///     case CREATE_PASSIVE_SELL_OFFER:
30853///         CreatePassiveSellOfferOp createPassiveSellOfferOp;
30854///     case SET_OPTIONS:
30855///         SetOptionsOp setOptionsOp;
30856///     case CHANGE_TRUST:
30857///         ChangeTrustOp changeTrustOp;
30858///     case ALLOW_TRUST:
30859///         AllowTrustOp allowTrustOp;
30860///     case ACCOUNT_MERGE:
30861///         MuxedAccount destination;
30862///     case INFLATION:
30863///         void;
30864///     case MANAGE_DATA:
30865///         ManageDataOp manageDataOp;
30866///     case BUMP_SEQUENCE:
30867///         BumpSequenceOp bumpSequenceOp;
30868///     case MANAGE_BUY_OFFER:
30869///         ManageBuyOfferOp manageBuyOfferOp;
30870///     case PATH_PAYMENT_STRICT_SEND:
30871///         PathPaymentStrictSendOp pathPaymentStrictSendOp;
30872///     case CREATE_CLAIMABLE_BALANCE:
30873///         CreateClaimableBalanceOp createClaimableBalanceOp;
30874///     case CLAIM_CLAIMABLE_BALANCE:
30875///         ClaimClaimableBalanceOp claimClaimableBalanceOp;
30876///     case BEGIN_SPONSORING_FUTURE_RESERVES:
30877///         BeginSponsoringFutureReservesOp beginSponsoringFutureReservesOp;
30878///     case END_SPONSORING_FUTURE_RESERVES:
30879///         void;
30880///     case REVOKE_SPONSORSHIP:
30881///         RevokeSponsorshipOp revokeSponsorshipOp;
30882///     case CLAWBACK:
30883///         ClawbackOp clawbackOp;
30884///     case CLAWBACK_CLAIMABLE_BALANCE:
30885///         ClawbackClaimableBalanceOp clawbackClaimableBalanceOp;
30886///     case SET_TRUST_LINE_FLAGS:
30887///         SetTrustLineFlagsOp setTrustLineFlagsOp;
30888///     case LIQUIDITY_POOL_DEPOSIT:
30889///         LiquidityPoolDepositOp liquidityPoolDepositOp;
30890///     case LIQUIDITY_POOL_WITHDRAW:
30891///         LiquidityPoolWithdrawOp liquidityPoolWithdrawOp;
30892///     case INVOKE_HOST_FUNCTION:
30893///         InvokeHostFunctionOp invokeHostFunctionOp;
30894///     case EXTEND_FOOTPRINT_TTL:
30895///         ExtendFootprintTTLOp extendFootprintTTLOp;
30896///     case RESTORE_FOOTPRINT:
30897///         RestoreFootprintOp restoreFootprintOp;
30898///     }
30899/// ```
30900///
30901// union with discriminant OperationType
30902#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
30903#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
30904#[cfg_attr(
30905    all(feature = "serde", feature = "alloc"),
30906    derive(serde::Serialize, serde::Deserialize),
30907    serde(rename_all = "snake_case")
30908)]
30909#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
30910#[allow(clippy::large_enum_variant)]
30911pub enum OperationBody {
30912    CreateAccount(CreateAccountOp),
30913    Payment(PaymentOp),
30914    PathPaymentStrictReceive(PathPaymentStrictReceiveOp),
30915    ManageSellOffer(ManageSellOfferOp),
30916    CreatePassiveSellOffer(CreatePassiveSellOfferOp),
30917    SetOptions(SetOptionsOp),
30918    ChangeTrust(ChangeTrustOp),
30919    AllowTrust(AllowTrustOp),
30920    AccountMerge(MuxedAccount),
30921    Inflation,
30922    ManageData(ManageDataOp),
30923    BumpSequence(BumpSequenceOp),
30924    ManageBuyOffer(ManageBuyOfferOp),
30925    PathPaymentStrictSend(PathPaymentStrictSendOp),
30926    CreateClaimableBalance(CreateClaimableBalanceOp),
30927    ClaimClaimableBalance(ClaimClaimableBalanceOp),
30928    BeginSponsoringFutureReserves(BeginSponsoringFutureReservesOp),
30929    EndSponsoringFutureReserves,
30930    RevokeSponsorship(RevokeSponsorshipOp),
30931    Clawback(ClawbackOp),
30932    ClawbackClaimableBalance(ClawbackClaimableBalanceOp),
30933    SetTrustLineFlags(SetTrustLineFlagsOp),
30934    LiquidityPoolDeposit(LiquidityPoolDepositOp),
30935    LiquidityPoolWithdraw(LiquidityPoolWithdrawOp),
30936    InvokeHostFunction(InvokeHostFunctionOp),
30937    ExtendFootprintTtl(ExtendFootprintTtlOp),
30938    RestoreFootprint(RestoreFootprintOp),
30939}
30940
30941impl OperationBody {
30942    pub const VARIANTS: [OperationType; 27] = [
30943        OperationType::CreateAccount,
30944        OperationType::Payment,
30945        OperationType::PathPaymentStrictReceive,
30946        OperationType::ManageSellOffer,
30947        OperationType::CreatePassiveSellOffer,
30948        OperationType::SetOptions,
30949        OperationType::ChangeTrust,
30950        OperationType::AllowTrust,
30951        OperationType::AccountMerge,
30952        OperationType::Inflation,
30953        OperationType::ManageData,
30954        OperationType::BumpSequence,
30955        OperationType::ManageBuyOffer,
30956        OperationType::PathPaymentStrictSend,
30957        OperationType::CreateClaimableBalance,
30958        OperationType::ClaimClaimableBalance,
30959        OperationType::BeginSponsoringFutureReserves,
30960        OperationType::EndSponsoringFutureReserves,
30961        OperationType::RevokeSponsorship,
30962        OperationType::Clawback,
30963        OperationType::ClawbackClaimableBalance,
30964        OperationType::SetTrustLineFlags,
30965        OperationType::LiquidityPoolDeposit,
30966        OperationType::LiquidityPoolWithdraw,
30967        OperationType::InvokeHostFunction,
30968        OperationType::ExtendFootprintTtl,
30969        OperationType::RestoreFootprint,
30970    ];
30971    pub const VARIANTS_STR: [&'static str; 27] = [
30972        "CreateAccount",
30973        "Payment",
30974        "PathPaymentStrictReceive",
30975        "ManageSellOffer",
30976        "CreatePassiveSellOffer",
30977        "SetOptions",
30978        "ChangeTrust",
30979        "AllowTrust",
30980        "AccountMerge",
30981        "Inflation",
30982        "ManageData",
30983        "BumpSequence",
30984        "ManageBuyOffer",
30985        "PathPaymentStrictSend",
30986        "CreateClaimableBalance",
30987        "ClaimClaimableBalance",
30988        "BeginSponsoringFutureReserves",
30989        "EndSponsoringFutureReserves",
30990        "RevokeSponsorship",
30991        "Clawback",
30992        "ClawbackClaimableBalance",
30993        "SetTrustLineFlags",
30994        "LiquidityPoolDeposit",
30995        "LiquidityPoolWithdraw",
30996        "InvokeHostFunction",
30997        "ExtendFootprintTtl",
30998        "RestoreFootprint",
30999    ];
31000
31001    #[must_use]
31002    pub const fn name(&self) -> &'static str {
31003        match self {
31004            Self::CreateAccount(_) => "CreateAccount",
31005            Self::Payment(_) => "Payment",
31006            Self::PathPaymentStrictReceive(_) => "PathPaymentStrictReceive",
31007            Self::ManageSellOffer(_) => "ManageSellOffer",
31008            Self::CreatePassiveSellOffer(_) => "CreatePassiveSellOffer",
31009            Self::SetOptions(_) => "SetOptions",
31010            Self::ChangeTrust(_) => "ChangeTrust",
31011            Self::AllowTrust(_) => "AllowTrust",
31012            Self::AccountMerge(_) => "AccountMerge",
31013            Self::Inflation => "Inflation",
31014            Self::ManageData(_) => "ManageData",
31015            Self::BumpSequence(_) => "BumpSequence",
31016            Self::ManageBuyOffer(_) => "ManageBuyOffer",
31017            Self::PathPaymentStrictSend(_) => "PathPaymentStrictSend",
31018            Self::CreateClaimableBalance(_) => "CreateClaimableBalance",
31019            Self::ClaimClaimableBalance(_) => "ClaimClaimableBalance",
31020            Self::BeginSponsoringFutureReserves(_) => "BeginSponsoringFutureReserves",
31021            Self::EndSponsoringFutureReserves => "EndSponsoringFutureReserves",
31022            Self::RevokeSponsorship(_) => "RevokeSponsorship",
31023            Self::Clawback(_) => "Clawback",
31024            Self::ClawbackClaimableBalance(_) => "ClawbackClaimableBalance",
31025            Self::SetTrustLineFlags(_) => "SetTrustLineFlags",
31026            Self::LiquidityPoolDeposit(_) => "LiquidityPoolDeposit",
31027            Self::LiquidityPoolWithdraw(_) => "LiquidityPoolWithdraw",
31028            Self::InvokeHostFunction(_) => "InvokeHostFunction",
31029            Self::ExtendFootprintTtl(_) => "ExtendFootprintTtl",
31030            Self::RestoreFootprint(_) => "RestoreFootprint",
31031        }
31032    }
31033
31034    #[must_use]
31035    pub const fn discriminant(&self) -> OperationType {
31036        #[allow(clippy::match_same_arms)]
31037        match self {
31038            Self::CreateAccount(_) => OperationType::CreateAccount,
31039            Self::Payment(_) => OperationType::Payment,
31040            Self::PathPaymentStrictReceive(_) => OperationType::PathPaymentStrictReceive,
31041            Self::ManageSellOffer(_) => OperationType::ManageSellOffer,
31042            Self::CreatePassiveSellOffer(_) => OperationType::CreatePassiveSellOffer,
31043            Self::SetOptions(_) => OperationType::SetOptions,
31044            Self::ChangeTrust(_) => OperationType::ChangeTrust,
31045            Self::AllowTrust(_) => OperationType::AllowTrust,
31046            Self::AccountMerge(_) => OperationType::AccountMerge,
31047            Self::Inflation => OperationType::Inflation,
31048            Self::ManageData(_) => OperationType::ManageData,
31049            Self::BumpSequence(_) => OperationType::BumpSequence,
31050            Self::ManageBuyOffer(_) => OperationType::ManageBuyOffer,
31051            Self::PathPaymentStrictSend(_) => OperationType::PathPaymentStrictSend,
31052            Self::CreateClaimableBalance(_) => OperationType::CreateClaimableBalance,
31053            Self::ClaimClaimableBalance(_) => OperationType::ClaimClaimableBalance,
31054            Self::BeginSponsoringFutureReserves(_) => OperationType::BeginSponsoringFutureReserves,
31055            Self::EndSponsoringFutureReserves => OperationType::EndSponsoringFutureReserves,
31056            Self::RevokeSponsorship(_) => OperationType::RevokeSponsorship,
31057            Self::Clawback(_) => OperationType::Clawback,
31058            Self::ClawbackClaimableBalance(_) => OperationType::ClawbackClaimableBalance,
31059            Self::SetTrustLineFlags(_) => OperationType::SetTrustLineFlags,
31060            Self::LiquidityPoolDeposit(_) => OperationType::LiquidityPoolDeposit,
31061            Self::LiquidityPoolWithdraw(_) => OperationType::LiquidityPoolWithdraw,
31062            Self::InvokeHostFunction(_) => OperationType::InvokeHostFunction,
31063            Self::ExtendFootprintTtl(_) => OperationType::ExtendFootprintTtl,
31064            Self::RestoreFootprint(_) => OperationType::RestoreFootprint,
31065        }
31066    }
31067
31068    #[must_use]
31069    pub const fn variants() -> [OperationType; 27] {
31070        Self::VARIANTS
31071    }
31072}
31073
31074impl Name for OperationBody {
31075    #[must_use]
31076    fn name(&self) -> &'static str {
31077        Self::name(self)
31078    }
31079}
31080
31081impl Discriminant<OperationType> for OperationBody {
31082    #[must_use]
31083    fn discriminant(&self) -> OperationType {
31084        Self::discriminant(self)
31085    }
31086}
31087
31088impl Variants<OperationType> for OperationBody {
31089    fn variants() -> slice::Iter<'static, OperationType> {
31090        Self::VARIANTS.iter()
31091    }
31092}
31093
31094impl Union<OperationType> for OperationBody {}
31095
31096impl ReadXdr for OperationBody {
31097    #[cfg(feature = "std")]
31098    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
31099        r.with_limited_depth(|r| {
31100            let dv: OperationType = <OperationType as ReadXdr>::read_xdr(r)?;
31101            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
31102            let v = match dv {
31103                OperationType::CreateAccount => Self::CreateAccount(CreateAccountOp::read_xdr(r)?),
31104                OperationType::Payment => Self::Payment(PaymentOp::read_xdr(r)?),
31105                OperationType::PathPaymentStrictReceive => {
31106                    Self::PathPaymentStrictReceive(PathPaymentStrictReceiveOp::read_xdr(r)?)
31107                }
31108                OperationType::ManageSellOffer => {
31109                    Self::ManageSellOffer(ManageSellOfferOp::read_xdr(r)?)
31110                }
31111                OperationType::CreatePassiveSellOffer => {
31112                    Self::CreatePassiveSellOffer(CreatePassiveSellOfferOp::read_xdr(r)?)
31113                }
31114                OperationType::SetOptions => Self::SetOptions(SetOptionsOp::read_xdr(r)?),
31115                OperationType::ChangeTrust => Self::ChangeTrust(ChangeTrustOp::read_xdr(r)?),
31116                OperationType::AllowTrust => Self::AllowTrust(AllowTrustOp::read_xdr(r)?),
31117                OperationType::AccountMerge => Self::AccountMerge(MuxedAccount::read_xdr(r)?),
31118                OperationType::Inflation => Self::Inflation,
31119                OperationType::ManageData => Self::ManageData(ManageDataOp::read_xdr(r)?),
31120                OperationType::BumpSequence => Self::BumpSequence(BumpSequenceOp::read_xdr(r)?),
31121                OperationType::ManageBuyOffer => {
31122                    Self::ManageBuyOffer(ManageBuyOfferOp::read_xdr(r)?)
31123                }
31124                OperationType::PathPaymentStrictSend => {
31125                    Self::PathPaymentStrictSend(PathPaymentStrictSendOp::read_xdr(r)?)
31126                }
31127                OperationType::CreateClaimableBalance => {
31128                    Self::CreateClaimableBalance(CreateClaimableBalanceOp::read_xdr(r)?)
31129                }
31130                OperationType::ClaimClaimableBalance => {
31131                    Self::ClaimClaimableBalance(ClaimClaimableBalanceOp::read_xdr(r)?)
31132                }
31133                OperationType::BeginSponsoringFutureReserves => {
31134                    Self::BeginSponsoringFutureReserves(BeginSponsoringFutureReservesOp::read_xdr(
31135                        r,
31136                    )?)
31137                }
31138                OperationType::EndSponsoringFutureReserves => Self::EndSponsoringFutureReserves,
31139                OperationType::RevokeSponsorship => {
31140                    Self::RevokeSponsorship(RevokeSponsorshipOp::read_xdr(r)?)
31141                }
31142                OperationType::Clawback => Self::Clawback(ClawbackOp::read_xdr(r)?),
31143                OperationType::ClawbackClaimableBalance => {
31144                    Self::ClawbackClaimableBalance(ClawbackClaimableBalanceOp::read_xdr(r)?)
31145                }
31146                OperationType::SetTrustLineFlags => {
31147                    Self::SetTrustLineFlags(SetTrustLineFlagsOp::read_xdr(r)?)
31148                }
31149                OperationType::LiquidityPoolDeposit => {
31150                    Self::LiquidityPoolDeposit(LiquidityPoolDepositOp::read_xdr(r)?)
31151                }
31152                OperationType::LiquidityPoolWithdraw => {
31153                    Self::LiquidityPoolWithdraw(LiquidityPoolWithdrawOp::read_xdr(r)?)
31154                }
31155                OperationType::InvokeHostFunction => {
31156                    Self::InvokeHostFunction(InvokeHostFunctionOp::read_xdr(r)?)
31157                }
31158                OperationType::ExtendFootprintTtl => {
31159                    Self::ExtendFootprintTtl(ExtendFootprintTtlOp::read_xdr(r)?)
31160                }
31161                OperationType::RestoreFootprint => {
31162                    Self::RestoreFootprint(RestoreFootprintOp::read_xdr(r)?)
31163                }
31164                #[allow(unreachable_patterns)]
31165                _ => return Err(Error::Invalid),
31166            };
31167            Ok(v)
31168        })
31169    }
31170}
31171
31172impl WriteXdr for OperationBody {
31173    #[cfg(feature = "std")]
31174    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
31175        w.with_limited_depth(|w| {
31176            self.discriminant().write_xdr(w)?;
31177            #[allow(clippy::match_same_arms)]
31178            match self {
31179                Self::CreateAccount(v) => v.write_xdr(w)?,
31180                Self::Payment(v) => v.write_xdr(w)?,
31181                Self::PathPaymentStrictReceive(v) => v.write_xdr(w)?,
31182                Self::ManageSellOffer(v) => v.write_xdr(w)?,
31183                Self::CreatePassiveSellOffer(v) => v.write_xdr(w)?,
31184                Self::SetOptions(v) => v.write_xdr(w)?,
31185                Self::ChangeTrust(v) => v.write_xdr(w)?,
31186                Self::AllowTrust(v) => v.write_xdr(w)?,
31187                Self::AccountMerge(v) => v.write_xdr(w)?,
31188                Self::Inflation => ().write_xdr(w)?,
31189                Self::ManageData(v) => v.write_xdr(w)?,
31190                Self::BumpSequence(v) => v.write_xdr(w)?,
31191                Self::ManageBuyOffer(v) => v.write_xdr(w)?,
31192                Self::PathPaymentStrictSend(v) => v.write_xdr(w)?,
31193                Self::CreateClaimableBalance(v) => v.write_xdr(w)?,
31194                Self::ClaimClaimableBalance(v) => v.write_xdr(w)?,
31195                Self::BeginSponsoringFutureReserves(v) => v.write_xdr(w)?,
31196                Self::EndSponsoringFutureReserves => ().write_xdr(w)?,
31197                Self::RevokeSponsorship(v) => v.write_xdr(w)?,
31198                Self::Clawback(v) => v.write_xdr(w)?,
31199                Self::ClawbackClaimableBalance(v) => v.write_xdr(w)?,
31200                Self::SetTrustLineFlags(v) => v.write_xdr(w)?,
31201                Self::LiquidityPoolDeposit(v) => v.write_xdr(w)?,
31202                Self::LiquidityPoolWithdraw(v) => v.write_xdr(w)?,
31203                Self::InvokeHostFunction(v) => v.write_xdr(w)?,
31204                Self::ExtendFootprintTtl(v) => v.write_xdr(w)?,
31205                Self::RestoreFootprint(v) => v.write_xdr(w)?,
31206            };
31207            Ok(())
31208        })
31209    }
31210}
31211
31212/// Operation is an XDR Struct defines as:
31213///
31214/// ```text
31215/// struct Operation
31216/// {
31217///     // sourceAccount is the account used to run the operation
31218///     // if not set, the runtime defaults to "sourceAccount" specified at
31219///     // the transaction level
31220///     MuxedAccount* sourceAccount;
31221///
31222///     union switch (OperationType type)
31223///     {
31224///     case CREATE_ACCOUNT:
31225///         CreateAccountOp createAccountOp;
31226///     case PAYMENT:
31227///         PaymentOp paymentOp;
31228///     case PATH_PAYMENT_STRICT_RECEIVE:
31229///         PathPaymentStrictReceiveOp pathPaymentStrictReceiveOp;
31230///     case MANAGE_SELL_OFFER:
31231///         ManageSellOfferOp manageSellOfferOp;
31232///     case CREATE_PASSIVE_SELL_OFFER:
31233///         CreatePassiveSellOfferOp createPassiveSellOfferOp;
31234///     case SET_OPTIONS:
31235///         SetOptionsOp setOptionsOp;
31236///     case CHANGE_TRUST:
31237///         ChangeTrustOp changeTrustOp;
31238///     case ALLOW_TRUST:
31239///         AllowTrustOp allowTrustOp;
31240///     case ACCOUNT_MERGE:
31241///         MuxedAccount destination;
31242///     case INFLATION:
31243///         void;
31244///     case MANAGE_DATA:
31245///         ManageDataOp manageDataOp;
31246///     case BUMP_SEQUENCE:
31247///         BumpSequenceOp bumpSequenceOp;
31248///     case MANAGE_BUY_OFFER:
31249///         ManageBuyOfferOp manageBuyOfferOp;
31250///     case PATH_PAYMENT_STRICT_SEND:
31251///         PathPaymentStrictSendOp pathPaymentStrictSendOp;
31252///     case CREATE_CLAIMABLE_BALANCE:
31253///         CreateClaimableBalanceOp createClaimableBalanceOp;
31254///     case CLAIM_CLAIMABLE_BALANCE:
31255///         ClaimClaimableBalanceOp claimClaimableBalanceOp;
31256///     case BEGIN_SPONSORING_FUTURE_RESERVES:
31257///         BeginSponsoringFutureReservesOp beginSponsoringFutureReservesOp;
31258///     case END_SPONSORING_FUTURE_RESERVES:
31259///         void;
31260///     case REVOKE_SPONSORSHIP:
31261///         RevokeSponsorshipOp revokeSponsorshipOp;
31262///     case CLAWBACK:
31263///         ClawbackOp clawbackOp;
31264///     case CLAWBACK_CLAIMABLE_BALANCE:
31265///         ClawbackClaimableBalanceOp clawbackClaimableBalanceOp;
31266///     case SET_TRUST_LINE_FLAGS:
31267///         SetTrustLineFlagsOp setTrustLineFlagsOp;
31268///     case LIQUIDITY_POOL_DEPOSIT:
31269///         LiquidityPoolDepositOp liquidityPoolDepositOp;
31270///     case LIQUIDITY_POOL_WITHDRAW:
31271///         LiquidityPoolWithdrawOp liquidityPoolWithdrawOp;
31272///     case INVOKE_HOST_FUNCTION:
31273///         InvokeHostFunctionOp invokeHostFunctionOp;
31274///     case EXTEND_FOOTPRINT_TTL:
31275///         ExtendFootprintTTLOp extendFootprintTTLOp;
31276///     case RESTORE_FOOTPRINT:
31277///         RestoreFootprintOp restoreFootprintOp;
31278///     }
31279///     body;
31280/// };
31281/// ```
31282///
31283#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
31284#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
31285#[cfg_attr(
31286    all(feature = "serde", feature = "alloc"),
31287    derive(serde::Serialize, serde::Deserialize),
31288    serde(rename_all = "snake_case")
31289)]
31290#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
31291pub struct Operation {
31292    pub source_account: Option<MuxedAccount>,
31293    pub body: OperationBody,
31294}
31295
31296impl ReadXdr for Operation {
31297    #[cfg(feature = "std")]
31298    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
31299        r.with_limited_depth(|r| {
31300            Ok(Self {
31301                source_account: Option::<MuxedAccount>::read_xdr(r)?,
31302                body: OperationBody::read_xdr(r)?,
31303            })
31304        })
31305    }
31306}
31307
31308impl WriteXdr for Operation {
31309    #[cfg(feature = "std")]
31310    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
31311        w.with_limited_depth(|w| {
31312            self.source_account.write_xdr(w)?;
31313            self.body.write_xdr(w)?;
31314            Ok(())
31315        })
31316    }
31317}
31318
31319/// HashIdPreimageOperationId is an XDR NestedStruct defines as:
31320///
31321/// ```text
31322/// struct
31323///     {
31324///         AccountID sourceAccount;
31325///         SequenceNumber seqNum;
31326///         uint32 opNum;
31327///     }
31328/// ```
31329///
31330#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
31331#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
31332#[cfg_attr(
31333    all(feature = "serde", feature = "alloc"),
31334    derive(serde::Serialize, serde::Deserialize),
31335    serde(rename_all = "snake_case")
31336)]
31337#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
31338pub struct HashIdPreimageOperationId {
31339    pub source_account: AccountId,
31340    pub seq_num: SequenceNumber,
31341    pub op_num: u32,
31342}
31343
31344impl ReadXdr for HashIdPreimageOperationId {
31345    #[cfg(feature = "std")]
31346    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
31347        r.with_limited_depth(|r| {
31348            Ok(Self {
31349                source_account: AccountId::read_xdr(r)?,
31350                seq_num: SequenceNumber::read_xdr(r)?,
31351                op_num: u32::read_xdr(r)?,
31352            })
31353        })
31354    }
31355}
31356
31357impl WriteXdr for HashIdPreimageOperationId {
31358    #[cfg(feature = "std")]
31359    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
31360        w.with_limited_depth(|w| {
31361            self.source_account.write_xdr(w)?;
31362            self.seq_num.write_xdr(w)?;
31363            self.op_num.write_xdr(w)?;
31364            Ok(())
31365        })
31366    }
31367}
31368
31369/// HashIdPreimageRevokeId is an XDR NestedStruct defines as:
31370///
31371/// ```text
31372/// struct
31373///     {
31374///         AccountID sourceAccount;
31375///         SequenceNumber seqNum;
31376///         uint32 opNum;
31377///         PoolID liquidityPoolID;
31378///         Asset asset;
31379///     }
31380/// ```
31381///
31382#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
31383#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
31384#[cfg_attr(
31385    all(feature = "serde", feature = "alloc"),
31386    derive(serde::Serialize, serde::Deserialize),
31387    serde(rename_all = "snake_case")
31388)]
31389#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
31390pub struct HashIdPreimageRevokeId {
31391    pub source_account: AccountId,
31392    pub seq_num: SequenceNumber,
31393    pub op_num: u32,
31394    pub liquidity_pool_id: PoolId,
31395    pub asset: Asset,
31396}
31397
31398impl ReadXdr for HashIdPreimageRevokeId {
31399    #[cfg(feature = "std")]
31400    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
31401        r.with_limited_depth(|r| {
31402            Ok(Self {
31403                source_account: AccountId::read_xdr(r)?,
31404                seq_num: SequenceNumber::read_xdr(r)?,
31405                op_num: u32::read_xdr(r)?,
31406                liquidity_pool_id: PoolId::read_xdr(r)?,
31407                asset: Asset::read_xdr(r)?,
31408            })
31409        })
31410    }
31411}
31412
31413impl WriteXdr for HashIdPreimageRevokeId {
31414    #[cfg(feature = "std")]
31415    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
31416        w.with_limited_depth(|w| {
31417            self.source_account.write_xdr(w)?;
31418            self.seq_num.write_xdr(w)?;
31419            self.op_num.write_xdr(w)?;
31420            self.liquidity_pool_id.write_xdr(w)?;
31421            self.asset.write_xdr(w)?;
31422            Ok(())
31423        })
31424    }
31425}
31426
31427/// HashIdPreimageContractId is an XDR NestedStruct defines as:
31428///
31429/// ```text
31430/// struct
31431///     {
31432///         Hash networkID;
31433///         ContractIDPreimage contractIDPreimage;
31434///     }
31435/// ```
31436///
31437#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
31438#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
31439#[cfg_attr(
31440    all(feature = "serde", feature = "alloc"),
31441    derive(serde::Serialize, serde::Deserialize),
31442    serde(rename_all = "snake_case")
31443)]
31444#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
31445pub struct HashIdPreimageContractId {
31446    pub network_id: Hash,
31447    pub contract_id_preimage: ContractIdPreimage,
31448}
31449
31450impl ReadXdr for HashIdPreimageContractId {
31451    #[cfg(feature = "std")]
31452    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
31453        r.with_limited_depth(|r| {
31454            Ok(Self {
31455                network_id: Hash::read_xdr(r)?,
31456                contract_id_preimage: ContractIdPreimage::read_xdr(r)?,
31457            })
31458        })
31459    }
31460}
31461
31462impl WriteXdr for HashIdPreimageContractId {
31463    #[cfg(feature = "std")]
31464    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
31465        w.with_limited_depth(|w| {
31466            self.network_id.write_xdr(w)?;
31467            self.contract_id_preimage.write_xdr(w)?;
31468            Ok(())
31469        })
31470    }
31471}
31472
31473/// HashIdPreimageSorobanAuthorization is an XDR NestedStruct defines as:
31474///
31475/// ```text
31476/// struct
31477///     {
31478///         Hash networkID;
31479///         int64 nonce;
31480///         uint32 signatureExpirationLedger;
31481///         SorobanAuthorizedInvocation invocation;
31482///     }
31483/// ```
31484///
31485#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
31486#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
31487#[cfg_attr(
31488    all(feature = "serde", feature = "alloc"),
31489    derive(serde::Serialize, serde::Deserialize),
31490    serde(rename_all = "snake_case")
31491)]
31492#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
31493pub struct HashIdPreimageSorobanAuthorization {
31494    pub network_id: Hash,
31495    pub nonce: i64,
31496    pub signature_expiration_ledger: u32,
31497    pub invocation: SorobanAuthorizedInvocation,
31498}
31499
31500impl ReadXdr for HashIdPreimageSorobanAuthorization {
31501    #[cfg(feature = "std")]
31502    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
31503        r.with_limited_depth(|r| {
31504            Ok(Self {
31505                network_id: Hash::read_xdr(r)?,
31506                nonce: i64::read_xdr(r)?,
31507                signature_expiration_ledger: u32::read_xdr(r)?,
31508                invocation: SorobanAuthorizedInvocation::read_xdr(r)?,
31509            })
31510        })
31511    }
31512}
31513
31514impl WriteXdr for HashIdPreimageSorobanAuthorization {
31515    #[cfg(feature = "std")]
31516    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
31517        w.with_limited_depth(|w| {
31518            self.network_id.write_xdr(w)?;
31519            self.nonce.write_xdr(w)?;
31520            self.signature_expiration_ledger.write_xdr(w)?;
31521            self.invocation.write_xdr(w)?;
31522            Ok(())
31523        })
31524    }
31525}
31526
31527/// HashIdPreimage is an XDR Union defines as:
31528///
31529/// ```text
31530/// union HashIDPreimage switch (EnvelopeType type)
31531/// {
31532/// case ENVELOPE_TYPE_OP_ID:
31533///     struct
31534///     {
31535///         AccountID sourceAccount;
31536///         SequenceNumber seqNum;
31537///         uint32 opNum;
31538///     } operationID;
31539/// case ENVELOPE_TYPE_POOL_REVOKE_OP_ID:
31540///     struct
31541///     {
31542///         AccountID sourceAccount;
31543///         SequenceNumber seqNum;
31544///         uint32 opNum;
31545///         PoolID liquidityPoolID;
31546///         Asset asset;
31547///     } revokeID;
31548/// case ENVELOPE_TYPE_CONTRACT_ID:
31549///     struct
31550///     {
31551///         Hash networkID;
31552///         ContractIDPreimage contractIDPreimage;
31553///     } contractID;
31554/// case ENVELOPE_TYPE_SOROBAN_AUTHORIZATION:
31555///     struct
31556///     {
31557///         Hash networkID;
31558///         int64 nonce;
31559///         uint32 signatureExpirationLedger;
31560///         SorobanAuthorizedInvocation invocation;
31561///     } sorobanAuthorization;
31562/// };
31563/// ```
31564///
31565// union with discriminant EnvelopeType
31566#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
31567#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
31568#[cfg_attr(
31569    all(feature = "serde", feature = "alloc"),
31570    derive(serde::Serialize, serde::Deserialize),
31571    serde(rename_all = "snake_case")
31572)]
31573#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
31574#[allow(clippy::large_enum_variant)]
31575pub enum HashIdPreimage {
31576    OpId(HashIdPreimageOperationId),
31577    PoolRevokeOpId(HashIdPreimageRevokeId),
31578    ContractId(HashIdPreimageContractId),
31579    SorobanAuthorization(HashIdPreimageSorobanAuthorization),
31580}
31581
31582impl HashIdPreimage {
31583    pub const VARIANTS: [EnvelopeType; 4] = [
31584        EnvelopeType::OpId,
31585        EnvelopeType::PoolRevokeOpId,
31586        EnvelopeType::ContractId,
31587        EnvelopeType::SorobanAuthorization,
31588    ];
31589    pub const VARIANTS_STR: [&'static str; 4] = [
31590        "OpId",
31591        "PoolRevokeOpId",
31592        "ContractId",
31593        "SorobanAuthorization",
31594    ];
31595
31596    #[must_use]
31597    pub const fn name(&self) -> &'static str {
31598        match self {
31599            Self::OpId(_) => "OpId",
31600            Self::PoolRevokeOpId(_) => "PoolRevokeOpId",
31601            Self::ContractId(_) => "ContractId",
31602            Self::SorobanAuthorization(_) => "SorobanAuthorization",
31603        }
31604    }
31605
31606    #[must_use]
31607    pub const fn discriminant(&self) -> EnvelopeType {
31608        #[allow(clippy::match_same_arms)]
31609        match self {
31610            Self::OpId(_) => EnvelopeType::OpId,
31611            Self::PoolRevokeOpId(_) => EnvelopeType::PoolRevokeOpId,
31612            Self::ContractId(_) => EnvelopeType::ContractId,
31613            Self::SorobanAuthorization(_) => EnvelopeType::SorobanAuthorization,
31614        }
31615    }
31616
31617    #[must_use]
31618    pub const fn variants() -> [EnvelopeType; 4] {
31619        Self::VARIANTS
31620    }
31621}
31622
31623impl Name for HashIdPreimage {
31624    #[must_use]
31625    fn name(&self) -> &'static str {
31626        Self::name(self)
31627    }
31628}
31629
31630impl Discriminant<EnvelopeType> for HashIdPreimage {
31631    #[must_use]
31632    fn discriminant(&self) -> EnvelopeType {
31633        Self::discriminant(self)
31634    }
31635}
31636
31637impl Variants<EnvelopeType> for HashIdPreimage {
31638    fn variants() -> slice::Iter<'static, EnvelopeType> {
31639        Self::VARIANTS.iter()
31640    }
31641}
31642
31643impl Union<EnvelopeType> for HashIdPreimage {}
31644
31645impl ReadXdr for HashIdPreimage {
31646    #[cfg(feature = "std")]
31647    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
31648        r.with_limited_depth(|r| {
31649            let dv: EnvelopeType = <EnvelopeType as ReadXdr>::read_xdr(r)?;
31650            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
31651            let v = match dv {
31652                EnvelopeType::OpId => Self::OpId(HashIdPreimageOperationId::read_xdr(r)?),
31653                EnvelopeType::PoolRevokeOpId => {
31654                    Self::PoolRevokeOpId(HashIdPreimageRevokeId::read_xdr(r)?)
31655                }
31656                EnvelopeType::ContractId => {
31657                    Self::ContractId(HashIdPreimageContractId::read_xdr(r)?)
31658                }
31659                EnvelopeType::SorobanAuthorization => {
31660                    Self::SorobanAuthorization(HashIdPreimageSorobanAuthorization::read_xdr(r)?)
31661                }
31662                #[allow(unreachable_patterns)]
31663                _ => return Err(Error::Invalid),
31664            };
31665            Ok(v)
31666        })
31667    }
31668}
31669
31670impl WriteXdr for HashIdPreimage {
31671    #[cfg(feature = "std")]
31672    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
31673        w.with_limited_depth(|w| {
31674            self.discriminant().write_xdr(w)?;
31675            #[allow(clippy::match_same_arms)]
31676            match self {
31677                Self::OpId(v) => v.write_xdr(w)?,
31678                Self::PoolRevokeOpId(v) => v.write_xdr(w)?,
31679                Self::ContractId(v) => v.write_xdr(w)?,
31680                Self::SorobanAuthorization(v) => v.write_xdr(w)?,
31681            };
31682            Ok(())
31683        })
31684    }
31685}
31686
31687/// MemoType is an XDR Enum defines as:
31688///
31689/// ```text
31690/// enum MemoType
31691/// {
31692///     MEMO_NONE = 0,
31693///     MEMO_TEXT = 1,
31694///     MEMO_ID = 2,
31695///     MEMO_HASH = 3,
31696///     MEMO_RETURN = 4
31697/// };
31698/// ```
31699///
31700// enum
31701#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
31702#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
31703#[cfg_attr(
31704    all(feature = "serde", feature = "alloc"),
31705    derive(serde::Serialize, serde::Deserialize),
31706    serde(rename_all = "snake_case")
31707)]
31708#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
31709#[repr(i32)]
31710pub enum MemoType {
31711    None = 0,
31712    Text = 1,
31713    Id = 2,
31714    Hash = 3,
31715    Return = 4,
31716}
31717
31718impl MemoType {
31719    pub const VARIANTS: [MemoType; 5] = [
31720        MemoType::None,
31721        MemoType::Text,
31722        MemoType::Id,
31723        MemoType::Hash,
31724        MemoType::Return,
31725    ];
31726    pub const VARIANTS_STR: [&'static str; 5] = ["None", "Text", "Id", "Hash", "Return"];
31727
31728    #[must_use]
31729    pub const fn name(&self) -> &'static str {
31730        match self {
31731            Self::None => "None",
31732            Self::Text => "Text",
31733            Self::Id => "Id",
31734            Self::Hash => "Hash",
31735            Self::Return => "Return",
31736        }
31737    }
31738
31739    #[must_use]
31740    pub const fn variants() -> [MemoType; 5] {
31741        Self::VARIANTS
31742    }
31743}
31744
31745impl Name for MemoType {
31746    #[must_use]
31747    fn name(&self) -> &'static str {
31748        Self::name(self)
31749    }
31750}
31751
31752impl Variants<MemoType> for MemoType {
31753    fn variants() -> slice::Iter<'static, MemoType> {
31754        Self::VARIANTS.iter()
31755    }
31756}
31757
31758impl Enum for MemoType {}
31759
31760impl fmt::Display for MemoType {
31761    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
31762        f.write_str(self.name())
31763    }
31764}
31765
31766impl TryFrom<i32> for MemoType {
31767    type Error = Error;
31768
31769    fn try_from(i: i32) -> Result<Self> {
31770        let e = match i {
31771            0 => MemoType::None,
31772            1 => MemoType::Text,
31773            2 => MemoType::Id,
31774            3 => MemoType::Hash,
31775            4 => MemoType::Return,
31776            #[allow(unreachable_patterns)]
31777            _ => return Err(Error::Invalid),
31778        };
31779        Ok(e)
31780    }
31781}
31782
31783impl From<MemoType> for i32 {
31784    #[must_use]
31785    fn from(e: MemoType) -> Self {
31786        e as Self
31787    }
31788}
31789
31790impl ReadXdr for MemoType {
31791    #[cfg(feature = "std")]
31792    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
31793        r.with_limited_depth(|r| {
31794            let e = i32::read_xdr(r)?;
31795            let v: Self = e.try_into()?;
31796            Ok(v)
31797        })
31798    }
31799}
31800
31801impl WriteXdr for MemoType {
31802    #[cfg(feature = "std")]
31803    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
31804        w.with_limited_depth(|w| {
31805            let i: i32 = (*self).into();
31806            i.write_xdr(w)
31807        })
31808    }
31809}
31810
31811/// Memo is an XDR Union defines as:
31812///
31813/// ```text
31814/// union Memo switch (MemoType type)
31815/// {
31816/// case MEMO_NONE:
31817///     void;
31818/// case MEMO_TEXT:
31819///     string text<28>;
31820/// case MEMO_ID:
31821///     uint64 id;
31822/// case MEMO_HASH:
31823///     Hash hash; // the hash of what to pull from the content server
31824/// case MEMO_RETURN:
31825///     Hash retHash; // the hash of the tx you are rejecting
31826/// };
31827/// ```
31828///
31829// union with discriminant MemoType
31830#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
31831#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
31832#[cfg_attr(
31833    all(feature = "serde", feature = "alloc"),
31834    derive(serde::Serialize, serde::Deserialize),
31835    serde(rename_all = "snake_case")
31836)]
31837#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
31838#[allow(clippy::large_enum_variant)]
31839pub enum Memo {
31840    None,
31841    Text(StringM<28>),
31842    Id(u64),
31843    Hash(Hash),
31844    Return(Hash),
31845}
31846
31847impl Memo {
31848    pub const VARIANTS: [MemoType; 5] = [
31849        MemoType::None,
31850        MemoType::Text,
31851        MemoType::Id,
31852        MemoType::Hash,
31853        MemoType::Return,
31854    ];
31855    pub const VARIANTS_STR: [&'static str; 5] = ["None", "Text", "Id", "Hash", "Return"];
31856
31857    #[must_use]
31858    pub const fn name(&self) -> &'static str {
31859        match self {
31860            Self::None => "None",
31861            Self::Text(_) => "Text",
31862            Self::Id(_) => "Id",
31863            Self::Hash(_) => "Hash",
31864            Self::Return(_) => "Return",
31865        }
31866    }
31867
31868    #[must_use]
31869    pub const fn discriminant(&self) -> MemoType {
31870        #[allow(clippy::match_same_arms)]
31871        match self {
31872            Self::None => MemoType::None,
31873            Self::Text(_) => MemoType::Text,
31874            Self::Id(_) => MemoType::Id,
31875            Self::Hash(_) => MemoType::Hash,
31876            Self::Return(_) => MemoType::Return,
31877        }
31878    }
31879
31880    #[must_use]
31881    pub const fn variants() -> [MemoType; 5] {
31882        Self::VARIANTS
31883    }
31884}
31885
31886impl Name for Memo {
31887    #[must_use]
31888    fn name(&self) -> &'static str {
31889        Self::name(self)
31890    }
31891}
31892
31893impl Discriminant<MemoType> for Memo {
31894    #[must_use]
31895    fn discriminant(&self) -> MemoType {
31896        Self::discriminant(self)
31897    }
31898}
31899
31900impl Variants<MemoType> for Memo {
31901    fn variants() -> slice::Iter<'static, MemoType> {
31902        Self::VARIANTS.iter()
31903    }
31904}
31905
31906impl Union<MemoType> for Memo {}
31907
31908impl ReadXdr for Memo {
31909    #[cfg(feature = "std")]
31910    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
31911        r.with_limited_depth(|r| {
31912            let dv: MemoType = <MemoType as ReadXdr>::read_xdr(r)?;
31913            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
31914            let v = match dv {
31915                MemoType::None => Self::None,
31916                MemoType::Text => Self::Text(StringM::<28>::read_xdr(r)?),
31917                MemoType::Id => Self::Id(u64::read_xdr(r)?),
31918                MemoType::Hash => Self::Hash(Hash::read_xdr(r)?),
31919                MemoType::Return => Self::Return(Hash::read_xdr(r)?),
31920                #[allow(unreachable_patterns)]
31921                _ => return Err(Error::Invalid),
31922            };
31923            Ok(v)
31924        })
31925    }
31926}
31927
31928impl WriteXdr for Memo {
31929    #[cfg(feature = "std")]
31930    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
31931        w.with_limited_depth(|w| {
31932            self.discriminant().write_xdr(w)?;
31933            #[allow(clippy::match_same_arms)]
31934            match self {
31935                Self::None => ().write_xdr(w)?,
31936                Self::Text(v) => v.write_xdr(w)?,
31937                Self::Id(v) => v.write_xdr(w)?,
31938                Self::Hash(v) => v.write_xdr(w)?,
31939                Self::Return(v) => v.write_xdr(w)?,
31940            };
31941            Ok(())
31942        })
31943    }
31944}
31945
31946/// TimeBounds is an XDR Struct defines as:
31947///
31948/// ```text
31949/// struct TimeBounds
31950/// {
31951///     TimePoint minTime;
31952///     TimePoint maxTime; // 0 here means no maxTime
31953/// };
31954/// ```
31955///
31956#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
31957#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
31958#[cfg_attr(
31959    all(feature = "serde", feature = "alloc"),
31960    derive(serde::Serialize, serde::Deserialize),
31961    serde(rename_all = "snake_case")
31962)]
31963#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
31964pub struct TimeBounds {
31965    pub min_time: TimePoint,
31966    pub max_time: TimePoint,
31967}
31968
31969impl ReadXdr for TimeBounds {
31970    #[cfg(feature = "std")]
31971    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
31972        r.with_limited_depth(|r| {
31973            Ok(Self {
31974                min_time: TimePoint::read_xdr(r)?,
31975                max_time: TimePoint::read_xdr(r)?,
31976            })
31977        })
31978    }
31979}
31980
31981impl WriteXdr for TimeBounds {
31982    #[cfg(feature = "std")]
31983    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
31984        w.with_limited_depth(|w| {
31985            self.min_time.write_xdr(w)?;
31986            self.max_time.write_xdr(w)?;
31987            Ok(())
31988        })
31989    }
31990}
31991
31992/// LedgerBounds is an XDR Struct defines as:
31993///
31994/// ```text
31995/// struct LedgerBounds
31996/// {
31997///     uint32 minLedger;
31998///     uint32 maxLedger; // 0 here means no maxLedger
31999/// };
32000/// ```
32001///
32002#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
32003#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
32004#[cfg_attr(
32005    all(feature = "serde", feature = "alloc"),
32006    derive(serde::Serialize, serde::Deserialize),
32007    serde(rename_all = "snake_case")
32008)]
32009#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
32010pub struct LedgerBounds {
32011    pub min_ledger: u32,
32012    pub max_ledger: u32,
32013}
32014
32015impl ReadXdr for LedgerBounds {
32016    #[cfg(feature = "std")]
32017    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
32018        r.with_limited_depth(|r| {
32019            Ok(Self {
32020                min_ledger: u32::read_xdr(r)?,
32021                max_ledger: u32::read_xdr(r)?,
32022            })
32023        })
32024    }
32025}
32026
32027impl WriteXdr for LedgerBounds {
32028    #[cfg(feature = "std")]
32029    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
32030        w.with_limited_depth(|w| {
32031            self.min_ledger.write_xdr(w)?;
32032            self.max_ledger.write_xdr(w)?;
32033            Ok(())
32034        })
32035    }
32036}
32037
32038/// PreconditionsV2 is an XDR Struct defines as:
32039///
32040/// ```text
32041/// struct PreconditionsV2
32042/// {
32043///     TimeBounds* timeBounds;
32044///
32045///     // Transaction only valid for ledger numbers n such that
32046///     // minLedger <= n < maxLedger (if maxLedger == 0, then
32047///     // only minLedger is checked)
32048///     LedgerBounds* ledgerBounds;
32049///
32050///     // If NULL, only valid when sourceAccount's sequence number
32051///     // is seqNum - 1.  Otherwise, valid when sourceAccount's
32052///     // sequence number n satisfies minSeqNum <= n < tx.seqNum.
32053///     // Note that after execution the account's sequence number
32054///     // is always raised to tx.seqNum, and a transaction is not
32055///     // valid if tx.seqNum is too high to ensure replay protection.
32056///     SequenceNumber* minSeqNum;
32057///
32058///     // For the transaction to be valid, the current ledger time must
32059///     // be at least minSeqAge greater than sourceAccount's seqTime.
32060///     Duration minSeqAge;
32061///
32062///     // For the transaction to be valid, the current ledger number
32063///     // must be at least minSeqLedgerGap greater than sourceAccount's
32064///     // seqLedger.
32065///     uint32 minSeqLedgerGap;
32066///
32067///     // For the transaction to be valid, there must be a signature
32068///     // corresponding to every Signer in this array, even if the
32069///     // signature is not otherwise required by the sourceAccount or
32070///     // operations.
32071///     SignerKey extraSigners<2>;
32072/// };
32073/// ```
32074///
32075#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
32076#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
32077#[cfg_attr(
32078    all(feature = "serde", feature = "alloc"),
32079    derive(serde::Serialize, serde::Deserialize),
32080    serde(rename_all = "snake_case")
32081)]
32082#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
32083pub struct PreconditionsV2 {
32084    pub time_bounds: Option<TimeBounds>,
32085    pub ledger_bounds: Option<LedgerBounds>,
32086    pub min_seq_num: Option<SequenceNumber>,
32087    pub min_seq_age: Duration,
32088    pub min_seq_ledger_gap: u32,
32089    pub extra_signers: VecM<SignerKey, 2>,
32090}
32091
32092impl ReadXdr for PreconditionsV2 {
32093    #[cfg(feature = "std")]
32094    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
32095        r.with_limited_depth(|r| {
32096            Ok(Self {
32097                time_bounds: Option::<TimeBounds>::read_xdr(r)?,
32098                ledger_bounds: Option::<LedgerBounds>::read_xdr(r)?,
32099                min_seq_num: Option::<SequenceNumber>::read_xdr(r)?,
32100                min_seq_age: Duration::read_xdr(r)?,
32101                min_seq_ledger_gap: u32::read_xdr(r)?,
32102                extra_signers: VecM::<SignerKey, 2>::read_xdr(r)?,
32103            })
32104        })
32105    }
32106}
32107
32108impl WriteXdr for PreconditionsV2 {
32109    #[cfg(feature = "std")]
32110    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
32111        w.with_limited_depth(|w| {
32112            self.time_bounds.write_xdr(w)?;
32113            self.ledger_bounds.write_xdr(w)?;
32114            self.min_seq_num.write_xdr(w)?;
32115            self.min_seq_age.write_xdr(w)?;
32116            self.min_seq_ledger_gap.write_xdr(w)?;
32117            self.extra_signers.write_xdr(w)?;
32118            Ok(())
32119        })
32120    }
32121}
32122
32123/// PreconditionType is an XDR Enum defines as:
32124///
32125/// ```text
32126/// enum PreconditionType
32127/// {
32128///     PRECOND_NONE = 0,
32129///     PRECOND_TIME = 1,
32130///     PRECOND_V2 = 2
32131/// };
32132/// ```
32133///
32134// enum
32135#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
32136#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
32137#[cfg_attr(
32138    all(feature = "serde", feature = "alloc"),
32139    derive(serde::Serialize, serde::Deserialize),
32140    serde(rename_all = "snake_case")
32141)]
32142#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
32143#[repr(i32)]
32144pub enum PreconditionType {
32145    None = 0,
32146    Time = 1,
32147    V2 = 2,
32148}
32149
32150impl PreconditionType {
32151    pub const VARIANTS: [PreconditionType; 3] = [
32152        PreconditionType::None,
32153        PreconditionType::Time,
32154        PreconditionType::V2,
32155    ];
32156    pub const VARIANTS_STR: [&'static str; 3] = ["None", "Time", "V2"];
32157
32158    #[must_use]
32159    pub const fn name(&self) -> &'static str {
32160        match self {
32161            Self::None => "None",
32162            Self::Time => "Time",
32163            Self::V2 => "V2",
32164        }
32165    }
32166
32167    #[must_use]
32168    pub const fn variants() -> [PreconditionType; 3] {
32169        Self::VARIANTS
32170    }
32171}
32172
32173impl Name for PreconditionType {
32174    #[must_use]
32175    fn name(&self) -> &'static str {
32176        Self::name(self)
32177    }
32178}
32179
32180impl Variants<PreconditionType> for PreconditionType {
32181    fn variants() -> slice::Iter<'static, PreconditionType> {
32182        Self::VARIANTS.iter()
32183    }
32184}
32185
32186impl Enum for PreconditionType {}
32187
32188impl fmt::Display for PreconditionType {
32189    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
32190        f.write_str(self.name())
32191    }
32192}
32193
32194impl TryFrom<i32> for PreconditionType {
32195    type Error = Error;
32196
32197    fn try_from(i: i32) -> Result<Self> {
32198        let e = match i {
32199            0 => PreconditionType::None,
32200            1 => PreconditionType::Time,
32201            2 => PreconditionType::V2,
32202            #[allow(unreachable_patterns)]
32203            _ => return Err(Error::Invalid),
32204        };
32205        Ok(e)
32206    }
32207}
32208
32209impl From<PreconditionType> for i32 {
32210    #[must_use]
32211    fn from(e: PreconditionType) -> Self {
32212        e as Self
32213    }
32214}
32215
32216impl ReadXdr for PreconditionType {
32217    #[cfg(feature = "std")]
32218    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
32219        r.with_limited_depth(|r| {
32220            let e = i32::read_xdr(r)?;
32221            let v: Self = e.try_into()?;
32222            Ok(v)
32223        })
32224    }
32225}
32226
32227impl WriteXdr for PreconditionType {
32228    #[cfg(feature = "std")]
32229    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
32230        w.with_limited_depth(|w| {
32231            let i: i32 = (*self).into();
32232            i.write_xdr(w)
32233        })
32234    }
32235}
32236
32237/// Preconditions is an XDR Union defines as:
32238///
32239/// ```text
32240/// union Preconditions switch (PreconditionType type)
32241/// {
32242/// case PRECOND_NONE:
32243///     void;
32244/// case PRECOND_TIME:
32245///     TimeBounds timeBounds;
32246/// case PRECOND_V2:
32247///     PreconditionsV2 v2;
32248/// };
32249/// ```
32250///
32251// union with discriminant PreconditionType
32252#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
32253#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
32254#[cfg_attr(
32255    all(feature = "serde", feature = "alloc"),
32256    derive(serde::Serialize, serde::Deserialize),
32257    serde(rename_all = "snake_case")
32258)]
32259#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
32260#[allow(clippy::large_enum_variant)]
32261pub enum Preconditions {
32262    None,
32263    Time(TimeBounds),
32264    V2(PreconditionsV2),
32265}
32266
32267impl Preconditions {
32268    pub const VARIANTS: [PreconditionType; 3] = [
32269        PreconditionType::None,
32270        PreconditionType::Time,
32271        PreconditionType::V2,
32272    ];
32273    pub const VARIANTS_STR: [&'static str; 3] = ["None", "Time", "V2"];
32274
32275    #[must_use]
32276    pub const fn name(&self) -> &'static str {
32277        match self {
32278            Self::None => "None",
32279            Self::Time(_) => "Time",
32280            Self::V2(_) => "V2",
32281        }
32282    }
32283
32284    #[must_use]
32285    pub const fn discriminant(&self) -> PreconditionType {
32286        #[allow(clippy::match_same_arms)]
32287        match self {
32288            Self::None => PreconditionType::None,
32289            Self::Time(_) => PreconditionType::Time,
32290            Self::V2(_) => PreconditionType::V2,
32291        }
32292    }
32293
32294    #[must_use]
32295    pub const fn variants() -> [PreconditionType; 3] {
32296        Self::VARIANTS
32297    }
32298}
32299
32300impl Name for Preconditions {
32301    #[must_use]
32302    fn name(&self) -> &'static str {
32303        Self::name(self)
32304    }
32305}
32306
32307impl Discriminant<PreconditionType> for Preconditions {
32308    #[must_use]
32309    fn discriminant(&self) -> PreconditionType {
32310        Self::discriminant(self)
32311    }
32312}
32313
32314impl Variants<PreconditionType> for Preconditions {
32315    fn variants() -> slice::Iter<'static, PreconditionType> {
32316        Self::VARIANTS.iter()
32317    }
32318}
32319
32320impl Union<PreconditionType> for Preconditions {}
32321
32322impl ReadXdr for Preconditions {
32323    #[cfg(feature = "std")]
32324    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
32325        r.with_limited_depth(|r| {
32326            let dv: PreconditionType = <PreconditionType as ReadXdr>::read_xdr(r)?;
32327            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
32328            let v = match dv {
32329                PreconditionType::None => Self::None,
32330                PreconditionType::Time => Self::Time(TimeBounds::read_xdr(r)?),
32331                PreconditionType::V2 => Self::V2(PreconditionsV2::read_xdr(r)?),
32332                #[allow(unreachable_patterns)]
32333                _ => return Err(Error::Invalid),
32334            };
32335            Ok(v)
32336        })
32337    }
32338}
32339
32340impl WriteXdr for Preconditions {
32341    #[cfg(feature = "std")]
32342    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
32343        w.with_limited_depth(|w| {
32344            self.discriminant().write_xdr(w)?;
32345            #[allow(clippy::match_same_arms)]
32346            match self {
32347                Self::None => ().write_xdr(w)?,
32348                Self::Time(v) => v.write_xdr(w)?,
32349                Self::V2(v) => v.write_xdr(w)?,
32350            };
32351            Ok(())
32352        })
32353    }
32354}
32355
32356/// LedgerFootprint is an XDR Struct defines as:
32357///
32358/// ```text
32359/// struct LedgerFootprint
32360/// {
32361///     LedgerKey readOnly<>;
32362///     LedgerKey readWrite<>;
32363/// };
32364/// ```
32365///
32366#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
32367#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
32368#[cfg_attr(
32369    all(feature = "serde", feature = "alloc"),
32370    derive(serde::Serialize, serde::Deserialize),
32371    serde(rename_all = "snake_case")
32372)]
32373#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
32374pub struct LedgerFootprint {
32375    pub read_only: VecM<LedgerKey>,
32376    pub read_write: VecM<LedgerKey>,
32377}
32378
32379impl ReadXdr for LedgerFootprint {
32380    #[cfg(feature = "std")]
32381    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
32382        r.with_limited_depth(|r| {
32383            Ok(Self {
32384                read_only: VecM::<LedgerKey>::read_xdr(r)?,
32385                read_write: VecM::<LedgerKey>::read_xdr(r)?,
32386            })
32387        })
32388    }
32389}
32390
32391impl WriteXdr for LedgerFootprint {
32392    #[cfg(feature = "std")]
32393    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
32394        w.with_limited_depth(|w| {
32395            self.read_only.write_xdr(w)?;
32396            self.read_write.write_xdr(w)?;
32397            Ok(())
32398        })
32399    }
32400}
32401
32402/// ArchivalProofType is an XDR Enum defines as:
32403///
32404/// ```text
32405/// enum ArchivalProofType
32406/// {
32407///     EXISTENCE = 0,
32408///     NONEXISTENCE = 1
32409/// };
32410/// ```
32411///
32412// enum
32413#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
32414#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
32415#[cfg_attr(
32416    all(feature = "serde", feature = "alloc"),
32417    derive(serde::Serialize, serde::Deserialize),
32418    serde(rename_all = "snake_case")
32419)]
32420#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
32421#[repr(i32)]
32422pub enum ArchivalProofType {
32423    Existence = 0,
32424    Nonexistence = 1,
32425}
32426
32427impl ArchivalProofType {
32428    pub const VARIANTS: [ArchivalProofType; 2] = [
32429        ArchivalProofType::Existence,
32430        ArchivalProofType::Nonexistence,
32431    ];
32432    pub const VARIANTS_STR: [&'static str; 2] = ["Existence", "Nonexistence"];
32433
32434    #[must_use]
32435    pub const fn name(&self) -> &'static str {
32436        match self {
32437            Self::Existence => "Existence",
32438            Self::Nonexistence => "Nonexistence",
32439        }
32440    }
32441
32442    #[must_use]
32443    pub const fn variants() -> [ArchivalProofType; 2] {
32444        Self::VARIANTS
32445    }
32446}
32447
32448impl Name for ArchivalProofType {
32449    #[must_use]
32450    fn name(&self) -> &'static str {
32451        Self::name(self)
32452    }
32453}
32454
32455impl Variants<ArchivalProofType> for ArchivalProofType {
32456    fn variants() -> slice::Iter<'static, ArchivalProofType> {
32457        Self::VARIANTS.iter()
32458    }
32459}
32460
32461impl Enum for ArchivalProofType {}
32462
32463impl fmt::Display for ArchivalProofType {
32464    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
32465        f.write_str(self.name())
32466    }
32467}
32468
32469impl TryFrom<i32> for ArchivalProofType {
32470    type Error = Error;
32471
32472    fn try_from(i: i32) -> Result<Self> {
32473        let e = match i {
32474            0 => ArchivalProofType::Existence,
32475            1 => ArchivalProofType::Nonexistence,
32476            #[allow(unreachable_patterns)]
32477            _ => return Err(Error::Invalid),
32478        };
32479        Ok(e)
32480    }
32481}
32482
32483impl From<ArchivalProofType> for i32 {
32484    #[must_use]
32485    fn from(e: ArchivalProofType) -> Self {
32486        e as Self
32487    }
32488}
32489
32490impl ReadXdr for ArchivalProofType {
32491    #[cfg(feature = "std")]
32492    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
32493        r.with_limited_depth(|r| {
32494            let e = i32::read_xdr(r)?;
32495            let v: Self = e.try_into()?;
32496            Ok(v)
32497        })
32498    }
32499}
32500
32501impl WriteXdr for ArchivalProofType {
32502    #[cfg(feature = "std")]
32503    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
32504        w.with_limited_depth(|w| {
32505            let i: i32 = (*self).into();
32506            i.write_xdr(w)
32507        })
32508    }
32509}
32510
32511/// ArchivalProofNode is an XDR Struct defines as:
32512///
32513/// ```text
32514/// struct ArchivalProofNode
32515/// {
32516///     uint32 index;
32517///     Hash hash;
32518/// };
32519/// ```
32520///
32521#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
32522#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
32523#[cfg_attr(
32524    all(feature = "serde", feature = "alloc"),
32525    derive(serde::Serialize, serde::Deserialize),
32526    serde(rename_all = "snake_case")
32527)]
32528#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
32529pub struct ArchivalProofNode {
32530    pub index: u32,
32531    pub hash: Hash,
32532}
32533
32534impl ReadXdr for ArchivalProofNode {
32535    #[cfg(feature = "std")]
32536    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
32537        r.with_limited_depth(|r| {
32538            Ok(Self {
32539                index: u32::read_xdr(r)?,
32540                hash: Hash::read_xdr(r)?,
32541            })
32542        })
32543    }
32544}
32545
32546impl WriteXdr for ArchivalProofNode {
32547    #[cfg(feature = "std")]
32548    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
32549        w.with_limited_depth(|w| {
32550            self.index.write_xdr(w)?;
32551            self.hash.write_xdr(w)?;
32552            Ok(())
32553        })
32554    }
32555}
32556
32557/// ProofLevel is an XDR Typedef defines as:
32558///
32559/// ```text
32560/// typedef ArchivalProofNode ProofLevel<>;
32561/// ```
32562///
32563#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
32564#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
32565#[derive(Default)]
32566#[cfg_attr(
32567    all(feature = "serde", feature = "alloc"),
32568    derive(serde::Serialize, serde::Deserialize),
32569    serde(rename_all = "snake_case")
32570)]
32571#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
32572#[derive(Debug)]
32573pub struct ProofLevel(pub VecM<ArchivalProofNode>);
32574
32575impl From<ProofLevel> for VecM<ArchivalProofNode> {
32576    #[must_use]
32577    fn from(x: ProofLevel) -> Self {
32578        x.0
32579    }
32580}
32581
32582impl From<VecM<ArchivalProofNode>> for ProofLevel {
32583    #[must_use]
32584    fn from(x: VecM<ArchivalProofNode>) -> Self {
32585        ProofLevel(x)
32586    }
32587}
32588
32589impl AsRef<VecM<ArchivalProofNode>> for ProofLevel {
32590    #[must_use]
32591    fn as_ref(&self) -> &VecM<ArchivalProofNode> {
32592        &self.0
32593    }
32594}
32595
32596impl ReadXdr for ProofLevel {
32597    #[cfg(feature = "std")]
32598    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
32599        r.with_limited_depth(|r| {
32600            let i = VecM::<ArchivalProofNode>::read_xdr(r)?;
32601            let v = ProofLevel(i);
32602            Ok(v)
32603        })
32604    }
32605}
32606
32607impl WriteXdr for ProofLevel {
32608    #[cfg(feature = "std")]
32609    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
32610        w.with_limited_depth(|w| self.0.write_xdr(w))
32611    }
32612}
32613
32614impl Deref for ProofLevel {
32615    type Target = VecM<ArchivalProofNode>;
32616    fn deref(&self) -> &Self::Target {
32617        &self.0
32618    }
32619}
32620
32621impl From<ProofLevel> for Vec<ArchivalProofNode> {
32622    #[must_use]
32623    fn from(x: ProofLevel) -> Self {
32624        x.0 .0
32625    }
32626}
32627
32628impl TryFrom<Vec<ArchivalProofNode>> for ProofLevel {
32629    type Error = Error;
32630    fn try_from(x: Vec<ArchivalProofNode>) -> Result<Self> {
32631        Ok(ProofLevel(x.try_into()?))
32632    }
32633}
32634
32635#[cfg(feature = "alloc")]
32636impl TryFrom<&Vec<ArchivalProofNode>> for ProofLevel {
32637    type Error = Error;
32638    fn try_from(x: &Vec<ArchivalProofNode>) -> Result<Self> {
32639        Ok(ProofLevel(x.try_into()?))
32640    }
32641}
32642
32643impl AsRef<Vec<ArchivalProofNode>> for ProofLevel {
32644    #[must_use]
32645    fn as_ref(&self) -> &Vec<ArchivalProofNode> {
32646        &self.0 .0
32647    }
32648}
32649
32650impl AsRef<[ArchivalProofNode]> for ProofLevel {
32651    #[cfg(feature = "alloc")]
32652    #[must_use]
32653    fn as_ref(&self) -> &[ArchivalProofNode] {
32654        &self.0 .0
32655    }
32656    #[cfg(not(feature = "alloc"))]
32657    #[must_use]
32658    fn as_ref(&self) -> &[ArchivalProofNode] {
32659        self.0 .0
32660    }
32661}
32662
32663/// ExistenceProofBody is an XDR Struct defines as:
32664///
32665/// ```text
32666/// struct ExistenceProofBody
32667/// {
32668///     ColdArchiveBucketEntry entriesToProve<>;
32669///
32670///     // Vector of vectors, where proofLevels[level]
32671///     // contains all HashNodes that correspond with that level
32672///     ProofLevel proofLevels<>;
32673/// };
32674/// ```
32675///
32676#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
32677#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
32678#[cfg_attr(
32679    all(feature = "serde", feature = "alloc"),
32680    derive(serde::Serialize, serde::Deserialize),
32681    serde(rename_all = "snake_case")
32682)]
32683#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
32684pub struct ExistenceProofBody {
32685    pub entries_to_prove: VecM<ColdArchiveBucketEntry>,
32686    pub proof_levels: VecM<ProofLevel>,
32687}
32688
32689impl ReadXdr for ExistenceProofBody {
32690    #[cfg(feature = "std")]
32691    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
32692        r.with_limited_depth(|r| {
32693            Ok(Self {
32694                entries_to_prove: VecM::<ColdArchiveBucketEntry>::read_xdr(r)?,
32695                proof_levels: VecM::<ProofLevel>::read_xdr(r)?,
32696            })
32697        })
32698    }
32699}
32700
32701impl WriteXdr for ExistenceProofBody {
32702    #[cfg(feature = "std")]
32703    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
32704        w.with_limited_depth(|w| {
32705            self.entries_to_prove.write_xdr(w)?;
32706            self.proof_levels.write_xdr(w)?;
32707            Ok(())
32708        })
32709    }
32710}
32711
32712/// NonexistenceProofBody is an XDR Struct defines as:
32713///
32714/// ```text
32715/// struct NonexistenceProofBody
32716/// {
32717///     LedgerKey keysToProve<>;
32718///
32719///     // Bounds for each key being proved, where bound[n]
32720///     // corresponds to keysToProve[n]
32721///     ColdArchiveBucketEntry lowBoundEntries<>;
32722///     ColdArchiveBucketEntry highBoundEntries<>;
32723///
32724///     // Vector of vectors, where proofLevels[level]
32725///     // contains all HashNodes that correspond with that level
32726///     ProofLevel proofLevels<>;
32727/// };
32728/// ```
32729///
32730#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
32731#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
32732#[cfg_attr(
32733    all(feature = "serde", feature = "alloc"),
32734    derive(serde::Serialize, serde::Deserialize),
32735    serde(rename_all = "snake_case")
32736)]
32737#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
32738pub struct NonexistenceProofBody {
32739    pub keys_to_prove: VecM<LedgerKey>,
32740    pub low_bound_entries: VecM<ColdArchiveBucketEntry>,
32741    pub high_bound_entries: VecM<ColdArchiveBucketEntry>,
32742    pub proof_levels: VecM<ProofLevel>,
32743}
32744
32745impl ReadXdr for NonexistenceProofBody {
32746    #[cfg(feature = "std")]
32747    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
32748        r.with_limited_depth(|r| {
32749            Ok(Self {
32750                keys_to_prove: VecM::<LedgerKey>::read_xdr(r)?,
32751                low_bound_entries: VecM::<ColdArchiveBucketEntry>::read_xdr(r)?,
32752                high_bound_entries: VecM::<ColdArchiveBucketEntry>::read_xdr(r)?,
32753                proof_levels: VecM::<ProofLevel>::read_xdr(r)?,
32754            })
32755        })
32756    }
32757}
32758
32759impl WriteXdr for NonexistenceProofBody {
32760    #[cfg(feature = "std")]
32761    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
32762        w.with_limited_depth(|w| {
32763            self.keys_to_prove.write_xdr(w)?;
32764            self.low_bound_entries.write_xdr(w)?;
32765            self.high_bound_entries.write_xdr(w)?;
32766            self.proof_levels.write_xdr(w)?;
32767            Ok(())
32768        })
32769    }
32770}
32771
32772/// ArchivalProofBody is an XDR NestedUnion defines as:
32773///
32774/// ```text
32775/// union switch (ArchivalProofType t)
32776///     {
32777///     case NONEXISTENCE:
32778///         NonexistenceProofBody nonexistenceProof;
32779///     case EXISTENCE:
32780///         ExistenceProofBody existenceProof;
32781///     }
32782/// ```
32783///
32784// union with discriminant ArchivalProofType
32785#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
32786#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
32787#[cfg_attr(
32788    all(feature = "serde", feature = "alloc"),
32789    derive(serde::Serialize, serde::Deserialize),
32790    serde(rename_all = "snake_case")
32791)]
32792#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
32793#[allow(clippy::large_enum_variant)]
32794pub enum ArchivalProofBody {
32795    Nonexistence(NonexistenceProofBody),
32796    Existence(ExistenceProofBody),
32797}
32798
32799impl ArchivalProofBody {
32800    pub const VARIANTS: [ArchivalProofType; 2] = [
32801        ArchivalProofType::Nonexistence,
32802        ArchivalProofType::Existence,
32803    ];
32804    pub const VARIANTS_STR: [&'static str; 2] = ["Nonexistence", "Existence"];
32805
32806    #[must_use]
32807    pub const fn name(&self) -> &'static str {
32808        match self {
32809            Self::Nonexistence(_) => "Nonexistence",
32810            Self::Existence(_) => "Existence",
32811        }
32812    }
32813
32814    #[must_use]
32815    pub const fn discriminant(&self) -> ArchivalProofType {
32816        #[allow(clippy::match_same_arms)]
32817        match self {
32818            Self::Nonexistence(_) => ArchivalProofType::Nonexistence,
32819            Self::Existence(_) => ArchivalProofType::Existence,
32820        }
32821    }
32822
32823    #[must_use]
32824    pub const fn variants() -> [ArchivalProofType; 2] {
32825        Self::VARIANTS
32826    }
32827}
32828
32829impl Name for ArchivalProofBody {
32830    #[must_use]
32831    fn name(&self) -> &'static str {
32832        Self::name(self)
32833    }
32834}
32835
32836impl Discriminant<ArchivalProofType> for ArchivalProofBody {
32837    #[must_use]
32838    fn discriminant(&self) -> ArchivalProofType {
32839        Self::discriminant(self)
32840    }
32841}
32842
32843impl Variants<ArchivalProofType> for ArchivalProofBody {
32844    fn variants() -> slice::Iter<'static, ArchivalProofType> {
32845        Self::VARIANTS.iter()
32846    }
32847}
32848
32849impl Union<ArchivalProofType> for ArchivalProofBody {}
32850
32851impl ReadXdr for ArchivalProofBody {
32852    #[cfg(feature = "std")]
32853    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
32854        r.with_limited_depth(|r| {
32855            let dv: ArchivalProofType = <ArchivalProofType as ReadXdr>::read_xdr(r)?;
32856            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
32857            let v = match dv {
32858                ArchivalProofType::Nonexistence => {
32859                    Self::Nonexistence(NonexistenceProofBody::read_xdr(r)?)
32860                }
32861                ArchivalProofType::Existence => Self::Existence(ExistenceProofBody::read_xdr(r)?),
32862                #[allow(unreachable_patterns)]
32863                _ => return Err(Error::Invalid),
32864            };
32865            Ok(v)
32866        })
32867    }
32868}
32869
32870impl WriteXdr for ArchivalProofBody {
32871    #[cfg(feature = "std")]
32872    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
32873        w.with_limited_depth(|w| {
32874            self.discriminant().write_xdr(w)?;
32875            #[allow(clippy::match_same_arms)]
32876            match self {
32877                Self::Nonexistence(v) => v.write_xdr(w)?,
32878                Self::Existence(v) => v.write_xdr(w)?,
32879            };
32880            Ok(())
32881        })
32882    }
32883}
32884
32885/// ArchivalProof is an XDR Struct defines as:
32886///
32887/// ```text
32888/// struct ArchivalProof
32889/// {
32890///     uint32 epoch; // AST Subtree for this proof
32891///
32892///     union switch (ArchivalProofType t)
32893///     {
32894///     case NONEXISTENCE:
32895///         NonexistenceProofBody nonexistenceProof;
32896///     case EXISTENCE:
32897///         ExistenceProofBody existenceProof;
32898///     } body;
32899/// };
32900/// ```
32901///
32902#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
32903#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
32904#[cfg_attr(
32905    all(feature = "serde", feature = "alloc"),
32906    derive(serde::Serialize, serde::Deserialize),
32907    serde(rename_all = "snake_case")
32908)]
32909#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
32910pub struct ArchivalProof {
32911    pub epoch: u32,
32912    pub body: ArchivalProofBody,
32913}
32914
32915impl ReadXdr for ArchivalProof {
32916    #[cfg(feature = "std")]
32917    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
32918        r.with_limited_depth(|r| {
32919            Ok(Self {
32920                epoch: u32::read_xdr(r)?,
32921                body: ArchivalProofBody::read_xdr(r)?,
32922            })
32923        })
32924    }
32925}
32926
32927impl WriteXdr for ArchivalProof {
32928    #[cfg(feature = "std")]
32929    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
32930        w.with_limited_depth(|w| {
32931            self.epoch.write_xdr(w)?;
32932            self.body.write_xdr(w)?;
32933            Ok(())
32934        })
32935    }
32936}
32937
32938/// SorobanResources is an XDR Struct defines as:
32939///
32940/// ```text
32941/// struct SorobanResources
32942/// {   
32943///     // The ledger footprint of the transaction.
32944///     LedgerFootprint footprint;
32945///     // The maximum number of instructions this transaction can use
32946///     uint32 instructions;
32947///
32948///     // The maximum number of bytes this transaction can read from ledger
32949///     uint32 readBytes;
32950///     // The maximum number of bytes this transaction can write to ledger
32951///     uint32 writeBytes;
32952/// };
32953/// ```
32954///
32955#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
32956#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
32957#[cfg_attr(
32958    all(feature = "serde", feature = "alloc"),
32959    derive(serde::Serialize, serde::Deserialize),
32960    serde(rename_all = "snake_case")
32961)]
32962#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
32963pub struct SorobanResources {
32964    pub footprint: LedgerFootprint,
32965    pub instructions: u32,
32966    pub read_bytes: u32,
32967    pub write_bytes: u32,
32968}
32969
32970impl ReadXdr for SorobanResources {
32971    #[cfg(feature = "std")]
32972    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
32973        r.with_limited_depth(|r| {
32974            Ok(Self {
32975                footprint: LedgerFootprint::read_xdr(r)?,
32976                instructions: u32::read_xdr(r)?,
32977                read_bytes: u32::read_xdr(r)?,
32978                write_bytes: u32::read_xdr(r)?,
32979            })
32980        })
32981    }
32982}
32983
32984impl WriteXdr for SorobanResources {
32985    #[cfg(feature = "std")]
32986    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
32987        w.with_limited_depth(|w| {
32988            self.footprint.write_xdr(w)?;
32989            self.instructions.write_xdr(w)?;
32990            self.read_bytes.write_xdr(w)?;
32991            self.write_bytes.write_xdr(w)?;
32992            Ok(())
32993        })
32994    }
32995}
32996
32997/// SorobanTransactionDataExt is an XDR NestedUnion defines as:
32998///
32999/// ```text
33000/// union switch (int v)
33001///     {
33002///     case 0:
33003///         void;
33004///     case 1:
33005///         ArchivalProof proofs<>;
33006///     }
33007/// ```
33008///
33009// union with discriminant i32
33010#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
33011#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
33012#[cfg_attr(
33013    all(feature = "serde", feature = "alloc"),
33014    derive(serde::Serialize, serde::Deserialize),
33015    serde(rename_all = "snake_case")
33016)]
33017#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
33018#[allow(clippy::large_enum_variant)]
33019pub enum SorobanTransactionDataExt {
33020    V0,
33021    V1(VecM<ArchivalProof>),
33022}
33023
33024impl SorobanTransactionDataExt {
33025    pub const VARIANTS: [i32; 2] = [0, 1];
33026    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"];
33027
33028    #[must_use]
33029    pub const fn name(&self) -> &'static str {
33030        match self {
33031            Self::V0 => "V0",
33032            Self::V1(_) => "V1",
33033        }
33034    }
33035
33036    #[must_use]
33037    pub const fn discriminant(&self) -> i32 {
33038        #[allow(clippy::match_same_arms)]
33039        match self {
33040            Self::V0 => 0,
33041            Self::V1(_) => 1,
33042        }
33043    }
33044
33045    #[must_use]
33046    pub const fn variants() -> [i32; 2] {
33047        Self::VARIANTS
33048    }
33049}
33050
33051impl Name for SorobanTransactionDataExt {
33052    #[must_use]
33053    fn name(&self) -> &'static str {
33054        Self::name(self)
33055    }
33056}
33057
33058impl Discriminant<i32> for SorobanTransactionDataExt {
33059    #[must_use]
33060    fn discriminant(&self) -> i32 {
33061        Self::discriminant(self)
33062    }
33063}
33064
33065impl Variants<i32> for SorobanTransactionDataExt {
33066    fn variants() -> slice::Iter<'static, i32> {
33067        Self::VARIANTS.iter()
33068    }
33069}
33070
33071impl Union<i32> for SorobanTransactionDataExt {}
33072
33073impl ReadXdr for SorobanTransactionDataExt {
33074    #[cfg(feature = "std")]
33075    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
33076        r.with_limited_depth(|r| {
33077            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
33078            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
33079            let v = match dv {
33080                0 => Self::V0,
33081                1 => Self::V1(VecM::<ArchivalProof>::read_xdr(r)?),
33082                #[allow(unreachable_patterns)]
33083                _ => return Err(Error::Invalid),
33084            };
33085            Ok(v)
33086        })
33087    }
33088}
33089
33090impl WriteXdr for SorobanTransactionDataExt {
33091    #[cfg(feature = "std")]
33092    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
33093        w.with_limited_depth(|w| {
33094            self.discriminant().write_xdr(w)?;
33095            #[allow(clippy::match_same_arms)]
33096            match self {
33097                Self::V0 => ().write_xdr(w)?,
33098                Self::V1(v) => v.write_xdr(w)?,
33099            };
33100            Ok(())
33101        })
33102    }
33103}
33104
33105/// SorobanTransactionData is an XDR Struct defines as:
33106///
33107/// ```text
33108/// struct SorobanTransactionData
33109/// {
33110///     union switch (int v)
33111///     {
33112///     case 0:
33113///         void;
33114///     case 1:
33115///         ArchivalProof proofs<>;
33116///     } ext;
33117///     SorobanResources resources;
33118///     // Amount of the transaction `fee` allocated to the Soroban resource fees.
33119///     // The fraction of `resourceFee` corresponding to `resources` specified
33120///     // above is *not* refundable (i.e. fees for instructions, ledger I/O), as
33121///     // well as fees for the transaction size.
33122///     // The remaining part of the fee is refundable and the charged value is
33123///     // based on the actual consumption of refundable resources (events, ledger
33124///     // rent bumps).
33125///     // The `inclusionFee` used for prioritization of the transaction is defined
33126///     // as `tx.fee - resourceFee`.
33127///     int64 resourceFee;
33128/// };
33129/// ```
33130///
33131#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
33132#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
33133#[cfg_attr(
33134    all(feature = "serde", feature = "alloc"),
33135    derive(serde::Serialize, serde::Deserialize),
33136    serde(rename_all = "snake_case")
33137)]
33138#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
33139pub struct SorobanTransactionData {
33140    pub ext: SorobanTransactionDataExt,
33141    pub resources: SorobanResources,
33142    pub resource_fee: i64,
33143}
33144
33145impl ReadXdr for SorobanTransactionData {
33146    #[cfg(feature = "std")]
33147    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
33148        r.with_limited_depth(|r| {
33149            Ok(Self {
33150                ext: SorobanTransactionDataExt::read_xdr(r)?,
33151                resources: SorobanResources::read_xdr(r)?,
33152                resource_fee: i64::read_xdr(r)?,
33153            })
33154        })
33155    }
33156}
33157
33158impl WriteXdr for SorobanTransactionData {
33159    #[cfg(feature = "std")]
33160    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
33161        w.with_limited_depth(|w| {
33162            self.ext.write_xdr(w)?;
33163            self.resources.write_xdr(w)?;
33164            self.resource_fee.write_xdr(w)?;
33165            Ok(())
33166        })
33167    }
33168}
33169
33170/// TransactionV0Ext is an XDR NestedUnion defines as:
33171///
33172/// ```text
33173/// union switch (int v)
33174///     {
33175///     case 0:
33176///         void;
33177///     }
33178/// ```
33179///
33180// union with discriminant i32
33181#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
33182#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
33183#[cfg_attr(
33184    all(feature = "serde", feature = "alloc"),
33185    derive(serde::Serialize, serde::Deserialize),
33186    serde(rename_all = "snake_case")
33187)]
33188#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
33189#[allow(clippy::large_enum_variant)]
33190pub enum TransactionV0Ext {
33191    V0,
33192}
33193
33194impl TransactionV0Ext {
33195    pub const VARIANTS: [i32; 1] = [0];
33196    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
33197
33198    #[must_use]
33199    pub const fn name(&self) -> &'static str {
33200        match self {
33201            Self::V0 => "V0",
33202        }
33203    }
33204
33205    #[must_use]
33206    pub const fn discriminant(&self) -> i32 {
33207        #[allow(clippy::match_same_arms)]
33208        match self {
33209            Self::V0 => 0,
33210        }
33211    }
33212
33213    #[must_use]
33214    pub const fn variants() -> [i32; 1] {
33215        Self::VARIANTS
33216    }
33217}
33218
33219impl Name for TransactionV0Ext {
33220    #[must_use]
33221    fn name(&self) -> &'static str {
33222        Self::name(self)
33223    }
33224}
33225
33226impl Discriminant<i32> for TransactionV0Ext {
33227    #[must_use]
33228    fn discriminant(&self) -> i32 {
33229        Self::discriminant(self)
33230    }
33231}
33232
33233impl Variants<i32> for TransactionV0Ext {
33234    fn variants() -> slice::Iter<'static, i32> {
33235        Self::VARIANTS.iter()
33236    }
33237}
33238
33239impl Union<i32> for TransactionV0Ext {}
33240
33241impl ReadXdr for TransactionV0Ext {
33242    #[cfg(feature = "std")]
33243    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
33244        r.with_limited_depth(|r| {
33245            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
33246            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
33247            let v = match dv {
33248                0 => Self::V0,
33249                #[allow(unreachable_patterns)]
33250                _ => return Err(Error::Invalid),
33251            };
33252            Ok(v)
33253        })
33254    }
33255}
33256
33257impl WriteXdr for TransactionV0Ext {
33258    #[cfg(feature = "std")]
33259    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
33260        w.with_limited_depth(|w| {
33261            self.discriminant().write_xdr(w)?;
33262            #[allow(clippy::match_same_arms)]
33263            match self {
33264                Self::V0 => ().write_xdr(w)?,
33265            };
33266            Ok(())
33267        })
33268    }
33269}
33270
33271/// TransactionV0 is an XDR Struct defines as:
33272///
33273/// ```text
33274/// struct TransactionV0
33275/// {
33276///     uint256 sourceAccountEd25519;
33277///     uint32 fee;
33278///     SequenceNumber seqNum;
33279///     TimeBounds* timeBounds;
33280///     Memo memo;
33281///     Operation operations<MAX_OPS_PER_TX>;
33282///     union switch (int v)
33283///     {
33284///     case 0:
33285///         void;
33286///     }
33287///     ext;
33288/// };
33289/// ```
33290///
33291#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
33292#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
33293#[cfg_attr(
33294    all(feature = "serde", feature = "alloc"),
33295    derive(serde::Serialize, serde::Deserialize),
33296    serde(rename_all = "snake_case")
33297)]
33298#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
33299pub struct TransactionV0 {
33300    pub source_account_ed25519: Uint256,
33301    pub fee: u32,
33302    pub seq_num: SequenceNumber,
33303    pub time_bounds: Option<TimeBounds>,
33304    pub memo: Memo,
33305    pub operations: VecM<Operation, 100>,
33306    pub ext: TransactionV0Ext,
33307}
33308
33309impl ReadXdr for TransactionV0 {
33310    #[cfg(feature = "std")]
33311    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
33312        r.with_limited_depth(|r| {
33313            Ok(Self {
33314                source_account_ed25519: Uint256::read_xdr(r)?,
33315                fee: u32::read_xdr(r)?,
33316                seq_num: SequenceNumber::read_xdr(r)?,
33317                time_bounds: Option::<TimeBounds>::read_xdr(r)?,
33318                memo: Memo::read_xdr(r)?,
33319                operations: VecM::<Operation, 100>::read_xdr(r)?,
33320                ext: TransactionV0Ext::read_xdr(r)?,
33321            })
33322        })
33323    }
33324}
33325
33326impl WriteXdr for TransactionV0 {
33327    #[cfg(feature = "std")]
33328    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
33329        w.with_limited_depth(|w| {
33330            self.source_account_ed25519.write_xdr(w)?;
33331            self.fee.write_xdr(w)?;
33332            self.seq_num.write_xdr(w)?;
33333            self.time_bounds.write_xdr(w)?;
33334            self.memo.write_xdr(w)?;
33335            self.operations.write_xdr(w)?;
33336            self.ext.write_xdr(w)?;
33337            Ok(())
33338        })
33339    }
33340}
33341
33342/// TransactionV0Envelope is an XDR Struct defines as:
33343///
33344/// ```text
33345/// struct TransactionV0Envelope
33346/// {
33347///     TransactionV0 tx;
33348///     /* Each decorated signature is a signature over the SHA256 hash of
33349///      * a TransactionSignaturePayload */
33350///     DecoratedSignature signatures<20>;
33351/// };
33352/// ```
33353///
33354#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
33355#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
33356#[cfg_attr(
33357    all(feature = "serde", feature = "alloc"),
33358    derive(serde::Serialize, serde::Deserialize),
33359    serde(rename_all = "snake_case")
33360)]
33361#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
33362pub struct TransactionV0Envelope {
33363    pub tx: TransactionV0,
33364    pub signatures: VecM<DecoratedSignature, 20>,
33365}
33366
33367impl ReadXdr for TransactionV0Envelope {
33368    #[cfg(feature = "std")]
33369    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
33370        r.with_limited_depth(|r| {
33371            Ok(Self {
33372                tx: TransactionV0::read_xdr(r)?,
33373                signatures: VecM::<DecoratedSignature, 20>::read_xdr(r)?,
33374            })
33375        })
33376    }
33377}
33378
33379impl WriteXdr for TransactionV0Envelope {
33380    #[cfg(feature = "std")]
33381    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
33382        w.with_limited_depth(|w| {
33383            self.tx.write_xdr(w)?;
33384            self.signatures.write_xdr(w)?;
33385            Ok(())
33386        })
33387    }
33388}
33389
33390/// TransactionExt is an XDR NestedUnion defines as:
33391///
33392/// ```text
33393/// union switch (int v)
33394///     {
33395///     case 0:
33396///         void;
33397///     case 1:
33398///         SorobanTransactionData sorobanData;
33399///     }
33400/// ```
33401///
33402// union with discriminant i32
33403#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
33404#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
33405#[cfg_attr(
33406    all(feature = "serde", feature = "alloc"),
33407    derive(serde::Serialize, serde::Deserialize),
33408    serde(rename_all = "snake_case")
33409)]
33410#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
33411#[allow(clippy::large_enum_variant)]
33412pub enum TransactionExt {
33413    V0,
33414    V1(SorobanTransactionData),
33415}
33416
33417impl TransactionExt {
33418    pub const VARIANTS: [i32; 2] = [0, 1];
33419    pub const VARIANTS_STR: [&'static str; 2] = ["V0", "V1"];
33420
33421    #[must_use]
33422    pub const fn name(&self) -> &'static str {
33423        match self {
33424            Self::V0 => "V0",
33425            Self::V1(_) => "V1",
33426        }
33427    }
33428
33429    #[must_use]
33430    pub const fn discriminant(&self) -> i32 {
33431        #[allow(clippy::match_same_arms)]
33432        match self {
33433            Self::V0 => 0,
33434            Self::V1(_) => 1,
33435        }
33436    }
33437
33438    #[must_use]
33439    pub const fn variants() -> [i32; 2] {
33440        Self::VARIANTS
33441    }
33442}
33443
33444impl Name for TransactionExt {
33445    #[must_use]
33446    fn name(&self) -> &'static str {
33447        Self::name(self)
33448    }
33449}
33450
33451impl Discriminant<i32> for TransactionExt {
33452    #[must_use]
33453    fn discriminant(&self) -> i32 {
33454        Self::discriminant(self)
33455    }
33456}
33457
33458impl Variants<i32> for TransactionExt {
33459    fn variants() -> slice::Iter<'static, i32> {
33460        Self::VARIANTS.iter()
33461    }
33462}
33463
33464impl Union<i32> for TransactionExt {}
33465
33466impl ReadXdr for TransactionExt {
33467    #[cfg(feature = "std")]
33468    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
33469        r.with_limited_depth(|r| {
33470            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
33471            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
33472            let v = match dv {
33473                0 => Self::V0,
33474                1 => Self::V1(SorobanTransactionData::read_xdr(r)?),
33475                #[allow(unreachable_patterns)]
33476                _ => return Err(Error::Invalid),
33477            };
33478            Ok(v)
33479        })
33480    }
33481}
33482
33483impl WriteXdr for TransactionExt {
33484    #[cfg(feature = "std")]
33485    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
33486        w.with_limited_depth(|w| {
33487            self.discriminant().write_xdr(w)?;
33488            #[allow(clippy::match_same_arms)]
33489            match self {
33490                Self::V0 => ().write_xdr(w)?,
33491                Self::V1(v) => v.write_xdr(w)?,
33492            };
33493            Ok(())
33494        })
33495    }
33496}
33497
33498/// Transaction is an XDR Struct defines as:
33499///
33500/// ```text
33501/// struct Transaction
33502/// {
33503///     // account used to run the transaction
33504///     MuxedAccount sourceAccount;
33505///
33506///     // the fee the sourceAccount will pay
33507///     uint32 fee;
33508///
33509///     // sequence number to consume in the account
33510///     SequenceNumber seqNum;
33511///
33512///     // validity conditions
33513///     Preconditions cond;
33514///
33515///     Memo memo;
33516///
33517///     Operation operations<MAX_OPS_PER_TX>;
33518///
33519///     // reserved for future use
33520///     union switch (int v)
33521///     {
33522///     case 0:
33523///         void;
33524///     case 1:
33525///         SorobanTransactionData sorobanData;
33526///     }
33527///     ext;
33528/// };
33529/// ```
33530///
33531#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
33532#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
33533#[cfg_attr(
33534    all(feature = "serde", feature = "alloc"),
33535    derive(serde::Serialize, serde::Deserialize),
33536    serde(rename_all = "snake_case")
33537)]
33538#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
33539pub struct Transaction {
33540    pub source_account: MuxedAccount,
33541    pub fee: u32,
33542    pub seq_num: SequenceNumber,
33543    pub cond: Preconditions,
33544    pub memo: Memo,
33545    pub operations: VecM<Operation, 100>,
33546    pub ext: TransactionExt,
33547}
33548
33549impl ReadXdr for Transaction {
33550    #[cfg(feature = "std")]
33551    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
33552        r.with_limited_depth(|r| {
33553            Ok(Self {
33554                source_account: MuxedAccount::read_xdr(r)?,
33555                fee: u32::read_xdr(r)?,
33556                seq_num: SequenceNumber::read_xdr(r)?,
33557                cond: Preconditions::read_xdr(r)?,
33558                memo: Memo::read_xdr(r)?,
33559                operations: VecM::<Operation, 100>::read_xdr(r)?,
33560                ext: TransactionExt::read_xdr(r)?,
33561            })
33562        })
33563    }
33564}
33565
33566impl WriteXdr for Transaction {
33567    #[cfg(feature = "std")]
33568    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
33569        w.with_limited_depth(|w| {
33570            self.source_account.write_xdr(w)?;
33571            self.fee.write_xdr(w)?;
33572            self.seq_num.write_xdr(w)?;
33573            self.cond.write_xdr(w)?;
33574            self.memo.write_xdr(w)?;
33575            self.operations.write_xdr(w)?;
33576            self.ext.write_xdr(w)?;
33577            Ok(())
33578        })
33579    }
33580}
33581
33582/// TransactionV1Envelope is an XDR Struct defines as:
33583///
33584/// ```text
33585/// struct TransactionV1Envelope
33586/// {
33587///     Transaction tx;
33588///     /* Each decorated signature is a signature over the SHA256 hash of
33589///      * a TransactionSignaturePayload */
33590///     DecoratedSignature signatures<20>;
33591/// };
33592/// ```
33593///
33594#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
33595#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
33596#[cfg_attr(
33597    all(feature = "serde", feature = "alloc"),
33598    derive(serde::Serialize, serde::Deserialize),
33599    serde(rename_all = "snake_case")
33600)]
33601#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
33602pub struct TransactionV1Envelope {
33603    pub tx: Transaction,
33604    pub signatures: VecM<DecoratedSignature, 20>,
33605}
33606
33607impl ReadXdr for TransactionV1Envelope {
33608    #[cfg(feature = "std")]
33609    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
33610        r.with_limited_depth(|r| {
33611            Ok(Self {
33612                tx: Transaction::read_xdr(r)?,
33613                signatures: VecM::<DecoratedSignature, 20>::read_xdr(r)?,
33614            })
33615        })
33616    }
33617}
33618
33619impl WriteXdr for TransactionV1Envelope {
33620    #[cfg(feature = "std")]
33621    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
33622        w.with_limited_depth(|w| {
33623            self.tx.write_xdr(w)?;
33624            self.signatures.write_xdr(w)?;
33625            Ok(())
33626        })
33627    }
33628}
33629
33630/// FeeBumpTransactionInnerTx is an XDR NestedUnion defines as:
33631///
33632/// ```text
33633/// union switch (EnvelopeType type)
33634///     {
33635///     case ENVELOPE_TYPE_TX:
33636///         TransactionV1Envelope v1;
33637///     }
33638/// ```
33639///
33640// union with discriminant EnvelopeType
33641#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
33642#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
33643#[cfg_attr(
33644    all(feature = "serde", feature = "alloc"),
33645    derive(serde::Serialize, serde::Deserialize),
33646    serde(rename_all = "snake_case")
33647)]
33648#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
33649#[allow(clippy::large_enum_variant)]
33650pub enum FeeBumpTransactionInnerTx {
33651    Tx(TransactionV1Envelope),
33652}
33653
33654impl FeeBumpTransactionInnerTx {
33655    pub const VARIANTS: [EnvelopeType; 1] = [EnvelopeType::Tx];
33656    pub const VARIANTS_STR: [&'static str; 1] = ["Tx"];
33657
33658    #[must_use]
33659    pub const fn name(&self) -> &'static str {
33660        match self {
33661            Self::Tx(_) => "Tx",
33662        }
33663    }
33664
33665    #[must_use]
33666    pub const fn discriminant(&self) -> EnvelopeType {
33667        #[allow(clippy::match_same_arms)]
33668        match self {
33669            Self::Tx(_) => EnvelopeType::Tx,
33670        }
33671    }
33672
33673    #[must_use]
33674    pub const fn variants() -> [EnvelopeType; 1] {
33675        Self::VARIANTS
33676    }
33677}
33678
33679impl Name for FeeBumpTransactionInnerTx {
33680    #[must_use]
33681    fn name(&self) -> &'static str {
33682        Self::name(self)
33683    }
33684}
33685
33686impl Discriminant<EnvelopeType> for FeeBumpTransactionInnerTx {
33687    #[must_use]
33688    fn discriminant(&self) -> EnvelopeType {
33689        Self::discriminant(self)
33690    }
33691}
33692
33693impl Variants<EnvelopeType> for FeeBumpTransactionInnerTx {
33694    fn variants() -> slice::Iter<'static, EnvelopeType> {
33695        Self::VARIANTS.iter()
33696    }
33697}
33698
33699impl Union<EnvelopeType> for FeeBumpTransactionInnerTx {}
33700
33701impl ReadXdr for FeeBumpTransactionInnerTx {
33702    #[cfg(feature = "std")]
33703    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
33704        r.with_limited_depth(|r| {
33705            let dv: EnvelopeType = <EnvelopeType as ReadXdr>::read_xdr(r)?;
33706            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
33707            let v = match dv {
33708                EnvelopeType::Tx => Self::Tx(TransactionV1Envelope::read_xdr(r)?),
33709                #[allow(unreachable_patterns)]
33710                _ => return Err(Error::Invalid),
33711            };
33712            Ok(v)
33713        })
33714    }
33715}
33716
33717impl WriteXdr for FeeBumpTransactionInnerTx {
33718    #[cfg(feature = "std")]
33719    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
33720        w.with_limited_depth(|w| {
33721            self.discriminant().write_xdr(w)?;
33722            #[allow(clippy::match_same_arms)]
33723            match self {
33724                Self::Tx(v) => v.write_xdr(w)?,
33725            };
33726            Ok(())
33727        })
33728    }
33729}
33730
33731/// FeeBumpTransactionExt is an XDR NestedUnion defines as:
33732///
33733/// ```text
33734/// union switch (int v)
33735///     {
33736///     case 0:
33737///         void;
33738///     }
33739/// ```
33740///
33741// union with discriminant i32
33742#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
33743#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
33744#[cfg_attr(
33745    all(feature = "serde", feature = "alloc"),
33746    derive(serde::Serialize, serde::Deserialize),
33747    serde(rename_all = "snake_case")
33748)]
33749#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
33750#[allow(clippy::large_enum_variant)]
33751pub enum FeeBumpTransactionExt {
33752    V0,
33753}
33754
33755impl FeeBumpTransactionExt {
33756    pub const VARIANTS: [i32; 1] = [0];
33757    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
33758
33759    #[must_use]
33760    pub const fn name(&self) -> &'static str {
33761        match self {
33762            Self::V0 => "V0",
33763        }
33764    }
33765
33766    #[must_use]
33767    pub const fn discriminant(&self) -> i32 {
33768        #[allow(clippy::match_same_arms)]
33769        match self {
33770            Self::V0 => 0,
33771        }
33772    }
33773
33774    #[must_use]
33775    pub const fn variants() -> [i32; 1] {
33776        Self::VARIANTS
33777    }
33778}
33779
33780impl Name for FeeBumpTransactionExt {
33781    #[must_use]
33782    fn name(&self) -> &'static str {
33783        Self::name(self)
33784    }
33785}
33786
33787impl Discriminant<i32> for FeeBumpTransactionExt {
33788    #[must_use]
33789    fn discriminant(&self) -> i32 {
33790        Self::discriminant(self)
33791    }
33792}
33793
33794impl Variants<i32> for FeeBumpTransactionExt {
33795    fn variants() -> slice::Iter<'static, i32> {
33796        Self::VARIANTS.iter()
33797    }
33798}
33799
33800impl Union<i32> for FeeBumpTransactionExt {}
33801
33802impl ReadXdr for FeeBumpTransactionExt {
33803    #[cfg(feature = "std")]
33804    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
33805        r.with_limited_depth(|r| {
33806            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
33807            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
33808            let v = match dv {
33809                0 => Self::V0,
33810                #[allow(unreachable_patterns)]
33811                _ => return Err(Error::Invalid),
33812            };
33813            Ok(v)
33814        })
33815    }
33816}
33817
33818impl WriteXdr for FeeBumpTransactionExt {
33819    #[cfg(feature = "std")]
33820    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
33821        w.with_limited_depth(|w| {
33822            self.discriminant().write_xdr(w)?;
33823            #[allow(clippy::match_same_arms)]
33824            match self {
33825                Self::V0 => ().write_xdr(w)?,
33826            };
33827            Ok(())
33828        })
33829    }
33830}
33831
33832/// FeeBumpTransaction is an XDR Struct defines as:
33833///
33834/// ```text
33835/// struct FeeBumpTransaction
33836/// {
33837///     MuxedAccount feeSource;
33838///     int64 fee;
33839///     union switch (EnvelopeType type)
33840///     {
33841///     case ENVELOPE_TYPE_TX:
33842///         TransactionV1Envelope v1;
33843///     }
33844///     innerTx;
33845///     union switch (int v)
33846///     {
33847///     case 0:
33848///         void;
33849///     }
33850///     ext;
33851/// };
33852/// ```
33853///
33854#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
33855#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
33856#[cfg_attr(
33857    all(feature = "serde", feature = "alloc"),
33858    derive(serde::Serialize, serde::Deserialize),
33859    serde(rename_all = "snake_case")
33860)]
33861#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
33862pub struct FeeBumpTransaction {
33863    pub fee_source: MuxedAccount,
33864    pub fee: i64,
33865    pub inner_tx: FeeBumpTransactionInnerTx,
33866    pub ext: FeeBumpTransactionExt,
33867}
33868
33869impl ReadXdr for FeeBumpTransaction {
33870    #[cfg(feature = "std")]
33871    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
33872        r.with_limited_depth(|r| {
33873            Ok(Self {
33874                fee_source: MuxedAccount::read_xdr(r)?,
33875                fee: i64::read_xdr(r)?,
33876                inner_tx: FeeBumpTransactionInnerTx::read_xdr(r)?,
33877                ext: FeeBumpTransactionExt::read_xdr(r)?,
33878            })
33879        })
33880    }
33881}
33882
33883impl WriteXdr for FeeBumpTransaction {
33884    #[cfg(feature = "std")]
33885    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
33886        w.with_limited_depth(|w| {
33887            self.fee_source.write_xdr(w)?;
33888            self.fee.write_xdr(w)?;
33889            self.inner_tx.write_xdr(w)?;
33890            self.ext.write_xdr(w)?;
33891            Ok(())
33892        })
33893    }
33894}
33895
33896/// FeeBumpTransactionEnvelope is an XDR Struct defines as:
33897///
33898/// ```text
33899/// struct FeeBumpTransactionEnvelope
33900/// {
33901///     FeeBumpTransaction tx;
33902///     /* Each decorated signature is a signature over the SHA256 hash of
33903///      * a TransactionSignaturePayload */
33904///     DecoratedSignature signatures<20>;
33905/// };
33906/// ```
33907///
33908#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
33909#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
33910#[cfg_attr(
33911    all(feature = "serde", feature = "alloc"),
33912    derive(serde::Serialize, serde::Deserialize),
33913    serde(rename_all = "snake_case")
33914)]
33915#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
33916pub struct FeeBumpTransactionEnvelope {
33917    pub tx: FeeBumpTransaction,
33918    pub signatures: VecM<DecoratedSignature, 20>,
33919}
33920
33921impl ReadXdr for FeeBumpTransactionEnvelope {
33922    #[cfg(feature = "std")]
33923    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
33924        r.with_limited_depth(|r| {
33925            Ok(Self {
33926                tx: FeeBumpTransaction::read_xdr(r)?,
33927                signatures: VecM::<DecoratedSignature, 20>::read_xdr(r)?,
33928            })
33929        })
33930    }
33931}
33932
33933impl WriteXdr for FeeBumpTransactionEnvelope {
33934    #[cfg(feature = "std")]
33935    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
33936        w.with_limited_depth(|w| {
33937            self.tx.write_xdr(w)?;
33938            self.signatures.write_xdr(w)?;
33939            Ok(())
33940        })
33941    }
33942}
33943
33944/// TransactionEnvelope is an XDR Union defines as:
33945///
33946/// ```text
33947/// union TransactionEnvelope switch (EnvelopeType type)
33948/// {
33949/// case ENVELOPE_TYPE_TX_V0:
33950///     TransactionV0Envelope v0;
33951/// case ENVELOPE_TYPE_TX:
33952///     TransactionV1Envelope v1;
33953/// case ENVELOPE_TYPE_TX_FEE_BUMP:
33954///     FeeBumpTransactionEnvelope feeBump;
33955/// };
33956/// ```
33957///
33958// union with discriminant EnvelopeType
33959#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
33960#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
33961#[cfg_attr(
33962    all(feature = "serde", feature = "alloc"),
33963    derive(serde::Serialize, serde::Deserialize),
33964    serde(rename_all = "snake_case")
33965)]
33966#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
33967#[allow(clippy::large_enum_variant)]
33968pub enum TransactionEnvelope {
33969    TxV0(TransactionV0Envelope),
33970    Tx(TransactionV1Envelope),
33971    TxFeeBump(FeeBumpTransactionEnvelope),
33972}
33973
33974impl TransactionEnvelope {
33975    pub const VARIANTS: [EnvelopeType; 3] = [
33976        EnvelopeType::TxV0,
33977        EnvelopeType::Tx,
33978        EnvelopeType::TxFeeBump,
33979    ];
33980    pub const VARIANTS_STR: [&'static str; 3] = ["TxV0", "Tx", "TxFeeBump"];
33981
33982    #[must_use]
33983    pub const fn name(&self) -> &'static str {
33984        match self {
33985            Self::TxV0(_) => "TxV0",
33986            Self::Tx(_) => "Tx",
33987            Self::TxFeeBump(_) => "TxFeeBump",
33988        }
33989    }
33990
33991    #[must_use]
33992    pub const fn discriminant(&self) -> EnvelopeType {
33993        #[allow(clippy::match_same_arms)]
33994        match self {
33995            Self::TxV0(_) => EnvelopeType::TxV0,
33996            Self::Tx(_) => EnvelopeType::Tx,
33997            Self::TxFeeBump(_) => EnvelopeType::TxFeeBump,
33998        }
33999    }
34000
34001    #[must_use]
34002    pub const fn variants() -> [EnvelopeType; 3] {
34003        Self::VARIANTS
34004    }
34005}
34006
34007impl Name for TransactionEnvelope {
34008    #[must_use]
34009    fn name(&self) -> &'static str {
34010        Self::name(self)
34011    }
34012}
34013
34014impl Discriminant<EnvelopeType> for TransactionEnvelope {
34015    #[must_use]
34016    fn discriminant(&self) -> EnvelopeType {
34017        Self::discriminant(self)
34018    }
34019}
34020
34021impl Variants<EnvelopeType> for TransactionEnvelope {
34022    fn variants() -> slice::Iter<'static, EnvelopeType> {
34023        Self::VARIANTS.iter()
34024    }
34025}
34026
34027impl Union<EnvelopeType> for TransactionEnvelope {}
34028
34029impl ReadXdr for TransactionEnvelope {
34030    #[cfg(feature = "std")]
34031    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
34032        r.with_limited_depth(|r| {
34033            let dv: EnvelopeType = <EnvelopeType as ReadXdr>::read_xdr(r)?;
34034            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
34035            let v = match dv {
34036                EnvelopeType::TxV0 => Self::TxV0(TransactionV0Envelope::read_xdr(r)?),
34037                EnvelopeType::Tx => Self::Tx(TransactionV1Envelope::read_xdr(r)?),
34038                EnvelopeType::TxFeeBump => {
34039                    Self::TxFeeBump(FeeBumpTransactionEnvelope::read_xdr(r)?)
34040                }
34041                #[allow(unreachable_patterns)]
34042                _ => return Err(Error::Invalid),
34043            };
34044            Ok(v)
34045        })
34046    }
34047}
34048
34049impl WriteXdr for TransactionEnvelope {
34050    #[cfg(feature = "std")]
34051    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
34052        w.with_limited_depth(|w| {
34053            self.discriminant().write_xdr(w)?;
34054            #[allow(clippy::match_same_arms)]
34055            match self {
34056                Self::TxV0(v) => v.write_xdr(w)?,
34057                Self::Tx(v) => v.write_xdr(w)?,
34058                Self::TxFeeBump(v) => v.write_xdr(w)?,
34059            };
34060            Ok(())
34061        })
34062    }
34063}
34064
34065/// TransactionSignaturePayloadTaggedTransaction is an XDR NestedUnion defines as:
34066///
34067/// ```text
34068/// union switch (EnvelopeType type)
34069///     {
34070///     // Backwards Compatibility: Use ENVELOPE_TYPE_TX to sign ENVELOPE_TYPE_TX_V0
34071///     case ENVELOPE_TYPE_TX:
34072///         Transaction tx;
34073///     case ENVELOPE_TYPE_TX_FEE_BUMP:
34074///         FeeBumpTransaction feeBump;
34075///     }
34076/// ```
34077///
34078// union with discriminant EnvelopeType
34079#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
34080#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
34081#[cfg_attr(
34082    all(feature = "serde", feature = "alloc"),
34083    derive(serde::Serialize, serde::Deserialize),
34084    serde(rename_all = "snake_case")
34085)]
34086#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
34087#[allow(clippy::large_enum_variant)]
34088pub enum TransactionSignaturePayloadTaggedTransaction {
34089    Tx(Transaction),
34090    TxFeeBump(FeeBumpTransaction),
34091}
34092
34093impl TransactionSignaturePayloadTaggedTransaction {
34094    pub const VARIANTS: [EnvelopeType; 2] = [EnvelopeType::Tx, EnvelopeType::TxFeeBump];
34095    pub const VARIANTS_STR: [&'static str; 2] = ["Tx", "TxFeeBump"];
34096
34097    #[must_use]
34098    pub const fn name(&self) -> &'static str {
34099        match self {
34100            Self::Tx(_) => "Tx",
34101            Self::TxFeeBump(_) => "TxFeeBump",
34102        }
34103    }
34104
34105    #[must_use]
34106    pub const fn discriminant(&self) -> EnvelopeType {
34107        #[allow(clippy::match_same_arms)]
34108        match self {
34109            Self::Tx(_) => EnvelopeType::Tx,
34110            Self::TxFeeBump(_) => EnvelopeType::TxFeeBump,
34111        }
34112    }
34113
34114    #[must_use]
34115    pub const fn variants() -> [EnvelopeType; 2] {
34116        Self::VARIANTS
34117    }
34118}
34119
34120impl Name for TransactionSignaturePayloadTaggedTransaction {
34121    #[must_use]
34122    fn name(&self) -> &'static str {
34123        Self::name(self)
34124    }
34125}
34126
34127impl Discriminant<EnvelopeType> for TransactionSignaturePayloadTaggedTransaction {
34128    #[must_use]
34129    fn discriminant(&self) -> EnvelopeType {
34130        Self::discriminant(self)
34131    }
34132}
34133
34134impl Variants<EnvelopeType> for TransactionSignaturePayloadTaggedTransaction {
34135    fn variants() -> slice::Iter<'static, EnvelopeType> {
34136        Self::VARIANTS.iter()
34137    }
34138}
34139
34140impl Union<EnvelopeType> for TransactionSignaturePayloadTaggedTransaction {}
34141
34142impl ReadXdr for TransactionSignaturePayloadTaggedTransaction {
34143    #[cfg(feature = "std")]
34144    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
34145        r.with_limited_depth(|r| {
34146            let dv: EnvelopeType = <EnvelopeType as ReadXdr>::read_xdr(r)?;
34147            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
34148            let v = match dv {
34149                EnvelopeType::Tx => Self::Tx(Transaction::read_xdr(r)?),
34150                EnvelopeType::TxFeeBump => Self::TxFeeBump(FeeBumpTransaction::read_xdr(r)?),
34151                #[allow(unreachable_patterns)]
34152                _ => return Err(Error::Invalid),
34153            };
34154            Ok(v)
34155        })
34156    }
34157}
34158
34159impl WriteXdr for TransactionSignaturePayloadTaggedTransaction {
34160    #[cfg(feature = "std")]
34161    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
34162        w.with_limited_depth(|w| {
34163            self.discriminant().write_xdr(w)?;
34164            #[allow(clippy::match_same_arms)]
34165            match self {
34166                Self::Tx(v) => v.write_xdr(w)?,
34167                Self::TxFeeBump(v) => v.write_xdr(w)?,
34168            };
34169            Ok(())
34170        })
34171    }
34172}
34173
34174/// TransactionSignaturePayload is an XDR Struct defines as:
34175///
34176/// ```text
34177/// struct TransactionSignaturePayload
34178/// {
34179///     Hash networkId;
34180///     union switch (EnvelopeType type)
34181///     {
34182///     // Backwards Compatibility: Use ENVELOPE_TYPE_TX to sign ENVELOPE_TYPE_TX_V0
34183///     case ENVELOPE_TYPE_TX:
34184///         Transaction tx;
34185///     case ENVELOPE_TYPE_TX_FEE_BUMP:
34186///         FeeBumpTransaction feeBump;
34187///     }
34188///     taggedTransaction;
34189/// };
34190/// ```
34191///
34192#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
34193#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
34194#[cfg_attr(
34195    all(feature = "serde", feature = "alloc"),
34196    derive(serde::Serialize, serde::Deserialize),
34197    serde(rename_all = "snake_case")
34198)]
34199#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
34200pub struct TransactionSignaturePayload {
34201    pub network_id: Hash,
34202    pub tagged_transaction: TransactionSignaturePayloadTaggedTransaction,
34203}
34204
34205impl ReadXdr for TransactionSignaturePayload {
34206    #[cfg(feature = "std")]
34207    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
34208        r.with_limited_depth(|r| {
34209            Ok(Self {
34210                network_id: Hash::read_xdr(r)?,
34211                tagged_transaction: TransactionSignaturePayloadTaggedTransaction::read_xdr(r)?,
34212            })
34213        })
34214    }
34215}
34216
34217impl WriteXdr for TransactionSignaturePayload {
34218    #[cfg(feature = "std")]
34219    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
34220        w.with_limited_depth(|w| {
34221            self.network_id.write_xdr(w)?;
34222            self.tagged_transaction.write_xdr(w)?;
34223            Ok(())
34224        })
34225    }
34226}
34227
34228/// ClaimAtomType is an XDR Enum defines as:
34229///
34230/// ```text
34231/// enum ClaimAtomType
34232/// {
34233///     CLAIM_ATOM_TYPE_V0 = 0,
34234///     CLAIM_ATOM_TYPE_ORDER_BOOK = 1,
34235///     CLAIM_ATOM_TYPE_LIQUIDITY_POOL = 2
34236/// };
34237/// ```
34238///
34239// enum
34240#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
34241#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
34242#[cfg_attr(
34243    all(feature = "serde", feature = "alloc"),
34244    derive(serde::Serialize, serde::Deserialize),
34245    serde(rename_all = "snake_case")
34246)]
34247#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
34248#[repr(i32)]
34249pub enum ClaimAtomType {
34250    V0 = 0,
34251    OrderBook = 1,
34252    LiquidityPool = 2,
34253}
34254
34255impl ClaimAtomType {
34256    pub const VARIANTS: [ClaimAtomType; 3] = [
34257        ClaimAtomType::V0,
34258        ClaimAtomType::OrderBook,
34259        ClaimAtomType::LiquidityPool,
34260    ];
34261    pub const VARIANTS_STR: [&'static str; 3] = ["V0", "OrderBook", "LiquidityPool"];
34262
34263    #[must_use]
34264    pub const fn name(&self) -> &'static str {
34265        match self {
34266            Self::V0 => "V0",
34267            Self::OrderBook => "OrderBook",
34268            Self::LiquidityPool => "LiquidityPool",
34269        }
34270    }
34271
34272    #[must_use]
34273    pub const fn variants() -> [ClaimAtomType; 3] {
34274        Self::VARIANTS
34275    }
34276}
34277
34278impl Name for ClaimAtomType {
34279    #[must_use]
34280    fn name(&self) -> &'static str {
34281        Self::name(self)
34282    }
34283}
34284
34285impl Variants<ClaimAtomType> for ClaimAtomType {
34286    fn variants() -> slice::Iter<'static, ClaimAtomType> {
34287        Self::VARIANTS.iter()
34288    }
34289}
34290
34291impl Enum for ClaimAtomType {}
34292
34293impl fmt::Display for ClaimAtomType {
34294    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
34295        f.write_str(self.name())
34296    }
34297}
34298
34299impl TryFrom<i32> for ClaimAtomType {
34300    type Error = Error;
34301
34302    fn try_from(i: i32) -> Result<Self> {
34303        let e = match i {
34304            0 => ClaimAtomType::V0,
34305            1 => ClaimAtomType::OrderBook,
34306            2 => ClaimAtomType::LiquidityPool,
34307            #[allow(unreachable_patterns)]
34308            _ => return Err(Error::Invalid),
34309        };
34310        Ok(e)
34311    }
34312}
34313
34314impl From<ClaimAtomType> for i32 {
34315    #[must_use]
34316    fn from(e: ClaimAtomType) -> Self {
34317        e as Self
34318    }
34319}
34320
34321impl ReadXdr for ClaimAtomType {
34322    #[cfg(feature = "std")]
34323    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
34324        r.with_limited_depth(|r| {
34325            let e = i32::read_xdr(r)?;
34326            let v: Self = e.try_into()?;
34327            Ok(v)
34328        })
34329    }
34330}
34331
34332impl WriteXdr for ClaimAtomType {
34333    #[cfg(feature = "std")]
34334    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
34335        w.with_limited_depth(|w| {
34336            let i: i32 = (*self).into();
34337            i.write_xdr(w)
34338        })
34339    }
34340}
34341
34342/// ClaimOfferAtomV0 is an XDR Struct defines as:
34343///
34344/// ```text
34345/// struct ClaimOfferAtomV0
34346/// {
34347///     // emitted to identify the offer
34348///     uint256 sellerEd25519; // Account that owns the offer
34349///     int64 offerID;
34350///
34351///     // amount and asset taken from the owner
34352///     Asset assetSold;
34353///     int64 amountSold;
34354///
34355///     // amount and asset sent to the owner
34356///     Asset assetBought;
34357///     int64 amountBought;
34358/// };
34359/// ```
34360///
34361#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
34362#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
34363#[cfg_attr(
34364    all(feature = "serde", feature = "alloc"),
34365    derive(serde::Serialize, serde::Deserialize),
34366    serde(rename_all = "snake_case")
34367)]
34368#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
34369pub struct ClaimOfferAtomV0 {
34370    pub seller_ed25519: Uint256,
34371    pub offer_id: i64,
34372    pub asset_sold: Asset,
34373    pub amount_sold: i64,
34374    pub asset_bought: Asset,
34375    pub amount_bought: i64,
34376}
34377
34378impl ReadXdr for ClaimOfferAtomV0 {
34379    #[cfg(feature = "std")]
34380    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
34381        r.with_limited_depth(|r| {
34382            Ok(Self {
34383                seller_ed25519: Uint256::read_xdr(r)?,
34384                offer_id: i64::read_xdr(r)?,
34385                asset_sold: Asset::read_xdr(r)?,
34386                amount_sold: i64::read_xdr(r)?,
34387                asset_bought: Asset::read_xdr(r)?,
34388                amount_bought: i64::read_xdr(r)?,
34389            })
34390        })
34391    }
34392}
34393
34394impl WriteXdr for ClaimOfferAtomV0 {
34395    #[cfg(feature = "std")]
34396    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
34397        w.with_limited_depth(|w| {
34398            self.seller_ed25519.write_xdr(w)?;
34399            self.offer_id.write_xdr(w)?;
34400            self.asset_sold.write_xdr(w)?;
34401            self.amount_sold.write_xdr(w)?;
34402            self.asset_bought.write_xdr(w)?;
34403            self.amount_bought.write_xdr(w)?;
34404            Ok(())
34405        })
34406    }
34407}
34408
34409/// ClaimOfferAtom is an XDR Struct defines as:
34410///
34411/// ```text
34412/// struct ClaimOfferAtom
34413/// {
34414///     // emitted to identify the offer
34415///     AccountID sellerID; // Account that owns the offer
34416///     int64 offerID;
34417///
34418///     // amount and asset taken from the owner
34419///     Asset assetSold;
34420///     int64 amountSold;
34421///
34422///     // amount and asset sent to the owner
34423///     Asset assetBought;
34424///     int64 amountBought;
34425/// };
34426/// ```
34427///
34428#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
34429#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
34430#[cfg_attr(
34431    all(feature = "serde", feature = "alloc"),
34432    derive(serde::Serialize, serde::Deserialize),
34433    serde(rename_all = "snake_case")
34434)]
34435#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
34436pub struct ClaimOfferAtom {
34437    pub seller_id: AccountId,
34438    pub offer_id: i64,
34439    pub asset_sold: Asset,
34440    pub amount_sold: i64,
34441    pub asset_bought: Asset,
34442    pub amount_bought: i64,
34443}
34444
34445impl ReadXdr for ClaimOfferAtom {
34446    #[cfg(feature = "std")]
34447    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
34448        r.with_limited_depth(|r| {
34449            Ok(Self {
34450                seller_id: AccountId::read_xdr(r)?,
34451                offer_id: i64::read_xdr(r)?,
34452                asset_sold: Asset::read_xdr(r)?,
34453                amount_sold: i64::read_xdr(r)?,
34454                asset_bought: Asset::read_xdr(r)?,
34455                amount_bought: i64::read_xdr(r)?,
34456            })
34457        })
34458    }
34459}
34460
34461impl WriteXdr for ClaimOfferAtom {
34462    #[cfg(feature = "std")]
34463    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
34464        w.with_limited_depth(|w| {
34465            self.seller_id.write_xdr(w)?;
34466            self.offer_id.write_xdr(w)?;
34467            self.asset_sold.write_xdr(w)?;
34468            self.amount_sold.write_xdr(w)?;
34469            self.asset_bought.write_xdr(w)?;
34470            self.amount_bought.write_xdr(w)?;
34471            Ok(())
34472        })
34473    }
34474}
34475
34476/// ClaimLiquidityAtom is an XDR Struct defines as:
34477///
34478/// ```text
34479/// struct ClaimLiquidityAtom
34480/// {
34481///     PoolID liquidityPoolID;
34482///
34483///     // amount and asset taken from the pool
34484///     Asset assetSold;
34485///     int64 amountSold;
34486///
34487///     // amount and asset sent to the pool
34488///     Asset assetBought;
34489///     int64 amountBought;
34490/// };
34491/// ```
34492///
34493#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
34494#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
34495#[cfg_attr(
34496    all(feature = "serde", feature = "alloc"),
34497    derive(serde::Serialize, serde::Deserialize),
34498    serde(rename_all = "snake_case")
34499)]
34500#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
34501pub struct ClaimLiquidityAtom {
34502    pub liquidity_pool_id: PoolId,
34503    pub asset_sold: Asset,
34504    pub amount_sold: i64,
34505    pub asset_bought: Asset,
34506    pub amount_bought: i64,
34507}
34508
34509impl ReadXdr for ClaimLiquidityAtom {
34510    #[cfg(feature = "std")]
34511    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
34512        r.with_limited_depth(|r| {
34513            Ok(Self {
34514                liquidity_pool_id: PoolId::read_xdr(r)?,
34515                asset_sold: Asset::read_xdr(r)?,
34516                amount_sold: i64::read_xdr(r)?,
34517                asset_bought: Asset::read_xdr(r)?,
34518                amount_bought: i64::read_xdr(r)?,
34519            })
34520        })
34521    }
34522}
34523
34524impl WriteXdr for ClaimLiquidityAtom {
34525    #[cfg(feature = "std")]
34526    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
34527        w.with_limited_depth(|w| {
34528            self.liquidity_pool_id.write_xdr(w)?;
34529            self.asset_sold.write_xdr(w)?;
34530            self.amount_sold.write_xdr(w)?;
34531            self.asset_bought.write_xdr(w)?;
34532            self.amount_bought.write_xdr(w)?;
34533            Ok(())
34534        })
34535    }
34536}
34537
34538/// ClaimAtom is an XDR Union defines as:
34539///
34540/// ```text
34541/// union ClaimAtom switch (ClaimAtomType type)
34542/// {
34543/// case CLAIM_ATOM_TYPE_V0:
34544///     ClaimOfferAtomV0 v0;
34545/// case CLAIM_ATOM_TYPE_ORDER_BOOK:
34546///     ClaimOfferAtom orderBook;
34547/// case CLAIM_ATOM_TYPE_LIQUIDITY_POOL:
34548///     ClaimLiquidityAtom liquidityPool;
34549/// };
34550/// ```
34551///
34552// union with discriminant ClaimAtomType
34553#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
34554#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
34555#[cfg_attr(
34556    all(feature = "serde", feature = "alloc"),
34557    derive(serde::Serialize, serde::Deserialize),
34558    serde(rename_all = "snake_case")
34559)]
34560#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
34561#[allow(clippy::large_enum_variant)]
34562pub enum ClaimAtom {
34563    V0(ClaimOfferAtomV0),
34564    OrderBook(ClaimOfferAtom),
34565    LiquidityPool(ClaimLiquidityAtom),
34566}
34567
34568impl ClaimAtom {
34569    pub const VARIANTS: [ClaimAtomType; 3] = [
34570        ClaimAtomType::V0,
34571        ClaimAtomType::OrderBook,
34572        ClaimAtomType::LiquidityPool,
34573    ];
34574    pub const VARIANTS_STR: [&'static str; 3] = ["V0", "OrderBook", "LiquidityPool"];
34575
34576    #[must_use]
34577    pub const fn name(&self) -> &'static str {
34578        match self {
34579            Self::V0(_) => "V0",
34580            Self::OrderBook(_) => "OrderBook",
34581            Self::LiquidityPool(_) => "LiquidityPool",
34582        }
34583    }
34584
34585    #[must_use]
34586    pub const fn discriminant(&self) -> ClaimAtomType {
34587        #[allow(clippy::match_same_arms)]
34588        match self {
34589            Self::V0(_) => ClaimAtomType::V0,
34590            Self::OrderBook(_) => ClaimAtomType::OrderBook,
34591            Self::LiquidityPool(_) => ClaimAtomType::LiquidityPool,
34592        }
34593    }
34594
34595    #[must_use]
34596    pub const fn variants() -> [ClaimAtomType; 3] {
34597        Self::VARIANTS
34598    }
34599}
34600
34601impl Name for ClaimAtom {
34602    #[must_use]
34603    fn name(&self) -> &'static str {
34604        Self::name(self)
34605    }
34606}
34607
34608impl Discriminant<ClaimAtomType> for ClaimAtom {
34609    #[must_use]
34610    fn discriminant(&self) -> ClaimAtomType {
34611        Self::discriminant(self)
34612    }
34613}
34614
34615impl Variants<ClaimAtomType> for ClaimAtom {
34616    fn variants() -> slice::Iter<'static, ClaimAtomType> {
34617        Self::VARIANTS.iter()
34618    }
34619}
34620
34621impl Union<ClaimAtomType> for ClaimAtom {}
34622
34623impl ReadXdr for ClaimAtom {
34624    #[cfg(feature = "std")]
34625    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
34626        r.with_limited_depth(|r| {
34627            let dv: ClaimAtomType = <ClaimAtomType as ReadXdr>::read_xdr(r)?;
34628            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
34629            let v = match dv {
34630                ClaimAtomType::V0 => Self::V0(ClaimOfferAtomV0::read_xdr(r)?),
34631                ClaimAtomType::OrderBook => Self::OrderBook(ClaimOfferAtom::read_xdr(r)?),
34632                ClaimAtomType::LiquidityPool => {
34633                    Self::LiquidityPool(ClaimLiquidityAtom::read_xdr(r)?)
34634                }
34635                #[allow(unreachable_patterns)]
34636                _ => return Err(Error::Invalid),
34637            };
34638            Ok(v)
34639        })
34640    }
34641}
34642
34643impl WriteXdr for ClaimAtom {
34644    #[cfg(feature = "std")]
34645    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
34646        w.with_limited_depth(|w| {
34647            self.discriminant().write_xdr(w)?;
34648            #[allow(clippy::match_same_arms)]
34649            match self {
34650                Self::V0(v) => v.write_xdr(w)?,
34651                Self::OrderBook(v) => v.write_xdr(w)?,
34652                Self::LiquidityPool(v) => v.write_xdr(w)?,
34653            };
34654            Ok(())
34655        })
34656    }
34657}
34658
34659/// CreateAccountResultCode is an XDR Enum defines as:
34660///
34661/// ```text
34662/// enum CreateAccountResultCode
34663/// {
34664///     // codes considered as "success" for the operation
34665///     CREATE_ACCOUNT_SUCCESS = 0, // account was created
34666///
34667///     // codes considered as "failure" for the operation
34668///     CREATE_ACCOUNT_MALFORMED = -1,   // invalid destination
34669///     CREATE_ACCOUNT_UNDERFUNDED = -2, // not enough funds in source account
34670///     CREATE_ACCOUNT_LOW_RESERVE =
34671///         -3, // would create an account below the min reserve
34672///     CREATE_ACCOUNT_ALREADY_EXIST = -4 // account already exists
34673/// };
34674/// ```
34675///
34676// enum
34677#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
34678#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
34679#[cfg_attr(
34680    all(feature = "serde", feature = "alloc"),
34681    derive(serde::Serialize, serde::Deserialize),
34682    serde(rename_all = "snake_case")
34683)]
34684#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
34685#[repr(i32)]
34686pub enum CreateAccountResultCode {
34687    Success = 0,
34688    Malformed = -1,
34689    Underfunded = -2,
34690    LowReserve = -3,
34691    AlreadyExist = -4,
34692}
34693
34694impl CreateAccountResultCode {
34695    pub const VARIANTS: [CreateAccountResultCode; 5] = [
34696        CreateAccountResultCode::Success,
34697        CreateAccountResultCode::Malformed,
34698        CreateAccountResultCode::Underfunded,
34699        CreateAccountResultCode::LowReserve,
34700        CreateAccountResultCode::AlreadyExist,
34701    ];
34702    pub const VARIANTS_STR: [&'static str; 5] = [
34703        "Success",
34704        "Malformed",
34705        "Underfunded",
34706        "LowReserve",
34707        "AlreadyExist",
34708    ];
34709
34710    #[must_use]
34711    pub const fn name(&self) -> &'static str {
34712        match self {
34713            Self::Success => "Success",
34714            Self::Malformed => "Malformed",
34715            Self::Underfunded => "Underfunded",
34716            Self::LowReserve => "LowReserve",
34717            Self::AlreadyExist => "AlreadyExist",
34718        }
34719    }
34720
34721    #[must_use]
34722    pub const fn variants() -> [CreateAccountResultCode; 5] {
34723        Self::VARIANTS
34724    }
34725}
34726
34727impl Name for CreateAccountResultCode {
34728    #[must_use]
34729    fn name(&self) -> &'static str {
34730        Self::name(self)
34731    }
34732}
34733
34734impl Variants<CreateAccountResultCode> for CreateAccountResultCode {
34735    fn variants() -> slice::Iter<'static, CreateAccountResultCode> {
34736        Self::VARIANTS.iter()
34737    }
34738}
34739
34740impl Enum for CreateAccountResultCode {}
34741
34742impl fmt::Display for CreateAccountResultCode {
34743    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
34744        f.write_str(self.name())
34745    }
34746}
34747
34748impl TryFrom<i32> for CreateAccountResultCode {
34749    type Error = Error;
34750
34751    fn try_from(i: i32) -> Result<Self> {
34752        let e = match i {
34753            0 => CreateAccountResultCode::Success,
34754            -1 => CreateAccountResultCode::Malformed,
34755            -2 => CreateAccountResultCode::Underfunded,
34756            -3 => CreateAccountResultCode::LowReserve,
34757            -4 => CreateAccountResultCode::AlreadyExist,
34758            #[allow(unreachable_patterns)]
34759            _ => return Err(Error::Invalid),
34760        };
34761        Ok(e)
34762    }
34763}
34764
34765impl From<CreateAccountResultCode> for i32 {
34766    #[must_use]
34767    fn from(e: CreateAccountResultCode) -> Self {
34768        e as Self
34769    }
34770}
34771
34772impl ReadXdr for CreateAccountResultCode {
34773    #[cfg(feature = "std")]
34774    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
34775        r.with_limited_depth(|r| {
34776            let e = i32::read_xdr(r)?;
34777            let v: Self = e.try_into()?;
34778            Ok(v)
34779        })
34780    }
34781}
34782
34783impl WriteXdr for CreateAccountResultCode {
34784    #[cfg(feature = "std")]
34785    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
34786        w.with_limited_depth(|w| {
34787            let i: i32 = (*self).into();
34788            i.write_xdr(w)
34789        })
34790    }
34791}
34792
34793/// CreateAccountResult is an XDR Union defines as:
34794///
34795/// ```text
34796/// union CreateAccountResult switch (CreateAccountResultCode code)
34797/// {
34798/// case CREATE_ACCOUNT_SUCCESS:
34799///     void;
34800/// case CREATE_ACCOUNT_MALFORMED:
34801/// case CREATE_ACCOUNT_UNDERFUNDED:
34802/// case CREATE_ACCOUNT_LOW_RESERVE:
34803/// case CREATE_ACCOUNT_ALREADY_EXIST:
34804///     void;
34805/// };
34806/// ```
34807///
34808// union with discriminant CreateAccountResultCode
34809#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
34810#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
34811#[cfg_attr(
34812    all(feature = "serde", feature = "alloc"),
34813    derive(serde::Serialize, serde::Deserialize),
34814    serde(rename_all = "snake_case")
34815)]
34816#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
34817#[allow(clippy::large_enum_variant)]
34818pub enum CreateAccountResult {
34819    Success,
34820    Malformed,
34821    Underfunded,
34822    LowReserve,
34823    AlreadyExist,
34824}
34825
34826impl CreateAccountResult {
34827    pub const VARIANTS: [CreateAccountResultCode; 5] = [
34828        CreateAccountResultCode::Success,
34829        CreateAccountResultCode::Malformed,
34830        CreateAccountResultCode::Underfunded,
34831        CreateAccountResultCode::LowReserve,
34832        CreateAccountResultCode::AlreadyExist,
34833    ];
34834    pub const VARIANTS_STR: [&'static str; 5] = [
34835        "Success",
34836        "Malformed",
34837        "Underfunded",
34838        "LowReserve",
34839        "AlreadyExist",
34840    ];
34841
34842    #[must_use]
34843    pub const fn name(&self) -> &'static str {
34844        match self {
34845            Self::Success => "Success",
34846            Self::Malformed => "Malformed",
34847            Self::Underfunded => "Underfunded",
34848            Self::LowReserve => "LowReserve",
34849            Self::AlreadyExist => "AlreadyExist",
34850        }
34851    }
34852
34853    #[must_use]
34854    pub const fn discriminant(&self) -> CreateAccountResultCode {
34855        #[allow(clippy::match_same_arms)]
34856        match self {
34857            Self::Success => CreateAccountResultCode::Success,
34858            Self::Malformed => CreateAccountResultCode::Malformed,
34859            Self::Underfunded => CreateAccountResultCode::Underfunded,
34860            Self::LowReserve => CreateAccountResultCode::LowReserve,
34861            Self::AlreadyExist => CreateAccountResultCode::AlreadyExist,
34862        }
34863    }
34864
34865    #[must_use]
34866    pub const fn variants() -> [CreateAccountResultCode; 5] {
34867        Self::VARIANTS
34868    }
34869}
34870
34871impl Name for CreateAccountResult {
34872    #[must_use]
34873    fn name(&self) -> &'static str {
34874        Self::name(self)
34875    }
34876}
34877
34878impl Discriminant<CreateAccountResultCode> for CreateAccountResult {
34879    #[must_use]
34880    fn discriminant(&self) -> CreateAccountResultCode {
34881        Self::discriminant(self)
34882    }
34883}
34884
34885impl Variants<CreateAccountResultCode> for CreateAccountResult {
34886    fn variants() -> slice::Iter<'static, CreateAccountResultCode> {
34887        Self::VARIANTS.iter()
34888    }
34889}
34890
34891impl Union<CreateAccountResultCode> for CreateAccountResult {}
34892
34893impl ReadXdr for CreateAccountResult {
34894    #[cfg(feature = "std")]
34895    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
34896        r.with_limited_depth(|r| {
34897            let dv: CreateAccountResultCode = <CreateAccountResultCode as ReadXdr>::read_xdr(r)?;
34898            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
34899            let v = match dv {
34900                CreateAccountResultCode::Success => Self::Success,
34901                CreateAccountResultCode::Malformed => Self::Malformed,
34902                CreateAccountResultCode::Underfunded => Self::Underfunded,
34903                CreateAccountResultCode::LowReserve => Self::LowReserve,
34904                CreateAccountResultCode::AlreadyExist => Self::AlreadyExist,
34905                #[allow(unreachable_patterns)]
34906                _ => return Err(Error::Invalid),
34907            };
34908            Ok(v)
34909        })
34910    }
34911}
34912
34913impl WriteXdr for CreateAccountResult {
34914    #[cfg(feature = "std")]
34915    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
34916        w.with_limited_depth(|w| {
34917            self.discriminant().write_xdr(w)?;
34918            #[allow(clippy::match_same_arms)]
34919            match self {
34920                Self::Success => ().write_xdr(w)?,
34921                Self::Malformed => ().write_xdr(w)?,
34922                Self::Underfunded => ().write_xdr(w)?,
34923                Self::LowReserve => ().write_xdr(w)?,
34924                Self::AlreadyExist => ().write_xdr(w)?,
34925            };
34926            Ok(())
34927        })
34928    }
34929}
34930
34931/// PaymentResultCode is an XDR Enum defines as:
34932///
34933/// ```text
34934/// enum PaymentResultCode
34935/// {
34936///     // codes considered as "success" for the operation
34937///     PAYMENT_SUCCESS = 0, // payment successfully completed
34938///
34939///     // codes considered as "failure" for the operation
34940///     PAYMENT_MALFORMED = -1,          // bad input
34941///     PAYMENT_UNDERFUNDED = -2,        // not enough funds in source account
34942///     PAYMENT_SRC_NO_TRUST = -3,       // no trust line on source account
34943///     PAYMENT_SRC_NOT_AUTHORIZED = -4, // source not authorized to transfer
34944///     PAYMENT_NO_DESTINATION = -5,     // destination account does not exist
34945///     PAYMENT_NO_TRUST = -6,       // destination missing a trust line for asset
34946///     PAYMENT_NOT_AUTHORIZED = -7, // destination not authorized to hold asset
34947///     PAYMENT_LINE_FULL = -8,      // destination would go above their limit
34948///     PAYMENT_NO_ISSUER = -9       // missing issuer on asset
34949/// };
34950/// ```
34951///
34952// enum
34953#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
34954#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
34955#[cfg_attr(
34956    all(feature = "serde", feature = "alloc"),
34957    derive(serde::Serialize, serde::Deserialize),
34958    serde(rename_all = "snake_case")
34959)]
34960#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
34961#[repr(i32)]
34962pub enum PaymentResultCode {
34963    Success = 0,
34964    Malformed = -1,
34965    Underfunded = -2,
34966    SrcNoTrust = -3,
34967    SrcNotAuthorized = -4,
34968    NoDestination = -5,
34969    NoTrust = -6,
34970    NotAuthorized = -7,
34971    LineFull = -8,
34972    NoIssuer = -9,
34973}
34974
34975impl PaymentResultCode {
34976    pub const VARIANTS: [PaymentResultCode; 10] = [
34977        PaymentResultCode::Success,
34978        PaymentResultCode::Malformed,
34979        PaymentResultCode::Underfunded,
34980        PaymentResultCode::SrcNoTrust,
34981        PaymentResultCode::SrcNotAuthorized,
34982        PaymentResultCode::NoDestination,
34983        PaymentResultCode::NoTrust,
34984        PaymentResultCode::NotAuthorized,
34985        PaymentResultCode::LineFull,
34986        PaymentResultCode::NoIssuer,
34987    ];
34988    pub const VARIANTS_STR: [&'static str; 10] = [
34989        "Success",
34990        "Malformed",
34991        "Underfunded",
34992        "SrcNoTrust",
34993        "SrcNotAuthorized",
34994        "NoDestination",
34995        "NoTrust",
34996        "NotAuthorized",
34997        "LineFull",
34998        "NoIssuer",
34999    ];
35000
35001    #[must_use]
35002    pub const fn name(&self) -> &'static str {
35003        match self {
35004            Self::Success => "Success",
35005            Self::Malformed => "Malformed",
35006            Self::Underfunded => "Underfunded",
35007            Self::SrcNoTrust => "SrcNoTrust",
35008            Self::SrcNotAuthorized => "SrcNotAuthorized",
35009            Self::NoDestination => "NoDestination",
35010            Self::NoTrust => "NoTrust",
35011            Self::NotAuthorized => "NotAuthorized",
35012            Self::LineFull => "LineFull",
35013            Self::NoIssuer => "NoIssuer",
35014        }
35015    }
35016
35017    #[must_use]
35018    pub const fn variants() -> [PaymentResultCode; 10] {
35019        Self::VARIANTS
35020    }
35021}
35022
35023impl Name for PaymentResultCode {
35024    #[must_use]
35025    fn name(&self) -> &'static str {
35026        Self::name(self)
35027    }
35028}
35029
35030impl Variants<PaymentResultCode> for PaymentResultCode {
35031    fn variants() -> slice::Iter<'static, PaymentResultCode> {
35032        Self::VARIANTS.iter()
35033    }
35034}
35035
35036impl Enum for PaymentResultCode {}
35037
35038impl fmt::Display for PaymentResultCode {
35039    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
35040        f.write_str(self.name())
35041    }
35042}
35043
35044impl TryFrom<i32> for PaymentResultCode {
35045    type Error = Error;
35046
35047    fn try_from(i: i32) -> Result<Self> {
35048        let e = match i {
35049            0 => PaymentResultCode::Success,
35050            -1 => PaymentResultCode::Malformed,
35051            -2 => PaymentResultCode::Underfunded,
35052            -3 => PaymentResultCode::SrcNoTrust,
35053            -4 => PaymentResultCode::SrcNotAuthorized,
35054            -5 => PaymentResultCode::NoDestination,
35055            -6 => PaymentResultCode::NoTrust,
35056            -7 => PaymentResultCode::NotAuthorized,
35057            -8 => PaymentResultCode::LineFull,
35058            -9 => PaymentResultCode::NoIssuer,
35059            #[allow(unreachable_patterns)]
35060            _ => return Err(Error::Invalid),
35061        };
35062        Ok(e)
35063    }
35064}
35065
35066impl From<PaymentResultCode> for i32 {
35067    #[must_use]
35068    fn from(e: PaymentResultCode) -> Self {
35069        e as Self
35070    }
35071}
35072
35073impl ReadXdr for PaymentResultCode {
35074    #[cfg(feature = "std")]
35075    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
35076        r.with_limited_depth(|r| {
35077            let e = i32::read_xdr(r)?;
35078            let v: Self = e.try_into()?;
35079            Ok(v)
35080        })
35081    }
35082}
35083
35084impl WriteXdr for PaymentResultCode {
35085    #[cfg(feature = "std")]
35086    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
35087        w.with_limited_depth(|w| {
35088            let i: i32 = (*self).into();
35089            i.write_xdr(w)
35090        })
35091    }
35092}
35093
35094/// PaymentResult is an XDR Union defines as:
35095///
35096/// ```text
35097/// union PaymentResult switch (PaymentResultCode code)
35098/// {
35099/// case PAYMENT_SUCCESS:
35100///     void;
35101/// case PAYMENT_MALFORMED:
35102/// case PAYMENT_UNDERFUNDED:
35103/// case PAYMENT_SRC_NO_TRUST:
35104/// case PAYMENT_SRC_NOT_AUTHORIZED:
35105/// case PAYMENT_NO_DESTINATION:
35106/// case PAYMENT_NO_TRUST:
35107/// case PAYMENT_NOT_AUTHORIZED:
35108/// case PAYMENT_LINE_FULL:
35109/// case PAYMENT_NO_ISSUER:
35110///     void;
35111/// };
35112/// ```
35113///
35114// union with discriminant PaymentResultCode
35115#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
35116#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
35117#[cfg_attr(
35118    all(feature = "serde", feature = "alloc"),
35119    derive(serde::Serialize, serde::Deserialize),
35120    serde(rename_all = "snake_case")
35121)]
35122#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
35123#[allow(clippy::large_enum_variant)]
35124pub enum PaymentResult {
35125    Success,
35126    Malformed,
35127    Underfunded,
35128    SrcNoTrust,
35129    SrcNotAuthorized,
35130    NoDestination,
35131    NoTrust,
35132    NotAuthorized,
35133    LineFull,
35134    NoIssuer,
35135}
35136
35137impl PaymentResult {
35138    pub const VARIANTS: [PaymentResultCode; 10] = [
35139        PaymentResultCode::Success,
35140        PaymentResultCode::Malformed,
35141        PaymentResultCode::Underfunded,
35142        PaymentResultCode::SrcNoTrust,
35143        PaymentResultCode::SrcNotAuthorized,
35144        PaymentResultCode::NoDestination,
35145        PaymentResultCode::NoTrust,
35146        PaymentResultCode::NotAuthorized,
35147        PaymentResultCode::LineFull,
35148        PaymentResultCode::NoIssuer,
35149    ];
35150    pub const VARIANTS_STR: [&'static str; 10] = [
35151        "Success",
35152        "Malformed",
35153        "Underfunded",
35154        "SrcNoTrust",
35155        "SrcNotAuthorized",
35156        "NoDestination",
35157        "NoTrust",
35158        "NotAuthorized",
35159        "LineFull",
35160        "NoIssuer",
35161    ];
35162
35163    #[must_use]
35164    pub const fn name(&self) -> &'static str {
35165        match self {
35166            Self::Success => "Success",
35167            Self::Malformed => "Malformed",
35168            Self::Underfunded => "Underfunded",
35169            Self::SrcNoTrust => "SrcNoTrust",
35170            Self::SrcNotAuthorized => "SrcNotAuthorized",
35171            Self::NoDestination => "NoDestination",
35172            Self::NoTrust => "NoTrust",
35173            Self::NotAuthorized => "NotAuthorized",
35174            Self::LineFull => "LineFull",
35175            Self::NoIssuer => "NoIssuer",
35176        }
35177    }
35178
35179    #[must_use]
35180    pub const fn discriminant(&self) -> PaymentResultCode {
35181        #[allow(clippy::match_same_arms)]
35182        match self {
35183            Self::Success => PaymentResultCode::Success,
35184            Self::Malformed => PaymentResultCode::Malformed,
35185            Self::Underfunded => PaymentResultCode::Underfunded,
35186            Self::SrcNoTrust => PaymentResultCode::SrcNoTrust,
35187            Self::SrcNotAuthorized => PaymentResultCode::SrcNotAuthorized,
35188            Self::NoDestination => PaymentResultCode::NoDestination,
35189            Self::NoTrust => PaymentResultCode::NoTrust,
35190            Self::NotAuthorized => PaymentResultCode::NotAuthorized,
35191            Self::LineFull => PaymentResultCode::LineFull,
35192            Self::NoIssuer => PaymentResultCode::NoIssuer,
35193        }
35194    }
35195
35196    #[must_use]
35197    pub const fn variants() -> [PaymentResultCode; 10] {
35198        Self::VARIANTS
35199    }
35200}
35201
35202impl Name for PaymentResult {
35203    #[must_use]
35204    fn name(&self) -> &'static str {
35205        Self::name(self)
35206    }
35207}
35208
35209impl Discriminant<PaymentResultCode> for PaymentResult {
35210    #[must_use]
35211    fn discriminant(&self) -> PaymentResultCode {
35212        Self::discriminant(self)
35213    }
35214}
35215
35216impl Variants<PaymentResultCode> for PaymentResult {
35217    fn variants() -> slice::Iter<'static, PaymentResultCode> {
35218        Self::VARIANTS.iter()
35219    }
35220}
35221
35222impl Union<PaymentResultCode> for PaymentResult {}
35223
35224impl ReadXdr for PaymentResult {
35225    #[cfg(feature = "std")]
35226    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
35227        r.with_limited_depth(|r| {
35228            let dv: PaymentResultCode = <PaymentResultCode as ReadXdr>::read_xdr(r)?;
35229            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
35230            let v = match dv {
35231                PaymentResultCode::Success => Self::Success,
35232                PaymentResultCode::Malformed => Self::Malformed,
35233                PaymentResultCode::Underfunded => Self::Underfunded,
35234                PaymentResultCode::SrcNoTrust => Self::SrcNoTrust,
35235                PaymentResultCode::SrcNotAuthorized => Self::SrcNotAuthorized,
35236                PaymentResultCode::NoDestination => Self::NoDestination,
35237                PaymentResultCode::NoTrust => Self::NoTrust,
35238                PaymentResultCode::NotAuthorized => Self::NotAuthorized,
35239                PaymentResultCode::LineFull => Self::LineFull,
35240                PaymentResultCode::NoIssuer => Self::NoIssuer,
35241                #[allow(unreachable_patterns)]
35242                _ => return Err(Error::Invalid),
35243            };
35244            Ok(v)
35245        })
35246    }
35247}
35248
35249impl WriteXdr for PaymentResult {
35250    #[cfg(feature = "std")]
35251    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
35252        w.with_limited_depth(|w| {
35253            self.discriminant().write_xdr(w)?;
35254            #[allow(clippy::match_same_arms)]
35255            match self {
35256                Self::Success => ().write_xdr(w)?,
35257                Self::Malformed => ().write_xdr(w)?,
35258                Self::Underfunded => ().write_xdr(w)?,
35259                Self::SrcNoTrust => ().write_xdr(w)?,
35260                Self::SrcNotAuthorized => ().write_xdr(w)?,
35261                Self::NoDestination => ().write_xdr(w)?,
35262                Self::NoTrust => ().write_xdr(w)?,
35263                Self::NotAuthorized => ().write_xdr(w)?,
35264                Self::LineFull => ().write_xdr(w)?,
35265                Self::NoIssuer => ().write_xdr(w)?,
35266            };
35267            Ok(())
35268        })
35269    }
35270}
35271
35272/// PathPaymentStrictReceiveResultCode is an XDR Enum defines as:
35273///
35274/// ```text
35275/// enum PathPaymentStrictReceiveResultCode
35276/// {
35277///     // codes considered as "success" for the operation
35278///     PATH_PAYMENT_STRICT_RECEIVE_SUCCESS = 0, // success
35279///
35280///     // codes considered as "failure" for the operation
35281///     PATH_PAYMENT_STRICT_RECEIVE_MALFORMED = -1, // bad input
35282///     PATH_PAYMENT_STRICT_RECEIVE_UNDERFUNDED =
35283///         -2, // not enough funds in source account
35284///     PATH_PAYMENT_STRICT_RECEIVE_SRC_NO_TRUST =
35285///         -3, // no trust line on source account
35286///     PATH_PAYMENT_STRICT_RECEIVE_SRC_NOT_AUTHORIZED =
35287///         -4, // source not authorized to transfer
35288///     PATH_PAYMENT_STRICT_RECEIVE_NO_DESTINATION =
35289///         -5, // destination account does not exist
35290///     PATH_PAYMENT_STRICT_RECEIVE_NO_TRUST =
35291///         -6, // dest missing a trust line for asset
35292///     PATH_PAYMENT_STRICT_RECEIVE_NOT_AUTHORIZED =
35293///         -7, // dest not authorized to hold asset
35294///     PATH_PAYMENT_STRICT_RECEIVE_LINE_FULL =
35295///         -8, // dest would go above their limit
35296///     PATH_PAYMENT_STRICT_RECEIVE_NO_ISSUER = -9, // missing issuer on one asset
35297///     PATH_PAYMENT_STRICT_RECEIVE_TOO_FEW_OFFERS =
35298///         -10, // not enough offers to satisfy path
35299///     PATH_PAYMENT_STRICT_RECEIVE_OFFER_CROSS_SELF =
35300///         -11, // would cross one of its own offers
35301///     PATH_PAYMENT_STRICT_RECEIVE_OVER_SENDMAX = -12 // could not satisfy sendmax
35302/// };
35303/// ```
35304///
35305// enum
35306#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
35307#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
35308#[cfg_attr(
35309    all(feature = "serde", feature = "alloc"),
35310    derive(serde::Serialize, serde::Deserialize),
35311    serde(rename_all = "snake_case")
35312)]
35313#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
35314#[repr(i32)]
35315pub enum PathPaymentStrictReceiveResultCode {
35316    Success = 0,
35317    Malformed = -1,
35318    Underfunded = -2,
35319    SrcNoTrust = -3,
35320    SrcNotAuthorized = -4,
35321    NoDestination = -5,
35322    NoTrust = -6,
35323    NotAuthorized = -7,
35324    LineFull = -8,
35325    NoIssuer = -9,
35326    TooFewOffers = -10,
35327    OfferCrossSelf = -11,
35328    OverSendmax = -12,
35329}
35330
35331impl PathPaymentStrictReceiveResultCode {
35332    pub const VARIANTS: [PathPaymentStrictReceiveResultCode; 13] = [
35333        PathPaymentStrictReceiveResultCode::Success,
35334        PathPaymentStrictReceiveResultCode::Malformed,
35335        PathPaymentStrictReceiveResultCode::Underfunded,
35336        PathPaymentStrictReceiveResultCode::SrcNoTrust,
35337        PathPaymentStrictReceiveResultCode::SrcNotAuthorized,
35338        PathPaymentStrictReceiveResultCode::NoDestination,
35339        PathPaymentStrictReceiveResultCode::NoTrust,
35340        PathPaymentStrictReceiveResultCode::NotAuthorized,
35341        PathPaymentStrictReceiveResultCode::LineFull,
35342        PathPaymentStrictReceiveResultCode::NoIssuer,
35343        PathPaymentStrictReceiveResultCode::TooFewOffers,
35344        PathPaymentStrictReceiveResultCode::OfferCrossSelf,
35345        PathPaymentStrictReceiveResultCode::OverSendmax,
35346    ];
35347    pub const VARIANTS_STR: [&'static str; 13] = [
35348        "Success",
35349        "Malformed",
35350        "Underfunded",
35351        "SrcNoTrust",
35352        "SrcNotAuthorized",
35353        "NoDestination",
35354        "NoTrust",
35355        "NotAuthorized",
35356        "LineFull",
35357        "NoIssuer",
35358        "TooFewOffers",
35359        "OfferCrossSelf",
35360        "OverSendmax",
35361    ];
35362
35363    #[must_use]
35364    pub const fn name(&self) -> &'static str {
35365        match self {
35366            Self::Success => "Success",
35367            Self::Malformed => "Malformed",
35368            Self::Underfunded => "Underfunded",
35369            Self::SrcNoTrust => "SrcNoTrust",
35370            Self::SrcNotAuthorized => "SrcNotAuthorized",
35371            Self::NoDestination => "NoDestination",
35372            Self::NoTrust => "NoTrust",
35373            Self::NotAuthorized => "NotAuthorized",
35374            Self::LineFull => "LineFull",
35375            Self::NoIssuer => "NoIssuer",
35376            Self::TooFewOffers => "TooFewOffers",
35377            Self::OfferCrossSelf => "OfferCrossSelf",
35378            Self::OverSendmax => "OverSendmax",
35379        }
35380    }
35381
35382    #[must_use]
35383    pub const fn variants() -> [PathPaymentStrictReceiveResultCode; 13] {
35384        Self::VARIANTS
35385    }
35386}
35387
35388impl Name for PathPaymentStrictReceiveResultCode {
35389    #[must_use]
35390    fn name(&self) -> &'static str {
35391        Self::name(self)
35392    }
35393}
35394
35395impl Variants<PathPaymentStrictReceiveResultCode> for PathPaymentStrictReceiveResultCode {
35396    fn variants() -> slice::Iter<'static, PathPaymentStrictReceiveResultCode> {
35397        Self::VARIANTS.iter()
35398    }
35399}
35400
35401impl Enum for PathPaymentStrictReceiveResultCode {}
35402
35403impl fmt::Display for PathPaymentStrictReceiveResultCode {
35404    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
35405        f.write_str(self.name())
35406    }
35407}
35408
35409impl TryFrom<i32> for PathPaymentStrictReceiveResultCode {
35410    type Error = Error;
35411
35412    fn try_from(i: i32) -> Result<Self> {
35413        let e = match i {
35414            0 => PathPaymentStrictReceiveResultCode::Success,
35415            -1 => PathPaymentStrictReceiveResultCode::Malformed,
35416            -2 => PathPaymentStrictReceiveResultCode::Underfunded,
35417            -3 => PathPaymentStrictReceiveResultCode::SrcNoTrust,
35418            -4 => PathPaymentStrictReceiveResultCode::SrcNotAuthorized,
35419            -5 => PathPaymentStrictReceiveResultCode::NoDestination,
35420            -6 => PathPaymentStrictReceiveResultCode::NoTrust,
35421            -7 => PathPaymentStrictReceiveResultCode::NotAuthorized,
35422            -8 => PathPaymentStrictReceiveResultCode::LineFull,
35423            -9 => PathPaymentStrictReceiveResultCode::NoIssuer,
35424            -10 => PathPaymentStrictReceiveResultCode::TooFewOffers,
35425            -11 => PathPaymentStrictReceiveResultCode::OfferCrossSelf,
35426            -12 => PathPaymentStrictReceiveResultCode::OverSendmax,
35427            #[allow(unreachable_patterns)]
35428            _ => return Err(Error::Invalid),
35429        };
35430        Ok(e)
35431    }
35432}
35433
35434impl From<PathPaymentStrictReceiveResultCode> for i32 {
35435    #[must_use]
35436    fn from(e: PathPaymentStrictReceiveResultCode) -> Self {
35437        e as Self
35438    }
35439}
35440
35441impl ReadXdr for PathPaymentStrictReceiveResultCode {
35442    #[cfg(feature = "std")]
35443    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
35444        r.with_limited_depth(|r| {
35445            let e = i32::read_xdr(r)?;
35446            let v: Self = e.try_into()?;
35447            Ok(v)
35448        })
35449    }
35450}
35451
35452impl WriteXdr for PathPaymentStrictReceiveResultCode {
35453    #[cfg(feature = "std")]
35454    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
35455        w.with_limited_depth(|w| {
35456            let i: i32 = (*self).into();
35457            i.write_xdr(w)
35458        })
35459    }
35460}
35461
35462/// SimplePaymentResult is an XDR Struct defines as:
35463///
35464/// ```text
35465/// struct SimplePaymentResult
35466/// {
35467///     AccountID destination;
35468///     Asset asset;
35469///     int64 amount;
35470/// };
35471/// ```
35472///
35473#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
35474#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
35475#[cfg_attr(
35476    all(feature = "serde", feature = "alloc"),
35477    derive(serde::Serialize, serde::Deserialize),
35478    serde(rename_all = "snake_case")
35479)]
35480#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
35481pub struct SimplePaymentResult {
35482    pub destination: AccountId,
35483    pub asset: Asset,
35484    pub amount: i64,
35485}
35486
35487impl ReadXdr for SimplePaymentResult {
35488    #[cfg(feature = "std")]
35489    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
35490        r.with_limited_depth(|r| {
35491            Ok(Self {
35492                destination: AccountId::read_xdr(r)?,
35493                asset: Asset::read_xdr(r)?,
35494                amount: i64::read_xdr(r)?,
35495            })
35496        })
35497    }
35498}
35499
35500impl WriteXdr for SimplePaymentResult {
35501    #[cfg(feature = "std")]
35502    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
35503        w.with_limited_depth(|w| {
35504            self.destination.write_xdr(w)?;
35505            self.asset.write_xdr(w)?;
35506            self.amount.write_xdr(w)?;
35507            Ok(())
35508        })
35509    }
35510}
35511
35512/// PathPaymentStrictReceiveResultSuccess is an XDR NestedStruct defines as:
35513///
35514/// ```text
35515/// struct
35516///     {
35517///         ClaimAtom offers<>;
35518///         SimplePaymentResult last;
35519///     }
35520/// ```
35521///
35522#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
35523#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
35524#[cfg_attr(
35525    all(feature = "serde", feature = "alloc"),
35526    derive(serde::Serialize, serde::Deserialize),
35527    serde(rename_all = "snake_case")
35528)]
35529#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
35530pub struct PathPaymentStrictReceiveResultSuccess {
35531    pub offers: VecM<ClaimAtom>,
35532    pub last: SimplePaymentResult,
35533}
35534
35535impl ReadXdr for PathPaymentStrictReceiveResultSuccess {
35536    #[cfg(feature = "std")]
35537    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
35538        r.with_limited_depth(|r| {
35539            Ok(Self {
35540                offers: VecM::<ClaimAtom>::read_xdr(r)?,
35541                last: SimplePaymentResult::read_xdr(r)?,
35542            })
35543        })
35544    }
35545}
35546
35547impl WriteXdr for PathPaymentStrictReceiveResultSuccess {
35548    #[cfg(feature = "std")]
35549    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
35550        w.with_limited_depth(|w| {
35551            self.offers.write_xdr(w)?;
35552            self.last.write_xdr(w)?;
35553            Ok(())
35554        })
35555    }
35556}
35557
35558/// PathPaymentStrictReceiveResult is an XDR Union defines as:
35559///
35560/// ```text
35561/// union PathPaymentStrictReceiveResult switch (
35562///     PathPaymentStrictReceiveResultCode code)
35563/// {
35564/// case PATH_PAYMENT_STRICT_RECEIVE_SUCCESS:
35565///     struct
35566///     {
35567///         ClaimAtom offers<>;
35568///         SimplePaymentResult last;
35569///     } success;
35570/// case PATH_PAYMENT_STRICT_RECEIVE_MALFORMED:
35571/// case PATH_PAYMENT_STRICT_RECEIVE_UNDERFUNDED:
35572/// case PATH_PAYMENT_STRICT_RECEIVE_SRC_NO_TRUST:
35573/// case PATH_PAYMENT_STRICT_RECEIVE_SRC_NOT_AUTHORIZED:
35574/// case PATH_PAYMENT_STRICT_RECEIVE_NO_DESTINATION:
35575/// case PATH_PAYMENT_STRICT_RECEIVE_NO_TRUST:
35576/// case PATH_PAYMENT_STRICT_RECEIVE_NOT_AUTHORIZED:
35577/// case PATH_PAYMENT_STRICT_RECEIVE_LINE_FULL:
35578///     void;
35579/// case PATH_PAYMENT_STRICT_RECEIVE_NO_ISSUER:
35580///     Asset noIssuer; // the asset that caused the error
35581/// case PATH_PAYMENT_STRICT_RECEIVE_TOO_FEW_OFFERS:
35582/// case PATH_PAYMENT_STRICT_RECEIVE_OFFER_CROSS_SELF:
35583/// case PATH_PAYMENT_STRICT_RECEIVE_OVER_SENDMAX:
35584///     void;
35585/// };
35586/// ```
35587///
35588// union with discriminant PathPaymentStrictReceiveResultCode
35589#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
35590#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
35591#[cfg_attr(
35592    all(feature = "serde", feature = "alloc"),
35593    derive(serde::Serialize, serde::Deserialize),
35594    serde(rename_all = "snake_case")
35595)]
35596#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
35597#[allow(clippy::large_enum_variant)]
35598pub enum PathPaymentStrictReceiveResult {
35599    Success(PathPaymentStrictReceiveResultSuccess),
35600    Malformed,
35601    Underfunded,
35602    SrcNoTrust,
35603    SrcNotAuthorized,
35604    NoDestination,
35605    NoTrust,
35606    NotAuthorized,
35607    LineFull,
35608    NoIssuer(Asset),
35609    TooFewOffers,
35610    OfferCrossSelf,
35611    OverSendmax,
35612}
35613
35614impl PathPaymentStrictReceiveResult {
35615    pub const VARIANTS: [PathPaymentStrictReceiveResultCode; 13] = [
35616        PathPaymentStrictReceiveResultCode::Success,
35617        PathPaymentStrictReceiveResultCode::Malformed,
35618        PathPaymentStrictReceiveResultCode::Underfunded,
35619        PathPaymentStrictReceiveResultCode::SrcNoTrust,
35620        PathPaymentStrictReceiveResultCode::SrcNotAuthorized,
35621        PathPaymentStrictReceiveResultCode::NoDestination,
35622        PathPaymentStrictReceiveResultCode::NoTrust,
35623        PathPaymentStrictReceiveResultCode::NotAuthorized,
35624        PathPaymentStrictReceiveResultCode::LineFull,
35625        PathPaymentStrictReceiveResultCode::NoIssuer,
35626        PathPaymentStrictReceiveResultCode::TooFewOffers,
35627        PathPaymentStrictReceiveResultCode::OfferCrossSelf,
35628        PathPaymentStrictReceiveResultCode::OverSendmax,
35629    ];
35630    pub const VARIANTS_STR: [&'static str; 13] = [
35631        "Success",
35632        "Malformed",
35633        "Underfunded",
35634        "SrcNoTrust",
35635        "SrcNotAuthorized",
35636        "NoDestination",
35637        "NoTrust",
35638        "NotAuthorized",
35639        "LineFull",
35640        "NoIssuer",
35641        "TooFewOffers",
35642        "OfferCrossSelf",
35643        "OverSendmax",
35644    ];
35645
35646    #[must_use]
35647    pub const fn name(&self) -> &'static str {
35648        match self {
35649            Self::Success(_) => "Success",
35650            Self::Malformed => "Malformed",
35651            Self::Underfunded => "Underfunded",
35652            Self::SrcNoTrust => "SrcNoTrust",
35653            Self::SrcNotAuthorized => "SrcNotAuthorized",
35654            Self::NoDestination => "NoDestination",
35655            Self::NoTrust => "NoTrust",
35656            Self::NotAuthorized => "NotAuthorized",
35657            Self::LineFull => "LineFull",
35658            Self::NoIssuer(_) => "NoIssuer",
35659            Self::TooFewOffers => "TooFewOffers",
35660            Self::OfferCrossSelf => "OfferCrossSelf",
35661            Self::OverSendmax => "OverSendmax",
35662        }
35663    }
35664
35665    #[must_use]
35666    pub const fn discriminant(&self) -> PathPaymentStrictReceiveResultCode {
35667        #[allow(clippy::match_same_arms)]
35668        match self {
35669            Self::Success(_) => PathPaymentStrictReceiveResultCode::Success,
35670            Self::Malformed => PathPaymentStrictReceiveResultCode::Malformed,
35671            Self::Underfunded => PathPaymentStrictReceiveResultCode::Underfunded,
35672            Self::SrcNoTrust => PathPaymentStrictReceiveResultCode::SrcNoTrust,
35673            Self::SrcNotAuthorized => PathPaymentStrictReceiveResultCode::SrcNotAuthorized,
35674            Self::NoDestination => PathPaymentStrictReceiveResultCode::NoDestination,
35675            Self::NoTrust => PathPaymentStrictReceiveResultCode::NoTrust,
35676            Self::NotAuthorized => PathPaymentStrictReceiveResultCode::NotAuthorized,
35677            Self::LineFull => PathPaymentStrictReceiveResultCode::LineFull,
35678            Self::NoIssuer(_) => PathPaymentStrictReceiveResultCode::NoIssuer,
35679            Self::TooFewOffers => PathPaymentStrictReceiveResultCode::TooFewOffers,
35680            Self::OfferCrossSelf => PathPaymentStrictReceiveResultCode::OfferCrossSelf,
35681            Self::OverSendmax => PathPaymentStrictReceiveResultCode::OverSendmax,
35682        }
35683    }
35684
35685    #[must_use]
35686    pub const fn variants() -> [PathPaymentStrictReceiveResultCode; 13] {
35687        Self::VARIANTS
35688    }
35689}
35690
35691impl Name for PathPaymentStrictReceiveResult {
35692    #[must_use]
35693    fn name(&self) -> &'static str {
35694        Self::name(self)
35695    }
35696}
35697
35698impl Discriminant<PathPaymentStrictReceiveResultCode> for PathPaymentStrictReceiveResult {
35699    #[must_use]
35700    fn discriminant(&self) -> PathPaymentStrictReceiveResultCode {
35701        Self::discriminant(self)
35702    }
35703}
35704
35705impl Variants<PathPaymentStrictReceiveResultCode> for PathPaymentStrictReceiveResult {
35706    fn variants() -> slice::Iter<'static, PathPaymentStrictReceiveResultCode> {
35707        Self::VARIANTS.iter()
35708    }
35709}
35710
35711impl Union<PathPaymentStrictReceiveResultCode> for PathPaymentStrictReceiveResult {}
35712
35713impl ReadXdr for PathPaymentStrictReceiveResult {
35714    #[cfg(feature = "std")]
35715    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
35716        r.with_limited_depth(|r| {
35717            let dv: PathPaymentStrictReceiveResultCode =
35718                <PathPaymentStrictReceiveResultCode as ReadXdr>::read_xdr(r)?;
35719            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
35720            let v = match dv {
35721                PathPaymentStrictReceiveResultCode::Success => {
35722                    Self::Success(PathPaymentStrictReceiveResultSuccess::read_xdr(r)?)
35723                }
35724                PathPaymentStrictReceiveResultCode::Malformed => Self::Malformed,
35725                PathPaymentStrictReceiveResultCode::Underfunded => Self::Underfunded,
35726                PathPaymentStrictReceiveResultCode::SrcNoTrust => Self::SrcNoTrust,
35727                PathPaymentStrictReceiveResultCode::SrcNotAuthorized => Self::SrcNotAuthorized,
35728                PathPaymentStrictReceiveResultCode::NoDestination => Self::NoDestination,
35729                PathPaymentStrictReceiveResultCode::NoTrust => Self::NoTrust,
35730                PathPaymentStrictReceiveResultCode::NotAuthorized => Self::NotAuthorized,
35731                PathPaymentStrictReceiveResultCode::LineFull => Self::LineFull,
35732                PathPaymentStrictReceiveResultCode::NoIssuer => Self::NoIssuer(Asset::read_xdr(r)?),
35733                PathPaymentStrictReceiveResultCode::TooFewOffers => Self::TooFewOffers,
35734                PathPaymentStrictReceiveResultCode::OfferCrossSelf => Self::OfferCrossSelf,
35735                PathPaymentStrictReceiveResultCode::OverSendmax => Self::OverSendmax,
35736                #[allow(unreachable_patterns)]
35737                _ => return Err(Error::Invalid),
35738            };
35739            Ok(v)
35740        })
35741    }
35742}
35743
35744impl WriteXdr for PathPaymentStrictReceiveResult {
35745    #[cfg(feature = "std")]
35746    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
35747        w.with_limited_depth(|w| {
35748            self.discriminant().write_xdr(w)?;
35749            #[allow(clippy::match_same_arms)]
35750            match self {
35751                Self::Success(v) => v.write_xdr(w)?,
35752                Self::Malformed => ().write_xdr(w)?,
35753                Self::Underfunded => ().write_xdr(w)?,
35754                Self::SrcNoTrust => ().write_xdr(w)?,
35755                Self::SrcNotAuthorized => ().write_xdr(w)?,
35756                Self::NoDestination => ().write_xdr(w)?,
35757                Self::NoTrust => ().write_xdr(w)?,
35758                Self::NotAuthorized => ().write_xdr(w)?,
35759                Self::LineFull => ().write_xdr(w)?,
35760                Self::NoIssuer(v) => v.write_xdr(w)?,
35761                Self::TooFewOffers => ().write_xdr(w)?,
35762                Self::OfferCrossSelf => ().write_xdr(w)?,
35763                Self::OverSendmax => ().write_xdr(w)?,
35764            };
35765            Ok(())
35766        })
35767    }
35768}
35769
35770/// PathPaymentStrictSendResultCode is an XDR Enum defines as:
35771///
35772/// ```text
35773/// enum PathPaymentStrictSendResultCode
35774/// {
35775///     // codes considered as "success" for the operation
35776///     PATH_PAYMENT_STRICT_SEND_SUCCESS = 0, // success
35777///
35778///     // codes considered as "failure" for the operation
35779///     PATH_PAYMENT_STRICT_SEND_MALFORMED = -1, // bad input
35780///     PATH_PAYMENT_STRICT_SEND_UNDERFUNDED =
35781///         -2, // not enough funds in source account
35782///     PATH_PAYMENT_STRICT_SEND_SRC_NO_TRUST =
35783///         -3, // no trust line on source account
35784///     PATH_PAYMENT_STRICT_SEND_SRC_NOT_AUTHORIZED =
35785///         -4, // source not authorized to transfer
35786///     PATH_PAYMENT_STRICT_SEND_NO_DESTINATION =
35787///         -5, // destination account does not exist
35788///     PATH_PAYMENT_STRICT_SEND_NO_TRUST =
35789///         -6, // dest missing a trust line for asset
35790///     PATH_PAYMENT_STRICT_SEND_NOT_AUTHORIZED =
35791///         -7, // dest not authorized to hold asset
35792///     PATH_PAYMENT_STRICT_SEND_LINE_FULL = -8, // dest would go above their limit
35793///     PATH_PAYMENT_STRICT_SEND_NO_ISSUER = -9, // missing issuer on one asset
35794///     PATH_PAYMENT_STRICT_SEND_TOO_FEW_OFFERS =
35795///         -10, // not enough offers to satisfy path
35796///     PATH_PAYMENT_STRICT_SEND_OFFER_CROSS_SELF =
35797///         -11, // would cross one of its own offers
35798///     PATH_PAYMENT_STRICT_SEND_UNDER_DESTMIN = -12 // could not satisfy destMin
35799/// };
35800/// ```
35801///
35802// enum
35803#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
35804#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
35805#[cfg_attr(
35806    all(feature = "serde", feature = "alloc"),
35807    derive(serde::Serialize, serde::Deserialize),
35808    serde(rename_all = "snake_case")
35809)]
35810#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
35811#[repr(i32)]
35812pub enum PathPaymentStrictSendResultCode {
35813    Success = 0,
35814    Malformed = -1,
35815    Underfunded = -2,
35816    SrcNoTrust = -3,
35817    SrcNotAuthorized = -4,
35818    NoDestination = -5,
35819    NoTrust = -6,
35820    NotAuthorized = -7,
35821    LineFull = -8,
35822    NoIssuer = -9,
35823    TooFewOffers = -10,
35824    OfferCrossSelf = -11,
35825    UnderDestmin = -12,
35826}
35827
35828impl PathPaymentStrictSendResultCode {
35829    pub const VARIANTS: [PathPaymentStrictSendResultCode; 13] = [
35830        PathPaymentStrictSendResultCode::Success,
35831        PathPaymentStrictSendResultCode::Malformed,
35832        PathPaymentStrictSendResultCode::Underfunded,
35833        PathPaymentStrictSendResultCode::SrcNoTrust,
35834        PathPaymentStrictSendResultCode::SrcNotAuthorized,
35835        PathPaymentStrictSendResultCode::NoDestination,
35836        PathPaymentStrictSendResultCode::NoTrust,
35837        PathPaymentStrictSendResultCode::NotAuthorized,
35838        PathPaymentStrictSendResultCode::LineFull,
35839        PathPaymentStrictSendResultCode::NoIssuer,
35840        PathPaymentStrictSendResultCode::TooFewOffers,
35841        PathPaymentStrictSendResultCode::OfferCrossSelf,
35842        PathPaymentStrictSendResultCode::UnderDestmin,
35843    ];
35844    pub const VARIANTS_STR: [&'static str; 13] = [
35845        "Success",
35846        "Malformed",
35847        "Underfunded",
35848        "SrcNoTrust",
35849        "SrcNotAuthorized",
35850        "NoDestination",
35851        "NoTrust",
35852        "NotAuthorized",
35853        "LineFull",
35854        "NoIssuer",
35855        "TooFewOffers",
35856        "OfferCrossSelf",
35857        "UnderDestmin",
35858    ];
35859
35860    #[must_use]
35861    pub const fn name(&self) -> &'static str {
35862        match self {
35863            Self::Success => "Success",
35864            Self::Malformed => "Malformed",
35865            Self::Underfunded => "Underfunded",
35866            Self::SrcNoTrust => "SrcNoTrust",
35867            Self::SrcNotAuthorized => "SrcNotAuthorized",
35868            Self::NoDestination => "NoDestination",
35869            Self::NoTrust => "NoTrust",
35870            Self::NotAuthorized => "NotAuthorized",
35871            Self::LineFull => "LineFull",
35872            Self::NoIssuer => "NoIssuer",
35873            Self::TooFewOffers => "TooFewOffers",
35874            Self::OfferCrossSelf => "OfferCrossSelf",
35875            Self::UnderDestmin => "UnderDestmin",
35876        }
35877    }
35878
35879    #[must_use]
35880    pub const fn variants() -> [PathPaymentStrictSendResultCode; 13] {
35881        Self::VARIANTS
35882    }
35883}
35884
35885impl Name for PathPaymentStrictSendResultCode {
35886    #[must_use]
35887    fn name(&self) -> &'static str {
35888        Self::name(self)
35889    }
35890}
35891
35892impl Variants<PathPaymentStrictSendResultCode> for PathPaymentStrictSendResultCode {
35893    fn variants() -> slice::Iter<'static, PathPaymentStrictSendResultCode> {
35894        Self::VARIANTS.iter()
35895    }
35896}
35897
35898impl Enum for PathPaymentStrictSendResultCode {}
35899
35900impl fmt::Display for PathPaymentStrictSendResultCode {
35901    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
35902        f.write_str(self.name())
35903    }
35904}
35905
35906impl TryFrom<i32> for PathPaymentStrictSendResultCode {
35907    type Error = Error;
35908
35909    fn try_from(i: i32) -> Result<Self> {
35910        let e = match i {
35911            0 => PathPaymentStrictSendResultCode::Success,
35912            -1 => PathPaymentStrictSendResultCode::Malformed,
35913            -2 => PathPaymentStrictSendResultCode::Underfunded,
35914            -3 => PathPaymentStrictSendResultCode::SrcNoTrust,
35915            -4 => PathPaymentStrictSendResultCode::SrcNotAuthorized,
35916            -5 => PathPaymentStrictSendResultCode::NoDestination,
35917            -6 => PathPaymentStrictSendResultCode::NoTrust,
35918            -7 => PathPaymentStrictSendResultCode::NotAuthorized,
35919            -8 => PathPaymentStrictSendResultCode::LineFull,
35920            -9 => PathPaymentStrictSendResultCode::NoIssuer,
35921            -10 => PathPaymentStrictSendResultCode::TooFewOffers,
35922            -11 => PathPaymentStrictSendResultCode::OfferCrossSelf,
35923            -12 => PathPaymentStrictSendResultCode::UnderDestmin,
35924            #[allow(unreachable_patterns)]
35925            _ => return Err(Error::Invalid),
35926        };
35927        Ok(e)
35928    }
35929}
35930
35931impl From<PathPaymentStrictSendResultCode> for i32 {
35932    #[must_use]
35933    fn from(e: PathPaymentStrictSendResultCode) -> Self {
35934        e as Self
35935    }
35936}
35937
35938impl ReadXdr for PathPaymentStrictSendResultCode {
35939    #[cfg(feature = "std")]
35940    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
35941        r.with_limited_depth(|r| {
35942            let e = i32::read_xdr(r)?;
35943            let v: Self = e.try_into()?;
35944            Ok(v)
35945        })
35946    }
35947}
35948
35949impl WriteXdr for PathPaymentStrictSendResultCode {
35950    #[cfg(feature = "std")]
35951    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
35952        w.with_limited_depth(|w| {
35953            let i: i32 = (*self).into();
35954            i.write_xdr(w)
35955        })
35956    }
35957}
35958
35959/// PathPaymentStrictSendResultSuccess is an XDR NestedStruct defines as:
35960///
35961/// ```text
35962/// struct
35963///     {
35964///         ClaimAtom offers<>;
35965///         SimplePaymentResult last;
35966///     }
35967/// ```
35968///
35969#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
35970#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
35971#[cfg_attr(
35972    all(feature = "serde", feature = "alloc"),
35973    derive(serde::Serialize, serde::Deserialize),
35974    serde(rename_all = "snake_case")
35975)]
35976#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
35977pub struct PathPaymentStrictSendResultSuccess {
35978    pub offers: VecM<ClaimAtom>,
35979    pub last: SimplePaymentResult,
35980}
35981
35982impl ReadXdr for PathPaymentStrictSendResultSuccess {
35983    #[cfg(feature = "std")]
35984    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
35985        r.with_limited_depth(|r| {
35986            Ok(Self {
35987                offers: VecM::<ClaimAtom>::read_xdr(r)?,
35988                last: SimplePaymentResult::read_xdr(r)?,
35989            })
35990        })
35991    }
35992}
35993
35994impl WriteXdr for PathPaymentStrictSendResultSuccess {
35995    #[cfg(feature = "std")]
35996    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
35997        w.with_limited_depth(|w| {
35998            self.offers.write_xdr(w)?;
35999            self.last.write_xdr(w)?;
36000            Ok(())
36001        })
36002    }
36003}
36004
36005/// PathPaymentStrictSendResult is an XDR Union defines as:
36006///
36007/// ```text
36008/// union PathPaymentStrictSendResult switch (PathPaymentStrictSendResultCode code)
36009/// {
36010/// case PATH_PAYMENT_STRICT_SEND_SUCCESS:
36011///     struct
36012///     {
36013///         ClaimAtom offers<>;
36014///         SimplePaymentResult last;
36015///     } success;
36016/// case PATH_PAYMENT_STRICT_SEND_MALFORMED:
36017/// case PATH_PAYMENT_STRICT_SEND_UNDERFUNDED:
36018/// case PATH_PAYMENT_STRICT_SEND_SRC_NO_TRUST:
36019/// case PATH_PAYMENT_STRICT_SEND_SRC_NOT_AUTHORIZED:
36020/// case PATH_PAYMENT_STRICT_SEND_NO_DESTINATION:
36021/// case PATH_PAYMENT_STRICT_SEND_NO_TRUST:
36022/// case PATH_PAYMENT_STRICT_SEND_NOT_AUTHORIZED:
36023/// case PATH_PAYMENT_STRICT_SEND_LINE_FULL:
36024///     void;
36025/// case PATH_PAYMENT_STRICT_SEND_NO_ISSUER:
36026///     Asset noIssuer; // the asset that caused the error
36027/// case PATH_PAYMENT_STRICT_SEND_TOO_FEW_OFFERS:
36028/// case PATH_PAYMENT_STRICT_SEND_OFFER_CROSS_SELF:
36029/// case PATH_PAYMENT_STRICT_SEND_UNDER_DESTMIN:
36030///     void;
36031/// };
36032/// ```
36033///
36034// union with discriminant PathPaymentStrictSendResultCode
36035#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
36036#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
36037#[cfg_attr(
36038    all(feature = "serde", feature = "alloc"),
36039    derive(serde::Serialize, serde::Deserialize),
36040    serde(rename_all = "snake_case")
36041)]
36042#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
36043#[allow(clippy::large_enum_variant)]
36044pub enum PathPaymentStrictSendResult {
36045    Success(PathPaymentStrictSendResultSuccess),
36046    Malformed,
36047    Underfunded,
36048    SrcNoTrust,
36049    SrcNotAuthorized,
36050    NoDestination,
36051    NoTrust,
36052    NotAuthorized,
36053    LineFull,
36054    NoIssuer(Asset),
36055    TooFewOffers,
36056    OfferCrossSelf,
36057    UnderDestmin,
36058}
36059
36060impl PathPaymentStrictSendResult {
36061    pub const VARIANTS: [PathPaymentStrictSendResultCode; 13] = [
36062        PathPaymentStrictSendResultCode::Success,
36063        PathPaymentStrictSendResultCode::Malformed,
36064        PathPaymentStrictSendResultCode::Underfunded,
36065        PathPaymentStrictSendResultCode::SrcNoTrust,
36066        PathPaymentStrictSendResultCode::SrcNotAuthorized,
36067        PathPaymentStrictSendResultCode::NoDestination,
36068        PathPaymentStrictSendResultCode::NoTrust,
36069        PathPaymentStrictSendResultCode::NotAuthorized,
36070        PathPaymentStrictSendResultCode::LineFull,
36071        PathPaymentStrictSendResultCode::NoIssuer,
36072        PathPaymentStrictSendResultCode::TooFewOffers,
36073        PathPaymentStrictSendResultCode::OfferCrossSelf,
36074        PathPaymentStrictSendResultCode::UnderDestmin,
36075    ];
36076    pub const VARIANTS_STR: [&'static str; 13] = [
36077        "Success",
36078        "Malformed",
36079        "Underfunded",
36080        "SrcNoTrust",
36081        "SrcNotAuthorized",
36082        "NoDestination",
36083        "NoTrust",
36084        "NotAuthorized",
36085        "LineFull",
36086        "NoIssuer",
36087        "TooFewOffers",
36088        "OfferCrossSelf",
36089        "UnderDestmin",
36090    ];
36091
36092    #[must_use]
36093    pub const fn name(&self) -> &'static str {
36094        match self {
36095            Self::Success(_) => "Success",
36096            Self::Malformed => "Malformed",
36097            Self::Underfunded => "Underfunded",
36098            Self::SrcNoTrust => "SrcNoTrust",
36099            Self::SrcNotAuthorized => "SrcNotAuthorized",
36100            Self::NoDestination => "NoDestination",
36101            Self::NoTrust => "NoTrust",
36102            Self::NotAuthorized => "NotAuthorized",
36103            Self::LineFull => "LineFull",
36104            Self::NoIssuer(_) => "NoIssuer",
36105            Self::TooFewOffers => "TooFewOffers",
36106            Self::OfferCrossSelf => "OfferCrossSelf",
36107            Self::UnderDestmin => "UnderDestmin",
36108        }
36109    }
36110
36111    #[must_use]
36112    pub const fn discriminant(&self) -> PathPaymentStrictSendResultCode {
36113        #[allow(clippy::match_same_arms)]
36114        match self {
36115            Self::Success(_) => PathPaymentStrictSendResultCode::Success,
36116            Self::Malformed => PathPaymentStrictSendResultCode::Malformed,
36117            Self::Underfunded => PathPaymentStrictSendResultCode::Underfunded,
36118            Self::SrcNoTrust => PathPaymentStrictSendResultCode::SrcNoTrust,
36119            Self::SrcNotAuthorized => PathPaymentStrictSendResultCode::SrcNotAuthorized,
36120            Self::NoDestination => PathPaymentStrictSendResultCode::NoDestination,
36121            Self::NoTrust => PathPaymentStrictSendResultCode::NoTrust,
36122            Self::NotAuthorized => PathPaymentStrictSendResultCode::NotAuthorized,
36123            Self::LineFull => PathPaymentStrictSendResultCode::LineFull,
36124            Self::NoIssuer(_) => PathPaymentStrictSendResultCode::NoIssuer,
36125            Self::TooFewOffers => PathPaymentStrictSendResultCode::TooFewOffers,
36126            Self::OfferCrossSelf => PathPaymentStrictSendResultCode::OfferCrossSelf,
36127            Self::UnderDestmin => PathPaymentStrictSendResultCode::UnderDestmin,
36128        }
36129    }
36130
36131    #[must_use]
36132    pub const fn variants() -> [PathPaymentStrictSendResultCode; 13] {
36133        Self::VARIANTS
36134    }
36135}
36136
36137impl Name for PathPaymentStrictSendResult {
36138    #[must_use]
36139    fn name(&self) -> &'static str {
36140        Self::name(self)
36141    }
36142}
36143
36144impl Discriminant<PathPaymentStrictSendResultCode> for PathPaymentStrictSendResult {
36145    #[must_use]
36146    fn discriminant(&self) -> PathPaymentStrictSendResultCode {
36147        Self::discriminant(self)
36148    }
36149}
36150
36151impl Variants<PathPaymentStrictSendResultCode> for PathPaymentStrictSendResult {
36152    fn variants() -> slice::Iter<'static, PathPaymentStrictSendResultCode> {
36153        Self::VARIANTS.iter()
36154    }
36155}
36156
36157impl Union<PathPaymentStrictSendResultCode> for PathPaymentStrictSendResult {}
36158
36159impl ReadXdr for PathPaymentStrictSendResult {
36160    #[cfg(feature = "std")]
36161    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
36162        r.with_limited_depth(|r| {
36163            let dv: PathPaymentStrictSendResultCode =
36164                <PathPaymentStrictSendResultCode as ReadXdr>::read_xdr(r)?;
36165            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
36166            let v = match dv {
36167                PathPaymentStrictSendResultCode::Success => {
36168                    Self::Success(PathPaymentStrictSendResultSuccess::read_xdr(r)?)
36169                }
36170                PathPaymentStrictSendResultCode::Malformed => Self::Malformed,
36171                PathPaymentStrictSendResultCode::Underfunded => Self::Underfunded,
36172                PathPaymentStrictSendResultCode::SrcNoTrust => Self::SrcNoTrust,
36173                PathPaymentStrictSendResultCode::SrcNotAuthorized => Self::SrcNotAuthorized,
36174                PathPaymentStrictSendResultCode::NoDestination => Self::NoDestination,
36175                PathPaymentStrictSendResultCode::NoTrust => Self::NoTrust,
36176                PathPaymentStrictSendResultCode::NotAuthorized => Self::NotAuthorized,
36177                PathPaymentStrictSendResultCode::LineFull => Self::LineFull,
36178                PathPaymentStrictSendResultCode::NoIssuer => Self::NoIssuer(Asset::read_xdr(r)?),
36179                PathPaymentStrictSendResultCode::TooFewOffers => Self::TooFewOffers,
36180                PathPaymentStrictSendResultCode::OfferCrossSelf => Self::OfferCrossSelf,
36181                PathPaymentStrictSendResultCode::UnderDestmin => Self::UnderDestmin,
36182                #[allow(unreachable_patterns)]
36183                _ => return Err(Error::Invalid),
36184            };
36185            Ok(v)
36186        })
36187    }
36188}
36189
36190impl WriteXdr for PathPaymentStrictSendResult {
36191    #[cfg(feature = "std")]
36192    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
36193        w.with_limited_depth(|w| {
36194            self.discriminant().write_xdr(w)?;
36195            #[allow(clippy::match_same_arms)]
36196            match self {
36197                Self::Success(v) => v.write_xdr(w)?,
36198                Self::Malformed => ().write_xdr(w)?,
36199                Self::Underfunded => ().write_xdr(w)?,
36200                Self::SrcNoTrust => ().write_xdr(w)?,
36201                Self::SrcNotAuthorized => ().write_xdr(w)?,
36202                Self::NoDestination => ().write_xdr(w)?,
36203                Self::NoTrust => ().write_xdr(w)?,
36204                Self::NotAuthorized => ().write_xdr(w)?,
36205                Self::LineFull => ().write_xdr(w)?,
36206                Self::NoIssuer(v) => v.write_xdr(w)?,
36207                Self::TooFewOffers => ().write_xdr(w)?,
36208                Self::OfferCrossSelf => ().write_xdr(w)?,
36209                Self::UnderDestmin => ().write_xdr(w)?,
36210            };
36211            Ok(())
36212        })
36213    }
36214}
36215
36216/// ManageSellOfferResultCode is an XDR Enum defines as:
36217///
36218/// ```text
36219/// enum ManageSellOfferResultCode
36220/// {
36221///     // codes considered as "success" for the operation
36222///     MANAGE_SELL_OFFER_SUCCESS = 0,
36223///
36224///     // codes considered as "failure" for the operation
36225///     MANAGE_SELL_OFFER_MALFORMED = -1, // generated offer would be invalid
36226///     MANAGE_SELL_OFFER_SELL_NO_TRUST =
36227///         -2,                              // no trust line for what we're selling
36228///     MANAGE_SELL_OFFER_BUY_NO_TRUST = -3, // no trust line for what we're buying
36229///     MANAGE_SELL_OFFER_SELL_NOT_AUTHORIZED = -4, // not authorized to sell
36230///     MANAGE_SELL_OFFER_BUY_NOT_AUTHORIZED = -5,  // not authorized to buy
36231///     MANAGE_SELL_OFFER_LINE_FULL = -6, // can't receive more of what it's buying
36232///     MANAGE_SELL_OFFER_UNDERFUNDED = -7, // doesn't hold what it's trying to sell
36233///     MANAGE_SELL_OFFER_CROSS_SELF =
36234///         -8, // would cross an offer from the same user
36235///     MANAGE_SELL_OFFER_SELL_NO_ISSUER = -9, // no issuer for what we're selling
36236///     MANAGE_SELL_OFFER_BUY_NO_ISSUER = -10, // no issuer for what we're buying
36237///
36238///     // update errors
36239///     MANAGE_SELL_OFFER_NOT_FOUND =
36240///         -11, // offerID does not match an existing offer
36241///
36242///     MANAGE_SELL_OFFER_LOW_RESERVE =
36243///         -12 // not enough funds to create a new Offer
36244/// };
36245/// ```
36246///
36247// enum
36248#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
36249#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
36250#[cfg_attr(
36251    all(feature = "serde", feature = "alloc"),
36252    derive(serde::Serialize, serde::Deserialize),
36253    serde(rename_all = "snake_case")
36254)]
36255#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
36256#[repr(i32)]
36257pub enum ManageSellOfferResultCode {
36258    Success = 0,
36259    Malformed = -1,
36260    SellNoTrust = -2,
36261    BuyNoTrust = -3,
36262    SellNotAuthorized = -4,
36263    BuyNotAuthorized = -5,
36264    LineFull = -6,
36265    Underfunded = -7,
36266    CrossSelf = -8,
36267    SellNoIssuer = -9,
36268    BuyNoIssuer = -10,
36269    NotFound = -11,
36270    LowReserve = -12,
36271}
36272
36273impl ManageSellOfferResultCode {
36274    pub const VARIANTS: [ManageSellOfferResultCode; 13] = [
36275        ManageSellOfferResultCode::Success,
36276        ManageSellOfferResultCode::Malformed,
36277        ManageSellOfferResultCode::SellNoTrust,
36278        ManageSellOfferResultCode::BuyNoTrust,
36279        ManageSellOfferResultCode::SellNotAuthorized,
36280        ManageSellOfferResultCode::BuyNotAuthorized,
36281        ManageSellOfferResultCode::LineFull,
36282        ManageSellOfferResultCode::Underfunded,
36283        ManageSellOfferResultCode::CrossSelf,
36284        ManageSellOfferResultCode::SellNoIssuer,
36285        ManageSellOfferResultCode::BuyNoIssuer,
36286        ManageSellOfferResultCode::NotFound,
36287        ManageSellOfferResultCode::LowReserve,
36288    ];
36289    pub const VARIANTS_STR: [&'static str; 13] = [
36290        "Success",
36291        "Malformed",
36292        "SellNoTrust",
36293        "BuyNoTrust",
36294        "SellNotAuthorized",
36295        "BuyNotAuthorized",
36296        "LineFull",
36297        "Underfunded",
36298        "CrossSelf",
36299        "SellNoIssuer",
36300        "BuyNoIssuer",
36301        "NotFound",
36302        "LowReserve",
36303    ];
36304
36305    #[must_use]
36306    pub const fn name(&self) -> &'static str {
36307        match self {
36308            Self::Success => "Success",
36309            Self::Malformed => "Malformed",
36310            Self::SellNoTrust => "SellNoTrust",
36311            Self::BuyNoTrust => "BuyNoTrust",
36312            Self::SellNotAuthorized => "SellNotAuthorized",
36313            Self::BuyNotAuthorized => "BuyNotAuthorized",
36314            Self::LineFull => "LineFull",
36315            Self::Underfunded => "Underfunded",
36316            Self::CrossSelf => "CrossSelf",
36317            Self::SellNoIssuer => "SellNoIssuer",
36318            Self::BuyNoIssuer => "BuyNoIssuer",
36319            Self::NotFound => "NotFound",
36320            Self::LowReserve => "LowReserve",
36321        }
36322    }
36323
36324    #[must_use]
36325    pub const fn variants() -> [ManageSellOfferResultCode; 13] {
36326        Self::VARIANTS
36327    }
36328}
36329
36330impl Name for ManageSellOfferResultCode {
36331    #[must_use]
36332    fn name(&self) -> &'static str {
36333        Self::name(self)
36334    }
36335}
36336
36337impl Variants<ManageSellOfferResultCode> for ManageSellOfferResultCode {
36338    fn variants() -> slice::Iter<'static, ManageSellOfferResultCode> {
36339        Self::VARIANTS.iter()
36340    }
36341}
36342
36343impl Enum for ManageSellOfferResultCode {}
36344
36345impl fmt::Display for ManageSellOfferResultCode {
36346    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
36347        f.write_str(self.name())
36348    }
36349}
36350
36351impl TryFrom<i32> for ManageSellOfferResultCode {
36352    type Error = Error;
36353
36354    fn try_from(i: i32) -> Result<Self> {
36355        let e = match i {
36356            0 => ManageSellOfferResultCode::Success,
36357            -1 => ManageSellOfferResultCode::Malformed,
36358            -2 => ManageSellOfferResultCode::SellNoTrust,
36359            -3 => ManageSellOfferResultCode::BuyNoTrust,
36360            -4 => ManageSellOfferResultCode::SellNotAuthorized,
36361            -5 => ManageSellOfferResultCode::BuyNotAuthorized,
36362            -6 => ManageSellOfferResultCode::LineFull,
36363            -7 => ManageSellOfferResultCode::Underfunded,
36364            -8 => ManageSellOfferResultCode::CrossSelf,
36365            -9 => ManageSellOfferResultCode::SellNoIssuer,
36366            -10 => ManageSellOfferResultCode::BuyNoIssuer,
36367            -11 => ManageSellOfferResultCode::NotFound,
36368            -12 => ManageSellOfferResultCode::LowReserve,
36369            #[allow(unreachable_patterns)]
36370            _ => return Err(Error::Invalid),
36371        };
36372        Ok(e)
36373    }
36374}
36375
36376impl From<ManageSellOfferResultCode> for i32 {
36377    #[must_use]
36378    fn from(e: ManageSellOfferResultCode) -> Self {
36379        e as Self
36380    }
36381}
36382
36383impl ReadXdr for ManageSellOfferResultCode {
36384    #[cfg(feature = "std")]
36385    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
36386        r.with_limited_depth(|r| {
36387            let e = i32::read_xdr(r)?;
36388            let v: Self = e.try_into()?;
36389            Ok(v)
36390        })
36391    }
36392}
36393
36394impl WriteXdr for ManageSellOfferResultCode {
36395    #[cfg(feature = "std")]
36396    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
36397        w.with_limited_depth(|w| {
36398            let i: i32 = (*self).into();
36399            i.write_xdr(w)
36400        })
36401    }
36402}
36403
36404/// ManageOfferEffect is an XDR Enum defines as:
36405///
36406/// ```text
36407/// enum ManageOfferEffect
36408/// {
36409///     MANAGE_OFFER_CREATED = 0,
36410///     MANAGE_OFFER_UPDATED = 1,
36411///     MANAGE_OFFER_DELETED = 2
36412/// };
36413/// ```
36414///
36415// enum
36416#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
36417#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
36418#[cfg_attr(
36419    all(feature = "serde", feature = "alloc"),
36420    derive(serde::Serialize, serde::Deserialize),
36421    serde(rename_all = "snake_case")
36422)]
36423#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
36424#[repr(i32)]
36425pub enum ManageOfferEffect {
36426    Created = 0,
36427    Updated = 1,
36428    Deleted = 2,
36429}
36430
36431impl ManageOfferEffect {
36432    pub const VARIANTS: [ManageOfferEffect; 3] = [
36433        ManageOfferEffect::Created,
36434        ManageOfferEffect::Updated,
36435        ManageOfferEffect::Deleted,
36436    ];
36437    pub const VARIANTS_STR: [&'static str; 3] = ["Created", "Updated", "Deleted"];
36438
36439    #[must_use]
36440    pub const fn name(&self) -> &'static str {
36441        match self {
36442            Self::Created => "Created",
36443            Self::Updated => "Updated",
36444            Self::Deleted => "Deleted",
36445        }
36446    }
36447
36448    #[must_use]
36449    pub const fn variants() -> [ManageOfferEffect; 3] {
36450        Self::VARIANTS
36451    }
36452}
36453
36454impl Name for ManageOfferEffect {
36455    #[must_use]
36456    fn name(&self) -> &'static str {
36457        Self::name(self)
36458    }
36459}
36460
36461impl Variants<ManageOfferEffect> for ManageOfferEffect {
36462    fn variants() -> slice::Iter<'static, ManageOfferEffect> {
36463        Self::VARIANTS.iter()
36464    }
36465}
36466
36467impl Enum for ManageOfferEffect {}
36468
36469impl fmt::Display for ManageOfferEffect {
36470    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
36471        f.write_str(self.name())
36472    }
36473}
36474
36475impl TryFrom<i32> for ManageOfferEffect {
36476    type Error = Error;
36477
36478    fn try_from(i: i32) -> Result<Self> {
36479        let e = match i {
36480            0 => ManageOfferEffect::Created,
36481            1 => ManageOfferEffect::Updated,
36482            2 => ManageOfferEffect::Deleted,
36483            #[allow(unreachable_patterns)]
36484            _ => return Err(Error::Invalid),
36485        };
36486        Ok(e)
36487    }
36488}
36489
36490impl From<ManageOfferEffect> for i32 {
36491    #[must_use]
36492    fn from(e: ManageOfferEffect) -> Self {
36493        e as Self
36494    }
36495}
36496
36497impl ReadXdr for ManageOfferEffect {
36498    #[cfg(feature = "std")]
36499    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
36500        r.with_limited_depth(|r| {
36501            let e = i32::read_xdr(r)?;
36502            let v: Self = e.try_into()?;
36503            Ok(v)
36504        })
36505    }
36506}
36507
36508impl WriteXdr for ManageOfferEffect {
36509    #[cfg(feature = "std")]
36510    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
36511        w.with_limited_depth(|w| {
36512            let i: i32 = (*self).into();
36513            i.write_xdr(w)
36514        })
36515    }
36516}
36517
36518/// ManageOfferSuccessResultOffer is an XDR NestedUnion defines as:
36519///
36520/// ```text
36521/// union switch (ManageOfferEffect effect)
36522///     {
36523///     case MANAGE_OFFER_CREATED:
36524///     case MANAGE_OFFER_UPDATED:
36525///         OfferEntry offer;
36526///     case MANAGE_OFFER_DELETED:
36527///         void;
36528///     }
36529/// ```
36530///
36531// union with discriminant ManageOfferEffect
36532#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
36533#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
36534#[cfg_attr(
36535    all(feature = "serde", feature = "alloc"),
36536    derive(serde::Serialize, serde::Deserialize),
36537    serde(rename_all = "snake_case")
36538)]
36539#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
36540#[allow(clippy::large_enum_variant)]
36541pub enum ManageOfferSuccessResultOffer {
36542    Created(OfferEntry),
36543    Updated(OfferEntry),
36544    Deleted,
36545}
36546
36547impl ManageOfferSuccessResultOffer {
36548    pub const VARIANTS: [ManageOfferEffect; 3] = [
36549        ManageOfferEffect::Created,
36550        ManageOfferEffect::Updated,
36551        ManageOfferEffect::Deleted,
36552    ];
36553    pub const VARIANTS_STR: [&'static str; 3] = ["Created", "Updated", "Deleted"];
36554
36555    #[must_use]
36556    pub const fn name(&self) -> &'static str {
36557        match self {
36558            Self::Created(_) => "Created",
36559            Self::Updated(_) => "Updated",
36560            Self::Deleted => "Deleted",
36561        }
36562    }
36563
36564    #[must_use]
36565    pub const fn discriminant(&self) -> ManageOfferEffect {
36566        #[allow(clippy::match_same_arms)]
36567        match self {
36568            Self::Created(_) => ManageOfferEffect::Created,
36569            Self::Updated(_) => ManageOfferEffect::Updated,
36570            Self::Deleted => ManageOfferEffect::Deleted,
36571        }
36572    }
36573
36574    #[must_use]
36575    pub const fn variants() -> [ManageOfferEffect; 3] {
36576        Self::VARIANTS
36577    }
36578}
36579
36580impl Name for ManageOfferSuccessResultOffer {
36581    #[must_use]
36582    fn name(&self) -> &'static str {
36583        Self::name(self)
36584    }
36585}
36586
36587impl Discriminant<ManageOfferEffect> for ManageOfferSuccessResultOffer {
36588    #[must_use]
36589    fn discriminant(&self) -> ManageOfferEffect {
36590        Self::discriminant(self)
36591    }
36592}
36593
36594impl Variants<ManageOfferEffect> for ManageOfferSuccessResultOffer {
36595    fn variants() -> slice::Iter<'static, ManageOfferEffect> {
36596        Self::VARIANTS.iter()
36597    }
36598}
36599
36600impl Union<ManageOfferEffect> for ManageOfferSuccessResultOffer {}
36601
36602impl ReadXdr for ManageOfferSuccessResultOffer {
36603    #[cfg(feature = "std")]
36604    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
36605        r.with_limited_depth(|r| {
36606            let dv: ManageOfferEffect = <ManageOfferEffect as ReadXdr>::read_xdr(r)?;
36607            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
36608            let v = match dv {
36609                ManageOfferEffect::Created => Self::Created(OfferEntry::read_xdr(r)?),
36610                ManageOfferEffect::Updated => Self::Updated(OfferEntry::read_xdr(r)?),
36611                ManageOfferEffect::Deleted => Self::Deleted,
36612                #[allow(unreachable_patterns)]
36613                _ => return Err(Error::Invalid),
36614            };
36615            Ok(v)
36616        })
36617    }
36618}
36619
36620impl WriteXdr for ManageOfferSuccessResultOffer {
36621    #[cfg(feature = "std")]
36622    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
36623        w.with_limited_depth(|w| {
36624            self.discriminant().write_xdr(w)?;
36625            #[allow(clippy::match_same_arms)]
36626            match self {
36627                Self::Created(v) => v.write_xdr(w)?,
36628                Self::Updated(v) => v.write_xdr(w)?,
36629                Self::Deleted => ().write_xdr(w)?,
36630            };
36631            Ok(())
36632        })
36633    }
36634}
36635
36636/// ManageOfferSuccessResult is an XDR Struct defines as:
36637///
36638/// ```text
36639/// struct ManageOfferSuccessResult
36640/// {
36641///     // offers that got claimed while creating this offer
36642///     ClaimAtom offersClaimed<>;
36643///
36644///     union switch (ManageOfferEffect effect)
36645///     {
36646///     case MANAGE_OFFER_CREATED:
36647///     case MANAGE_OFFER_UPDATED:
36648///         OfferEntry offer;
36649///     case MANAGE_OFFER_DELETED:
36650///         void;
36651///     }
36652///     offer;
36653/// };
36654/// ```
36655///
36656#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
36657#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
36658#[cfg_attr(
36659    all(feature = "serde", feature = "alloc"),
36660    derive(serde::Serialize, serde::Deserialize),
36661    serde(rename_all = "snake_case")
36662)]
36663#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
36664pub struct ManageOfferSuccessResult {
36665    pub offers_claimed: VecM<ClaimAtom>,
36666    pub offer: ManageOfferSuccessResultOffer,
36667}
36668
36669impl ReadXdr for ManageOfferSuccessResult {
36670    #[cfg(feature = "std")]
36671    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
36672        r.with_limited_depth(|r| {
36673            Ok(Self {
36674                offers_claimed: VecM::<ClaimAtom>::read_xdr(r)?,
36675                offer: ManageOfferSuccessResultOffer::read_xdr(r)?,
36676            })
36677        })
36678    }
36679}
36680
36681impl WriteXdr for ManageOfferSuccessResult {
36682    #[cfg(feature = "std")]
36683    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
36684        w.with_limited_depth(|w| {
36685            self.offers_claimed.write_xdr(w)?;
36686            self.offer.write_xdr(w)?;
36687            Ok(())
36688        })
36689    }
36690}
36691
36692/// ManageSellOfferResult is an XDR Union defines as:
36693///
36694/// ```text
36695/// union ManageSellOfferResult switch (ManageSellOfferResultCode code)
36696/// {
36697/// case MANAGE_SELL_OFFER_SUCCESS:
36698///     ManageOfferSuccessResult success;
36699/// case MANAGE_SELL_OFFER_MALFORMED:
36700/// case MANAGE_SELL_OFFER_SELL_NO_TRUST:
36701/// case MANAGE_SELL_OFFER_BUY_NO_TRUST:
36702/// case MANAGE_SELL_OFFER_SELL_NOT_AUTHORIZED:
36703/// case MANAGE_SELL_OFFER_BUY_NOT_AUTHORIZED:
36704/// case MANAGE_SELL_OFFER_LINE_FULL:
36705/// case MANAGE_SELL_OFFER_UNDERFUNDED:
36706/// case MANAGE_SELL_OFFER_CROSS_SELF:
36707/// case MANAGE_SELL_OFFER_SELL_NO_ISSUER:
36708/// case MANAGE_SELL_OFFER_BUY_NO_ISSUER:
36709/// case MANAGE_SELL_OFFER_NOT_FOUND:
36710/// case MANAGE_SELL_OFFER_LOW_RESERVE:
36711///     void;
36712/// };
36713/// ```
36714///
36715// union with discriminant ManageSellOfferResultCode
36716#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
36717#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
36718#[cfg_attr(
36719    all(feature = "serde", feature = "alloc"),
36720    derive(serde::Serialize, serde::Deserialize),
36721    serde(rename_all = "snake_case")
36722)]
36723#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
36724#[allow(clippy::large_enum_variant)]
36725pub enum ManageSellOfferResult {
36726    Success(ManageOfferSuccessResult),
36727    Malformed,
36728    SellNoTrust,
36729    BuyNoTrust,
36730    SellNotAuthorized,
36731    BuyNotAuthorized,
36732    LineFull,
36733    Underfunded,
36734    CrossSelf,
36735    SellNoIssuer,
36736    BuyNoIssuer,
36737    NotFound,
36738    LowReserve,
36739}
36740
36741impl ManageSellOfferResult {
36742    pub const VARIANTS: [ManageSellOfferResultCode; 13] = [
36743        ManageSellOfferResultCode::Success,
36744        ManageSellOfferResultCode::Malformed,
36745        ManageSellOfferResultCode::SellNoTrust,
36746        ManageSellOfferResultCode::BuyNoTrust,
36747        ManageSellOfferResultCode::SellNotAuthorized,
36748        ManageSellOfferResultCode::BuyNotAuthorized,
36749        ManageSellOfferResultCode::LineFull,
36750        ManageSellOfferResultCode::Underfunded,
36751        ManageSellOfferResultCode::CrossSelf,
36752        ManageSellOfferResultCode::SellNoIssuer,
36753        ManageSellOfferResultCode::BuyNoIssuer,
36754        ManageSellOfferResultCode::NotFound,
36755        ManageSellOfferResultCode::LowReserve,
36756    ];
36757    pub const VARIANTS_STR: [&'static str; 13] = [
36758        "Success",
36759        "Malformed",
36760        "SellNoTrust",
36761        "BuyNoTrust",
36762        "SellNotAuthorized",
36763        "BuyNotAuthorized",
36764        "LineFull",
36765        "Underfunded",
36766        "CrossSelf",
36767        "SellNoIssuer",
36768        "BuyNoIssuer",
36769        "NotFound",
36770        "LowReserve",
36771    ];
36772
36773    #[must_use]
36774    pub const fn name(&self) -> &'static str {
36775        match self {
36776            Self::Success(_) => "Success",
36777            Self::Malformed => "Malformed",
36778            Self::SellNoTrust => "SellNoTrust",
36779            Self::BuyNoTrust => "BuyNoTrust",
36780            Self::SellNotAuthorized => "SellNotAuthorized",
36781            Self::BuyNotAuthorized => "BuyNotAuthorized",
36782            Self::LineFull => "LineFull",
36783            Self::Underfunded => "Underfunded",
36784            Self::CrossSelf => "CrossSelf",
36785            Self::SellNoIssuer => "SellNoIssuer",
36786            Self::BuyNoIssuer => "BuyNoIssuer",
36787            Self::NotFound => "NotFound",
36788            Self::LowReserve => "LowReserve",
36789        }
36790    }
36791
36792    #[must_use]
36793    pub const fn discriminant(&self) -> ManageSellOfferResultCode {
36794        #[allow(clippy::match_same_arms)]
36795        match self {
36796            Self::Success(_) => ManageSellOfferResultCode::Success,
36797            Self::Malformed => ManageSellOfferResultCode::Malformed,
36798            Self::SellNoTrust => ManageSellOfferResultCode::SellNoTrust,
36799            Self::BuyNoTrust => ManageSellOfferResultCode::BuyNoTrust,
36800            Self::SellNotAuthorized => ManageSellOfferResultCode::SellNotAuthorized,
36801            Self::BuyNotAuthorized => ManageSellOfferResultCode::BuyNotAuthorized,
36802            Self::LineFull => ManageSellOfferResultCode::LineFull,
36803            Self::Underfunded => ManageSellOfferResultCode::Underfunded,
36804            Self::CrossSelf => ManageSellOfferResultCode::CrossSelf,
36805            Self::SellNoIssuer => ManageSellOfferResultCode::SellNoIssuer,
36806            Self::BuyNoIssuer => ManageSellOfferResultCode::BuyNoIssuer,
36807            Self::NotFound => ManageSellOfferResultCode::NotFound,
36808            Self::LowReserve => ManageSellOfferResultCode::LowReserve,
36809        }
36810    }
36811
36812    #[must_use]
36813    pub const fn variants() -> [ManageSellOfferResultCode; 13] {
36814        Self::VARIANTS
36815    }
36816}
36817
36818impl Name for ManageSellOfferResult {
36819    #[must_use]
36820    fn name(&self) -> &'static str {
36821        Self::name(self)
36822    }
36823}
36824
36825impl Discriminant<ManageSellOfferResultCode> for ManageSellOfferResult {
36826    #[must_use]
36827    fn discriminant(&self) -> ManageSellOfferResultCode {
36828        Self::discriminant(self)
36829    }
36830}
36831
36832impl Variants<ManageSellOfferResultCode> for ManageSellOfferResult {
36833    fn variants() -> slice::Iter<'static, ManageSellOfferResultCode> {
36834        Self::VARIANTS.iter()
36835    }
36836}
36837
36838impl Union<ManageSellOfferResultCode> for ManageSellOfferResult {}
36839
36840impl ReadXdr for ManageSellOfferResult {
36841    #[cfg(feature = "std")]
36842    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
36843        r.with_limited_depth(|r| {
36844            let dv: ManageSellOfferResultCode =
36845                <ManageSellOfferResultCode as ReadXdr>::read_xdr(r)?;
36846            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
36847            let v = match dv {
36848                ManageSellOfferResultCode::Success => {
36849                    Self::Success(ManageOfferSuccessResult::read_xdr(r)?)
36850                }
36851                ManageSellOfferResultCode::Malformed => Self::Malformed,
36852                ManageSellOfferResultCode::SellNoTrust => Self::SellNoTrust,
36853                ManageSellOfferResultCode::BuyNoTrust => Self::BuyNoTrust,
36854                ManageSellOfferResultCode::SellNotAuthorized => Self::SellNotAuthorized,
36855                ManageSellOfferResultCode::BuyNotAuthorized => Self::BuyNotAuthorized,
36856                ManageSellOfferResultCode::LineFull => Self::LineFull,
36857                ManageSellOfferResultCode::Underfunded => Self::Underfunded,
36858                ManageSellOfferResultCode::CrossSelf => Self::CrossSelf,
36859                ManageSellOfferResultCode::SellNoIssuer => Self::SellNoIssuer,
36860                ManageSellOfferResultCode::BuyNoIssuer => Self::BuyNoIssuer,
36861                ManageSellOfferResultCode::NotFound => Self::NotFound,
36862                ManageSellOfferResultCode::LowReserve => Self::LowReserve,
36863                #[allow(unreachable_patterns)]
36864                _ => return Err(Error::Invalid),
36865            };
36866            Ok(v)
36867        })
36868    }
36869}
36870
36871impl WriteXdr for ManageSellOfferResult {
36872    #[cfg(feature = "std")]
36873    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
36874        w.with_limited_depth(|w| {
36875            self.discriminant().write_xdr(w)?;
36876            #[allow(clippy::match_same_arms)]
36877            match self {
36878                Self::Success(v) => v.write_xdr(w)?,
36879                Self::Malformed => ().write_xdr(w)?,
36880                Self::SellNoTrust => ().write_xdr(w)?,
36881                Self::BuyNoTrust => ().write_xdr(w)?,
36882                Self::SellNotAuthorized => ().write_xdr(w)?,
36883                Self::BuyNotAuthorized => ().write_xdr(w)?,
36884                Self::LineFull => ().write_xdr(w)?,
36885                Self::Underfunded => ().write_xdr(w)?,
36886                Self::CrossSelf => ().write_xdr(w)?,
36887                Self::SellNoIssuer => ().write_xdr(w)?,
36888                Self::BuyNoIssuer => ().write_xdr(w)?,
36889                Self::NotFound => ().write_xdr(w)?,
36890                Self::LowReserve => ().write_xdr(w)?,
36891            };
36892            Ok(())
36893        })
36894    }
36895}
36896
36897/// ManageBuyOfferResultCode is an XDR Enum defines as:
36898///
36899/// ```text
36900/// enum ManageBuyOfferResultCode
36901/// {
36902///     // codes considered as "success" for the operation
36903///     MANAGE_BUY_OFFER_SUCCESS = 0,
36904///
36905///     // codes considered as "failure" for the operation
36906///     MANAGE_BUY_OFFER_MALFORMED = -1,     // generated offer would be invalid
36907///     MANAGE_BUY_OFFER_SELL_NO_TRUST = -2, // no trust line for what we're selling
36908///     MANAGE_BUY_OFFER_BUY_NO_TRUST = -3,  // no trust line for what we're buying
36909///     MANAGE_BUY_OFFER_SELL_NOT_AUTHORIZED = -4, // not authorized to sell
36910///     MANAGE_BUY_OFFER_BUY_NOT_AUTHORIZED = -5,  // not authorized to buy
36911///     MANAGE_BUY_OFFER_LINE_FULL = -6,   // can't receive more of what it's buying
36912///     MANAGE_BUY_OFFER_UNDERFUNDED = -7, // doesn't hold what it's trying to sell
36913///     MANAGE_BUY_OFFER_CROSS_SELF = -8, // would cross an offer from the same user
36914///     MANAGE_BUY_OFFER_SELL_NO_ISSUER = -9, // no issuer for what we're selling
36915///     MANAGE_BUY_OFFER_BUY_NO_ISSUER = -10, // no issuer for what we're buying
36916///
36917///     // update errors
36918///     MANAGE_BUY_OFFER_NOT_FOUND =
36919///         -11, // offerID does not match an existing offer
36920///
36921///     MANAGE_BUY_OFFER_LOW_RESERVE = -12 // not enough funds to create a new Offer
36922/// };
36923/// ```
36924///
36925// enum
36926#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
36927#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
36928#[cfg_attr(
36929    all(feature = "serde", feature = "alloc"),
36930    derive(serde::Serialize, serde::Deserialize),
36931    serde(rename_all = "snake_case")
36932)]
36933#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
36934#[repr(i32)]
36935pub enum ManageBuyOfferResultCode {
36936    Success = 0,
36937    Malformed = -1,
36938    SellNoTrust = -2,
36939    BuyNoTrust = -3,
36940    SellNotAuthorized = -4,
36941    BuyNotAuthorized = -5,
36942    LineFull = -6,
36943    Underfunded = -7,
36944    CrossSelf = -8,
36945    SellNoIssuer = -9,
36946    BuyNoIssuer = -10,
36947    NotFound = -11,
36948    LowReserve = -12,
36949}
36950
36951impl ManageBuyOfferResultCode {
36952    pub const VARIANTS: [ManageBuyOfferResultCode; 13] = [
36953        ManageBuyOfferResultCode::Success,
36954        ManageBuyOfferResultCode::Malformed,
36955        ManageBuyOfferResultCode::SellNoTrust,
36956        ManageBuyOfferResultCode::BuyNoTrust,
36957        ManageBuyOfferResultCode::SellNotAuthorized,
36958        ManageBuyOfferResultCode::BuyNotAuthorized,
36959        ManageBuyOfferResultCode::LineFull,
36960        ManageBuyOfferResultCode::Underfunded,
36961        ManageBuyOfferResultCode::CrossSelf,
36962        ManageBuyOfferResultCode::SellNoIssuer,
36963        ManageBuyOfferResultCode::BuyNoIssuer,
36964        ManageBuyOfferResultCode::NotFound,
36965        ManageBuyOfferResultCode::LowReserve,
36966    ];
36967    pub const VARIANTS_STR: [&'static str; 13] = [
36968        "Success",
36969        "Malformed",
36970        "SellNoTrust",
36971        "BuyNoTrust",
36972        "SellNotAuthorized",
36973        "BuyNotAuthorized",
36974        "LineFull",
36975        "Underfunded",
36976        "CrossSelf",
36977        "SellNoIssuer",
36978        "BuyNoIssuer",
36979        "NotFound",
36980        "LowReserve",
36981    ];
36982
36983    #[must_use]
36984    pub const fn name(&self) -> &'static str {
36985        match self {
36986            Self::Success => "Success",
36987            Self::Malformed => "Malformed",
36988            Self::SellNoTrust => "SellNoTrust",
36989            Self::BuyNoTrust => "BuyNoTrust",
36990            Self::SellNotAuthorized => "SellNotAuthorized",
36991            Self::BuyNotAuthorized => "BuyNotAuthorized",
36992            Self::LineFull => "LineFull",
36993            Self::Underfunded => "Underfunded",
36994            Self::CrossSelf => "CrossSelf",
36995            Self::SellNoIssuer => "SellNoIssuer",
36996            Self::BuyNoIssuer => "BuyNoIssuer",
36997            Self::NotFound => "NotFound",
36998            Self::LowReserve => "LowReserve",
36999        }
37000    }
37001
37002    #[must_use]
37003    pub const fn variants() -> [ManageBuyOfferResultCode; 13] {
37004        Self::VARIANTS
37005    }
37006}
37007
37008impl Name for ManageBuyOfferResultCode {
37009    #[must_use]
37010    fn name(&self) -> &'static str {
37011        Self::name(self)
37012    }
37013}
37014
37015impl Variants<ManageBuyOfferResultCode> for ManageBuyOfferResultCode {
37016    fn variants() -> slice::Iter<'static, ManageBuyOfferResultCode> {
37017        Self::VARIANTS.iter()
37018    }
37019}
37020
37021impl Enum for ManageBuyOfferResultCode {}
37022
37023impl fmt::Display for ManageBuyOfferResultCode {
37024    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
37025        f.write_str(self.name())
37026    }
37027}
37028
37029impl TryFrom<i32> for ManageBuyOfferResultCode {
37030    type Error = Error;
37031
37032    fn try_from(i: i32) -> Result<Self> {
37033        let e = match i {
37034            0 => ManageBuyOfferResultCode::Success,
37035            -1 => ManageBuyOfferResultCode::Malformed,
37036            -2 => ManageBuyOfferResultCode::SellNoTrust,
37037            -3 => ManageBuyOfferResultCode::BuyNoTrust,
37038            -4 => ManageBuyOfferResultCode::SellNotAuthorized,
37039            -5 => ManageBuyOfferResultCode::BuyNotAuthorized,
37040            -6 => ManageBuyOfferResultCode::LineFull,
37041            -7 => ManageBuyOfferResultCode::Underfunded,
37042            -8 => ManageBuyOfferResultCode::CrossSelf,
37043            -9 => ManageBuyOfferResultCode::SellNoIssuer,
37044            -10 => ManageBuyOfferResultCode::BuyNoIssuer,
37045            -11 => ManageBuyOfferResultCode::NotFound,
37046            -12 => ManageBuyOfferResultCode::LowReserve,
37047            #[allow(unreachable_patterns)]
37048            _ => return Err(Error::Invalid),
37049        };
37050        Ok(e)
37051    }
37052}
37053
37054impl From<ManageBuyOfferResultCode> for i32 {
37055    #[must_use]
37056    fn from(e: ManageBuyOfferResultCode) -> Self {
37057        e as Self
37058    }
37059}
37060
37061impl ReadXdr for ManageBuyOfferResultCode {
37062    #[cfg(feature = "std")]
37063    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
37064        r.with_limited_depth(|r| {
37065            let e = i32::read_xdr(r)?;
37066            let v: Self = e.try_into()?;
37067            Ok(v)
37068        })
37069    }
37070}
37071
37072impl WriteXdr for ManageBuyOfferResultCode {
37073    #[cfg(feature = "std")]
37074    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
37075        w.with_limited_depth(|w| {
37076            let i: i32 = (*self).into();
37077            i.write_xdr(w)
37078        })
37079    }
37080}
37081
37082/// ManageBuyOfferResult is an XDR Union defines as:
37083///
37084/// ```text
37085/// union ManageBuyOfferResult switch (ManageBuyOfferResultCode code)
37086/// {
37087/// case MANAGE_BUY_OFFER_SUCCESS:
37088///     ManageOfferSuccessResult success;
37089/// case MANAGE_BUY_OFFER_MALFORMED:
37090/// case MANAGE_BUY_OFFER_SELL_NO_TRUST:
37091/// case MANAGE_BUY_OFFER_BUY_NO_TRUST:
37092/// case MANAGE_BUY_OFFER_SELL_NOT_AUTHORIZED:
37093/// case MANAGE_BUY_OFFER_BUY_NOT_AUTHORIZED:
37094/// case MANAGE_BUY_OFFER_LINE_FULL:
37095/// case MANAGE_BUY_OFFER_UNDERFUNDED:
37096/// case MANAGE_BUY_OFFER_CROSS_SELF:
37097/// case MANAGE_BUY_OFFER_SELL_NO_ISSUER:
37098/// case MANAGE_BUY_OFFER_BUY_NO_ISSUER:
37099/// case MANAGE_BUY_OFFER_NOT_FOUND:
37100/// case MANAGE_BUY_OFFER_LOW_RESERVE:
37101///     void;
37102/// };
37103/// ```
37104///
37105// union with discriminant ManageBuyOfferResultCode
37106#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
37107#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
37108#[cfg_attr(
37109    all(feature = "serde", feature = "alloc"),
37110    derive(serde::Serialize, serde::Deserialize),
37111    serde(rename_all = "snake_case")
37112)]
37113#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
37114#[allow(clippy::large_enum_variant)]
37115pub enum ManageBuyOfferResult {
37116    Success(ManageOfferSuccessResult),
37117    Malformed,
37118    SellNoTrust,
37119    BuyNoTrust,
37120    SellNotAuthorized,
37121    BuyNotAuthorized,
37122    LineFull,
37123    Underfunded,
37124    CrossSelf,
37125    SellNoIssuer,
37126    BuyNoIssuer,
37127    NotFound,
37128    LowReserve,
37129}
37130
37131impl ManageBuyOfferResult {
37132    pub const VARIANTS: [ManageBuyOfferResultCode; 13] = [
37133        ManageBuyOfferResultCode::Success,
37134        ManageBuyOfferResultCode::Malformed,
37135        ManageBuyOfferResultCode::SellNoTrust,
37136        ManageBuyOfferResultCode::BuyNoTrust,
37137        ManageBuyOfferResultCode::SellNotAuthorized,
37138        ManageBuyOfferResultCode::BuyNotAuthorized,
37139        ManageBuyOfferResultCode::LineFull,
37140        ManageBuyOfferResultCode::Underfunded,
37141        ManageBuyOfferResultCode::CrossSelf,
37142        ManageBuyOfferResultCode::SellNoIssuer,
37143        ManageBuyOfferResultCode::BuyNoIssuer,
37144        ManageBuyOfferResultCode::NotFound,
37145        ManageBuyOfferResultCode::LowReserve,
37146    ];
37147    pub const VARIANTS_STR: [&'static str; 13] = [
37148        "Success",
37149        "Malformed",
37150        "SellNoTrust",
37151        "BuyNoTrust",
37152        "SellNotAuthorized",
37153        "BuyNotAuthorized",
37154        "LineFull",
37155        "Underfunded",
37156        "CrossSelf",
37157        "SellNoIssuer",
37158        "BuyNoIssuer",
37159        "NotFound",
37160        "LowReserve",
37161    ];
37162
37163    #[must_use]
37164    pub const fn name(&self) -> &'static str {
37165        match self {
37166            Self::Success(_) => "Success",
37167            Self::Malformed => "Malformed",
37168            Self::SellNoTrust => "SellNoTrust",
37169            Self::BuyNoTrust => "BuyNoTrust",
37170            Self::SellNotAuthorized => "SellNotAuthorized",
37171            Self::BuyNotAuthorized => "BuyNotAuthorized",
37172            Self::LineFull => "LineFull",
37173            Self::Underfunded => "Underfunded",
37174            Self::CrossSelf => "CrossSelf",
37175            Self::SellNoIssuer => "SellNoIssuer",
37176            Self::BuyNoIssuer => "BuyNoIssuer",
37177            Self::NotFound => "NotFound",
37178            Self::LowReserve => "LowReserve",
37179        }
37180    }
37181
37182    #[must_use]
37183    pub const fn discriminant(&self) -> ManageBuyOfferResultCode {
37184        #[allow(clippy::match_same_arms)]
37185        match self {
37186            Self::Success(_) => ManageBuyOfferResultCode::Success,
37187            Self::Malformed => ManageBuyOfferResultCode::Malformed,
37188            Self::SellNoTrust => ManageBuyOfferResultCode::SellNoTrust,
37189            Self::BuyNoTrust => ManageBuyOfferResultCode::BuyNoTrust,
37190            Self::SellNotAuthorized => ManageBuyOfferResultCode::SellNotAuthorized,
37191            Self::BuyNotAuthorized => ManageBuyOfferResultCode::BuyNotAuthorized,
37192            Self::LineFull => ManageBuyOfferResultCode::LineFull,
37193            Self::Underfunded => ManageBuyOfferResultCode::Underfunded,
37194            Self::CrossSelf => ManageBuyOfferResultCode::CrossSelf,
37195            Self::SellNoIssuer => ManageBuyOfferResultCode::SellNoIssuer,
37196            Self::BuyNoIssuer => ManageBuyOfferResultCode::BuyNoIssuer,
37197            Self::NotFound => ManageBuyOfferResultCode::NotFound,
37198            Self::LowReserve => ManageBuyOfferResultCode::LowReserve,
37199        }
37200    }
37201
37202    #[must_use]
37203    pub const fn variants() -> [ManageBuyOfferResultCode; 13] {
37204        Self::VARIANTS
37205    }
37206}
37207
37208impl Name for ManageBuyOfferResult {
37209    #[must_use]
37210    fn name(&self) -> &'static str {
37211        Self::name(self)
37212    }
37213}
37214
37215impl Discriminant<ManageBuyOfferResultCode> for ManageBuyOfferResult {
37216    #[must_use]
37217    fn discriminant(&self) -> ManageBuyOfferResultCode {
37218        Self::discriminant(self)
37219    }
37220}
37221
37222impl Variants<ManageBuyOfferResultCode> for ManageBuyOfferResult {
37223    fn variants() -> slice::Iter<'static, ManageBuyOfferResultCode> {
37224        Self::VARIANTS.iter()
37225    }
37226}
37227
37228impl Union<ManageBuyOfferResultCode> for ManageBuyOfferResult {}
37229
37230impl ReadXdr for ManageBuyOfferResult {
37231    #[cfg(feature = "std")]
37232    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
37233        r.with_limited_depth(|r| {
37234            let dv: ManageBuyOfferResultCode = <ManageBuyOfferResultCode as ReadXdr>::read_xdr(r)?;
37235            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
37236            let v = match dv {
37237                ManageBuyOfferResultCode::Success => {
37238                    Self::Success(ManageOfferSuccessResult::read_xdr(r)?)
37239                }
37240                ManageBuyOfferResultCode::Malformed => Self::Malformed,
37241                ManageBuyOfferResultCode::SellNoTrust => Self::SellNoTrust,
37242                ManageBuyOfferResultCode::BuyNoTrust => Self::BuyNoTrust,
37243                ManageBuyOfferResultCode::SellNotAuthorized => Self::SellNotAuthorized,
37244                ManageBuyOfferResultCode::BuyNotAuthorized => Self::BuyNotAuthorized,
37245                ManageBuyOfferResultCode::LineFull => Self::LineFull,
37246                ManageBuyOfferResultCode::Underfunded => Self::Underfunded,
37247                ManageBuyOfferResultCode::CrossSelf => Self::CrossSelf,
37248                ManageBuyOfferResultCode::SellNoIssuer => Self::SellNoIssuer,
37249                ManageBuyOfferResultCode::BuyNoIssuer => Self::BuyNoIssuer,
37250                ManageBuyOfferResultCode::NotFound => Self::NotFound,
37251                ManageBuyOfferResultCode::LowReserve => Self::LowReserve,
37252                #[allow(unreachable_patterns)]
37253                _ => return Err(Error::Invalid),
37254            };
37255            Ok(v)
37256        })
37257    }
37258}
37259
37260impl WriteXdr for ManageBuyOfferResult {
37261    #[cfg(feature = "std")]
37262    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
37263        w.with_limited_depth(|w| {
37264            self.discriminant().write_xdr(w)?;
37265            #[allow(clippy::match_same_arms)]
37266            match self {
37267                Self::Success(v) => v.write_xdr(w)?,
37268                Self::Malformed => ().write_xdr(w)?,
37269                Self::SellNoTrust => ().write_xdr(w)?,
37270                Self::BuyNoTrust => ().write_xdr(w)?,
37271                Self::SellNotAuthorized => ().write_xdr(w)?,
37272                Self::BuyNotAuthorized => ().write_xdr(w)?,
37273                Self::LineFull => ().write_xdr(w)?,
37274                Self::Underfunded => ().write_xdr(w)?,
37275                Self::CrossSelf => ().write_xdr(w)?,
37276                Self::SellNoIssuer => ().write_xdr(w)?,
37277                Self::BuyNoIssuer => ().write_xdr(w)?,
37278                Self::NotFound => ().write_xdr(w)?,
37279                Self::LowReserve => ().write_xdr(w)?,
37280            };
37281            Ok(())
37282        })
37283    }
37284}
37285
37286/// SetOptionsResultCode is an XDR Enum defines as:
37287///
37288/// ```text
37289/// enum SetOptionsResultCode
37290/// {
37291///     // codes considered as "success" for the operation
37292///     SET_OPTIONS_SUCCESS = 0,
37293///     // codes considered as "failure" for the operation
37294///     SET_OPTIONS_LOW_RESERVE = -1,      // not enough funds to add a signer
37295///     SET_OPTIONS_TOO_MANY_SIGNERS = -2, // max number of signers already reached
37296///     SET_OPTIONS_BAD_FLAGS = -3,        // invalid combination of clear/set flags
37297///     SET_OPTIONS_INVALID_INFLATION = -4,      // inflation account does not exist
37298///     SET_OPTIONS_CANT_CHANGE = -5,            // can no longer change this option
37299///     SET_OPTIONS_UNKNOWN_FLAG = -6,           // can't set an unknown flag
37300///     SET_OPTIONS_THRESHOLD_OUT_OF_RANGE = -7, // bad value for weight/threshold
37301///     SET_OPTIONS_BAD_SIGNER = -8,             // signer cannot be masterkey
37302///     SET_OPTIONS_INVALID_HOME_DOMAIN = -9,    // malformed home domain
37303///     SET_OPTIONS_AUTH_REVOCABLE_REQUIRED =
37304///         -10 // auth revocable is required for clawback
37305/// };
37306/// ```
37307///
37308// enum
37309#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
37310#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
37311#[cfg_attr(
37312    all(feature = "serde", feature = "alloc"),
37313    derive(serde::Serialize, serde::Deserialize),
37314    serde(rename_all = "snake_case")
37315)]
37316#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
37317#[repr(i32)]
37318pub enum SetOptionsResultCode {
37319    Success = 0,
37320    LowReserve = -1,
37321    TooManySigners = -2,
37322    BadFlags = -3,
37323    InvalidInflation = -4,
37324    CantChange = -5,
37325    UnknownFlag = -6,
37326    ThresholdOutOfRange = -7,
37327    BadSigner = -8,
37328    InvalidHomeDomain = -9,
37329    AuthRevocableRequired = -10,
37330}
37331
37332impl SetOptionsResultCode {
37333    pub const VARIANTS: [SetOptionsResultCode; 11] = [
37334        SetOptionsResultCode::Success,
37335        SetOptionsResultCode::LowReserve,
37336        SetOptionsResultCode::TooManySigners,
37337        SetOptionsResultCode::BadFlags,
37338        SetOptionsResultCode::InvalidInflation,
37339        SetOptionsResultCode::CantChange,
37340        SetOptionsResultCode::UnknownFlag,
37341        SetOptionsResultCode::ThresholdOutOfRange,
37342        SetOptionsResultCode::BadSigner,
37343        SetOptionsResultCode::InvalidHomeDomain,
37344        SetOptionsResultCode::AuthRevocableRequired,
37345    ];
37346    pub const VARIANTS_STR: [&'static str; 11] = [
37347        "Success",
37348        "LowReserve",
37349        "TooManySigners",
37350        "BadFlags",
37351        "InvalidInflation",
37352        "CantChange",
37353        "UnknownFlag",
37354        "ThresholdOutOfRange",
37355        "BadSigner",
37356        "InvalidHomeDomain",
37357        "AuthRevocableRequired",
37358    ];
37359
37360    #[must_use]
37361    pub const fn name(&self) -> &'static str {
37362        match self {
37363            Self::Success => "Success",
37364            Self::LowReserve => "LowReserve",
37365            Self::TooManySigners => "TooManySigners",
37366            Self::BadFlags => "BadFlags",
37367            Self::InvalidInflation => "InvalidInflation",
37368            Self::CantChange => "CantChange",
37369            Self::UnknownFlag => "UnknownFlag",
37370            Self::ThresholdOutOfRange => "ThresholdOutOfRange",
37371            Self::BadSigner => "BadSigner",
37372            Self::InvalidHomeDomain => "InvalidHomeDomain",
37373            Self::AuthRevocableRequired => "AuthRevocableRequired",
37374        }
37375    }
37376
37377    #[must_use]
37378    pub const fn variants() -> [SetOptionsResultCode; 11] {
37379        Self::VARIANTS
37380    }
37381}
37382
37383impl Name for SetOptionsResultCode {
37384    #[must_use]
37385    fn name(&self) -> &'static str {
37386        Self::name(self)
37387    }
37388}
37389
37390impl Variants<SetOptionsResultCode> for SetOptionsResultCode {
37391    fn variants() -> slice::Iter<'static, SetOptionsResultCode> {
37392        Self::VARIANTS.iter()
37393    }
37394}
37395
37396impl Enum for SetOptionsResultCode {}
37397
37398impl fmt::Display for SetOptionsResultCode {
37399    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
37400        f.write_str(self.name())
37401    }
37402}
37403
37404impl TryFrom<i32> for SetOptionsResultCode {
37405    type Error = Error;
37406
37407    fn try_from(i: i32) -> Result<Self> {
37408        let e = match i {
37409            0 => SetOptionsResultCode::Success,
37410            -1 => SetOptionsResultCode::LowReserve,
37411            -2 => SetOptionsResultCode::TooManySigners,
37412            -3 => SetOptionsResultCode::BadFlags,
37413            -4 => SetOptionsResultCode::InvalidInflation,
37414            -5 => SetOptionsResultCode::CantChange,
37415            -6 => SetOptionsResultCode::UnknownFlag,
37416            -7 => SetOptionsResultCode::ThresholdOutOfRange,
37417            -8 => SetOptionsResultCode::BadSigner,
37418            -9 => SetOptionsResultCode::InvalidHomeDomain,
37419            -10 => SetOptionsResultCode::AuthRevocableRequired,
37420            #[allow(unreachable_patterns)]
37421            _ => return Err(Error::Invalid),
37422        };
37423        Ok(e)
37424    }
37425}
37426
37427impl From<SetOptionsResultCode> for i32 {
37428    #[must_use]
37429    fn from(e: SetOptionsResultCode) -> Self {
37430        e as Self
37431    }
37432}
37433
37434impl ReadXdr for SetOptionsResultCode {
37435    #[cfg(feature = "std")]
37436    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
37437        r.with_limited_depth(|r| {
37438            let e = i32::read_xdr(r)?;
37439            let v: Self = e.try_into()?;
37440            Ok(v)
37441        })
37442    }
37443}
37444
37445impl WriteXdr for SetOptionsResultCode {
37446    #[cfg(feature = "std")]
37447    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
37448        w.with_limited_depth(|w| {
37449            let i: i32 = (*self).into();
37450            i.write_xdr(w)
37451        })
37452    }
37453}
37454
37455/// SetOptionsResult is an XDR Union defines as:
37456///
37457/// ```text
37458/// union SetOptionsResult switch (SetOptionsResultCode code)
37459/// {
37460/// case SET_OPTIONS_SUCCESS:
37461///     void;
37462/// case SET_OPTIONS_LOW_RESERVE:
37463/// case SET_OPTIONS_TOO_MANY_SIGNERS:
37464/// case SET_OPTIONS_BAD_FLAGS:
37465/// case SET_OPTIONS_INVALID_INFLATION:
37466/// case SET_OPTIONS_CANT_CHANGE:
37467/// case SET_OPTIONS_UNKNOWN_FLAG:
37468/// case SET_OPTIONS_THRESHOLD_OUT_OF_RANGE:
37469/// case SET_OPTIONS_BAD_SIGNER:
37470/// case SET_OPTIONS_INVALID_HOME_DOMAIN:
37471/// case SET_OPTIONS_AUTH_REVOCABLE_REQUIRED:
37472///     void;
37473/// };
37474/// ```
37475///
37476// union with discriminant SetOptionsResultCode
37477#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
37478#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
37479#[cfg_attr(
37480    all(feature = "serde", feature = "alloc"),
37481    derive(serde::Serialize, serde::Deserialize),
37482    serde(rename_all = "snake_case")
37483)]
37484#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
37485#[allow(clippy::large_enum_variant)]
37486pub enum SetOptionsResult {
37487    Success,
37488    LowReserve,
37489    TooManySigners,
37490    BadFlags,
37491    InvalidInflation,
37492    CantChange,
37493    UnknownFlag,
37494    ThresholdOutOfRange,
37495    BadSigner,
37496    InvalidHomeDomain,
37497    AuthRevocableRequired,
37498}
37499
37500impl SetOptionsResult {
37501    pub const VARIANTS: [SetOptionsResultCode; 11] = [
37502        SetOptionsResultCode::Success,
37503        SetOptionsResultCode::LowReserve,
37504        SetOptionsResultCode::TooManySigners,
37505        SetOptionsResultCode::BadFlags,
37506        SetOptionsResultCode::InvalidInflation,
37507        SetOptionsResultCode::CantChange,
37508        SetOptionsResultCode::UnknownFlag,
37509        SetOptionsResultCode::ThresholdOutOfRange,
37510        SetOptionsResultCode::BadSigner,
37511        SetOptionsResultCode::InvalidHomeDomain,
37512        SetOptionsResultCode::AuthRevocableRequired,
37513    ];
37514    pub const VARIANTS_STR: [&'static str; 11] = [
37515        "Success",
37516        "LowReserve",
37517        "TooManySigners",
37518        "BadFlags",
37519        "InvalidInflation",
37520        "CantChange",
37521        "UnknownFlag",
37522        "ThresholdOutOfRange",
37523        "BadSigner",
37524        "InvalidHomeDomain",
37525        "AuthRevocableRequired",
37526    ];
37527
37528    #[must_use]
37529    pub const fn name(&self) -> &'static str {
37530        match self {
37531            Self::Success => "Success",
37532            Self::LowReserve => "LowReserve",
37533            Self::TooManySigners => "TooManySigners",
37534            Self::BadFlags => "BadFlags",
37535            Self::InvalidInflation => "InvalidInflation",
37536            Self::CantChange => "CantChange",
37537            Self::UnknownFlag => "UnknownFlag",
37538            Self::ThresholdOutOfRange => "ThresholdOutOfRange",
37539            Self::BadSigner => "BadSigner",
37540            Self::InvalidHomeDomain => "InvalidHomeDomain",
37541            Self::AuthRevocableRequired => "AuthRevocableRequired",
37542        }
37543    }
37544
37545    #[must_use]
37546    pub const fn discriminant(&self) -> SetOptionsResultCode {
37547        #[allow(clippy::match_same_arms)]
37548        match self {
37549            Self::Success => SetOptionsResultCode::Success,
37550            Self::LowReserve => SetOptionsResultCode::LowReserve,
37551            Self::TooManySigners => SetOptionsResultCode::TooManySigners,
37552            Self::BadFlags => SetOptionsResultCode::BadFlags,
37553            Self::InvalidInflation => SetOptionsResultCode::InvalidInflation,
37554            Self::CantChange => SetOptionsResultCode::CantChange,
37555            Self::UnknownFlag => SetOptionsResultCode::UnknownFlag,
37556            Self::ThresholdOutOfRange => SetOptionsResultCode::ThresholdOutOfRange,
37557            Self::BadSigner => SetOptionsResultCode::BadSigner,
37558            Self::InvalidHomeDomain => SetOptionsResultCode::InvalidHomeDomain,
37559            Self::AuthRevocableRequired => SetOptionsResultCode::AuthRevocableRequired,
37560        }
37561    }
37562
37563    #[must_use]
37564    pub const fn variants() -> [SetOptionsResultCode; 11] {
37565        Self::VARIANTS
37566    }
37567}
37568
37569impl Name for SetOptionsResult {
37570    #[must_use]
37571    fn name(&self) -> &'static str {
37572        Self::name(self)
37573    }
37574}
37575
37576impl Discriminant<SetOptionsResultCode> for SetOptionsResult {
37577    #[must_use]
37578    fn discriminant(&self) -> SetOptionsResultCode {
37579        Self::discriminant(self)
37580    }
37581}
37582
37583impl Variants<SetOptionsResultCode> for SetOptionsResult {
37584    fn variants() -> slice::Iter<'static, SetOptionsResultCode> {
37585        Self::VARIANTS.iter()
37586    }
37587}
37588
37589impl Union<SetOptionsResultCode> for SetOptionsResult {}
37590
37591impl ReadXdr for SetOptionsResult {
37592    #[cfg(feature = "std")]
37593    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
37594        r.with_limited_depth(|r| {
37595            let dv: SetOptionsResultCode = <SetOptionsResultCode as ReadXdr>::read_xdr(r)?;
37596            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
37597            let v = match dv {
37598                SetOptionsResultCode::Success => Self::Success,
37599                SetOptionsResultCode::LowReserve => Self::LowReserve,
37600                SetOptionsResultCode::TooManySigners => Self::TooManySigners,
37601                SetOptionsResultCode::BadFlags => Self::BadFlags,
37602                SetOptionsResultCode::InvalidInflation => Self::InvalidInflation,
37603                SetOptionsResultCode::CantChange => Self::CantChange,
37604                SetOptionsResultCode::UnknownFlag => Self::UnknownFlag,
37605                SetOptionsResultCode::ThresholdOutOfRange => Self::ThresholdOutOfRange,
37606                SetOptionsResultCode::BadSigner => Self::BadSigner,
37607                SetOptionsResultCode::InvalidHomeDomain => Self::InvalidHomeDomain,
37608                SetOptionsResultCode::AuthRevocableRequired => Self::AuthRevocableRequired,
37609                #[allow(unreachable_patterns)]
37610                _ => return Err(Error::Invalid),
37611            };
37612            Ok(v)
37613        })
37614    }
37615}
37616
37617impl WriteXdr for SetOptionsResult {
37618    #[cfg(feature = "std")]
37619    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
37620        w.with_limited_depth(|w| {
37621            self.discriminant().write_xdr(w)?;
37622            #[allow(clippy::match_same_arms)]
37623            match self {
37624                Self::Success => ().write_xdr(w)?,
37625                Self::LowReserve => ().write_xdr(w)?,
37626                Self::TooManySigners => ().write_xdr(w)?,
37627                Self::BadFlags => ().write_xdr(w)?,
37628                Self::InvalidInflation => ().write_xdr(w)?,
37629                Self::CantChange => ().write_xdr(w)?,
37630                Self::UnknownFlag => ().write_xdr(w)?,
37631                Self::ThresholdOutOfRange => ().write_xdr(w)?,
37632                Self::BadSigner => ().write_xdr(w)?,
37633                Self::InvalidHomeDomain => ().write_xdr(w)?,
37634                Self::AuthRevocableRequired => ().write_xdr(w)?,
37635            };
37636            Ok(())
37637        })
37638    }
37639}
37640
37641/// ChangeTrustResultCode is an XDR Enum defines as:
37642///
37643/// ```text
37644/// enum ChangeTrustResultCode
37645/// {
37646///     // codes considered as "success" for the operation
37647///     CHANGE_TRUST_SUCCESS = 0,
37648///     // codes considered as "failure" for the operation
37649///     CHANGE_TRUST_MALFORMED = -1,     // bad input
37650///     CHANGE_TRUST_NO_ISSUER = -2,     // could not find issuer
37651///     CHANGE_TRUST_INVALID_LIMIT = -3, // cannot drop limit below balance
37652///                                      // cannot create with a limit of 0
37653///     CHANGE_TRUST_LOW_RESERVE =
37654///         -4, // not enough funds to create a new trust line,
37655///     CHANGE_TRUST_SELF_NOT_ALLOWED = -5,   // trusting self is not allowed
37656///     CHANGE_TRUST_TRUST_LINE_MISSING = -6, // Asset trustline is missing for pool
37657///     CHANGE_TRUST_CANNOT_DELETE =
37658///         -7, // Asset trustline is still referenced in a pool
37659///     CHANGE_TRUST_NOT_AUTH_MAINTAIN_LIABILITIES =
37660///         -8 // Asset trustline is deauthorized
37661/// };
37662/// ```
37663///
37664// enum
37665#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
37666#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
37667#[cfg_attr(
37668    all(feature = "serde", feature = "alloc"),
37669    derive(serde::Serialize, serde::Deserialize),
37670    serde(rename_all = "snake_case")
37671)]
37672#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
37673#[repr(i32)]
37674pub enum ChangeTrustResultCode {
37675    Success = 0,
37676    Malformed = -1,
37677    NoIssuer = -2,
37678    InvalidLimit = -3,
37679    LowReserve = -4,
37680    SelfNotAllowed = -5,
37681    TrustLineMissing = -6,
37682    CannotDelete = -7,
37683    NotAuthMaintainLiabilities = -8,
37684}
37685
37686impl ChangeTrustResultCode {
37687    pub const VARIANTS: [ChangeTrustResultCode; 9] = [
37688        ChangeTrustResultCode::Success,
37689        ChangeTrustResultCode::Malformed,
37690        ChangeTrustResultCode::NoIssuer,
37691        ChangeTrustResultCode::InvalidLimit,
37692        ChangeTrustResultCode::LowReserve,
37693        ChangeTrustResultCode::SelfNotAllowed,
37694        ChangeTrustResultCode::TrustLineMissing,
37695        ChangeTrustResultCode::CannotDelete,
37696        ChangeTrustResultCode::NotAuthMaintainLiabilities,
37697    ];
37698    pub const VARIANTS_STR: [&'static str; 9] = [
37699        "Success",
37700        "Malformed",
37701        "NoIssuer",
37702        "InvalidLimit",
37703        "LowReserve",
37704        "SelfNotAllowed",
37705        "TrustLineMissing",
37706        "CannotDelete",
37707        "NotAuthMaintainLiabilities",
37708    ];
37709
37710    #[must_use]
37711    pub const fn name(&self) -> &'static str {
37712        match self {
37713            Self::Success => "Success",
37714            Self::Malformed => "Malformed",
37715            Self::NoIssuer => "NoIssuer",
37716            Self::InvalidLimit => "InvalidLimit",
37717            Self::LowReserve => "LowReserve",
37718            Self::SelfNotAllowed => "SelfNotAllowed",
37719            Self::TrustLineMissing => "TrustLineMissing",
37720            Self::CannotDelete => "CannotDelete",
37721            Self::NotAuthMaintainLiabilities => "NotAuthMaintainLiabilities",
37722        }
37723    }
37724
37725    #[must_use]
37726    pub const fn variants() -> [ChangeTrustResultCode; 9] {
37727        Self::VARIANTS
37728    }
37729}
37730
37731impl Name for ChangeTrustResultCode {
37732    #[must_use]
37733    fn name(&self) -> &'static str {
37734        Self::name(self)
37735    }
37736}
37737
37738impl Variants<ChangeTrustResultCode> for ChangeTrustResultCode {
37739    fn variants() -> slice::Iter<'static, ChangeTrustResultCode> {
37740        Self::VARIANTS.iter()
37741    }
37742}
37743
37744impl Enum for ChangeTrustResultCode {}
37745
37746impl fmt::Display for ChangeTrustResultCode {
37747    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
37748        f.write_str(self.name())
37749    }
37750}
37751
37752impl TryFrom<i32> for ChangeTrustResultCode {
37753    type Error = Error;
37754
37755    fn try_from(i: i32) -> Result<Self> {
37756        let e = match i {
37757            0 => ChangeTrustResultCode::Success,
37758            -1 => ChangeTrustResultCode::Malformed,
37759            -2 => ChangeTrustResultCode::NoIssuer,
37760            -3 => ChangeTrustResultCode::InvalidLimit,
37761            -4 => ChangeTrustResultCode::LowReserve,
37762            -5 => ChangeTrustResultCode::SelfNotAllowed,
37763            -6 => ChangeTrustResultCode::TrustLineMissing,
37764            -7 => ChangeTrustResultCode::CannotDelete,
37765            -8 => ChangeTrustResultCode::NotAuthMaintainLiabilities,
37766            #[allow(unreachable_patterns)]
37767            _ => return Err(Error::Invalid),
37768        };
37769        Ok(e)
37770    }
37771}
37772
37773impl From<ChangeTrustResultCode> for i32 {
37774    #[must_use]
37775    fn from(e: ChangeTrustResultCode) -> Self {
37776        e as Self
37777    }
37778}
37779
37780impl ReadXdr for ChangeTrustResultCode {
37781    #[cfg(feature = "std")]
37782    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
37783        r.with_limited_depth(|r| {
37784            let e = i32::read_xdr(r)?;
37785            let v: Self = e.try_into()?;
37786            Ok(v)
37787        })
37788    }
37789}
37790
37791impl WriteXdr for ChangeTrustResultCode {
37792    #[cfg(feature = "std")]
37793    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
37794        w.with_limited_depth(|w| {
37795            let i: i32 = (*self).into();
37796            i.write_xdr(w)
37797        })
37798    }
37799}
37800
37801/// ChangeTrustResult is an XDR Union defines as:
37802///
37803/// ```text
37804/// union ChangeTrustResult switch (ChangeTrustResultCode code)
37805/// {
37806/// case CHANGE_TRUST_SUCCESS:
37807///     void;
37808/// case CHANGE_TRUST_MALFORMED:
37809/// case CHANGE_TRUST_NO_ISSUER:
37810/// case CHANGE_TRUST_INVALID_LIMIT:
37811/// case CHANGE_TRUST_LOW_RESERVE:
37812/// case CHANGE_TRUST_SELF_NOT_ALLOWED:
37813/// case CHANGE_TRUST_TRUST_LINE_MISSING:
37814/// case CHANGE_TRUST_CANNOT_DELETE:
37815/// case CHANGE_TRUST_NOT_AUTH_MAINTAIN_LIABILITIES:
37816///     void;
37817/// };
37818/// ```
37819///
37820// union with discriminant ChangeTrustResultCode
37821#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
37822#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
37823#[cfg_attr(
37824    all(feature = "serde", feature = "alloc"),
37825    derive(serde::Serialize, serde::Deserialize),
37826    serde(rename_all = "snake_case")
37827)]
37828#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
37829#[allow(clippy::large_enum_variant)]
37830pub enum ChangeTrustResult {
37831    Success,
37832    Malformed,
37833    NoIssuer,
37834    InvalidLimit,
37835    LowReserve,
37836    SelfNotAllowed,
37837    TrustLineMissing,
37838    CannotDelete,
37839    NotAuthMaintainLiabilities,
37840}
37841
37842impl ChangeTrustResult {
37843    pub const VARIANTS: [ChangeTrustResultCode; 9] = [
37844        ChangeTrustResultCode::Success,
37845        ChangeTrustResultCode::Malformed,
37846        ChangeTrustResultCode::NoIssuer,
37847        ChangeTrustResultCode::InvalidLimit,
37848        ChangeTrustResultCode::LowReserve,
37849        ChangeTrustResultCode::SelfNotAllowed,
37850        ChangeTrustResultCode::TrustLineMissing,
37851        ChangeTrustResultCode::CannotDelete,
37852        ChangeTrustResultCode::NotAuthMaintainLiabilities,
37853    ];
37854    pub const VARIANTS_STR: [&'static str; 9] = [
37855        "Success",
37856        "Malformed",
37857        "NoIssuer",
37858        "InvalidLimit",
37859        "LowReserve",
37860        "SelfNotAllowed",
37861        "TrustLineMissing",
37862        "CannotDelete",
37863        "NotAuthMaintainLiabilities",
37864    ];
37865
37866    #[must_use]
37867    pub const fn name(&self) -> &'static str {
37868        match self {
37869            Self::Success => "Success",
37870            Self::Malformed => "Malformed",
37871            Self::NoIssuer => "NoIssuer",
37872            Self::InvalidLimit => "InvalidLimit",
37873            Self::LowReserve => "LowReserve",
37874            Self::SelfNotAllowed => "SelfNotAllowed",
37875            Self::TrustLineMissing => "TrustLineMissing",
37876            Self::CannotDelete => "CannotDelete",
37877            Self::NotAuthMaintainLiabilities => "NotAuthMaintainLiabilities",
37878        }
37879    }
37880
37881    #[must_use]
37882    pub const fn discriminant(&self) -> ChangeTrustResultCode {
37883        #[allow(clippy::match_same_arms)]
37884        match self {
37885            Self::Success => ChangeTrustResultCode::Success,
37886            Self::Malformed => ChangeTrustResultCode::Malformed,
37887            Self::NoIssuer => ChangeTrustResultCode::NoIssuer,
37888            Self::InvalidLimit => ChangeTrustResultCode::InvalidLimit,
37889            Self::LowReserve => ChangeTrustResultCode::LowReserve,
37890            Self::SelfNotAllowed => ChangeTrustResultCode::SelfNotAllowed,
37891            Self::TrustLineMissing => ChangeTrustResultCode::TrustLineMissing,
37892            Self::CannotDelete => ChangeTrustResultCode::CannotDelete,
37893            Self::NotAuthMaintainLiabilities => ChangeTrustResultCode::NotAuthMaintainLiabilities,
37894        }
37895    }
37896
37897    #[must_use]
37898    pub const fn variants() -> [ChangeTrustResultCode; 9] {
37899        Self::VARIANTS
37900    }
37901}
37902
37903impl Name for ChangeTrustResult {
37904    #[must_use]
37905    fn name(&self) -> &'static str {
37906        Self::name(self)
37907    }
37908}
37909
37910impl Discriminant<ChangeTrustResultCode> for ChangeTrustResult {
37911    #[must_use]
37912    fn discriminant(&self) -> ChangeTrustResultCode {
37913        Self::discriminant(self)
37914    }
37915}
37916
37917impl Variants<ChangeTrustResultCode> for ChangeTrustResult {
37918    fn variants() -> slice::Iter<'static, ChangeTrustResultCode> {
37919        Self::VARIANTS.iter()
37920    }
37921}
37922
37923impl Union<ChangeTrustResultCode> for ChangeTrustResult {}
37924
37925impl ReadXdr for ChangeTrustResult {
37926    #[cfg(feature = "std")]
37927    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
37928        r.with_limited_depth(|r| {
37929            let dv: ChangeTrustResultCode = <ChangeTrustResultCode as ReadXdr>::read_xdr(r)?;
37930            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
37931            let v = match dv {
37932                ChangeTrustResultCode::Success => Self::Success,
37933                ChangeTrustResultCode::Malformed => Self::Malformed,
37934                ChangeTrustResultCode::NoIssuer => Self::NoIssuer,
37935                ChangeTrustResultCode::InvalidLimit => Self::InvalidLimit,
37936                ChangeTrustResultCode::LowReserve => Self::LowReserve,
37937                ChangeTrustResultCode::SelfNotAllowed => Self::SelfNotAllowed,
37938                ChangeTrustResultCode::TrustLineMissing => Self::TrustLineMissing,
37939                ChangeTrustResultCode::CannotDelete => Self::CannotDelete,
37940                ChangeTrustResultCode::NotAuthMaintainLiabilities => {
37941                    Self::NotAuthMaintainLiabilities
37942                }
37943                #[allow(unreachable_patterns)]
37944                _ => return Err(Error::Invalid),
37945            };
37946            Ok(v)
37947        })
37948    }
37949}
37950
37951impl WriteXdr for ChangeTrustResult {
37952    #[cfg(feature = "std")]
37953    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
37954        w.with_limited_depth(|w| {
37955            self.discriminant().write_xdr(w)?;
37956            #[allow(clippy::match_same_arms)]
37957            match self {
37958                Self::Success => ().write_xdr(w)?,
37959                Self::Malformed => ().write_xdr(w)?,
37960                Self::NoIssuer => ().write_xdr(w)?,
37961                Self::InvalidLimit => ().write_xdr(w)?,
37962                Self::LowReserve => ().write_xdr(w)?,
37963                Self::SelfNotAllowed => ().write_xdr(w)?,
37964                Self::TrustLineMissing => ().write_xdr(w)?,
37965                Self::CannotDelete => ().write_xdr(w)?,
37966                Self::NotAuthMaintainLiabilities => ().write_xdr(w)?,
37967            };
37968            Ok(())
37969        })
37970    }
37971}
37972
37973/// AllowTrustResultCode is an XDR Enum defines as:
37974///
37975/// ```text
37976/// enum AllowTrustResultCode
37977/// {
37978///     // codes considered as "success" for the operation
37979///     ALLOW_TRUST_SUCCESS = 0,
37980///     // codes considered as "failure" for the operation
37981///     ALLOW_TRUST_MALFORMED = -1,     // asset is not ASSET_TYPE_ALPHANUM
37982///     ALLOW_TRUST_NO_TRUST_LINE = -2, // trustor does not have a trustline
37983///                                     // source account does not require trust
37984///     ALLOW_TRUST_TRUST_NOT_REQUIRED = -3,
37985///     ALLOW_TRUST_CANT_REVOKE = -4,      // source account can't revoke trust,
37986///     ALLOW_TRUST_SELF_NOT_ALLOWED = -5, // trusting self is not allowed
37987///     ALLOW_TRUST_LOW_RESERVE = -6       // claimable balances can't be created
37988///                                        // on revoke due to low reserves
37989/// };
37990/// ```
37991///
37992// enum
37993#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
37994#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
37995#[cfg_attr(
37996    all(feature = "serde", feature = "alloc"),
37997    derive(serde::Serialize, serde::Deserialize),
37998    serde(rename_all = "snake_case")
37999)]
38000#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
38001#[repr(i32)]
38002pub enum AllowTrustResultCode {
38003    Success = 0,
38004    Malformed = -1,
38005    NoTrustLine = -2,
38006    TrustNotRequired = -3,
38007    CantRevoke = -4,
38008    SelfNotAllowed = -5,
38009    LowReserve = -6,
38010}
38011
38012impl AllowTrustResultCode {
38013    pub const VARIANTS: [AllowTrustResultCode; 7] = [
38014        AllowTrustResultCode::Success,
38015        AllowTrustResultCode::Malformed,
38016        AllowTrustResultCode::NoTrustLine,
38017        AllowTrustResultCode::TrustNotRequired,
38018        AllowTrustResultCode::CantRevoke,
38019        AllowTrustResultCode::SelfNotAllowed,
38020        AllowTrustResultCode::LowReserve,
38021    ];
38022    pub const VARIANTS_STR: [&'static str; 7] = [
38023        "Success",
38024        "Malformed",
38025        "NoTrustLine",
38026        "TrustNotRequired",
38027        "CantRevoke",
38028        "SelfNotAllowed",
38029        "LowReserve",
38030    ];
38031
38032    #[must_use]
38033    pub const fn name(&self) -> &'static str {
38034        match self {
38035            Self::Success => "Success",
38036            Self::Malformed => "Malformed",
38037            Self::NoTrustLine => "NoTrustLine",
38038            Self::TrustNotRequired => "TrustNotRequired",
38039            Self::CantRevoke => "CantRevoke",
38040            Self::SelfNotAllowed => "SelfNotAllowed",
38041            Self::LowReserve => "LowReserve",
38042        }
38043    }
38044
38045    #[must_use]
38046    pub const fn variants() -> [AllowTrustResultCode; 7] {
38047        Self::VARIANTS
38048    }
38049}
38050
38051impl Name for AllowTrustResultCode {
38052    #[must_use]
38053    fn name(&self) -> &'static str {
38054        Self::name(self)
38055    }
38056}
38057
38058impl Variants<AllowTrustResultCode> for AllowTrustResultCode {
38059    fn variants() -> slice::Iter<'static, AllowTrustResultCode> {
38060        Self::VARIANTS.iter()
38061    }
38062}
38063
38064impl Enum for AllowTrustResultCode {}
38065
38066impl fmt::Display for AllowTrustResultCode {
38067    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
38068        f.write_str(self.name())
38069    }
38070}
38071
38072impl TryFrom<i32> for AllowTrustResultCode {
38073    type Error = Error;
38074
38075    fn try_from(i: i32) -> Result<Self> {
38076        let e = match i {
38077            0 => AllowTrustResultCode::Success,
38078            -1 => AllowTrustResultCode::Malformed,
38079            -2 => AllowTrustResultCode::NoTrustLine,
38080            -3 => AllowTrustResultCode::TrustNotRequired,
38081            -4 => AllowTrustResultCode::CantRevoke,
38082            -5 => AllowTrustResultCode::SelfNotAllowed,
38083            -6 => AllowTrustResultCode::LowReserve,
38084            #[allow(unreachable_patterns)]
38085            _ => return Err(Error::Invalid),
38086        };
38087        Ok(e)
38088    }
38089}
38090
38091impl From<AllowTrustResultCode> for i32 {
38092    #[must_use]
38093    fn from(e: AllowTrustResultCode) -> Self {
38094        e as Self
38095    }
38096}
38097
38098impl ReadXdr for AllowTrustResultCode {
38099    #[cfg(feature = "std")]
38100    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
38101        r.with_limited_depth(|r| {
38102            let e = i32::read_xdr(r)?;
38103            let v: Self = e.try_into()?;
38104            Ok(v)
38105        })
38106    }
38107}
38108
38109impl WriteXdr for AllowTrustResultCode {
38110    #[cfg(feature = "std")]
38111    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
38112        w.with_limited_depth(|w| {
38113            let i: i32 = (*self).into();
38114            i.write_xdr(w)
38115        })
38116    }
38117}
38118
38119/// AllowTrustResult is an XDR Union defines as:
38120///
38121/// ```text
38122/// union AllowTrustResult switch (AllowTrustResultCode code)
38123/// {
38124/// case ALLOW_TRUST_SUCCESS:
38125///     void;
38126/// case ALLOW_TRUST_MALFORMED:
38127/// case ALLOW_TRUST_NO_TRUST_LINE:
38128/// case ALLOW_TRUST_TRUST_NOT_REQUIRED:
38129/// case ALLOW_TRUST_CANT_REVOKE:
38130/// case ALLOW_TRUST_SELF_NOT_ALLOWED:
38131/// case ALLOW_TRUST_LOW_RESERVE:
38132///     void;
38133/// };
38134/// ```
38135///
38136// union with discriminant AllowTrustResultCode
38137#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
38138#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
38139#[cfg_attr(
38140    all(feature = "serde", feature = "alloc"),
38141    derive(serde::Serialize, serde::Deserialize),
38142    serde(rename_all = "snake_case")
38143)]
38144#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
38145#[allow(clippy::large_enum_variant)]
38146pub enum AllowTrustResult {
38147    Success,
38148    Malformed,
38149    NoTrustLine,
38150    TrustNotRequired,
38151    CantRevoke,
38152    SelfNotAllowed,
38153    LowReserve,
38154}
38155
38156impl AllowTrustResult {
38157    pub const VARIANTS: [AllowTrustResultCode; 7] = [
38158        AllowTrustResultCode::Success,
38159        AllowTrustResultCode::Malformed,
38160        AllowTrustResultCode::NoTrustLine,
38161        AllowTrustResultCode::TrustNotRequired,
38162        AllowTrustResultCode::CantRevoke,
38163        AllowTrustResultCode::SelfNotAllowed,
38164        AllowTrustResultCode::LowReserve,
38165    ];
38166    pub const VARIANTS_STR: [&'static str; 7] = [
38167        "Success",
38168        "Malformed",
38169        "NoTrustLine",
38170        "TrustNotRequired",
38171        "CantRevoke",
38172        "SelfNotAllowed",
38173        "LowReserve",
38174    ];
38175
38176    #[must_use]
38177    pub const fn name(&self) -> &'static str {
38178        match self {
38179            Self::Success => "Success",
38180            Self::Malformed => "Malformed",
38181            Self::NoTrustLine => "NoTrustLine",
38182            Self::TrustNotRequired => "TrustNotRequired",
38183            Self::CantRevoke => "CantRevoke",
38184            Self::SelfNotAllowed => "SelfNotAllowed",
38185            Self::LowReserve => "LowReserve",
38186        }
38187    }
38188
38189    #[must_use]
38190    pub const fn discriminant(&self) -> AllowTrustResultCode {
38191        #[allow(clippy::match_same_arms)]
38192        match self {
38193            Self::Success => AllowTrustResultCode::Success,
38194            Self::Malformed => AllowTrustResultCode::Malformed,
38195            Self::NoTrustLine => AllowTrustResultCode::NoTrustLine,
38196            Self::TrustNotRequired => AllowTrustResultCode::TrustNotRequired,
38197            Self::CantRevoke => AllowTrustResultCode::CantRevoke,
38198            Self::SelfNotAllowed => AllowTrustResultCode::SelfNotAllowed,
38199            Self::LowReserve => AllowTrustResultCode::LowReserve,
38200        }
38201    }
38202
38203    #[must_use]
38204    pub const fn variants() -> [AllowTrustResultCode; 7] {
38205        Self::VARIANTS
38206    }
38207}
38208
38209impl Name for AllowTrustResult {
38210    #[must_use]
38211    fn name(&self) -> &'static str {
38212        Self::name(self)
38213    }
38214}
38215
38216impl Discriminant<AllowTrustResultCode> for AllowTrustResult {
38217    #[must_use]
38218    fn discriminant(&self) -> AllowTrustResultCode {
38219        Self::discriminant(self)
38220    }
38221}
38222
38223impl Variants<AllowTrustResultCode> for AllowTrustResult {
38224    fn variants() -> slice::Iter<'static, AllowTrustResultCode> {
38225        Self::VARIANTS.iter()
38226    }
38227}
38228
38229impl Union<AllowTrustResultCode> for AllowTrustResult {}
38230
38231impl ReadXdr for AllowTrustResult {
38232    #[cfg(feature = "std")]
38233    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
38234        r.with_limited_depth(|r| {
38235            let dv: AllowTrustResultCode = <AllowTrustResultCode as ReadXdr>::read_xdr(r)?;
38236            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
38237            let v = match dv {
38238                AllowTrustResultCode::Success => Self::Success,
38239                AllowTrustResultCode::Malformed => Self::Malformed,
38240                AllowTrustResultCode::NoTrustLine => Self::NoTrustLine,
38241                AllowTrustResultCode::TrustNotRequired => Self::TrustNotRequired,
38242                AllowTrustResultCode::CantRevoke => Self::CantRevoke,
38243                AllowTrustResultCode::SelfNotAllowed => Self::SelfNotAllowed,
38244                AllowTrustResultCode::LowReserve => Self::LowReserve,
38245                #[allow(unreachable_patterns)]
38246                _ => return Err(Error::Invalid),
38247            };
38248            Ok(v)
38249        })
38250    }
38251}
38252
38253impl WriteXdr for AllowTrustResult {
38254    #[cfg(feature = "std")]
38255    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
38256        w.with_limited_depth(|w| {
38257            self.discriminant().write_xdr(w)?;
38258            #[allow(clippy::match_same_arms)]
38259            match self {
38260                Self::Success => ().write_xdr(w)?,
38261                Self::Malformed => ().write_xdr(w)?,
38262                Self::NoTrustLine => ().write_xdr(w)?,
38263                Self::TrustNotRequired => ().write_xdr(w)?,
38264                Self::CantRevoke => ().write_xdr(w)?,
38265                Self::SelfNotAllowed => ().write_xdr(w)?,
38266                Self::LowReserve => ().write_xdr(w)?,
38267            };
38268            Ok(())
38269        })
38270    }
38271}
38272
38273/// AccountMergeResultCode is an XDR Enum defines as:
38274///
38275/// ```text
38276/// enum AccountMergeResultCode
38277/// {
38278///     // codes considered as "success" for the operation
38279///     ACCOUNT_MERGE_SUCCESS = 0,
38280///     // codes considered as "failure" for the operation
38281///     ACCOUNT_MERGE_MALFORMED = -1,       // can't merge onto itself
38282///     ACCOUNT_MERGE_NO_ACCOUNT = -2,      // destination does not exist
38283///     ACCOUNT_MERGE_IMMUTABLE_SET = -3,   // source account has AUTH_IMMUTABLE set
38284///     ACCOUNT_MERGE_HAS_SUB_ENTRIES = -4, // account has trust lines/offers
38285///     ACCOUNT_MERGE_SEQNUM_TOO_FAR = -5,  // sequence number is over max allowed
38286///     ACCOUNT_MERGE_DEST_FULL = -6,       // can't add source balance to
38287///                                         // destination balance
38288///     ACCOUNT_MERGE_IS_SPONSOR = -7       // can't merge account that is a sponsor
38289/// };
38290/// ```
38291///
38292// enum
38293#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
38294#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
38295#[cfg_attr(
38296    all(feature = "serde", feature = "alloc"),
38297    derive(serde::Serialize, serde::Deserialize),
38298    serde(rename_all = "snake_case")
38299)]
38300#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
38301#[repr(i32)]
38302pub enum AccountMergeResultCode {
38303    Success = 0,
38304    Malformed = -1,
38305    NoAccount = -2,
38306    ImmutableSet = -3,
38307    HasSubEntries = -4,
38308    SeqnumTooFar = -5,
38309    DestFull = -6,
38310    IsSponsor = -7,
38311}
38312
38313impl AccountMergeResultCode {
38314    pub const VARIANTS: [AccountMergeResultCode; 8] = [
38315        AccountMergeResultCode::Success,
38316        AccountMergeResultCode::Malformed,
38317        AccountMergeResultCode::NoAccount,
38318        AccountMergeResultCode::ImmutableSet,
38319        AccountMergeResultCode::HasSubEntries,
38320        AccountMergeResultCode::SeqnumTooFar,
38321        AccountMergeResultCode::DestFull,
38322        AccountMergeResultCode::IsSponsor,
38323    ];
38324    pub const VARIANTS_STR: [&'static str; 8] = [
38325        "Success",
38326        "Malformed",
38327        "NoAccount",
38328        "ImmutableSet",
38329        "HasSubEntries",
38330        "SeqnumTooFar",
38331        "DestFull",
38332        "IsSponsor",
38333    ];
38334
38335    #[must_use]
38336    pub const fn name(&self) -> &'static str {
38337        match self {
38338            Self::Success => "Success",
38339            Self::Malformed => "Malformed",
38340            Self::NoAccount => "NoAccount",
38341            Self::ImmutableSet => "ImmutableSet",
38342            Self::HasSubEntries => "HasSubEntries",
38343            Self::SeqnumTooFar => "SeqnumTooFar",
38344            Self::DestFull => "DestFull",
38345            Self::IsSponsor => "IsSponsor",
38346        }
38347    }
38348
38349    #[must_use]
38350    pub const fn variants() -> [AccountMergeResultCode; 8] {
38351        Self::VARIANTS
38352    }
38353}
38354
38355impl Name for AccountMergeResultCode {
38356    #[must_use]
38357    fn name(&self) -> &'static str {
38358        Self::name(self)
38359    }
38360}
38361
38362impl Variants<AccountMergeResultCode> for AccountMergeResultCode {
38363    fn variants() -> slice::Iter<'static, AccountMergeResultCode> {
38364        Self::VARIANTS.iter()
38365    }
38366}
38367
38368impl Enum for AccountMergeResultCode {}
38369
38370impl fmt::Display for AccountMergeResultCode {
38371    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
38372        f.write_str(self.name())
38373    }
38374}
38375
38376impl TryFrom<i32> for AccountMergeResultCode {
38377    type Error = Error;
38378
38379    fn try_from(i: i32) -> Result<Self> {
38380        let e = match i {
38381            0 => AccountMergeResultCode::Success,
38382            -1 => AccountMergeResultCode::Malformed,
38383            -2 => AccountMergeResultCode::NoAccount,
38384            -3 => AccountMergeResultCode::ImmutableSet,
38385            -4 => AccountMergeResultCode::HasSubEntries,
38386            -5 => AccountMergeResultCode::SeqnumTooFar,
38387            -6 => AccountMergeResultCode::DestFull,
38388            -7 => AccountMergeResultCode::IsSponsor,
38389            #[allow(unreachable_patterns)]
38390            _ => return Err(Error::Invalid),
38391        };
38392        Ok(e)
38393    }
38394}
38395
38396impl From<AccountMergeResultCode> for i32 {
38397    #[must_use]
38398    fn from(e: AccountMergeResultCode) -> Self {
38399        e as Self
38400    }
38401}
38402
38403impl ReadXdr for AccountMergeResultCode {
38404    #[cfg(feature = "std")]
38405    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
38406        r.with_limited_depth(|r| {
38407            let e = i32::read_xdr(r)?;
38408            let v: Self = e.try_into()?;
38409            Ok(v)
38410        })
38411    }
38412}
38413
38414impl WriteXdr for AccountMergeResultCode {
38415    #[cfg(feature = "std")]
38416    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
38417        w.with_limited_depth(|w| {
38418            let i: i32 = (*self).into();
38419            i.write_xdr(w)
38420        })
38421    }
38422}
38423
38424/// AccountMergeResult is an XDR Union defines as:
38425///
38426/// ```text
38427/// union AccountMergeResult switch (AccountMergeResultCode code)
38428/// {
38429/// case ACCOUNT_MERGE_SUCCESS:
38430///     int64 sourceAccountBalance; // how much got transferred from source account
38431/// case ACCOUNT_MERGE_MALFORMED:
38432/// case ACCOUNT_MERGE_NO_ACCOUNT:
38433/// case ACCOUNT_MERGE_IMMUTABLE_SET:
38434/// case ACCOUNT_MERGE_HAS_SUB_ENTRIES:
38435/// case ACCOUNT_MERGE_SEQNUM_TOO_FAR:
38436/// case ACCOUNT_MERGE_DEST_FULL:
38437/// case ACCOUNT_MERGE_IS_SPONSOR:
38438///     void;
38439/// };
38440/// ```
38441///
38442// union with discriminant AccountMergeResultCode
38443#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
38444#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
38445#[cfg_attr(
38446    all(feature = "serde", feature = "alloc"),
38447    derive(serde::Serialize, serde::Deserialize),
38448    serde(rename_all = "snake_case")
38449)]
38450#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
38451#[allow(clippy::large_enum_variant)]
38452pub enum AccountMergeResult {
38453    Success(i64),
38454    Malformed,
38455    NoAccount,
38456    ImmutableSet,
38457    HasSubEntries,
38458    SeqnumTooFar,
38459    DestFull,
38460    IsSponsor,
38461}
38462
38463impl AccountMergeResult {
38464    pub const VARIANTS: [AccountMergeResultCode; 8] = [
38465        AccountMergeResultCode::Success,
38466        AccountMergeResultCode::Malformed,
38467        AccountMergeResultCode::NoAccount,
38468        AccountMergeResultCode::ImmutableSet,
38469        AccountMergeResultCode::HasSubEntries,
38470        AccountMergeResultCode::SeqnumTooFar,
38471        AccountMergeResultCode::DestFull,
38472        AccountMergeResultCode::IsSponsor,
38473    ];
38474    pub const VARIANTS_STR: [&'static str; 8] = [
38475        "Success",
38476        "Malformed",
38477        "NoAccount",
38478        "ImmutableSet",
38479        "HasSubEntries",
38480        "SeqnumTooFar",
38481        "DestFull",
38482        "IsSponsor",
38483    ];
38484
38485    #[must_use]
38486    pub const fn name(&self) -> &'static str {
38487        match self {
38488            Self::Success(_) => "Success",
38489            Self::Malformed => "Malformed",
38490            Self::NoAccount => "NoAccount",
38491            Self::ImmutableSet => "ImmutableSet",
38492            Self::HasSubEntries => "HasSubEntries",
38493            Self::SeqnumTooFar => "SeqnumTooFar",
38494            Self::DestFull => "DestFull",
38495            Self::IsSponsor => "IsSponsor",
38496        }
38497    }
38498
38499    #[must_use]
38500    pub const fn discriminant(&self) -> AccountMergeResultCode {
38501        #[allow(clippy::match_same_arms)]
38502        match self {
38503            Self::Success(_) => AccountMergeResultCode::Success,
38504            Self::Malformed => AccountMergeResultCode::Malformed,
38505            Self::NoAccount => AccountMergeResultCode::NoAccount,
38506            Self::ImmutableSet => AccountMergeResultCode::ImmutableSet,
38507            Self::HasSubEntries => AccountMergeResultCode::HasSubEntries,
38508            Self::SeqnumTooFar => AccountMergeResultCode::SeqnumTooFar,
38509            Self::DestFull => AccountMergeResultCode::DestFull,
38510            Self::IsSponsor => AccountMergeResultCode::IsSponsor,
38511        }
38512    }
38513
38514    #[must_use]
38515    pub const fn variants() -> [AccountMergeResultCode; 8] {
38516        Self::VARIANTS
38517    }
38518}
38519
38520impl Name for AccountMergeResult {
38521    #[must_use]
38522    fn name(&self) -> &'static str {
38523        Self::name(self)
38524    }
38525}
38526
38527impl Discriminant<AccountMergeResultCode> for AccountMergeResult {
38528    #[must_use]
38529    fn discriminant(&self) -> AccountMergeResultCode {
38530        Self::discriminant(self)
38531    }
38532}
38533
38534impl Variants<AccountMergeResultCode> for AccountMergeResult {
38535    fn variants() -> slice::Iter<'static, AccountMergeResultCode> {
38536        Self::VARIANTS.iter()
38537    }
38538}
38539
38540impl Union<AccountMergeResultCode> for AccountMergeResult {}
38541
38542impl ReadXdr for AccountMergeResult {
38543    #[cfg(feature = "std")]
38544    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
38545        r.with_limited_depth(|r| {
38546            let dv: AccountMergeResultCode = <AccountMergeResultCode as ReadXdr>::read_xdr(r)?;
38547            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
38548            let v = match dv {
38549                AccountMergeResultCode::Success => Self::Success(i64::read_xdr(r)?),
38550                AccountMergeResultCode::Malformed => Self::Malformed,
38551                AccountMergeResultCode::NoAccount => Self::NoAccount,
38552                AccountMergeResultCode::ImmutableSet => Self::ImmutableSet,
38553                AccountMergeResultCode::HasSubEntries => Self::HasSubEntries,
38554                AccountMergeResultCode::SeqnumTooFar => Self::SeqnumTooFar,
38555                AccountMergeResultCode::DestFull => Self::DestFull,
38556                AccountMergeResultCode::IsSponsor => Self::IsSponsor,
38557                #[allow(unreachable_patterns)]
38558                _ => return Err(Error::Invalid),
38559            };
38560            Ok(v)
38561        })
38562    }
38563}
38564
38565impl WriteXdr for AccountMergeResult {
38566    #[cfg(feature = "std")]
38567    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
38568        w.with_limited_depth(|w| {
38569            self.discriminant().write_xdr(w)?;
38570            #[allow(clippy::match_same_arms)]
38571            match self {
38572                Self::Success(v) => v.write_xdr(w)?,
38573                Self::Malformed => ().write_xdr(w)?,
38574                Self::NoAccount => ().write_xdr(w)?,
38575                Self::ImmutableSet => ().write_xdr(w)?,
38576                Self::HasSubEntries => ().write_xdr(w)?,
38577                Self::SeqnumTooFar => ().write_xdr(w)?,
38578                Self::DestFull => ().write_xdr(w)?,
38579                Self::IsSponsor => ().write_xdr(w)?,
38580            };
38581            Ok(())
38582        })
38583    }
38584}
38585
38586/// InflationResultCode is an XDR Enum defines as:
38587///
38588/// ```text
38589/// enum InflationResultCode
38590/// {
38591///     // codes considered as "success" for the operation
38592///     INFLATION_SUCCESS = 0,
38593///     // codes considered as "failure" for the operation
38594///     INFLATION_NOT_TIME = -1
38595/// };
38596/// ```
38597///
38598// enum
38599#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
38600#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
38601#[cfg_attr(
38602    all(feature = "serde", feature = "alloc"),
38603    derive(serde::Serialize, serde::Deserialize),
38604    serde(rename_all = "snake_case")
38605)]
38606#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
38607#[repr(i32)]
38608pub enum InflationResultCode {
38609    Success = 0,
38610    NotTime = -1,
38611}
38612
38613impl InflationResultCode {
38614    pub const VARIANTS: [InflationResultCode; 2] =
38615        [InflationResultCode::Success, InflationResultCode::NotTime];
38616    pub const VARIANTS_STR: [&'static str; 2] = ["Success", "NotTime"];
38617
38618    #[must_use]
38619    pub const fn name(&self) -> &'static str {
38620        match self {
38621            Self::Success => "Success",
38622            Self::NotTime => "NotTime",
38623        }
38624    }
38625
38626    #[must_use]
38627    pub const fn variants() -> [InflationResultCode; 2] {
38628        Self::VARIANTS
38629    }
38630}
38631
38632impl Name for InflationResultCode {
38633    #[must_use]
38634    fn name(&self) -> &'static str {
38635        Self::name(self)
38636    }
38637}
38638
38639impl Variants<InflationResultCode> for InflationResultCode {
38640    fn variants() -> slice::Iter<'static, InflationResultCode> {
38641        Self::VARIANTS.iter()
38642    }
38643}
38644
38645impl Enum for InflationResultCode {}
38646
38647impl fmt::Display for InflationResultCode {
38648    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
38649        f.write_str(self.name())
38650    }
38651}
38652
38653impl TryFrom<i32> for InflationResultCode {
38654    type Error = Error;
38655
38656    fn try_from(i: i32) -> Result<Self> {
38657        let e = match i {
38658            0 => InflationResultCode::Success,
38659            -1 => InflationResultCode::NotTime,
38660            #[allow(unreachable_patterns)]
38661            _ => return Err(Error::Invalid),
38662        };
38663        Ok(e)
38664    }
38665}
38666
38667impl From<InflationResultCode> for i32 {
38668    #[must_use]
38669    fn from(e: InflationResultCode) -> Self {
38670        e as Self
38671    }
38672}
38673
38674impl ReadXdr for InflationResultCode {
38675    #[cfg(feature = "std")]
38676    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
38677        r.with_limited_depth(|r| {
38678            let e = i32::read_xdr(r)?;
38679            let v: Self = e.try_into()?;
38680            Ok(v)
38681        })
38682    }
38683}
38684
38685impl WriteXdr for InflationResultCode {
38686    #[cfg(feature = "std")]
38687    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
38688        w.with_limited_depth(|w| {
38689            let i: i32 = (*self).into();
38690            i.write_xdr(w)
38691        })
38692    }
38693}
38694
38695/// InflationPayout is an XDR Struct defines as:
38696///
38697/// ```text
38698/// struct InflationPayout // or use PaymentResultAtom to limit types?
38699/// {
38700///     AccountID destination;
38701///     int64 amount;
38702/// };
38703/// ```
38704///
38705#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
38706#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
38707#[cfg_attr(
38708    all(feature = "serde", feature = "alloc"),
38709    derive(serde::Serialize, serde::Deserialize),
38710    serde(rename_all = "snake_case")
38711)]
38712#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
38713pub struct InflationPayout {
38714    pub destination: AccountId,
38715    pub amount: i64,
38716}
38717
38718impl ReadXdr for InflationPayout {
38719    #[cfg(feature = "std")]
38720    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
38721        r.with_limited_depth(|r| {
38722            Ok(Self {
38723                destination: AccountId::read_xdr(r)?,
38724                amount: i64::read_xdr(r)?,
38725            })
38726        })
38727    }
38728}
38729
38730impl WriteXdr for InflationPayout {
38731    #[cfg(feature = "std")]
38732    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
38733        w.with_limited_depth(|w| {
38734            self.destination.write_xdr(w)?;
38735            self.amount.write_xdr(w)?;
38736            Ok(())
38737        })
38738    }
38739}
38740
38741/// InflationResult is an XDR Union defines as:
38742///
38743/// ```text
38744/// union InflationResult switch (InflationResultCode code)
38745/// {
38746/// case INFLATION_SUCCESS:
38747///     InflationPayout payouts<>;
38748/// case INFLATION_NOT_TIME:
38749///     void;
38750/// };
38751/// ```
38752///
38753// union with discriminant InflationResultCode
38754#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
38755#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
38756#[cfg_attr(
38757    all(feature = "serde", feature = "alloc"),
38758    derive(serde::Serialize, serde::Deserialize),
38759    serde(rename_all = "snake_case")
38760)]
38761#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
38762#[allow(clippy::large_enum_variant)]
38763pub enum InflationResult {
38764    Success(VecM<InflationPayout>),
38765    NotTime,
38766}
38767
38768impl InflationResult {
38769    pub const VARIANTS: [InflationResultCode; 2] =
38770        [InflationResultCode::Success, InflationResultCode::NotTime];
38771    pub const VARIANTS_STR: [&'static str; 2] = ["Success", "NotTime"];
38772
38773    #[must_use]
38774    pub const fn name(&self) -> &'static str {
38775        match self {
38776            Self::Success(_) => "Success",
38777            Self::NotTime => "NotTime",
38778        }
38779    }
38780
38781    #[must_use]
38782    pub const fn discriminant(&self) -> InflationResultCode {
38783        #[allow(clippy::match_same_arms)]
38784        match self {
38785            Self::Success(_) => InflationResultCode::Success,
38786            Self::NotTime => InflationResultCode::NotTime,
38787        }
38788    }
38789
38790    #[must_use]
38791    pub const fn variants() -> [InflationResultCode; 2] {
38792        Self::VARIANTS
38793    }
38794}
38795
38796impl Name for InflationResult {
38797    #[must_use]
38798    fn name(&self) -> &'static str {
38799        Self::name(self)
38800    }
38801}
38802
38803impl Discriminant<InflationResultCode> for InflationResult {
38804    #[must_use]
38805    fn discriminant(&self) -> InflationResultCode {
38806        Self::discriminant(self)
38807    }
38808}
38809
38810impl Variants<InflationResultCode> for InflationResult {
38811    fn variants() -> slice::Iter<'static, InflationResultCode> {
38812        Self::VARIANTS.iter()
38813    }
38814}
38815
38816impl Union<InflationResultCode> for InflationResult {}
38817
38818impl ReadXdr for InflationResult {
38819    #[cfg(feature = "std")]
38820    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
38821        r.with_limited_depth(|r| {
38822            let dv: InflationResultCode = <InflationResultCode as ReadXdr>::read_xdr(r)?;
38823            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
38824            let v = match dv {
38825                InflationResultCode::Success => {
38826                    Self::Success(VecM::<InflationPayout>::read_xdr(r)?)
38827                }
38828                InflationResultCode::NotTime => Self::NotTime,
38829                #[allow(unreachable_patterns)]
38830                _ => return Err(Error::Invalid),
38831            };
38832            Ok(v)
38833        })
38834    }
38835}
38836
38837impl WriteXdr for InflationResult {
38838    #[cfg(feature = "std")]
38839    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
38840        w.with_limited_depth(|w| {
38841            self.discriminant().write_xdr(w)?;
38842            #[allow(clippy::match_same_arms)]
38843            match self {
38844                Self::Success(v) => v.write_xdr(w)?,
38845                Self::NotTime => ().write_xdr(w)?,
38846            };
38847            Ok(())
38848        })
38849    }
38850}
38851
38852/// ManageDataResultCode is an XDR Enum defines as:
38853///
38854/// ```text
38855/// enum ManageDataResultCode
38856/// {
38857///     // codes considered as "success" for the operation
38858///     MANAGE_DATA_SUCCESS = 0,
38859///     // codes considered as "failure" for the operation
38860///     MANAGE_DATA_NOT_SUPPORTED_YET =
38861///         -1, // The network hasn't moved to this protocol change yet
38862///     MANAGE_DATA_NAME_NOT_FOUND =
38863///         -2, // Trying to remove a Data Entry that isn't there
38864///     MANAGE_DATA_LOW_RESERVE = -3, // not enough funds to create a new Data Entry
38865///     MANAGE_DATA_INVALID_NAME = -4 // Name not a valid string
38866/// };
38867/// ```
38868///
38869// enum
38870#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
38871#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
38872#[cfg_attr(
38873    all(feature = "serde", feature = "alloc"),
38874    derive(serde::Serialize, serde::Deserialize),
38875    serde(rename_all = "snake_case")
38876)]
38877#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
38878#[repr(i32)]
38879pub enum ManageDataResultCode {
38880    Success = 0,
38881    NotSupportedYet = -1,
38882    NameNotFound = -2,
38883    LowReserve = -3,
38884    InvalidName = -4,
38885}
38886
38887impl ManageDataResultCode {
38888    pub const VARIANTS: [ManageDataResultCode; 5] = [
38889        ManageDataResultCode::Success,
38890        ManageDataResultCode::NotSupportedYet,
38891        ManageDataResultCode::NameNotFound,
38892        ManageDataResultCode::LowReserve,
38893        ManageDataResultCode::InvalidName,
38894    ];
38895    pub const VARIANTS_STR: [&'static str; 5] = [
38896        "Success",
38897        "NotSupportedYet",
38898        "NameNotFound",
38899        "LowReserve",
38900        "InvalidName",
38901    ];
38902
38903    #[must_use]
38904    pub const fn name(&self) -> &'static str {
38905        match self {
38906            Self::Success => "Success",
38907            Self::NotSupportedYet => "NotSupportedYet",
38908            Self::NameNotFound => "NameNotFound",
38909            Self::LowReserve => "LowReserve",
38910            Self::InvalidName => "InvalidName",
38911        }
38912    }
38913
38914    #[must_use]
38915    pub const fn variants() -> [ManageDataResultCode; 5] {
38916        Self::VARIANTS
38917    }
38918}
38919
38920impl Name for ManageDataResultCode {
38921    #[must_use]
38922    fn name(&self) -> &'static str {
38923        Self::name(self)
38924    }
38925}
38926
38927impl Variants<ManageDataResultCode> for ManageDataResultCode {
38928    fn variants() -> slice::Iter<'static, ManageDataResultCode> {
38929        Self::VARIANTS.iter()
38930    }
38931}
38932
38933impl Enum for ManageDataResultCode {}
38934
38935impl fmt::Display for ManageDataResultCode {
38936    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
38937        f.write_str(self.name())
38938    }
38939}
38940
38941impl TryFrom<i32> for ManageDataResultCode {
38942    type Error = Error;
38943
38944    fn try_from(i: i32) -> Result<Self> {
38945        let e = match i {
38946            0 => ManageDataResultCode::Success,
38947            -1 => ManageDataResultCode::NotSupportedYet,
38948            -2 => ManageDataResultCode::NameNotFound,
38949            -3 => ManageDataResultCode::LowReserve,
38950            -4 => ManageDataResultCode::InvalidName,
38951            #[allow(unreachable_patterns)]
38952            _ => return Err(Error::Invalid),
38953        };
38954        Ok(e)
38955    }
38956}
38957
38958impl From<ManageDataResultCode> for i32 {
38959    #[must_use]
38960    fn from(e: ManageDataResultCode) -> Self {
38961        e as Self
38962    }
38963}
38964
38965impl ReadXdr for ManageDataResultCode {
38966    #[cfg(feature = "std")]
38967    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
38968        r.with_limited_depth(|r| {
38969            let e = i32::read_xdr(r)?;
38970            let v: Self = e.try_into()?;
38971            Ok(v)
38972        })
38973    }
38974}
38975
38976impl WriteXdr for ManageDataResultCode {
38977    #[cfg(feature = "std")]
38978    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
38979        w.with_limited_depth(|w| {
38980            let i: i32 = (*self).into();
38981            i.write_xdr(w)
38982        })
38983    }
38984}
38985
38986/// ManageDataResult is an XDR Union defines as:
38987///
38988/// ```text
38989/// union ManageDataResult switch (ManageDataResultCode code)
38990/// {
38991/// case MANAGE_DATA_SUCCESS:
38992///     void;
38993/// case MANAGE_DATA_NOT_SUPPORTED_YET:
38994/// case MANAGE_DATA_NAME_NOT_FOUND:
38995/// case MANAGE_DATA_LOW_RESERVE:
38996/// case MANAGE_DATA_INVALID_NAME:
38997///     void;
38998/// };
38999/// ```
39000///
39001// union with discriminant ManageDataResultCode
39002#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
39003#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
39004#[cfg_attr(
39005    all(feature = "serde", feature = "alloc"),
39006    derive(serde::Serialize, serde::Deserialize),
39007    serde(rename_all = "snake_case")
39008)]
39009#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
39010#[allow(clippy::large_enum_variant)]
39011pub enum ManageDataResult {
39012    Success,
39013    NotSupportedYet,
39014    NameNotFound,
39015    LowReserve,
39016    InvalidName,
39017}
39018
39019impl ManageDataResult {
39020    pub const VARIANTS: [ManageDataResultCode; 5] = [
39021        ManageDataResultCode::Success,
39022        ManageDataResultCode::NotSupportedYet,
39023        ManageDataResultCode::NameNotFound,
39024        ManageDataResultCode::LowReserve,
39025        ManageDataResultCode::InvalidName,
39026    ];
39027    pub const VARIANTS_STR: [&'static str; 5] = [
39028        "Success",
39029        "NotSupportedYet",
39030        "NameNotFound",
39031        "LowReserve",
39032        "InvalidName",
39033    ];
39034
39035    #[must_use]
39036    pub const fn name(&self) -> &'static str {
39037        match self {
39038            Self::Success => "Success",
39039            Self::NotSupportedYet => "NotSupportedYet",
39040            Self::NameNotFound => "NameNotFound",
39041            Self::LowReserve => "LowReserve",
39042            Self::InvalidName => "InvalidName",
39043        }
39044    }
39045
39046    #[must_use]
39047    pub const fn discriminant(&self) -> ManageDataResultCode {
39048        #[allow(clippy::match_same_arms)]
39049        match self {
39050            Self::Success => ManageDataResultCode::Success,
39051            Self::NotSupportedYet => ManageDataResultCode::NotSupportedYet,
39052            Self::NameNotFound => ManageDataResultCode::NameNotFound,
39053            Self::LowReserve => ManageDataResultCode::LowReserve,
39054            Self::InvalidName => ManageDataResultCode::InvalidName,
39055        }
39056    }
39057
39058    #[must_use]
39059    pub const fn variants() -> [ManageDataResultCode; 5] {
39060        Self::VARIANTS
39061    }
39062}
39063
39064impl Name for ManageDataResult {
39065    #[must_use]
39066    fn name(&self) -> &'static str {
39067        Self::name(self)
39068    }
39069}
39070
39071impl Discriminant<ManageDataResultCode> for ManageDataResult {
39072    #[must_use]
39073    fn discriminant(&self) -> ManageDataResultCode {
39074        Self::discriminant(self)
39075    }
39076}
39077
39078impl Variants<ManageDataResultCode> for ManageDataResult {
39079    fn variants() -> slice::Iter<'static, ManageDataResultCode> {
39080        Self::VARIANTS.iter()
39081    }
39082}
39083
39084impl Union<ManageDataResultCode> for ManageDataResult {}
39085
39086impl ReadXdr for ManageDataResult {
39087    #[cfg(feature = "std")]
39088    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
39089        r.with_limited_depth(|r| {
39090            let dv: ManageDataResultCode = <ManageDataResultCode as ReadXdr>::read_xdr(r)?;
39091            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
39092            let v = match dv {
39093                ManageDataResultCode::Success => Self::Success,
39094                ManageDataResultCode::NotSupportedYet => Self::NotSupportedYet,
39095                ManageDataResultCode::NameNotFound => Self::NameNotFound,
39096                ManageDataResultCode::LowReserve => Self::LowReserve,
39097                ManageDataResultCode::InvalidName => Self::InvalidName,
39098                #[allow(unreachable_patterns)]
39099                _ => return Err(Error::Invalid),
39100            };
39101            Ok(v)
39102        })
39103    }
39104}
39105
39106impl WriteXdr for ManageDataResult {
39107    #[cfg(feature = "std")]
39108    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
39109        w.with_limited_depth(|w| {
39110            self.discriminant().write_xdr(w)?;
39111            #[allow(clippy::match_same_arms)]
39112            match self {
39113                Self::Success => ().write_xdr(w)?,
39114                Self::NotSupportedYet => ().write_xdr(w)?,
39115                Self::NameNotFound => ().write_xdr(w)?,
39116                Self::LowReserve => ().write_xdr(w)?,
39117                Self::InvalidName => ().write_xdr(w)?,
39118            };
39119            Ok(())
39120        })
39121    }
39122}
39123
39124/// BumpSequenceResultCode is an XDR Enum defines as:
39125///
39126/// ```text
39127/// enum BumpSequenceResultCode
39128/// {
39129///     // codes considered as "success" for the operation
39130///     BUMP_SEQUENCE_SUCCESS = 0,
39131///     // codes considered as "failure" for the operation
39132///     BUMP_SEQUENCE_BAD_SEQ = -1 // `bumpTo` is not within bounds
39133/// };
39134/// ```
39135///
39136// enum
39137#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
39138#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
39139#[cfg_attr(
39140    all(feature = "serde", feature = "alloc"),
39141    derive(serde::Serialize, serde::Deserialize),
39142    serde(rename_all = "snake_case")
39143)]
39144#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
39145#[repr(i32)]
39146pub enum BumpSequenceResultCode {
39147    Success = 0,
39148    BadSeq = -1,
39149}
39150
39151impl BumpSequenceResultCode {
39152    pub const VARIANTS: [BumpSequenceResultCode; 2] = [
39153        BumpSequenceResultCode::Success,
39154        BumpSequenceResultCode::BadSeq,
39155    ];
39156    pub const VARIANTS_STR: [&'static str; 2] = ["Success", "BadSeq"];
39157
39158    #[must_use]
39159    pub const fn name(&self) -> &'static str {
39160        match self {
39161            Self::Success => "Success",
39162            Self::BadSeq => "BadSeq",
39163        }
39164    }
39165
39166    #[must_use]
39167    pub const fn variants() -> [BumpSequenceResultCode; 2] {
39168        Self::VARIANTS
39169    }
39170}
39171
39172impl Name for BumpSequenceResultCode {
39173    #[must_use]
39174    fn name(&self) -> &'static str {
39175        Self::name(self)
39176    }
39177}
39178
39179impl Variants<BumpSequenceResultCode> for BumpSequenceResultCode {
39180    fn variants() -> slice::Iter<'static, BumpSequenceResultCode> {
39181        Self::VARIANTS.iter()
39182    }
39183}
39184
39185impl Enum for BumpSequenceResultCode {}
39186
39187impl fmt::Display for BumpSequenceResultCode {
39188    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
39189        f.write_str(self.name())
39190    }
39191}
39192
39193impl TryFrom<i32> for BumpSequenceResultCode {
39194    type Error = Error;
39195
39196    fn try_from(i: i32) -> Result<Self> {
39197        let e = match i {
39198            0 => BumpSequenceResultCode::Success,
39199            -1 => BumpSequenceResultCode::BadSeq,
39200            #[allow(unreachable_patterns)]
39201            _ => return Err(Error::Invalid),
39202        };
39203        Ok(e)
39204    }
39205}
39206
39207impl From<BumpSequenceResultCode> for i32 {
39208    #[must_use]
39209    fn from(e: BumpSequenceResultCode) -> Self {
39210        e as Self
39211    }
39212}
39213
39214impl ReadXdr for BumpSequenceResultCode {
39215    #[cfg(feature = "std")]
39216    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
39217        r.with_limited_depth(|r| {
39218            let e = i32::read_xdr(r)?;
39219            let v: Self = e.try_into()?;
39220            Ok(v)
39221        })
39222    }
39223}
39224
39225impl WriteXdr for BumpSequenceResultCode {
39226    #[cfg(feature = "std")]
39227    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
39228        w.with_limited_depth(|w| {
39229            let i: i32 = (*self).into();
39230            i.write_xdr(w)
39231        })
39232    }
39233}
39234
39235/// BumpSequenceResult is an XDR Union defines as:
39236///
39237/// ```text
39238/// union BumpSequenceResult switch (BumpSequenceResultCode code)
39239/// {
39240/// case BUMP_SEQUENCE_SUCCESS:
39241///     void;
39242/// case BUMP_SEQUENCE_BAD_SEQ:
39243///     void;
39244/// };
39245/// ```
39246///
39247// union with discriminant BumpSequenceResultCode
39248#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
39249#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
39250#[cfg_attr(
39251    all(feature = "serde", feature = "alloc"),
39252    derive(serde::Serialize, serde::Deserialize),
39253    serde(rename_all = "snake_case")
39254)]
39255#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
39256#[allow(clippy::large_enum_variant)]
39257pub enum BumpSequenceResult {
39258    Success,
39259    BadSeq,
39260}
39261
39262impl BumpSequenceResult {
39263    pub const VARIANTS: [BumpSequenceResultCode; 2] = [
39264        BumpSequenceResultCode::Success,
39265        BumpSequenceResultCode::BadSeq,
39266    ];
39267    pub const VARIANTS_STR: [&'static str; 2] = ["Success", "BadSeq"];
39268
39269    #[must_use]
39270    pub const fn name(&self) -> &'static str {
39271        match self {
39272            Self::Success => "Success",
39273            Self::BadSeq => "BadSeq",
39274        }
39275    }
39276
39277    #[must_use]
39278    pub const fn discriminant(&self) -> BumpSequenceResultCode {
39279        #[allow(clippy::match_same_arms)]
39280        match self {
39281            Self::Success => BumpSequenceResultCode::Success,
39282            Self::BadSeq => BumpSequenceResultCode::BadSeq,
39283        }
39284    }
39285
39286    #[must_use]
39287    pub const fn variants() -> [BumpSequenceResultCode; 2] {
39288        Self::VARIANTS
39289    }
39290}
39291
39292impl Name for BumpSequenceResult {
39293    #[must_use]
39294    fn name(&self) -> &'static str {
39295        Self::name(self)
39296    }
39297}
39298
39299impl Discriminant<BumpSequenceResultCode> for BumpSequenceResult {
39300    #[must_use]
39301    fn discriminant(&self) -> BumpSequenceResultCode {
39302        Self::discriminant(self)
39303    }
39304}
39305
39306impl Variants<BumpSequenceResultCode> for BumpSequenceResult {
39307    fn variants() -> slice::Iter<'static, BumpSequenceResultCode> {
39308        Self::VARIANTS.iter()
39309    }
39310}
39311
39312impl Union<BumpSequenceResultCode> for BumpSequenceResult {}
39313
39314impl ReadXdr for BumpSequenceResult {
39315    #[cfg(feature = "std")]
39316    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
39317        r.with_limited_depth(|r| {
39318            let dv: BumpSequenceResultCode = <BumpSequenceResultCode as ReadXdr>::read_xdr(r)?;
39319            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
39320            let v = match dv {
39321                BumpSequenceResultCode::Success => Self::Success,
39322                BumpSequenceResultCode::BadSeq => Self::BadSeq,
39323                #[allow(unreachable_patterns)]
39324                _ => return Err(Error::Invalid),
39325            };
39326            Ok(v)
39327        })
39328    }
39329}
39330
39331impl WriteXdr for BumpSequenceResult {
39332    #[cfg(feature = "std")]
39333    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
39334        w.with_limited_depth(|w| {
39335            self.discriminant().write_xdr(w)?;
39336            #[allow(clippy::match_same_arms)]
39337            match self {
39338                Self::Success => ().write_xdr(w)?,
39339                Self::BadSeq => ().write_xdr(w)?,
39340            };
39341            Ok(())
39342        })
39343    }
39344}
39345
39346/// CreateClaimableBalanceResultCode is an XDR Enum defines as:
39347///
39348/// ```text
39349/// enum CreateClaimableBalanceResultCode
39350/// {
39351///     CREATE_CLAIMABLE_BALANCE_SUCCESS = 0,
39352///     CREATE_CLAIMABLE_BALANCE_MALFORMED = -1,
39353///     CREATE_CLAIMABLE_BALANCE_LOW_RESERVE = -2,
39354///     CREATE_CLAIMABLE_BALANCE_NO_TRUST = -3,
39355///     CREATE_CLAIMABLE_BALANCE_NOT_AUTHORIZED = -4,
39356///     CREATE_CLAIMABLE_BALANCE_UNDERFUNDED = -5
39357/// };
39358/// ```
39359///
39360// enum
39361#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
39362#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
39363#[cfg_attr(
39364    all(feature = "serde", feature = "alloc"),
39365    derive(serde::Serialize, serde::Deserialize),
39366    serde(rename_all = "snake_case")
39367)]
39368#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
39369#[repr(i32)]
39370pub enum CreateClaimableBalanceResultCode {
39371    Success = 0,
39372    Malformed = -1,
39373    LowReserve = -2,
39374    NoTrust = -3,
39375    NotAuthorized = -4,
39376    Underfunded = -5,
39377}
39378
39379impl CreateClaimableBalanceResultCode {
39380    pub const VARIANTS: [CreateClaimableBalanceResultCode; 6] = [
39381        CreateClaimableBalanceResultCode::Success,
39382        CreateClaimableBalanceResultCode::Malformed,
39383        CreateClaimableBalanceResultCode::LowReserve,
39384        CreateClaimableBalanceResultCode::NoTrust,
39385        CreateClaimableBalanceResultCode::NotAuthorized,
39386        CreateClaimableBalanceResultCode::Underfunded,
39387    ];
39388    pub const VARIANTS_STR: [&'static str; 6] = [
39389        "Success",
39390        "Malformed",
39391        "LowReserve",
39392        "NoTrust",
39393        "NotAuthorized",
39394        "Underfunded",
39395    ];
39396
39397    #[must_use]
39398    pub const fn name(&self) -> &'static str {
39399        match self {
39400            Self::Success => "Success",
39401            Self::Malformed => "Malformed",
39402            Self::LowReserve => "LowReserve",
39403            Self::NoTrust => "NoTrust",
39404            Self::NotAuthorized => "NotAuthorized",
39405            Self::Underfunded => "Underfunded",
39406        }
39407    }
39408
39409    #[must_use]
39410    pub const fn variants() -> [CreateClaimableBalanceResultCode; 6] {
39411        Self::VARIANTS
39412    }
39413}
39414
39415impl Name for CreateClaimableBalanceResultCode {
39416    #[must_use]
39417    fn name(&self) -> &'static str {
39418        Self::name(self)
39419    }
39420}
39421
39422impl Variants<CreateClaimableBalanceResultCode> for CreateClaimableBalanceResultCode {
39423    fn variants() -> slice::Iter<'static, CreateClaimableBalanceResultCode> {
39424        Self::VARIANTS.iter()
39425    }
39426}
39427
39428impl Enum for CreateClaimableBalanceResultCode {}
39429
39430impl fmt::Display for CreateClaimableBalanceResultCode {
39431    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
39432        f.write_str(self.name())
39433    }
39434}
39435
39436impl TryFrom<i32> for CreateClaimableBalanceResultCode {
39437    type Error = Error;
39438
39439    fn try_from(i: i32) -> Result<Self> {
39440        let e = match i {
39441            0 => CreateClaimableBalanceResultCode::Success,
39442            -1 => CreateClaimableBalanceResultCode::Malformed,
39443            -2 => CreateClaimableBalanceResultCode::LowReserve,
39444            -3 => CreateClaimableBalanceResultCode::NoTrust,
39445            -4 => CreateClaimableBalanceResultCode::NotAuthorized,
39446            -5 => CreateClaimableBalanceResultCode::Underfunded,
39447            #[allow(unreachable_patterns)]
39448            _ => return Err(Error::Invalid),
39449        };
39450        Ok(e)
39451    }
39452}
39453
39454impl From<CreateClaimableBalanceResultCode> for i32 {
39455    #[must_use]
39456    fn from(e: CreateClaimableBalanceResultCode) -> Self {
39457        e as Self
39458    }
39459}
39460
39461impl ReadXdr for CreateClaimableBalanceResultCode {
39462    #[cfg(feature = "std")]
39463    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
39464        r.with_limited_depth(|r| {
39465            let e = i32::read_xdr(r)?;
39466            let v: Self = e.try_into()?;
39467            Ok(v)
39468        })
39469    }
39470}
39471
39472impl WriteXdr for CreateClaimableBalanceResultCode {
39473    #[cfg(feature = "std")]
39474    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
39475        w.with_limited_depth(|w| {
39476            let i: i32 = (*self).into();
39477            i.write_xdr(w)
39478        })
39479    }
39480}
39481
39482/// CreateClaimableBalanceResult is an XDR Union defines as:
39483///
39484/// ```text
39485/// union CreateClaimableBalanceResult switch (
39486///     CreateClaimableBalanceResultCode code)
39487/// {
39488/// case CREATE_CLAIMABLE_BALANCE_SUCCESS:
39489///     ClaimableBalanceID balanceID;
39490/// case CREATE_CLAIMABLE_BALANCE_MALFORMED:
39491/// case CREATE_CLAIMABLE_BALANCE_LOW_RESERVE:
39492/// case CREATE_CLAIMABLE_BALANCE_NO_TRUST:
39493/// case CREATE_CLAIMABLE_BALANCE_NOT_AUTHORIZED:
39494/// case CREATE_CLAIMABLE_BALANCE_UNDERFUNDED:
39495///     void;
39496/// };
39497/// ```
39498///
39499// union with discriminant CreateClaimableBalanceResultCode
39500#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
39501#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
39502#[cfg_attr(
39503    all(feature = "serde", feature = "alloc"),
39504    derive(serde::Serialize, serde::Deserialize),
39505    serde(rename_all = "snake_case")
39506)]
39507#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
39508#[allow(clippy::large_enum_variant)]
39509pub enum CreateClaimableBalanceResult {
39510    Success(ClaimableBalanceId),
39511    Malformed,
39512    LowReserve,
39513    NoTrust,
39514    NotAuthorized,
39515    Underfunded,
39516}
39517
39518impl CreateClaimableBalanceResult {
39519    pub const VARIANTS: [CreateClaimableBalanceResultCode; 6] = [
39520        CreateClaimableBalanceResultCode::Success,
39521        CreateClaimableBalanceResultCode::Malformed,
39522        CreateClaimableBalanceResultCode::LowReserve,
39523        CreateClaimableBalanceResultCode::NoTrust,
39524        CreateClaimableBalanceResultCode::NotAuthorized,
39525        CreateClaimableBalanceResultCode::Underfunded,
39526    ];
39527    pub const VARIANTS_STR: [&'static str; 6] = [
39528        "Success",
39529        "Malformed",
39530        "LowReserve",
39531        "NoTrust",
39532        "NotAuthorized",
39533        "Underfunded",
39534    ];
39535
39536    #[must_use]
39537    pub const fn name(&self) -> &'static str {
39538        match self {
39539            Self::Success(_) => "Success",
39540            Self::Malformed => "Malformed",
39541            Self::LowReserve => "LowReserve",
39542            Self::NoTrust => "NoTrust",
39543            Self::NotAuthorized => "NotAuthorized",
39544            Self::Underfunded => "Underfunded",
39545        }
39546    }
39547
39548    #[must_use]
39549    pub const fn discriminant(&self) -> CreateClaimableBalanceResultCode {
39550        #[allow(clippy::match_same_arms)]
39551        match self {
39552            Self::Success(_) => CreateClaimableBalanceResultCode::Success,
39553            Self::Malformed => CreateClaimableBalanceResultCode::Malformed,
39554            Self::LowReserve => CreateClaimableBalanceResultCode::LowReserve,
39555            Self::NoTrust => CreateClaimableBalanceResultCode::NoTrust,
39556            Self::NotAuthorized => CreateClaimableBalanceResultCode::NotAuthorized,
39557            Self::Underfunded => CreateClaimableBalanceResultCode::Underfunded,
39558        }
39559    }
39560
39561    #[must_use]
39562    pub const fn variants() -> [CreateClaimableBalanceResultCode; 6] {
39563        Self::VARIANTS
39564    }
39565}
39566
39567impl Name for CreateClaimableBalanceResult {
39568    #[must_use]
39569    fn name(&self) -> &'static str {
39570        Self::name(self)
39571    }
39572}
39573
39574impl Discriminant<CreateClaimableBalanceResultCode> for CreateClaimableBalanceResult {
39575    #[must_use]
39576    fn discriminant(&self) -> CreateClaimableBalanceResultCode {
39577        Self::discriminant(self)
39578    }
39579}
39580
39581impl Variants<CreateClaimableBalanceResultCode> for CreateClaimableBalanceResult {
39582    fn variants() -> slice::Iter<'static, CreateClaimableBalanceResultCode> {
39583        Self::VARIANTS.iter()
39584    }
39585}
39586
39587impl Union<CreateClaimableBalanceResultCode> for CreateClaimableBalanceResult {}
39588
39589impl ReadXdr for CreateClaimableBalanceResult {
39590    #[cfg(feature = "std")]
39591    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
39592        r.with_limited_depth(|r| {
39593            let dv: CreateClaimableBalanceResultCode =
39594                <CreateClaimableBalanceResultCode as ReadXdr>::read_xdr(r)?;
39595            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
39596            let v = match dv {
39597                CreateClaimableBalanceResultCode::Success => {
39598                    Self::Success(ClaimableBalanceId::read_xdr(r)?)
39599                }
39600                CreateClaimableBalanceResultCode::Malformed => Self::Malformed,
39601                CreateClaimableBalanceResultCode::LowReserve => Self::LowReserve,
39602                CreateClaimableBalanceResultCode::NoTrust => Self::NoTrust,
39603                CreateClaimableBalanceResultCode::NotAuthorized => Self::NotAuthorized,
39604                CreateClaimableBalanceResultCode::Underfunded => Self::Underfunded,
39605                #[allow(unreachable_patterns)]
39606                _ => return Err(Error::Invalid),
39607            };
39608            Ok(v)
39609        })
39610    }
39611}
39612
39613impl WriteXdr for CreateClaimableBalanceResult {
39614    #[cfg(feature = "std")]
39615    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
39616        w.with_limited_depth(|w| {
39617            self.discriminant().write_xdr(w)?;
39618            #[allow(clippy::match_same_arms)]
39619            match self {
39620                Self::Success(v) => v.write_xdr(w)?,
39621                Self::Malformed => ().write_xdr(w)?,
39622                Self::LowReserve => ().write_xdr(w)?,
39623                Self::NoTrust => ().write_xdr(w)?,
39624                Self::NotAuthorized => ().write_xdr(w)?,
39625                Self::Underfunded => ().write_xdr(w)?,
39626            };
39627            Ok(())
39628        })
39629    }
39630}
39631
39632/// ClaimClaimableBalanceResultCode is an XDR Enum defines as:
39633///
39634/// ```text
39635/// enum ClaimClaimableBalanceResultCode
39636/// {
39637///     CLAIM_CLAIMABLE_BALANCE_SUCCESS = 0,
39638///     CLAIM_CLAIMABLE_BALANCE_DOES_NOT_EXIST = -1,
39639///     CLAIM_CLAIMABLE_BALANCE_CANNOT_CLAIM = -2,
39640///     CLAIM_CLAIMABLE_BALANCE_LINE_FULL = -3,
39641///     CLAIM_CLAIMABLE_BALANCE_NO_TRUST = -4,
39642///     CLAIM_CLAIMABLE_BALANCE_NOT_AUTHORIZED = -5
39643/// };
39644/// ```
39645///
39646// enum
39647#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
39648#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
39649#[cfg_attr(
39650    all(feature = "serde", feature = "alloc"),
39651    derive(serde::Serialize, serde::Deserialize),
39652    serde(rename_all = "snake_case")
39653)]
39654#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
39655#[repr(i32)]
39656pub enum ClaimClaimableBalanceResultCode {
39657    Success = 0,
39658    DoesNotExist = -1,
39659    CannotClaim = -2,
39660    LineFull = -3,
39661    NoTrust = -4,
39662    NotAuthorized = -5,
39663}
39664
39665impl ClaimClaimableBalanceResultCode {
39666    pub const VARIANTS: [ClaimClaimableBalanceResultCode; 6] = [
39667        ClaimClaimableBalanceResultCode::Success,
39668        ClaimClaimableBalanceResultCode::DoesNotExist,
39669        ClaimClaimableBalanceResultCode::CannotClaim,
39670        ClaimClaimableBalanceResultCode::LineFull,
39671        ClaimClaimableBalanceResultCode::NoTrust,
39672        ClaimClaimableBalanceResultCode::NotAuthorized,
39673    ];
39674    pub const VARIANTS_STR: [&'static str; 6] = [
39675        "Success",
39676        "DoesNotExist",
39677        "CannotClaim",
39678        "LineFull",
39679        "NoTrust",
39680        "NotAuthorized",
39681    ];
39682
39683    #[must_use]
39684    pub const fn name(&self) -> &'static str {
39685        match self {
39686            Self::Success => "Success",
39687            Self::DoesNotExist => "DoesNotExist",
39688            Self::CannotClaim => "CannotClaim",
39689            Self::LineFull => "LineFull",
39690            Self::NoTrust => "NoTrust",
39691            Self::NotAuthorized => "NotAuthorized",
39692        }
39693    }
39694
39695    #[must_use]
39696    pub const fn variants() -> [ClaimClaimableBalanceResultCode; 6] {
39697        Self::VARIANTS
39698    }
39699}
39700
39701impl Name for ClaimClaimableBalanceResultCode {
39702    #[must_use]
39703    fn name(&self) -> &'static str {
39704        Self::name(self)
39705    }
39706}
39707
39708impl Variants<ClaimClaimableBalanceResultCode> for ClaimClaimableBalanceResultCode {
39709    fn variants() -> slice::Iter<'static, ClaimClaimableBalanceResultCode> {
39710        Self::VARIANTS.iter()
39711    }
39712}
39713
39714impl Enum for ClaimClaimableBalanceResultCode {}
39715
39716impl fmt::Display for ClaimClaimableBalanceResultCode {
39717    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
39718        f.write_str(self.name())
39719    }
39720}
39721
39722impl TryFrom<i32> for ClaimClaimableBalanceResultCode {
39723    type Error = Error;
39724
39725    fn try_from(i: i32) -> Result<Self> {
39726        let e = match i {
39727            0 => ClaimClaimableBalanceResultCode::Success,
39728            -1 => ClaimClaimableBalanceResultCode::DoesNotExist,
39729            -2 => ClaimClaimableBalanceResultCode::CannotClaim,
39730            -3 => ClaimClaimableBalanceResultCode::LineFull,
39731            -4 => ClaimClaimableBalanceResultCode::NoTrust,
39732            -5 => ClaimClaimableBalanceResultCode::NotAuthorized,
39733            #[allow(unreachable_patterns)]
39734            _ => return Err(Error::Invalid),
39735        };
39736        Ok(e)
39737    }
39738}
39739
39740impl From<ClaimClaimableBalanceResultCode> for i32 {
39741    #[must_use]
39742    fn from(e: ClaimClaimableBalanceResultCode) -> Self {
39743        e as Self
39744    }
39745}
39746
39747impl ReadXdr for ClaimClaimableBalanceResultCode {
39748    #[cfg(feature = "std")]
39749    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
39750        r.with_limited_depth(|r| {
39751            let e = i32::read_xdr(r)?;
39752            let v: Self = e.try_into()?;
39753            Ok(v)
39754        })
39755    }
39756}
39757
39758impl WriteXdr for ClaimClaimableBalanceResultCode {
39759    #[cfg(feature = "std")]
39760    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
39761        w.with_limited_depth(|w| {
39762            let i: i32 = (*self).into();
39763            i.write_xdr(w)
39764        })
39765    }
39766}
39767
39768/// ClaimClaimableBalanceResult is an XDR Union defines as:
39769///
39770/// ```text
39771/// union ClaimClaimableBalanceResult switch (ClaimClaimableBalanceResultCode code)
39772/// {
39773/// case CLAIM_CLAIMABLE_BALANCE_SUCCESS:
39774///     void;
39775/// case CLAIM_CLAIMABLE_BALANCE_DOES_NOT_EXIST:
39776/// case CLAIM_CLAIMABLE_BALANCE_CANNOT_CLAIM:
39777/// case CLAIM_CLAIMABLE_BALANCE_LINE_FULL:
39778/// case CLAIM_CLAIMABLE_BALANCE_NO_TRUST:
39779/// case CLAIM_CLAIMABLE_BALANCE_NOT_AUTHORIZED:
39780///     void;
39781/// };
39782/// ```
39783///
39784// union with discriminant ClaimClaimableBalanceResultCode
39785#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
39786#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
39787#[cfg_attr(
39788    all(feature = "serde", feature = "alloc"),
39789    derive(serde::Serialize, serde::Deserialize),
39790    serde(rename_all = "snake_case")
39791)]
39792#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
39793#[allow(clippy::large_enum_variant)]
39794pub enum ClaimClaimableBalanceResult {
39795    Success,
39796    DoesNotExist,
39797    CannotClaim,
39798    LineFull,
39799    NoTrust,
39800    NotAuthorized,
39801}
39802
39803impl ClaimClaimableBalanceResult {
39804    pub const VARIANTS: [ClaimClaimableBalanceResultCode; 6] = [
39805        ClaimClaimableBalanceResultCode::Success,
39806        ClaimClaimableBalanceResultCode::DoesNotExist,
39807        ClaimClaimableBalanceResultCode::CannotClaim,
39808        ClaimClaimableBalanceResultCode::LineFull,
39809        ClaimClaimableBalanceResultCode::NoTrust,
39810        ClaimClaimableBalanceResultCode::NotAuthorized,
39811    ];
39812    pub const VARIANTS_STR: [&'static str; 6] = [
39813        "Success",
39814        "DoesNotExist",
39815        "CannotClaim",
39816        "LineFull",
39817        "NoTrust",
39818        "NotAuthorized",
39819    ];
39820
39821    #[must_use]
39822    pub const fn name(&self) -> &'static str {
39823        match self {
39824            Self::Success => "Success",
39825            Self::DoesNotExist => "DoesNotExist",
39826            Self::CannotClaim => "CannotClaim",
39827            Self::LineFull => "LineFull",
39828            Self::NoTrust => "NoTrust",
39829            Self::NotAuthorized => "NotAuthorized",
39830        }
39831    }
39832
39833    #[must_use]
39834    pub const fn discriminant(&self) -> ClaimClaimableBalanceResultCode {
39835        #[allow(clippy::match_same_arms)]
39836        match self {
39837            Self::Success => ClaimClaimableBalanceResultCode::Success,
39838            Self::DoesNotExist => ClaimClaimableBalanceResultCode::DoesNotExist,
39839            Self::CannotClaim => ClaimClaimableBalanceResultCode::CannotClaim,
39840            Self::LineFull => ClaimClaimableBalanceResultCode::LineFull,
39841            Self::NoTrust => ClaimClaimableBalanceResultCode::NoTrust,
39842            Self::NotAuthorized => ClaimClaimableBalanceResultCode::NotAuthorized,
39843        }
39844    }
39845
39846    #[must_use]
39847    pub const fn variants() -> [ClaimClaimableBalanceResultCode; 6] {
39848        Self::VARIANTS
39849    }
39850}
39851
39852impl Name for ClaimClaimableBalanceResult {
39853    #[must_use]
39854    fn name(&self) -> &'static str {
39855        Self::name(self)
39856    }
39857}
39858
39859impl Discriminant<ClaimClaimableBalanceResultCode> for ClaimClaimableBalanceResult {
39860    #[must_use]
39861    fn discriminant(&self) -> ClaimClaimableBalanceResultCode {
39862        Self::discriminant(self)
39863    }
39864}
39865
39866impl Variants<ClaimClaimableBalanceResultCode> for ClaimClaimableBalanceResult {
39867    fn variants() -> slice::Iter<'static, ClaimClaimableBalanceResultCode> {
39868        Self::VARIANTS.iter()
39869    }
39870}
39871
39872impl Union<ClaimClaimableBalanceResultCode> for ClaimClaimableBalanceResult {}
39873
39874impl ReadXdr for ClaimClaimableBalanceResult {
39875    #[cfg(feature = "std")]
39876    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
39877        r.with_limited_depth(|r| {
39878            let dv: ClaimClaimableBalanceResultCode =
39879                <ClaimClaimableBalanceResultCode as ReadXdr>::read_xdr(r)?;
39880            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
39881            let v = match dv {
39882                ClaimClaimableBalanceResultCode::Success => Self::Success,
39883                ClaimClaimableBalanceResultCode::DoesNotExist => Self::DoesNotExist,
39884                ClaimClaimableBalanceResultCode::CannotClaim => Self::CannotClaim,
39885                ClaimClaimableBalanceResultCode::LineFull => Self::LineFull,
39886                ClaimClaimableBalanceResultCode::NoTrust => Self::NoTrust,
39887                ClaimClaimableBalanceResultCode::NotAuthorized => Self::NotAuthorized,
39888                #[allow(unreachable_patterns)]
39889                _ => return Err(Error::Invalid),
39890            };
39891            Ok(v)
39892        })
39893    }
39894}
39895
39896impl WriteXdr for ClaimClaimableBalanceResult {
39897    #[cfg(feature = "std")]
39898    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
39899        w.with_limited_depth(|w| {
39900            self.discriminant().write_xdr(w)?;
39901            #[allow(clippy::match_same_arms)]
39902            match self {
39903                Self::Success => ().write_xdr(w)?,
39904                Self::DoesNotExist => ().write_xdr(w)?,
39905                Self::CannotClaim => ().write_xdr(w)?,
39906                Self::LineFull => ().write_xdr(w)?,
39907                Self::NoTrust => ().write_xdr(w)?,
39908                Self::NotAuthorized => ().write_xdr(w)?,
39909            };
39910            Ok(())
39911        })
39912    }
39913}
39914
39915/// BeginSponsoringFutureReservesResultCode is an XDR Enum defines as:
39916///
39917/// ```text
39918/// enum BeginSponsoringFutureReservesResultCode
39919/// {
39920///     // codes considered as "success" for the operation
39921///     BEGIN_SPONSORING_FUTURE_RESERVES_SUCCESS = 0,
39922///
39923///     // codes considered as "failure" for the operation
39924///     BEGIN_SPONSORING_FUTURE_RESERVES_MALFORMED = -1,
39925///     BEGIN_SPONSORING_FUTURE_RESERVES_ALREADY_SPONSORED = -2,
39926///     BEGIN_SPONSORING_FUTURE_RESERVES_RECURSIVE = -3
39927/// };
39928/// ```
39929///
39930// enum
39931#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
39932#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
39933#[cfg_attr(
39934    all(feature = "serde", feature = "alloc"),
39935    derive(serde::Serialize, serde::Deserialize),
39936    serde(rename_all = "snake_case")
39937)]
39938#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
39939#[repr(i32)]
39940pub enum BeginSponsoringFutureReservesResultCode {
39941    Success = 0,
39942    Malformed = -1,
39943    AlreadySponsored = -2,
39944    Recursive = -3,
39945}
39946
39947impl BeginSponsoringFutureReservesResultCode {
39948    pub const VARIANTS: [BeginSponsoringFutureReservesResultCode; 4] = [
39949        BeginSponsoringFutureReservesResultCode::Success,
39950        BeginSponsoringFutureReservesResultCode::Malformed,
39951        BeginSponsoringFutureReservesResultCode::AlreadySponsored,
39952        BeginSponsoringFutureReservesResultCode::Recursive,
39953    ];
39954    pub const VARIANTS_STR: [&'static str; 4] =
39955        ["Success", "Malformed", "AlreadySponsored", "Recursive"];
39956
39957    #[must_use]
39958    pub const fn name(&self) -> &'static str {
39959        match self {
39960            Self::Success => "Success",
39961            Self::Malformed => "Malformed",
39962            Self::AlreadySponsored => "AlreadySponsored",
39963            Self::Recursive => "Recursive",
39964        }
39965    }
39966
39967    #[must_use]
39968    pub const fn variants() -> [BeginSponsoringFutureReservesResultCode; 4] {
39969        Self::VARIANTS
39970    }
39971}
39972
39973impl Name for BeginSponsoringFutureReservesResultCode {
39974    #[must_use]
39975    fn name(&self) -> &'static str {
39976        Self::name(self)
39977    }
39978}
39979
39980impl Variants<BeginSponsoringFutureReservesResultCode> for BeginSponsoringFutureReservesResultCode {
39981    fn variants() -> slice::Iter<'static, BeginSponsoringFutureReservesResultCode> {
39982        Self::VARIANTS.iter()
39983    }
39984}
39985
39986impl Enum for BeginSponsoringFutureReservesResultCode {}
39987
39988impl fmt::Display for BeginSponsoringFutureReservesResultCode {
39989    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
39990        f.write_str(self.name())
39991    }
39992}
39993
39994impl TryFrom<i32> for BeginSponsoringFutureReservesResultCode {
39995    type Error = Error;
39996
39997    fn try_from(i: i32) -> Result<Self> {
39998        let e = match i {
39999            0 => BeginSponsoringFutureReservesResultCode::Success,
40000            -1 => BeginSponsoringFutureReservesResultCode::Malformed,
40001            -2 => BeginSponsoringFutureReservesResultCode::AlreadySponsored,
40002            -3 => BeginSponsoringFutureReservesResultCode::Recursive,
40003            #[allow(unreachable_patterns)]
40004            _ => return Err(Error::Invalid),
40005        };
40006        Ok(e)
40007    }
40008}
40009
40010impl From<BeginSponsoringFutureReservesResultCode> for i32 {
40011    #[must_use]
40012    fn from(e: BeginSponsoringFutureReservesResultCode) -> Self {
40013        e as Self
40014    }
40015}
40016
40017impl ReadXdr for BeginSponsoringFutureReservesResultCode {
40018    #[cfg(feature = "std")]
40019    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
40020        r.with_limited_depth(|r| {
40021            let e = i32::read_xdr(r)?;
40022            let v: Self = e.try_into()?;
40023            Ok(v)
40024        })
40025    }
40026}
40027
40028impl WriteXdr for BeginSponsoringFutureReservesResultCode {
40029    #[cfg(feature = "std")]
40030    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
40031        w.with_limited_depth(|w| {
40032            let i: i32 = (*self).into();
40033            i.write_xdr(w)
40034        })
40035    }
40036}
40037
40038/// BeginSponsoringFutureReservesResult is an XDR Union defines as:
40039///
40040/// ```text
40041/// union BeginSponsoringFutureReservesResult switch (
40042///     BeginSponsoringFutureReservesResultCode code)
40043/// {
40044/// case BEGIN_SPONSORING_FUTURE_RESERVES_SUCCESS:
40045///     void;
40046/// case BEGIN_SPONSORING_FUTURE_RESERVES_MALFORMED:
40047/// case BEGIN_SPONSORING_FUTURE_RESERVES_ALREADY_SPONSORED:
40048/// case BEGIN_SPONSORING_FUTURE_RESERVES_RECURSIVE:
40049///     void;
40050/// };
40051/// ```
40052///
40053// union with discriminant BeginSponsoringFutureReservesResultCode
40054#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
40055#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
40056#[cfg_attr(
40057    all(feature = "serde", feature = "alloc"),
40058    derive(serde::Serialize, serde::Deserialize),
40059    serde(rename_all = "snake_case")
40060)]
40061#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
40062#[allow(clippy::large_enum_variant)]
40063pub enum BeginSponsoringFutureReservesResult {
40064    Success,
40065    Malformed,
40066    AlreadySponsored,
40067    Recursive,
40068}
40069
40070impl BeginSponsoringFutureReservesResult {
40071    pub const VARIANTS: [BeginSponsoringFutureReservesResultCode; 4] = [
40072        BeginSponsoringFutureReservesResultCode::Success,
40073        BeginSponsoringFutureReservesResultCode::Malformed,
40074        BeginSponsoringFutureReservesResultCode::AlreadySponsored,
40075        BeginSponsoringFutureReservesResultCode::Recursive,
40076    ];
40077    pub const VARIANTS_STR: [&'static str; 4] =
40078        ["Success", "Malformed", "AlreadySponsored", "Recursive"];
40079
40080    #[must_use]
40081    pub const fn name(&self) -> &'static str {
40082        match self {
40083            Self::Success => "Success",
40084            Self::Malformed => "Malformed",
40085            Self::AlreadySponsored => "AlreadySponsored",
40086            Self::Recursive => "Recursive",
40087        }
40088    }
40089
40090    #[must_use]
40091    pub const fn discriminant(&self) -> BeginSponsoringFutureReservesResultCode {
40092        #[allow(clippy::match_same_arms)]
40093        match self {
40094            Self::Success => BeginSponsoringFutureReservesResultCode::Success,
40095            Self::Malformed => BeginSponsoringFutureReservesResultCode::Malformed,
40096            Self::AlreadySponsored => BeginSponsoringFutureReservesResultCode::AlreadySponsored,
40097            Self::Recursive => BeginSponsoringFutureReservesResultCode::Recursive,
40098        }
40099    }
40100
40101    #[must_use]
40102    pub const fn variants() -> [BeginSponsoringFutureReservesResultCode; 4] {
40103        Self::VARIANTS
40104    }
40105}
40106
40107impl Name for BeginSponsoringFutureReservesResult {
40108    #[must_use]
40109    fn name(&self) -> &'static str {
40110        Self::name(self)
40111    }
40112}
40113
40114impl Discriminant<BeginSponsoringFutureReservesResultCode> for BeginSponsoringFutureReservesResult {
40115    #[must_use]
40116    fn discriminant(&self) -> BeginSponsoringFutureReservesResultCode {
40117        Self::discriminant(self)
40118    }
40119}
40120
40121impl Variants<BeginSponsoringFutureReservesResultCode> for BeginSponsoringFutureReservesResult {
40122    fn variants() -> slice::Iter<'static, BeginSponsoringFutureReservesResultCode> {
40123        Self::VARIANTS.iter()
40124    }
40125}
40126
40127impl Union<BeginSponsoringFutureReservesResultCode> for BeginSponsoringFutureReservesResult {}
40128
40129impl ReadXdr for BeginSponsoringFutureReservesResult {
40130    #[cfg(feature = "std")]
40131    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
40132        r.with_limited_depth(|r| {
40133            let dv: BeginSponsoringFutureReservesResultCode =
40134                <BeginSponsoringFutureReservesResultCode as ReadXdr>::read_xdr(r)?;
40135            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
40136            let v = match dv {
40137                BeginSponsoringFutureReservesResultCode::Success => Self::Success,
40138                BeginSponsoringFutureReservesResultCode::Malformed => Self::Malformed,
40139                BeginSponsoringFutureReservesResultCode::AlreadySponsored => Self::AlreadySponsored,
40140                BeginSponsoringFutureReservesResultCode::Recursive => Self::Recursive,
40141                #[allow(unreachable_patterns)]
40142                _ => return Err(Error::Invalid),
40143            };
40144            Ok(v)
40145        })
40146    }
40147}
40148
40149impl WriteXdr for BeginSponsoringFutureReservesResult {
40150    #[cfg(feature = "std")]
40151    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
40152        w.with_limited_depth(|w| {
40153            self.discriminant().write_xdr(w)?;
40154            #[allow(clippy::match_same_arms)]
40155            match self {
40156                Self::Success => ().write_xdr(w)?,
40157                Self::Malformed => ().write_xdr(w)?,
40158                Self::AlreadySponsored => ().write_xdr(w)?,
40159                Self::Recursive => ().write_xdr(w)?,
40160            };
40161            Ok(())
40162        })
40163    }
40164}
40165
40166/// EndSponsoringFutureReservesResultCode is an XDR Enum defines as:
40167///
40168/// ```text
40169/// enum EndSponsoringFutureReservesResultCode
40170/// {
40171///     // codes considered as "success" for the operation
40172///     END_SPONSORING_FUTURE_RESERVES_SUCCESS = 0,
40173///
40174///     // codes considered as "failure" for the operation
40175///     END_SPONSORING_FUTURE_RESERVES_NOT_SPONSORED = -1
40176/// };
40177/// ```
40178///
40179// enum
40180#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
40181#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
40182#[cfg_attr(
40183    all(feature = "serde", feature = "alloc"),
40184    derive(serde::Serialize, serde::Deserialize),
40185    serde(rename_all = "snake_case")
40186)]
40187#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
40188#[repr(i32)]
40189pub enum EndSponsoringFutureReservesResultCode {
40190    Success = 0,
40191    NotSponsored = -1,
40192}
40193
40194impl EndSponsoringFutureReservesResultCode {
40195    pub const VARIANTS: [EndSponsoringFutureReservesResultCode; 2] = [
40196        EndSponsoringFutureReservesResultCode::Success,
40197        EndSponsoringFutureReservesResultCode::NotSponsored,
40198    ];
40199    pub const VARIANTS_STR: [&'static str; 2] = ["Success", "NotSponsored"];
40200
40201    #[must_use]
40202    pub const fn name(&self) -> &'static str {
40203        match self {
40204            Self::Success => "Success",
40205            Self::NotSponsored => "NotSponsored",
40206        }
40207    }
40208
40209    #[must_use]
40210    pub const fn variants() -> [EndSponsoringFutureReservesResultCode; 2] {
40211        Self::VARIANTS
40212    }
40213}
40214
40215impl Name for EndSponsoringFutureReservesResultCode {
40216    #[must_use]
40217    fn name(&self) -> &'static str {
40218        Self::name(self)
40219    }
40220}
40221
40222impl Variants<EndSponsoringFutureReservesResultCode> for EndSponsoringFutureReservesResultCode {
40223    fn variants() -> slice::Iter<'static, EndSponsoringFutureReservesResultCode> {
40224        Self::VARIANTS.iter()
40225    }
40226}
40227
40228impl Enum for EndSponsoringFutureReservesResultCode {}
40229
40230impl fmt::Display for EndSponsoringFutureReservesResultCode {
40231    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
40232        f.write_str(self.name())
40233    }
40234}
40235
40236impl TryFrom<i32> for EndSponsoringFutureReservesResultCode {
40237    type Error = Error;
40238
40239    fn try_from(i: i32) -> Result<Self> {
40240        let e = match i {
40241            0 => EndSponsoringFutureReservesResultCode::Success,
40242            -1 => EndSponsoringFutureReservesResultCode::NotSponsored,
40243            #[allow(unreachable_patterns)]
40244            _ => return Err(Error::Invalid),
40245        };
40246        Ok(e)
40247    }
40248}
40249
40250impl From<EndSponsoringFutureReservesResultCode> for i32 {
40251    #[must_use]
40252    fn from(e: EndSponsoringFutureReservesResultCode) -> Self {
40253        e as Self
40254    }
40255}
40256
40257impl ReadXdr for EndSponsoringFutureReservesResultCode {
40258    #[cfg(feature = "std")]
40259    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
40260        r.with_limited_depth(|r| {
40261            let e = i32::read_xdr(r)?;
40262            let v: Self = e.try_into()?;
40263            Ok(v)
40264        })
40265    }
40266}
40267
40268impl WriteXdr for EndSponsoringFutureReservesResultCode {
40269    #[cfg(feature = "std")]
40270    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
40271        w.with_limited_depth(|w| {
40272            let i: i32 = (*self).into();
40273            i.write_xdr(w)
40274        })
40275    }
40276}
40277
40278/// EndSponsoringFutureReservesResult is an XDR Union defines as:
40279///
40280/// ```text
40281/// union EndSponsoringFutureReservesResult switch (
40282///     EndSponsoringFutureReservesResultCode code)
40283/// {
40284/// case END_SPONSORING_FUTURE_RESERVES_SUCCESS:
40285///     void;
40286/// case END_SPONSORING_FUTURE_RESERVES_NOT_SPONSORED:
40287///     void;
40288/// };
40289/// ```
40290///
40291// union with discriminant EndSponsoringFutureReservesResultCode
40292#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
40293#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
40294#[cfg_attr(
40295    all(feature = "serde", feature = "alloc"),
40296    derive(serde::Serialize, serde::Deserialize),
40297    serde(rename_all = "snake_case")
40298)]
40299#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
40300#[allow(clippy::large_enum_variant)]
40301pub enum EndSponsoringFutureReservesResult {
40302    Success,
40303    NotSponsored,
40304}
40305
40306impl EndSponsoringFutureReservesResult {
40307    pub const VARIANTS: [EndSponsoringFutureReservesResultCode; 2] = [
40308        EndSponsoringFutureReservesResultCode::Success,
40309        EndSponsoringFutureReservesResultCode::NotSponsored,
40310    ];
40311    pub const VARIANTS_STR: [&'static str; 2] = ["Success", "NotSponsored"];
40312
40313    #[must_use]
40314    pub const fn name(&self) -> &'static str {
40315        match self {
40316            Self::Success => "Success",
40317            Self::NotSponsored => "NotSponsored",
40318        }
40319    }
40320
40321    #[must_use]
40322    pub const fn discriminant(&self) -> EndSponsoringFutureReservesResultCode {
40323        #[allow(clippy::match_same_arms)]
40324        match self {
40325            Self::Success => EndSponsoringFutureReservesResultCode::Success,
40326            Self::NotSponsored => EndSponsoringFutureReservesResultCode::NotSponsored,
40327        }
40328    }
40329
40330    #[must_use]
40331    pub const fn variants() -> [EndSponsoringFutureReservesResultCode; 2] {
40332        Self::VARIANTS
40333    }
40334}
40335
40336impl Name for EndSponsoringFutureReservesResult {
40337    #[must_use]
40338    fn name(&self) -> &'static str {
40339        Self::name(self)
40340    }
40341}
40342
40343impl Discriminant<EndSponsoringFutureReservesResultCode> for EndSponsoringFutureReservesResult {
40344    #[must_use]
40345    fn discriminant(&self) -> EndSponsoringFutureReservesResultCode {
40346        Self::discriminant(self)
40347    }
40348}
40349
40350impl Variants<EndSponsoringFutureReservesResultCode> for EndSponsoringFutureReservesResult {
40351    fn variants() -> slice::Iter<'static, EndSponsoringFutureReservesResultCode> {
40352        Self::VARIANTS.iter()
40353    }
40354}
40355
40356impl Union<EndSponsoringFutureReservesResultCode> for EndSponsoringFutureReservesResult {}
40357
40358impl ReadXdr for EndSponsoringFutureReservesResult {
40359    #[cfg(feature = "std")]
40360    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
40361        r.with_limited_depth(|r| {
40362            let dv: EndSponsoringFutureReservesResultCode =
40363                <EndSponsoringFutureReservesResultCode as ReadXdr>::read_xdr(r)?;
40364            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
40365            let v = match dv {
40366                EndSponsoringFutureReservesResultCode::Success => Self::Success,
40367                EndSponsoringFutureReservesResultCode::NotSponsored => Self::NotSponsored,
40368                #[allow(unreachable_patterns)]
40369                _ => return Err(Error::Invalid),
40370            };
40371            Ok(v)
40372        })
40373    }
40374}
40375
40376impl WriteXdr for EndSponsoringFutureReservesResult {
40377    #[cfg(feature = "std")]
40378    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
40379        w.with_limited_depth(|w| {
40380            self.discriminant().write_xdr(w)?;
40381            #[allow(clippy::match_same_arms)]
40382            match self {
40383                Self::Success => ().write_xdr(w)?,
40384                Self::NotSponsored => ().write_xdr(w)?,
40385            };
40386            Ok(())
40387        })
40388    }
40389}
40390
40391/// RevokeSponsorshipResultCode is an XDR Enum defines as:
40392///
40393/// ```text
40394/// enum RevokeSponsorshipResultCode
40395/// {
40396///     // codes considered as "success" for the operation
40397///     REVOKE_SPONSORSHIP_SUCCESS = 0,
40398///
40399///     // codes considered as "failure" for the operation
40400///     REVOKE_SPONSORSHIP_DOES_NOT_EXIST = -1,
40401///     REVOKE_SPONSORSHIP_NOT_SPONSOR = -2,
40402///     REVOKE_SPONSORSHIP_LOW_RESERVE = -3,
40403///     REVOKE_SPONSORSHIP_ONLY_TRANSFERABLE = -4,
40404///     REVOKE_SPONSORSHIP_MALFORMED = -5
40405/// };
40406/// ```
40407///
40408// enum
40409#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
40410#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
40411#[cfg_attr(
40412    all(feature = "serde", feature = "alloc"),
40413    derive(serde::Serialize, serde::Deserialize),
40414    serde(rename_all = "snake_case")
40415)]
40416#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
40417#[repr(i32)]
40418pub enum RevokeSponsorshipResultCode {
40419    Success = 0,
40420    DoesNotExist = -1,
40421    NotSponsor = -2,
40422    LowReserve = -3,
40423    OnlyTransferable = -4,
40424    Malformed = -5,
40425}
40426
40427impl RevokeSponsorshipResultCode {
40428    pub const VARIANTS: [RevokeSponsorshipResultCode; 6] = [
40429        RevokeSponsorshipResultCode::Success,
40430        RevokeSponsorshipResultCode::DoesNotExist,
40431        RevokeSponsorshipResultCode::NotSponsor,
40432        RevokeSponsorshipResultCode::LowReserve,
40433        RevokeSponsorshipResultCode::OnlyTransferable,
40434        RevokeSponsorshipResultCode::Malformed,
40435    ];
40436    pub const VARIANTS_STR: [&'static str; 6] = [
40437        "Success",
40438        "DoesNotExist",
40439        "NotSponsor",
40440        "LowReserve",
40441        "OnlyTransferable",
40442        "Malformed",
40443    ];
40444
40445    #[must_use]
40446    pub const fn name(&self) -> &'static str {
40447        match self {
40448            Self::Success => "Success",
40449            Self::DoesNotExist => "DoesNotExist",
40450            Self::NotSponsor => "NotSponsor",
40451            Self::LowReserve => "LowReserve",
40452            Self::OnlyTransferable => "OnlyTransferable",
40453            Self::Malformed => "Malformed",
40454        }
40455    }
40456
40457    #[must_use]
40458    pub const fn variants() -> [RevokeSponsorshipResultCode; 6] {
40459        Self::VARIANTS
40460    }
40461}
40462
40463impl Name for RevokeSponsorshipResultCode {
40464    #[must_use]
40465    fn name(&self) -> &'static str {
40466        Self::name(self)
40467    }
40468}
40469
40470impl Variants<RevokeSponsorshipResultCode> for RevokeSponsorshipResultCode {
40471    fn variants() -> slice::Iter<'static, RevokeSponsorshipResultCode> {
40472        Self::VARIANTS.iter()
40473    }
40474}
40475
40476impl Enum for RevokeSponsorshipResultCode {}
40477
40478impl fmt::Display for RevokeSponsorshipResultCode {
40479    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
40480        f.write_str(self.name())
40481    }
40482}
40483
40484impl TryFrom<i32> for RevokeSponsorshipResultCode {
40485    type Error = Error;
40486
40487    fn try_from(i: i32) -> Result<Self> {
40488        let e = match i {
40489            0 => RevokeSponsorshipResultCode::Success,
40490            -1 => RevokeSponsorshipResultCode::DoesNotExist,
40491            -2 => RevokeSponsorshipResultCode::NotSponsor,
40492            -3 => RevokeSponsorshipResultCode::LowReserve,
40493            -4 => RevokeSponsorshipResultCode::OnlyTransferable,
40494            -5 => RevokeSponsorshipResultCode::Malformed,
40495            #[allow(unreachable_patterns)]
40496            _ => return Err(Error::Invalid),
40497        };
40498        Ok(e)
40499    }
40500}
40501
40502impl From<RevokeSponsorshipResultCode> for i32 {
40503    #[must_use]
40504    fn from(e: RevokeSponsorshipResultCode) -> Self {
40505        e as Self
40506    }
40507}
40508
40509impl ReadXdr for RevokeSponsorshipResultCode {
40510    #[cfg(feature = "std")]
40511    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
40512        r.with_limited_depth(|r| {
40513            let e = i32::read_xdr(r)?;
40514            let v: Self = e.try_into()?;
40515            Ok(v)
40516        })
40517    }
40518}
40519
40520impl WriteXdr for RevokeSponsorshipResultCode {
40521    #[cfg(feature = "std")]
40522    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
40523        w.with_limited_depth(|w| {
40524            let i: i32 = (*self).into();
40525            i.write_xdr(w)
40526        })
40527    }
40528}
40529
40530/// RevokeSponsorshipResult is an XDR Union defines as:
40531///
40532/// ```text
40533/// union RevokeSponsorshipResult switch (RevokeSponsorshipResultCode code)
40534/// {
40535/// case REVOKE_SPONSORSHIP_SUCCESS:
40536///     void;
40537/// case REVOKE_SPONSORSHIP_DOES_NOT_EXIST:
40538/// case REVOKE_SPONSORSHIP_NOT_SPONSOR:
40539/// case REVOKE_SPONSORSHIP_LOW_RESERVE:
40540/// case REVOKE_SPONSORSHIP_ONLY_TRANSFERABLE:
40541/// case REVOKE_SPONSORSHIP_MALFORMED:
40542///     void;
40543/// };
40544/// ```
40545///
40546// union with discriminant RevokeSponsorshipResultCode
40547#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
40548#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
40549#[cfg_attr(
40550    all(feature = "serde", feature = "alloc"),
40551    derive(serde::Serialize, serde::Deserialize),
40552    serde(rename_all = "snake_case")
40553)]
40554#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
40555#[allow(clippy::large_enum_variant)]
40556pub enum RevokeSponsorshipResult {
40557    Success,
40558    DoesNotExist,
40559    NotSponsor,
40560    LowReserve,
40561    OnlyTransferable,
40562    Malformed,
40563}
40564
40565impl RevokeSponsorshipResult {
40566    pub const VARIANTS: [RevokeSponsorshipResultCode; 6] = [
40567        RevokeSponsorshipResultCode::Success,
40568        RevokeSponsorshipResultCode::DoesNotExist,
40569        RevokeSponsorshipResultCode::NotSponsor,
40570        RevokeSponsorshipResultCode::LowReserve,
40571        RevokeSponsorshipResultCode::OnlyTransferable,
40572        RevokeSponsorshipResultCode::Malformed,
40573    ];
40574    pub const VARIANTS_STR: [&'static str; 6] = [
40575        "Success",
40576        "DoesNotExist",
40577        "NotSponsor",
40578        "LowReserve",
40579        "OnlyTransferable",
40580        "Malformed",
40581    ];
40582
40583    #[must_use]
40584    pub const fn name(&self) -> &'static str {
40585        match self {
40586            Self::Success => "Success",
40587            Self::DoesNotExist => "DoesNotExist",
40588            Self::NotSponsor => "NotSponsor",
40589            Self::LowReserve => "LowReserve",
40590            Self::OnlyTransferable => "OnlyTransferable",
40591            Self::Malformed => "Malformed",
40592        }
40593    }
40594
40595    #[must_use]
40596    pub const fn discriminant(&self) -> RevokeSponsorshipResultCode {
40597        #[allow(clippy::match_same_arms)]
40598        match self {
40599            Self::Success => RevokeSponsorshipResultCode::Success,
40600            Self::DoesNotExist => RevokeSponsorshipResultCode::DoesNotExist,
40601            Self::NotSponsor => RevokeSponsorshipResultCode::NotSponsor,
40602            Self::LowReserve => RevokeSponsorshipResultCode::LowReserve,
40603            Self::OnlyTransferable => RevokeSponsorshipResultCode::OnlyTransferable,
40604            Self::Malformed => RevokeSponsorshipResultCode::Malformed,
40605        }
40606    }
40607
40608    #[must_use]
40609    pub const fn variants() -> [RevokeSponsorshipResultCode; 6] {
40610        Self::VARIANTS
40611    }
40612}
40613
40614impl Name for RevokeSponsorshipResult {
40615    #[must_use]
40616    fn name(&self) -> &'static str {
40617        Self::name(self)
40618    }
40619}
40620
40621impl Discriminant<RevokeSponsorshipResultCode> for RevokeSponsorshipResult {
40622    #[must_use]
40623    fn discriminant(&self) -> RevokeSponsorshipResultCode {
40624        Self::discriminant(self)
40625    }
40626}
40627
40628impl Variants<RevokeSponsorshipResultCode> for RevokeSponsorshipResult {
40629    fn variants() -> slice::Iter<'static, RevokeSponsorshipResultCode> {
40630        Self::VARIANTS.iter()
40631    }
40632}
40633
40634impl Union<RevokeSponsorshipResultCode> for RevokeSponsorshipResult {}
40635
40636impl ReadXdr for RevokeSponsorshipResult {
40637    #[cfg(feature = "std")]
40638    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
40639        r.with_limited_depth(|r| {
40640            let dv: RevokeSponsorshipResultCode =
40641                <RevokeSponsorshipResultCode as ReadXdr>::read_xdr(r)?;
40642            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
40643            let v = match dv {
40644                RevokeSponsorshipResultCode::Success => Self::Success,
40645                RevokeSponsorshipResultCode::DoesNotExist => Self::DoesNotExist,
40646                RevokeSponsorshipResultCode::NotSponsor => Self::NotSponsor,
40647                RevokeSponsorshipResultCode::LowReserve => Self::LowReserve,
40648                RevokeSponsorshipResultCode::OnlyTransferable => Self::OnlyTransferable,
40649                RevokeSponsorshipResultCode::Malformed => Self::Malformed,
40650                #[allow(unreachable_patterns)]
40651                _ => return Err(Error::Invalid),
40652            };
40653            Ok(v)
40654        })
40655    }
40656}
40657
40658impl WriteXdr for RevokeSponsorshipResult {
40659    #[cfg(feature = "std")]
40660    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
40661        w.with_limited_depth(|w| {
40662            self.discriminant().write_xdr(w)?;
40663            #[allow(clippy::match_same_arms)]
40664            match self {
40665                Self::Success => ().write_xdr(w)?,
40666                Self::DoesNotExist => ().write_xdr(w)?,
40667                Self::NotSponsor => ().write_xdr(w)?,
40668                Self::LowReserve => ().write_xdr(w)?,
40669                Self::OnlyTransferable => ().write_xdr(w)?,
40670                Self::Malformed => ().write_xdr(w)?,
40671            };
40672            Ok(())
40673        })
40674    }
40675}
40676
40677/// ClawbackResultCode is an XDR Enum defines as:
40678///
40679/// ```text
40680/// enum ClawbackResultCode
40681/// {
40682///     // codes considered as "success" for the operation
40683///     CLAWBACK_SUCCESS = 0,
40684///
40685///     // codes considered as "failure" for the operation
40686///     CLAWBACK_MALFORMED = -1,
40687///     CLAWBACK_NOT_CLAWBACK_ENABLED = -2,
40688///     CLAWBACK_NO_TRUST = -3,
40689///     CLAWBACK_UNDERFUNDED = -4
40690/// };
40691/// ```
40692///
40693// enum
40694#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
40695#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
40696#[cfg_attr(
40697    all(feature = "serde", feature = "alloc"),
40698    derive(serde::Serialize, serde::Deserialize),
40699    serde(rename_all = "snake_case")
40700)]
40701#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
40702#[repr(i32)]
40703pub enum ClawbackResultCode {
40704    Success = 0,
40705    Malformed = -1,
40706    NotClawbackEnabled = -2,
40707    NoTrust = -3,
40708    Underfunded = -4,
40709}
40710
40711impl ClawbackResultCode {
40712    pub const VARIANTS: [ClawbackResultCode; 5] = [
40713        ClawbackResultCode::Success,
40714        ClawbackResultCode::Malformed,
40715        ClawbackResultCode::NotClawbackEnabled,
40716        ClawbackResultCode::NoTrust,
40717        ClawbackResultCode::Underfunded,
40718    ];
40719    pub const VARIANTS_STR: [&'static str; 5] = [
40720        "Success",
40721        "Malformed",
40722        "NotClawbackEnabled",
40723        "NoTrust",
40724        "Underfunded",
40725    ];
40726
40727    #[must_use]
40728    pub const fn name(&self) -> &'static str {
40729        match self {
40730            Self::Success => "Success",
40731            Self::Malformed => "Malformed",
40732            Self::NotClawbackEnabled => "NotClawbackEnabled",
40733            Self::NoTrust => "NoTrust",
40734            Self::Underfunded => "Underfunded",
40735        }
40736    }
40737
40738    #[must_use]
40739    pub const fn variants() -> [ClawbackResultCode; 5] {
40740        Self::VARIANTS
40741    }
40742}
40743
40744impl Name for ClawbackResultCode {
40745    #[must_use]
40746    fn name(&self) -> &'static str {
40747        Self::name(self)
40748    }
40749}
40750
40751impl Variants<ClawbackResultCode> for ClawbackResultCode {
40752    fn variants() -> slice::Iter<'static, ClawbackResultCode> {
40753        Self::VARIANTS.iter()
40754    }
40755}
40756
40757impl Enum for ClawbackResultCode {}
40758
40759impl fmt::Display for ClawbackResultCode {
40760    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
40761        f.write_str(self.name())
40762    }
40763}
40764
40765impl TryFrom<i32> for ClawbackResultCode {
40766    type Error = Error;
40767
40768    fn try_from(i: i32) -> Result<Self> {
40769        let e = match i {
40770            0 => ClawbackResultCode::Success,
40771            -1 => ClawbackResultCode::Malformed,
40772            -2 => ClawbackResultCode::NotClawbackEnabled,
40773            -3 => ClawbackResultCode::NoTrust,
40774            -4 => ClawbackResultCode::Underfunded,
40775            #[allow(unreachable_patterns)]
40776            _ => return Err(Error::Invalid),
40777        };
40778        Ok(e)
40779    }
40780}
40781
40782impl From<ClawbackResultCode> for i32 {
40783    #[must_use]
40784    fn from(e: ClawbackResultCode) -> Self {
40785        e as Self
40786    }
40787}
40788
40789impl ReadXdr for ClawbackResultCode {
40790    #[cfg(feature = "std")]
40791    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
40792        r.with_limited_depth(|r| {
40793            let e = i32::read_xdr(r)?;
40794            let v: Self = e.try_into()?;
40795            Ok(v)
40796        })
40797    }
40798}
40799
40800impl WriteXdr for ClawbackResultCode {
40801    #[cfg(feature = "std")]
40802    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
40803        w.with_limited_depth(|w| {
40804            let i: i32 = (*self).into();
40805            i.write_xdr(w)
40806        })
40807    }
40808}
40809
40810/// ClawbackResult is an XDR Union defines as:
40811///
40812/// ```text
40813/// union ClawbackResult switch (ClawbackResultCode code)
40814/// {
40815/// case CLAWBACK_SUCCESS:
40816///     void;
40817/// case CLAWBACK_MALFORMED:
40818/// case CLAWBACK_NOT_CLAWBACK_ENABLED:
40819/// case CLAWBACK_NO_TRUST:
40820/// case CLAWBACK_UNDERFUNDED:
40821///     void;
40822/// };
40823/// ```
40824///
40825// union with discriminant ClawbackResultCode
40826#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
40827#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
40828#[cfg_attr(
40829    all(feature = "serde", feature = "alloc"),
40830    derive(serde::Serialize, serde::Deserialize),
40831    serde(rename_all = "snake_case")
40832)]
40833#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
40834#[allow(clippy::large_enum_variant)]
40835pub enum ClawbackResult {
40836    Success,
40837    Malformed,
40838    NotClawbackEnabled,
40839    NoTrust,
40840    Underfunded,
40841}
40842
40843impl ClawbackResult {
40844    pub const VARIANTS: [ClawbackResultCode; 5] = [
40845        ClawbackResultCode::Success,
40846        ClawbackResultCode::Malformed,
40847        ClawbackResultCode::NotClawbackEnabled,
40848        ClawbackResultCode::NoTrust,
40849        ClawbackResultCode::Underfunded,
40850    ];
40851    pub const VARIANTS_STR: [&'static str; 5] = [
40852        "Success",
40853        "Malformed",
40854        "NotClawbackEnabled",
40855        "NoTrust",
40856        "Underfunded",
40857    ];
40858
40859    #[must_use]
40860    pub const fn name(&self) -> &'static str {
40861        match self {
40862            Self::Success => "Success",
40863            Self::Malformed => "Malformed",
40864            Self::NotClawbackEnabled => "NotClawbackEnabled",
40865            Self::NoTrust => "NoTrust",
40866            Self::Underfunded => "Underfunded",
40867        }
40868    }
40869
40870    #[must_use]
40871    pub const fn discriminant(&self) -> ClawbackResultCode {
40872        #[allow(clippy::match_same_arms)]
40873        match self {
40874            Self::Success => ClawbackResultCode::Success,
40875            Self::Malformed => ClawbackResultCode::Malformed,
40876            Self::NotClawbackEnabled => ClawbackResultCode::NotClawbackEnabled,
40877            Self::NoTrust => ClawbackResultCode::NoTrust,
40878            Self::Underfunded => ClawbackResultCode::Underfunded,
40879        }
40880    }
40881
40882    #[must_use]
40883    pub const fn variants() -> [ClawbackResultCode; 5] {
40884        Self::VARIANTS
40885    }
40886}
40887
40888impl Name for ClawbackResult {
40889    #[must_use]
40890    fn name(&self) -> &'static str {
40891        Self::name(self)
40892    }
40893}
40894
40895impl Discriminant<ClawbackResultCode> for ClawbackResult {
40896    #[must_use]
40897    fn discriminant(&self) -> ClawbackResultCode {
40898        Self::discriminant(self)
40899    }
40900}
40901
40902impl Variants<ClawbackResultCode> for ClawbackResult {
40903    fn variants() -> slice::Iter<'static, ClawbackResultCode> {
40904        Self::VARIANTS.iter()
40905    }
40906}
40907
40908impl Union<ClawbackResultCode> for ClawbackResult {}
40909
40910impl ReadXdr for ClawbackResult {
40911    #[cfg(feature = "std")]
40912    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
40913        r.with_limited_depth(|r| {
40914            let dv: ClawbackResultCode = <ClawbackResultCode as ReadXdr>::read_xdr(r)?;
40915            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
40916            let v = match dv {
40917                ClawbackResultCode::Success => Self::Success,
40918                ClawbackResultCode::Malformed => Self::Malformed,
40919                ClawbackResultCode::NotClawbackEnabled => Self::NotClawbackEnabled,
40920                ClawbackResultCode::NoTrust => Self::NoTrust,
40921                ClawbackResultCode::Underfunded => Self::Underfunded,
40922                #[allow(unreachable_patterns)]
40923                _ => return Err(Error::Invalid),
40924            };
40925            Ok(v)
40926        })
40927    }
40928}
40929
40930impl WriteXdr for ClawbackResult {
40931    #[cfg(feature = "std")]
40932    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
40933        w.with_limited_depth(|w| {
40934            self.discriminant().write_xdr(w)?;
40935            #[allow(clippy::match_same_arms)]
40936            match self {
40937                Self::Success => ().write_xdr(w)?,
40938                Self::Malformed => ().write_xdr(w)?,
40939                Self::NotClawbackEnabled => ().write_xdr(w)?,
40940                Self::NoTrust => ().write_xdr(w)?,
40941                Self::Underfunded => ().write_xdr(w)?,
40942            };
40943            Ok(())
40944        })
40945    }
40946}
40947
40948/// ClawbackClaimableBalanceResultCode is an XDR Enum defines as:
40949///
40950/// ```text
40951/// enum ClawbackClaimableBalanceResultCode
40952/// {
40953///     // codes considered as "success" for the operation
40954///     CLAWBACK_CLAIMABLE_BALANCE_SUCCESS = 0,
40955///
40956///     // codes considered as "failure" for the operation
40957///     CLAWBACK_CLAIMABLE_BALANCE_DOES_NOT_EXIST = -1,
40958///     CLAWBACK_CLAIMABLE_BALANCE_NOT_ISSUER = -2,
40959///     CLAWBACK_CLAIMABLE_BALANCE_NOT_CLAWBACK_ENABLED = -3
40960/// };
40961/// ```
40962///
40963// enum
40964#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
40965#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
40966#[cfg_attr(
40967    all(feature = "serde", feature = "alloc"),
40968    derive(serde::Serialize, serde::Deserialize),
40969    serde(rename_all = "snake_case")
40970)]
40971#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
40972#[repr(i32)]
40973pub enum ClawbackClaimableBalanceResultCode {
40974    Success = 0,
40975    DoesNotExist = -1,
40976    NotIssuer = -2,
40977    NotClawbackEnabled = -3,
40978}
40979
40980impl ClawbackClaimableBalanceResultCode {
40981    pub const VARIANTS: [ClawbackClaimableBalanceResultCode; 4] = [
40982        ClawbackClaimableBalanceResultCode::Success,
40983        ClawbackClaimableBalanceResultCode::DoesNotExist,
40984        ClawbackClaimableBalanceResultCode::NotIssuer,
40985        ClawbackClaimableBalanceResultCode::NotClawbackEnabled,
40986    ];
40987    pub const VARIANTS_STR: [&'static str; 4] =
40988        ["Success", "DoesNotExist", "NotIssuer", "NotClawbackEnabled"];
40989
40990    #[must_use]
40991    pub const fn name(&self) -> &'static str {
40992        match self {
40993            Self::Success => "Success",
40994            Self::DoesNotExist => "DoesNotExist",
40995            Self::NotIssuer => "NotIssuer",
40996            Self::NotClawbackEnabled => "NotClawbackEnabled",
40997        }
40998    }
40999
41000    #[must_use]
41001    pub const fn variants() -> [ClawbackClaimableBalanceResultCode; 4] {
41002        Self::VARIANTS
41003    }
41004}
41005
41006impl Name for ClawbackClaimableBalanceResultCode {
41007    #[must_use]
41008    fn name(&self) -> &'static str {
41009        Self::name(self)
41010    }
41011}
41012
41013impl Variants<ClawbackClaimableBalanceResultCode> for ClawbackClaimableBalanceResultCode {
41014    fn variants() -> slice::Iter<'static, ClawbackClaimableBalanceResultCode> {
41015        Self::VARIANTS.iter()
41016    }
41017}
41018
41019impl Enum for ClawbackClaimableBalanceResultCode {}
41020
41021impl fmt::Display for ClawbackClaimableBalanceResultCode {
41022    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
41023        f.write_str(self.name())
41024    }
41025}
41026
41027impl TryFrom<i32> for ClawbackClaimableBalanceResultCode {
41028    type Error = Error;
41029
41030    fn try_from(i: i32) -> Result<Self> {
41031        let e = match i {
41032            0 => ClawbackClaimableBalanceResultCode::Success,
41033            -1 => ClawbackClaimableBalanceResultCode::DoesNotExist,
41034            -2 => ClawbackClaimableBalanceResultCode::NotIssuer,
41035            -3 => ClawbackClaimableBalanceResultCode::NotClawbackEnabled,
41036            #[allow(unreachable_patterns)]
41037            _ => return Err(Error::Invalid),
41038        };
41039        Ok(e)
41040    }
41041}
41042
41043impl From<ClawbackClaimableBalanceResultCode> for i32 {
41044    #[must_use]
41045    fn from(e: ClawbackClaimableBalanceResultCode) -> Self {
41046        e as Self
41047    }
41048}
41049
41050impl ReadXdr for ClawbackClaimableBalanceResultCode {
41051    #[cfg(feature = "std")]
41052    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
41053        r.with_limited_depth(|r| {
41054            let e = i32::read_xdr(r)?;
41055            let v: Self = e.try_into()?;
41056            Ok(v)
41057        })
41058    }
41059}
41060
41061impl WriteXdr for ClawbackClaimableBalanceResultCode {
41062    #[cfg(feature = "std")]
41063    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
41064        w.with_limited_depth(|w| {
41065            let i: i32 = (*self).into();
41066            i.write_xdr(w)
41067        })
41068    }
41069}
41070
41071/// ClawbackClaimableBalanceResult is an XDR Union defines as:
41072///
41073/// ```text
41074/// union ClawbackClaimableBalanceResult switch (
41075///     ClawbackClaimableBalanceResultCode code)
41076/// {
41077/// case CLAWBACK_CLAIMABLE_BALANCE_SUCCESS:
41078///     void;
41079/// case CLAWBACK_CLAIMABLE_BALANCE_DOES_NOT_EXIST:
41080/// case CLAWBACK_CLAIMABLE_BALANCE_NOT_ISSUER:
41081/// case CLAWBACK_CLAIMABLE_BALANCE_NOT_CLAWBACK_ENABLED:
41082///     void;
41083/// };
41084/// ```
41085///
41086// union with discriminant ClawbackClaimableBalanceResultCode
41087#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
41088#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
41089#[cfg_attr(
41090    all(feature = "serde", feature = "alloc"),
41091    derive(serde::Serialize, serde::Deserialize),
41092    serde(rename_all = "snake_case")
41093)]
41094#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
41095#[allow(clippy::large_enum_variant)]
41096pub enum ClawbackClaimableBalanceResult {
41097    Success,
41098    DoesNotExist,
41099    NotIssuer,
41100    NotClawbackEnabled,
41101}
41102
41103impl ClawbackClaimableBalanceResult {
41104    pub const VARIANTS: [ClawbackClaimableBalanceResultCode; 4] = [
41105        ClawbackClaimableBalanceResultCode::Success,
41106        ClawbackClaimableBalanceResultCode::DoesNotExist,
41107        ClawbackClaimableBalanceResultCode::NotIssuer,
41108        ClawbackClaimableBalanceResultCode::NotClawbackEnabled,
41109    ];
41110    pub const VARIANTS_STR: [&'static str; 4] =
41111        ["Success", "DoesNotExist", "NotIssuer", "NotClawbackEnabled"];
41112
41113    #[must_use]
41114    pub const fn name(&self) -> &'static str {
41115        match self {
41116            Self::Success => "Success",
41117            Self::DoesNotExist => "DoesNotExist",
41118            Self::NotIssuer => "NotIssuer",
41119            Self::NotClawbackEnabled => "NotClawbackEnabled",
41120        }
41121    }
41122
41123    #[must_use]
41124    pub const fn discriminant(&self) -> ClawbackClaimableBalanceResultCode {
41125        #[allow(clippy::match_same_arms)]
41126        match self {
41127            Self::Success => ClawbackClaimableBalanceResultCode::Success,
41128            Self::DoesNotExist => ClawbackClaimableBalanceResultCode::DoesNotExist,
41129            Self::NotIssuer => ClawbackClaimableBalanceResultCode::NotIssuer,
41130            Self::NotClawbackEnabled => ClawbackClaimableBalanceResultCode::NotClawbackEnabled,
41131        }
41132    }
41133
41134    #[must_use]
41135    pub const fn variants() -> [ClawbackClaimableBalanceResultCode; 4] {
41136        Self::VARIANTS
41137    }
41138}
41139
41140impl Name for ClawbackClaimableBalanceResult {
41141    #[must_use]
41142    fn name(&self) -> &'static str {
41143        Self::name(self)
41144    }
41145}
41146
41147impl Discriminant<ClawbackClaimableBalanceResultCode> for ClawbackClaimableBalanceResult {
41148    #[must_use]
41149    fn discriminant(&self) -> ClawbackClaimableBalanceResultCode {
41150        Self::discriminant(self)
41151    }
41152}
41153
41154impl Variants<ClawbackClaimableBalanceResultCode> for ClawbackClaimableBalanceResult {
41155    fn variants() -> slice::Iter<'static, ClawbackClaimableBalanceResultCode> {
41156        Self::VARIANTS.iter()
41157    }
41158}
41159
41160impl Union<ClawbackClaimableBalanceResultCode> for ClawbackClaimableBalanceResult {}
41161
41162impl ReadXdr for ClawbackClaimableBalanceResult {
41163    #[cfg(feature = "std")]
41164    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
41165        r.with_limited_depth(|r| {
41166            let dv: ClawbackClaimableBalanceResultCode =
41167                <ClawbackClaimableBalanceResultCode as ReadXdr>::read_xdr(r)?;
41168            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
41169            let v = match dv {
41170                ClawbackClaimableBalanceResultCode::Success => Self::Success,
41171                ClawbackClaimableBalanceResultCode::DoesNotExist => Self::DoesNotExist,
41172                ClawbackClaimableBalanceResultCode::NotIssuer => Self::NotIssuer,
41173                ClawbackClaimableBalanceResultCode::NotClawbackEnabled => Self::NotClawbackEnabled,
41174                #[allow(unreachable_patterns)]
41175                _ => return Err(Error::Invalid),
41176            };
41177            Ok(v)
41178        })
41179    }
41180}
41181
41182impl WriteXdr for ClawbackClaimableBalanceResult {
41183    #[cfg(feature = "std")]
41184    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
41185        w.with_limited_depth(|w| {
41186            self.discriminant().write_xdr(w)?;
41187            #[allow(clippy::match_same_arms)]
41188            match self {
41189                Self::Success => ().write_xdr(w)?,
41190                Self::DoesNotExist => ().write_xdr(w)?,
41191                Self::NotIssuer => ().write_xdr(w)?,
41192                Self::NotClawbackEnabled => ().write_xdr(w)?,
41193            };
41194            Ok(())
41195        })
41196    }
41197}
41198
41199/// SetTrustLineFlagsResultCode is an XDR Enum defines as:
41200///
41201/// ```text
41202/// enum SetTrustLineFlagsResultCode
41203/// {
41204///     // codes considered as "success" for the operation
41205///     SET_TRUST_LINE_FLAGS_SUCCESS = 0,
41206///
41207///     // codes considered as "failure" for the operation
41208///     SET_TRUST_LINE_FLAGS_MALFORMED = -1,
41209///     SET_TRUST_LINE_FLAGS_NO_TRUST_LINE = -2,
41210///     SET_TRUST_LINE_FLAGS_CANT_REVOKE = -3,
41211///     SET_TRUST_LINE_FLAGS_INVALID_STATE = -4,
41212///     SET_TRUST_LINE_FLAGS_LOW_RESERVE = -5 // claimable balances can't be created
41213///                                           // on revoke due to low reserves
41214/// };
41215/// ```
41216///
41217// enum
41218#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
41219#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
41220#[cfg_attr(
41221    all(feature = "serde", feature = "alloc"),
41222    derive(serde::Serialize, serde::Deserialize),
41223    serde(rename_all = "snake_case")
41224)]
41225#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
41226#[repr(i32)]
41227pub enum SetTrustLineFlagsResultCode {
41228    Success = 0,
41229    Malformed = -1,
41230    NoTrustLine = -2,
41231    CantRevoke = -3,
41232    InvalidState = -4,
41233    LowReserve = -5,
41234}
41235
41236impl SetTrustLineFlagsResultCode {
41237    pub const VARIANTS: [SetTrustLineFlagsResultCode; 6] = [
41238        SetTrustLineFlagsResultCode::Success,
41239        SetTrustLineFlagsResultCode::Malformed,
41240        SetTrustLineFlagsResultCode::NoTrustLine,
41241        SetTrustLineFlagsResultCode::CantRevoke,
41242        SetTrustLineFlagsResultCode::InvalidState,
41243        SetTrustLineFlagsResultCode::LowReserve,
41244    ];
41245    pub const VARIANTS_STR: [&'static str; 6] = [
41246        "Success",
41247        "Malformed",
41248        "NoTrustLine",
41249        "CantRevoke",
41250        "InvalidState",
41251        "LowReserve",
41252    ];
41253
41254    #[must_use]
41255    pub const fn name(&self) -> &'static str {
41256        match self {
41257            Self::Success => "Success",
41258            Self::Malformed => "Malformed",
41259            Self::NoTrustLine => "NoTrustLine",
41260            Self::CantRevoke => "CantRevoke",
41261            Self::InvalidState => "InvalidState",
41262            Self::LowReserve => "LowReserve",
41263        }
41264    }
41265
41266    #[must_use]
41267    pub const fn variants() -> [SetTrustLineFlagsResultCode; 6] {
41268        Self::VARIANTS
41269    }
41270}
41271
41272impl Name for SetTrustLineFlagsResultCode {
41273    #[must_use]
41274    fn name(&self) -> &'static str {
41275        Self::name(self)
41276    }
41277}
41278
41279impl Variants<SetTrustLineFlagsResultCode> for SetTrustLineFlagsResultCode {
41280    fn variants() -> slice::Iter<'static, SetTrustLineFlagsResultCode> {
41281        Self::VARIANTS.iter()
41282    }
41283}
41284
41285impl Enum for SetTrustLineFlagsResultCode {}
41286
41287impl fmt::Display for SetTrustLineFlagsResultCode {
41288    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
41289        f.write_str(self.name())
41290    }
41291}
41292
41293impl TryFrom<i32> for SetTrustLineFlagsResultCode {
41294    type Error = Error;
41295
41296    fn try_from(i: i32) -> Result<Self> {
41297        let e = match i {
41298            0 => SetTrustLineFlagsResultCode::Success,
41299            -1 => SetTrustLineFlagsResultCode::Malformed,
41300            -2 => SetTrustLineFlagsResultCode::NoTrustLine,
41301            -3 => SetTrustLineFlagsResultCode::CantRevoke,
41302            -4 => SetTrustLineFlagsResultCode::InvalidState,
41303            -5 => SetTrustLineFlagsResultCode::LowReserve,
41304            #[allow(unreachable_patterns)]
41305            _ => return Err(Error::Invalid),
41306        };
41307        Ok(e)
41308    }
41309}
41310
41311impl From<SetTrustLineFlagsResultCode> for i32 {
41312    #[must_use]
41313    fn from(e: SetTrustLineFlagsResultCode) -> Self {
41314        e as Self
41315    }
41316}
41317
41318impl ReadXdr for SetTrustLineFlagsResultCode {
41319    #[cfg(feature = "std")]
41320    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
41321        r.with_limited_depth(|r| {
41322            let e = i32::read_xdr(r)?;
41323            let v: Self = e.try_into()?;
41324            Ok(v)
41325        })
41326    }
41327}
41328
41329impl WriteXdr for SetTrustLineFlagsResultCode {
41330    #[cfg(feature = "std")]
41331    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
41332        w.with_limited_depth(|w| {
41333            let i: i32 = (*self).into();
41334            i.write_xdr(w)
41335        })
41336    }
41337}
41338
41339/// SetTrustLineFlagsResult is an XDR Union defines as:
41340///
41341/// ```text
41342/// union SetTrustLineFlagsResult switch (SetTrustLineFlagsResultCode code)
41343/// {
41344/// case SET_TRUST_LINE_FLAGS_SUCCESS:
41345///     void;
41346/// case SET_TRUST_LINE_FLAGS_MALFORMED:
41347/// case SET_TRUST_LINE_FLAGS_NO_TRUST_LINE:
41348/// case SET_TRUST_LINE_FLAGS_CANT_REVOKE:
41349/// case SET_TRUST_LINE_FLAGS_INVALID_STATE:
41350/// case SET_TRUST_LINE_FLAGS_LOW_RESERVE:
41351///     void;
41352/// };
41353/// ```
41354///
41355// union with discriminant SetTrustLineFlagsResultCode
41356#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
41357#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
41358#[cfg_attr(
41359    all(feature = "serde", feature = "alloc"),
41360    derive(serde::Serialize, serde::Deserialize),
41361    serde(rename_all = "snake_case")
41362)]
41363#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
41364#[allow(clippy::large_enum_variant)]
41365pub enum SetTrustLineFlagsResult {
41366    Success,
41367    Malformed,
41368    NoTrustLine,
41369    CantRevoke,
41370    InvalidState,
41371    LowReserve,
41372}
41373
41374impl SetTrustLineFlagsResult {
41375    pub const VARIANTS: [SetTrustLineFlagsResultCode; 6] = [
41376        SetTrustLineFlagsResultCode::Success,
41377        SetTrustLineFlagsResultCode::Malformed,
41378        SetTrustLineFlagsResultCode::NoTrustLine,
41379        SetTrustLineFlagsResultCode::CantRevoke,
41380        SetTrustLineFlagsResultCode::InvalidState,
41381        SetTrustLineFlagsResultCode::LowReserve,
41382    ];
41383    pub const VARIANTS_STR: [&'static str; 6] = [
41384        "Success",
41385        "Malformed",
41386        "NoTrustLine",
41387        "CantRevoke",
41388        "InvalidState",
41389        "LowReserve",
41390    ];
41391
41392    #[must_use]
41393    pub const fn name(&self) -> &'static str {
41394        match self {
41395            Self::Success => "Success",
41396            Self::Malformed => "Malformed",
41397            Self::NoTrustLine => "NoTrustLine",
41398            Self::CantRevoke => "CantRevoke",
41399            Self::InvalidState => "InvalidState",
41400            Self::LowReserve => "LowReserve",
41401        }
41402    }
41403
41404    #[must_use]
41405    pub const fn discriminant(&self) -> SetTrustLineFlagsResultCode {
41406        #[allow(clippy::match_same_arms)]
41407        match self {
41408            Self::Success => SetTrustLineFlagsResultCode::Success,
41409            Self::Malformed => SetTrustLineFlagsResultCode::Malformed,
41410            Self::NoTrustLine => SetTrustLineFlagsResultCode::NoTrustLine,
41411            Self::CantRevoke => SetTrustLineFlagsResultCode::CantRevoke,
41412            Self::InvalidState => SetTrustLineFlagsResultCode::InvalidState,
41413            Self::LowReserve => SetTrustLineFlagsResultCode::LowReserve,
41414        }
41415    }
41416
41417    #[must_use]
41418    pub const fn variants() -> [SetTrustLineFlagsResultCode; 6] {
41419        Self::VARIANTS
41420    }
41421}
41422
41423impl Name for SetTrustLineFlagsResult {
41424    #[must_use]
41425    fn name(&self) -> &'static str {
41426        Self::name(self)
41427    }
41428}
41429
41430impl Discriminant<SetTrustLineFlagsResultCode> for SetTrustLineFlagsResult {
41431    #[must_use]
41432    fn discriminant(&self) -> SetTrustLineFlagsResultCode {
41433        Self::discriminant(self)
41434    }
41435}
41436
41437impl Variants<SetTrustLineFlagsResultCode> for SetTrustLineFlagsResult {
41438    fn variants() -> slice::Iter<'static, SetTrustLineFlagsResultCode> {
41439        Self::VARIANTS.iter()
41440    }
41441}
41442
41443impl Union<SetTrustLineFlagsResultCode> for SetTrustLineFlagsResult {}
41444
41445impl ReadXdr for SetTrustLineFlagsResult {
41446    #[cfg(feature = "std")]
41447    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
41448        r.with_limited_depth(|r| {
41449            let dv: SetTrustLineFlagsResultCode =
41450                <SetTrustLineFlagsResultCode as ReadXdr>::read_xdr(r)?;
41451            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
41452            let v = match dv {
41453                SetTrustLineFlagsResultCode::Success => Self::Success,
41454                SetTrustLineFlagsResultCode::Malformed => Self::Malformed,
41455                SetTrustLineFlagsResultCode::NoTrustLine => Self::NoTrustLine,
41456                SetTrustLineFlagsResultCode::CantRevoke => Self::CantRevoke,
41457                SetTrustLineFlagsResultCode::InvalidState => Self::InvalidState,
41458                SetTrustLineFlagsResultCode::LowReserve => Self::LowReserve,
41459                #[allow(unreachable_patterns)]
41460                _ => return Err(Error::Invalid),
41461            };
41462            Ok(v)
41463        })
41464    }
41465}
41466
41467impl WriteXdr for SetTrustLineFlagsResult {
41468    #[cfg(feature = "std")]
41469    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
41470        w.with_limited_depth(|w| {
41471            self.discriminant().write_xdr(w)?;
41472            #[allow(clippy::match_same_arms)]
41473            match self {
41474                Self::Success => ().write_xdr(w)?,
41475                Self::Malformed => ().write_xdr(w)?,
41476                Self::NoTrustLine => ().write_xdr(w)?,
41477                Self::CantRevoke => ().write_xdr(w)?,
41478                Self::InvalidState => ().write_xdr(w)?,
41479                Self::LowReserve => ().write_xdr(w)?,
41480            };
41481            Ok(())
41482        })
41483    }
41484}
41485
41486/// LiquidityPoolDepositResultCode is an XDR Enum defines as:
41487///
41488/// ```text
41489/// enum LiquidityPoolDepositResultCode
41490/// {
41491///     // codes considered as "success" for the operation
41492///     LIQUIDITY_POOL_DEPOSIT_SUCCESS = 0,
41493///
41494///     // codes considered as "failure" for the operation
41495///     LIQUIDITY_POOL_DEPOSIT_MALFORMED = -1,      // bad input
41496///     LIQUIDITY_POOL_DEPOSIT_NO_TRUST = -2,       // no trust line for one of the
41497///                                                 // assets
41498///     LIQUIDITY_POOL_DEPOSIT_NOT_AUTHORIZED = -3, // not authorized for one of the
41499///                                                 // assets
41500///     LIQUIDITY_POOL_DEPOSIT_UNDERFUNDED = -4,    // not enough balance for one of
41501///                                                 // the assets
41502///     LIQUIDITY_POOL_DEPOSIT_LINE_FULL = -5,      // pool share trust line doesn't
41503///                                                 // have sufficient limit
41504///     LIQUIDITY_POOL_DEPOSIT_BAD_PRICE = -6,      // deposit price outside bounds
41505///     LIQUIDITY_POOL_DEPOSIT_POOL_FULL = -7       // pool reserves are full
41506/// };
41507/// ```
41508///
41509// enum
41510#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
41511#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
41512#[cfg_attr(
41513    all(feature = "serde", feature = "alloc"),
41514    derive(serde::Serialize, serde::Deserialize),
41515    serde(rename_all = "snake_case")
41516)]
41517#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
41518#[repr(i32)]
41519pub enum LiquidityPoolDepositResultCode {
41520    Success = 0,
41521    Malformed = -1,
41522    NoTrust = -2,
41523    NotAuthorized = -3,
41524    Underfunded = -4,
41525    LineFull = -5,
41526    BadPrice = -6,
41527    PoolFull = -7,
41528}
41529
41530impl LiquidityPoolDepositResultCode {
41531    pub const VARIANTS: [LiquidityPoolDepositResultCode; 8] = [
41532        LiquidityPoolDepositResultCode::Success,
41533        LiquidityPoolDepositResultCode::Malformed,
41534        LiquidityPoolDepositResultCode::NoTrust,
41535        LiquidityPoolDepositResultCode::NotAuthorized,
41536        LiquidityPoolDepositResultCode::Underfunded,
41537        LiquidityPoolDepositResultCode::LineFull,
41538        LiquidityPoolDepositResultCode::BadPrice,
41539        LiquidityPoolDepositResultCode::PoolFull,
41540    ];
41541    pub const VARIANTS_STR: [&'static str; 8] = [
41542        "Success",
41543        "Malformed",
41544        "NoTrust",
41545        "NotAuthorized",
41546        "Underfunded",
41547        "LineFull",
41548        "BadPrice",
41549        "PoolFull",
41550    ];
41551
41552    #[must_use]
41553    pub const fn name(&self) -> &'static str {
41554        match self {
41555            Self::Success => "Success",
41556            Self::Malformed => "Malformed",
41557            Self::NoTrust => "NoTrust",
41558            Self::NotAuthorized => "NotAuthorized",
41559            Self::Underfunded => "Underfunded",
41560            Self::LineFull => "LineFull",
41561            Self::BadPrice => "BadPrice",
41562            Self::PoolFull => "PoolFull",
41563        }
41564    }
41565
41566    #[must_use]
41567    pub const fn variants() -> [LiquidityPoolDepositResultCode; 8] {
41568        Self::VARIANTS
41569    }
41570}
41571
41572impl Name for LiquidityPoolDepositResultCode {
41573    #[must_use]
41574    fn name(&self) -> &'static str {
41575        Self::name(self)
41576    }
41577}
41578
41579impl Variants<LiquidityPoolDepositResultCode> for LiquidityPoolDepositResultCode {
41580    fn variants() -> slice::Iter<'static, LiquidityPoolDepositResultCode> {
41581        Self::VARIANTS.iter()
41582    }
41583}
41584
41585impl Enum for LiquidityPoolDepositResultCode {}
41586
41587impl fmt::Display for LiquidityPoolDepositResultCode {
41588    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
41589        f.write_str(self.name())
41590    }
41591}
41592
41593impl TryFrom<i32> for LiquidityPoolDepositResultCode {
41594    type Error = Error;
41595
41596    fn try_from(i: i32) -> Result<Self> {
41597        let e = match i {
41598            0 => LiquidityPoolDepositResultCode::Success,
41599            -1 => LiquidityPoolDepositResultCode::Malformed,
41600            -2 => LiquidityPoolDepositResultCode::NoTrust,
41601            -3 => LiquidityPoolDepositResultCode::NotAuthorized,
41602            -4 => LiquidityPoolDepositResultCode::Underfunded,
41603            -5 => LiquidityPoolDepositResultCode::LineFull,
41604            -6 => LiquidityPoolDepositResultCode::BadPrice,
41605            -7 => LiquidityPoolDepositResultCode::PoolFull,
41606            #[allow(unreachable_patterns)]
41607            _ => return Err(Error::Invalid),
41608        };
41609        Ok(e)
41610    }
41611}
41612
41613impl From<LiquidityPoolDepositResultCode> for i32 {
41614    #[must_use]
41615    fn from(e: LiquidityPoolDepositResultCode) -> Self {
41616        e as Self
41617    }
41618}
41619
41620impl ReadXdr for LiquidityPoolDepositResultCode {
41621    #[cfg(feature = "std")]
41622    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
41623        r.with_limited_depth(|r| {
41624            let e = i32::read_xdr(r)?;
41625            let v: Self = e.try_into()?;
41626            Ok(v)
41627        })
41628    }
41629}
41630
41631impl WriteXdr for LiquidityPoolDepositResultCode {
41632    #[cfg(feature = "std")]
41633    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
41634        w.with_limited_depth(|w| {
41635            let i: i32 = (*self).into();
41636            i.write_xdr(w)
41637        })
41638    }
41639}
41640
41641/// LiquidityPoolDepositResult is an XDR Union defines as:
41642///
41643/// ```text
41644/// union LiquidityPoolDepositResult switch (LiquidityPoolDepositResultCode code)
41645/// {
41646/// case LIQUIDITY_POOL_DEPOSIT_SUCCESS:
41647///     void;
41648/// case LIQUIDITY_POOL_DEPOSIT_MALFORMED:
41649/// case LIQUIDITY_POOL_DEPOSIT_NO_TRUST:
41650/// case LIQUIDITY_POOL_DEPOSIT_NOT_AUTHORIZED:
41651/// case LIQUIDITY_POOL_DEPOSIT_UNDERFUNDED:
41652/// case LIQUIDITY_POOL_DEPOSIT_LINE_FULL:
41653/// case LIQUIDITY_POOL_DEPOSIT_BAD_PRICE:
41654/// case LIQUIDITY_POOL_DEPOSIT_POOL_FULL:
41655///     void;
41656/// };
41657/// ```
41658///
41659// union with discriminant LiquidityPoolDepositResultCode
41660#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
41661#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
41662#[cfg_attr(
41663    all(feature = "serde", feature = "alloc"),
41664    derive(serde::Serialize, serde::Deserialize),
41665    serde(rename_all = "snake_case")
41666)]
41667#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
41668#[allow(clippy::large_enum_variant)]
41669pub enum LiquidityPoolDepositResult {
41670    Success,
41671    Malformed,
41672    NoTrust,
41673    NotAuthorized,
41674    Underfunded,
41675    LineFull,
41676    BadPrice,
41677    PoolFull,
41678}
41679
41680impl LiquidityPoolDepositResult {
41681    pub const VARIANTS: [LiquidityPoolDepositResultCode; 8] = [
41682        LiquidityPoolDepositResultCode::Success,
41683        LiquidityPoolDepositResultCode::Malformed,
41684        LiquidityPoolDepositResultCode::NoTrust,
41685        LiquidityPoolDepositResultCode::NotAuthorized,
41686        LiquidityPoolDepositResultCode::Underfunded,
41687        LiquidityPoolDepositResultCode::LineFull,
41688        LiquidityPoolDepositResultCode::BadPrice,
41689        LiquidityPoolDepositResultCode::PoolFull,
41690    ];
41691    pub const VARIANTS_STR: [&'static str; 8] = [
41692        "Success",
41693        "Malformed",
41694        "NoTrust",
41695        "NotAuthorized",
41696        "Underfunded",
41697        "LineFull",
41698        "BadPrice",
41699        "PoolFull",
41700    ];
41701
41702    #[must_use]
41703    pub const fn name(&self) -> &'static str {
41704        match self {
41705            Self::Success => "Success",
41706            Self::Malformed => "Malformed",
41707            Self::NoTrust => "NoTrust",
41708            Self::NotAuthorized => "NotAuthorized",
41709            Self::Underfunded => "Underfunded",
41710            Self::LineFull => "LineFull",
41711            Self::BadPrice => "BadPrice",
41712            Self::PoolFull => "PoolFull",
41713        }
41714    }
41715
41716    #[must_use]
41717    pub const fn discriminant(&self) -> LiquidityPoolDepositResultCode {
41718        #[allow(clippy::match_same_arms)]
41719        match self {
41720            Self::Success => LiquidityPoolDepositResultCode::Success,
41721            Self::Malformed => LiquidityPoolDepositResultCode::Malformed,
41722            Self::NoTrust => LiquidityPoolDepositResultCode::NoTrust,
41723            Self::NotAuthorized => LiquidityPoolDepositResultCode::NotAuthorized,
41724            Self::Underfunded => LiquidityPoolDepositResultCode::Underfunded,
41725            Self::LineFull => LiquidityPoolDepositResultCode::LineFull,
41726            Self::BadPrice => LiquidityPoolDepositResultCode::BadPrice,
41727            Self::PoolFull => LiquidityPoolDepositResultCode::PoolFull,
41728        }
41729    }
41730
41731    #[must_use]
41732    pub const fn variants() -> [LiquidityPoolDepositResultCode; 8] {
41733        Self::VARIANTS
41734    }
41735}
41736
41737impl Name for LiquidityPoolDepositResult {
41738    #[must_use]
41739    fn name(&self) -> &'static str {
41740        Self::name(self)
41741    }
41742}
41743
41744impl Discriminant<LiquidityPoolDepositResultCode> for LiquidityPoolDepositResult {
41745    #[must_use]
41746    fn discriminant(&self) -> LiquidityPoolDepositResultCode {
41747        Self::discriminant(self)
41748    }
41749}
41750
41751impl Variants<LiquidityPoolDepositResultCode> for LiquidityPoolDepositResult {
41752    fn variants() -> slice::Iter<'static, LiquidityPoolDepositResultCode> {
41753        Self::VARIANTS.iter()
41754    }
41755}
41756
41757impl Union<LiquidityPoolDepositResultCode> for LiquidityPoolDepositResult {}
41758
41759impl ReadXdr for LiquidityPoolDepositResult {
41760    #[cfg(feature = "std")]
41761    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
41762        r.with_limited_depth(|r| {
41763            let dv: LiquidityPoolDepositResultCode =
41764                <LiquidityPoolDepositResultCode as ReadXdr>::read_xdr(r)?;
41765            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
41766            let v = match dv {
41767                LiquidityPoolDepositResultCode::Success => Self::Success,
41768                LiquidityPoolDepositResultCode::Malformed => Self::Malformed,
41769                LiquidityPoolDepositResultCode::NoTrust => Self::NoTrust,
41770                LiquidityPoolDepositResultCode::NotAuthorized => Self::NotAuthorized,
41771                LiquidityPoolDepositResultCode::Underfunded => Self::Underfunded,
41772                LiquidityPoolDepositResultCode::LineFull => Self::LineFull,
41773                LiquidityPoolDepositResultCode::BadPrice => Self::BadPrice,
41774                LiquidityPoolDepositResultCode::PoolFull => Self::PoolFull,
41775                #[allow(unreachable_patterns)]
41776                _ => return Err(Error::Invalid),
41777            };
41778            Ok(v)
41779        })
41780    }
41781}
41782
41783impl WriteXdr for LiquidityPoolDepositResult {
41784    #[cfg(feature = "std")]
41785    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
41786        w.with_limited_depth(|w| {
41787            self.discriminant().write_xdr(w)?;
41788            #[allow(clippy::match_same_arms)]
41789            match self {
41790                Self::Success => ().write_xdr(w)?,
41791                Self::Malformed => ().write_xdr(w)?,
41792                Self::NoTrust => ().write_xdr(w)?,
41793                Self::NotAuthorized => ().write_xdr(w)?,
41794                Self::Underfunded => ().write_xdr(w)?,
41795                Self::LineFull => ().write_xdr(w)?,
41796                Self::BadPrice => ().write_xdr(w)?,
41797                Self::PoolFull => ().write_xdr(w)?,
41798            };
41799            Ok(())
41800        })
41801    }
41802}
41803
41804/// LiquidityPoolWithdrawResultCode is an XDR Enum defines as:
41805///
41806/// ```text
41807/// enum LiquidityPoolWithdrawResultCode
41808/// {
41809///     // codes considered as "success" for the operation
41810///     LIQUIDITY_POOL_WITHDRAW_SUCCESS = 0,
41811///
41812///     // codes considered as "failure" for the operation
41813///     LIQUIDITY_POOL_WITHDRAW_MALFORMED = -1,    // bad input
41814///     LIQUIDITY_POOL_WITHDRAW_NO_TRUST = -2,     // no trust line for one of the
41815///                                                // assets
41816///     LIQUIDITY_POOL_WITHDRAW_UNDERFUNDED = -3,  // not enough balance of the
41817///                                                // pool share
41818///     LIQUIDITY_POOL_WITHDRAW_LINE_FULL = -4,    // would go above limit for one
41819///                                                // of the assets
41820///     LIQUIDITY_POOL_WITHDRAW_UNDER_MINIMUM = -5 // didn't withdraw enough
41821/// };
41822/// ```
41823///
41824// enum
41825#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
41826#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
41827#[cfg_attr(
41828    all(feature = "serde", feature = "alloc"),
41829    derive(serde::Serialize, serde::Deserialize),
41830    serde(rename_all = "snake_case")
41831)]
41832#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
41833#[repr(i32)]
41834pub enum LiquidityPoolWithdrawResultCode {
41835    Success = 0,
41836    Malformed = -1,
41837    NoTrust = -2,
41838    Underfunded = -3,
41839    LineFull = -4,
41840    UnderMinimum = -5,
41841}
41842
41843impl LiquidityPoolWithdrawResultCode {
41844    pub const VARIANTS: [LiquidityPoolWithdrawResultCode; 6] = [
41845        LiquidityPoolWithdrawResultCode::Success,
41846        LiquidityPoolWithdrawResultCode::Malformed,
41847        LiquidityPoolWithdrawResultCode::NoTrust,
41848        LiquidityPoolWithdrawResultCode::Underfunded,
41849        LiquidityPoolWithdrawResultCode::LineFull,
41850        LiquidityPoolWithdrawResultCode::UnderMinimum,
41851    ];
41852    pub const VARIANTS_STR: [&'static str; 6] = [
41853        "Success",
41854        "Malformed",
41855        "NoTrust",
41856        "Underfunded",
41857        "LineFull",
41858        "UnderMinimum",
41859    ];
41860
41861    #[must_use]
41862    pub const fn name(&self) -> &'static str {
41863        match self {
41864            Self::Success => "Success",
41865            Self::Malformed => "Malformed",
41866            Self::NoTrust => "NoTrust",
41867            Self::Underfunded => "Underfunded",
41868            Self::LineFull => "LineFull",
41869            Self::UnderMinimum => "UnderMinimum",
41870        }
41871    }
41872
41873    #[must_use]
41874    pub const fn variants() -> [LiquidityPoolWithdrawResultCode; 6] {
41875        Self::VARIANTS
41876    }
41877}
41878
41879impl Name for LiquidityPoolWithdrawResultCode {
41880    #[must_use]
41881    fn name(&self) -> &'static str {
41882        Self::name(self)
41883    }
41884}
41885
41886impl Variants<LiquidityPoolWithdrawResultCode> for LiquidityPoolWithdrawResultCode {
41887    fn variants() -> slice::Iter<'static, LiquidityPoolWithdrawResultCode> {
41888        Self::VARIANTS.iter()
41889    }
41890}
41891
41892impl Enum for LiquidityPoolWithdrawResultCode {}
41893
41894impl fmt::Display for LiquidityPoolWithdrawResultCode {
41895    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
41896        f.write_str(self.name())
41897    }
41898}
41899
41900impl TryFrom<i32> for LiquidityPoolWithdrawResultCode {
41901    type Error = Error;
41902
41903    fn try_from(i: i32) -> Result<Self> {
41904        let e = match i {
41905            0 => LiquidityPoolWithdrawResultCode::Success,
41906            -1 => LiquidityPoolWithdrawResultCode::Malformed,
41907            -2 => LiquidityPoolWithdrawResultCode::NoTrust,
41908            -3 => LiquidityPoolWithdrawResultCode::Underfunded,
41909            -4 => LiquidityPoolWithdrawResultCode::LineFull,
41910            -5 => LiquidityPoolWithdrawResultCode::UnderMinimum,
41911            #[allow(unreachable_patterns)]
41912            _ => return Err(Error::Invalid),
41913        };
41914        Ok(e)
41915    }
41916}
41917
41918impl From<LiquidityPoolWithdrawResultCode> for i32 {
41919    #[must_use]
41920    fn from(e: LiquidityPoolWithdrawResultCode) -> Self {
41921        e as Self
41922    }
41923}
41924
41925impl ReadXdr for LiquidityPoolWithdrawResultCode {
41926    #[cfg(feature = "std")]
41927    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
41928        r.with_limited_depth(|r| {
41929            let e = i32::read_xdr(r)?;
41930            let v: Self = e.try_into()?;
41931            Ok(v)
41932        })
41933    }
41934}
41935
41936impl WriteXdr for LiquidityPoolWithdrawResultCode {
41937    #[cfg(feature = "std")]
41938    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
41939        w.with_limited_depth(|w| {
41940            let i: i32 = (*self).into();
41941            i.write_xdr(w)
41942        })
41943    }
41944}
41945
41946/// LiquidityPoolWithdrawResult is an XDR Union defines as:
41947///
41948/// ```text
41949/// union LiquidityPoolWithdrawResult switch (LiquidityPoolWithdrawResultCode code)
41950/// {
41951/// case LIQUIDITY_POOL_WITHDRAW_SUCCESS:
41952///     void;
41953/// case LIQUIDITY_POOL_WITHDRAW_MALFORMED:
41954/// case LIQUIDITY_POOL_WITHDRAW_NO_TRUST:
41955/// case LIQUIDITY_POOL_WITHDRAW_UNDERFUNDED:
41956/// case LIQUIDITY_POOL_WITHDRAW_LINE_FULL:
41957/// case LIQUIDITY_POOL_WITHDRAW_UNDER_MINIMUM:
41958///     void;
41959/// };
41960/// ```
41961///
41962// union with discriminant LiquidityPoolWithdrawResultCode
41963#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
41964#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
41965#[cfg_attr(
41966    all(feature = "serde", feature = "alloc"),
41967    derive(serde::Serialize, serde::Deserialize),
41968    serde(rename_all = "snake_case")
41969)]
41970#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
41971#[allow(clippy::large_enum_variant)]
41972pub enum LiquidityPoolWithdrawResult {
41973    Success,
41974    Malformed,
41975    NoTrust,
41976    Underfunded,
41977    LineFull,
41978    UnderMinimum,
41979}
41980
41981impl LiquidityPoolWithdrawResult {
41982    pub const VARIANTS: [LiquidityPoolWithdrawResultCode; 6] = [
41983        LiquidityPoolWithdrawResultCode::Success,
41984        LiquidityPoolWithdrawResultCode::Malformed,
41985        LiquidityPoolWithdrawResultCode::NoTrust,
41986        LiquidityPoolWithdrawResultCode::Underfunded,
41987        LiquidityPoolWithdrawResultCode::LineFull,
41988        LiquidityPoolWithdrawResultCode::UnderMinimum,
41989    ];
41990    pub const VARIANTS_STR: [&'static str; 6] = [
41991        "Success",
41992        "Malformed",
41993        "NoTrust",
41994        "Underfunded",
41995        "LineFull",
41996        "UnderMinimum",
41997    ];
41998
41999    #[must_use]
42000    pub const fn name(&self) -> &'static str {
42001        match self {
42002            Self::Success => "Success",
42003            Self::Malformed => "Malformed",
42004            Self::NoTrust => "NoTrust",
42005            Self::Underfunded => "Underfunded",
42006            Self::LineFull => "LineFull",
42007            Self::UnderMinimum => "UnderMinimum",
42008        }
42009    }
42010
42011    #[must_use]
42012    pub const fn discriminant(&self) -> LiquidityPoolWithdrawResultCode {
42013        #[allow(clippy::match_same_arms)]
42014        match self {
42015            Self::Success => LiquidityPoolWithdrawResultCode::Success,
42016            Self::Malformed => LiquidityPoolWithdrawResultCode::Malformed,
42017            Self::NoTrust => LiquidityPoolWithdrawResultCode::NoTrust,
42018            Self::Underfunded => LiquidityPoolWithdrawResultCode::Underfunded,
42019            Self::LineFull => LiquidityPoolWithdrawResultCode::LineFull,
42020            Self::UnderMinimum => LiquidityPoolWithdrawResultCode::UnderMinimum,
42021        }
42022    }
42023
42024    #[must_use]
42025    pub const fn variants() -> [LiquidityPoolWithdrawResultCode; 6] {
42026        Self::VARIANTS
42027    }
42028}
42029
42030impl Name for LiquidityPoolWithdrawResult {
42031    #[must_use]
42032    fn name(&self) -> &'static str {
42033        Self::name(self)
42034    }
42035}
42036
42037impl Discriminant<LiquidityPoolWithdrawResultCode> for LiquidityPoolWithdrawResult {
42038    #[must_use]
42039    fn discriminant(&self) -> LiquidityPoolWithdrawResultCode {
42040        Self::discriminant(self)
42041    }
42042}
42043
42044impl Variants<LiquidityPoolWithdrawResultCode> for LiquidityPoolWithdrawResult {
42045    fn variants() -> slice::Iter<'static, LiquidityPoolWithdrawResultCode> {
42046        Self::VARIANTS.iter()
42047    }
42048}
42049
42050impl Union<LiquidityPoolWithdrawResultCode> for LiquidityPoolWithdrawResult {}
42051
42052impl ReadXdr for LiquidityPoolWithdrawResult {
42053    #[cfg(feature = "std")]
42054    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
42055        r.with_limited_depth(|r| {
42056            let dv: LiquidityPoolWithdrawResultCode =
42057                <LiquidityPoolWithdrawResultCode as ReadXdr>::read_xdr(r)?;
42058            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
42059            let v = match dv {
42060                LiquidityPoolWithdrawResultCode::Success => Self::Success,
42061                LiquidityPoolWithdrawResultCode::Malformed => Self::Malformed,
42062                LiquidityPoolWithdrawResultCode::NoTrust => Self::NoTrust,
42063                LiquidityPoolWithdrawResultCode::Underfunded => Self::Underfunded,
42064                LiquidityPoolWithdrawResultCode::LineFull => Self::LineFull,
42065                LiquidityPoolWithdrawResultCode::UnderMinimum => Self::UnderMinimum,
42066                #[allow(unreachable_patterns)]
42067                _ => return Err(Error::Invalid),
42068            };
42069            Ok(v)
42070        })
42071    }
42072}
42073
42074impl WriteXdr for LiquidityPoolWithdrawResult {
42075    #[cfg(feature = "std")]
42076    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
42077        w.with_limited_depth(|w| {
42078            self.discriminant().write_xdr(w)?;
42079            #[allow(clippy::match_same_arms)]
42080            match self {
42081                Self::Success => ().write_xdr(w)?,
42082                Self::Malformed => ().write_xdr(w)?,
42083                Self::NoTrust => ().write_xdr(w)?,
42084                Self::Underfunded => ().write_xdr(w)?,
42085                Self::LineFull => ().write_xdr(w)?,
42086                Self::UnderMinimum => ().write_xdr(w)?,
42087            };
42088            Ok(())
42089        })
42090    }
42091}
42092
42093/// InvokeHostFunctionResultCode is an XDR Enum defines as:
42094///
42095/// ```text
42096/// enum InvokeHostFunctionResultCode
42097/// {
42098///     // codes considered as "success" for the operation
42099///     INVOKE_HOST_FUNCTION_SUCCESS = 0,
42100///
42101///     // codes considered as "failure" for the operation
42102///     INVOKE_HOST_FUNCTION_MALFORMED = -1,
42103///     INVOKE_HOST_FUNCTION_TRAPPED = -2,
42104///     INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED = -3,
42105///     INVOKE_HOST_FUNCTION_ENTRY_ARCHIVED = -4,
42106///     INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE = -5,
42107///     INVOKE_HOST_FUNCTION_INVALID_CREATION_PROOF = -6
42108/// };
42109/// ```
42110///
42111// enum
42112#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
42113#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
42114#[cfg_attr(
42115    all(feature = "serde", feature = "alloc"),
42116    derive(serde::Serialize, serde::Deserialize),
42117    serde(rename_all = "snake_case")
42118)]
42119#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
42120#[repr(i32)]
42121pub enum InvokeHostFunctionResultCode {
42122    Success = 0,
42123    Malformed = -1,
42124    Trapped = -2,
42125    ResourceLimitExceeded = -3,
42126    EntryArchived = -4,
42127    InsufficientRefundableFee = -5,
42128    InvalidCreationProof = -6,
42129}
42130
42131impl InvokeHostFunctionResultCode {
42132    pub const VARIANTS: [InvokeHostFunctionResultCode; 7] = [
42133        InvokeHostFunctionResultCode::Success,
42134        InvokeHostFunctionResultCode::Malformed,
42135        InvokeHostFunctionResultCode::Trapped,
42136        InvokeHostFunctionResultCode::ResourceLimitExceeded,
42137        InvokeHostFunctionResultCode::EntryArchived,
42138        InvokeHostFunctionResultCode::InsufficientRefundableFee,
42139        InvokeHostFunctionResultCode::InvalidCreationProof,
42140    ];
42141    pub const VARIANTS_STR: [&'static str; 7] = [
42142        "Success",
42143        "Malformed",
42144        "Trapped",
42145        "ResourceLimitExceeded",
42146        "EntryArchived",
42147        "InsufficientRefundableFee",
42148        "InvalidCreationProof",
42149    ];
42150
42151    #[must_use]
42152    pub const fn name(&self) -> &'static str {
42153        match self {
42154            Self::Success => "Success",
42155            Self::Malformed => "Malformed",
42156            Self::Trapped => "Trapped",
42157            Self::ResourceLimitExceeded => "ResourceLimitExceeded",
42158            Self::EntryArchived => "EntryArchived",
42159            Self::InsufficientRefundableFee => "InsufficientRefundableFee",
42160            Self::InvalidCreationProof => "InvalidCreationProof",
42161        }
42162    }
42163
42164    #[must_use]
42165    pub const fn variants() -> [InvokeHostFunctionResultCode; 7] {
42166        Self::VARIANTS
42167    }
42168}
42169
42170impl Name for InvokeHostFunctionResultCode {
42171    #[must_use]
42172    fn name(&self) -> &'static str {
42173        Self::name(self)
42174    }
42175}
42176
42177impl Variants<InvokeHostFunctionResultCode> for InvokeHostFunctionResultCode {
42178    fn variants() -> slice::Iter<'static, InvokeHostFunctionResultCode> {
42179        Self::VARIANTS.iter()
42180    }
42181}
42182
42183impl Enum for InvokeHostFunctionResultCode {}
42184
42185impl fmt::Display for InvokeHostFunctionResultCode {
42186    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
42187        f.write_str(self.name())
42188    }
42189}
42190
42191impl TryFrom<i32> for InvokeHostFunctionResultCode {
42192    type Error = Error;
42193
42194    fn try_from(i: i32) -> Result<Self> {
42195        let e = match i {
42196            0 => InvokeHostFunctionResultCode::Success,
42197            -1 => InvokeHostFunctionResultCode::Malformed,
42198            -2 => InvokeHostFunctionResultCode::Trapped,
42199            -3 => InvokeHostFunctionResultCode::ResourceLimitExceeded,
42200            -4 => InvokeHostFunctionResultCode::EntryArchived,
42201            -5 => InvokeHostFunctionResultCode::InsufficientRefundableFee,
42202            -6 => InvokeHostFunctionResultCode::InvalidCreationProof,
42203            #[allow(unreachable_patterns)]
42204            _ => return Err(Error::Invalid),
42205        };
42206        Ok(e)
42207    }
42208}
42209
42210impl From<InvokeHostFunctionResultCode> for i32 {
42211    #[must_use]
42212    fn from(e: InvokeHostFunctionResultCode) -> Self {
42213        e as Self
42214    }
42215}
42216
42217impl ReadXdr for InvokeHostFunctionResultCode {
42218    #[cfg(feature = "std")]
42219    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
42220        r.with_limited_depth(|r| {
42221            let e = i32::read_xdr(r)?;
42222            let v: Self = e.try_into()?;
42223            Ok(v)
42224        })
42225    }
42226}
42227
42228impl WriteXdr for InvokeHostFunctionResultCode {
42229    #[cfg(feature = "std")]
42230    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
42231        w.with_limited_depth(|w| {
42232            let i: i32 = (*self).into();
42233            i.write_xdr(w)
42234        })
42235    }
42236}
42237
42238/// InvokeHostFunctionResult is an XDR Union defines as:
42239///
42240/// ```text
42241/// union InvokeHostFunctionResult switch (InvokeHostFunctionResultCode code)
42242/// {
42243/// case INVOKE_HOST_FUNCTION_SUCCESS:
42244///     Hash success; // sha256(InvokeHostFunctionSuccessPreImage)
42245/// case INVOKE_HOST_FUNCTION_MALFORMED:
42246/// case INVOKE_HOST_FUNCTION_TRAPPED:
42247/// case INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED:
42248/// case INVOKE_HOST_FUNCTION_ENTRY_ARCHIVED:
42249/// case INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE:
42250///     void;
42251/// };
42252/// ```
42253///
42254// union with discriminant InvokeHostFunctionResultCode
42255#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
42256#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
42257#[cfg_attr(
42258    all(feature = "serde", feature = "alloc"),
42259    derive(serde::Serialize, serde::Deserialize),
42260    serde(rename_all = "snake_case")
42261)]
42262#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
42263#[allow(clippy::large_enum_variant)]
42264pub enum InvokeHostFunctionResult {
42265    Success(Hash),
42266    Malformed,
42267    Trapped,
42268    ResourceLimitExceeded,
42269    EntryArchived,
42270    InsufficientRefundableFee,
42271}
42272
42273impl InvokeHostFunctionResult {
42274    pub const VARIANTS: [InvokeHostFunctionResultCode; 6] = [
42275        InvokeHostFunctionResultCode::Success,
42276        InvokeHostFunctionResultCode::Malformed,
42277        InvokeHostFunctionResultCode::Trapped,
42278        InvokeHostFunctionResultCode::ResourceLimitExceeded,
42279        InvokeHostFunctionResultCode::EntryArchived,
42280        InvokeHostFunctionResultCode::InsufficientRefundableFee,
42281    ];
42282    pub const VARIANTS_STR: [&'static str; 6] = [
42283        "Success",
42284        "Malformed",
42285        "Trapped",
42286        "ResourceLimitExceeded",
42287        "EntryArchived",
42288        "InsufficientRefundableFee",
42289    ];
42290
42291    #[must_use]
42292    pub const fn name(&self) -> &'static str {
42293        match self {
42294            Self::Success(_) => "Success",
42295            Self::Malformed => "Malformed",
42296            Self::Trapped => "Trapped",
42297            Self::ResourceLimitExceeded => "ResourceLimitExceeded",
42298            Self::EntryArchived => "EntryArchived",
42299            Self::InsufficientRefundableFee => "InsufficientRefundableFee",
42300        }
42301    }
42302
42303    #[must_use]
42304    pub const fn discriminant(&self) -> InvokeHostFunctionResultCode {
42305        #[allow(clippy::match_same_arms)]
42306        match self {
42307            Self::Success(_) => InvokeHostFunctionResultCode::Success,
42308            Self::Malformed => InvokeHostFunctionResultCode::Malformed,
42309            Self::Trapped => InvokeHostFunctionResultCode::Trapped,
42310            Self::ResourceLimitExceeded => InvokeHostFunctionResultCode::ResourceLimitExceeded,
42311            Self::EntryArchived => InvokeHostFunctionResultCode::EntryArchived,
42312            Self::InsufficientRefundableFee => {
42313                InvokeHostFunctionResultCode::InsufficientRefundableFee
42314            }
42315        }
42316    }
42317
42318    #[must_use]
42319    pub const fn variants() -> [InvokeHostFunctionResultCode; 6] {
42320        Self::VARIANTS
42321    }
42322}
42323
42324impl Name for InvokeHostFunctionResult {
42325    #[must_use]
42326    fn name(&self) -> &'static str {
42327        Self::name(self)
42328    }
42329}
42330
42331impl Discriminant<InvokeHostFunctionResultCode> for InvokeHostFunctionResult {
42332    #[must_use]
42333    fn discriminant(&self) -> InvokeHostFunctionResultCode {
42334        Self::discriminant(self)
42335    }
42336}
42337
42338impl Variants<InvokeHostFunctionResultCode> for InvokeHostFunctionResult {
42339    fn variants() -> slice::Iter<'static, InvokeHostFunctionResultCode> {
42340        Self::VARIANTS.iter()
42341    }
42342}
42343
42344impl Union<InvokeHostFunctionResultCode> for InvokeHostFunctionResult {}
42345
42346impl ReadXdr for InvokeHostFunctionResult {
42347    #[cfg(feature = "std")]
42348    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
42349        r.with_limited_depth(|r| {
42350            let dv: InvokeHostFunctionResultCode =
42351                <InvokeHostFunctionResultCode as ReadXdr>::read_xdr(r)?;
42352            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
42353            let v = match dv {
42354                InvokeHostFunctionResultCode::Success => Self::Success(Hash::read_xdr(r)?),
42355                InvokeHostFunctionResultCode::Malformed => Self::Malformed,
42356                InvokeHostFunctionResultCode::Trapped => Self::Trapped,
42357                InvokeHostFunctionResultCode::ResourceLimitExceeded => Self::ResourceLimitExceeded,
42358                InvokeHostFunctionResultCode::EntryArchived => Self::EntryArchived,
42359                InvokeHostFunctionResultCode::InsufficientRefundableFee => {
42360                    Self::InsufficientRefundableFee
42361                }
42362                #[allow(unreachable_patterns)]
42363                _ => return Err(Error::Invalid),
42364            };
42365            Ok(v)
42366        })
42367    }
42368}
42369
42370impl WriteXdr for InvokeHostFunctionResult {
42371    #[cfg(feature = "std")]
42372    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
42373        w.with_limited_depth(|w| {
42374            self.discriminant().write_xdr(w)?;
42375            #[allow(clippy::match_same_arms)]
42376            match self {
42377                Self::Success(v) => v.write_xdr(w)?,
42378                Self::Malformed => ().write_xdr(w)?,
42379                Self::Trapped => ().write_xdr(w)?,
42380                Self::ResourceLimitExceeded => ().write_xdr(w)?,
42381                Self::EntryArchived => ().write_xdr(w)?,
42382                Self::InsufficientRefundableFee => ().write_xdr(w)?,
42383            };
42384            Ok(())
42385        })
42386    }
42387}
42388
42389/// ExtendFootprintTtlResultCode is an XDR Enum defines as:
42390///
42391/// ```text
42392/// enum ExtendFootprintTTLResultCode
42393/// {
42394///     // codes considered as "success" for the operation
42395///     EXTEND_FOOTPRINT_TTL_SUCCESS = 0,
42396///
42397///     // codes considered as "failure" for the operation
42398///     EXTEND_FOOTPRINT_TTL_MALFORMED = -1,
42399///     EXTEND_FOOTPRINT_TTL_RESOURCE_LIMIT_EXCEEDED = -2,
42400///     EXTEND_FOOTPRINT_TTL_INSUFFICIENT_REFUNDABLE_FEE = -3
42401/// };
42402/// ```
42403///
42404// enum
42405#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
42406#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
42407#[cfg_attr(
42408    all(feature = "serde", feature = "alloc"),
42409    derive(serde::Serialize, serde::Deserialize),
42410    serde(rename_all = "snake_case")
42411)]
42412#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
42413#[repr(i32)]
42414pub enum ExtendFootprintTtlResultCode {
42415    Success = 0,
42416    Malformed = -1,
42417    ResourceLimitExceeded = -2,
42418    InsufficientRefundableFee = -3,
42419}
42420
42421impl ExtendFootprintTtlResultCode {
42422    pub const VARIANTS: [ExtendFootprintTtlResultCode; 4] = [
42423        ExtendFootprintTtlResultCode::Success,
42424        ExtendFootprintTtlResultCode::Malformed,
42425        ExtendFootprintTtlResultCode::ResourceLimitExceeded,
42426        ExtendFootprintTtlResultCode::InsufficientRefundableFee,
42427    ];
42428    pub const VARIANTS_STR: [&'static str; 4] = [
42429        "Success",
42430        "Malformed",
42431        "ResourceLimitExceeded",
42432        "InsufficientRefundableFee",
42433    ];
42434
42435    #[must_use]
42436    pub const fn name(&self) -> &'static str {
42437        match self {
42438            Self::Success => "Success",
42439            Self::Malformed => "Malformed",
42440            Self::ResourceLimitExceeded => "ResourceLimitExceeded",
42441            Self::InsufficientRefundableFee => "InsufficientRefundableFee",
42442        }
42443    }
42444
42445    #[must_use]
42446    pub const fn variants() -> [ExtendFootprintTtlResultCode; 4] {
42447        Self::VARIANTS
42448    }
42449}
42450
42451impl Name for ExtendFootprintTtlResultCode {
42452    #[must_use]
42453    fn name(&self) -> &'static str {
42454        Self::name(self)
42455    }
42456}
42457
42458impl Variants<ExtendFootprintTtlResultCode> for ExtendFootprintTtlResultCode {
42459    fn variants() -> slice::Iter<'static, ExtendFootprintTtlResultCode> {
42460        Self::VARIANTS.iter()
42461    }
42462}
42463
42464impl Enum for ExtendFootprintTtlResultCode {}
42465
42466impl fmt::Display for ExtendFootprintTtlResultCode {
42467    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
42468        f.write_str(self.name())
42469    }
42470}
42471
42472impl TryFrom<i32> for ExtendFootprintTtlResultCode {
42473    type Error = Error;
42474
42475    fn try_from(i: i32) -> Result<Self> {
42476        let e = match i {
42477            0 => ExtendFootprintTtlResultCode::Success,
42478            -1 => ExtendFootprintTtlResultCode::Malformed,
42479            -2 => ExtendFootprintTtlResultCode::ResourceLimitExceeded,
42480            -3 => ExtendFootprintTtlResultCode::InsufficientRefundableFee,
42481            #[allow(unreachable_patterns)]
42482            _ => return Err(Error::Invalid),
42483        };
42484        Ok(e)
42485    }
42486}
42487
42488impl From<ExtendFootprintTtlResultCode> for i32 {
42489    #[must_use]
42490    fn from(e: ExtendFootprintTtlResultCode) -> Self {
42491        e as Self
42492    }
42493}
42494
42495impl ReadXdr for ExtendFootprintTtlResultCode {
42496    #[cfg(feature = "std")]
42497    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
42498        r.with_limited_depth(|r| {
42499            let e = i32::read_xdr(r)?;
42500            let v: Self = e.try_into()?;
42501            Ok(v)
42502        })
42503    }
42504}
42505
42506impl WriteXdr for ExtendFootprintTtlResultCode {
42507    #[cfg(feature = "std")]
42508    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
42509        w.with_limited_depth(|w| {
42510            let i: i32 = (*self).into();
42511            i.write_xdr(w)
42512        })
42513    }
42514}
42515
42516/// ExtendFootprintTtlResult is an XDR Union defines as:
42517///
42518/// ```text
42519/// union ExtendFootprintTTLResult switch (ExtendFootprintTTLResultCode code)
42520/// {
42521/// case EXTEND_FOOTPRINT_TTL_SUCCESS:
42522///     void;
42523/// case EXTEND_FOOTPRINT_TTL_MALFORMED:
42524/// case EXTEND_FOOTPRINT_TTL_RESOURCE_LIMIT_EXCEEDED:
42525/// case EXTEND_FOOTPRINT_TTL_INSUFFICIENT_REFUNDABLE_FEE:
42526///     void;
42527/// };
42528/// ```
42529///
42530// union with discriminant ExtendFootprintTtlResultCode
42531#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
42532#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
42533#[cfg_attr(
42534    all(feature = "serde", feature = "alloc"),
42535    derive(serde::Serialize, serde::Deserialize),
42536    serde(rename_all = "snake_case")
42537)]
42538#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
42539#[allow(clippy::large_enum_variant)]
42540pub enum ExtendFootprintTtlResult {
42541    Success,
42542    Malformed,
42543    ResourceLimitExceeded,
42544    InsufficientRefundableFee,
42545}
42546
42547impl ExtendFootprintTtlResult {
42548    pub const VARIANTS: [ExtendFootprintTtlResultCode; 4] = [
42549        ExtendFootprintTtlResultCode::Success,
42550        ExtendFootprintTtlResultCode::Malformed,
42551        ExtendFootprintTtlResultCode::ResourceLimitExceeded,
42552        ExtendFootprintTtlResultCode::InsufficientRefundableFee,
42553    ];
42554    pub const VARIANTS_STR: [&'static str; 4] = [
42555        "Success",
42556        "Malformed",
42557        "ResourceLimitExceeded",
42558        "InsufficientRefundableFee",
42559    ];
42560
42561    #[must_use]
42562    pub const fn name(&self) -> &'static str {
42563        match self {
42564            Self::Success => "Success",
42565            Self::Malformed => "Malformed",
42566            Self::ResourceLimitExceeded => "ResourceLimitExceeded",
42567            Self::InsufficientRefundableFee => "InsufficientRefundableFee",
42568        }
42569    }
42570
42571    #[must_use]
42572    pub const fn discriminant(&self) -> ExtendFootprintTtlResultCode {
42573        #[allow(clippy::match_same_arms)]
42574        match self {
42575            Self::Success => ExtendFootprintTtlResultCode::Success,
42576            Self::Malformed => ExtendFootprintTtlResultCode::Malformed,
42577            Self::ResourceLimitExceeded => ExtendFootprintTtlResultCode::ResourceLimitExceeded,
42578            Self::InsufficientRefundableFee => {
42579                ExtendFootprintTtlResultCode::InsufficientRefundableFee
42580            }
42581        }
42582    }
42583
42584    #[must_use]
42585    pub const fn variants() -> [ExtendFootprintTtlResultCode; 4] {
42586        Self::VARIANTS
42587    }
42588}
42589
42590impl Name for ExtendFootprintTtlResult {
42591    #[must_use]
42592    fn name(&self) -> &'static str {
42593        Self::name(self)
42594    }
42595}
42596
42597impl Discriminant<ExtendFootprintTtlResultCode> for ExtendFootprintTtlResult {
42598    #[must_use]
42599    fn discriminant(&self) -> ExtendFootprintTtlResultCode {
42600        Self::discriminant(self)
42601    }
42602}
42603
42604impl Variants<ExtendFootprintTtlResultCode> for ExtendFootprintTtlResult {
42605    fn variants() -> slice::Iter<'static, ExtendFootprintTtlResultCode> {
42606        Self::VARIANTS.iter()
42607    }
42608}
42609
42610impl Union<ExtendFootprintTtlResultCode> for ExtendFootprintTtlResult {}
42611
42612impl ReadXdr for ExtendFootprintTtlResult {
42613    #[cfg(feature = "std")]
42614    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
42615        r.with_limited_depth(|r| {
42616            let dv: ExtendFootprintTtlResultCode =
42617                <ExtendFootprintTtlResultCode as ReadXdr>::read_xdr(r)?;
42618            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
42619            let v = match dv {
42620                ExtendFootprintTtlResultCode::Success => Self::Success,
42621                ExtendFootprintTtlResultCode::Malformed => Self::Malformed,
42622                ExtendFootprintTtlResultCode::ResourceLimitExceeded => Self::ResourceLimitExceeded,
42623                ExtendFootprintTtlResultCode::InsufficientRefundableFee => {
42624                    Self::InsufficientRefundableFee
42625                }
42626                #[allow(unreachable_patterns)]
42627                _ => return Err(Error::Invalid),
42628            };
42629            Ok(v)
42630        })
42631    }
42632}
42633
42634impl WriteXdr for ExtendFootprintTtlResult {
42635    #[cfg(feature = "std")]
42636    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
42637        w.with_limited_depth(|w| {
42638            self.discriminant().write_xdr(w)?;
42639            #[allow(clippy::match_same_arms)]
42640            match self {
42641                Self::Success => ().write_xdr(w)?,
42642                Self::Malformed => ().write_xdr(w)?,
42643                Self::ResourceLimitExceeded => ().write_xdr(w)?,
42644                Self::InsufficientRefundableFee => ().write_xdr(w)?,
42645            };
42646            Ok(())
42647        })
42648    }
42649}
42650
42651/// RestoreFootprintResultCode is an XDR Enum defines as:
42652///
42653/// ```text
42654/// enum RestoreFootprintResultCode
42655/// {
42656///     // codes considered as "success" for the operation
42657///     RESTORE_FOOTPRINT_SUCCESS = 0,
42658///
42659///     // codes considered as "failure" for the operation
42660///     RESTORE_FOOTPRINT_MALFORMED = -1,
42661///     RESTORE_FOOTPRINT_RESOURCE_LIMIT_EXCEEDED = -2,
42662///     RESTORE_FOOTPRINT_INSUFFICIENT_REFUNDABLE_FEE = -3,
42663///     RESTORE_FOOTPRINT_INVALID_PROOF = -4
42664/// };
42665/// ```
42666///
42667// enum
42668#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
42669#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
42670#[cfg_attr(
42671    all(feature = "serde", feature = "alloc"),
42672    derive(serde::Serialize, serde::Deserialize),
42673    serde(rename_all = "snake_case")
42674)]
42675#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
42676#[repr(i32)]
42677pub enum RestoreFootprintResultCode {
42678    Success = 0,
42679    Malformed = -1,
42680    ResourceLimitExceeded = -2,
42681    InsufficientRefundableFee = -3,
42682    InvalidProof = -4,
42683}
42684
42685impl RestoreFootprintResultCode {
42686    pub const VARIANTS: [RestoreFootprintResultCode; 5] = [
42687        RestoreFootprintResultCode::Success,
42688        RestoreFootprintResultCode::Malformed,
42689        RestoreFootprintResultCode::ResourceLimitExceeded,
42690        RestoreFootprintResultCode::InsufficientRefundableFee,
42691        RestoreFootprintResultCode::InvalidProof,
42692    ];
42693    pub const VARIANTS_STR: [&'static str; 5] = [
42694        "Success",
42695        "Malformed",
42696        "ResourceLimitExceeded",
42697        "InsufficientRefundableFee",
42698        "InvalidProof",
42699    ];
42700
42701    #[must_use]
42702    pub const fn name(&self) -> &'static str {
42703        match self {
42704            Self::Success => "Success",
42705            Self::Malformed => "Malformed",
42706            Self::ResourceLimitExceeded => "ResourceLimitExceeded",
42707            Self::InsufficientRefundableFee => "InsufficientRefundableFee",
42708            Self::InvalidProof => "InvalidProof",
42709        }
42710    }
42711
42712    #[must_use]
42713    pub const fn variants() -> [RestoreFootprintResultCode; 5] {
42714        Self::VARIANTS
42715    }
42716}
42717
42718impl Name for RestoreFootprintResultCode {
42719    #[must_use]
42720    fn name(&self) -> &'static str {
42721        Self::name(self)
42722    }
42723}
42724
42725impl Variants<RestoreFootprintResultCode> for RestoreFootprintResultCode {
42726    fn variants() -> slice::Iter<'static, RestoreFootprintResultCode> {
42727        Self::VARIANTS.iter()
42728    }
42729}
42730
42731impl Enum for RestoreFootprintResultCode {}
42732
42733impl fmt::Display for RestoreFootprintResultCode {
42734    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
42735        f.write_str(self.name())
42736    }
42737}
42738
42739impl TryFrom<i32> for RestoreFootprintResultCode {
42740    type Error = Error;
42741
42742    fn try_from(i: i32) -> Result<Self> {
42743        let e = match i {
42744            0 => RestoreFootprintResultCode::Success,
42745            -1 => RestoreFootprintResultCode::Malformed,
42746            -2 => RestoreFootprintResultCode::ResourceLimitExceeded,
42747            -3 => RestoreFootprintResultCode::InsufficientRefundableFee,
42748            -4 => RestoreFootprintResultCode::InvalidProof,
42749            #[allow(unreachable_patterns)]
42750            _ => return Err(Error::Invalid),
42751        };
42752        Ok(e)
42753    }
42754}
42755
42756impl From<RestoreFootprintResultCode> for i32 {
42757    #[must_use]
42758    fn from(e: RestoreFootprintResultCode) -> Self {
42759        e as Self
42760    }
42761}
42762
42763impl ReadXdr for RestoreFootprintResultCode {
42764    #[cfg(feature = "std")]
42765    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
42766        r.with_limited_depth(|r| {
42767            let e = i32::read_xdr(r)?;
42768            let v: Self = e.try_into()?;
42769            Ok(v)
42770        })
42771    }
42772}
42773
42774impl WriteXdr for RestoreFootprintResultCode {
42775    #[cfg(feature = "std")]
42776    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
42777        w.with_limited_depth(|w| {
42778            let i: i32 = (*self).into();
42779            i.write_xdr(w)
42780        })
42781    }
42782}
42783
42784/// RestoreFootprintResult is an XDR Union defines as:
42785///
42786/// ```text
42787/// union RestoreFootprintResult switch (RestoreFootprintResultCode code)
42788/// {
42789/// case RESTORE_FOOTPRINT_SUCCESS:
42790///     void;
42791/// case RESTORE_FOOTPRINT_MALFORMED:
42792/// case RESTORE_FOOTPRINT_RESOURCE_LIMIT_EXCEEDED:
42793/// case RESTORE_FOOTPRINT_INSUFFICIENT_REFUNDABLE_FEE:
42794///     void;
42795/// };
42796/// ```
42797///
42798// union with discriminant RestoreFootprintResultCode
42799#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
42800#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
42801#[cfg_attr(
42802    all(feature = "serde", feature = "alloc"),
42803    derive(serde::Serialize, serde::Deserialize),
42804    serde(rename_all = "snake_case")
42805)]
42806#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
42807#[allow(clippy::large_enum_variant)]
42808pub enum RestoreFootprintResult {
42809    Success,
42810    Malformed,
42811    ResourceLimitExceeded,
42812    InsufficientRefundableFee,
42813}
42814
42815impl RestoreFootprintResult {
42816    pub const VARIANTS: [RestoreFootprintResultCode; 4] = [
42817        RestoreFootprintResultCode::Success,
42818        RestoreFootprintResultCode::Malformed,
42819        RestoreFootprintResultCode::ResourceLimitExceeded,
42820        RestoreFootprintResultCode::InsufficientRefundableFee,
42821    ];
42822    pub const VARIANTS_STR: [&'static str; 4] = [
42823        "Success",
42824        "Malformed",
42825        "ResourceLimitExceeded",
42826        "InsufficientRefundableFee",
42827    ];
42828
42829    #[must_use]
42830    pub const fn name(&self) -> &'static str {
42831        match self {
42832            Self::Success => "Success",
42833            Self::Malformed => "Malformed",
42834            Self::ResourceLimitExceeded => "ResourceLimitExceeded",
42835            Self::InsufficientRefundableFee => "InsufficientRefundableFee",
42836        }
42837    }
42838
42839    #[must_use]
42840    pub const fn discriminant(&self) -> RestoreFootprintResultCode {
42841        #[allow(clippy::match_same_arms)]
42842        match self {
42843            Self::Success => RestoreFootprintResultCode::Success,
42844            Self::Malformed => RestoreFootprintResultCode::Malformed,
42845            Self::ResourceLimitExceeded => RestoreFootprintResultCode::ResourceLimitExceeded,
42846            Self::InsufficientRefundableFee => {
42847                RestoreFootprintResultCode::InsufficientRefundableFee
42848            }
42849        }
42850    }
42851
42852    #[must_use]
42853    pub const fn variants() -> [RestoreFootprintResultCode; 4] {
42854        Self::VARIANTS
42855    }
42856}
42857
42858impl Name for RestoreFootprintResult {
42859    #[must_use]
42860    fn name(&self) -> &'static str {
42861        Self::name(self)
42862    }
42863}
42864
42865impl Discriminant<RestoreFootprintResultCode> for RestoreFootprintResult {
42866    #[must_use]
42867    fn discriminant(&self) -> RestoreFootprintResultCode {
42868        Self::discriminant(self)
42869    }
42870}
42871
42872impl Variants<RestoreFootprintResultCode> for RestoreFootprintResult {
42873    fn variants() -> slice::Iter<'static, RestoreFootprintResultCode> {
42874        Self::VARIANTS.iter()
42875    }
42876}
42877
42878impl Union<RestoreFootprintResultCode> for RestoreFootprintResult {}
42879
42880impl ReadXdr for RestoreFootprintResult {
42881    #[cfg(feature = "std")]
42882    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
42883        r.with_limited_depth(|r| {
42884            let dv: RestoreFootprintResultCode =
42885                <RestoreFootprintResultCode as ReadXdr>::read_xdr(r)?;
42886            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
42887            let v = match dv {
42888                RestoreFootprintResultCode::Success => Self::Success,
42889                RestoreFootprintResultCode::Malformed => Self::Malformed,
42890                RestoreFootprintResultCode::ResourceLimitExceeded => Self::ResourceLimitExceeded,
42891                RestoreFootprintResultCode::InsufficientRefundableFee => {
42892                    Self::InsufficientRefundableFee
42893                }
42894                #[allow(unreachable_patterns)]
42895                _ => return Err(Error::Invalid),
42896            };
42897            Ok(v)
42898        })
42899    }
42900}
42901
42902impl WriteXdr for RestoreFootprintResult {
42903    #[cfg(feature = "std")]
42904    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
42905        w.with_limited_depth(|w| {
42906            self.discriminant().write_xdr(w)?;
42907            #[allow(clippy::match_same_arms)]
42908            match self {
42909                Self::Success => ().write_xdr(w)?,
42910                Self::Malformed => ().write_xdr(w)?,
42911                Self::ResourceLimitExceeded => ().write_xdr(w)?,
42912                Self::InsufficientRefundableFee => ().write_xdr(w)?,
42913            };
42914            Ok(())
42915        })
42916    }
42917}
42918
42919/// OperationResultCode is an XDR Enum defines as:
42920///
42921/// ```text
42922/// enum OperationResultCode
42923/// {
42924///     opINNER = 0, // inner object result is valid
42925///
42926///     opBAD_AUTH = -1,            // too few valid signatures / wrong network
42927///     opNO_ACCOUNT = -2,          // source account was not found
42928///     opNOT_SUPPORTED = -3,       // operation not supported at this time
42929///     opTOO_MANY_SUBENTRIES = -4, // max number of subentries already reached
42930///     opEXCEEDED_WORK_LIMIT = -5, // operation did too much work
42931///     opTOO_MANY_SPONSORING = -6  // account is sponsoring too many entries
42932/// };
42933/// ```
42934///
42935// enum
42936#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
42937#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
42938#[cfg_attr(
42939    all(feature = "serde", feature = "alloc"),
42940    derive(serde::Serialize, serde::Deserialize),
42941    serde(rename_all = "snake_case")
42942)]
42943#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
42944#[repr(i32)]
42945pub enum OperationResultCode {
42946    OpInner = 0,
42947    OpBadAuth = -1,
42948    OpNoAccount = -2,
42949    OpNotSupported = -3,
42950    OpTooManySubentries = -4,
42951    OpExceededWorkLimit = -5,
42952    OpTooManySponsoring = -6,
42953}
42954
42955impl OperationResultCode {
42956    pub const VARIANTS: [OperationResultCode; 7] = [
42957        OperationResultCode::OpInner,
42958        OperationResultCode::OpBadAuth,
42959        OperationResultCode::OpNoAccount,
42960        OperationResultCode::OpNotSupported,
42961        OperationResultCode::OpTooManySubentries,
42962        OperationResultCode::OpExceededWorkLimit,
42963        OperationResultCode::OpTooManySponsoring,
42964    ];
42965    pub const VARIANTS_STR: [&'static str; 7] = [
42966        "OpInner",
42967        "OpBadAuth",
42968        "OpNoAccount",
42969        "OpNotSupported",
42970        "OpTooManySubentries",
42971        "OpExceededWorkLimit",
42972        "OpTooManySponsoring",
42973    ];
42974
42975    #[must_use]
42976    pub const fn name(&self) -> &'static str {
42977        match self {
42978            Self::OpInner => "OpInner",
42979            Self::OpBadAuth => "OpBadAuth",
42980            Self::OpNoAccount => "OpNoAccount",
42981            Self::OpNotSupported => "OpNotSupported",
42982            Self::OpTooManySubentries => "OpTooManySubentries",
42983            Self::OpExceededWorkLimit => "OpExceededWorkLimit",
42984            Self::OpTooManySponsoring => "OpTooManySponsoring",
42985        }
42986    }
42987
42988    #[must_use]
42989    pub const fn variants() -> [OperationResultCode; 7] {
42990        Self::VARIANTS
42991    }
42992}
42993
42994impl Name for OperationResultCode {
42995    #[must_use]
42996    fn name(&self) -> &'static str {
42997        Self::name(self)
42998    }
42999}
43000
43001impl Variants<OperationResultCode> for OperationResultCode {
43002    fn variants() -> slice::Iter<'static, OperationResultCode> {
43003        Self::VARIANTS.iter()
43004    }
43005}
43006
43007impl Enum for OperationResultCode {}
43008
43009impl fmt::Display for OperationResultCode {
43010    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
43011        f.write_str(self.name())
43012    }
43013}
43014
43015impl TryFrom<i32> for OperationResultCode {
43016    type Error = Error;
43017
43018    fn try_from(i: i32) -> Result<Self> {
43019        let e = match i {
43020            0 => OperationResultCode::OpInner,
43021            -1 => OperationResultCode::OpBadAuth,
43022            -2 => OperationResultCode::OpNoAccount,
43023            -3 => OperationResultCode::OpNotSupported,
43024            -4 => OperationResultCode::OpTooManySubentries,
43025            -5 => OperationResultCode::OpExceededWorkLimit,
43026            -6 => OperationResultCode::OpTooManySponsoring,
43027            #[allow(unreachable_patterns)]
43028            _ => return Err(Error::Invalid),
43029        };
43030        Ok(e)
43031    }
43032}
43033
43034impl From<OperationResultCode> for i32 {
43035    #[must_use]
43036    fn from(e: OperationResultCode) -> Self {
43037        e as Self
43038    }
43039}
43040
43041impl ReadXdr for OperationResultCode {
43042    #[cfg(feature = "std")]
43043    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
43044        r.with_limited_depth(|r| {
43045            let e = i32::read_xdr(r)?;
43046            let v: Self = e.try_into()?;
43047            Ok(v)
43048        })
43049    }
43050}
43051
43052impl WriteXdr for OperationResultCode {
43053    #[cfg(feature = "std")]
43054    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
43055        w.with_limited_depth(|w| {
43056            let i: i32 = (*self).into();
43057            i.write_xdr(w)
43058        })
43059    }
43060}
43061
43062/// OperationResultTr is an XDR NestedUnion defines as:
43063///
43064/// ```text
43065/// union switch (OperationType type)
43066///     {
43067///     case CREATE_ACCOUNT:
43068///         CreateAccountResult createAccountResult;
43069///     case PAYMENT:
43070///         PaymentResult paymentResult;
43071///     case PATH_PAYMENT_STRICT_RECEIVE:
43072///         PathPaymentStrictReceiveResult pathPaymentStrictReceiveResult;
43073///     case MANAGE_SELL_OFFER:
43074///         ManageSellOfferResult manageSellOfferResult;
43075///     case CREATE_PASSIVE_SELL_OFFER:
43076///         ManageSellOfferResult createPassiveSellOfferResult;
43077///     case SET_OPTIONS:
43078///         SetOptionsResult setOptionsResult;
43079///     case CHANGE_TRUST:
43080///         ChangeTrustResult changeTrustResult;
43081///     case ALLOW_TRUST:
43082///         AllowTrustResult allowTrustResult;
43083///     case ACCOUNT_MERGE:
43084///         AccountMergeResult accountMergeResult;
43085///     case INFLATION:
43086///         InflationResult inflationResult;
43087///     case MANAGE_DATA:
43088///         ManageDataResult manageDataResult;
43089///     case BUMP_SEQUENCE:
43090///         BumpSequenceResult bumpSeqResult;
43091///     case MANAGE_BUY_OFFER:
43092///         ManageBuyOfferResult manageBuyOfferResult;
43093///     case PATH_PAYMENT_STRICT_SEND:
43094///         PathPaymentStrictSendResult pathPaymentStrictSendResult;
43095///     case CREATE_CLAIMABLE_BALANCE:
43096///         CreateClaimableBalanceResult createClaimableBalanceResult;
43097///     case CLAIM_CLAIMABLE_BALANCE:
43098///         ClaimClaimableBalanceResult claimClaimableBalanceResult;
43099///     case BEGIN_SPONSORING_FUTURE_RESERVES:
43100///         BeginSponsoringFutureReservesResult beginSponsoringFutureReservesResult;
43101///     case END_SPONSORING_FUTURE_RESERVES:
43102///         EndSponsoringFutureReservesResult endSponsoringFutureReservesResult;
43103///     case REVOKE_SPONSORSHIP:
43104///         RevokeSponsorshipResult revokeSponsorshipResult;
43105///     case CLAWBACK:
43106///         ClawbackResult clawbackResult;
43107///     case CLAWBACK_CLAIMABLE_BALANCE:
43108///         ClawbackClaimableBalanceResult clawbackClaimableBalanceResult;
43109///     case SET_TRUST_LINE_FLAGS:
43110///         SetTrustLineFlagsResult setTrustLineFlagsResult;
43111///     case LIQUIDITY_POOL_DEPOSIT:
43112///         LiquidityPoolDepositResult liquidityPoolDepositResult;
43113///     case LIQUIDITY_POOL_WITHDRAW:
43114///         LiquidityPoolWithdrawResult liquidityPoolWithdrawResult;
43115///     case INVOKE_HOST_FUNCTION:
43116///         InvokeHostFunctionResult invokeHostFunctionResult;
43117///     case EXTEND_FOOTPRINT_TTL:
43118///         ExtendFootprintTTLResult extendFootprintTTLResult;
43119///     case RESTORE_FOOTPRINT:
43120///         RestoreFootprintResult restoreFootprintResult;
43121///     }
43122/// ```
43123///
43124// union with discriminant OperationType
43125#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
43126#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
43127#[cfg_attr(
43128    all(feature = "serde", feature = "alloc"),
43129    derive(serde::Serialize, serde::Deserialize),
43130    serde(rename_all = "snake_case")
43131)]
43132#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
43133#[allow(clippy::large_enum_variant)]
43134pub enum OperationResultTr {
43135    CreateAccount(CreateAccountResult),
43136    Payment(PaymentResult),
43137    PathPaymentStrictReceive(PathPaymentStrictReceiveResult),
43138    ManageSellOffer(ManageSellOfferResult),
43139    CreatePassiveSellOffer(ManageSellOfferResult),
43140    SetOptions(SetOptionsResult),
43141    ChangeTrust(ChangeTrustResult),
43142    AllowTrust(AllowTrustResult),
43143    AccountMerge(AccountMergeResult),
43144    Inflation(InflationResult),
43145    ManageData(ManageDataResult),
43146    BumpSequence(BumpSequenceResult),
43147    ManageBuyOffer(ManageBuyOfferResult),
43148    PathPaymentStrictSend(PathPaymentStrictSendResult),
43149    CreateClaimableBalance(CreateClaimableBalanceResult),
43150    ClaimClaimableBalance(ClaimClaimableBalanceResult),
43151    BeginSponsoringFutureReserves(BeginSponsoringFutureReservesResult),
43152    EndSponsoringFutureReserves(EndSponsoringFutureReservesResult),
43153    RevokeSponsorship(RevokeSponsorshipResult),
43154    Clawback(ClawbackResult),
43155    ClawbackClaimableBalance(ClawbackClaimableBalanceResult),
43156    SetTrustLineFlags(SetTrustLineFlagsResult),
43157    LiquidityPoolDeposit(LiquidityPoolDepositResult),
43158    LiquidityPoolWithdraw(LiquidityPoolWithdrawResult),
43159    InvokeHostFunction(InvokeHostFunctionResult),
43160    ExtendFootprintTtl(ExtendFootprintTtlResult),
43161    RestoreFootprint(RestoreFootprintResult),
43162}
43163
43164impl OperationResultTr {
43165    pub const VARIANTS: [OperationType; 27] = [
43166        OperationType::CreateAccount,
43167        OperationType::Payment,
43168        OperationType::PathPaymentStrictReceive,
43169        OperationType::ManageSellOffer,
43170        OperationType::CreatePassiveSellOffer,
43171        OperationType::SetOptions,
43172        OperationType::ChangeTrust,
43173        OperationType::AllowTrust,
43174        OperationType::AccountMerge,
43175        OperationType::Inflation,
43176        OperationType::ManageData,
43177        OperationType::BumpSequence,
43178        OperationType::ManageBuyOffer,
43179        OperationType::PathPaymentStrictSend,
43180        OperationType::CreateClaimableBalance,
43181        OperationType::ClaimClaimableBalance,
43182        OperationType::BeginSponsoringFutureReserves,
43183        OperationType::EndSponsoringFutureReserves,
43184        OperationType::RevokeSponsorship,
43185        OperationType::Clawback,
43186        OperationType::ClawbackClaimableBalance,
43187        OperationType::SetTrustLineFlags,
43188        OperationType::LiquidityPoolDeposit,
43189        OperationType::LiquidityPoolWithdraw,
43190        OperationType::InvokeHostFunction,
43191        OperationType::ExtendFootprintTtl,
43192        OperationType::RestoreFootprint,
43193    ];
43194    pub const VARIANTS_STR: [&'static str; 27] = [
43195        "CreateAccount",
43196        "Payment",
43197        "PathPaymentStrictReceive",
43198        "ManageSellOffer",
43199        "CreatePassiveSellOffer",
43200        "SetOptions",
43201        "ChangeTrust",
43202        "AllowTrust",
43203        "AccountMerge",
43204        "Inflation",
43205        "ManageData",
43206        "BumpSequence",
43207        "ManageBuyOffer",
43208        "PathPaymentStrictSend",
43209        "CreateClaimableBalance",
43210        "ClaimClaimableBalance",
43211        "BeginSponsoringFutureReserves",
43212        "EndSponsoringFutureReserves",
43213        "RevokeSponsorship",
43214        "Clawback",
43215        "ClawbackClaimableBalance",
43216        "SetTrustLineFlags",
43217        "LiquidityPoolDeposit",
43218        "LiquidityPoolWithdraw",
43219        "InvokeHostFunction",
43220        "ExtendFootprintTtl",
43221        "RestoreFootprint",
43222    ];
43223
43224    #[must_use]
43225    pub const fn name(&self) -> &'static str {
43226        match self {
43227            Self::CreateAccount(_) => "CreateAccount",
43228            Self::Payment(_) => "Payment",
43229            Self::PathPaymentStrictReceive(_) => "PathPaymentStrictReceive",
43230            Self::ManageSellOffer(_) => "ManageSellOffer",
43231            Self::CreatePassiveSellOffer(_) => "CreatePassiveSellOffer",
43232            Self::SetOptions(_) => "SetOptions",
43233            Self::ChangeTrust(_) => "ChangeTrust",
43234            Self::AllowTrust(_) => "AllowTrust",
43235            Self::AccountMerge(_) => "AccountMerge",
43236            Self::Inflation(_) => "Inflation",
43237            Self::ManageData(_) => "ManageData",
43238            Self::BumpSequence(_) => "BumpSequence",
43239            Self::ManageBuyOffer(_) => "ManageBuyOffer",
43240            Self::PathPaymentStrictSend(_) => "PathPaymentStrictSend",
43241            Self::CreateClaimableBalance(_) => "CreateClaimableBalance",
43242            Self::ClaimClaimableBalance(_) => "ClaimClaimableBalance",
43243            Self::BeginSponsoringFutureReserves(_) => "BeginSponsoringFutureReserves",
43244            Self::EndSponsoringFutureReserves(_) => "EndSponsoringFutureReserves",
43245            Self::RevokeSponsorship(_) => "RevokeSponsorship",
43246            Self::Clawback(_) => "Clawback",
43247            Self::ClawbackClaimableBalance(_) => "ClawbackClaimableBalance",
43248            Self::SetTrustLineFlags(_) => "SetTrustLineFlags",
43249            Self::LiquidityPoolDeposit(_) => "LiquidityPoolDeposit",
43250            Self::LiquidityPoolWithdraw(_) => "LiquidityPoolWithdraw",
43251            Self::InvokeHostFunction(_) => "InvokeHostFunction",
43252            Self::ExtendFootprintTtl(_) => "ExtendFootprintTtl",
43253            Self::RestoreFootprint(_) => "RestoreFootprint",
43254        }
43255    }
43256
43257    #[must_use]
43258    pub const fn discriminant(&self) -> OperationType {
43259        #[allow(clippy::match_same_arms)]
43260        match self {
43261            Self::CreateAccount(_) => OperationType::CreateAccount,
43262            Self::Payment(_) => OperationType::Payment,
43263            Self::PathPaymentStrictReceive(_) => OperationType::PathPaymentStrictReceive,
43264            Self::ManageSellOffer(_) => OperationType::ManageSellOffer,
43265            Self::CreatePassiveSellOffer(_) => OperationType::CreatePassiveSellOffer,
43266            Self::SetOptions(_) => OperationType::SetOptions,
43267            Self::ChangeTrust(_) => OperationType::ChangeTrust,
43268            Self::AllowTrust(_) => OperationType::AllowTrust,
43269            Self::AccountMerge(_) => OperationType::AccountMerge,
43270            Self::Inflation(_) => OperationType::Inflation,
43271            Self::ManageData(_) => OperationType::ManageData,
43272            Self::BumpSequence(_) => OperationType::BumpSequence,
43273            Self::ManageBuyOffer(_) => OperationType::ManageBuyOffer,
43274            Self::PathPaymentStrictSend(_) => OperationType::PathPaymentStrictSend,
43275            Self::CreateClaimableBalance(_) => OperationType::CreateClaimableBalance,
43276            Self::ClaimClaimableBalance(_) => OperationType::ClaimClaimableBalance,
43277            Self::BeginSponsoringFutureReserves(_) => OperationType::BeginSponsoringFutureReserves,
43278            Self::EndSponsoringFutureReserves(_) => OperationType::EndSponsoringFutureReserves,
43279            Self::RevokeSponsorship(_) => OperationType::RevokeSponsorship,
43280            Self::Clawback(_) => OperationType::Clawback,
43281            Self::ClawbackClaimableBalance(_) => OperationType::ClawbackClaimableBalance,
43282            Self::SetTrustLineFlags(_) => OperationType::SetTrustLineFlags,
43283            Self::LiquidityPoolDeposit(_) => OperationType::LiquidityPoolDeposit,
43284            Self::LiquidityPoolWithdraw(_) => OperationType::LiquidityPoolWithdraw,
43285            Self::InvokeHostFunction(_) => OperationType::InvokeHostFunction,
43286            Self::ExtendFootprintTtl(_) => OperationType::ExtendFootprintTtl,
43287            Self::RestoreFootprint(_) => OperationType::RestoreFootprint,
43288        }
43289    }
43290
43291    #[must_use]
43292    pub const fn variants() -> [OperationType; 27] {
43293        Self::VARIANTS
43294    }
43295}
43296
43297impl Name for OperationResultTr {
43298    #[must_use]
43299    fn name(&self) -> &'static str {
43300        Self::name(self)
43301    }
43302}
43303
43304impl Discriminant<OperationType> for OperationResultTr {
43305    #[must_use]
43306    fn discriminant(&self) -> OperationType {
43307        Self::discriminant(self)
43308    }
43309}
43310
43311impl Variants<OperationType> for OperationResultTr {
43312    fn variants() -> slice::Iter<'static, OperationType> {
43313        Self::VARIANTS.iter()
43314    }
43315}
43316
43317impl Union<OperationType> for OperationResultTr {}
43318
43319impl ReadXdr for OperationResultTr {
43320    #[cfg(feature = "std")]
43321    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
43322        r.with_limited_depth(|r| {
43323            let dv: OperationType = <OperationType as ReadXdr>::read_xdr(r)?;
43324            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
43325            let v = match dv {
43326                OperationType::CreateAccount => {
43327                    Self::CreateAccount(CreateAccountResult::read_xdr(r)?)
43328                }
43329                OperationType::Payment => Self::Payment(PaymentResult::read_xdr(r)?),
43330                OperationType::PathPaymentStrictReceive => {
43331                    Self::PathPaymentStrictReceive(PathPaymentStrictReceiveResult::read_xdr(r)?)
43332                }
43333                OperationType::ManageSellOffer => {
43334                    Self::ManageSellOffer(ManageSellOfferResult::read_xdr(r)?)
43335                }
43336                OperationType::CreatePassiveSellOffer => {
43337                    Self::CreatePassiveSellOffer(ManageSellOfferResult::read_xdr(r)?)
43338                }
43339                OperationType::SetOptions => Self::SetOptions(SetOptionsResult::read_xdr(r)?),
43340                OperationType::ChangeTrust => Self::ChangeTrust(ChangeTrustResult::read_xdr(r)?),
43341                OperationType::AllowTrust => Self::AllowTrust(AllowTrustResult::read_xdr(r)?),
43342                OperationType::AccountMerge => Self::AccountMerge(AccountMergeResult::read_xdr(r)?),
43343                OperationType::Inflation => Self::Inflation(InflationResult::read_xdr(r)?),
43344                OperationType::ManageData => Self::ManageData(ManageDataResult::read_xdr(r)?),
43345                OperationType::BumpSequence => Self::BumpSequence(BumpSequenceResult::read_xdr(r)?),
43346                OperationType::ManageBuyOffer => {
43347                    Self::ManageBuyOffer(ManageBuyOfferResult::read_xdr(r)?)
43348                }
43349                OperationType::PathPaymentStrictSend => {
43350                    Self::PathPaymentStrictSend(PathPaymentStrictSendResult::read_xdr(r)?)
43351                }
43352                OperationType::CreateClaimableBalance => {
43353                    Self::CreateClaimableBalance(CreateClaimableBalanceResult::read_xdr(r)?)
43354                }
43355                OperationType::ClaimClaimableBalance => {
43356                    Self::ClaimClaimableBalance(ClaimClaimableBalanceResult::read_xdr(r)?)
43357                }
43358                OperationType::BeginSponsoringFutureReserves => {
43359                    Self::BeginSponsoringFutureReserves(
43360                        BeginSponsoringFutureReservesResult::read_xdr(r)?,
43361                    )
43362                }
43363                OperationType::EndSponsoringFutureReserves => Self::EndSponsoringFutureReserves(
43364                    EndSponsoringFutureReservesResult::read_xdr(r)?,
43365                ),
43366                OperationType::RevokeSponsorship => {
43367                    Self::RevokeSponsorship(RevokeSponsorshipResult::read_xdr(r)?)
43368                }
43369                OperationType::Clawback => Self::Clawback(ClawbackResult::read_xdr(r)?),
43370                OperationType::ClawbackClaimableBalance => {
43371                    Self::ClawbackClaimableBalance(ClawbackClaimableBalanceResult::read_xdr(r)?)
43372                }
43373                OperationType::SetTrustLineFlags => {
43374                    Self::SetTrustLineFlags(SetTrustLineFlagsResult::read_xdr(r)?)
43375                }
43376                OperationType::LiquidityPoolDeposit => {
43377                    Self::LiquidityPoolDeposit(LiquidityPoolDepositResult::read_xdr(r)?)
43378                }
43379                OperationType::LiquidityPoolWithdraw => {
43380                    Self::LiquidityPoolWithdraw(LiquidityPoolWithdrawResult::read_xdr(r)?)
43381                }
43382                OperationType::InvokeHostFunction => {
43383                    Self::InvokeHostFunction(InvokeHostFunctionResult::read_xdr(r)?)
43384                }
43385                OperationType::ExtendFootprintTtl => {
43386                    Self::ExtendFootprintTtl(ExtendFootprintTtlResult::read_xdr(r)?)
43387                }
43388                OperationType::RestoreFootprint => {
43389                    Self::RestoreFootprint(RestoreFootprintResult::read_xdr(r)?)
43390                }
43391                #[allow(unreachable_patterns)]
43392                _ => return Err(Error::Invalid),
43393            };
43394            Ok(v)
43395        })
43396    }
43397}
43398
43399impl WriteXdr for OperationResultTr {
43400    #[cfg(feature = "std")]
43401    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
43402        w.with_limited_depth(|w| {
43403            self.discriminant().write_xdr(w)?;
43404            #[allow(clippy::match_same_arms)]
43405            match self {
43406                Self::CreateAccount(v) => v.write_xdr(w)?,
43407                Self::Payment(v) => v.write_xdr(w)?,
43408                Self::PathPaymentStrictReceive(v) => v.write_xdr(w)?,
43409                Self::ManageSellOffer(v) => v.write_xdr(w)?,
43410                Self::CreatePassiveSellOffer(v) => v.write_xdr(w)?,
43411                Self::SetOptions(v) => v.write_xdr(w)?,
43412                Self::ChangeTrust(v) => v.write_xdr(w)?,
43413                Self::AllowTrust(v) => v.write_xdr(w)?,
43414                Self::AccountMerge(v) => v.write_xdr(w)?,
43415                Self::Inflation(v) => v.write_xdr(w)?,
43416                Self::ManageData(v) => v.write_xdr(w)?,
43417                Self::BumpSequence(v) => v.write_xdr(w)?,
43418                Self::ManageBuyOffer(v) => v.write_xdr(w)?,
43419                Self::PathPaymentStrictSend(v) => v.write_xdr(w)?,
43420                Self::CreateClaimableBalance(v) => v.write_xdr(w)?,
43421                Self::ClaimClaimableBalance(v) => v.write_xdr(w)?,
43422                Self::BeginSponsoringFutureReserves(v) => v.write_xdr(w)?,
43423                Self::EndSponsoringFutureReserves(v) => v.write_xdr(w)?,
43424                Self::RevokeSponsorship(v) => v.write_xdr(w)?,
43425                Self::Clawback(v) => v.write_xdr(w)?,
43426                Self::ClawbackClaimableBalance(v) => v.write_xdr(w)?,
43427                Self::SetTrustLineFlags(v) => v.write_xdr(w)?,
43428                Self::LiquidityPoolDeposit(v) => v.write_xdr(w)?,
43429                Self::LiquidityPoolWithdraw(v) => v.write_xdr(w)?,
43430                Self::InvokeHostFunction(v) => v.write_xdr(w)?,
43431                Self::ExtendFootprintTtl(v) => v.write_xdr(w)?,
43432                Self::RestoreFootprint(v) => v.write_xdr(w)?,
43433            };
43434            Ok(())
43435        })
43436    }
43437}
43438
43439/// OperationResult is an XDR Union defines as:
43440///
43441/// ```text
43442/// union OperationResult switch (OperationResultCode code)
43443/// {
43444/// case opINNER:
43445///     union switch (OperationType type)
43446///     {
43447///     case CREATE_ACCOUNT:
43448///         CreateAccountResult createAccountResult;
43449///     case PAYMENT:
43450///         PaymentResult paymentResult;
43451///     case PATH_PAYMENT_STRICT_RECEIVE:
43452///         PathPaymentStrictReceiveResult pathPaymentStrictReceiveResult;
43453///     case MANAGE_SELL_OFFER:
43454///         ManageSellOfferResult manageSellOfferResult;
43455///     case CREATE_PASSIVE_SELL_OFFER:
43456///         ManageSellOfferResult createPassiveSellOfferResult;
43457///     case SET_OPTIONS:
43458///         SetOptionsResult setOptionsResult;
43459///     case CHANGE_TRUST:
43460///         ChangeTrustResult changeTrustResult;
43461///     case ALLOW_TRUST:
43462///         AllowTrustResult allowTrustResult;
43463///     case ACCOUNT_MERGE:
43464///         AccountMergeResult accountMergeResult;
43465///     case INFLATION:
43466///         InflationResult inflationResult;
43467///     case MANAGE_DATA:
43468///         ManageDataResult manageDataResult;
43469///     case BUMP_SEQUENCE:
43470///         BumpSequenceResult bumpSeqResult;
43471///     case MANAGE_BUY_OFFER:
43472///         ManageBuyOfferResult manageBuyOfferResult;
43473///     case PATH_PAYMENT_STRICT_SEND:
43474///         PathPaymentStrictSendResult pathPaymentStrictSendResult;
43475///     case CREATE_CLAIMABLE_BALANCE:
43476///         CreateClaimableBalanceResult createClaimableBalanceResult;
43477///     case CLAIM_CLAIMABLE_BALANCE:
43478///         ClaimClaimableBalanceResult claimClaimableBalanceResult;
43479///     case BEGIN_SPONSORING_FUTURE_RESERVES:
43480///         BeginSponsoringFutureReservesResult beginSponsoringFutureReservesResult;
43481///     case END_SPONSORING_FUTURE_RESERVES:
43482///         EndSponsoringFutureReservesResult endSponsoringFutureReservesResult;
43483///     case REVOKE_SPONSORSHIP:
43484///         RevokeSponsorshipResult revokeSponsorshipResult;
43485///     case CLAWBACK:
43486///         ClawbackResult clawbackResult;
43487///     case CLAWBACK_CLAIMABLE_BALANCE:
43488///         ClawbackClaimableBalanceResult clawbackClaimableBalanceResult;
43489///     case SET_TRUST_LINE_FLAGS:
43490///         SetTrustLineFlagsResult setTrustLineFlagsResult;
43491///     case LIQUIDITY_POOL_DEPOSIT:
43492///         LiquidityPoolDepositResult liquidityPoolDepositResult;
43493///     case LIQUIDITY_POOL_WITHDRAW:
43494///         LiquidityPoolWithdrawResult liquidityPoolWithdrawResult;
43495///     case INVOKE_HOST_FUNCTION:
43496///         InvokeHostFunctionResult invokeHostFunctionResult;
43497///     case EXTEND_FOOTPRINT_TTL:
43498///         ExtendFootprintTTLResult extendFootprintTTLResult;
43499///     case RESTORE_FOOTPRINT:
43500///         RestoreFootprintResult restoreFootprintResult;
43501///     }
43502///     tr;
43503/// case opBAD_AUTH:
43504/// case opNO_ACCOUNT:
43505/// case opNOT_SUPPORTED:
43506/// case opTOO_MANY_SUBENTRIES:
43507/// case opEXCEEDED_WORK_LIMIT:
43508/// case opTOO_MANY_SPONSORING:
43509///     void;
43510/// };
43511/// ```
43512///
43513// union with discriminant OperationResultCode
43514#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
43515#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
43516#[cfg_attr(
43517    all(feature = "serde", feature = "alloc"),
43518    derive(serde::Serialize, serde::Deserialize),
43519    serde(rename_all = "snake_case")
43520)]
43521#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
43522#[allow(clippy::large_enum_variant)]
43523pub enum OperationResult {
43524    OpInner(OperationResultTr),
43525    OpBadAuth,
43526    OpNoAccount,
43527    OpNotSupported,
43528    OpTooManySubentries,
43529    OpExceededWorkLimit,
43530    OpTooManySponsoring,
43531}
43532
43533impl OperationResult {
43534    pub const VARIANTS: [OperationResultCode; 7] = [
43535        OperationResultCode::OpInner,
43536        OperationResultCode::OpBadAuth,
43537        OperationResultCode::OpNoAccount,
43538        OperationResultCode::OpNotSupported,
43539        OperationResultCode::OpTooManySubentries,
43540        OperationResultCode::OpExceededWorkLimit,
43541        OperationResultCode::OpTooManySponsoring,
43542    ];
43543    pub const VARIANTS_STR: [&'static str; 7] = [
43544        "OpInner",
43545        "OpBadAuth",
43546        "OpNoAccount",
43547        "OpNotSupported",
43548        "OpTooManySubentries",
43549        "OpExceededWorkLimit",
43550        "OpTooManySponsoring",
43551    ];
43552
43553    #[must_use]
43554    pub const fn name(&self) -> &'static str {
43555        match self {
43556            Self::OpInner(_) => "OpInner",
43557            Self::OpBadAuth => "OpBadAuth",
43558            Self::OpNoAccount => "OpNoAccount",
43559            Self::OpNotSupported => "OpNotSupported",
43560            Self::OpTooManySubentries => "OpTooManySubentries",
43561            Self::OpExceededWorkLimit => "OpExceededWorkLimit",
43562            Self::OpTooManySponsoring => "OpTooManySponsoring",
43563        }
43564    }
43565
43566    #[must_use]
43567    pub const fn discriminant(&self) -> OperationResultCode {
43568        #[allow(clippy::match_same_arms)]
43569        match self {
43570            Self::OpInner(_) => OperationResultCode::OpInner,
43571            Self::OpBadAuth => OperationResultCode::OpBadAuth,
43572            Self::OpNoAccount => OperationResultCode::OpNoAccount,
43573            Self::OpNotSupported => OperationResultCode::OpNotSupported,
43574            Self::OpTooManySubentries => OperationResultCode::OpTooManySubentries,
43575            Self::OpExceededWorkLimit => OperationResultCode::OpExceededWorkLimit,
43576            Self::OpTooManySponsoring => OperationResultCode::OpTooManySponsoring,
43577        }
43578    }
43579
43580    #[must_use]
43581    pub const fn variants() -> [OperationResultCode; 7] {
43582        Self::VARIANTS
43583    }
43584}
43585
43586impl Name for OperationResult {
43587    #[must_use]
43588    fn name(&self) -> &'static str {
43589        Self::name(self)
43590    }
43591}
43592
43593impl Discriminant<OperationResultCode> for OperationResult {
43594    #[must_use]
43595    fn discriminant(&self) -> OperationResultCode {
43596        Self::discriminant(self)
43597    }
43598}
43599
43600impl Variants<OperationResultCode> for OperationResult {
43601    fn variants() -> slice::Iter<'static, OperationResultCode> {
43602        Self::VARIANTS.iter()
43603    }
43604}
43605
43606impl Union<OperationResultCode> for OperationResult {}
43607
43608impl ReadXdr for OperationResult {
43609    #[cfg(feature = "std")]
43610    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
43611        r.with_limited_depth(|r| {
43612            let dv: OperationResultCode = <OperationResultCode as ReadXdr>::read_xdr(r)?;
43613            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
43614            let v = match dv {
43615                OperationResultCode::OpInner => Self::OpInner(OperationResultTr::read_xdr(r)?),
43616                OperationResultCode::OpBadAuth => Self::OpBadAuth,
43617                OperationResultCode::OpNoAccount => Self::OpNoAccount,
43618                OperationResultCode::OpNotSupported => Self::OpNotSupported,
43619                OperationResultCode::OpTooManySubentries => Self::OpTooManySubentries,
43620                OperationResultCode::OpExceededWorkLimit => Self::OpExceededWorkLimit,
43621                OperationResultCode::OpTooManySponsoring => Self::OpTooManySponsoring,
43622                #[allow(unreachable_patterns)]
43623                _ => return Err(Error::Invalid),
43624            };
43625            Ok(v)
43626        })
43627    }
43628}
43629
43630impl WriteXdr for OperationResult {
43631    #[cfg(feature = "std")]
43632    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
43633        w.with_limited_depth(|w| {
43634            self.discriminant().write_xdr(w)?;
43635            #[allow(clippy::match_same_arms)]
43636            match self {
43637                Self::OpInner(v) => v.write_xdr(w)?,
43638                Self::OpBadAuth => ().write_xdr(w)?,
43639                Self::OpNoAccount => ().write_xdr(w)?,
43640                Self::OpNotSupported => ().write_xdr(w)?,
43641                Self::OpTooManySubentries => ().write_xdr(w)?,
43642                Self::OpExceededWorkLimit => ().write_xdr(w)?,
43643                Self::OpTooManySponsoring => ().write_xdr(w)?,
43644            };
43645            Ok(())
43646        })
43647    }
43648}
43649
43650/// TransactionResultCode is an XDR Enum defines as:
43651///
43652/// ```text
43653/// enum TransactionResultCode
43654/// {
43655///     txFEE_BUMP_INNER_SUCCESS = 1, // fee bump inner transaction succeeded
43656///     txSUCCESS = 0,                // all operations succeeded
43657///
43658///     txFAILED = -1, // one of the operations failed (none were applied)
43659///
43660///     txTOO_EARLY = -2,         // ledger closeTime before minTime
43661///     txTOO_LATE = -3,          // ledger closeTime after maxTime
43662///     txMISSING_OPERATION = -4, // no operation was specified
43663///     txBAD_SEQ = -5,           // sequence number does not match source account
43664///
43665///     txBAD_AUTH = -6,             // too few valid signatures / wrong network
43666///     txINSUFFICIENT_BALANCE = -7, // fee would bring account below reserve
43667///     txNO_ACCOUNT = -8,           // source account not found
43668///     txINSUFFICIENT_FEE = -9,     // fee is too small
43669///     txBAD_AUTH_EXTRA = -10,      // unused signatures attached to transaction
43670///     txINTERNAL_ERROR = -11,      // an unknown error occurred
43671///
43672///     txNOT_SUPPORTED = -12,          // transaction type not supported
43673///     txFEE_BUMP_INNER_FAILED = -13,  // fee bump inner transaction failed
43674///     txBAD_SPONSORSHIP = -14,        // sponsorship not confirmed
43675///     txBAD_MIN_SEQ_AGE_OR_GAP = -15, // minSeqAge or minSeqLedgerGap conditions not met
43676///     txMALFORMED = -16,              // precondition is invalid
43677///     txSOROBAN_INVALID = -17         // soroban-specific preconditions were not met
43678/// };
43679/// ```
43680///
43681// enum
43682#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
43683#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
43684#[cfg_attr(
43685    all(feature = "serde", feature = "alloc"),
43686    derive(serde::Serialize, serde::Deserialize),
43687    serde(rename_all = "snake_case")
43688)]
43689#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
43690#[repr(i32)]
43691pub enum TransactionResultCode {
43692    TxFeeBumpInnerSuccess = 1,
43693    TxSuccess = 0,
43694    TxFailed = -1,
43695    TxTooEarly = -2,
43696    TxTooLate = -3,
43697    TxMissingOperation = -4,
43698    TxBadSeq = -5,
43699    TxBadAuth = -6,
43700    TxInsufficientBalance = -7,
43701    TxNoAccount = -8,
43702    TxInsufficientFee = -9,
43703    TxBadAuthExtra = -10,
43704    TxInternalError = -11,
43705    TxNotSupported = -12,
43706    TxFeeBumpInnerFailed = -13,
43707    TxBadSponsorship = -14,
43708    TxBadMinSeqAgeOrGap = -15,
43709    TxMalformed = -16,
43710    TxSorobanInvalid = -17,
43711}
43712
43713impl TransactionResultCode {
43714    pub const VARIANTS: [TransactionResultCode; 19] = [
43715        TransactionResultCode::TxFeeBumpInnerSuccess,
43716        TransactionResultCode::TxSuccess,
43717        TransactionResultCode::TxFailed,
43718        TransactionResultCode::TxTooEarly,
43719        TransactionResultCode::TxTooLate,
43720        TransactionResultCode::TxMissingOperation,
43721        TransactionResultCode::TxBadSeq,
43722        TransactionResultCode::TxBadAuth,
43723        TransactionResultCode::TxInsufficientBalance,
43724        TransactionResultCode::TxNoAccount,
43725        TransactionResultCode::TxInsufficientFee,
43726        TransactionResultCode::TxBadAuthExtra,
43727        TransactionResultCode::TxInternalError,
43728        TransactionResultCode::TxNotSupported,
43729        TransactionResultCode::TxFeeBumpInnerFailed,
43730        TransactionResultCode::TxBadSponsorship,
43731        TransactionResultCode::TxBadMinSeqAgeOrGap,
43732        TransactionResultCode::TxMalformed,
43733        TransactionResultCode::TxSorobanInvalid,
43734    ];
43735    pub const VARIANTS_STR: [&'static str; 19] = [
43736        "TxFeeBumpInnerSuccess",
43737        "TxSuccess",
43738        "TxFailed",
43739        "TxTooEarly",
43740        "TxTooLate",
43741        "TxMissingOperation",
43742        "TxBadSeq",
43743        "TxBadAuth",
43744        "TxInsufficientBalance",
43745        "TxNoAccount",
43746        "TxInsufficientFee",
43747        "TxBadAuthExtra",
43748        "TxInternalError",
43749        "TxNotSupported",
43750        "TxFeeBumpInnerFailed",
43751        "TxBadSponsorship",
43752        "TxBadMinSeqAgeOrGap",
43753        "TxMalformed",
43754        "TxSorobanInvalid",
43755    ];
43756
43757    #[must_use]
43758    pub const fn name(&self) -> &'static str {
43759        match self {
43760            Self::TxFeeBumpInnerSuccess => "TxFeeBumpInnerSuccess",
43761            Self::TxSuccess => "TxSuccess",
43762            Self::TxFailed => "TxFailed",
43763            Self::TxTooEarly => "TxTooEarly",
43764            Self::TxTooLate => "TxTooLate",
43765            Self::TxMissingOperation => "TxMissingOperation",
43766            Self::TxBadSeq => "TxBadSeq",
43767            Self::TxBadAuth => "TxBadAuth",
43768            Self::TxInsufficientBalance => "TxInsufficientBalance",
43769            Self::TxNoAccount => "TxNoAccount",
43770            Self::TxInsufficientFee => "TxInsufficientFee",
43771            Self::TxBadAuthExtra => "TxBadAuthExtra",
43772            Self::TxInternalError => "TxInternalError",
43773            Self::TxNotSupported => "TxNotSupported",
43774            Self::TxFeeBumpInnerFailed => "TxFeeBumpInnerFailed",
43775            Self::TxBadSponsorship => "TxBadSponsorship",
43776            Self::TxBadMinSeqAgeOrGap => "TxBadMinSeqAgeOrGap",
43777            Self::TxMalformed => "TxMalformed",
43778            Self::TxSorobanInvalid => "TxSorobanInvalid",
43779        }
43780    }
43781
43782    #[must_use]
43783    pub const fn variants() -> [TransactionResultCode; 19] {
43784        Self::VARIANTS
43785    }
43786}
43787
43788impl Name for TransactionResultCode {
43789    #[must_use]
43790    fn name(&self) -> &'static str {
43791        Self::name(self)
43792    }
43793}
43794
43795impl Variants<TransactionResultCode> for TransactionResultCode {
43796    fn variants() -> slice::Iter<'static, TransactionResultCode> {
43797        Self::VARIANTS.iter()
43798    }
43799}
43800
43801impl Enum for TransactionResultCode {}
43802
43803impl fmt::Display for TransactionResultCode {
43804    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
43805        f.write_str(self.name())
43806    }
43807}
43808
43809impl TryFrom<i32> for TransactionResultCode {
43810    type Error = Error;
43811
43812    fn try_from(i: i32) -> Result<Self> {
43813        let e = match i {
43814            1 => TransactionResultCode::TxFeeBumpInnerSuccess,
43815            0 => TransactionResultCode::TxSuccess,
43816            -1 => TransactionResultCode::TxFailed,
43817            -2 => TransactionResultCode::TxTooEarly,
43818            -3 => TransactionResultCode::TxTooLate,
43819            -4 => TransactionResultCode::TxMissingOperation,
43820            -5 => TransactionResultCode::TxBadSeq,
43821            -6 => TransactionResultCode::TxBadAuth,
43822            -7 => TransactionResultCode::TxInsufficientBalance,
43823            -8 => TransactionResultCode::TxNoAccount,
43824            -9 => TransactionResultCode::TxInsufficientFee,
43825            -10 => TransactionResultCode::TxBadAuthExtra,
43826            -11 => TransactionResultCode::TxInternalError,
43827            -12 => TransactionResultCode::TxNotSupported,
43828            -13 => TransactionResultCode::TxFeeBumpInnerFailed,
43829            -14 => TransactionResultCode::TxBadSponsorship,
43830            -15 => TransactionResultCode::TxBadMinSeqAgeOrGap,
43831            -16 => TransactionResultCode::TxMalformed,
43832            -17 => TransactionResultCode::TxSorobanInvalid,
43833            #[allow(unreachable_patterns)]
43834            _ => return Err(Error::Invalid),
43835        };
43836        Ok(e)
43837    }
43838}
43839
43840impl From<TransactionResultCode> for i32 {
43841    #[must_use]
43842    fn from(e: TransactionResultCode) -> Self {
43843        e as Self
43844    }
43845}
43846
43847impl ReadXdr for TransactionResultCode {
43848    #[cfg(feature = "std")]
43849    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
43850        r.with_limited_depth(|r| {
43851            let e = i32::read_xdr(r)?;
43852            let v: Self = e.try_into()?;
43853            Ok(v)
43854        })
43855    }
43856}
43857
43858impl WriteXdr for TransactionResultCode {
43859    #[cfg(feature = "std")]
43860    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
43861        w.with_limited_depth(|w| {
43862            let i: i32 = (*self).into();
43863            i.write_xdr(w)
43864        })
43865    }
43866}
43867
43868/// InnerTransactionResultResult is an XDR NestedUnion defines as:
43869///
43870/// ```text
43871/// union switch (TransactionResultCode code)
43872///     {
43873///     // txFEE_BUMP_INNER_SUCCESS is not included
43874///     case txSUCCESS:
43875///     case txFAILED:
43876///         OperationResult results<>;
43877///     case txTOO_EARLY:
43878///     case txTOO_LATE:
43879///     case txMISSING_OPERATION:
43880///     case txBAD_SEQ:
43881///     case txBAD_AUTH:
43882///     case txINSUFFICIENT_BALANCE:
43883///     case txNO_ACCOUNT:
43884///     case txINSUFFICIENT_FEE:
43885///     case txBAD_AUTH_EXTRA:
43886///     case txINTERNAL_ERROR:
43887///     case txNOT_SUPPORTED:
43888///     // txFEE_BUMP_INNER_FAILED is not included
43889///     case txBAD_SPONSORSHIP:
43890///     case txBAD_MIN_SEQ_AGE_OR_GAP:
43891///     case txMALFORMED:
43892///     case txSOROBAN_INVALID:
43893///         void;
43894///     }
43895/// ```
43896///
43897// union with discriminant TransactionResultCode
43898#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
43899#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
43900#[cfg_attr(
43901    all(feature = "serde", feature = "alloc"),
43902    derive(serde::Serialize, serde::Deserialize),
43903    serde(rename_all = "snake_case")
43904)]
43905#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
43906#[allow(clippy::large_enum_variant)]
43907pub enum InnerTransactionResultResult {
43908    TxSuccess(VecM<OperationResult>),
43909    TxFailed(VecM<OperationResult>),
43910    TxTooEarly,
43911    TxTooLate,
43912    TxMissingOperation,
43913    TxBadSeq,
43914    TxBadAuth,
43915    TxInsufficientBalance,
43916    TxNoAccount,
43917    TxInsufficientFee,
43918    TxBadAuthExtra,
43919    TxInternalError,
43920    TxNotSupported,
43921    TxBadSponsorship,
43922    TxBadMinSeqAgeOrGap,
43923    TxMalformed,
43924    TxSorobanInvalid,
43925}
43926
43927impl InnerTransactionResultResult {
43928    pub const VARIANTS: [TransactionResultCode; 17] = [
43929        TransactionResultCode::TxSuccess,
43930        TransactionResultCode::TxFailed,
43931        TransactionResultCode::TxTooEarly,
43932        TransactionResultCode::TxTooLate,
43933        TransactionResultCode::TxMissingOperation,
43934        TransactionResultCode::TxBadSeq,
43935        TransactionResultCode::TxBadAuth,
43936        TransactionResultCode::TxInsufficientBalance,
43937        TransactionResultCode::TxNoAccount,
43938        TransactionResultCode::TxInsufficientFee,
43939        TransactionResultCode::TxBadAuthExtra,
43940        TransactionResultCode::TxInternalError,
43941        TransactionResultCode::TxNotSupported,
43942        TransactionResultCode::TxBadSponsorship,
43943        TransactionResultCode::TxBadMinSeqAgeOrGap,
43944        TransactionResultCode::TxMalformed,
43945        TransactionResultCode::TxSorobanInvalid,
43946    ];
43947    pub const VARIANTS_STR: [&'static str; 17] = [
43948        "TxSuccess",
43949        "TxFailed",
43950        "TxTooEarly",
43951        "TxTooLate",
43952        "TxMissingOperation",
43953        "TxBadSeq",
43954        "TxBadAuth",
43955        "TxInsufficientBalance",
43956        "TxNoAccount",
43957        "TxInsufficientFee",
43958        "TxBadAuthExtra",
43959        "TxInternalError",
43960        "TxNotSupported",
43961        "TxBadSponsorship",
43962        "TxBadMinSeqAgeOrGap",
43963        "TxMalformed",
43964        "TxSorobanInvalid",
43965    ];
43966
43967    #[must_use]
43968    pub const fn name(&self) -> &'static str {
43969        match self {
43970            Self::TxSuccess(_) => "TxSuccess",
43971            Self::TxFailed(_) => "TxFailed",
43972            Self::TxTooEarly => "TxTooEarly",
43973            Self::TxTooLate => "TxTooLate",
43974            Self::TxMissingOperation => "TxMissingOperation",
43975            Self::TxBadSeq => "TxBadSeq",
43976            Self::TxBadAuth => "TxBadAuth",
43977            Self::TxInsufficientBalance => "TxInsufficientBalance",
43978            Self::TxNoAccount => "TxNoAccount",
43979            Self::TxInsufficientFee => "TxInsufficientFee",
43980            Self::TxBadAuthExtra => "TxBadAuthExtra",
43981            Self::TxInternalError => "TxInternalError",
43982            Self::TxNotSupported => "TxNotSupported",
43983            Self::TxBadSponsorship => "TxBadSponsorship",
43984            Self::TxBadMinSeqAgeOrGap => "TxBadMinSeqAgeOrGap",
43985            Self::TxMalformed => "TxMalformed",
43986            Self::TxSorobanInvalid => "TxSorobanInvalid",
43987        }
43988    }
43989
43990    #[must_use]
43991    pub const fn discriminant(&self) -> TransactionResultCode {
43992        #[allow(clippy::match_same_arms)]
43993        match self {
43994            Self::TxSuccess(_) => TransactionResultCode::TxSuccess,
43995            Self::TxFailed(_) => TransactionResultCode::TxFailed,
43996            Self::TxTooEarly => TransactionResultCode::TxTooEarly,
43997            Self::TxTooLate => TransactionResultCode::TxTooLate,
43998            Self::TxMissingOperation => TransactionResultCode::TxMissingOperation,
43999            Self::TxBadSeq => TransactionResultCode::TxBadSeq,
44000            Self::TxBadAuth => TransactionResultCode::TxBadAuth,
44001            Self::TxInsufficientBalance => TransactionResultCode::TxInsufficientBalance,
44002            Self::TxNoAccount => TransactionResultCode::TxNoAccount,
44003            Self::TxInsufficientFee => TransactionResultCode::TxInsufficientFee,
44004            Self::TxBadAuthExtra => TransactionResultCode::TxBadAuthExtra,
44005            Self::TxInternalError => TransactionResultCode::TxInternalError,
44006            Self::TxNotSupported => TransactionResultCode::TxNotSupported,
44007            Self::TxBadSponsorship => TransactionResultCode::TxBadSponsorship,
44008            Self::TxBadMinSeqAgeOrGap => TransactionResultCode::TxBadMinSeqAgeOrGap,
44009            Self::TxMalformed => TransactionResultCode::TxMalformed,
44010            Self::TxSorobanInvalid => TransactionResultCode::TxSorobanInvalid,
44011        }
44012    }
44013
44014    #[must_use]
44015    pub const fn variants() -> [TransactionResultCode; 17] {
44016        Self::VARIANTS
44017    }
44018}
44019
44020impl Name for InnerTransactionResultResult {
44021    #[must_use]
44022    fn name(&self) -> &'static str {
44023        Self::name(self)
44024    }
44025}
44026
44027impl Discriminant<TransactionResultCode> for InnerTransactionResultResult {
44028    #[must_use]
44029    fn discriminant(&self) -> TransactionResultCode {
44030        Self::discriminant(self)
44031    }
44032}
44033
44034impl Variants<TransactionResultCode> for InnerTransactionResultResult {
44035    fn variants() -> slice::Iter<'static, TransactionResultCode> {
44036        Self::VARIANTS.iter()
44037    }
44038}
44039
44040impl Union<TransactionResultCode> for InnerTransactionResultResult {}
44041
44042impl ReadXdr for InnerTransactionResultResult {
44043    #[cfg(feature = "std")]
44044    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
44045        r.with_limited_depth(|r| {
44046            let dv: TransactionResultCode = <TransactionResultCode as ReadXdr>::read_xdr(r)?;
44047            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
44048            let v = match dv {
44049                TransactionResultCode::TxSuccess => {
44050                    Self::TxSuccess(VecM::<OperationResult>::read_xdr(r)?)
44051                }
44052                TransactionResultCode::TxFailed => {
44053                    Self::TxFailed(VecM::<OperationResult>::read_xdr(r)?)
44054                }
44055                TransactionResultCode::TxTooEarly => Self::TxTooEarly,
44056                TransactionResultCode::TxTooLate => Self::TxTooLate,
44057                TransactionResultCode::TxMissingOperation => Self::TxMissingOperation,
44058                TransactionResultCode::TxBadSeq => Self::TxBadSeq,
44059                TransactionResultCode::TxBadAuth => Self::TxBadAuth,
44060                TransactionResultCode::TxInsufficientBalance => Self::TxInsufficientBalance,
44061                TransactionResultCode::TxNoAccount => Self::TxNoAccount,
44062                TransactionResultCode::TxInsufficientFee => Self::TxInsufficientFee,
44063                TransactionResultCode::TxBadAuthExtra => Self::TxBadAuthExtra,
44064                TransactionResultCode::TxInternalError => Self::TxInternalError,
44065                TransactionResultCode::TxNotSupported => Self::TxNotSupported,
44066                TransactionResultCode::TxBadSponsorship => Self::TxBadSponsorship,
44067                TransactionResultCode::TxBadMinSeqAgeOrGap => Self::TxBadMinSeqAgeOrGap,
44068                TransactionResultCode::TxMalformed => Self::TxMalformed,
44069                TransactionResultCode::TxSorobanInvalid => Self::TxSorobanInvalid,
44070                #[allow(unreachable_patterns)]
44071                _ => return Err(Error::Invalid),
44072            };
44073            Ok(v)
44074        })
44075    }
44076}
44077
44078impl WriteXdr for InnerTransactionResultResult {
44079    #[cfg(feature = "std")]
44080    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
44081        w.with_limited_depth(|w| {
44082            self.discriminant().write_xdr(w)?;
44083            #[allow(clippy::match_same_arms)]
44084            match self {
44085                Self::TxSuccess(v) => v.write_xdr(w)?,
44086                Self::TxFailed(v) => v.write_xdr(w)?,
44087                Self::TxTooEarly => ().write_xdr(w)?,
44088                Self::TxTooLate => ().write_xdr(w)?,
44089                Self::TxMissingOperation => ().write_xdr(w)?,
44090                Self::TxBadSeq => ().write_xdr(w)?,
44091                Self::TxBadAuth => ().write_xdr(w)?,
44092                Self::TxInsufficientBalance => ().write_xdr(w)?,
44093                Self::TxNoAccount => ().write_xdr(w)?,
44094                Self::TxInsufficientFee => ().write_xdr(w)?,
44095                Self::TxBadAuthExtra => ().write_xdr(w)?,
44096                Self::TxInternalError => ().write_xdr(w)?,
44097                Self::TxNotSupported => ().write_xdr(w)?,
44098                Self::TxBadSponsorship => ().write_xdr(w)?,
44099                Self::TxBadMinSeqAgeOrGap => ().write_xdr(w)?,
44100                Self::TxMalformed => ().write_xdr(w)?,
44101                Self::TxSorobanInvalid => ().write_xdr(w)?,
44102            };
44103            Ok(())
44104        })
44105    }
44106}
44107
44108/// InnerTransactionResultExt is an XDR NestedUnion defines as:
44109///
44110/// ```text
44111/// union switch (int v)
44112///     {
44113///     case 0:
44114///         void;
44115///     }
44116/// ```
44117///
44118// union with discriminant i32
44119#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
44120#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
44121#[cfg_attr(
44122    all(feature = "serde", feature = "alloc"),
44123    derive(serde::Serialize, serde::Deserialize),
44124    serde(rename_all = "snake_case")
44125)]
44126#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
44127#[allow(clippy::large_enum_variant)]
44128pub enum InnerTransactionResultExt {
44129    V0,
44130}
44131
44132impl InnerTransactionResultExt {
44133    pub const VARIANTS: [i32; 1] = [0];
44134    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
44135
44136    #[must_use]
44137    pub const fn name(&self) -> &'static str {
44138        match self {
44139            Self::V0 => "V0",
44140        }
44141    }
44142
44143    #[must_use]
44144    pub const fn discriminant(&self) -> i32 {
44145        #[allow(clippy::match_same_arms)]
44146        match self {
44147            Self::V0 => 0,
44148        }
44149    }
44150
44151    #[must_use]
44152    pub const fn variants() -> [i32; 1] {
44153        Self::VARIANTS
44154    }
44155}
44156
44157impl Name for InnerTransactionResultExt {
44158    #[must_use]
44159    fn name(&self) -> &'static str {
44160        Self::name(self)
44161    }
44162}
44163
44164impl Discriminant<i32> for InnerTransactionResultExt {
44165    #[must_use]
44166    fn discriminant(&self) -> i32 {
44167        Self::discriminant(self)
44168    }
44169}
44170
44171impl Variants<i32> for InnerTransactionResultExt {
44172    fn variants() -> slice::Iter<'static, i32> {
44173        Self::VARIANTS.iter()
44174    }
44175}
44176
44177impl Union<i32> for InnerTransactionResultExt {}
44178
44179impl ReadXdr for InnerTransactionResultExt {
44180    #[cfg(feature = "std")]
44181    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
44182        r.with_limited_depth(|r| {
44183            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
44184            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
44185            let v = match dv {
44186                0 => Self::V0,
44187                #[allow(unreachable_patterns)]
44188                _ => return Err(Error::Invalid),
44189            };
44190            Ok(v)
44191        })
44192    }
44193}
44194
44195impl WriteXdr for InnerTransactionResultExt {
44196    #[cfg(feature = "std")]
44197    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
44198        w.with_limited_depth(|w| {
44199            self.discriminant().write_xdr(w)?;
44200            #[allow(clippy::match_same_arms)]
44201            match self {
44202                Self::V0 => ().write_xdr(w)?,
44203            };
44204            Ok(())
44205        })
44206    }
44207}
44208
44209/// InnerTransactionResult is an XDR Struct defines as:
44210///
44211/// ```text
44212/// struct InnerTransactionResult
44213/// {
44214///     // Always 0. Here for binary compatibility.
44215///     int64 feeCharged;
44216///
44217///     union switch (TransactionResultCode code)
44218///     {
44219///     // txFEE_BUMP_INNER_SUCCESS is not included
44220///     case txSUCCESS:
44221///     case txFAILED:
44222///         OperationResult results<>;
44223///     case txTOO_EARLY:
44224///     case txTOO_LATE:
44225///     case txMISSING_OPERATION:
44226///     case txBAD_SEQ:
44227///     case txBAD_AUTH:
44228///     case txINSUFFICIENT_BALANCE:
44229///     case txNO_ACCOUNT:
44230///     case txINSUFFICIENT_FEE:
44231///     case txBAD_AUTH_EXTRA:
44232///     case txINTERNAL_ERROR:
44233///     case txNOT_SUPPORTED:
44234///     // txFEE_BUMP_INNER_FAILED is not included
44235///     case txBAD_SPONSORSHIP:
44236///     case txBAD_MIN_SEQ_AGE_OR_GAP:
44237///     case txMALFORMED:
44238///     case txSOROBAN_INVALID:
44239///         void;
44240///     }
44241///     result;
44242///
44243///     // reserved for future use
44244///     union switch (int v)
44245///     {
44246///     case 0:
44247///         void;
44248///     }
44249///     ext;
44250/// };
44251/// ```
44252///
44253#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
44254#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
44255#[cfg_attr(
44256    all(feature = "serde", feature = "alloc"),
44257    derive(serde::Serialize, serde::Deserialize),
44258    serde(rename_all = "snake_case")
44259)]
44260#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
44261pub struct InnerTransactionResult {
44262    pub fee_charged: i64,
44263    pub result: InnerTransactionResultResult,
44264    pub ext: InnerTransactionResultExt,
44265}
44266
44267impl ReadXdr for InnerTransactionResult {
44268    #[cfg(feature = "std")]
44269    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
44270        r.with_limited_depth(|r| {
44271            Ok(Self {
44272                fee_charged: i64::read_xdr(r)?,
44273                result: InnerTransactionResultResult::read_xdr(r)?,
44274                ext: InnerTransactionResultExt::read_xdr(r)?,
44275            })
44276        })
44277    }
44278}
44279
44280impl WriteXdr for InnerTransactionResult {
44281    #[cfg(feature = "std")]
44282    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
44283        w.with_limited_depth(|w| {
44284            self.fee_charged.write_xdr(w)?;
44285            self.result.write_xdr(w)?;
44286            self.ext.write_xdr(w)?;
44287            Ok(())
44288        })
44289    }
44290}
44291
44292/// InnerTransactionResultPair is an XDR Struct defines as:
44293///
44294/// ```text
44295/// struct InnerTransactionResultPair
44296/// {
44297///     Hash transactionHash;          // hash of the inner transaction
44298///     InnerTransactionResult result; // result for the inner transaction
44299/// };
44300/// ```
44301///
44302#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
44303#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
44304#[cfg_attr(
44305    all(feature = "serde", feature = "alloc"),
44306    derive(serde::Serialize, serde::Deserialize),
44307    serde(rename_all = "snake_case")
44308)]
44309#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
44310pub struct InnerTransactionResultPair {
44311    pub transaction_hash: Hash,
44312    pub result: InnerTransactionResult,
44313}
44314
44315impl ReadXdr for InnerTransactionResultPair {
44316    #[cfg(feature = "std")]
44317    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
44318        r.with_limited_depth(|r| {
44319            Ok(Self {
44320                transaction_hash: Hash::read_xdr(r)?,
44321                result: InnerTransactionResult::read_xdr(r)?,
44322            })
44323        })
44324    }
44325}
44326
44327impl WriteXdr for InnerTransactionResultPair {
44328    #[cfg(feature = "std")]
44329    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
44330        w.with_limited_depth(|w| {
44331            self.transaction_hash.write_xdr(w)?;
44332            self.result.write_xdr(w)?;
44333            Ok(())
44334        })
44335    }
44336}
44337
44338/// TransactionResultResult is an XDR NestedUnion defines as:
44339///
44340/// ```text
44341/// union switch (TransactionResultCode code)
44342///     {
44343///     case txFEE_BUMP_INNER_SUCCESS:
44344///     case txFEE_BUMP_INNER_FAILED:
44345///         InnerTransactionResultPair innerResultPair;
44346///     case txSUCCESS:
44347///     case txFAILED:
44348///         OperationResult results<>;
44349///     case txTOO_EARLY:
44350///     case txTOO_LATE:
44351///     case txMISSING_OPERATION:
44352///     case txBAD_SEQ:
44353///     case txBAD_AUTH:
44354///     case txINSUFFICIENT_BALANCE:
44355///     case txNO_ACCOUNT:
44356///     case txINSUFFICIENT_FEE:
44357///     case txBAD_AUTH_EXTRA:
44358///     case txINTERNAL_ERROR:
44359///     case txNOT_SUPPORTED:
44360///     // case txFEE_BUMP_INNER_FAILED: handled above
44361///     case txBAD_SPONSORSHIP:
44362///     case txBAD_MIN_SEQ_AGE_OR_GAP:
44363///     case txMALFORMED:
44364///     case txSOROBAN_INVALID:
44365///         void;
44366///     }
44367/// ```
44368///
44369// union with discriminant TransactionResultCode
44370#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
44371#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
44372#[cfg_attr(
44373    all(feature = "serde", feature = "alloc"),
44374    derive(serde::Serialize, serde::Deserialize),
44375    serde(rename_all = "snake_case")
44376)]
44377#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
44378#[allow(clippy::large_enum_variant)]
44379pub enum TransactionResultResult {
44380    TxFeeBumpInnerSuccess(InnerTransactionResultPair),
44381    TxFeeBumpInnerFailed(InnerTransactionResultPair),
44382    TxSuccess(VecM<OperationResult>),
44383    TxFailed(VecM<OperationResult>),
44384    TxTooEarly,
44385    TxTooLate,
44386    TxMissingOperation,
44387    TxBadSeq,
44388    TxBadAuth,
44389    TxInsufficientBalance,
44390    TxNoAccount,
44391    TxInsufficientFee,
44392    TxBadAuthExtra,
44393    TxInternalError,
44394    TxNotSupported,
44395    TxBadSponsorship,
44396    TxBadMinSeqAgeOrGap,
44397    TxMalformed,
44398    TxSorobanInvalid,
44399}
44400
44401impl TransactionResultResult {
44402    pub const VARIANTS: [TransactionResultCode; 19] = [
44403        TransactionResultCode::TxFeeBumpInnerSuccess,
44404        TransactionResultCode::TxFeeBumpInnerFailed,
44405        TransactionResultCode::TxSuccess,
44406        TransactionResultCode::TxFailed,
44407        TransactionResultCode::TxTooEarly,
44408        TransactionResultCode::TxTooLate,
44409        TransactionResultCode::TxMissingOperation,
44410        TransactionResultCode::TxBadSeq,
44411        TransactionResultCode::TxBadAuth,
44412        TransactionResultCode::TxInsufficientBalance,
44413        TransactionResultCode::TxNoAccount,
44414        TransactionResultCode::TxInsufficientFee,
44415        TransactionResultCode::TxBadAuthExtra,
44416        TransactionResultCode::TxInternalError,
44417        TransactionResultCode::TxNotSupported,
44418        TransactionResultCode::TxBadSponsorship,
44419        TransactionResultCode::TxBadMinSeqAgeOrGap,
44420        TransactionResultCode::TxMalformed,
44421        TransactionResultCode::TxSorobanInvalid,
44422    ];
44423    pub const VARIANTS_STR: [&'static str; 19] = [
44424        "TxFeeBumpInnerSuccess",
44425        "TxFeeBumpInnerFailed",
44426        "TxSuccess",
44427        "TxFailed",
44428        "TxTooEarly",
44429        "TxTooLate",
44430        "TxMissingOperation",
44431        "TxBadSeq",
44432        "TxBadAuth",
44433        "TxInsufficientBalance",
44434        "TxNoAccount",
44435        "TxInsufficientFee",
44436        "TxBadAuthExtra",
44437        "TxInternalError",
44438        "TxNotSupported",
44439        "TxBadSponsorship",
44440        "TxBadMinSeqAgeOrGap",
44441        "TxMalformed",
44442        "TxSorobanInvalid",
44443    ];
44444
44445    #[must_use]
44446    pub const fn name(&self) -> &'static str {
44447        match self {
44448            Self::TxFeeBumpInnerSuccess(_) => "TxFeeBumpInnerSuccess",
44449            Self::TxFeeBumpInnerFailed(_) => "TxFeeBumpInnerFailed",
44450            Self::TxSuccess(_) => "TxSuccess",
44451            Self::TxFailed(_) => "TxFailed",
44452            Self::TxTooEarly => "TxTooEarly",
44453            Self::TxTooLate => "TxTooLate",
44454            Self::TxMissingOperation => "TxMissingOperation",
44455            Self::TxBadSeq => "TxBadSeq",
44456            Self::TxBadAuth => "TxBadAuth",
44457            Self::TxInsufficientBalance => "TxInsufficientBalance",
44458            Self::TxNoAccount => "TxNoAccount",
44459            Self::TxInsufficientFee => "TxInsufficientFee",
44460            Self::TxBadAuthExtra => "TxBadAuthExtra",
44461            Self::TxInternalError => "TxInternalError",
44462            Self::TxNotSupported => "TxNotSupported",
44463            Self::TxBadSponsorship => "TxBadSponsorship",
44464            Self::TxBadMinSeqAgeOrGap => "TxBadMinSeqAgeOrGap",
44465            Self::TxMalformed => "TxMalformed",
44466            Self::TxSorobanInvalid => "TxSorobanInvalid",
44467        }
44468    }
44469
44470    #[must_use]
44471    pub const fn discriminant(&self) -> TransactionResultCode {
44472        #[allow(clippy::match_same_arms)]
44473        match self {
44474            Self::TxFeeBumpInnerSuccess(_) => TransactionResultCode::TxFeeBumpInnerSuccess,
44475            Self::TxFeeBumpInnerFailed(_) => TransactionResultCode::TxFeeBumpInnerFailed,
44476            Self::TxSuccess(_) => TransactionResultCode::TxSuccess,
44477            Self::TxFailed(_) => TransactionResultCode::TxFailed,
44478            Self::TxTooEarly => TransactionResultCode::TxTooEarly,
44479            Self::TxTooLate => TransactionResultCode::TxTooLate,
44480            Self::TxMissingOperation => TransactionResultCode::TxMissingOperation,
44481            Self::TxBadSeq => TransactionResultCode::TxBadSeq,
44482            Self::TxBadAuth => TransactionResultCode::TxBadAuth,
44483            Self::TxInsufficientBalance => TransactionResultCode::TxInsufficientBalance,
44484            Self::TxNoAccount => TransactionResultCode::TxNoAccount,
44485            Self::TxInsufficientFee => TransactionResultCode::TxInsufficientFee,
44486            Self::TxBadAuthExtra => TransactionResultCode::TxBadAuthExtra,
44487            Self::TxInternalError => TransactionResultCode::TxInternalError,
44488            Self::TxNotSupported => TransactionResultCode::TxNotSupported,
44489            Self::TxBadSponsorship => TransactionResultCode::TxBadSponsorship,
44490            Self::TxBadMinSeqAgeOrGap => TransactionResultCode::TxBadMinSeqAgeOrGap,
44491            Self::TxMalformed => TransactionResultCode::TxMalformed,
44492            Self::TxSorobanInvalid => TransactionResultCode::TxSorobanInvalid,
44493        }
44494    }
44495
44496    #[must_use]
44497    pub const fn variants() -> [TransactionResultCode; 19] {
44498        Self::VARIANTS
44499    }
44500}
44501
44502impl Name for TransactionResultResult {
44503    #[must_use]
44504    fn name(&self) -> &'static str {
44505        Self::name(self)
44506    }
44507}
44508
44509impl Discriminant<TransactionResultCode> for TransactionResultResult {
44510    #[must_use]
44511    fn discriminant(&self) -> TransactionResultCode {
44512        Self::discriminant(self)
44513    }
44514}
44515
44516impl Variants<TransactionResultCode> for TransactionResultResult {
44517    fn variants() -> slice::Iter<'static, TransactionResultCode> {
44518        Self::VARIANTS.iter()
44519    }
44520}
44521
44522impl Union<TransactionResultCode> for TransactionResultResult {}
44523
44524impl ReadXdr for TransactionResultResult {
44525    #[cfg(feature = "std")]
44526    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
44527        r.with_limited_depth(|r| {
44528            let dv: TransactionResultCode = <TransactionResultCode as ReadXdr>::read_xdr(r)?;
44529            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
44530            let v = match dv {
44531                TransactionResultCode::TxFeeBumpInnerSuccess => {
44532                    Self::TxFeeBumpInnerSuccess(InnerTransactionResultPair::read_xdr(r)?)
44533                }
44534                TransactionResultCode::TxFeeBumpInnerFailed => {
44535                    Self::TxFeeBumpInnerFailed(InnerTransactionResultPair::read_xdr(r)?)
44536                }
44537                TransactionResultCode::TxSuccess => {
44538                    Self::TxSuccess(VecM::<OperationResult>::read_xdr(r)?)
44539                }
44540                TransactionResultCode::TxFailed => {
44541                    Self::TxFailed(VecM::<OperationResult>::read_xdr(r)?)
44542                }
44543                TransactionResultCode::TxTooEarly => Self::TxTooEarly,
44544                TransactionResultCode::TxTooLate => Self::TxTooLate,
44545                TransactionResultCode::TxMissingOperation => Self::TxMissingOperation,
44546                TransactionResultCode::TxBadSeq => Self::TxBadSeq,
44547                TransactionResultCode::TxBadAuth => Self::TxBadAuth,
44548                TransactionResultCode::TxInsufficientBalance => Self::TxInsufficientBalance,
44549                TransactionResultCode::TxNoAccount => Self::TxNoAccount,
44550                TransactionResultCode::TxInsufficientFee => Self::TxInsufficientFee,
44551                TransactionResultCode::TxBadAuthExtra => Self::TxBadAuthExtra,
44552                TransactionResultCode::TxInternalError => Self::TxInternalError,
44553                TransactionResultCode::TxNotSupported => Self::TxNotSupported,
44554                TransactionResultCode::TxBadSponsorship => Self::TxBadSponsorship,
44555                TransactionResultCode::TxBadMinSeqAgeOrGap => Self::TxBadMinSeqAgeOrGap,
44556                TransactionResultCode::TxMalformed => Self::TxMalformed,
44557                TransactionResultCode::TxSorobanInvalid => Self::TxSorobanInvalid,
44558                #[allow(unreachable_patterns)]
44559                _ => return Err(Error::Invalid),
44560            };
44561            Ok(v)
44562        })
44563    }
44564}
44565
44566impl WriteXdr for TransactionResultResult {
44567    #[cfg(feature = "std")]
44568    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
44569        w.with_limited_depth(|w| {
44570            self.discriminant().write_xdr(w)?;
44571            #[allow(clippy::match_same_arms)]
44572            match self {
44573                Self::TxFeeBumpInnerSuccess(v) => v.write_xdr(w)?,
44574                Self::TxFeeBumpInnerFailed(v) => v.write_xdr(w)?,
44575                Self::TxSuccess(v) => v.write_xdr(w)?,
44576                Self::TxFailed(v) => v.write_xdr(w)?,
44577                Self::TxTooEarly => ().write_xdr(w)?,
44578                Self::TxTooLate => ().write_xdr(w)?,
44579                Self::TxMissingOperation => ().write_xdr(w)?,
44580                Self::TxBadSeq => ().write_xdr(w)?,
44581                Self::TxBadAuth => ().write_xdr(w)?,
44582                Self::TxInsufficientBalance => ().write_xdr(w)?,
44583                Self::TxNoAccount => ().write_xdr(w)?,
44584                Self::TxInsufficientFee => ().write_xdr(w)?,
44585                Self::TxBadAuthExtra => ().write_xdr(w)?,
44586                Self::TxInternalError => ().write_xdr(w)?,
44587                Self::TxNotSupported => ().write_xdr(w)?,
44588                Self::TxBadSponsorship => ().write_xdr(w)?,
44589                Self::TxBadMinSeqAgeOrGap => ().write_xdr(w)?,
44590                Self::TxMalformed => ().write_xdr(w)?,
44591                Self::TxSorobanInvalid => ().write_xdr(w)?,
44592            };
44593            Ok(())
44594        })
44595    }
44596}
44597
44598/// TransactionResultExt is an XDR NestedUnion defines as:
44599///
44600/// ```text
44601/// union switch (int v)
44602///     {
44603///     case 0:
44604///         void;
44605///     }
44606/// ```
44607///
44608// union with discriminant i32
44609#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
44610#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
44611#[cfg_attr(
44612    all(feature = "serde", feature = "alloc"),
44613    derive(serde::Serialize, serde::Deserialize),
44614    serde(rename_all = "snake_case")
44615)]
44616#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
44617#[allow(clippy::large_enum_variant)]
44618pub enum TransactionResultExt {
44619    V0,
44620}
44621
44622impl TransactionResultExt {
44623    pub const VARIANTS: [i32; 1] = [0];
44624    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
44625
44626    #[must_use]
44627    pub const fn name(&self) -> &'static str {
44628        match self {
44629            Self::V0 => "V0",
44630        }
44631    }
44632
44633    #[must_use]
44634    pub const fn discriminant(&self) -> i32 {
44635        #[allow(clippy::match_same_arms)]
44636        match self {
44637            Self::V0 => 0,
44638        }
44639    }
44640
44641    #[must_use]
44642    pub const fn variants() -> [i32; 1] {
44643        Self::VARIANTS
44644    }
44645}
44646
44647impl Name for TransactionResultExt {
44648    #[must_use]
44649    fn name(&self) -> &'static str {
44650        Self::name(self)
44651    }
44652}
44653
44654impl Discriminant<i32> for TransactionResultExt {
44655    #[must_use]
44656    fn discriminant(&self) -> i32 {
44657        Self::discriminant(self)
44658    }
44659}
44660
44661impl Variants<i32> for TransactionResultExt {
44662    fn variants() -> slice::Iter<'static, i32> {
44663        Self::VARIANTS.iter()
44664    }
44665}
44666
44667impl Union<i32> for TransactionResultExt {}
44668
44669impl ReadXdr for TransactionResultExt {
44670    #[cfg(feature = "std")]
44671    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
44672        r.with_limited_depth(|r| {
44673            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
44674            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
44675            let v = match dv {
44676                0 => Self::V0,
44677                #[allow(unreachable_patterns)]
44678                _ => return Err(Error::Invalid),
44679            };
44680            Ok(v)
44681        })
44682    }
44683}
44684
44685impl WriteXdr for TransactionResultExt {
44686    #[cfg(feature = "std")]
44687    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
44688        w.with_limited_depth(|w| {
44689            self.discriminant().write_xdr(w)?;
44690            #[allow(clippy::match_same_arms)]
44691            match self {
44692                Self::V0 => ().write_xdr(w)?,
44693            };
44694            Ok(())
44695        })
44696    }
44697}
44698
44699/// TransactionResult is an XDR Struct defines as:
44700///
44701/// ```text
44702/// struct TransactionResult
44703/// {
44704///     int64 feeCharged; // actual fee charged for the transaction
44705///
44706///     union switch (TransactionResultCode code)
44707///     {
44708///     case txFEE_BUMP_INNER_SUCCESS:
44709///     case txFEE_BUMP_INNER_FAILED:
44710///         InnerTransactionResultPair innerResultPair;
44711///     case txSUCCESS:
44712///     case txFAILED:
44713///         OperationResult results<>;
44714///     case txTOO_EARLY:
44715///     case txTOO_LATE:
44716///     case txMISSING_OPERATION:
44717///     case txBAD_SEQ:
44718///     case txBAD_AUTH:
44719///     case txINSUFFICIENT_BALANCE:
44720///     case txNO_ACCOUNT:
44721///     case txINSUFFICIENT_FEE:
44722///     case txBAD_AUTH_EXTRA:
44723///     case txINTERNAL_ERROR:
44724///     case txNOT_SUPPORTED:
44725///     // case txFEE_BUMP_INNER_FAILED: handled above
44726///     case txBAD_SPONSORSHIP:
44727///     case txBAD_MIN_SEQ_AGE_OR_GAP:
44728///     case txMALFORMED:
44729///     case txSOROBAN_INVALID:
44730///         void;
44731///     }
44732///     result;
44733///
44734///     // reserved for future use
44735///     union switch (int v)
44736///     {
44737///     case 0:
44738///         void;
44739///     }
44740///     ext;
44741/// };
44742/// ```
44743///
44744#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
44745#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
44746#[cfg_attr(
44747    all(feature = "serde", feature = "alloc"),
44748    derive(serde::Serialize, serde::Deserialize),
44749    serde(rename_all = "snake_case")
44750)]
44751#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
44752pub struct TransactionResult {
44753    pub fee_charged: i64,
44754    pub result: TransactionResultResult,
44755    pub ext: TransactionResultExt,
44756}
44757
44758impl ReadXdr for TransactionResult {
44759    #[cfg(feature = "std")]
44760    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
44761        r.with_limited_depth(|r| {
44762            Ok(Self {
44763                fee_charged: i64::read_xdr(r)?,
44764                result: TransactionResultResult::read_xdr(r)?,
44765                ext: TransactionResultExt::read_xdr(r)?,
44766            })
44767        })
44768    }
44769}
44770
44771impl WriteXdr for TransactionResult {
44772    #[cfg(feature = "std")]
44773    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
44774        w.with_limited_depth(|w| {
44775            self.fee_charged.write_xdr(w)?;
44776            self.result.write_xdr(w)?;
44777            self.ext.write_xdr(w)?;
44778            Ok(())
44779        })
44780    }
44781}
44782
44783/// Hash is an XDR Typedef defines as:
44784///
44785/// ```text
44786/// typedef opaque Hash[32];
44787/// ```
44788///
44789#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
44790#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
44791#[cfg_attr(
44792    all(feature = "serde", feature = "alloc"),
44793    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
44794)]
44795pub struct Hash(pub [u8; 32]);
44796
44797impl core::fmt::Debug for Hash {
44798    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
44799        let v = &self.0;
44800        write!(f, "Hash(")?;
44801        for b in v {
44802            write!(f, "{b:02x}")?;
44803        }
44804        write!(f, ")")?;
44805        Ok(())
44806    }
44807}
44808impl core::fmt::Display for Hash {
44809    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
44810        let v = &self.0;
44811        for b in v {
44812            write!(f, "{b:02x}")?;
44813        }
44814        Ok(())
44815    }
44816}
44817
44818#[cfg(feature = "alloc")]
44819impl core::str::FromStr for Hash {
44820    type Err = Error;
44821    fn from_str(s: &str) -> core::result::Result<Self, Self::Err> {
44822        hex::decode(s).map_err(|_| Error::InvalidHex)?.try_into()
44823    }
44824}
44825#[cfg(feature = "schemars")]
44826impl schemars::JsonSchema for Hash {
44827    fn schema_name() -> String {
44828        "Hash".to_string()
44829    }
44830
44831    fn is_referenceable() -> bool {
44832        false
44833    }
44834
44835    fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
44836        let schema = String::json_schema(gen);
44837        if let schemars::schema::Schema::Object(mut schema) = schema {
44838            schema.extensions.insert(
44839                "contentEncoding".to_owned(),
44840                serde_json::Value::String("hex".to_string()),
44841            );
44842            schema.extensions.insert(
44843                "contentMediaType".to_owned(),
44844                serde_json::Value::String("application/binary".to_string()),
44845            );
44846            let string = *schema.string.unwrap_or_default().clone();
44847            schema.string = Some(Box::new(schemars::schema::StringValidation {
44848                max_length: 32_u32.checked_mul(2).map(Some).unwrap_or_default(),
44849                min_length: 32_u32.checked_mul(2).map(Some).unwrap_or_default(),
44850                ..string
44851            }));
44852            schema.into()
44853        } else {
44854            schema
44855        }
44856    }
44857}
44858impl From<Hash> for [u8; 32] {
44859    #[must_use]
44860    fn from(x: Hash) -> Self {
44861        x.0
44862    }
44863}
44864
44865impl From<[u8; 32]> for Hash {
44866    #[must_use]
44867    fn from(x: [u8; 32]) -> Self {
44868        Hash(x)
44869    }
44870}
44871
44872impl AsRef<[u8; 32]> for Hash {
44873    #[must_use]
44874    fn as_ref(&self) -> &[u8; 32] {
44875        &self.0
44876    }
44877}
44878
44879impl ReadXdr for Hash {
44880    #[cfg(feature = "std")]
44881    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
44882        r.with_limited_depth(|r| {
44883            let i = <[u8; 32]>::read_xdr(r)?;
44884            let v = Hash(i);
44885            Ok(v)
44886        })
44887    }
44888}
44889
44890impl WriteXdr for Hash {
44891    #[cfg(feature = "std")]
44892    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
44893        w.with_limited_depth(|w| self.0.write_xdr(w))
44894    }
44895}
44896
44897impl Hash {
44898    #[must_use]
44899    pub fn as_slice(&self) -> &[u8] {
44900        &self.0
44901    }
44902}
44903
44904#[cfg(feature = "alloc")]
44905impl TryFrom<Vec<u8>> for Hash {
44906    type Error = Error;
44907    fn try_from(x: Vec<u8>) -> Result<Self> {
44908        x.as_slice().try_into()
44909    }
44910}
44911
44912#[cfg(feature = "alloc")]
44913impl TryFrom<&Vec<u8>> for Hash {
44914    type Error = Error;
44915    fn try_from(x: &Vec<u8>) -> Result<Self> {
44916        x.as_slice().try_into()
44917    }
44918}
44919
44920impl TryFrom<&[u8]> for Hash {
44921    type Error = Error;
44922    fn try_from(x: &[u8]) -> Result<Self> {
44923        Ok(Hash(x.try_into()?))
44924    }
44925}
44926
44927impl AsRef<[u8]> for Hash {
44928    #[must_use]
44929    fn as_ref(&self) -> &[u8] {
44930        &self.0
44931    }
44932}
44933
44934/// Uint256 is an XDR Typedef defines as:
44935///
44936/// ```text
44937/// typedef opaque uint256[32];
44938/// ```
44939///
44940#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
44941#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
44942#[cfg_attr(
44943    all(feature = "serde", feature = "alloc"),
44944    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
44945)]
44946pub struct Uint256(pub [u8; 32]);
44947
44948impl core::fmt::Debug for Uint256 {
44949    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
44950        let v = &self.0;
44951        write!(f, "Uint256(")?;
44952        for b in v {
44953            write!(f, "{b:02x}")?;
44954        }
44955        write!(f, ")")?;
44956        Ok(())
44957    }
44958}
44959impl core::fmt::Display for Uint256 {
44960    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
44961        let v = &self.0;
44962        for b in v {
44963            write!(f, "{b:02x}")?;
44964        }
44965        Ok(())
44966    }
44967}
44968
44969#[cfg(feature = "alloc")]
44970impl core::str::FromStr for Uint256 {
44971    type Err = Error;
44972    fn from_str(s: &str) -> core::result::Result<Self, Self::Err> {
44973        hex::decode(s).map_err(|_| Error::InvalidHex)?.try_into()
44974    }
44975}
44976#[cfg(feature = "schemars")]
44977impl schemars::JsonSchema for Uint256 {
44978    fn schema_name() -> String {
44979        "Uint256".to_string()
44980    }
44981
44982    fn is_referenceable() -> bool {
44983        false
44984    }
44985
44986    fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
44987        let schema = String::json_schema(gen);
44988        if let schemars::schema::Schema::Object(mut schema) = schema {
44989            schema.extensions.insert(
44990                "contentEncoding".to_owned(),
44991                serde_json::Value::String("hex".to_string()),
44992            );
44993            schema.extensions.insert(
44994                "contentMediaType".to_owned(),
44995                serde_json::Value::String("application/binary".to_string()),
44996            );
44997            let string = *schema.string.unwrap_or_default().clone();
44998            schema.string = Some(Box::new(schemars::schema::StringValidation {
44999                max_length: 32_u32.checked_mul(2).map(Some).unwrap_or_default(),
45000                min_length: 32_u32.checked_mul(2).map(Some).unwrap_or_default(),
45001                ..string
45002            }));
45003            schema.into()
45004        } else {
45005            schema
45006        }
45007    }
45008}
45009impl From<Uint256> for [u8; 32] {
45010    #[must_use]
45011    fn from(x: Uint256) -> Self {
45012        x.0
45013    }
45014}
45015
45016impl From<[u8; 32]> for Uint256 {
45017    #[must_use]
45018    fn from(x: [u8; 32]) -> Self {
45019        Uint256(x)
45020    }
45021}
45022
45023impl AsRef<[u8; 32]> for Uint256 {
45024    #[must_use]
45025    fn as_ref(&self) -> &[u8; 32] {
45026        &self.0
45027    }
45028}
45029
45030impl ReadXdr for Uint256 {
45031    #[cfg(feature = "std")]
45032    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
45033        r.with_limited_depth(|r| {
45034            let i = <[u8; 32]>::read_xdr(r)?;
45035            let v = Uint256(i);
45036            Ok(v)
45037        })
45038    }
45039}
45040
45041impl WriteXdr for Uint256 {
45042    #[cfg(feature = "std")]
45043    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
45044        w.with_limited_depth(|w| self.0.write_xdr(w))
45045    }
45046}
45047
45048impl Uint256 {
45049    #[must_use]
45050    pub fn as_slice(&self) -> &[u8] {
45051        &self.0
45052    }
45053}
45054
45055#[cfg(feature = "alloc")]
45056impl TryFrom<Vec<u8>> for Uint256 {
45057    type Error = Error;
45058    fn try_from(x: Vec<u8>) -> Result<Self> {
45059        x.as_slice().try_into()
45060    }
45061}
45062
45063#[cfg(feature = "alloc")]
45064impl TryFrom<&Vec<u8>> for Uint256 {
45065    type Error = Error;
45066    fn try_from(x: &Vec<u8>) -> Result<Self> {
45067        x.as_slice().try_into()
45068    }
45069}
45070
45071impl TryFrom<&[u8]> for Uint256 {
45072    type Error = Error;
45073    fn try_from(x: &[u8]) -> Result<Self> {
45074        Ok(Uint256(x.try_into()?))
45075    }
45076}
45077
45078impl AsRef<[u8]> for Uint256 {
45079    #[must_use]
45080    fn as_ref(&self) -> &[u8] {
45081        &self.0
45082    }
45083}
45084
45085/// Uint32 is an XDR Typedef defines as:
45086///
45087/// ```text
45088/// typedef unsigned int uint32;
45089/// ```
45090///
45091pub type Uint32 = u32;
45092
45093/// Int32 is an XDR Typedef defines as:
45094///
45095/// ```text
45096/// typedef int int32;
45097/// ```
45098///
45099pub type Int32 = i32;
45100
45101/// Uint64 is an XDR Typedef defines as:
45102///
45103/// ```text
45104/// typedef unsigned hyper uint64;
45105/// ```
45106///
45107pub type Uint64 = u64;
45108
45109/// Int64 is an XDR Typedef defines as:
45110///
45111/// ```text
45112/// typedef hyper int64;
45113/// ```
45114///
45115pub type Int64 = i64;
45116
45117/// TimePoint is an XDR Typedef defines as:
45118///
45119/// ```text
45120/// typedef uint64 TimePoint;
45121/// ```
45122///
45123#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
45124#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
45125#[cfg_attr(
45126    all(feature = "serde", feature = "alloc"),
45127    derive(serde::Serialize, serde::Deserialize),
45128    serde(rename_all = "snake_case")
45129)]
45130#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
45131#[derive(Debug)]
45132pub struct TimePoint(pub u64);
45133
45134impl From<TimePoint> for u64 {
45135    #[must_use]
45136    fn from(x: TimePoint) -> Self {
45137        x.0
45138    }
45139}
45140
45141impl From<u64> for TimePoint {
45142    #[must_use]
45143    fn from(x: u64) -> Self {
45144        TimePoint(x)
45145    }
45146}
45147
45148impl AsRef<u64> for TimePoint {
45149    #[must_use]
45150    fn as_ref(&self) -> &u64 {
45151        &self.0
45152    }
45153}
45154
45155impl ReadXdr for TimePoint {
45156    #[cfg(feature = "std")]
45157    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
45158        r.with_limited_depth(|r| {
45159            let i = u64::read_xdr(r)?;
45160            let v = TimePoint(i);
45161            Ok(v)
45162        })
45163    }
45164}
45165
45166impl WriteXdr for TimePoint {
45167    #[cfg(feature = "std")]
45168    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
45169        w.with_limited_depth(|w| self.0.write_xdr(w))
45170    }
45171}
45172
45173/// Duration is an XDR Typedef defines as:
45174///
45175/// ```text
45176/// typedef uint64 Duration;
45177/// ```
45178///
45179#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
45180#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
45181#[cfg_attr(
45182    all(feature = "serde", feature = "alloc"),
45183    derive(serde::Serialize, serde::Deserialize),
45184    serde(rename_all = "snake_case")
45185)]
45186#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
45187#[derive(Debug)]
45188pub struct Duration(pub u64);
45189
45190impl From<Duration> for u64 {
45191    #[must_use]
45192    fn from(x: Duration) -> Self {
45193        x.0
45194    }
45195}
45196
45197impl From<u64> for Duration {
45198    #[must_use]
45199    fn from(x: u64) -> Self {
45200        Duration(x)
45201    }
45202}
45203
45204impl AsRef<u64> for Duration {
45205    #[must_use]
45206    fn as_ref(&self) -> &u64 {
45207        &self.0
45208    }
45209}
45210
45211impl ReadXdr for Duration {
45212    #[cfg(feature = "std")]
45213    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
45214        r.with_limited_depth(|r| {
45215            let i = u64::read_xdr(r)?;
45216            let v = Duration(i);
45217            Ok(v)
45218        })
45219    }
45220}
45221
45222impl WriteXdr for Duration {
45223    #[cfg(feature = "std")]
45224    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
45225        w.with_limited_depth(|w| self.0.write_xdr(w))
45226    }
45227}
45228
45229/// ExtensionPoint is an XDR Union defines as:
45230///
45231/// ```text
45232/// union ExtensionPoint switch (int v)
45233/// {
45234/// case 0:
45235///     void;
45236/// };
45237/// ```
45238///
45239// union with discriminant i32
45240#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
45241#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
45242#[cfg_attr(
45243    all(feature = "serde", feature = "alloc"),
45244    derive(serde::Serialize, serde::Deserialize),
45245    serde(rename_all = "snake_case")
45246)]
45247#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
45248#[allow(clippy::large_enum_variant)]
45249pub enum ExtensionPoint {
45250    V0,
45251}
45252
45253impl ExtensionPoint {
45254    pub const VARIANTS: [i32; 1] = [0];
45255    pub const VARIANTS_STR: [&'static str; 1] = ["V0"];
45256
45257    #[must_use]
45258    pub const fn name(&self) -> &'static str {
45259        match self {
45260            Self::V0 => "V0",
45261        }
45262    }
45263
45264    #[must_use]
45265    pub const fn discriminant(&self) -> i32 {
45266        #[allow(clippy::match_same_arms)]
45267        match self {
45268            Self::V0 => 0,
45269        }
45270    }
45271
45272    #[must_use]
45273    pub const fn variants() -> [i32; 1] {
45274        Self::VARIANTS
45275    }
45276}
45277
45278impl Name for ExtensionPoint {
45279    #[must_use]
45280    fn name(&self) -> &'static str {
45281        Self::name(self)
45282    }
45283}
45284
45285impl Discriminant<i32> for ExtensionPoint {
45286    #[must_use]
45287    fn discriminant(&self) -> i32 {
45288        Self::discriminant(self)
45289    }
45290}
45291
45292impl Variants<i32> for ExtensionPoint {
45293    fn variants() -> slice::Iter<'static, i32> {
45294        Self::VARIANTS.iter()
45295    }
45296}
45297
45298impl Union<i32> for ExtensionPoint {}
45299
45300impl ReadXdr for ExtensionPoint {
45301    #[cfg(feature = "std")]
45302    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
45303        r.with_limited_depth(|r| {
45304            let dv: i32 = <i32 as ReadXdr>::read_xdr(r)?;
45305            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
45306            let v = match dv {
45307                0 => Self::V0,
45308                #[allow(unreachable_patterns)]
45309                _ => return Err(Error::Invalid),
45310            };
45311            Ok(v)
45312        })
45313    }
45314}
45315
45316impl WriteXdr for ExtensionPoint {
45317    #[cfg(feature = "std")]
45318    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
45319        w.with_limited_depth(|w| {
45320            self.discriminant().write_xdr(w)?;
45321            #[allow(clippy::match_same_arms)]
45322            match self {
45323                Self::V0 => ().write_xdr(w)?,
45324            };
45325            Ok(())
45326        })
45327    }
45328}
45329
45330/// CryptoKeyType is an XDR Enum defines as:
45331///
45332/// ```text
45333/// enum CryptoKeyType
45334/// {
45335///     KEY_TYPE_ED25519 = 0,
45336///     KEY_TYPE_PRE_AUTH_TX = 1,
45337///     KEY_TYPE_HASH_X = 2,
45338///     KEY_TYPE_ED25519_SIGNED_PAYLOAD = 3,
45339///     // MUXED enum values for supported type are derived from the enum values
45340///     // above by ORing them with 0x100
45341///     KEY_TYPE_MUXED_ED25519 = 0x100
45342/// };
45343/// ```
45344///
45345// enum
45346#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
45347#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
45348#[cfg_attr(
45349    all(feature = "serde", feature = "alloc"),
45350    derive(serde::Serialize, serde::Deserialize),
45351    serde(rename_all = "snake_case")
45352)]
45353#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
45354#[repr(i32)]
45355pub enum CryptoKeyType {
45356    Ed25519 = 0,
45357    PreAuthTx = 1,
45358    HashX = 2,
45359    Ed25519SignedPayload = 3,
45360    MuxedEd25519 = 256,
45361}
45362
45363impl CryptoKeyType {
45364    pub const VARIANTS: [CryptoKeyType; 5] = [
45365        CryptoKeyType::Ed25519,
45366        CryptoKeyType::PreAuthTx,
45367        CryptoKeyType::HashX,
45368        CryptoKeyType::Ed25519SignedPayload,
45369        CryptoKeyType::MuxedEd25519,
45370    ];
45371    pub const VARIANTS_STR: [&'static str; 5] = [
45372        "Ed25519",
45373        "PreAuthTx",
45374        "HashX",
45375        "Ed25519SignedPayload",
45376        "MuxedEd25519",
45377    ];
45378
45379    #[must_use]
45380    pub const fn name(&self) -> &'static str {
45381        match self {
45382            Self::Ed25519 => "Ed25519",
45383            Self::PreAuthTx => "PreAuthTx",
45384            Self::HashX => "HashX",
45385            Self::Ed25519SignedPayload => "Ed25519SignedPayload",
45386            Self::MuxedEd25519 => "MuxedEd25519",
45387        }
45388    }
45389
45390    #[must_use]
45391    pub const fn variants() -> [CryptoKeyType; 5] {
45392        Self::VARIANTS
45393    }
45394}
45395
45396impl Name for CryptoKeyType {
45397    #[must_use]
45398    fn name(&self) -> &'static str {
45399        Self::name(self)
45400    }
45401}
45402
45403impl Variants<CryptoKeyType> for CryptoKeyType {
45404    fn variants() -> slice::Iter<'static, CryptoKeyType> {
45405        Self::VARIANTS.iter()
45406    }
45407}
45408
45409impl Enum for CryptoKeyType {}
45410
45411impl fmt::Display for CryptoKeyType {
45412    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
45413        f.write_str(self.name())
45414    }
45415}
45416
45417impl TryFrom<i32> for CryptoKeyType {
45418    type Error = Error;
45419
45420    fn try_from(i: i32) -> Result<Self> {
45421        let e = match i {
45422            0 => CryptoKeyType::Ed25519,
45423            1 => CryptoKeyType::PreAuthTx,
45424            2 => CryptoKeyType::HashX,
45425            3 => CryptoKeyType::Ed25519SignedPayload,
45426            256 => CryptoKeyType::MuxedEd25519,
45427            #[allow(unreachable_patterns)]
45428            _ => return Err(Error::Invalid),
45429        };
45430        Ok(e)
45431    }
45432}
45433
45434impl From<CryptoKeyType> for i32 {
45435    #[must_use]
45436    fn from(e: CryptoKeyType) -> Self {
45437        e as Self
45438    }
45439}
45440
45441impl ReadXdr for CryptoKeyType {
45442    #[cfg(feature = "std")]
45443    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
45444        r.with_limited_depth(|r| {
45445            let e = i32::read_xdr(r)?;
45446            let v: Self = e.try_into()?;
45447            Ok(v)
45448        })
45449    }
45450}
45451
45452impl WriteXdr for CryptoKeyType {
45453    #[cfg(feature = "std")]
45454    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
45455        w.with_limited_depth(|w| {
45456            let i: i32 = (*self).into();
45457            i.write_xdr(w)
45458        })
45459    }
45460}
45461
45462/// PublicKeyType is an XDR Enum defines as:
45463///
45464/// ```text
45465/// enum PublicKeyType
45466/// {
45467///     PUBLIC_KEY_TYPE_ED25519 = KEY_TYPE_ED25519
45468/// };
45469/// ```
45470///
45471// enum
45472#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
45473#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
45474#[cfg_attr(
45475    all(feature = "serde", feature = "alloc"),
45476    derive(serde::Serialize, serde::Deserialize),
45477    serde(rename_all = "snake_case")
45478)]
45479#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
45480#[repr(i32)]
45481pub enum PublicKeyType {
45482    PublicKeyTypeEd25519 = 0,
45483}
45484
45485impl PublicKeyType {
45486    pub const VARIANTS: [PublicKeyType; 1] = [PublicKeyType::PublicKeyTypeEd25519];
45487    pub const VARIANTS_STR: [&'static str; 1] = ["PublicKeyTypeEd25519"];
45488
45489    #[must_use]
45490    pub const fn name(&self) -> &'static str {
45491        match self {
45492            Self::PublicKeyTypeEd25519 => "PublicKeyTypeEd25519",
45493        }
45494    }
45495
45496    #[must_use]
45497    pub const fn variants() -> [PublicKeyType; 1] {
45498        Self::VARIANTS
45499    }
45500}
45501
45502impl Name for PublicKeyType {
45503    #[must_use]
45504    fn name(&self) -> &'static str {
45505        Self::name(self)
45506    }
45507}
45508
45509impl Variants<PublicKeyType> for PublicKeyType {
45510    fn variants() -> slice::Iter<'static, PublicKeyType> {
45511        Self::VARIANTS.iter()
45512    }
45513}
45514
45515impl Enum for PublicKeyType {}
45516
45517impl fmt::Display for PublicKeyType {
45518    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
45519        f.write_str(self.name())
45520    }
45521}
45522
45523impl TryFrom<i32> for PublicKeyType {
45524    type Error = Error;
45525
45526    fn try_from(i: i32) -> Result<Self> {
45527        let e = match i {
45528            0 => PublicKeyType::PublicKeyTypeEd25519,
45529            #[allow(unreachable_patterns)]
45530            _ => return Err(Error::Invalid),
45531        };
45532        Ok(e)
45533    }
45534}
45535
45536impl From<PublicKeyType> for i32 {
45537    #[must_use]
45538    fn from(e: PublicKeyType) -> Self {
45539        e as Self
45540    }
45541}
45542
45543impl ReadXdr for PublicKeyType {
45544    #[cfg(feature = "std")]
45545    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
45546        r.with_limited_depth(|r| {
45547            let e = i32::read_xdr(r)?;
45548            let v: Self = e.try_into()?;
45549            Ok(v)
45550        })
45551    }
45552}
45553
45554impl WriteXdr for PublicKeyType {
45555    #[cfg(feature = "std")]
45556    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
45557        w.with_limited_depth(|w| {
45558            let i: i32 = (*self).into();
45559            i.write_xdr(w)
45560        })
45561    }
45562}
45563
45564/// SignerKeyType is an XDR Enum defines as:
45565///
45566/// ```text
45567/// enum SignerKeyType
45568/// {
45569///     SIGNER_KEY_TYPE_ED25519 = KEY_TYPE_ED25519,
45570///     SIGNER_KEY_TYPE_PRE_AUTH_TX = KEY_TYPE_PRE_AUTH_TX,
45571///     SIGNER_KEY_TYPE_HASH_X = KEY_TYPE_HASH_X,
45572///     SIGNER_KEY_TYPE_ED25519_SIGNED_PAYLOAD = KEY_TYPE_ED25519_SIGNED_PAYLOAD
45573/// };
45574/// ```
45575///
45576// enum
45577#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
45578#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
45579#[cfg_attr(
45580    all(feature = "serde", feature = "alloc"),
45581    derive(serde::Serialize, serde::Deserialize),
45582    serde(rename_all = "snake_case")
45583)]
45584#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
45585#[repr(i32)]
45586pub enum SignerKeyType {
45587    Ed25519 = 0,
45588    PreAuthTx = 1,
45589    HashX = 2,
45590    Ed25519SignedPayload = 3,
45591}
45592
45593impl SignerKeyType {
45594    pub const VARIANTS: [SignerKeyType; 4] = [
45595        SignerKeyType::Ed25519,
45596        SignerKeyType::PreAuthTx,
45597        SignerKeyType::HashX,
45598        SignerKeyType::Ed25519SignedPayload,
45599    ];
45600    pub const VARIANTS_STR: [&'static str; 4] =
45601        ["Ed25519", "PreAuthTx", "HashX", "Ed25519SignedPayload"];
45602
45603    #[must_use]
45604    pub const fn name(&self) -> &'static str {
45605        match self {
45606            Self::Ed25519 => "Ed25519",
45607            Self::PreAuthTx => "PreAuthTx",
45608            Self::HashX => "HashX",
45609            Self::Ed25519SignedPayload => "Ed25519SignedPayload",
45610        }
45611    }
45612
45613    #[must_use]
45614    pub const fn variants() -> [SignerKeyType; 4] {
45615        Self::VARIANTS
45616    }
45617}
45618
45619impl Name for SignerKeyType {
45620    #[must_use]
45621    fn name(&self) -> &'static str {
45622        Self::name(self)
45623    }
45624}
45625
45626impl Variants<SignerKeyType> for SignerKeyType {
45627    fn variants() -> slice::Iter<'static, SignerKeyType> {
45628        Self::VARIANTS.iter()
45629    }
45630}
45631
45632impl Enum for SignerKeyType {}
45633
45634impl fmt::Display for SignerKeyType {
45635    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
45636        f.write_str(self.name())
45637    }
45638}
45639
45640impl TryFrom<i32> for SignerKeyType {
45641    type Error = Error;
45642
45643    fn try_from(i: i32) -> Result<Self> {
45644        let e = match i {
45645            0 => SignerKeyType::Ed25519,
45646            1 => SignerKeyType::PreAuthTx,
45647            2 => SignerKeyType::HashX,
45648            3 => SignerKeyType::Ed25519SignedPayload,
45649            #[allow(unreachable_patterns)]
45650            _ => return Err(Error::Invalid),
45651        };
45652        Ok(e)
45653    }
45654}
45655
45656impl From<SignerKeyType> for i32 {
45657    #[must_use]
45658    fn from(e: SignerKeyType) -> Self {
45659        e as Self
45660    }
45661}
45662
45663impl ReadXdr for SignerKeyType {
45664    #[cfg(feature = "std")]
45665    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
45666        r.with_limited_depth(|r| {
45667            let e = i32::read_xdr(r)?;
45668            let v: Self = e.try_into()?;
45669            Ok(v)
45670        })
45671    }
45672}
45673
45674impl WriteXdr for SignerKeyType {
45675    #[cfg(feature = "std")]
45676    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
45677        w.with_limited_depth(|w| {
45678            let i: i32 = (*self).into();
45679            i.write_xdr(w)
45680        })
45681    }
45682}
45683
45684/// PublicKey is an XDR Union defines as:
45685///
45686/// ```text
45687/// union PublicKey switch (PublicKeyType type)
45688/// {
45689/// case PUBLIC_KEY_TYPE_ED25519:
45690///     uint256 ed25519;
45691/// };
45692/// ```
45693///
45694// union with discriminant PublicKeyType
45695#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
45696#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
45697#[cfg_attr(
45698    all(feature = "serde", feature = "alloc"),
45699    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
45700)]
45701#[allow(clippy::large_enum_variant)]
45702pub enum PublicKey {
45703    PublicKeyTypeEd25519(Uint256),
45704}
45705
45706impl PublicKey {
45707    pub const VARIANTS: [PublicKeyType; 1] = [PublicKeyType::PublicKeyTypeEd25519];
45708    pub const VARIANTS_STR: [&'static str; 1] = ["PublicKeyTypeEd25519"];
45709
45710    #[must_use]
45711    pub const fn name(&self) -> &'static str {
45712        match self {
45713            Self::PublicKeyTypeEd25519(_) => "PublicKeyTypeEd25519",
45714        }
45715    }
45716
45717    #[must_use]
45718    pub const fn discriminant(&self) -> PublicKeyType {
45719        #[allow(clippy::match_same_arms)]
45720        match self {
45721            Self::PublicKeyTypeEd25519(_) => PublicKeyType::PublicKeyTypeEd25519,
45722        }
45723    }
45724
45725    #[must_use]
45726    pub const fn variants() -> [PublicKeyType; 1] {
45727        Self::VARIANTS
45728    }
45729}
45730
45731impl Name for PublicKey {
45732    #[must_use]
45733    fn name(&self) -> &'static str {
45734        Self::name(self)
45735    }
45736}
45737
45738impl Discriminant<PublicKeyType> for PublicKey {
45739    #[must_use]
45740    fn discriminant(&self) -> PublicKeyType {
45741        Self::discriminant(self)
45742    }
45743}
45744
45745impl Variants<PublicKeyType> for PublicKey {
45746    fn variants() -> slice::Iter<'static, PublicKeyType> {
45747        Self::VARIANTS.iter()
45748    }
45749}
45750
45751impl Union<PublicKeyType> for PublicKey {}
45752
45753impl ReadXdr for PublicKey {
45754    #[cfg(feature = "std")]
45755    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
45756        r.with_limited_depth(|r| {
45757            let dv: PublicKeyType = <PublicKeyType as ReadXdr>::read_xdr(r)?;
45758            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
45759            let v = match dv {
45760                PublicKeyType::PublicKeyTypeEd25519 => {
45761                    Self::PublicKeyTypeEd25519(Uint256::read_xdr(r)?)
45762                }
45763                #[allow(unreachable_patterns)]
45764                _ => return Err(Error::Invalid),
45765            };
45766            Ok(v)
45767        })
45768    }
45769}
45770
45771impl WriteXdr for PublicKey {
45772    #[cfg(feature = "std")]
45773    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
45774        w.with_limited_depth(|w| {
45775            self.discriminant().write_xdr(w)?;
45776            #[allow(clippy::match_same_arms)]
45777            match self {
45778                Self::PublicKeyTypeEd25519(v) => v.write_xdr(w)?,
45779            };
45780            Ok(())
45781        })
45782    }
45783}
45784
45785/// SignerKeyEd25519SignedPayload is an XDR NestedStruct defines as:
45786///
45787/// ```text
45788/// struct
45789///     {
45790///         /* Public key that must sign the payload. */
45791///         uint256 ed25519;
45792///         /* Payload to be raw signed by ed25519. */
45793///         opaque payload<64>;
45794///     }
45795/// ```
45796///
45797#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
45798#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
45799#[cfg_attr(
45800    all(feature = "serde", feature = "alloc"),
45801    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
45802)]
45803pub struct SignerKeyEd25519SignedPayload {
45804    pub ed25519: Uint256,
45805    pub payload: BytesM<64>,
45806}
45807
45808impl ReadXdr for SignerKeyEd25519SignedPayload {
45809    #[cfg(feature = "std")]
45810    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
45811        r.with_limited_depth(|r| {
45812            Ok(Self {
45813                ed25519: Uint256::read_xdr(r)?,
45814                payload: BytesM::<64>::read_xdr(r)?,
45815            })
45816        })
45817    }
45818}
45819
45820impl WriteXdr for SignerKeyEd25519SignedPayload {
45821    #[cfg(feature = "std")]
45822    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
45823        w.with_limited_depth(|w| {
45824            self.ed25519.write_xdr(w)?;
45825            self.payload.write_xdr(w)?;
45826            Ok(())
45827        })
45828    }
45829}
45830
45831/// SignerKey is an XDR Union defines as:
45832///
45833/// ```text
45834/// union SignerKey switch (SignerKeyType type)
45835/// {
45836/// case SIGNER_KEY_TYPE_ED25519:
45837///     uint256 ed25519;
45838/// case SIGNER_KEY_TYPE_PRE_AUTH_TX:
45839///     /* SHA-256 Hash of TransactionSignaturePayload structure */
45840///     uint256 preAuthTx;
45841/// case SIGNER_KEY_TYPE_HASH_X:
45842///     /* Hash of random 256 bit preimage X */
45843///     uint256 hashX;
45844/// case SIGNER_KEY_TYPE_ED25519_SIGNED_PAYLOAD:
45845///     struct
45846///     {
45847///         /* Public key that must sign the payload. */
45848///         uint256 ed25519;
45849///         /* Payload to be raw signed by ed25519. */
45850///         opaque payload<64>;
45851///     } ed25519SignedPayload;
45852/// };
45853/// ```
45854///
45855// union with discriminant SignerKeyType
45856#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
45857#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
45858#[cfg_attr(
45859    all(feature = "serde", feature = "alloc"),
45860    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
45861)]
45862#[allow(clippy::large_enum_variant)]
45863pub enum SignerKey {
45864    Ed25519(Uint256),
45865    PreAuthTx(Uint256),
45866    HashX(Uint256),
45867    Ed25519SignedPayload(SignerKeyEd25519SignedPayload),
45868}
45869
45870impl SignerKey {
45871    pub const VARIANTS: [SignerKeyType; 4] = [
45872        SignerKeyType::Ed25519,
45873        SignerKeyType::PreAuthTx,
45874        SignerKeyType::HashX,
45875        SignerKeyType::Ed25519SignedPayload,
45876    ];
45877    pub const VARIANTS_STR: [&'static str; 4] =
45878        ["Ed25519", "PreAuthTx", "HashX", "Ed25519SignedPayload"];
45879
45880    #[must_use]
45881    pub const fn name(&self) -> &'static str {
45882        match self {
45883            Self::Ed25519(_) => "Ed25519",
45884            Self::PreAuthTx(_) => "PreAuthTx",
45885            Self::HashX(_) => "HashX",
45886            Self::Ed25519SignedPayload(_) => "Ed25519SignedPayload",
45887        }
45888    }
45889
45890    #[must_use]
45891    pub const fn discriminant(&self) -> SignerKeyType {
45892        #[allow(clippy::match_same_arms)]
45893        match self {
45894            Self::Ed25519(_) => SignerKeyType::Ed25519,
45895            Self::PreAuthTx(_) => SignerKeyType::PreAuthTx,
45896            Self::HashX(_) => SignerKeyType::HashX,
45897            Self::Ed25519SignedPayload(_) => SignerKeyType::Ed25519SignedPayload,
45898        }
45899    }
45900
45901    #[must_use]
45902    pub const fn variants() -> [SignerKeyType; 4] {
45903        Self::VARIANTS
45904    }
45905}
45906
45907impl Name for SignerKey {
45908    #[must_use]
45909    fn name(&self) -> &'static str {
45910        Self::name(self)
45911    }
45912}
45913
45914impl Discriminant<SignerKeyType> for SignerKey {
45915    #[must_use]
45916    fn discriminant(&self) -> SignerKeyType {
45917        Self::discriminant(self)
45918    }
45919}
45920
45921impl Variants<SignerKeyType> for SignerKey {
45922    fn variants() -> slice::Iter<'static, SignerKeyType> {
45923        Self::VARIANTS.iter()
45924    }
45925}
45926
45927impl Union<SignerKeyType> for SignerKey {}
45928
45929impl ReadXdr for SignerKey {
45930    #[cfg(feature = "std")]
45931    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
45932        r.with_limited_depth(|r| {
45933            let dv: SignerKeyType = <SignerKeyType as ReadXdr>::read_xdr(r)?;
45934            #[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
45935            let v = match dv {
45936                SignerKeyType::Ed25519 => Self::Ed25519(Uint256::read_xdr(r)?),
45937                SignerKeyType::PreAuthTx => Self::PreAuthTx(Uint256::read_xdr(r)?),
45938                SignerKeyType::HashX => Self::HashX(Uint256::read_xdr(r)?),
45939                SignerKeyType::Ed25519SignedPayload => {
45940                    Self::Ed25519SignedPayload(SignerKeyEd25519SignedPayload::read_xdr(r)?)
45941                }
45942                #[allow(unreachable_patterns)]
45943                _ => return Err(Error::Invalid),
45944            };
45945            Ok(v)
45946        })
45947    }
45948}
45949
45950impl WriteXdr for SignerKey {
45951    #[cfg(feature = "std")]
45952    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
45953        w.with_limited_depth(|w| {
45954            self.discriminant().write_xdr(w)?;
45955            #[allow(clippy::match_same_arms)]
45956            match self {
45957                Self::Ed25519(v) => v.write_xdr(w)?,
45958                Self::PreAuthTx(v) => v.write_xdr(w)?,
45959                Self::HashX(v) => v.write_xdr(w)?,
45960                Self::Ed25519SignedPayload(v) => v.write_xdr(w)?,
45961            };
45962            Ok(())
45963        })
45964    }
45965}
45966
45967/// Signature is an XDR Typedef defines as:
45968///
45969/// ```text
45970/// typedef opaque Signature<64>;
45971/// ```
45972///
45973#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
45974#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
45975#[derive(Default)]
45976#[cfg_attr(
45977    all(feature = "serde", feature = "alloc"),
45978    derive(serde::Serialize, serde::Deserialize),
45979    serde(rename_all = "snake_case")
45980)]
45981#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
45982#[derive(Debug)]
45983pub struct Signature(pub BytesM<64>);
45984
45985impl From<Signature> for BytesM<64> {
45986    #[must_use]
45987    fn from(x: Signature) -> Self {
45988        x.0
45989    }
45990}
45991
45992impl From<BytesM<64>> for Signature {
45993    #[must_use]
45994    fn from(x: BytesM<64>) -> Self {
45995        Signature(x)
45996    }
45997}
45998
45999impl AsRef<BytesM<64>> for Signature {
46000    #[must_use]
46001    fn as_ref(&self) -> &BytesM<64> {
46002        &self.0
46003    }
46004}
46005
46006impl ReadXdr for Signature {
46007    #[cfg(feature = "std")]
46008    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
46009        r.with_limited_depth(|r| {
46010            let i = BytesM::<64>::read_xdr(r)?;
46011            let v = Signature(i);
46012            Ok(v)
46013        })
46014    }
46015}
46016
46017impl WriteXdr for Signature {
46018    #[cfg(feature = "std")]
46019    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
46020        w.with_limited_depth(|w| self.0.write_xdr(w))
46021    }
46022}
46023
46024impl Deref for Signature {
46025    type Target = BytesM<64>;
46026    fn deref(&self) -> &Self::Target {
46027        &self.0
46028    }
46029}
46030
46031impl From<Signature> for Vec<u8> {
46032    #[must_use]
46033    fn from(x: Signature) -> Self {
46034        x.0 .0
46035    }
46036}
46037
46038impl TryFrom<Vec<u8>> for Signature {
46039    type Error = Error;
46040    fn try_from(x: Vec<u8>) -> Result<Self> {
46041        Ok(Signature(x.try_into()?))
46042    }
46043}
46044
46045#[cfg(feature = "alloc")]
46046impl TryFrom<&Vec<u8>> for Signature {
46047    type Error = Error;
46048    fn try_from(x: &Vec<u8>) -> Result<Self> {
46049        Ok(Signature(x.try_into()?))
46050    }
46051}
46052
46053impl AsRef<Vec<u8>> for Signature {
46054    #[must_use]
46055    fn as_ref(&self) -> &Vec<u8> {
46056        &self.0 .0
46057    }
46058}
46059
46060impl AsRef<[u8]> for Signature {
46061    #[cfg(feature = "alloc")]
46062    #[must_use]
46063    fn as_ref(&self) -> &[u8] {
46064        &self.0 .0
46065    }
46066    #[cfg(not(feature = "alloc"))]
46067    #[must_use]
46068    fn as_ref(&self) -> &[u8] {
46069        self.0 .0
46070    }
46071}
46072
46073/// SignatureHint is an XDR Typedef defines as:
46074///
46075/// ```text
46076/// typedef opaque SignatureHint[4];
46077/// ```
46078///
46079#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
46080#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
46081#[cfg_attr(
46082    all(feature = "serde", feature = "alloc"),
46083    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
46084)]
46085pub struct SignatureHint(pub [u8; 4]);
46086
46087impl core::fmt::Debug for SignatureHint {
46088    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
46089        let v = &self.0;
46090        write!(f, "SignatureHint(")?;
46091        for b in v {
46092            write!(f, "{b:02x}")?;
46093        }
46094        write!(f, ")")?;
46095        Ok(())
46096    }
46097}
46098impl core::fmt::Display for SignatureHint {
46099    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
46100        let v = &self.0;
46101        for b in v {
46102            write!(f, "{b:02x}")?;
46103        }
46104        Ok(())
46105    }
46106}
46107
46108#[cfg(feature = "alloc")]
46109impl core::str::FromStr for SignatureHint {
46110    type Err = Error;
46111    fn from_str(s: &str) -> core::result::Result<Self, Self::Err> {
46112        hex::decode(s).map_err(|_| Error::InvalidHex)?.try_into()
46113    }
46114}
46115#[cfg(feature = "schemars")]
46116impl schemars::JsonSchema for SignatureHint {
46117    fn schema_name() -> String {
46118        "SignatureHint".to_string()
46119    }
46120
46121    fn is_referenceable() -> bool {
46122        false
46123    }
46124
46125    fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
46126        let schema = String::json_schema(gen);
46127        if let schemars::schema::Schema::Object(mut schema) = schema {
46128            schema.extensions.insert(
46129                "contentEncoding".to_owned(),
46130                serde_json::Value::String("hex".to_string()),
46131            );
46132            schema.extensions.insert(
46133                "contentMediaType".to_owned(),
46134                serde_json::Value::String("application/binary".to_string()),
46135            );
46136            let string = *schema.string.unwrap_or_default().clone();
46137            schema.string = Some(Box::new(schemars::schema::StringValidation {
46138                max_length: 4_u32.checked_mul(2).map(Some).unwrap_or_default(),
46139                min_length: 4_u32.checked_mul(2).map(Some).unwrap_or_default(),
46140                ..string
46141            }));
46142            schema.into()
46143        } else {
46144            schema
46145        }
46146    }
46147}
46148impl From<SignatureHint> for [u8; 4] {
46149    #[must_use]
46150    fn from(x: SignatureHint) -> Self {
46151        x.0
46152    }
46153}
46154
46155impl From<[u8; 4]> for SignatureHint {
46156    #[must_use]
46157    fn from(x: [u8; 4]) -> Self {
46158        SignatureHint(x)
46159    }
46160}
46161
46162impl AsRef<[u8; 4]> for SignatureHint {
46163    #[must_use]
46164    fn as_ref(&self) -> &[u8; 4] {
46165        &self.0
46166    }
46167}
46168
46169impl ReadXdr for SignatureHint {
46170    #[cfg(feature = "std")]
46171    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
46172        r.with_limited_depth(|r| {
46173            let i = <[u8; 4]>::read_xdr(r)?;
46174            let v = SignatureHint(i);
46175            Ok(v)
46176        })
46177    }
46178}
46179
46180impl WriteXdr for SignatureHint {
46181    #[cfg(feature = "std")]
46182    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
46183        w.with_limited_depth(|w| self.0.write_xdr(w))
46184    }
46185}
46186
46187impl SignatureHint {
46188    #[must_use]
46189    pub fn as_slice(&self) -> &[u8] {
46190        &self.0
46191    }
46192}
46193
46194#[cfg(feature = "alloc")]
46195impl TryFrom<Vec<u8>> for SignatureHint {
46196    type Error = Error;
46197    fn try_from(x: Vec<u8>) -> Result<Self> {
46198        x.as_slice().try_into()
46199    }
46200}
46201
46202#[cfg(feature = "alloc")]
46203impl TryFrom<&Vec<u8>> for SignatureHint {
46204    type Error = Error;
46205    fn try_from(x: &Vec<u8>) -> Result<Self> {
46206        x.as_slice().try_into()
46207    }
46208}
46209
46210impl TryFrom<&[u8]> for SignatureHint {
46211    type Error = Error;
46212    fn try_from(x: &[u8]) -> Result<Self> {
46213        Ok(SignatureHint(x.try_into()?))
46214    }
46215}
46216
46217impl AsRef<[u8]> for SignatureHint {
46218    #[must_use]
46219    fn as_ref(&self) -> &[u8] {
46220        &self.0
46221    }
46222}
46223
46224/// NodeId is an XDR Typedef defines as:
46225///
46226/// ```text
46227/// typedef PublicKey NodeID;
46228/// ```
46229///
46230#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
46231#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
46232#[cfg_attr(
46233    all(feature = "serde", feature = "alloc"),
46234    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
46235)]
46236#[derive(Debug)]
46237pub struct NodeId(pub PublicKey);
46238
46239impl From<NodeId> for PublicKey {
46240    #[must_use]
46241    fn from(x: NodeId) -> Self {
46242        x.0
46243    }
46244}
46245
46246impl From<PublicKey> for NodeId {
46247    #[must_use]
46248    fn from(x: PublicKey) -> Self {
46249        NodeId(x)
46250    }
46251}
46252
46253impl AsRef<PublicKey> for NodeId {
46254    #[must_use]
46255    fn as_ref(&self) -> &PublicKey {
46256        &self.0
46257    }
46258}
46259
46260impl ReadXdr for NodeId {
46261    #[cfg(feature = "std")]
46262    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
46263        r.with_limited_depth(|r| {
46264            let i = PublicKey::read_xdr(r)?;
46265            let v = NodeId(i);
46266            Ok(v)
46267        })
46268    }
46269}
46270
46271impl WriteXdr for NodeId {
46272    #[cfg(feature = "std")]
46273    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
46274        w.with_limited_depth(|w| self.0.write_xdr(w))
46275    }
46276}
46277
46278/// AccountId is an XDR Typedef defines as:
46279///
46280/// ```text
46281/// typedef PublicKey AccountID;
46282/// ```
46283///
46284#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
46285#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
46286#[cfg_attr(
46287    all(feature = "serde", feature = "alloc"),
46288    derive(serde_with::SerializeDisplay, serde_with::DeserializeFromStr)
46289)]
46290#[derive(Debug)]
46291pub struct AccountId(pub PublicKey);
46292
46293impl From<AccountId> for PublicKey {
46294    #[must_use]
46295    fn from(x: AccountId) -> Self {
46296        x.0
46297    }
46298}
46299
46300impl From<PublicKey> for AccountId {
46301    #[must_use]
46302    fn from(x: PublicKey) -> Self {
46303        AccountId(x)
46304    }
46305}
46306
46307impl AsRef<PublicKey> for AccountId {
46308    #[must_use]
46309    fn as_ref(&self) -> &PublicKey {
46310        &self.0
46311    }
46312}
46313
46314impl ReadXdr for AccountId {
46315    #[cfg(feature = "std")]
46316    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
46317        r.with_limited_depth(|r| {
46318            let i = PublicKey::read_xdr(r)?;
46319            let v = AccountId(i);
46320            Ok(v)
46321        })
46322    }
46323}
46324
46325impl WriteXdr for AccountId {
46326    #[cfg(feature = "std")]
46327    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
46328        w.with_limited_depth(|w| self.0.write_xdr(w))
46329    }
46330}
46331
46332/// Curve25519Secret is an XDR Struct defines as:
46333///
46334/// ```text
46335/// struct Curve25519Secret
46336/// {
46337///     opaque key[32];
46338/// };
46339/// ```
46340///
46341#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
46342#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
46343#[cfg_attr(
46344    all(feature = "serde", feature = "alloc"),
46345    derive(serde::Serialize, serde::Deserialize),
46346    serde(rename_all = "snake_case")
46347)]
46348#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
46349pub struct Curve25519Secret {
46350    pub key: [u8; 32],
46351}
46352
46353impl ReadXdr for Curve25519Secret {
46354    #[cfg(feature = "std")]
46355    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
46356        r.with_limited_depth(|r| {
46357            Ok(Self {
46358                key: <[u8; 32]>::read_xdr(r)?,
46359            })
46360        })
46361    }
46362}
46363
46364impl WriteXdr for Curve25519Secret {
46365    #[cfg(feature = "std")]
46366    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
46367        w.with_limited_depth(|w| {
46368            self.key.write_xdr(w)?;
46369            Ok(())
46370        })
46371    }
46372}
46373
46374/// Curve25519Public is an XDR Struct defines as:
46375///
46376/// ```text
46377/// struct Curve25519Public
46378/// {
46379///     opaque key[32];
46380/// };
46381/// ```
46382///
46383#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
46384#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
46385#[cfg_attr(
46386    all(feature = "serde", feature = "alloc"),
46387    derive(serde::Serialize, serde::Deserialize),
46388    serde(rename_all = "snake_case")
46389)]
46390#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
46391pub struct Curve25519Public {
46392    pub key: [u8; 32],
46393}
46394
46395impl ReadXdr for Curve25519Public {
46396    #[cfg(feature = "std")]
46397    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
46398        r.with_limited_depth(|r| {
46399            Ok(Self {
46400                key: <[u8; 32]>::read_xdr(r)?,
46401            })
46402        })
46403    }
46404}
46405
46406impl WriteXdr for Curve25519Public {
46407    #[cfg(feature = "std")]
46408    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
46409        w.with_limited_depth(|w| {
46410            self.key.write_xdr(w)?;
46411            Ok(())
46412        })
46413    }
46414}
46415
46416/// HmacSha256Key is an XDR Struct defines as:
46417///
46418/// ```text
46419/// struct HmacSha256Key
46420/// {
46421///     opaque key[32];
46422/// };
46423/// ```
46424///
46425#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
46426#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
46427#[cfg_attr(
46428    all(feature = "serde", feature = "alloc"),
46429    derive(serde::Serialize, serde::Deserialize),
46430    serde(rename_all = "snake_case")
46431)]
46432#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
46433pub struct HmacSha256Key {
46434    pub key: [u8; 32],
46435}
46436
46437impl ReadXdr for HmacSha256Key {
46438    #[cfg(feature = "std")]
46439    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
46440        r.with_limited_depth(|r| {
46441            Ok(Self {
46442                key: <[u8; 32]>::read_xdr(r)?,
46443            })
46444        })
46445    }
46446}
46447
46448impl WriteXdr for HmacSha256Key {
46449    #[cfg(feature = "std")]
46450    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
46451        w.with_limited_depth(|w| {
46452            self.key.write_xdr(w)?;
46453            Ok(())
46454        })
46455    }
46456}
46457
46458/// HmacSha256Mac is an XDR Struct defines as:
46459///
46460/// ```text
46461/// struct HmacSha256Mac
46462/// {
46463///     opaque mac[32];
46464/// };
46465/// ```
46466///
46467#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
46468#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
46469#[cfg_attr(
46470    all(feature = "serde", feature = "alloc"),
46471    derive(serde::Serialize, serde::Deserialize),
46472    serde(rename_all = "snake_case")
46473)]
46474#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
46475pub struct HmacSha256Mac {
46476    pub mac: [u8; 32],
46477}
46478
46479impl ReadXdr for HmacSha256Mac {
46480    #[cfg(feature = "std")]
46481    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
46482        r.with_limited_depth(|r| {
46483            Ok(Self {
46484                mac: <[u8; 32]>::read_xdr(r)?,
46485            })
46486        })
46487    }
46488}
46489
46490impl WriteXdr for HmacSha256Mac {
46491    #[cfg(feature = "std")]
46492    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
46493        w.with_limited_depth(|w| {
46494            self.mac.write_xdr(w)?;
46495            Ok(())
46496        })
46497    }
46498}
46499
46500/// ShortHashSeed is an XDR Struct defines as:
46501///
46502/// ```text
46503/// struct ShortHashSeed
46504/// {
46505///     opaque seed[16];
46506/// };
46507/// ```
46508///
46509#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
46510#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
46511#[cfg_attr(
46512    all(feature = "serde", feature = "alloc"),
46513    derive(serde::Serialize, serde::Deserialize),
46514    serde(rename_all = "snake_case")
46515)]
46516#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
46517pub struct ShortHashSeed {
46518    pub seed: [u8; 16],
46519}
46520
46521impl ReadXdr for ShortHashSeed {
46522    #[cfg(feature = "std")]
46523    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
46524        r.with_limited_depth(|r| {
46525            Ok(Self {
46526                seed: <[u8; 16]>::read_xdr(r)?,
46527            })
46528        })
46529    }
46530}
46531
46532impl WriteXdr for ShortHashSeed {
46533    #[cfg(feature = "std")]
46534    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
46535        w.with_limited_depth(|w| {
46536            self.seed.write_xdr(w)?;
46537            Ok(())
46538        })
46539    }
46540}
46541
46542/// BinaryFuseFilterType is an XDR Enum defines as:
46543///
46544/// ```text
46545/// enum BinaryFuseFilterType
46546/// {
46547///     BINARY_FUSE_FILTER_8_BIT = 0,
46548///     BINARY_FUSE_FILTER_16_BIT = 1,
46549///     BINARY_FUSE_FILTER_32_BIT = 2
46550/// };
46551/// ```
46552///
46553// enum
46554#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
46555#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
46556#[cfg_attr(
46557    all(feature = "serde", feature = "alloc"),
46558    derive(serde::Serialize, serde::Deserialize),
46559    serde(rename_all = "snake_case")
46560)]
46561#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
46562#[repr(i32)]
46563pub enum BinaryFuseFilterType {
46564    B8Bit = 0,
46565    B16Bit = 1,
46566    B32Bit = 2,
46567}
46568
46569impl BinaryFuseFilterType {
46570    pub const VARIANTS: [BinaryFuseFilterType; 3] = [
46571        BinaryFuseFilterType::B8Bit,
46572        BinaryFuseFilterType::B16Bit,
46573        BinaryFuseFilterType::B32Bit,
46574    ];
46575    pub const VARIANTS_STR: [&'static str; 3] = ["B8Bit", "B16Bit", "B32Bit"];
46576
46577    #[must_use]
46578    pub const fn name(&self) -> &'static str {
46579        match self {
46580            Self::B8Bit => "B8Bit",
46581            Self::B16Bit => "B16Bit",
46582            Self::B32Bit => "B32Bit",
46583        }
46584    }
46585
46586    #[must_use]
46587    pub const fn variants() -> [BinaryFuseFilterType; 3] {
46588        Self::VARIANTS
46589    }
46590}
46591
46592impl Name for BinaryFuseFilterType {
46593    #[must_use]
46594    fn name(&self) -> &'static str {
46595        Self::name(self)
46596    }
46597}
46598
46599impl Variants<BinaryFuseFilterType> for BinaryFuseFilterType {
46600    fn variants() -> slice::Iter<'static, BinaryFuseFilterType> {
46601        Self::VARIANTS.iter()
46602    }
46603}
46604
46605impl Enum for BinaryFuseFilterType {}
46606
46607impl fmt::Display for BinaryFuseFilterType {
46608    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
46609        f.write_str(self.name())
46610    }
46611}
46612
46613impl TryFrom<i32> for BinaryFuseFilterType {
46614    type Error = Error;
46615
46616    fn try_from(i: i32) -> Result<Self> {
46617        let e = match i {
46618            0 => BinaryFuseFilterType::B8Bit,
46619            1 => BinaryFuseFilterType::B16Bit,
46620            2 => BinaryFuseFilterType::B32Bit,
46621            #[allow(unreachable_patterns)]
46622            _ => return Err(Error::Invalid),
46623        };
46624        Ok(e)
46625    }
46626}
46627
46628impl From<BinaryFuseFilterType> for i32 {
46629    #[must_use]
46630    fn from(e: BinaryFuseFilterType) -> Self {
46631        e as Self
46632    }
46633}
46634
46635impl ReadXdr for BinaryFuseFilterType {
46636    #[cfg(feature = "std")]
46637    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
46638        r.with_limited_depth(|r| {
46639            let e = i32::read_xdr(r)?;
46640            let v: Self = e.try_into()?;
46641            Ok(v)
46642        })
46643    }
46644}
46645
46646impl WriteXdr for BinaryFuseFilterType {
46647    #[cfg(feature = "std")]
46648    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
46649        w.with_limited_depth(|w| {
46650            let i: i32 = (*self).into();
46651            i.write_xdr(w)
46652        })
46653    }
46654}
46655
46656/// SerializedBinaryFuseFilter is an XDR Struct defines as:
46657///
46658/// ```text
46659/// struct SerializedBinaryFuseFilter
46660/// {
46661///     BinaryFuseFilterType type;
46662///
46663///     // Seed used to hash input to filter
46664///     ShortHashSeed inputHashSeed;
46665///
46666///     // Seed used for internal filter hash operations
46667///     ShortHashSeed filterSeed;
46668///     uint32 segmentLength;
46669///     uint32 segementLengthMask;
46670///     uint32 segmentCount;
46671///     uint32 segmentCountLength;
46672///     uint32 fingerprintLength; // Length in terms of element count, not bytes
46673///
46674///     // Array of uint8_t, uint16_t, or uint32_t depending on filter type
46675///     opaque fingerprints<>;
46676/// };
46677/// ```
46678///
46679#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
46680#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
46681#[cfg_attr(
46682    all(feature = "serde", feature = "alloc"),
46683    derive(serde::Serialize, serde::Deserialize),
46684    serde(rename_all = "snake_case")
46685)]
46686#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
46687pub struct SerializedBinaryFuseFilter {
46688    pub type_: BinaryFuseFilterType,
46689    pub input_hash_seed: ShortHashSeed,
46690    pub filter_seed: ShortHashSeed,
46691    pub segment_length: u32,
46692    pub segement_length_mask: u32,
46693    pub segment_count: u32,
46694    pub segment_count_length: u32,
46695    pub fingerprint_length: u32,
46696    pub fingerprints: BytesM,
46697}
46698
46699impl ReadXdr for SerializedBinaryFuseFilter {
46700    #[cfg(feature = "std")]
46701    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self> {
46702        r.with_limited_depth(|r| {
46703            Ok(Self {
46704                type_: BinaryFuseFilterType::read_xdr(r)?,
46705                input_hash_seed: ShortHashSeed::read_xdr(r)?,
46706                filter_seed: ShortHashSeed::read_xdr(r)?,
46707                segment_length: u32::read_xdr(r)?,
46708                segement_length_mask: u32::read_xdr(r)?,
46709                segment_count: u32::read_xdr(r)?,
46710                segment_count_length: u32::read_xdr(r)?,
46711                fingerprint_length: u32::read_xdr(r)?,
46712                fingerprints: BytesM::read_xdr(r)?,
46713            })
46714        })
46715    }
46716}
46717
46718impl WriteXdr for SerializedBinaryFuseFilter {
46719    #[cfg(feature = "std")]
46720    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
46721        w.with_limited_depth(|w| {
46722            self.type_.write_xdr(w)?;
46723            self.input_hash_seed.write_xdr(w)?;
46724            self.filter_seed.write_xdr(w)?;
46725            self.segment_length.write_xdr(w)?;
46726            self.segement_length_mask.write_xdr(w)?;
46727            self.segment_count.write_xdr(w)?;
46728            self.segment_count_length.write_xdr(w)?;
46729            self.fingerprint_length.write_xdr(w)?;
46730            self.fingerprints.write_xdr(w)?;
46731            Ok(())
46732        })
46733    }
46734}
46735
46736#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
46737#[cfg_attr(
46738    all(feature = "serde", feature = "alloc"),
46739    derive(serde::Serialize, serde::Deserialize),
46740    serde(rename_all = "snake_case")
46741)]
46742#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
46743pub enum TypeVariant {
46744    Value,
46745    ScpBallot,
46746    ScpStatementType,
46747    ScpNomination,
46748    ScpStatement,
46749    ScpStatementPledges,
46750    ScpStatementPrepare,
46751    ScpStatementConfirm,
46752    ScpStatementExternalize,
46753    ScpEnvelope,
46754    ScpQuorumSet,
46755    ConfigSettingContractExecutionLanesV0,
46756    ConfigSettingContractComputeV0,
46757    ConfigSettingContractParallelComputeV0,
46758    ConfigSettingContractLedgerCostV0,
46759    ConfigSettingContractHistoricalDataV0,
46760    ConfigSettingContractEventsV0,
46761    ConfigSettingContractBandwidthV0,
46762    ContractCostType,
46763    ContractCostParamEntry,
46764    StateArchivalSettings,
46765    EvictionIterator,
46766    ContractCostParams,
46767    ConfigSettingId,
46768    ConfigSettingEntry,
46769    ScEnvMetaKind,
46770    ScEnvMetaEntry,
46771    ScEnvMetaEntryInterfaceVersion,
46772    ScMetaV0,
46773    ScMetaKind,
46774    ScMetaEntry,
46775    ScSpecType,
46776    ScSpecTypeOption,
46777    ScSpecTypeResult,
46778    ScSpecTypeVec,
46779    ScSpecTypeMap,
46780    ScSpecTypeTuple,
46781    ScSpecTypeBytesN,
46782    ScSpecTypeUdt,
46783    ScSpecTypeDef,
46784    ScSpecUdtStructFieldV0,
46785    ScSpecUdtStructV0,
46786    ScSpecUdtUnionCaseVoidV0,
46787    ScSpecUdtUnionCaseTupleV0,
46788    ScSpecUdtUnionCaseV0Kind,
46789    ScSpecUdtUnionCaseV0,
46790    ScSpecUdtUnionV0,
46791    ScSpecUdtEnumCaseV0,
46792    ScSpecUdtEnumV0,
46793    ScSpecUdtErrorEnumCaseV0,
46794    ScSpecUdtErrorEnumV0,
46795    ScSpecFunctionInputV0,
46796    ScSpecFunctionV0,
46797    ScSpecEntryKind,
46798    ScSpecEntry,
46799    ScValType,
46800    ScErrorType,
46801    ScErrorCode,
46802    ScError,
46803    UInt128Parts,
46804    Int128Parts,
46805    UInt256Parts,
46806    Int256Parts,
46807    ContractExecutableType,
46808    ContractExecutable,
46809    ScAddressType,
46810    ScAddress,
46811    ScVec,
46812    ScMap,
46813    ScBytes,
46814    ScString,
46815    ScSymbol,
46816    ScNonceKey,
46817    ScContractInstance,
46818    ScVal,
46819    ScMapEntry,
46820    StoredTransactionSet,
46821    StoredDebugTransactionSet,
46822    PersistedScpStateV0,
46823    PersistedScpStateV1,
46824    PersistedScpState,
46825    Thresholds,
46826    String32,
46827    String64,
46828    SequenceNumber,
46829    DataValue,
46830    PoolId,
46831    AssetCode4,
46832    AssetCode12,
46833    AssetType,
46834    AssetCode,
46835    AlphaNum4,
46836    AlphaNum12,
46837    Asset,
46838    Price,
46839    Liabilities,
46840    ThresholdIndexes,
46841    LedgerEntryType,
46842    Signer,
46843    AccountFlags,
46844    SponsorshipDescriptor,
46845    AccountEntryExtensionV3,
46846    AccountEntryExtensionV2,
46847    AccountEntryExtensionV2Ext,
46848    AccountEntryExtensionV1,
46849    AccountEntryExtensionV1Ext,
46850    AccountEntry,
46851    AccountEntryExt,
46852    TrustLineFlags,
46853    LiquidityPoolType,
46854    TrustLineAsset,
46855    TrustLineEntryExtensionV2,
46856    TrustLineEntryExtensionV2Ext,
46857    TrustLineEntry,
46858    TrustLineEntryExt,
46859    TrustLineEntryV1,
46860    TrustLineEntryV1Ext,
46861    OfferEntryFlags,
46862    OfferEntry,
46863    OfferEntryExt,
46864    DataEntry,
46865    DataEntryExt,
46866    ClaimPredicateType,
46867    ClaimPredicate,
46868    ClaimantType,
46869    Claimant,
46870    ClaimantV0,
46871    ClaimableBalanceIdType,
46872    ClaimableBalanceId,
46873    ClaimableBalanceFlags,
46874    ClaimableBalanceEntryExtensionV1,
46875    ClaimableBalanceEntryExtensionV1Ext,
46876    ClaimableBalanceEntry,
46877    ClaimableBalanceEntryExt,
46878    LiquidityPoolConstantProductParameters,
46879    LiquidityPoolEntry,
46880    LiquidityPoolEntryBody,
46881    LiquidityPoolEntryConstantProduct,
46882    ContractDataDurability,
46883    ContractDataEntry,
46884    ContractCodeCostInputs,
46885    ContractCodeEntry,
46886    ContractCodeEntryExt,
46887    ContractCodeEntryV1,
46888    TtlEntry,
46889    LedgerEntryExtensionV1,
46890    LedgerEntryExtensionV1Ext,
46891    LedgerEntry,
46892    LedgerEntryData,
46893    LedgerEntryExt,
46894    LedgerKey,
46895    LedgerKeyAccount,
46896    LedgerKeyTrustLine,
46897    LedgerKeyOffer,
46898    LedgerKeyData,
46899    LedgerKeyClaimableBalance,
46900    LedgerKeyLiquidityPool,
46901    LedgerKeyContractData,
46902    LedgerKeyContractCode,
46903    LedgerKeyConfigSetting,
46904    LedgerKeyTtl,
46905    EnvelopeType,
46906    BucketListType,
46907    BucketEntryType,
46908    HotArchiveBucketEntryType,
46909    ColdArchiveBucketEntryType,
46910    BucketMetadata,
46911    BucketMetadataExt,
46912    BucketEntry,
46913    HotArchiveBucketEntry,
46914    ColdArchiveArchivedLeaf,
46915    ColdArchiveDeletedLeaf,
46916    ColdArchiveBoundaryLeaf,
46917    ColdArchiveHashEntry,
46918    ColdArchiveBucketEntry,
46919    UpgradeType,
46920    StellarValueType,
46921    LedgerCloseValueSignature,
46922    StellarValue,
46923    StellarValueExt,
46924    LedgerHeaderFlags,
46925    LedgerHeaderExtensionV1,
46926    LedgerHeaderExtensionV1Ext,
46927    LedgerHeader,
46928    LedgerHeaderExt,
46929    LedgerUpgradeType,
46930    ConfigUpgradeSetKey,
46931    LedgerUpgrade,
46932    ConfigUpgradeSet,
46933    TxSetComponentType,
46934    TxExecutionThread,
46935    ParallelTxExecutionStage,
46936    ParallelTxsComponent,
46937    TxSetComponent,
46938    TxSetComponentTxsMaybeDiscountedFee,
46939    TransactionPhase,
46940    TransactionSet,
46941    TransactionSetV1,
46942    GeneralizedTransactionSet,
46943    TransactionResultPair,
46944    TransactionResultSet,
46945    TransactionHistoryEntry,
46946    TransactionHistoryEntryExt,
46947    TransactionHistoryResultEntry,
46948    TransactionHistoryResultEntryExt,
46949    LedgerHeaderHistoryEntry,
46950    LedgerHeaderHistoryEntryExt,
46951    LedgerScpMessages,
46952    ScpHistoryEntryV0,
46953    ScpHistoryEntry,
46954    LedgerEntryChangeType,
46955    LedgerEntryChange,
46956    LedgerEntryChanges,
46957    OperationMeta,
46958    TransactionMetaV1,
46959    TransactionMetaV2,
46960    ContractEventType,
46961    ContractEvent,
46962    ContractEventBody,
46963    ContractEventV0,
46964    DiagnosticEvent,
46965    SorobanTransactionMetaExtV1,
46966    SorobanTransactionMetaExt,
46967    SorobanTransactionMeta,
46968    TransactionMetaV3,
46969    InvokeHostFunctionSuccessPreImage,
46970    TransactionMeta,
46971    TransactionResultMeta,
46972    UpgradeEntryMeta,
46973    LedgerCloseMetaV0,
46974    LedgerCloseMetaExtV1,
46975    LedgerCloseMetaExtV2,
46976    LedgerCloseMetaExt,
46977    LedgerCloseMetaV1,
46978    LedgerCloseMeta,
46979    ErrorCode,
46980    SError,
46981    SendMore,
46982    SendMoreExtended,
46983    AuthCert,
46984    Hello,
46985    Auth,
46986    IpAddrType,
46987    PeerAddress,
46988    PeerAddressIp,
46989    MessageType,
46990    DontHave,
46991    SurveyMessageCommandType,
46992    SurveyMessageResponseType,
46993    TimeSlicedSurveyStartCollectingMessage,
46994    SignedTimeSlicedSurveyStartCollectingMessage,
46995    TimeSlicedSurveyStopCollectingMessage,
46996    SignedTimeSlicedSurveyStopCollectingMessage,
46997    SurveyRequestMessage,
46998    TimeSlicedSurveyRequestMessage,
46999    SignedSurveyRequestMessage,
47000    SignedTimeSlicedSurveyRequestMessage,
47001    EncryptedBody,
47002    SurveyResponseMessage,
47003    TimeSlicedSurveyResponseMessage,
47004    SignedSurveyResponseMessage,
47005    SignedTimeSlicedSurveyResponseMessage,
47006    PeerStats,
47007    PeerStatList,
47008    TimeSlicedNodeData,
47009    TimeSlicedPeerData,
47010    TimeSlicedPeerDataList,
47011    TopologyResponseBodyV0,
47012    TopologyResponseBodyV1,
47013    TopologyResponseBodyV2,
47014    SurveyResponseBody,
47015    TxAdvertVector,
47016    FloodAdvert,
47017    TxDemandVector,
47018    FloodDemand,
47019    StellarMessage,
47020    AuthenticatedMessage,
47021    AuthenticatedMessageV0,
47022    LiquidityPoolParameters,
47023    MuxedAccount,
47024    MuxedAccountMed25519,
47025    DecoratedSignature,
47026    OperationType,
47027    CreateAccountOp,
47028    PaymentOp,
47029    PathPaymentStrictReceiveOp,
47030    PathPaymentStrictSendOp,
47031    ManageSellOfferOp,
47032    ManageBuyOfferOp,
47033    CreatePassiveSellOfferOp,
47034    SetOptionsOp,
47035    ChangeTrustAsset,
47036    ChangeTrustOp,
47037    AllowTrustOp,
47038    ManageDataOp,
47039    BumpSequenceOp,
47040    CreateClaimableBalanceOp,
47041    ClaimClaimableBalanceOp,
47042    BeginSponsoringFutureReservesOp,
47043    RevokeSponsorshipType,
47044    RevokeSponsorshipOp,
47045    RevokeSponsorshipOpSigner,
47046    ClawbackOp,
47047    ClawbackClaimableBalanceOp,
47048    SetTrustLineFlagsOp,
47049    LiquidityPoolDepositOp,
47050    LiquidityPoolWithdrawOp,
47051    HostFunctionType,
47052    ContractIdPreimageType,
47053    ContractIdPreimage,
47054    ContractIdPreimageFromAddress,
47055    CreateContractArgs,
47056    CreateContractArgsV2,
47057    InvokeContractArgs,
47058    HostFunction,
47059    SorobanAuthorizedFunctionType,
47060    SorobanAuthorizedFunction,
47061    SorobanAuthorizedInvocation,
47062    SorobanAddressCredentials,
47063    SorobanCredentialsType,
47064    SorobanCredentials,
47065    SorobanAuthorizationEntry,
47066    InvokeHostFunctionOp,
47067    ExtendFootprintTtlOp,
47068    RestoreFootprintOp,
47069    Operation,
47070    OperationBody,
47071    HashIdPreimage,
47072    HashIdPreimageOperationId,
47073    HashIdPreimageRevokeId,
47074    HashIdPreimageContractId,
47075    HashIdPreimageSorobanAuthorization,
47076    MemoType,
47077    Memo,
47078    TimeBounds,
47079    LedgerBounds,
47080    PreconditionsV2,
47081    PreconditionType,
47082    Preconditions,
47083    LedgerFootprint,
47084    ArchivalProofType,
47085    ArchivalProofNode,
47086    ProofLevel,
47087    ExistenceProofBody,
47088    NonexistenceProofBody,
47089    ArchivalProof,
47090    ArchivalProofBody,
47091    SorobanResources,
47092    SorobanTransactionData,
47093    SorobanTransactionDataExt,
47094    TransactionV0,
47095    TransactionV0Ext,
47096    TransactionV0Envelope,
47097    Transaction,
47098    TransactionExt,
47099    TransactionV1Envelope,
47100    FeeBumpTransaction,
47101    FeeBumpTransactionInnerTx,
47102    FeeBumpTransactionExt,
47103    FeeBumpTransactionEnvelope,
47104    TransactionEnvelope,
47105    TransactionSignaturePayload,
47106    TransactionSignaturePayloadTaggedTransaction,
47107    ClaimAtomType,
47108    ClaimOfferAtomV0,
47109    ClaimOfferAtom,
47110    ClaimLiquidityAtom,
47111    ClaimAtom,
47112    CreateAccountResultCode,
47113    CreateAccountResult,
47114    PaymentResultCode,
47115    PaymentResult,
47116    PathPaymentStrictReceiveResultCode,
47117    SimplePaymentResult,
47118    PathPaymentStrictReceiveResult,
47119    PathPaymentStrictReceiveResultSuccess,
47120    PathPaymentStrictSendResultCode,
47121    PathPaymentStrictSendResult,
47122    PathPaymentStrictSendResultSuccess,
47123    ManageSellOfferResultCode,
47124    ManageOfferEffect,
47125    ManageOfferSuccessResult,
47126    ManageOfferSuccessResultOffer,
47127    ManageSellOfferResult,
47128    ManageBuyOfferResultCode,
47129    ManageBuyOfferResult,
47130    SetOptionsResultCode,
47131    SetOptionsResult,
47132    ChangeTrustResultCode,
47133    ChangeTrustResult,
47134    AllowTrustResultCode,
47135    AllowTrustResult,
47136    AccountMergeResultCode,
47137    AccountMergeResult,
47138    InflationResultCode,
47139    InflationPayout,
47140    InflationResult,
47141    ManageDataResultCode,
47142    ManageDataResult,
47143    BumpSequenceResultCode,
47144    BumpSequenceResult,
47145    CreateClaimableBalanceResultCode,
47146    CreateClaimableBalanceResult,
47147    ClaimClaimableBalanceResultCode,
47148    ClaimClaimableBalanceResult,
47149    BeginSponsoringFutureReservesResultCode,
47150    BeginSponsoringFutureReservesResult,
47151    EndSponsoringFutureReservesResultCode,
47152    EndSponsoringFutureReservesResult,
47153    RevokeSponsorshipResultCode,
47154    RevokeSponsorshipResult,
47155    ClawbackResultCode,
47156    ClawbackResult,
47157    ClawbackClaimableBalanceResultCode,
47158    ClawbackClaimableBalanceResult,
47159    SetTrustLineFlagsResultCode,
47160    SetTrustLineFlagsResult,
47161    LiquidityPoolDepositResultCode,
47162    LiquidityPoolDepositResult,
47163    LiquidityPoolWithdrawResultCode,
47164    LiquidityPoolWithdrawResult,
47165    InvokeHostFunctionResultCode,
47166    InvokeHostFunctionResult,
47167    ExtendFootprintTtlResultCode,
47168    ExtendFootprintTtlResult,
47169    RestoreFootprintResultCode,
47170    RestoreFootprintResult,
47171    OperationResultCode,
47172    OperationResult,
47173    OperationResultTr,
47174    TransactionResultCode,
47175    InnerTransactionResult,
47176    InnerTransactionResultResult,
47177    InnerTransactionResultExt,
47178    InnerTransactionResultPair,
47179    TransactionResult,
47180    TransactionResultResult,
47181    TransactionResultExt,
47182    Hash,
47183    Uint256,
47184    Uint32,
47185    Int32,
47186    Uint64,
47187    Int64,
47188    TimePoint,
47189    Duration,
47190    ExtensionPoint,
47191    CryptoKeyType,
47192    PublicKeyType,
47193    SignerKeyType,
47194    PublicKey,
47195    SignerKey,
47196    SignerKeyEd25519SignedPayload,
47197    Signature,
47198    SignatureHint,
47199    NodeId,
47200    AccountId,
47201    Curve25519Secret,
47202    Curve25519Public,
47203    HmacSha256Key,
47204    HmacSha256Mac,
47205    ShortHashSeed,
47206    BinaryFuseFilterType,
47207    SerializedBinaryFuseFilter,
47208}
47209
47210impl TypeVariant {
47211    pub const VARIANTS: [TypeVariant; 464] = [
47212        TypeVariant::Value,
47213        TypeVariant::ScpBallot,
47214        TypeVariant::ScpStatementType,
47215        TypeVariant::ScpNomination,
47216        TypeVariant::ScpStatement,
47217        TypeVariant::ScpStatementPledges,
47218        TypeVariant::ScpStatementPrepare,
47219        TypeVariant::ScpStatementConfirm,
47220        TypeVariant::ScpStatementExternalize,
47221        TypeVariant::ScpEnvelope,
47222        TypeVariant::ScpQuorumSet,
47223        TypeVariant::ConfigSettingContractExecutionLanesV0,
47224        TypeVariant::ConfigSettingContractComputeV0,
47225        TypeVariant::ConfigSettingContractParallelComputeV0,
47226        TypeVariant::ConfigSettingContractLedgerCostV0,
47227        TypeVariant::ConfigSettingContractHistoricalDataV0,
47228        TypeVariant::ConfigSettingContractEventsV0,
47229        TypeVariant::ConfigSettingContractBandwidthV0,
47230        TypeVariant::ContractCostType,
47231        TypeVariant::ContractCostParamEntry,
47232        TypeVariant::StateArchivalSettings,
47233        TypeVariant::EvictionIterator,
47234        TypeVariant::ContractCostParams,
47235        TypeVariant::ConfigSettingId,
47236        TypeVariant::ConfigSettingEntry,
47237        TypeVariant::ScEnvMetaKind,
47238        TypeVariant::ScEnvMetaEntry,
47239        TypeVariant::ScEnvMetaEntryInterfaceVersion,
47240        TypeVariant::ScMetaV0,
47241        TypeVariant::ScMetaKind,
47242        TypeVariant::ScMetaEntry,
47243        TypeVariant::ScSpecType,
47244        TypeVariant::ScSpecTypeOption,
47245        TypeVariant::ScSpecTypeResult,
47246        TypeVariant::ScSpecTypeVec,
47247        TypeVariant::ScSpecTypeMap,
47248        TypeVariant::ScSpecTypeTuple,
47249        TypeVariant::ScSpecTypeBytesN,
47250        TypeVariant::ScSpecTypeUdt,
47251        TypeVariant::ScSpecTypeDef,
47252        TypeVariant::ScSpecUdtStructFieldV0,
47253        TypeVariant::ScSpecUdtStructV0,
47254        TypeVariant::ScSpecUdtUnionCaseVoidV0,
47255        TypeVariant::ScSpecUdtUnionCaseTupleV0,
47256        TypeVariant::ScSpecUdtUnionCaseV0Kind,
47257        TypeVariant::ScSpecUdtUnionCaseV0,
47258        TypeVariant::ScSpecUdtUnionV0,
47259        TypeVariant::ScSpecUdtEnumCaseV0,
47260        TypeVariant::ScSpecUdtEnumV0,
47261        TypeVariant::ScSpecUdtErrorEnumCaseV0,
47262        TypeVariant::ScSpecUdtErrorEnumV0,
47263        TypeVariant::ScSpecFunctionInputV0,
47264        TypeVariant::ScSpecFunctionV0,
47265        TypeVariant::ScSpecEntryKind,
47266        TypeVariant::ScSpecEntry,
47267        TypeVariant::ScValType,
47268        TypeVariant::ScErrorType,
47269        TypeVariant::ScErrorCode,
47270        TypeVariant::ScError,
47271        TypeVariant::UInt128Parts,
47272        TypeVariant::Int128Parts,
47273        TypeVariant::UInt256Parts,
47274        TypeVariant::Int256Parts,
47275        TypeVariant::ContractExecutableType,
47276        TypeVariant::ContractExecutable,
47277        TypeVariant::ScAddressType,
47278        TypeVariant::ScAddress,
47279        TypeVariant::ScVec,
47280        TypeVariant::ScMap,
47281        TypeVariant::ScBytes,
47282        TypeVariant::ScString,
47283        TypeVariant::ScSymbol,
47284        TypeVariant::ScNonceKey,
47285        TypeVariant::ScContractInstance,
47286        TypeVariant::ScVal,
47287        TypeVariant::ScMapEntry,
47288        TypeVariant::StoredTransactionSet,
47289        TypeVariant::StoredDebugTransactionSet,
47290        TypeVariant::PersistedScpStateV0,
47291        TypeVariant::PersistedScpStateV1,
47292        TypeVariant::PersistedScpState,
47293        TypeVariant::Thresholds,
47294        TypeVariant::String32,
47295        TypeVariant::String64,
47296        TypeVariant::SequenceNumber,
47297        TypeVariant::DataValue,
47298        TypeVariant::PoolId,
47299        TypeVariant::AssetCode4,
47300        TypeVariant::AssetCode12,
47301        TypeVariant::AssetType,
47302        TypeVariant::AssetCode,
47303        TypeVariant::AlphaNum4,
47304        TypeVariant::AlphaNum12,
47305        TypeVariant::Asset,
47306        TypeVariant::Price,
47307        TypeVariant::Liabilities,
47308        TypeVariant::ThresholdIndexes,
47309        TypeVariant::LedgerEntryType,
47310        TypeVariant::Signer,
47311        TypeVariant::AccountFlags,
47312        TypeVariant::SponsorshipDescriptor,
47313        TypeVariant::AccountEntryExtensionV3,
47314        TypeVariant::AccountEntryExtensionV2,
47315        TypeVariant::AccountEntryExtensionV2Ext,
47316        TypeVariant::AccountEntryExtensionV1,
47317        TypeVariant::AccountEntryExtensionV1Ext,
47318        TypeVariant::AccountEntry,
47319        TypeVariant::AccountEntryExt,
47320        TypeVariant::TrustLineFlags,
47321        TypeVariant::LiquidityPoolType,
47322        TypeVariant::TrustLineAsset,
47323        TypeVariant::TrustLineEntryExtensionV2,
47324        TypeVariant::TrustLineEntryExtensionV2Ext,
47325        TypeVariant::TrustLineEntry,
47326        TypeVariant::TrustLineEntryExt,
47327        TypeVariant::TrustLineEntryV1,
47328        TypeVariant::TrustLineEntryV1Ext,
47329        TypeVariant::OfferEntryFlags,
47330        TypeVariant::OfferEntry,
47331        TypeVariant::OfferEntryExt,
47332        TypeVariant::DataEntry,
47333        TypeVariant::DataEntryExt,
47334        TypeVariant::ClaimPredicateType,
47335        TypeVariant::ClaimPredicate,
47336        TypeVariant::ClaimantType,
47337        TypeVariant::Claimant,
47338        TypeVariant::ClaimantV0,
47339        TypeVariant::ClaimableBalanceIdType,
47340        TypeVariant::ClaimableBalanceId,
47341        TypeVariant::ClaimableBalanceFlags,
47342        TypeVariant::ClaimableBalanceEntryExtensionV1,
47343        TypeVariant::ClaimableBalanceEntryExtensionV1Ext,
47344        TypeVariant::ClaimableBalanceEntry,
47345        TypeVariant::ClaimableBalanceEntryExt,
47346        TypeVariant::LiquidityPoolConstantProductParameters,
47347        TypeVariant::LiquidityPoolEntry,
47348        TypeVariant::LiquidityPoolEntryBody,
47349        TypeVariant::LiquidityPoolEntryConstantProduct,
47350        TypeVariant::ContractDataDurability,
47351        TypeVariant::ContractDataEntry,
47352        TypeVariant::ContractCodeCostInputs,
47353        TypeVariant::ContractCodeEntry,
47354        TypeVariant::ContractCodeEntryExt,
47355        TypeVariant::ContractCodeEntryV1,
47356        TypeVariant::TtlEntry,
47357        TypeVariant::LedgerEntryExtensionV1,
47358        TypeVariant::LedgerEntryExtensionV1Ext,
47359        TypeVariant::LedgerEntry,
47360        TypeVariant::LedgerEntryData,
47361        TypeVariant::LedgerEntryExt,
47362        TypeVariant::LedgerKey,
47363        TypeVariant::LedgerKeyAccount,
47364        TypeVariant::LedgerKeyTrustLine,
47365        TypeVariant::LedgerKeyOffer,
47366        TypeVariant::LedgerKeyData,
47367        TypeVariant::LedgerKeyClaimableBalance,
47368        TypeVariant::LedgerKeyLiquidityPool,
47369        TypeVariant::LedgerKeyContractData,
47370        TypeVariant::LedgerKeyContractCode,
47371        TypeVariant::LedgerKeyConfigSetting,
47372        TypeVariant::LedgerKeyTtl,
47373        TypeVariant::EnvelopeType,
47374        TypeVariant::BucketListType,
47375        TypeVariant::BucketEntryType,
47376        TypeVariant::HotArchiveBucketEntryType,
47377        TypeVariant::ColdArchiveBucketEntryType,
47378        TypeVariant::BucketMetadata,
47379        TypeVariant::BucketMetadataExt,
47380        TypeVariant::BucketEntry,
47381        TypeVariant::HotArchiveBucketEntry,
47382        TypeVariant::ColdArchiveArchivedLeaf,
47383        TypeVariant::ColdArchiveDeletedLeaf,
47384        TypeVariant::ColdArchiveBoundaryLeaf,
47385        TypeVariant::ColdArchiveHashEntry,
47386        TypeVariant::ColdArchiveBucketEntry,
47387        TypeVariant::UpgradeType,
47388        TypeVariant::StellarValueType,
47389        TypeVariant::LedgerCloseValueSignature,
47390        TypeVariant::StellarValue,
47391        TypeVariant::StellarValueExt,
47392        TypeVariant::LedgerHeaderFlags,
47393        TypeVariant::LedgerHeaderExtensionV1,
47394        TypeVariant::LedgerHeaderExtensionV1Ext,
47395        TypeVariant::LedgerHeader,
47396        TypeVariant::LedgerHeaderExt,
47397        TypeVariant::LedgerUpgradeType,
47398        TypeVariant::ConfigUpgradeSetKey,
47399        TypeVariant::LedgerUpgrade,
47400        TypeVariant::ConfigUpgradeSet,
47401        TypeVariant::TxSetComponentType,
47402        TypeVariant::TxExecutionThread,
47403        TypeVariant::ParallelTxExecutionStage,
47404        TypeVariant::ParallelTxsComponent,
47405        TypeVariant::TxSetComponent,
47406        TypeVariant::TxSetComponentTxsMaybeDiscountedFee,
47407        TypeVariant::TransactionPhase,
47408        TypeVariant::TransactionSet,
47409        TypeVariant::TransactionSetV1,
47410        TypeVariant::GeneralizedTransactionSet,
47411        TypeVariant::TransactionResultPair,
47412        TypeVariant::TransactionResultSet,
47413        TypeVariant::TransactionHistoryEntry,
47414        TypeVariant::TransactionHistoryEntryExt,
47415        TypeVariant::TransactionHistoryResultEntry,
47416        TypeVariant::TransactionHistoryResultEntryExt,
47417        TypeVariant::LedgerHeaderHistoryEntry,
47418        TypeVariant::LedgerHeaderHistoryEntryExt,
47419        TypeVariant::LedgerScpMessages,
47420        TypeVariant::ScpHistoryEntryV0,
47421        TypeVariant::ScpHistoryEntry,
47422        TypeVariant::LedgerEntryChangeType,
47423        TypeVariant::LedgerEntryChange,
47424        TypeVariant::LedgerEntryChanges,
47425        TypeVariant::OperationMeta,
47426        TypeVariant::TransactionMetaV1,
47427        TypeVariant::TransactionMetaV2,
47428        TypeVariant::ContractEventType,
47429        TypeVariant::ContractEvent,
47430        TypeVariant::ContractEventBody,
47431        TypeVariant::ContractEventV0,
47432        TypeVariant::DiagnosticEvent,
47433        TypeVariant::SorobanTransactionMetaExtV1,
47434        TypeVariant::SorobanTransactionMetaExt,
47435        TypeVariant::SorobanTransactionMeta,
47436        TypeVariant::TransactionMetaV3,
47437        TypeVariant::InvokeHostFunctionSuccessPreImage,
47438        TypeVariant::TransactionMeta,
47439        TypeVariant::TransactionResultMeta,
47440        TypeVariant::UpgradeEntryMeta,
47441        TypeVariant::LedgerCloseMetaV0,
47442        TypeVariant::LedgerCloseMetaExtV1,
47443        TypeVariant::LedgerCloseMetaExtV2,
47444        TypeVariant::LedgerCloseMetaExt,
47445        TypeVariant::LedgerCloseMetaV1,
47446        TypeVariant::LedgerCloseMeta,
47447        TypeVariant::ErrorCode,
47448        TypeVariant::SError,
47449        TypeVariant::SendMore,
47450        TypeVariant::SendMoreExtended,
47451        TypeVariant::AuthCert,
47452        TypeVariant::Hello,
47453        TypeVariant::Auth,
47454        TypeVariant::IpAddrType,
47455        TypeVariant::PeerAddress,
47456        TypeVariant::PeerAddressIp,
47457        TypeVariant::MessageType,
47458        TypeVariant::DontHave,
47459        TypeVariant::SurveyMessageCommandType,
47460        TypeVariant::SurveyMessageResponseType,
47461        TypeVariant::TimeSlicedSurveyStartCollectingMessage,
47462        TypeVariant::SignedTimeSlicedSurveyStartCollectingMessage,
47463        TypeVariant::TimeSlicedSurveyStopCollectingMessage,
47464        TypeVariant::SignedTimeSlicedSurveyStopCollectingMessage,
47465        TypeVariant::SurveyRequestMessage,
47466        TypeVariant::TimeSlicedSurveyRequestMessage,
47467        TypeVariant::SignedSurveyRequestMessage,
47468        TypeVariant::SignedTimeSlicedSurveyRequestMessage,
47469        TypeVariant::EncryptedBody,
47470        TypeVariant::SurveyResponseMessage,
47471        TypeVariant::TimeSlicedSurveyResponseMessage,
47472        TypeVariant::SignedSurveyResponseMessage,
47473        TypeVariant::SignedTimeSlicedSurveyResponseMessage,
47474        TypeVariant::PeerStats,
47475        TypeVariant::PeerStatList,
47476        TypeVariant::TimeSlicedNodeData,
47477        TypeVariant::TimeSlicedPeerData,
47478        TypeVariant::TimeSlicedPeerDataList,
47479        TypeVariant::TopologyResponseBodyV0,
47480        TypeVariant::TopologyResponseBodyV1,
47481        TypeVariant::TopologyResponseBodyV2,
47482        TypeVariant::SurveyResponseBody,
47483        TypeVariant::TxAdvertVector,
47484        TypeVariant::FloodAdvert,
47485        TypeVariant::TxDemandVector,
47486        TypeVariant::FloodDemand,
47487        TypeVariant::StellarMessage,
47488        TypeVariant::AuthenticatedMessage,
47489        TypeVariant::AuthenticatedMessageV0,
47490        TypeVariant::LiquidityPoolParameters,
47491        TypeVariant::MuxedAccount,
47492        TypeVariant::MuxedAccountMed25519,
47493        TypeVariant::DecoratedSignature,
47494        TypeVariant::OperationType,
47495        TypeVariant::CreateAccountOp,
47496        TypeVariant::PaymentOp,
47497        TypeVariant::PathPaymentStrictReceiveOp,
47498        TypeVariant::PathPaymentStrictSendOp,
47499        TypeVariant::ManageSellOfferOp,
47500        TypeVariant::ManageBuyOfferOp,
47501        TypeVariant::CreatePassiveSellOfferOp,
47502        TypeVariant::SetOptionsOp,
47503        TypeVariant::ChangeTrustAsset,
47504        TypeVariant::ChangeTrustOp,
47505        TypeVariant::AllowTrustOp,
47506        TypeVariant::ManageDataOp,
47507        TypeVariant::BumpSequenceOp,
47508        TypeVariant::CreateClaimableBalanceOp,
47509        TypeVariant::ClaimClaimableBalanceOp,
47510        TypeVariant::BeginSponsoringFutureReservesOp,
47511        TypeVariant::RevokeSponsorshipType,
47512        TypeVariant::RevokeSponsorshipOp,
47513        TypeVariant::RevokeSponsorshipOpSigner,
47514        TypeVariant::ClawbackOp,
47515        TypeVariant::ClawbackClaimableBalanceOp,
47516        TypeVariant::SetTrustLineFlagsOp,
47517        TypeVariant::LiquidityPoolDepositOp,
47518        TypeVariant::LiquidityPoolWithdrawOp,
47519        TypeVariant::HostFunctionType,
47520        TypeVariant::ContractIdPreimageType,
47521        TypeVariant::ContractIdPreimage,
47522        TypeVariant::ContractIdPreimageFromAddress,
47523        TypeVariant::CreateContractArgs,
47524        TypeVariant::CreateContractArgsV2,
47525        TypeVariant::InvokeContractArgs,
47526        TypeVariant::HostFunction,
47527        TypeVariant::SorobanAuthorizedFunctionType,
47528        TypeVariant::SorobanAuthorizedFunction,
47529        TypeVariant::SorobanAuthorizedInvocation,
47530        TypeVariant::SorobanAddressCredentials,
47531        TypeVariant::SorobanCredentialsType,
47532        TypeVariant::SorobanCredentials,
47533        TypeVariant::SorobanAuthorizationEntry,
47534        TypeVariant::InvokeHostFunctionOp,
47535        TypeVariant::ExtendFootprintTtlOp,
47536        TypeVariant::RestoreFootprintOp,
47537        TypeVariant::Operation,
47538        TypeVariant::OperationBody,
47539        TypeVariant::HashIdPreimage,
47540        TypeVariant::HashIdPreimageOperationId,
47541        TypeVariant::HashIdPreimageRevokeId,
47542        TypeVariant::HashIdPreimageContractId,
47543        TypeVariant::HashIdPreimageSorobanAuthorization,
47544        TypeVariant::MemoType,
47545        TypeVariant::Memo,
47546        TypeVariant::TimeBounds,
47547        TypeVariant::LedgerBounds,
47548        TypeVariant::PreconditionsV2,
47549        TypeVariant::PreconditionType,
47550        TypeVariant::Preconditions,
47551        TypeVariant::LedgerFootprint,
47552        TypeVariant::ArchivalProofType,
47553        TypeVariant::ArchivalProofNode,
47554        TypeVariant::ProofLevel,
47555        TypeVariant::ExistenceProofBody,
47556        TypeVariant::NonexistenceProofBody,
47557        TypeVariant::ArchivalProof,
47558        TypeVariant::ArchivalProofBody,
47559        TypeVariant::SorobanResources,
47560        TypeVariant::SorobanTransactionData,
47561        TypeVariant::SorobanTransactionDataExt,
47562        TypeVariant::TransactionV0,
47563        TypeVariant::TransactionV0Ext,
47564        TypeVariant::TransactionV0Envelope,
47565        TypeVariant::Transaction,
47566        TypeVariant::TransactionExt,
47567        TypeVariant::TransactionV1Envelope,
47568        TypeVariant::FeeBumpTransaction,
47569        TypeVariant::FeeBumpTransactionInnerTx,
47570        TypeVariant::FeeBumpTransactionExt,
47571        TypeVariant::FeeBumpTransactionEnvelope,
47572        TypeVariant::TransactionEnvelope,
47573        TypeVariant::TransactionSignaturePayload,
47574        TypeVariant::TransactionSignaturePayloadTaggedTransaction,
47575        TypeVariant::ClaimAtomType,
47576        TypeVariant::ClaimOfferAtomV0,
47577        TypeVariant::ClaimOfferAtom,
47578        TypeVariant::ClaimLiquidityAtom,
47579        TypeVariant::ClaimAtom,
47580        TypeVariant::CreateAccountResultCode,
47581        TypeVariant::CreateAccountResult,
47582        TypeVariant::PaymentResultCode,
47583        TypeVariant::PaymentResult,
47584        TypeVariant::PathPaymentStrictReceiveResultCode,
47585        TypeVariant::SimplePaymentResult,
47586        TypeVariant::PathPaymentStrictReceiveResult,
47587        TypeVariant::PathPaymentStrictReceiveResultSuccess,
47588        TypeVariant::PathPaymentStrictSendResultCode,
47589        TypeVariant::PathPaymentStrictSendResult,
47590        TypeVariant::PathPaymentStrictSendResultSuccess,
47591        TypeVariant::ManageSellOfferResultCode,
47592        TypeVariant::ManageOfferEffect,
47593        TypeVariant::ManageOfferSuccessResult,
47594        TypeVariant::ManageOfferSuccessResultOffer,
47595        TypeVariant::ManageSellOfferResult,
47596        TypeVariant::ManageBuyOfferResultCode,
47597        TypeVariant::ManageBuyOfferResult,
47598        TypeVariant::SetOptionsResultCode,
47599        TypeVariant::SetOptionsResult,
47600        TypeVariant::ChangeTrustResultCode,
47601        TypeVariant::ChangeTrustResult,
47602        TypeVariant::AllowTrustResultCode,
47603        TypeVariant::AllowTrustResult,
47604        TypeVariant::AccountMergeResultCode,
47605        TypeVariant::AccountMergeResult,
47606        TypeVariant::InflationResultCode,
47607        TypeVariant::InflationPayout,
47608        TypeVariant::InflationResult,
47609        TypeVariant::ManageDataResultCode,
47610        TypeVariant::ManageDataResult,
47611        TypeVariant::BumpSequenceResultCode,
47612        TypeVariant::BumpSequenceResult,
47613        TypeVariant::CreateClaimableBalanceResultCode,
47614        TypeVariant::CreateClaimableBalanceResult,
47615        TypeVariant::ClaimClaimableBalanceResultCode,
47616        TypeVariant::ClaimClaimableBalanceResult,
47617        TypeVariant::BeginSponsoringFutureReservesResultCode,
47618        TypeVariant::BeginSponsoringFutureReservesResult,
47619        TypeVariant::EndSponsoringFutureReservesResultCode,
47620        TypeVariant::EndSponsoringFutureReservesResult,
47621        TypeVariant::RevokeSponsorshipResultCode,
47622        TypeVariant::RevokeSponsorshipResult,
47623        TypeVariant::ClawbackResultCode,
47624        TypeVariant::ClawbackResult,
47625        TypeVariant::ClawbackClaimableBalanceResultCode,
47626        TypeVariant::ClawbackClaimableBalanceResult,
47627        TypeVariant::SetTrustLineFlagsResultCode,
47628        TypeVariant::SetTrustLineFlagsResult,
47629        TypeVariant::LiquidityPoolDepositResultCode,
47630        TypeVariant::LiquidityPoolDepositResult,
47631        TypeVariant::LiquidityPoolWithdrawResultCode,
47632        TypeVariant::LiquidityPoolWithdrawResult,
47633        TypeVariant::InvokeHostFunctionResultCode,
47634        TypeVariant::InvokeHostFunctionResult,
47635        TypeVariant::ExtendFootprintTtlResultCode,
47636        TypeVariant::ExtendFootprintTtlResult,
47637        TypeVariant::RestoreFootprintResultCode,
47638        TypeVariant::RestoreFootprintResult,
47639        TypeVariant::OperationResultCode,
47640        TypeVariant::OperationResult,
47641        TypeVariant::OperationResultTr,
47642        TypeVariant::TransactionResultCode,
47643        TypeVariant::InnerTransactionResult,
47644        TypeVariant::InnerTransactionResultResult,
47645        TypeVariant::InnerTransactionResultExt,
47646        TypeVariant::InnerTransactionResultPair,
47647        TypeVariant::TransactionResult,
47648        TypeVariant::TransactionResultResult,
47649        TypeVariant::TransactionResultExt,
47650        TypeVariant::Hash,
47651        TypeVariant::Uint256,
47652        TypeVariant::Uint32,
47653        TypeVariant::Int32,
47654        TypeVariant::Uint64,
47655        TypeVariant::Int64,
47656        TypeVariant::TimePoint,
47657        TypeVariant::Duration,
47658        TypeVariant::ExtensionPoint,
47659        TypeVariant::CryptoKeyType,
47660        TypeVariant::PublicKeyType,
47661        TypeVariant::SignerKeyType,
47662        TypeVariant::PublicKey,
47663        TypeVariant::SignerKey,
47664        TypeVariant::SignerKeyEd25519SignedPayload,
47665        TypeVariant::Signature,
47666        TypeVariant::SignatureHint,
47667        TypeVariant::NodeId,
47668        TypeVariant::AccountId,
47669        TypeVariant::Curve25519Secret,
47670        TypeVariant::Curve25519Public,
47671        TypeVariant::HmacSha256Key,
47672        TypeVariant::HmacSha256Mac,
47673        TypeVariant::ShortHashSeed,
47674        TypeVariant::BinaryFuseFilterType,
47675        TypeVariant::SerializedBinaryFuseFilter,
47676    ];
47677    pub const VARIANTS_STR: [&'static str; 464] = [
47678        "Value",
47679        "ScpBallot",
47680        "ScpStatementType",
47681        "ScpNomination",
47682        "ScpStatement",
47683        "ScpStatementPledges",
47684        "ScpStatementPrepare",
47685        "ScpStatementConfirm",
47686        "ScpStatementExternalize",
47687        "ScpEnvelope",
47688        "ScpQuorumSet",
47689        "ConfigSettingContractExecutionLanesV0",
47690        "ConfigSettingContractComputeV0",
47691        "ConfigSettingContractParallelComputeV0",
47692        "ConfigSettingContractLedgerCostV0",
47693        "ConfigSettingContractHistoricalDataV0",
47694        "ConfigSettingContractEventsV0",
47695        "ConfigSettingContractBandwidthV0",
47696        "ContractCostType",
47697        "ContractCostParamEntry",
47698        "StateArchivalSettings",
47699        "EvictionIterator",
47700        "ContractCostParams",
47701        "ConfigSettingId",
47702        "ConfigSettingEntry",
47703        "ScEnvMetaKind",
47704        "ScEnvMetaEntry",
47705        "ScEnvMetaEntryInterfaceVersion",
47706        "ScMetaV0",
47707        "ScMetaKind",
47708        "ScMetaEntry",
47709        "ScSpecType",
47710        "ScSpecTypeOption",
47711        "ScSpecTypeResult",
47712        "ScSpecTypeVec",
47713        "ScSpecTypeMap",
47714        "ScSpecTypeTuple",
47715        "ScSpecTypeBytesN",
47716        "ScSpecTypeUdt",
47717        "ScSpecTypeDef",
47718        "ScSpecUdtStructFieldV0",
47719        "ScSpecUdtStructV0",
47720        "ScSpecUdtUnionCaseVoidV0",
47721        "ScSpecUdtUnionCaseTupleV0",
47722        "ScSpecUdtUnionCaseV0Kind",
47723        "ScSpecUdtUnionCaseV0",
47724        "ScSpecUdtUnionV0",
47725        "ScSpecUdtEnumCaseV0",
47726        "ScSpecUdtEnumV0",
47727        "ScSpecUdtErrorEnumCaseV0",
47728        "ScSpecUdtErrorEnumV0",
47729        "ScSpecFunctionInputV0",
47730        "ScSpecFunctionV0",
47731        "ScSpecEntryKind",
47732        "ScSpecEntry",
47733        "ScValType",
47734        "ScErrorType",
47735        "ScErrorCode",
47736        "ScError",
47737        "UInt128Parts",
47738        "Int128Parts",
47739        "UInt256Parts",
47740        "Int256Parts",
47741        "ContractExecutableType",
47742        "ContractExecutable",
47743        "ScAddressType",
47744        "ScAddress",
47745        "ScVec",
47746        "ScMap",
47747        "ScBytes",
47748        "ScString",
47749        "ScSymbol",
47750        "ScNonceKey",
47751        "ScContractInstance",
47752        "ScVal",
47753        "ScMapEntry",
47754        "StoredTransactionSet",
47755        "StoredDebugTransactionSet",
47756        "PersistedScpStateV0",
47757        "PersistedScpStateV1",
47758        "PersistedScpState",
47759        "Thresholds",
47760        "String32",
47761        "String64",
47762        "SequenceNumber",
47763        "DataValue",
47764        "PoolId",
47765        "AssetCode4",
47766        "AssetCode12",
47767        "AssetType",
47768        "AssetCode",
47769        "AlphaNum4",
47770        "AlphaNum12",
47771        "Asset",
47772        "Price",
47773        "Liabilities",
47774        "ThresholdIndexes",
47775        "LedgerEntryType",
47776        "Signer",
47777        "AccountFlags",
47778        "SponsorshipDescriptor",
47779        "AccountEntryExtensionV3",
47780        "AccountEntryExtensionV2",
47781        "AccountEntryExtensionV2Ext",
47782        "AccountEntryExtensionV1",
47783        "AccountEntryExtensionV1Ext",
47784        "AccountEntry",
47785        "AccountEntryExt",
47786        "TrustLineFlags",
47787        "LiquidityPoolType",
47788        "TrustLineAsset",
47789        "TrustLineEntryExtensionV2",
47790        "TrustLineEntryExtensionV2Ext",
47791        "TrustLineEntry",
47792        "TrustLineEntryExt",
47793        "TrustLineEntryV1",
47794        "TrustLineEntryV1Ext",
47795        "OfferEntryFlags",
47796        "OfferEntry",
47797        "OfferEntryExt",
47798        "DataEntry",
47799        "DataEntryExt",
47800        "ClaimPredicateType",
47801        "ClaimPredicate",
47802        "ClaimantType",
47803        "Claimant",
47804        "ClaimantV0",
47805        "ClaimableBalanceIdType",
47806        "ClaimableBalanceId",
47807        "ClaimableBalanceFlags",
47808        "ClaimableBalanceEntryExtensionV1",
47809        "ClaimableBalanceEntryExtensionV1Ext",
47810        "ClaimableBalanceEntry",
47811        "ClaimableBalanceEntryExt",
47812        "LiquidityPoolConstantProductParameters",
47813        "LiquidityPoolEntry",
47814        "LiquidityPoolEntryBody",
47815        "LiquidityPoolEntryConstantProduct",
47816        "ContractDataDurability",
47817        "ContractDataEntry",
47818        "ContractCodeCostInputs",
47819        "ContractCodeEntry",
47820        "ContractCodeEntryExt",
47821        "ContractCodeEntryV1",
47822        "TtlEntry",
47823        "LedgerEntryExtensionV1",
47824        "LedgerEntryExtensionV1Ext",
47825        "LedgerEntry",
47826        "LedgerEntryData",
47827        "LedgerEntryExt",
47828        "LedgerKey",
47829        "LedgerKeyAccount",
47830        "LedgerKeyTrustLine",
47831        "LedgerKeyOffer",
47832        "LedgerKeyData",
47833        "LedgerKeyClaimableBalance",
47834        "LedgerKeyLiquidityPool",
47835        "LedgerKeyContractData",
47836        "LedgerKeyContractCode",
47837        "LedgerKeyConfigSetting",
47838        "LedgerKeyTtl",
47839        "EnvelopeType",
47840        "BucketListType",
47841        "BucketEntryType",
47842        "HotArchiveBucketEntryType",
47843        "ColdArchiveBucketEntryType",
47844        "BucketMetadata",
47845        "BucketMetadataExt",
47846        "BucketEntry",
47847        "HotArchiveBucketEntry",
47848        "ColdArchiveArchivedLeaf",
47849        "ColdArchiveDeletedLeaf",
47850        "ColdArchiveBoundaryLeaf",
47851        "ColdArchiveHashEntry",
47852        "ColdArchiveBucketEntry",
47853        "UpgradeType",
47854        "StellarValueType",
47855        "LedgerCloseValueSignature",
47856        "StellarValue",
47857        "StellarValueExt",
47858        "LedgerHeaderFlags",
47859        "LedgerHeaderExtensionV1",
47860        "LedgerHeaderExtensionV1Ext",
47861        "LedgerHeader",
47862        "LedgerHeaderExt",
47863        "LedgerUpgradeType",
47864        "ConfigUpgradeSetKey",
47865        "LedgerUpgrade",
47866        "ConfigUpgradeSet",
47867        "TxSetComponentType",
47868        "TxExecutionThread",
47869        "ParallelTxExecutionStage",
47870        "ParallelTxsComponent",
47871        "TxSetComponent",
47872        "TxSetComponentTxsMaybeDiscountedFee",
47873        "TransactionPhase",
47874        "TransactionSet",
47875        "TransactionSetV1",
47876        "GeneralizedTransactionSet",
47877        "TransactionResultPair",
47878        "TransactionResultSet",
47879        "TransactionHistoryEntry",
47880        "TransactionHistoryEntryExt",
47881        "TransactionHistoryResultEntry",
47882        "TransactionHistoryResultEntryExt",
47883        "LedgerHeaderHistoryEntry",
47884        "LedgerHeaderHistoryEntryExt",
47885        "LedgerScpMessages",
47886        "ScpHistoryEntryV0",
47887        "ScpHistoryEntry",
47888        "LedgerEntryChangeType",
47889        "LedgerEntryChange",
47890        "LedgerEntryChanges",
47891        "OperationMeta",
47892        "TransactionMetaV1",
47893        "TransactionMetaV2",
47894        "ContractEventType",
47895        "ContractEvent",
47896        "ContractEventBody",
47897        "ContractEventV0",
47898        "DiagnosticEvent",
47899        "SorobanTransactionMetaExtV1",
47900        "SorobanTransactionMetaExt",
47901        "SorobanTransactionMeta",
47902        "TransactionMetaV3",
47903        "InvokeHostFunctionSuccessPreImage",
47904        "TransactionMeta",
47905        "TransactionResultMeta",
47906        "UpgradeEntryMeta",
47907        "LedgerCloseMetaV0",
47908        "LedgerCloseMetaExtV1",
47909        "LedgerCloseMetaExtV2",
47910        "LedgerCloseMetaExt",
47911        "LedgerCloseMetaV1",
47912        "LedgerCloseMeta",
47913        "ErrorCode",
47914        "SError",
47915        "SendMore",
47916        "SendMoreExtended",
47917        "AuthCert",
47918        "Hello",
47919        "Auth",
47920        "IpAddrType",
47921        "PeerAddress",
47922        "PeerAddressIp",
47923        "MessageType",
47924        "DontHave",
47925        "SurveyMessageCommandType",
47926        "SurveyMessageResponseType",
47927        "TimeSlicedSurveyStartCollectingMessage",
47928        "SignedTimeSlicedSurveyStartCollectingMessage",
47929        "TimeSlicedSurveyStopCollectingMessage",
47930        "SignedTimeSlicedSurveyStopCollectingMessage",
47931        "SurveyRequestMessage",
47932        "TimeSlicedSurveyRequestMessage",
47933        "SignedSurveyRequestMessage",
47934        "SignedTimeSlicedSurveyRequestMessage",
47935        "EncryptedBody",
47936        "SurveyResponseMessage",
47937        "TimeSlicedSurveyResponseMessage",
47938        "SignedSurveyResponseMessage",
47939        "SignedTimeSlicedSurveyResponseMessage",
47940        "PeerStats",
47941        "PeerStatList",
47942        "TimeSlicedNodeData",
47943        "TimeSlicedPeerData",
47944        "TimeSlicedPeerDataList",
47945        "TopologyResponseBodyV0",
47946        "TopologyResponseBodyV1",
47947        "TopologyResponseBodyV2",
47948        "SurveyResponseBody",
47949        "TxAdvertVector",
47950        "FloodAdvert",
47951        "TxDemandVector",
47952        "FloodDemand",
47953        "StellarMessage",
47954        "AuthenticatedMessage",
47955        "AuthenticatedMessageV0",
47956        "LiquidityPoolParameters",
47957        "MuxedAccount",
47958        "MuxedAccountMed25519",
47959        "DecoratedSignature",
47960        "OperationType",
47961        "CreateAccountOp",
47962        "PaymentOp",
47963        "PathPaymentStrictReceiveOp",
47964        "PathPaymentStrictSendOp",
47965        "ManageSellOfferOp",
47966        "ManageBuyOfferOp",
47967        "CreatePassiveSellOfferOp",
47968        "SetOptionsOp",
47969        "ChangeTrustAsset",
47970        "ChangeTrustOp",
47971        "AllowTrustOp",
47972        "ManageDataOp",
47973        "BumpSequenceOp",
47974        "CreateClaimableBalanceOp",
47975        "ClaimClaimableBalanceOp",
47976        "BeginSponsoringFutureReservesOp",
47977        "RevokeSponsorshipType",
47978        "RevokeSponsorshipOp",
47979        "RevokeSponsorshipOpSigner",
47980        "ClawbackOp",
47981        "ClawbackClaimableBalanceOp",
47982        "SetTrustLineFlagsOp",
47983        "LiquidityPoolDepositOp",
47984        "LiquidityPoolWithdrawOp",
47985        "HostFunctionType",
47986        "ContractIdPreimageType",
47987        "ContractIdPreimage",
47988        "ContractIdPreimageFromAddress",
47989        "CreateContractArgs",
47990        "CreateContractArgsV2",
47991        "InvokeContractArgs",
47992        "HostFunction",
47993        "SorobanAuthorizedFunctionType",
47994        "SorobanAuthorizedFunction",
47995        "SorobanAuthorizedInvocation",
47996        "SorobanAddressCredentials",
47997        "SorobanCredentialsType",
47998        "SorobanCredentials",
47999        "SorobanAuthorizationEntry",
48000        "InvokeHostFunctionOp",
48001        "ExtendFootprintTtlOp",
48002        "RestoreFootprintOp",
48003        "Operation",
48004        "OperationBody",
48005        "HashIdPreimage",
48006        "HashIdPreimageOperationId",
48007        "HashIdPreimageRevokeId",
48008        "HashIdPreimageContractId",
48009        "HashIdPreimageSorobanAuthorization",
48010        "MemoType",
48011        "Memo",
48012        "TimeBounds",
48013        "LedgerBounds",
48014        "PreconditionsV2",
48015        "PreconditionType",
48016        "Preconditions",
48017        "LedgerFootprint",
48018        "ArchivalProofType",
48019        "ArchivalProofNode",
48020        "ProofLevel",
48021        "ExistenceProofBody",
48022        "NonexistenceProofBody",
48023        "ArchivalProof",
48024        "ArchivalProofBody",
48025        "SorobanResources",
48026        "SorobanTransactionData",
48027        "SorobanTransactionDataExt",
48028        "TransactionV0",
48029        "TransactionV0Ext",
48030        "TransactionV0Envelope",
48031        "Transaction",
48032        "TransactionExt",
48033        "TransactionV1Envelope",
48034        "FeeBumpTransaction",
48035        "FeeBumpTransactionInnerTx",
48036        "FeeBumpTransactionExt",
48037        "FeeBumpTransactionEnvelope",
48038        "TransactionEnvelope",
48039        "TransactionSignaturePayload",
48040        "TransactionSignaturePayloadTaggedTransaction",
48041        "ClaimAtomType",
48042        "ClaimOfferAtomV0",
48043        "ClaimOfferAtom",
48044        "ClaimLiquidityAtom",
48045        "ClaimAtom",
48046        "CreateAccountResultCode",
48047        "CreateAccountResult",
48048        "PaymentResultCode",
48049        "PaymentResult",
48050        "PathPaymentStrictReceiveResultCode",
48051        "SimplePaymentResult",
48052        "PathPaymentStrictReceiveResult",
48053        "PathPaymentStrictReceiveResultSuccess",
48054        "PathPaymentStrictSendResultCode",
48055        "PathPaymentStrictSendResult",
48056        "PathPaymentStrictSendResultSuccess",
48057        "ManageSellOfferResultCode",
48058        "ManageOfferEffect",
48059        "ManageOfferSuccessResult",
48060        "ManageOfferSuccessResultOffer",
48061        "ManageSellOfferResult",
48062        "ManageBuyOfferResultCode",
48063        "ManageBuyOfferResult",
48064        "SetOptionsResultCode",
48065        "SetOptionsResult",
48066        "ChangeTrustResultCode",
48067        "ChangeTrustResult",
48068        "AllowTrustResultCode",
48069        "AllowTrustResult",
48070        "AccountMergeResultCode",
48071        "AccountMergeResult",
48072        "InflationResultCode",
48073        "InflationPayout",
48074        "InflationResult",
48075        "ManageDataResultCode",
48076        "ManageDataResult",
48077        "BumpSequenceResultCode",
48078        "BumpSequenceResult",
48079        "CreateClaimableBalanceResultCode",
48080        "CreateClaimableBalanceResult",
48081        "ClaimClaimableBalanceResultCode",
48082        "ClaimClaimableBalanceResult",
48083        "BeginSponsoringFutureReservesResultCode",
48084        "BeginSponsoringFutureReservesResult",
48085        "EndSponsoringFutureReservesResultCode",
48086        "EndSponsoringFutureReservesResult",
48087        "RevokeSponsorshipResultCode",
48088        "RevokeSponsorshipResult",
48089        "ClawbackResultCode",
48090        "ClawbackResult",
48091        "ClawbackClaimableBalanceResultCode",
48092        "ClawbackClaimableBalanceResult",
48093        "SetTrustLineFlagsResultCode",
48094        "SetTrustLineFlagsResult",
48095        "LiquidityPoolDepositResultCode",
48096        "LiquidityPoolDepositResult",
48097        "LiquidityPoolWithdrawResultCode",
48098        "LiquidityPoolWithdrawResult",
48099        "InvokeHostFunctionResultCode",
48100        "InvokeHostFunctionResult",
48101        "ExtendFootprintTtlResultCode",
48102        "ExtendFootprintTtlResult",
48103        "RestoreFootprintResultCode",
48104        "RestoreFootprintResult",
48105        "OperationResultCode",
48106        "OperationResult",
48107        "OperationResultTr",
48108        "TransactionResultCode",
48109        "InnerTransactionResult",
48110        "InnerTransactionResultResult",
48111        "InnerTransactionResultExt",
48112        "InnerTransactionResultPair",
48113        "TransactionResult",
48114        "TransactionResultResult",
48115        "TransactionResultExt",
48116        "Hash",
48117        "Uint256",
48118        "Uint32",
48119        "Int32",
48120        "Uint64",
48121        "Int64",
48122        "TimePoint",
48123        "Duration",
48124        "ExtensionPoint",
48125        "CryptoKeyType",
48126        "PublicKeyType",
48127        "SignerKeyType",
48128        "PublicKey",
48129        "SignerKey",
48130        "SignerKeyEd25519SignedPayload",
48131        "Signature",
48132        "SignatureHint",
48133        "NodeId",
48134        "AccountId",
48135        "Curve25519Secret",
48136        "Curve25519Public",
48137        "HmacSha256Key",
48138        "HmacSha256Mac",
48139        "ShortHashSeed",
48140        "BinaryFuseFilterType",
48141        "SerializedBinaryFuseFilter",
48142    ];
48143
48144    #[must_use]
48145    #[allow(clippy::too_many_lines)]
48146    pub const fn name(&self) -> &'static str {
48147        match self {
48148            Self::Value => "Value",
48149            Self::ScpBallot => "ScpBallot",
48150            Self::ScpStatementType => "ScpStatementType",
48151            Self::ScpNomination => "ScpNomination",
48152            Self::ScpStatement => "ScpStatement",
48153            Self::ScpStatementPledges => "ScpStatementPledges",
48154            Self::ScpStatementPrepare => "ScpStatementPrepare",
48155            Self::ScpStatementConfirm => "ScpStatementConfirm",
48156            Self::ScpStatementExternalize => "ScpStatementExternalize",
48157            Self::ScpEnvelope => "ScpEnvelope",
48158            Self::ScpQuorumSet => "ScpQuorumSet",
48159            Self::ConfigSettingContractExecutionLanesV0 => "ConfigSettingContractExecutionLanesV0",
48160            Self::ConfigSettingContractComputeV0 => "ConfigSettingContractComputeV0",
48161            Self::ConfigSettingContractParallelComputeV0 => {
48162                "ConfigSettingContractParallelComputeV0"
48163            }
48164            Self::ConfigSettingContractLedgerCostV0 => "ConfigSettingContractLedgerCostV0",
48165            Self::ConfigSettingContractHistoricalDataV0 => "ConfigSettingContractHistoricalDataV0",
48166            Self::ConfigSettingContractEventsV0 => "ConfigSettingContractEventsV0",
48167            Self::ConfigSettingContractBandwidthV0 => "ConfigSettingContractBandwidthV0",
48168            Self::ContractCostType => "ContractCostType",
48169            Self::ContractCostParamEntry => "ContractCostParamEntry",
48170            Self::StateArchivalSettings => "StateArchivalSettings",
48171            Self::EvictionIterator => "EvictionIterator",
48172            Self::ContractCostParams => "ContractCostParams",
48173            Self::ConfigSettingId => "ConfigSettingId",
48174            Self::ConfigSettingEntry => "ConfigSettingEntry",
48175            Self::ScEnvMetaKind => "ScEnvMetaKind",
48176            Self::ScEnvMetaEntry => "ScEnvMetaEntry",
48177            Self::ScEnvMetaEntryInterfaceVersion => "ScEnvMetaEntryInterfaceVersion",
48178            Self::ScMetaV0 => "ScMetaV0",
48179            Self::ScMetaKind => "ScMetaKind",
48180            Self::ScMetaEntry => "ScMetaEntry",
48181            Self::ScSpecType => "ScSpecType",
48182            Self::ScSpecTypeOption => "ScSpecTypeOption",
48183            Self::ScSpecTypeResult => "ScSpecTypeResult",
48184            Self::ScSpecTypeVec => "ScSpecTypeVec",
48185            Self::ScSpecTypeMap => "ScSpecTypeMap",
48186            Self::ScSpecTypeTuple => "ScSpecTypeTuple",
48187            Self::ScSpecTypeBytesN => "ScSpecTypeBytesN",
48188            Self::ScSpecTypeUdt => "ScSpecTypeUdt",
48189            Self::ScSpecTypeDef => "ScSpecTypeDef",
48190            Self::ScSpecUdtStructFieldV0 => "ScSpecUdtStructFieldV0",
48191            Self::ScSpecUdtStructV0 => "ScSpecUdtStructV0",
48192            Self::ScSpecUdtUnionCaseVoidV0 => "ScSpecUdtUnionCaseVoidV0",
48193            Self::ScSpecUdtUnionCaseTupleV0 => "ScSpecUdtUnionCaseTupleV0",
48194            Self::ScSpecUdtUnionCaseV0Kind => "ScSpecUdtUnionCaseV0Kind",
48195            Self::ScSpecUdtUnionCaseV0 => "ScSpecUdtUnionCaseV0",
48196            Self::ScSpecUdtUnionV0 => "ScSpecUdtUnionV0",
48197            Self::ScSpecUdtEnumCaseV0 => "ScSpecUdtEnumCaseV0",
48198            Self::ScSpecUdtEnumV0 => "ScSpecUdtEnumV0",
48199            Self::ScSpecUdtErrorEnumCaseV0 => "ScSpecUdtErrorEnumCaseV0",
48200            Self::ScSpecUdtErrorEnumV0 => "ScSpecUdtErrorEnumV0",
48201            Self::ScSpecFunctionInputV0 => "ScSpecFunctionInputV0",
48202            Self::ScSpecFunctionV0 => "ScSpecFunctionV0",
48203            Self::ScSpecEntryKind => "ScSpecEntryKind",
48204            Self::ScSpecEntry => "ScSpecEntry",
48205            Self::ScValType => "ScValType",
48206            Self::ScErrorType => "ScErrorType",
48207            Self::ScErrorCode => "ScErrorCode",
48208            Self::ScError => "ScError",
48209            Self::UInt128Parts => "UInt128Parts",
48210            Self::Int128Parts => "Int128Parts",
48211            Self::UInt256Parts => "UInt256Parts",
48212            Self::Int256Parts => "Int256Parts",
48213            Self::ContractExecutableType => "ContractExecutableType",
48214            Self::ContractExecutable => "ContractExecutable",
48215            Self::ScAddressType => "ScAddressType",
48216            Self::ScAddress => "ScAddress",
48217            Self::ScVec => "ScVec",
48218            Self::ScMap => "ScMap",
48219            Self::ScBytes => "ScBytes",
48220            Self::ScString => "ScString",
48221            Self::ScSymbol => "ScSymbol",
48222            Self::ScNonceKey => "ScNonceKey",
48223            Self::ScContractInstance => "ScContractInstance",
48224            Self::ScVal => "ScVal",
48225            Self::ScMapEntry => "ScMapEntry",
48226            Self::StoredTransactionSet => "StoredTransactionSet",
48227            Self::StoredDebugTransactionSet => "StoredDebugTransactionSet",
48228            Self::PersistedScpStateV0 => "PersistedScpStateV0",
48229            Self::PersistedScpStateV1 => "PersistedScpStateV1",
48230            Self::PersistedScpState => "PersistedScpState",
48231            Self::Thresholds => "Thresholds",
48232            Self::String32 => "String32",
48233            Self::String64 => "String64",
48234            Self::SequenceNumber => "SequenceNumber",
48235            Self::DataValue => "DataValue",
48236            Self::PoolId => "PoolId",
48237            Self::AssetCode4 => "AssetCode4",
48238            Self::AssetCode12 => "AssetCode12",
48239            Self::AssetType => "AssetType",
48240            Self::AssetCode => "AssetCode",
48241            Self::AlphaNum4 => "AlphaNum4",
48242            Self::AlphaNum12 => "AlphaNum12",
48243            Self::Asset => "Asset",
48244            Self::Price => "Price",
48245            Self::Liabilities => "Liabilities",
48246            Self::ThresholdIndexes => "ThresholdIndexes",
48247            Self::LedgerEntryType => "LedgerEntryType",
48248            Self::Signer => "Signer",
48249            Self::AccountFlags => "AccountFlags",
48250            Self::SponsorshipDescriptor => "SponsorshipDescriptor",
48251            Self::AccountEntryExtensionV3 => "AccountEntryExtensionV3",
48252            Self::AccountEntryExtensionV2 => "AccountEntryExtensionV2",
48253            Self::AccountEntryExtensionV2Ext => "AccountEntryExtensionV2Ext",
48254            Self::AccountEntryExtensionV1 => "AccountEntryExtensionV1",
48255            Self::AccountEntryExtensionV1Ext => "AccountEntryExtensionV1Ext",
48256            Self::AccountEntry => "AccountEntry",
48257            Self::AccountEntryExt => "AccountEntryExt",
48258            Self::TrustLineFlags => "TrustLineFlags",
48259            Self::LiquidityPoolType => "LiquidityPoolType",
48260            Self::TrustLineAsset => "TrustLineAsset",
48261            Self::TrustLineEntryExtensionV2 => "TrustLineEntryExtensionV2",
48262            Self::TrustLineEntryExtensionV2Ext => "TrustLineEntryExtensionV2Ext",
48263            Self::TrustLineEntry => "TrustLineEntry",
48264            Self::TrustLineEntryExt => "TrustLineEntryExt",
48265            Self::TrustLineEntryV1 => "TrustLineEntryV1",
48266            Self::TrustLineEntryV1Ext => "TrustLineEntryV1Ext",
48267            Self::OfferEntryFlags => "OfferEntryFlags",
48268            Self::OfferEntry => "OfferEntry",
48269            Self::OfferEntryExt => "OfferEntryExt",
48270            Self::DataEntry => "DataEntry",
48271            Self::DataEntryExt => "DataEntryExt",
48272            Self::ClaimPredicateType => "ClaimPredicateType",
48273            Self::ClaimPredicate => "ClaimPredicate",
48274            Self::ClaimantType => "ClaimantType",
48275            Self::Claimant => "Claimant",
48276            Self::ClaimantV0 => "ClaimantV0",
48277            Self::ClaimableBalanceIdType => "ClaimableBalanceIdType",
48278            Self::ClaimableBalanceId => "ClaimableBalanceId",
48279            Self::ClaimableBalanceFlags => "ClaimableBalanceFlags",
48280            Self::ClaimableBalanceEntryExtensionV1 => "ClaimableBalanceEntryExtensionV1",
48281            Self::ClaimableBalanceEntryExtensionV1Ext => "ClaimableBalanceEntryExtensionV1Ext",
48282            Self::ClaimableBalanceEntry => "ClaimableBalanceEntry",
48283            Self::ClaimableBalanceEntryExt => "ClaimableBalanceEntryExt",
48284            Self::LiquidityPoolConstantProductParameters => {
48285                "LiquidityPoolConstantProductParameters"
48286            }
48287            Self::LiquidityPoolEntry => "LiquidityPoolEntry",
48288            Self::LiquidityPoolEntryBody => "LiquidityPoolEntryBody",
48289            Self::LiquidityPoolEntryConstantProduct => "LiquidityPoolEntryConstantProduct",
48290            Self::ContractDataDurability => "ContractDataDurability",
48291            Self::ContractDataEntry => "ContractDataEntry",
48292            Self::ContractCodeCostInputs => "ContractCodeCostInputs",
48293            Self::ContractCodeEntry => "ContractCodeEntry",
48294            Self::ContractCodeEntryExt => "ContractCodeEntryExt",
48295            Self::ContractCodeEntryV1 => "ContractCodeEntryV1",
48296            Self::TtlEntry => "TtlEntry",
48297            Self::LedgerEntryExtensionV1 => "LedgerEntryExtensionV1",
48298            Self::LedgerEntryExtensionV1Ext => "LedgerEntryExtensionV1Ext",
48299            Self::LedgerEntry => "LedgerEntry",
48300            Self::LedgerEntryData => "LedgerEntryData",
48301            Self::LedgerEntryExt => "LedgerEntryExt",
48302            Self::LedgerKey => "LedgerKey",
48303            Self::LedgerKeyAccount => "LedgerKeyAccount",
48304            Self::LedgerKeyTrustLine => "LedgerKeyTrustLine",
48305            Self::LedgerKeyOffer => "LedgerKeyOffer",
48306            Self::LedgerKeyData => "LedgerKeyData",
48307            Self::LedgerKeyClaimableBalance => "LedgerKeyClaimableBalance",
48308            Self::LedgerKeyLiquidityPool => "LedgerKeyLiquidityPool",
48309            Self::LedgerKeyContractData => "LedgerKeyContractData",
48310            Self::LedgerKeyContractCode => "LedgerKeyContractCode",
48311            Self::LedgerKeyConfigSetting => "LedgerKeyConfigSetting",
48312            Self::LedgerKeyTtl => "LedgerKeyTtl",
48313            Self::EnvelopeType => "EnvelopeType",
48314            Self::BucketListType => "BucketListType",
48315            Self::BucketEntryType => "BucketEntryType",
48316            Self::HotArchiveBucketEntryType => "HotArchiveBucketEntryType",
48317            Self::ColdArchiveBucketEntryType => "ColdArchiveBucketEntryType",
48318            Self::BucketMetadata => "BucketMetadata",
48319            Self::BucketMetadataExt => "BucketMetadataExt",
48320            Self::BucketEntry => "BucketEntry",
48321            Self::HotArchiveBucketEntry => "HotArchiveBucketEntry",
48322            Self::ColdArchiveArchivedLeaf => "ColdArchiveArchivedLeaf",
48323            Self::ColdArchiveDeletedLeaf => "ColdArchiveDeletedLeaf",
48324            Self::ColdArchiveBoundaryLeaf => "ColdArchiveBoundaryLeaf",
48325            Self::ColdArchiveHashEntry => "ColdArchiveHashEntry",
48326            Self::ColdArchiveBucketEntry => "ColdArchiveBucketEntry",
48327            Self::UpgradeType => "UpgradeType",
48328            Self::StellarValueType => "StellarValueType",
48329            Self::LedgerCloseValueSignature => "LedgerCloseValueSignature",
48330            Self::StellarValue => "StellarValue",
48331            Self::StellarValueExt => "StellarValueExt",
48332            Self::LedgerHeaderFlags => "LedgerHeaderFlags",
48333            Self::LedgerHeaderExtensionV1 => "LedgerHeaderExtensionV1",
48334            Self::LedgerHeaderExtensionV1Ext => "LedgerHeaderExtensionV1Ext",
48335            Self::LedgerHeader => "LedgerHeader",
48336            Self::LedgerHeaderExt => "LedgerHeaderExt",
48337            Self::LedgerUpgradeType => "LedgerUpgradeType",
48338            Self::ConfigUpgradeSetKey => "ConfigUpgradeSetKey",
48339            Self::LedgerUpgrade => "LedgerUpgrade",
48340            Self::ConfigUpgradeSet => "ConfigUpgradeSet",
48341            Self::TxSetComponentType => "TxSetComponentType",
48342            Self::TxExecutionThread => "TxExecutionThread",
48343            Self::ParallelTxExecutionStage => "ParallelTxExecutionStage",
48344            Self::ParallelTxsComponent => "ParallelTxsComponent",
48345            Self::TxSetComponent => "TxSetComponent",
48346            Self::TxSetComponentTxsMaybeDiscountedFee => "TxSetComponentTxsMaybeDiscountedFee",
48347            Self::TransactionPhase => "TransactionPhase",
48348            Self::TransactionSet => "TransactionSet",
48349            Self::TransactionSetV1 => "TransactionSetV1",
48350            Self::GeneralizedTransactionSet => "GeneralizedTransactionSet",
48351            Self::TransactionResultPair => "TransactionResultPair",
48352            Self::TransactionResultSet => "TransactionResultSet",
48353            Self::TransactionHistoryEntry => "TransactionHistoryEntry",
48354            Self::TransactionHistoryEntryExt => "TransactionHistoryEntryExt",
48355            Self::TransactionHistoryResultEntry => "TransactionHistoryResultEntry",
48356            Self::TransactionHistoryResultEntryExt => "TransactionHistoryResultEntryExt",
48357            Self::LedgerHeaderHistoryEntry => "LedgerHeaderHistoryEntry",
48358            Self::LedgerHeaderHistoryEntryExt => "LedgerHeaderHistoryEntryExt",
48359            Self::LedgerScpMessages => "LedgerScpMessages",
48360            Self::ScpHistoryEntryV0 => "ScpHistoryEntryV0",
48361            Self::ScpHistoryEntry => "ScpHistoryEntry",
48362            Self::LedgerEntryChangeType => "LedgerEntryChangeType",
48363            Self::LedgerEntryChange => "LedgerEntryChange",
48364            Self::LedgerEntryChanges => "LedgerEntryChanges",
48365            Self::OperationMeta => "OperationMeta",
48366            Self::TransactionMetaV1 => "TransactionMetaV1",
48367            Self::TransactionMetaV2 => "TransactionMetaV2",
48368            Self::ContractEventType => "ContractEventType",
48369            Self::ContractEvent => "ContractEvent",
48370            Self::ContractEventBody => "ContractEventBody",
48371            Self::ContractEventV0 => "ContractEventV0",
48372            Self::DiagnosticEvent => "DiagnosticEvent",
48373            Self::SorobanTransactionMetaExtV1 => "SorobanTransactionMetaExtV1",
48374            Self::SorobanTransactionMetaExt => "SorobanTransactionMetaExt",
48375            Self::SorobanTransactionMeta => "SorobanTransactionMeta",
48376            Self::TransactionMetaV3 => "TransactionMetaV3",
48377            Self::InvokeHostFunctionSuccessPreImage => "InvokeHostFunctionSuccessPreImage",
48378            Self::TransactionMeta => "TransactionMeta",
48379            Self::TransactionResultMeta => "TransactionResultMeta",
48380            Self::UpgradeEntryMeta => "UpgradeEntryMeta",
48381            Self::LedgerCloseMetaV0 => "LedgerCloseMetaV0",
48382            Self::LedgerCloseMetaExtV1 => "LedgerCloseMetaExtV1",
48383            Self::LedgerCloseMetaExtV2 => "LedgerCloseMetaExtV2",
48384            Self::LedgerCloseMetaExt => "LedgerCloseMetaExt",
48385            Self::LedgerCloseMetaV1 => "LedgerCloseMetaV1",
48386            Self::LedgerCloseMeta => "LedgerCloseMeta",
48387            Self::ErrorCode => "ErrorCode",
48388            Self::SError => "SError",
48389            Self::SendMore => "SendMore",
48390            Self::SendMoreExtended => "SendMoreExtended",
48391            Self::AuthCert => "AuthCert",
48392            Self::Hello => "Hello",
48393            Self::Auth => "Auth",
48394            Self::IpAddrType => "IpAddrType",
48395            Self::PeerAddress => "PeerAddress",
48396            Self::PeerAddressIp => "PeerAddressIp",
48397            Self::MessageType => "MessageType",
48398            Self::DontHave => "DontHave",
48399            Self::SurveyMessageCommandType => "SurveyMessageCommandType",
48400            Self::SurveyMessageResponseType => "SurveyMessageResponseType",
48401            Self::TimeSlicedSurveyStartCollectingMessage => {
48402                "TimeSlicedSurveyStartCollectingMessage"
48403            }
48404            Self::SignedTimeSlicedSurveyStartCollectingMessage => {
48405                "SignedTimeSlicedSurveyStartCollectingMessage"
48406            }
48407            Self::TimeSlicedSurveyStopCollectingMessage => "TimeSlicedSurveyStopCollectingMessage",
48408            Self::SignedTimeSlicedSurveyStopCollectingMessage => {
48409                "SignedTimeSlicedSurveyStopCollectingMessage"
48410            }
48411            Self::SurveyRequestMessage => "SurveyRequestMessage",
48412            Self::TimeSlicedSurveyRequestMessage => "TimeSlicedSurveyRequestMessage",
48413            Self::SignedSurveyRequestMessage => "SignedSurveyRequestMessage",
48414            Self::SignedTimeSlicedSurveyRequestMessage => "SignedTimeSlicedSurveyRequestMessage",
48415            Self::EncryptedBody => "EncryptedBody",
48416            Self::SurveyResponseMessage => "SurveyResponseMessage",
48417            Self::TimeSlicedSurveyResponseMessage => "TimeSlicedSurveyResponseMessage",
48418            Self::SignedSurveyResponseMessage => "SignedSurveyResponseMessage",
48419            Self::SignedTimeSlicedSurveyResponseMessage => "SignedTimeSlicedSurveyResponseMessage",
48420            Self::PeerStats => "PeerStats",
48421            Self::PeerStatList => "PeerStatList",
48422            Self::TimeSlicedNodeData => "TimeSlicedNodeData",
48423            Self::TimeSlicedPeerData => "TimeSlicedPeerData",
48424            Self::TimeSlicedPeerDataList => "TimeSlicedPeerDataList",
48425            Self::TopologyResponseBodyV0 => "TopologyResponseBodyV0",
48426            Self::TopologyResponseBodyV1 => "TopologyResponseBodyV1",
48427            Self::TopologyResponseBodyV2 => "TopologyResponseBodyV2",
48428            Self::SurveyResponseBody => "SurveyResponseBody",
48429            Self::TxAdvertVector => "TxAdvertVector",
48430            Self::FloodAdvert => "FloodAdvert",
48431            Self::TxDemandVector => "TxDemandVector",
48432            Self::FloodDemand => "FloodDemand",
48433            Self::StellarMessage => "StellarMessage",
48434            Self::AuthenticatedMessage => "AuthenticatedMessage",
48435            Self::AuthenticatedMessageV0 => "AuthenticatedMessageV0",
48436            Self::LiquidityPoolParameters => "LiquidityPoolParameters",
48437            Self::MuxedAccount => "MuxedAccount",
48438            Self::MuxedAccountMed25519 => "MuxedAccountMed25519",
48439            Self::DecoratedSignature => "DecoratedSignature",
48440            Self::OperationType => "OperationType",
48441            Self::CreateAccountOp => "CreateAccountOp",
48442            Self::PaymentOp => "PaymentOp",
48443            Self::PathPaymentStrictReceiveOp => "PathPaymentStrictReceiveOp",
48444            Self::PathPaymentStrictSendOp => "PathPaymentStrictSendOp",
48445            Self::ManageSellOfferOp => "ManageSellOfferOp",
48446            Self::ManageBuyOfferOp => "ManageBuyOfferOp",
48447            Self::CreatePassiveSellOfferOp => "CreatePassiveSellOfferOp",
48448            Self::SetOptionsOp => "SetOptionsOp",
48449            Self::ChangeTrustAsset => "ChangeTrustAsset",
48450            Self::ChangeTrustOp => "ChangeTrustOp",
48451            Self::AllowTrustOp => "AllowTrustOp",
48452            Self::ManageDataOp => "ManageDataOp",
48453            Self::BumpSequenceOp => "BumpSequenceOp",
48454            Self::CreateClaimableBalanceOp => "CreateClaimableBalanceOp",
48455            Self::ClaimClaimableBalanceOp => "ClaimClaimableBalanceOp",
48456            Self::BeginSponsoringFutureReservesOp => "BeginSponsoringFutureReservesOp",
48457            Self::RevokeSponsorshipType => "RevokeSponsorshipType",
48458            Self::RevokeSponsorshipOp => "RevokeSponsorshipOp",
48459            Self::RevokeSponsorshipOpSigner => "RevokeSponsorshipOpSigner",
48460            Self::ClawbackOp => "ClawbackOp",
48461            Self::ClawbackClaimableBalanceOp => "ClawbackClaimableBalanceOp",
48462            Self::SetTrustLineFlagsOp => "SetTrustLineFlagsOp",
48463            Self::LiquidityPoolDepositOp => "LiquidityPoolDepositOp",
48464            Self::LiquidityPoolWithdrawOp => "LiquidityPoolWithdrawOp",
48465            Self::HostFunctionType => "HostFunctionType",
48466            Self::ContractIdPreimageType => "ContractIdPreimageType",
48467            Self::ContractIdPreimage => "ContractIdPreimage",
48468            Self::ContractIdPreimageFromAddress => "ContractIdPreimageFromAddress",
48469            Self::CreateContractArgs => "CreateContractArgs",
48470            Self::CreateContractArgsV2 => "CreateContractArgsV2",
48471            Self::InvokeContractArgs => "InvokeContractArgs",
48472            Self::HostFunction => "HostFunction",
48473            Self::SorobanAuthorizedFunctionType => "SorobanAuthorizedFunctionType",
48474            Self::SorobanAuthorizedFunction => "SorobanAuthorizedFunction",
48475            Self::SorobanAuthorizedInvocation => "SorobanAuthorizedInvocation",
48476            Self::SorobanAddressCredentials => "SorobanAddressCredentials",
48477            Self::SorobanCredentialsType => "SorobanCredentialsType",
48478            Self::SorobanCredentials => "SorobanCredentials",
48479            Self::SorobanAuthorizationEntry => "SorobanAuthorizationEntry",
48480            Self::InvokeHostFunctionOp => "InvokeHostFunctionOp",
48481            Self::ExtendFootprintTtlOp => "ExtendFootprintTtlOp",
48482            Self::RestoreFootprintOp => "RestoreFootprintOp",
48483            Self::Operation => "Operation",
48484            Self::OperationBody => "OperationBody",
48485            Self::HashIdPreimage => "HashIdPreimage",
48486            Self::HashIdPreimageOperationId => "HashIdPreimageOperationId",
48487            Self::HashIdPreimageRevokeId => "HashIdPreimageRevokeId",
48488            Self::HashIdPreimageContractId => "HashIdPreimageContractId",
48489            Self::HashIdPreimageSorobanAuthorization => "HashIdPreimageSorobanAuthorization",
48490            Self::MemoType => "MemoType",
48491            Self::Memo => "Memo",
48492            Self::TimeBounds => "TimeBounds",
48493            Self::LedgerBounds => "LedgerBounds",
48494            Self::PreconditionsV2 => "PreconditionsV2",
48495            Self::PreconditionType => "PreconditionType",
48496            Self::Preconditions => "Preconditions",
48497            Self::LedgerFootprint => "LedgerFootprint",
48498            Self::ArchivalProofType => "ArchivalProofType",
48499            Self::ArchivalProofNode => "ArchivalProofNode",
48500            Self::ProofLevel => "ProofLevel",
48501            Self::ExistenceProofBody => "ExistenceProofBody",
48502            Self::NonexistenceProofBody => "NonexistenceProofBody",
48503            Self::ArchivalProof => "ArchivalProof",
48504            Self::ArchivalProofBody => "ArchivalProofBody",
48505            Self::SorobanResources => "SorobanResources",
48506            Self::SorobanTransactionData => "SorobanTransactionData",
48507            Self::SorobanTransactionDataExt => "SorobanTransactionDataExt",
48508            Self::TransactionV0 => "TransactionV0",
48509            Self::TransactionV0Ext => "TransactionV0Ext",
48510            Self::TransactionV0Envelope => "TransactionV0Envelope",
48511            Self::Transaction => "Transaction",
48512            Self::TransactionExt => "TransactionExt",
48513            Self::TransactionV1Envelope => "TransactionV1Envelope",
48514            Self::FeeBumpTransaction => "FeeBumpTransaction",
48515            Self::FeeBumpTransactionInnerTx => "FeeBumpTransactionInnerTx",
48516            Self::FeeBumpTransactionExt => "FeeBumpTransactionExt",
48517            Self::FeeBumpTransactionEnvelope => "FeeBumpTransactionEnvelope",
48518            Self::TransactionEnvelope => "TransactionEnvelope",
48519            Self::TransactionSignaturePayload => "TransactionSignaturePayload",
48520            Self::TransactionSignaturePayloadTaggedTransaction => {
48521                "TransactionSignaturePayloadTaggedTransaction"
48522            }
48523            Self::ClaimAtomType => "ClaimAtomType",
48524            Self::ClaimOfferAtomV0 => "ClaimOfferAtomV0",
48525            Self::ClaimOfferAtom => "ClaimOfferAtom",
48526            Self::ClaimLiquidityAtom => "ClaimLiquidityAtom",
48527            Self::ClaimAtom => "ClaimAtom",
48528            Self::CreateAccountResultCode => "CreateAccountResultCode",
48529            Self::CreateAccountResult => "CreateAccountResult",
48530            Self::PaymentResultCode => "PaymentResultCode",
48531            Self::PaymentResult => "PaymentResult",
48532            Self::PathPaymentStrictReceiveResultCode => "PathPaymentStrictReceiveResultCode",
48533            Self::SimplePaymentResult => "SimplePaymentResult",
48534            Self::PathPaymentStrictReceiveResult => "PathPaymentStrictReceiveResult",
48535            Self::PathPaymentStrictReceiveResultSuccess => "PathPaymentStrictReceiveResultSuccess",
48536            Self::PathPaymentStrictSendResultCode => "PathPaymentStrictSendResultCode",
48537            Self::PathPaymentStrictSendResult => "PathPaymentStrictSendResult",
48538            Self::PathPaymentStrictSendResultSuccess => "PathPaymentStrictSendResultSuccess",
48539            Self::ManageSellOfferResultCode => "ManageSellOfferResultCode",
48540            Self::ManageOfferEffect => "ManageOfferEffect",
48541            Self::ManageOfferSuccessResult => "ManageOfferSuccessResult",
48542            Self::ManageOfferSuccessResultOffer => "ManageOfferSuccessResultOffer",
48543            Self::ManageSellOfferResult => "ManageSellOfferResult",
48544            Self::ManageBuyOfferResultCode => "ManageBuyOfferResultCode",
48545            Self::ManageBuyOfferResult => "ManageBuyOfferResult",
48546            Self::SetOptionsResultCode => "SetOptionsResultCode",
48547            Self::SetOptionsResult => "SetOptionsResult",
48548            Self::ChangeTrustResultCode => "ChangeTrustResultCode",
48549            Self::ChangeTrustResult => "ChangeTrustResult",
48550            Self::AllowTrustResultCode => "AllowTrustResultCode",
48551            Self::AllowTrustResult => "AllowTrustResult",
48552            Self::AccountMergeResultCode => "AccountMergeResultCode",
48553            Self::AccountMergeResult => "AccountMergeResult",
48554            Self::InflationResultCode => "InflationResultCode",
48555            Self::InflationPayout => "InflationPayout",
48556            Self::InflationResult => "InflationResult",
48557            Self::ManageDataResultCode => "ManageDataResultCode",
48558            Self::ManageDataResult => "ManageDataResult",
48559            Self::BumpSequenceResultCode => "BumpSequenceResultCode",
48560            Self::BumpSequenceResult => "BumpSequenceResult",
48561            Self::CreateClaimableBalanceResultCode => "CreateClaimableBalanceResultCode",
48562            Self::CreateClaimableBalanceResult => "CreateClaimableBalanceResult",
48563            Self::ClaimClaimableBalanceResultCode => "ClaimClaimableBalanceResultCode",
48564            Self::ClaimClaimableBalanceResult => "ClaimClaimableBalanceResult",
48565            Self::BeginSponsoringFutureReservesResultCode => {
48566                "BeginSponsoringFutureReservesResultCode"
48567            }
48568            Self::BeginSponsoringFutureReservesResult => "BeginSponsoringFutureReservesResult",
48569            Self::EndSponsoringFutureReservesResultCode => "EndSponsoringFutureReservesResultCode",
48570            Self::EndSponsoringFutureReservesResult => "EndSponsoringFutureReservesResult",
48571            Self::RevokeSponsorshipResultCode => "RevokeSponsorshipResultCode",
48572            Self::RevokeSponsorshipResult => "RevokeSponsorshipResult",
48573            Self::ClawbackResultCode => "ClawbackResultCode",
48574            Self::ClawbackResult => "ClawbackResult",
48575            Self::ClawbackClaimableBalanceResultCode => "ClawbackClaimableBalanceResultCode",
48576            Self::ClawbackClaimableBalanceResult => "ClawbackClaimableBalanceResult",
48577            Self::SetTrustLineFlagsResultCode => "SetTrustLineFlagsResultCode",
48578            Self::SetTrustLineFlagsResult => "SetTrustLineFlagsResult",
48579            Self::LiquidityPoolDepositResultCode => "LiquidityPoolDepositResultCode",
48580            Self::LiquidityPoolDepositResult => "LiquidityPoolDepositResult",
48581            Self::LiquidityPoolWithdrawResultCode => "LiquidityPoolWithdrawResultCode",
48582            Self::LiquidityPoolWithdrawResult => "LiquidityPoolWithdrawResult",
48583            Self::InvokeHostFunctionResultCode => "InvokeHostFunctionResultCode",
48584            Self::InvokeHostFunctionResult => "InvokeHostFunctionResult",
48585            Self::ExtendFootprintTtlResultCode => "ExtendFootprintTtlResultCode",
48586            Self::ExtendFootprintTtlResult => "ExtendFootprintTtlResult",
48587            Self::RestoreFootprintResultCode => "RestoreFootprintResultCode",
48588            Self::RestoreFootprintResult => "RestoreFootprintResult",
48589            Self::OperationResultCode => "OperationResultCode",
48590            Self::OperationResult => "OperationResult",
48591            Self::OperationResultTr => "OperationResultTr",
48592            Self::TransactionResultCode => "TransactionResultCode",
48593            Self::InnerTransactionResult => "InnerTransactionResult",
48594            Self::InnerTransactionResultResult => "InnerTransactionResultResult",
48595            Self::InnerTransactionResultExt => "InnerTransactionResultExt",
48596            Self::InnerTransactionResultPair => "InnerTransactionResultPair",
48597            Self::TransactionResult => "TransactionResult",
48598            Self::TransactionResultResult => "TransactionResultResult",
48599            Self::TransactionResultExt => "TransactionResultExt",
48600            Self::Hash => "Hash",
48601            Self::Uint256 => "Uint256",
48602            Self::Uint32 => "Uint32",
48603            Self::Int32 => "Int32",
48604            Self::Uint64 => "Uint64",
48605            Self::Int64 => "Int64",
48606            Self::TimePoint => "TimePoint",
48607            Self::Duration => "Duration",
48608            Self::ExtensionPoint => "ExtensionPoint",
48609            Self::CryptoKeyType => "CryptoKeyType",
48610            Self::PublicKeyType => "PublicKeyType",
48611            Self::SignerKeyType => "SignerKeyType",
48612            Self::PublicKey => "PublicKey",
48613            Self::SignerKey => "SignerKey",
48614            Self::SignerKeyEd25519SignedPayload => "SignerKeyEd25519SignedPayload",
48615            Self::Signature => "Signature",
48616            Self::SignatureHint => "SignatureHint",
48617            Self::NodeId => "NodeId",
48618            Self::AccountId => "AccountId",
48619            Self::Curve25519Secret => "Curve25519Secret",
48620            Self::Curve25519Public => "Curve25519Public",
48621            Self::HmacSha256Key => "HmacSha256Key",
48622            Self::HmacSha256Mac => "HmacSha256Mac",
48623            Self::ShortHashSeed => "ShortHashSeed",
48624            Self::BinaryFuseFilterType => "BinaryFuseFilterType",
48625            Self::SerializedBinaryFuseFilter => "SerializedBinaryFuseFilter",
48626        }
48627    }
48628
48629    #[must_use]
48630    #[allow(clippy::too_many_lines)]
48631    pub const fn variants() -> [TypeVariant; 464] {
48632        Self::VARIANTS
48633    }
48634
48635    #[cfg(feature = "schemars")]
48636    #[must_use]
48637    #[allow(clippy::too_many_lines)]
48638    pub fn json_schema(&self, gen: schemars::gen::SchemaGenerator) -> schemars::schema::RootSchema {
48639        match self {
48640            Self::Value => gen.into_root_schema_for::<Value>(),
48641            Self::ScpBallot => gen.into_root_schema_for::<ScpBallot>(),
48642            Self::ScpStatementType => gen.into_root_schema_for::<ScpStatementType>(),
48643            Self::ScpNomination => gen.into_root_schema_for::<ScpNomination>(),
48644            Self::ScpStatement => gen.into_root_schema_for::<ScpStatement>(),
48645            Self::ScpStatementPledges => gen.into_root_schema_for::<ScpStatementPledges>(),
48646            Self::ScpStatementPrepare => gen.into_root_schema_for::<ScpStatementPrepare>(),
48647            Self::ScpStatementConfirm => gen.into_root_schema_for::<ScpStatementConfirm>(),
48648            Self::ScpStatementExternalize => gen.into_root_schema_for::<ScpStatementExternalize>(),
48649            Self::ScpEnvelope => gen.into_root_schema_for::<ScpEnvelope>(),
48650            Self::ScpQuorumSet => gen.into_root_schema_for::<ScpQuorumSet>(),
48651            Self::ConfigSettingContractExecutionLanesV0 => {
48652                gen.into_root_schema_for::<ConfigSettingContractExecutionLanesV0>()
48653            }
48654            Self::ConfigSettingContractComputeV0 => {
48655                gen.into_root_schema_for::<ConfigSettingContractComputeV0>()
48656            }
48657            Self::ConfigSettingContractParallelComputeV0 => {
48658                gen.into_root_schema_for::<ConfigSettingContractParallelComputeV0>()
48659            }
48660            Self::ConfigSettingContractLedgerCostV0 => {
48661                gen.into_root_schema_for::<ConfigSettingContractLedgerCostV0>()
48662            }
48663            Self::ConfigSettingContractHistoricalDataV0 => {
48664                gen.into_root_schema_for::<ConfigSettingContractHistoricalDataV0>()
48665            }
48666            Self::ConfigSettingContractEventsV0 => {
48667                gen.into_root_schema_for::<ConfigSettingContractEventsV0>()
48668            }
48669            Self::ConfigSettingContractBandwidthV0 => {
48670                gen.into_root_schema_for::<ConfigSettingContractBandwidthV0>()
48671            }
48672            Self::ContractCostType => gen.into_root_schema_for::<ContractCostType>(),
48673            Self::ContractCostParamEntry => gen.into_root_schema_for::<ContractCostParamEntry>(),
48674            Self::StateArchivalSettings => gen.into_root_schema_for::<StateArchivalSettings>(),
48675            Self::EvictionIterator => gen.into_root_schema_for::<EvictionIterator>(),
48676            Self::ContractCostParams => gen.into_root_schema_for::<ContractCostParams>(),
48677            Self::ConfigSettingId => gen.into_root_schema_for::<ConfigSettingId>(),
48678            Self::ConfigSettingEntry => gen.into_root_schema_for::<ConfigSettingEntry>(),
48679            Self::ScEnvMetaKind => gen.into_root_schema_for::<ScEnvMetaKind>(),
48680            Self::ScEnvMetaEntry => gen.into_root_schema_for::<ScEnvMetaEntry>(),
48681            Self::ScEnvMetaEntryInterfaceVersion => {
48682                gen.into_root_schema_for::<ScEnvMetaEntryInterfaceVersion>()
48683            }
48684            Self::ScMetaV0 => gen.into_root_schema_for::<ScMetaV0>(),
48685            Self::ScMetaKind => gen.into_root_schema_for::<ScMetaKind>(),
48686            Self::ScMetaEntry => gen.into_root_schema_for::<ScMetaEntry>(),
48687            Self::ScSpecType => gen.into_root_schema_for::<ScSpecType>(),
48688            Self::ScSpecTypeOption => gen.into_root_schema_for::<ScSpecTypeOption>(),
48689            Self::ScSpecTypeResult => gen.into_root_schema_for::<ScSpecTypeResult>(),
48690            Self::ScSpecTypeVec => gen.into_root_schema_for::<ScSpecTypeVec>(),
48691            Self::ScSpecTypeMap => gen.into_root_schema_for::<ScSpecTypeMap>(),
48692            Self::ScSpecTypeTuple => gen.into_root_schema_for::<ScSpecTypeTuple>(),
48693            Self::ScSpecTypeBytesN => gen.into_root_schema_for::<ScSpecTypeBytesN>(),
48694            Self::ScSpecTypeUdt => gen.into_root_schema_for::<ScSpecTypeUdt>(),
48695            Self::ScSpecTypeDef => gen.into_root_schema_for::<ScSpecTypeDef>(),
48696            Self::ScSpecUdtStructFieldV0 => gen.into_root_schema_for::<ScSpecUdtStructFieldV0>(),
48697            Self::ScSpecUdtStructV0 => gen.into_root_schema_for::<ScSpecUdtStructV0>(),
48698            Self::ScSpecUdtUnionCaseVoidV0 => {
48699                gen.into_root_schema_for::<ScSpecUdtUnionCaseVoidV0>()
48700            }
48701            Self::ScSpecUdtUnionCaseTupleV0 => {
48702                gen.into_root_schema_for::<ScSpecUdtUnionCaseTupleV0>()
48703            }
48704            Self::ScSpecUdtUnionCaseV0Kind => {
48705                gen.into_root_schema_for::<ScSpecUdtUnionCaseV0Kind>()
48706            }
48707            Self::ScSpecUdtUnionCaseV0 => gen.into_root_schema_for::<ScSpecUdtUnionCaseV0>(),
48708            Self::ScSpecUdtUnionV0 => gen.into_root_schema_for::<ScSpecUdtUnionV0>(),
48709            Self::ScSpecUdtEnumCaseV0 => gen.into_root_schema_for::<ScSpecUdtEnumCaseV0>(),
48710            Self::ScSpecUdtEnumV0 => gen.into_root_schema_for::<ScSpecUdtEnumV0>(),
48711            Self::ScSpecUdtErrorEnumCaseV0 => {
48712                gen.into_root_schema_for::<ScSpecUdtErrorEnumCaseV0>()
48713            }
48714            Self::ScSpecUdtErrorEnumV0 => gen.into_root_schema_for::<ScSpecUdtErrorEnumV0>(),
48715            Self::ScSpecFunctionInputV0 => gen.into_root_schema_for::<ScSpecFunctionInputV0>(),
48716            Self::ScSpecFunctionV0 => gen.into_root_schema_for::<ScSpecFunctionV0>(),
48717            Self::ScSpecEntryKind => gen.into_root_schema_for::<ScSpecEntryKind>(),
48718            Self::ScSpecEntry => gen.into_root_schema_for::<ScSpecEntry>(),
48719            Self::ScValType => gen.into_root_schema_for::<ScValType>(),
48720            Self::ScErrorType => gen.into_root_schema_for::<ScErrorType>(),
48721            Self::ScErrorCode => gen.into_root_schema_for::<ScErrorCode>(),
48722            Self::ScError => gen.into_root_schema_for::<ScError>(),
48723            Self::UInt128Parts => gen.into_root_schema_for::<UInt128Parts>(),
48724            Self::Int128Parts => gen.into_root_schema_for::<Int128Parts>(),
48725            Self::UInt256Parts => gen.into_root_schema_for::<UInt256Parts>(),
48726            Self::Int256Parts => gen.into_root_schema_for::<Int256Parts>(),
48727            Self::ContractExecutableType => gen.into_root_schema_for::<ContractExecutableType>(),
48728            Self::ContractExecutable => gen.into_root_schema_for::<ContractExecutable>(),
48729            Self::ScAddressType => gen.into_root_schema_for::<ScAddressType>(),
48730            Self::ScAddress => gen.into_root_schema_for::<ScAddress>(),
48731            Self::ScVec => gen.into_root_schema_for::<ScVec>(),
48732            Self::ScMap => gen.into_root_schema_for::<ScMap>(),
48733            Self::ScBytes => gen.into_root_schema_for::<ScBytes>(),
48734            Self::ScString => gen.into_root_schema_for::<ScString>(),
48735            Self::ScSymbol => gen.into_root_schema_for::<ScSymbol>(),
48736            Self::ScNonceKey => gen.into_root_schema_for::<ScNonceKey>(),
48737            Self::ScContractInstance => gen.into_root_schema_for::<ScContractInstance>(),
48738            Self::ScVal => gen.into_root_schema_for::<ScVal>(),
48739            Self::ScMapEntry => gen.into_root_schema_for::<ScMapEntry>(),
48740            Self::StoredTransactionSet => gen.into_root_schema_for::<StoredTransactionSet>(),
48741            Self::StoredDebugTransactionSet => {
48742                gen.into_root_schema_for::<StoredDebugTransactionSet>()
48743            }
48744            Self::PersistedScpStateV0 => gen.into_root_schema_for::<PersistedScpStateV0>(),
48745            Self::PersistedScpStateV1 => gen.into_root_schema_for::<PersistedScpStateV1>(),
48746            Self::PersistedScpState => gen.into_root_schema_for::<PersistedScpState>(),
48747            Self::Thresholds => gen.into_root_schema_for::<Thresholds>(),
48748            Self::String32 => gen.into_root_schema_for::<String32>(),
48749            Self::String64 => gen.into_root_schema_for::<String64>(),
48750            Self::SequenceNumber => gen.into_root_schema_for::<SequenceNumber>(),
48751            Self::DataValue => gen.into_root_schema_for::<DataValue>(),
48752            Self::PoolId => gen.into_root_schema_for::<PoolId>(),
48753            Self::AssetCode4 => gen.into_root_schema_for::<AssetCode4>(),
48754            Self::AssetCode12 => gen.into_root_schema_for::<AssetCode12>(),
48755            Self::AssetType => gen.into_root_schema_for::<AssetType>(),
48756            Self::AssetCode => gen.into_root_schema_for::<AssetCode>(),
48757            Self::AlphaNum4 => gen.into_root_schema_for::<AlphaNum4>(),
48758            Self::AlphaNum12 => gen.into_root_schema_for::<AlphaNum12>(),
48759            Self::Asset => gen.into_root_schema_for::<Asset>(),
48760            Self::Price => gen.into_root_schema_for::<Price>(),
48761            Self::Liabilities => gen.into_root_schema_for::<Liabilities>(),
48762            Self::ThresholdIndexes => gen.into_root_schema_for::<ThresholdIndexes>(),
48763            Self::LedgerEntryType => gen.into_root_schema_for::<LedgerEntryType>(),
48764            Self::Signer => gen.into_root_schema_for::<Signer>(),
48765            Self::AccountFlags => gen.into_root_schema_for::<AccountFlags>(),
48766            Self::SponsorshipDescriptor => gen.into_root_schema_for::<SponsorshipDescriptor>(),
48767            Self::AccountEntryExtensionV3 => gen.into_root_schema_for::<AccountEntryExtensionV3>(),
48768            Self::AccountEntryExtensionV2 => gen.into_root_schema_for::<AccountEntryExtensionV2>(),
48769            Self::AccountEntryExtensionV2Ext => {
48770                gen.into_root_schema_for::<AccountEntryExtensionV2Ext>()
48771            }
48772            Self::AccountEntryExtensionV1 => gen.into_root_schema_for::<AccountEntryExtensionV1>(),
48773            Self::AccountEntryExtensionV1Ext => {
48774                gen.into_root_schema_for::<AccountEntryExtensionV1Ext>()
48775            }
48776            Self::AccountEntry => gen.into_root_schema_for::<AccountEntry>(),
48777            Self::AccountEntryExt => gen.into_root_schema_for::<AccountEntryExt>(),
48778            Self::TrustLineFlags => gen.into_root_schema_for::<TrustLineFlags>(),
48779            Self::LiquidityPoolType => gen.into_root_schema_for::<LiquidityPoolType>(),
48780            Self::TrustLineAsset => gen.into_root_schema_for::<TrustLineAsset>(),
48781            Self::TrustLineEntryExtensionV2 => {
48782                gen.into_root_schema_for::<TrustLineEntryExtensionV2>()
48783            }
48784            Self::TrustLineEntryExtensionV2Ext => {
48785                gen.into_root_schema_for::<TrustLineEntryExtensionV2Ext>()
48786            }
48787            Self::TrustLineEntry => gen.into_root_schema_for::<TrustLineEntry>(),
48788            Self::TrustLineEntryExt => gen.into_root_schema_for::<TrustLineEntryExt>(),
48789            Self::TrustLineEntryV1 => gen.into_root_schema_for::<TrustLineEntryV1>(),
48790            Self::TrustLineEntryV1Ext => gen.into_root_schema_for::<TrustLineEntryV1Ext>(),
48791            Self::OfferEntryFlags => gen.into_root_schema_for::<OfferEntryFlags>(),
48792            Self::OfferEntry => gen.into_root_schema_for::<OfferEntry>(),
48793            Self::OfferEntryExt => gen.into_root_schema_for::<OfferEntryExt>(),
48794            Self::DataEntry => gen.into_root_schema_for::<DataEntry>(),
48795            Self::DataEntryExt => gen.into_root_schema_for::<DataEntryExt>(),
48796            Self::ClaimPredicateType => gen.into_root_schema_for::<ClaimPredicateType>(),
48797            Self::ClaimPredicate => gen.into_root_schema_for::<ClaimPredicate>(),
48798            Self::ClaimantType => gen.into_root_schema_for::<ClaimantType>(),
48799            Self::Claimant => gen.into_root_schema_for::<Claimant>(),
48800            Self::ClaimantV0 => gen.into_root_schema_for::<ClaimantV0>(),
48801            Self::ClaimableBalanceIdType => gen.into_root_schema_for::<ClaimableBalanceIdType>(),
48802            Self::ClaimableBalanceId => gen.into_root_schema_for::<ClaimableBalanceId>(),
48803            Self::ClaimableBalanceFlags => gen.into_root_schema_for::<ClaimableBalanceFlags>(),
48804            Self::ClaimableBalanceEntryExtensionV1 => {
48805                gen.into_root_schema_for::<ClaimableBalanceEntryExtensionV1>()
48806            }
48807            Self::ClaimableBalanceEntryExtensionV1Ext => {
48808                gen.into_root_schema_for::<ClaimableBalanceEntryExtensionV1Ext>()
48809            }
48810            Self::ClaimableBalanceEntry => gen.into_root_schema_for::<ClaimableBalanceEntry>(),
48811            Self::ClaimableBalanceEntryExt => {
48812                gen.into_root_schema_for::<ClaimableBalanceEntryExt>()
48813            }
48814            Self::LiquidityPoolConstantProductParameters => {
48815                gen.into_root_schema_for::<LiquidityPoolConstantProductParameters>()
48816            }
48817            Self::LiquidityPoolEntry => gen.into_root_schema_for::<LiquidityPoolEntry>(),
48818            Self::LiquidityPoolEntryBody => gen.into_root_schema_for::<LiquidityPoolEntryBody>(),
48819            Self::LiquidityPoolEntryConstantProduct => {
48820                gen.into_root_schema_for::<LiquidityPoolEntryConstantProduct>()
48821            }
48822            Self::ContractDataDurability => gen.into_root_schema_for::<ContractDataDurability>(),
48823            Self::ContractDataEntry => gen.into_root_schema_for::<ContractDataEntry>(),
48824            Self::ContractCodeCostInputs => gen.into_root_schema_for::<ContractCodeCostInputs>(),
48825            Self::ContractCodeEntry => gen.into_root_schema_for::<ContractCodeEntry>(),
48826            Self::ContractCodeEntryExt => gen.into_root_schema_for::<ContractCodeEntryExt>(),
48827            Self::ContractCodeEntryV1 => gen.into_root_schema_for::<ContractCodeEntryV1>(),
48828            Self::TtlEntry => gen.into_root_schema_for::<TtlEntry>(),
48829            Self::LedgerEntryExtensionV1 => gen.into_root_schema_for::<LedgerEntryExtensionV1>(),
48830            Self::LedgerEntryExtensionV1Ext => {
48831                gen.into_root_schema_for::<LedgerEntryExtensionV1Ext>()
48832            }
48833            Self::LedgerEntry => gen.into_root_schema_for::<LedgerEntry>(),
48834            Self::LedgerEntryData => gen.into_root_schema_for::<LedgerEntryData>(),
48835            Self::LedgerEntryExt => gen.into_root_schema_for::<LedgerEntryExt>(),
48836            Self::LedgerKey => gen.into_root_schema_for::<LedgerKey>(),
48837            Self::LedgerKeyAccount => gen.into_root_schema_for::<LedgerKeyAccount>(),
48838            Self::LedgerKeyTrustLine => gen.into_root_schema_for::<LedgerKeyTrustLine>(),
48839            Self::LedgerKeyOffer => gen.into_root_schema_for::<LedgerKeyOffer>(),
48840            Self::LedgerKeyData => gen.into_root_schema_for::<LedgerKeyData>(),
48841            Self::LedgerKeyClaimableBalance => {
48842                gen.into_root_schema_for::<LedgerKeyClaimableBalance>()
48843            }
48844            Self::LedgerKeyLiquidityPool => gen.into_root_schema_for::<LedgerKeyLiquidityPool>(),
48845            Self::LedgerKeyContractData => gen.into_root_schema_for::<LedgerKeyContractData>(),
48846            Self::LedgerKeyContractCode => gen.into_root_schema_for::<LedgerKeyContractCode>(),
48847            Self::LedgerKeyConfigSetting => gen.into_root_schema_for::<LedgerKeyConfigSetting>(),
48848            Self::LedgerKeyTtl => gen.into_root_schema_for::<LedgerKeyTtl>(),
48849            Self::EnvelopeType => gen.into_root_schema_for::<EnvelopeType>(),
48850            Self::BucketListType => gen.into_root_schema_for::<BucketListType>(),
48851            Self::BucketEntryType => gen.into_root_schema_for::<BucketEntryType>(),
48852            Self::HotArchiveBucketEntryType => {
48853                gen.into_root_schema_for::<HotArchiveBucketEntryType>()
48854            }
48855            Self::ColdArchiveBucketEntryType => {
48856                gen.into_root_schema_for::<ColdArchiveBucketEntryType>()
48857            }
48858            Self::BucketMetadata => gen.into_root_schema_for::<BucketMetadata>(),
48859            Self::BucketMetadataExt => gen.into_root_schema_for::<BucketMetadataExt>(),
48860            Self::BucketEntry => gen.into_root_schema_for::<BucketEntry>(),
48861            Self::HotArchiveBucketEntry => gen.into_root_schema_for::<HotArchiveBucketEntry>(),
48862            Self::ColdArchiveArchivedLeaf => gen.into_root_schema_for::<ColdArchiveArchivedLeaf>(),
48863            Self::ColdArchiveDeletedLeaf => gen.into_root_schema_for::<ColdArchiveDeletedLeaf>(),
48864            Self::ColdArchiveBoundaryLeaf => gen.into_root_schema_for::<ColdArchiveBoundaryLeaf>(),
48865            Self::ColdArchiveHashEntry => gen.into_root_schema_for::<ColdArchiveHashEntry>(),
48866            Self::ColdArchiveBucketEntry => gen.into_root_schema_for::<ColdArchiveBucketEntry>(),
48867            Self::UpgradeType => gen.into_root_schema_for::<UpgradeType>(),
48868            Self::StellarValueType => gen.into_root_schema_for::<StellarValueType>(),
48869            Self::LedgerCloseValueSignature => {
48870                gen.into_root_schema_for::<LedgerCloseValueSignature>()
48871            }
48872            Self::StellarValue => gen.into_root_schema_for::<StellarValue>(),
48873            Self::StellarValueExt => gen.into_root_schema_for::<StellarValueExt>(),
48874            Self::LedgerHeaderFlags => gen.into_root_schema_for::<LedgerHeaderFlags>(),
48875            Self::LedgerHeaderExtensionV1 => gen.into_root_schema_for::<LedgerHeaderExtensionV1>(),
48876            Self::LedgerHeaderExtensionV1Ext => {
48877                gen.into_root_schema_for::<LedgerHeaderExtensionV1Ext>()
48878            }
48879            Self::LedgerHeader => gen.into_root_schema_for::<LedgerHeader>(),
48880            Self::LedgerHeaderExt => gen.into_root_schema_for::<LedgerHeaderExt>(),
48881            Self::LedgerUpgradeType => gen.into_root_schema_for::<LedgerUpgradeType>(),
48882            Self::ConfigUpgradeSetKey => gen.into_root_schema_for::<ConfigUpgradeSetKey>(),
48883            Self::LedgerUpgrade => gen.into_root_schema_for::<LedgerUpgrade>(),
48884            Self::ConfigUpgradeSet => gen.into_root_schema_for::<ConfigUpgradeSet>(),
48885            Self::TxSetComponentType => gen.into_root_schema_for::<TxSetComponentType>(),
48886            Self::TxExecutionThread => gen.into_root_schema_for::<TxExecutionThread>(),
48887            Self::ParallelTxExecutionStage => {
48888                gen.into_root_schema_for::<ParallelTxExecutionStage>()
48889            }
48890            Self::ParallelTxsComponent => gen.into_root_schema_for::<ParallelTxsComponent>(),
48891            Self::TxSetComponent => gen.into_root_schema_for::<TxSetComponent>(),
48892            Self::TxSetComponentTxsMaybeDiscountedFee => {
48893                gen.into_root_schema_for::<TxSetComponentTxsMaybeDiscountedFee>()
48894            }
48895            Self::TransactionPhase => gen.into_root_schema_for::<TransactionPhase>(),
48896            Self::TransactionSet => gen.into_root_schema_for::<TransactionSet>(),
48897            Self::TransactionSetV1 => gen.into_root_schema_for::<TransactionSetV1>(),
48898            Self::GeneralizedTransactionSet => {
48899                gen.into_root_schema_for::<GeneralizedTransactionSet>()
48900            }
48901            Self::TransactionResultPair => gen.into_root_schema_for::<TransactionResultPair>(),
48902            Self::TransactionResultSet => gen.into_root_schema_for::<TransactionResultSet>(),
48903            Self::TransactionHistoryEntry => gen.into_root_schema_for::<TransactionHistoryEntry>(),
48904            Self::TransactionHistoryEntryExt => {
48905                gen.into_root_schema_for::<TransactionHistoryEntryExt>()
48906            }
48907            Self::TransactionHistoryResultEntry => {
48908                gen.into_root_schema_for::<TransactionHistoryResultEntry>()
48909            }
48910            Self::TransactionHistoryResultEntryExt => {
48911                gen.into_root_schema_for::<TransactionHistoryResultEntryExt>()
48912            }
48913            Self::LedgerHeaderHistoryEntry => {
48914                gen.into_root_schema_for::<LedgerHeaderHistoryEntry>()
48915            }
48916            Self::LedgerHeaderHistoryEntryExt => {
48917                gen.into_root_schema_for::<LedgerHeaderHistoryEntryExt>()
48918            }
48919            Self::LedgerScpMessages => gen.into_root_schema_for::<LedgerScpMessages>(),
48920            Self::ScpHistoryEntryV0 => gen.into_root_schema_for::<ScpHistoryEntryV0>(),
48921            Self::ScpHistoryEntry => gen.into_root_schema_for::<ScpHistoryEntry>(),
48922            Self::LedgerEntryChangeType => gen.into_root_schema_for::<LedgerEntryChangeType>(),
48923            Self::LedgerEntryChange => gen.into_root_schema_for::<LedgerEntryChange>(),
48924            Self::LedgerEntryChanges => gen.into_root_schema_for::<LedgerEntryChanges>(),
48925            Self::OperationMeta => gen.into_root_schema_for::<OperationMeta>(),
48926            Self::TransactionMetaV1 => gen.into_root_schema_for::<TransactionMetaV1>(),
48927            Self::TransactionMetaV2 => gen.into_root_schema_for::<TransactionMetaV2>(),
48928            Self::ContractEventType => gen.into_root_schema_for::<ContractEventType>(),
48929            Self::ContractEvent => gen.into_root_schema_for::<ContractEvent>(),
48930            Self::ContractEventBody => gen.into_root_schema_for::<ContractEventBody>(),
48931            Self::ContractEventV0 => gen.into_root_schema_for::<ContractEventV0>(),
48932            Self::DiagnosticEvent => gen.into_root_schema_for::<DiagnosticEvent>(),
48933            Self::SorobanTransactionMetaExtV1 => {
48934                gen.into_root_schema_for::<SorobanTransactionMetaExtV1>()
48935            }
48936            Self::SorobanTransactionMetaExt => {
48937                gen.into_root_schema_for::<SorobanTransactionMetaExt>()
48938            }
48939            Self::SorobanTransactionMeta => gen.into_root_schema_for::<SorobanTransactionMeta>(),
48940            Self::TransactionMetaV3 => gen.into_root_schema_for::<TransactionMetaV3>(),
48941            Self::InvokeHostFunctionSuccessPreImage => {
48942                gen.into_root_schema_for::<InvokeHostFunctionSuccessPreImage>()
48943            }
48944            Self::TransactionMeta => gen.into_root_schema_for::<TransactionMeta>(),
48945            Self::TransactionResultMeta => gen.into_root_schema_for::<TransactionResultMeta>(),
48946            Self::UpgradeEntryMeta => gen.into_root_schema_for::<UpgradeEntryMeta>(),
48947            Self::LedgerCloseMetaV0 => gen.into_root_schema_for::<LedgerCloseMetaV0>(),
48948            Self::LedgerCloseMetaExtV1 => gen.into_root_schema_for::<LedgerCloseMetaExtV1>(),
48949            Self::LedgerCloseMetaExtV2 => gen.into_root_schema_for::<LedgerCloseMetaExtV2>(),
48950            Self::LedgerCloseMetaExt => gen.into_root_schema_for::<LedgerCloseMetaExt>(),
48951            Self::LedgerCloseMetaV1 => gen.into_root_schema_for::<LedgerCloseMetaV1>(),
48952            Self::LedgerCloseMeta => gen.into_root_schema_for::<LedgerCloseMeta>(),
48953            Self::ErrorCode => gen.into_root_schema_for::<ErrorCode>(),
48954            Self::SError => gen.into_root_schema_for::<SError>(),
48955            Self::SendMore => gen.into_root_schema_for::<SendMore>(),
48956            Self::SendMoreExtended => gen.into_root_schema_for::<SendMoreExtended>(),
48957            Self::AuthCert => gen.into_root_schema_for::<AuthCert>(),
48958            Self::Hello => gen.into_root_schema_for::<Hello>(),
48959            Self::Auth => gen.into_root_schema_for::<Auth>(),
48960            Self::IpAddrType => gen.into_root_schema_for::<IpAddrType>(),
48961            Self::PeerAddress => gen.into_root_schema_for::<PeerAddress>(),
48962            Self::PeerAddressIp => gen.into_root_schema_for::<PeerAddressIp>(),
48963            Self::MessageType => gen.into_root_schema_for::<MessageType>(),
48964            Self::DontHave => gen.into_root_schema_for::<DontHave>(),
48965            Self::SurveyMessageCommandType => {
48966                gen.into_root_schema_for::<SurveyMessageCommandType>()
48967            }
48968            Self::SurveyMessageResponseType => {
48969                gen.into_root_schema_for::<SurveyMessageResponseType>()
48970            }
48971            Self::TimeSlicedSurveyStartCollectingMessage => {
48972                gen.into_root_schema_for::<TimeSlicedSurveyStartCollectingMessage>()
48973            }
48974            Self::SignedTimeSlicedSurveyStartCollectingMessage => {
48975                gen.into_root_schema_for::<SignedTimeSlicedSurveyStartCollectingMessage>()
48976            }
48977            Self::TimeSlicedSurveyStopCollectingMessage => {
48978                gen.into_root_schema_for::<TimeSlicedSurveyStopCollectingMessage>()
48979            }
48980            Self::SignedTimeSlicedSurveyStopCollectingMessage => {
48981                gen.into_root_schema_for::<SignedTimeSlicedSurveyStopCollectingMessage>()
48982            }
48983            Self::SurveyRequestMessage => gen.into_root_schema_for::<SurveyRequestMessage>(),
48984            Self::TimeSlicedSurveyRequestMessage => {
48985                gen.into_root_schema_for::<TimeSlicedSurveyRequestMessage>()
48986            }
48987            Self::SignedSurveyRequestMessage => {
48988                gen.into_root_schema_for::<SignedSurveyRequestMessage>()
48989            }
48990            Self::SignedTimeSlicedSurveyRequestMessage => {
48991                gen.into_root_schema_for::<SignedTimeSlicedSurveyRequestMessage>()
48992            }
48993            Self::EncryptedBody => gen.into_root_schema_for::<EncryptedBody>(),
48994            Self::SurveyResponseMessage => gen.into_root_schema_for::<SurveyResponseMessage>(),
48995            Self::TimeSlicedSurveyResponseMessage => {
48996                gen.into_root_schema_for::<TimeSlicedSurveyResponseMessage>()
48997            }
48998            Self::SignedSurveyResponseMessage => {
48999                gen.into_root_schema_for::<SignedSurveyResponseMessage>()
49000            }
49001            Self::SignedTimeSlicedSurveyResponseMessage => {
49002                gen.into_root_schema_for::<SignedTimeSlicedSurveyResponseMessage>()
49003            }
49004            Self::PeerStats => gen.into_root_schema_for::<PeerStats>(),
49005            Self::PeerStatList => gen.into_root_schema_for::<PeerStatList>(),
49006            Self::TimeSlicedNodeData => gen.into_root_schema_for::<TimeSlicedNodeData>(),
49007            Self::TimeSlicedPeerData => gen.into_root_schema_for::<TimeSlicedPeerData>(),
49008            Self::TimeSlicedPeerDataList => gen.into_root_schema_for::<TimeSlicedPeerDataList>(),
49009            Self::TopologyResponseBodyV0 => gen.into_root_schema_for::<TopologyResponseBodyV0>(),
49010            Self::TopologyResponseBodyV1 => gen.into_root_schema_for::<TopologyResponseBodyV1>(),
49011            Self::TopologyResponseBodyV2 => gen.into_root_schema_for::<TopologyResponseBodyV2>(),
49012            Self::SurveyResponseBody => gen.into_root_schema_for::<SurveyResponseBody>(),
49013            Self::TxAdvertVector => gen.into_root_schema_for::<TxAdvertVector>(),
49014            Self::FloodAdvert => gen.into_root_schema_for::<FloodAdvert>(),
49015            Self::TxDemandVector => gen.into_root_schema_for::<TxDemandVector>(),
49016            Self::FloodDemand => gen.into_root_schema_for::<FloodDemand>(),
49017            Self::StellarMessage => gen.into_root_schema_for::<StellarMessage>(),
49018            Self::AuthenticatedMessage => gen.into_root_schema_for::<AuthenticatedMessage>(),
49019            Self::AuthenticatedMessageV0 => gen.into_root_schema_for::<AuthenticatedMessageV0>(),
49020            Self::LiquidityPoolParameters => gen.into_root_schema_for::<LiquidityPoolParameters>(),
49021            Self::MuxedAccount => gen.into_root_schema_for::<MuxedAccount>(),
49022            Self::MuxedAccountMed25519 => gen.into_root_schema_for::<MuxedAccountMed25519>(),
49023            Self::DecoratedSignature => gen.into_root_schema_for::<DecoratedSignature>(),
49024            Self::OperationType => gen.into_root_schema_for::<OperationType>(),
49025            Self::CreateAccountOp => gen.into_root_schema_for::<CreateAccountOp>(),
49026            Self::PaymentOp => gen.into_root_schema_for::<PaymentOp>(),
49027            Self::PathPaymentStrictReceiveOp => {
49028                gen.into_root_schema_for::<PathPaymentStrictReceiveOp>()
49029            }
49030            Self::PathPaymentStrictSendOp => gen.into_root_schema_for::<PathPaymentStrictSendOp>(),
49031            Self::ManageSellOfferOp => gen.into_root_schema_for::<ManageSellOfferOp>(),
49032            Self::ManageBuyOfferOp => gen.into_root_schema_for::<ManageBuyOfferOp>(),
49033            Self::CreatePassiveSellOfferOp => {
49034                gen.into_root_schema_for::<CreatePassiveSellOfferOp>()
49035            }
49036            Self::SetOptionsOp => gen.into_root_schema_for::<SetOptionsOp>(),
49037            Self::ChangeTrustAsset => gen.into_root_schema_for::<ChangeTrustAsset>(),
49038            Self::ChangeTrustOp => gen.into_root_schema_for::<ChangeTrustOp>(),
49039            Self::AllowTrustOp => gen.into_root_schema_for::<AllowTrustOp>(),
49040            Self::ManageDataOp => gen.into_root_schema_for::<ManageDataOp>(),
49041            Self::BumpSequenceOp => gen.into_root_schema_for::<BumpSequenceOp>(),
49042            Self::CreateClaimableBalanceOp => {
49043                gen.into_root_schema_for::<CreateClaimableBalanceOp>()
49044            }
49045            Self::ClaimClaimableBalanceOp => gen.into_root_schema_for::<ClaimClaimableBalanceOp>(),
49046            Self::BeginSponsoringFutureReservesOp => {
49047                gen.into_root_schema_for::<BeginSponsoringFutureReservesOp>()
49048            }
49049            Self::RevokeSponsorshipType => gen.into_root_schema_for::<RevokeSponsorshipType>(),
49050            Self::RevokeSponsorshipOp => gen.into_root_schema_for::<RevokeSponsorshipOp>(),
49051            Self::RevokeSponsorshipOpSigner => {
49052                gen.into_root_schema_for::<RevokeSponsorshipOpSigner>()
49053            }
49054            Self::ClawbackOp => gen.into_root_schema_for::<ClawbackOp>(),
49055            Self::ClawbackClaimableBalanceOp => {
49056                gen.into_root_schema_for::<ClawbackClaimableBalanceOp>()
49057            }
49058            Self::SetTrustLineFlagsOp => gen.into_root_schema_for::<SetTrustLineFlagsOp>(),
49059            Self::LiquidityPoolDepositOp => gen.into_root_schema_for::<LiquidityPoolDepositOp>(),
49060            Self::LiquidityPoolWithdrawOp => gen.into_root_schema_for::<LiquidityPoolWithdrawOp>(),
49061            Self::HostFunctionType => gen.into_root_schema_for::<HostFunctionType>(),
49062            Self::ContractIdPreimageType => gen.into_root_schema_for::<ContractIdPreimageType>(),
49063            Self::ContractIdPreimage => gen.into_root_schema_for::<ContractIdPreimage>(),
49064            Self::ContractIdPreimageFromAddress => {
49065                gen.into_root_schema_for::<ContractIdPreimageFromAddress>()
49066            }
49067            Self::CreateContractArgs => gen.into_root_schema_for::<CreateContractArgs>(),
49068            Self::CreateContractArgsV2 => gen.into_root_schema_for::<CreateContractArgsV2>(),
49069            Self::InvokeContractArgs => gen.into_root_schema_for::<InvokeContractArgs>(),
49070            Self::HostFunction => gen.into_root_schema_for::<HostFunction>(),
49071            Self::SorobanAuthorizedFunctionType => {
49072                gen.into_root_schema_for::<SorobanAuthorizedFunctionType>()
49073            }
49074            Self::SorobanAuthorizedFunction => {
49075                gen.into_root_schema_for::<SorobanAuthorizedFunction>()
49076            }
49077            Self::SorobanAuthorizedInvocation => {
49078                gen.into_root_schema_for::<SorobanAuthorizedInvocation>()
49079            }
49080            Self::SorobanAddressCredentials => {
49081                gen.into_root_schema_for::<SorobanAddressCredentials>()
49082            }
49083            Self::SorobanCredentialsType => gen.into_root_schema_for::<SorobanCredentialsType>(),
49084            Self::SorobanCredentials => gen.into_root_schema_for::<SorobanCredentials>(),
49085            Self::SorobanAuthorizationEntry => {
49086                gen.into_root_schema_for::<SorobanAuthorizationEntry>()
49087            }
49088            Self::InvokeHostFunctionOp => gen.into_root_schema_for::<InvokeHostFunctionOp>(),
49089            Self::ExtendFootprintTtlOp => gen.into_root_schema_for::<ExtendFootprintTtlOp>(),
49090            Self::RestoreFootprintOp => gen.into_root_schema_for::<RestoreFootprintOp>(),
49091            Self::Operation => gen.into_root_schema_for::<Operation>(),
49092            Self::OperationBody => gen.into_root_schema_for::<OperationBody>(),
49093            Self::HashIdPreimage => gen.into_root_schema_for::<HashIdPreimage>(),
49094            Self::HashIdPreimageOperationId => {
49095                gen.into_root_schema_for::<HashIdPreimageOperationId>()
49096            }
49097            Self::HashIdPreimageRevokeId => gen.into_root_schema_for::<HashIdPreimageRevokeId>(),
49098            Self::HashIdPreimageContractId => {
49099                gen.into_root_schema_for::<HashIdPreimageContractId>()
49100            }
49101            Self::HashIdPreimageSorobanAuthorization => {
49102                gen.into_root_schema_for::<HashIdPreimageSorobanAuthorization>()
49103            }
49104            Self::MemoType => gen.into_root_schema_for::<MemoType>(),
49105            Self::Memo => gen.into_root_schema_for::<Memo>(),
49106            Self::TimeBounds => gen.into_root_schema_for::<TimeBounds>(),
49107            Self::LedgerBounds => gen.into_root_schema_for::<LedgerBounds>(),
49108            Self::PreconditionsV2 => gen.into_root_schema_for::<PreconditionsV2>(),
49109            Self::PreconditionType => gen.into_root_schema_for::<PreconditionType>(),
49110            Self::Preconditions => gen.into_root_schema_for::<Preconditions>(),
49111            Self::LedgerFootprint => gen.into_root_schema_for::<LedgerFootprint>(),
49112            Self::ArchivalProofType => gen.into_root_schema_for::<ArchivalProofType>(),
49113            Self::ArchivalProofNode => gen.into_root_schema_for::<ArchivalProofNode>(),
49114            Self::ProofLevel => gen.into_root_schema_for::<ProofLevel>(),
49115            Self::ExistenceProofBody => gen.into_root_schema_for::<ExistenceProofBody>(),
49116            Self::NonexistenceProofBody => gen.into_root_schema_for::<NonexistenceProofBody>(),
49117            Self::ArchivalProof => gen.into_root_schema_for::<ArchivalProof>(),
49118            Self::ArchivalProofBody => gen.into_root_schema_for::<ArchivalProofBody>(),
49119            Self::SorobanResources => gen.into_root_schema_for::<SorobanResources>(),
49120            Self::SorobanTransactionData => gen.into_root_schema_for::<SorobanTransactionData>(),
49121            Self::SorobanTransactionDataExt => {
49122                gen.into_root_schema_for::<SorobanTransactionDataExt>()
49123            }
49124            Self::TransactionV0 => gen.into_root_schema_for::<TransactionV0>(),
49125            Self::TransactionV0Ext => gen.into_root_schema_for::<TransactionV0Ext>(),
49126            Self::TransactionV0Envelope => gen.into_root_schema_for::<TransactionV0Envelope>(),
49127            Self::Transaction => gen.into_root_schema_for::<Transaction>(),
49128            Self::TransactionExt => gen.into_root_schema_for::<TransactionExt>(),
49129            Self::TransactionV1Envelope => gen.into_root_schema_for::<TransactionV1Envelope>(),
49130            Self::FeeBumpTransaction => gen.into_root_schema_for::<FeeBumpTransaction>(),
49131            Self::FeeBumpTransactionInnerTx => {
49132                gen.into_root_schema_for::<FeeBumpTransactionInnerTx>()
49133            }
49134            Self::FeeBumpTransactionExt => gen.into_root_schema_for::<FeeBumpTransactionExt>(),
49135            Self::FeeBumpTransactionEnvelope => {
49136                gen.into_root_schema_for::<FeeBumpTransactionEnvelope>()
49137            }
49138            Self::TransactionEnvelope => gen.into_root_schema_for::<TransactionEnvelope>(),
49139            Self::TransactionSignaturePayload => {
49140                gen.into_root_schema_for::<TransactionSignaturePayload>()
49141            }
49142            Self::TransactionSignaturePayloadTaggedTransaction => {
49143                gen.into_root_schema_for::<TransactionSignaturePayloadTaggedTransaction>()
49144            }
49145            Self::ClaimAtomType => gen.into_root_schema_for::<ClaimAtomType>(),
49146            Self::ClaimOfferAtomV0 => gen.into_root_schema_for::<ClaimOfferAtomV0>(),
49147            Self::ClaimOfferAtom => gen.into_root_schema_for::<ClaimOfferAtom>(),
49148            Self::ClaimLiquidityAtom => gen.into_root_schema_for::<ClaimLiquidityAtom>(),
49149            Self::ClaimAtom => gen.into_root_schema_for::<ClaimAtom>(),
49150            Self::CreateAccountResultCode => gen.into_root_schema_for::<CreateAccountResultCode>(),
49151            Self::CreateAccountResult => gen.into_root_schema_for::<CreateAccountResult>(),
49152            Self::PaymentResultCode => gen.into_root_schema_for::<PaymentResultCode>(),
49153            Self::PaymentResult => gen.into_root_schema_for::<PaymentResult>(),
49154            Self::PathPaymentStrictReceiveResultCode => {
49155                gen.into_root_schema_for::<PathPaymentStrictReceiveResultCode>()
49156            }
49157            Self::SimplePaymentResult => gen.into_root_schema_for::<SimplePaymentResult>(),
49158            Self::PathPaymentStrictReceiveResult => {
49159                gen.into_root_schema_for::<PathPaymentStrictReceiveResult>()
49160            }
49161            Self::PathPaymentStrictReceiveResultSuccess => {
49162                gen.into_root_schema_for::<PathPaymentStrictReceiveResultSuccess>()
49163            }
49164            Self::PathPaymentStrictSendResultCode => {
49165                gen.into_root_schema_for::<PathPaymentStrictSendResultCode>()
49166            }
49167            Self::PathPaymentStrictSendResult => {
49168                gen.into_root_schema_for::<PathPaymentStrictSendResult>()
49169            }
49170            Self::PathPaymentStrictSendResultSuccess => {
49171                gen.into_root_schema_for::<PathPaymentStrictSendResultSuccess>()
49172            }
49173            Self::ManageSellOfferResultCode => {
49174                gen.into_root_schema_for::<ManageSellOfferResultCode>()
49175            }
49176            Self::ManageOfferEffect => gen.into_root_schema_for::<ManageOfferEffect>(),
49177            Self::ManageOfferSuccessResult => {
49178                gen.into_root_schema_for::<ManageOfferSuccessResult>()
49179            }
49180            Self::ManageOfferSuccessResultOffer => {
49181                gen.into_root_schema_for::<ManageOfferSuccessResultOffer>()
49182            }
49183            Self::ManageSellOfferResult => gen.into_root_schema_for::<ManageSellOfferResult>(),
49184            Self::ManageBuyOfferResultCode => {
49185                gen.into_root_schema_for::<ManageBuyOfferResultCode>()
49186            }
49187            Self::ManageBuyOfferResult => gen.into_root_schema_for::<ManageBuyOfferResult>(),
49188            Self::SetOptionsResultCode => gen.into_root_schema_for::<SetOptionsResultCode>(),
49189            Self::SetOptionsResult => gen.into_root_schema_for::<SetOptionsResult>(),
49190            Self::ChangeTrustResultCode => gen.into_root_schema_for::<ChangeTrustResultCode>(),
49191            Self::ChangeTrustResult => gen.into_root_schema_for::<ChangeTrustResult>(),
49192            Self::AllowTrustResultCode => gen.into_root_schema_for::<AllowTrustResultCode>(),
49193            Self::AllowTrustResult => gen.into_root_schema_for::<AllowTrustResult>(),
49194            Self::AccountMergeResultCode => gen.into_root_schema_for::<AccountMergeResultCode>(),
49195            Self::AccountMergeResult => gen.into_root_schema_for::<AccountMergeResult>(),
49196            Self::InflationResultCode => gen.into_root_schema_for::<InflationResultCode>(),
49197            Self::InflationPayout => gen.into_root_schema_for::<InflationPayout>(),
49198            Self::InflationResult => gen.into_root_schema_for::<InflationResult>(),
49199            Self::ManageDataResultCode => gen.into_root_schema_for::<ManageDataResultCode>(),
49200            Self::ManageDataResult => gen.into_root_schema_for::<ManageDataResult>(),
49201            Self::BumpSequenceResultCode => gen.into_root_schema_for::<BumpSequenceResultCode>(),
49202            Self::BumpSequenceResult => gen.into_root_schema_for::<BumpSequenceResult>(),
49203            Self::CreateClaimableBalanceResultCode => {
49204                gen.into_root_schema_for::<CreateClaimableBalanceResultCode>()
49205            }
49206            Self::CreateClaimableBalanceResult => {
49207                gen.into_root_schema_for::<CreateClaimableBalanceResult>()
49208            }
49209            Self::ClaimClaimableBalanceResultCode => {
49210                gen.into_root_schema_for::<ClaimClaimableBalanceResultCode>()
49211            }
49212            Self::ClaimClaimableBalanceResult => {
49213                gen.into_root_schema_for::<ClaimClaimableBalanceResult>()
49214            }
49215            Self::BeginSponsoringFutureReservesResultCode => {
49216                gen.into_root_schema_for::<BeginSponsoringFutureReservesResultCode>()
49217            }
49218            Self::BeginSponsoringFutureReservesResult => {
49219                gen.into_root_schema_for::<BeginSponsoringFutureReservesResult>()
49220            }
49221            Self::EndSponsoringFutureReservesResultCode => {
49222                gen.into_root_schema_for::<EndSponsoringFutureReservesResultCode>()
49223            }
49224            Self::EndSponsoringFutureReservesResult => {
49225                gen.into_root_schema_for::<EndSponsoringFutureReservesResult>()
49226            }
49227            Self::RevokeSponsorshipResultCode => {
49228                gen.into_root_schema_for::<RevokeSponsorshipResultCode>()
49229            }
49230            Self::RevokeSponsorshipResult => gen.into_root_schema_for::<RevokeSponsorshipResult>(),
49231            Self::ClawbackResultCode => gen.into_root_schema_for::<ClawbackResultCode>(),
49232            Self::ClawbackResult => gen.into_root_schema_for::<ClawbackResult>(),
49233            Self::ClawbackClaimableBalanceResultCode => {
49234                gen.into_root_schema_for::<ClawbackClaimableBalanceResultCode>()
49235            }
49236            Self::ClawbackClaimableBalanceResult => {
49237                gen.into_root_schema_for::<ClawbackClaimableBalanceResult>()
49238            }
49239            Self::SetTrustLineFlagsResultCode => {
49240                gen.into_root_schema_for::<SetTrustLineFlagsResultCode>()
49241            }
49242            Self::SetTrustLineFlagsResult => gen.into_root_schema_for::<SetTrustLineFlagsResult>(),
49243            Self::LiquidityPoolDepositResultCode => {
49244                gen.into_root_schema_for::<LiquidityPoolDepositResultCode>()
49245            }
49246            Self::LiquidityPoolDepositResult => {
49247                gen.into_root_schema_for::<LiquidityPoolDepositResult>()
49248            }
49249            Self::LiquidityPoolWithdrawResultCode => {
49250                gen.into_root_schema_for::<LiquidityPoolWithdrawResultCode>()
49251            }
49252            Self::LiquidityPoolWithdrawResult => {
49253                gen.into_root_schema_for::<LiquidityPoolWithdrawResult>()
49254            }
49255            Self::InvokeHostFunctionResultCode => {
49256                gen.into_root_schema_for::<InvokeHostFunctionResultCode>()
49257            }
49258            Self::InvokeHostFunctionResult => {
49259                gen.into_root_schema_for::<InvokeHostFunctionResult>()
49260            }
49261            Self::ExtendFootprintTtlResultCode => {
49262                gen.into_root_schema_for::<ExtendFootprintTtlResultCode>()
49263            }
49264            Self::ExtendFootprintTtlResult => {
49265                gen.into_root_schema_for::<ExtendFootprintTtlResult>()
49266            }
49267            Self::RestoreFootprintResultCode => {
49268                gen.into_root_schema_for::<RestoreFootprintResultCode>()
49269            }
49270            Self::RestoreFootprintResult => gen.into_root_schema_for::<RestoreFootprintResult>(),
49271            Self::OperationResultCode => gen.into_root_schema_for::<OperationResultCode>(),
49272            Self::OperationResult => gen.into_root_schema_for::<OperationResult>(),
49273            Self::OperationResultTr => gen.into_root_schema_for::<OperationResultTr>(),
49274            Self::TransactionResultCode => gen.into_root_schema_for::<TransactionResultCode>(),
49275            Self::InnerTransactionResult => gen.into_root_schema_for::<InnerTransactionResult>(),
49276            Self::InnerTransactionResultResult => {
49277                gen.into_root_schema_for::<InnerTransactionResultResult>()
49278            }
49279            Self::InnerTransactionResultExt => {
49280                gen.into_root_schema_for::<InnerTransactionResultExt>()
49281            }
49282            Self::InnerTransactionResultPair => {
49283                gen.into_root_schema_for::<InnerTransactionResultPair>()
49284            }
49285            Self::TransactionResult => gen.into_root_schema_for::<TransactionResult>(),
49286            Self::TransactionResultResult => gen.into_root_schema_for::<TransactionResultResult>(),
49287            Self::TransactionResultExt => gen.into_root_schema_for::<TransactionResultExt>(),
49288            Self::Hash => gen.into_root_schema_for::<Hash>(),
49289            Self::Uint256 => gen.into_root_schema_for::<Uint256>(),
49290            Self::Uint32 => gen.into_root_schema_for::<Uint32>(),
49291            Self::Int32 => gen.into_root_schema_for::<Int32>(),
49292            Self::Uint64 => gen.into_root_schema_for::<Uint64>(),
49293            Self::Int64 => gen.into_root_schema_for::<Int64>(),
49294            Self::TimePoint => gen.into_root_schema_for::<TimePoint>(),
49295            Self::Duration => gen.into_root_schema_for::<Duration>(),
49296            Self::ExtensionPoint => gen.into_root_schema_for::<ExtensionPoint>(),
49297            Self::CryptoKeyType => gen.into_root_schema_for::<CryptoKeyType>(),
49298            Self::PublicKeyType => gen.into_root_schema_for::<PublicKeyType>(),
49299            Self::SignerKeyType => gen.into_root_schema_for::<SignerKeyType>(),
49300            Self::PublicKey => gen.into_root_schema_for::<PublicKey>(),
49301            Self::SignerKey => gen.into_root_schema_for::<SignerKey>(),
49302            Self::SignerKeyEd25519SignedPayload => {
49303                gen.into_root_schema_for::<SignerKeyEd25519SignedPayload>()
49304            }
49305            Self::Signature => gen.into_root_schema_for::<Signature>(),
49306            Self::SignatureHint => gen.into_root_schema_for::<SignatureHint>(),
49307            Self::NodeId => gen.into_root_schema_for::<NodeId>(),
49308            Self::AccountId => gen.into_root_schema_for::<AccountId>(),
49309            Self::Curve25519Secret => gen.into_root_schema_for::<Curve25519Secret>(),
49310            Self::Curve25519Public => gen.into_root_schema_for::<Curve25519Public>(),
49311            Self::HmacSha256Key => gen.into_root_schema_for::<HmacSha256Key>(),
49312            Self::HmacSha256Mac => gen.into_root_schema_for::<HmacSha256Mac>(),
49313            Self::ShortHashSeed => gen.into_root_schema_for::<ShortHashSeed>(),
49314            Self::BinaryFuseFilterType => gen.into_root_schema_for::<BinaryFuseFilterType>(),
49315            Self::SerializedBinaryFuseFilter => {
49316                gen.into_root_schema_for::<SerializedBinaryFuseFilter>()
49317            }
49318        }
49319    }
49320}
49321
49322impl Name for TypeVariant {
49323    #[must_use]
49324    fn name(&self) -> &'static str {
49325        Self::name(self)
49326    }
49327}
49328
49329impl Variants<TypeVariant> for TypeVariant {
49330    fn variants() -> slice::Iter<'static, TypeVariant> {
49331        Self::VARIANTS.iter()
49332    }
49333}
49334
49335impl core::str::FromStr for TypeVariant {
49336    type Err = Error;
49337    #[allow(clippy::too_many_lines)]
49338    fn from_str(s: &str) -> Result<Self> {
49339        match s {
49340            "Value" => Ok(Self::Value),
49341            "ScpBallot" => Ok(Self::ScpBallot),
49342            "ScpStatementType" => Ok(Self::ScpStatementType),
49343            "ScpNomination" => Ok(Self::ScpNomination),
49344            "ScpStatement" => Ok(Self::ScpStatement),
49345            "ScpStatementPledges" => Ok(Self::ScpStatementPledges),
49346            "ScpStatementPrepare" => Ok(Self::ScpStatementPrepare),
49347            "ScpStatementConfirm" => Ok(Self::ScpStatementConfirm),
49348            "ScpStatementExternalize" => Ok(Self::ScpStatementExternalize),
49349            "ScpEnvelope" => Ok(Self::ScpEnvelope),
49350            "ScpQuorumSet" => Ok(Self::ScpQuorumSet),
49351            "ConfigSettingContractExecutionLanesV0" => {
49352                Ok(Self::ConfigSettingContractExecutionLanesV0)
49353            }
49354            "ConfigSettingContractComputeV0" => Ok(Self::ConfigSettingContractComputeV0),
49355            "ConfigSettingContractParallelComputeV0" => {
49356                Ok(Self::ConfigSettingContractParallelComputeV0)
49357            }
49358            "ConfigSettingContractLedgerCostV0" => Ok(Self::ConfigSettingContractLedgerCostV0),
49359            "ConfigSettingContractHistoricalDataV0" => {
49360                Ok(Self::ConfigSettingContractHistoricalDataV0)
49361            }
49362            "ConfigSettingContractEventsV0" => Ok(Self::ConfigSettingContractEventsV0),
49363            "ConfigSettingContractBandwidthV0" => Ok(Self::ConfigSettingContractBandwidthV0),
49364            "ContractCostType" => Ok(Self::ContractCostType),
49365            "ContractCostParamEntry" => Ok(Self::ContractCostParamEntry),
49366            "StateArchivalSettings" => Ok(Self::StateArchivalSettings),
49367            "EvictionIterator" => Ok(Self::EvictionIterator),
49368            "ContractCostParams" => Ok(Self::ContractCostParams),
49369            "ConfigSettingId" => Ok(Self::ConfigSettingId),
49370            "ConfigSettingEntry" => Ok(Self::ConfigSettingEntry),
49371            "ScEnvMetaKind" => Ok(Self::ScEnvMetaKind),
49372            "ScEnvMetaEntry" => Ok(Self::ScEnvMetaEntry),
49373            "ScEnvMetaEntryInterfaceVersion" => Ok(Self::ScEnvMetaEntryInterfaceVersion),
49374            "ScMetaV0" => Ok(Self::ScMetaV0),
49375            "ScMetaKind" => Ok(Self::ScMetaKind),
49376            "ScMetaEntry" => Ok(Self::ScMetaEntry),
49377            "ScSpecType" => Ok(Self::ScSpecType),
49378            "ScSpecTypeOption" => Ok(Self::ScSpecTypeOption),
49379            "ScSpecTypeResult" => Ok(Self::ScSpecTypeResult),
49380            "ScSpecTypeVec" => Ok(Self::ScSpecTypeVec),
49381            "ScSpecTypeMap" => Ok(Self::ScSpecTypeMap),
49382            "ScSpecTypeTuple" => Ok(Self::ScSpecTypeTuple),
49383            "ScSpecTypeBytesN" => Ok(Self::ScSpecTypeBytesN),
49384            "ScSpecTypeUdt" => Ok(Self::ScSpecTypeUdt),
49385            "ScSpecTypeDef" => Ok(Self::ScSpecTypeDef),
49386            "ScSpecUdtStructFieldV0" => Ok(Self::ScSpecUdtStructFieldV0),
49387            "ScSpecUdtStructV0" => Ok(Self::ScSpecUdtStructV0),
49388            "ScSpecUdtUnionCaseVoidV0" => Ok(Self::ScSpecUdtUnionCaseVoidV0),
49389            "ScSpecUdtUnionCaseTupleV0" => Ok(Self::ScSpecUdtUnionCaseTupleV0),
49390            "ScSpecUdtUnionCaseV0Kind" => Ok(Self::ScSpecUdtUnionCaseV0Kind),
49391            "ScSpecUdtUnionCaseV0" => Ok(Self::ScSpecUdtUnionCaseV0),
49392            "ScSpecUdtUnionV0" => Ok(Self::ScSpecUdtUnionV0),
49393            "ScSpecUdtEnumCaseV0" => Ok(Self::ScSpecUdtEnumCaseV0),
49394            "ScSpecUdtEnumV0" => Ok(Self::ScSpecUdtEnumV0),
49395            "ScSpecUdtErrorEnumCaseV0" => Ok(Self::ScSpecUdtErrorEnumCaseV0),
49396            "ScSpecUdtErrorEnumV0" => Ok(Self::ScSpecUdtErrorEnumV0),
49397            "ScSpecFunctionInputV0" => Ok(Self::ScSpecFunctionInputV0),
49398            "ScSpecFunctionV0" => Ok(Self::ScSpecFunctionV0),
49399            "ScSpecEntryKind" => Ok(Self::ScSpecEntryKind),
49400            "ScSpecEntry" => Ok(Self::ScSpecEntry),
49401            "ScValType" => Ok(Self::ScValType),
49402            "ScErrorType" => Ok(Self::ScErrorType),
49403            "ScErrorCode" => Ok(Self::ScErrorCode),
49404            "ScError" => Ok(Self::ScError),
49405            "UInt128Parts" => Ok(Self::UInt128Parts),
49406            "Int128Parts" => Ok(Self::Int128Parts),
49407            "UInt256Parts" => Ok(Self::UInt256Parts),
49408            "Int256Parts" => Ok(Self::Int256Parts),
49409            "ContractExecutableType" => Ok(Self::ContractExecutableType),
49410            "ContractExecutable" => Ok(Self::ContractExecutable),
49411            "ScAddressType" => Ok(Self::ScAddressType),
49412            "ScAddress" => Ok(Self::ScAddress),
49413            "ScVec" => Ok(Self::ScVec),
49414            "ScMap" => Ok(Self::ScMap),
49415            "ScBytes" => Ok(Self::ScBytes),
49416            "ScString" => Ok(Self::ScString),
49417            "ScSymbol" => Ok(Self::ScSymbol),
49418            "ScNonceKey" => Ok(Self::ScNonceKey),
49419            "ScContractInstance" => Ok(Self::ScContractInstance),
49420            "ScVal" => Ok(Self::ScVal),
49421            "ScMapEntry" => Ok(Self::ScMapEntry),
49422            "StoredTransactionSet" => Ok(Self::StoredTransactionSet),
49423            "StoredDebugTransactionSet" => Ok(Self::StoredDebugTransactionSet),
49424            "PersistedScpStateV0" => Ok(Self::PersistedScpStateV0),
49425            "PersistedScpStateV1" => Ok(Self::PersistedScpStateV1),
49426            "PersistedScpState" => Ok(Self::PersistedScpState),
49427            "Thresholds" => Ok(Self::Thresholds),
49428            "String32" => Ok(Self::String32),
49429            "String64" => Ok(Self::String64),
49430            "SequenceNumber" => Ok(Self::SequenceNumber),
49431            "DataValue" => Ok(Self::DataValue),
49432            "PoolId" => Ok(Self::PoolId),
49433            "AssetCode4" => Ok(Self::AssetCode4),
49434            "AssetCode12" => Ok(Self::AssetCode12),
49435            "AssetType" => Ok(Self::AssetType),
49436            "AssetCode" => Ok(Self::AssetCode),
49437            "AlphaNum4" => Ok(Self::AlphaNum4),
49438            "AlphaNum12" => Ok(Self::AlphaNum12),
49439            "Asset" => Ok(Self::Asset),
49440            "Price" => Ok(Self::Price),
49441            "Liabilities" => Ok(Self::Liabilities),
49442            "ThresholdIndexes" => Ok(Self::ThresholdIndexes),
49443            "LedgerEntryType" => Ok(Self::LedgerEntryType),
49444            "Signer" => Ok(Self::Signer),
49445            "AccountFlags" => Ok(Self::AccountFlags),
49446            "SponsorshipDescriptor" => Ok(Self::SponsorshipDescriptor),
49447            "AccountEntryExtensionV3" => Ok(Self::AccountEntryExtensionV3),
49448            "AccountEntryExtensionV2" => Ok(Self::AccountEntryExtensionV2),
49449            "AccountEntryExtensionV2Ext" => Ok(Self::AccountEntryExtensionV2Ext),
49450            "AccountEntryExtensionV1" => Ok(Self::AccountEntryExtensionV1),
49451            "AccountEntryExtensionV1Ext" => Ok(Self::AccountEntryExtensionV1Ext),
49452            "AccountEntry" => Ok(Self::AccountEntry),
49453            "AccountEntryExt" => Ok(Self::AccountEntryExt),
49454            "TrustLineFlags" => Ok(Self::TrustLineFlags),
49455            "LiquidityPoolType" => Ok(Self::LiquidityPoolType),
49456            "TrustLineAsset" => Ok(Self::TrustLineAsset),
49457            "TrustLineEntryExtensionV2" => Ok(Self::TrustLineEntryExtensionV2),
49458            "TrustLineEntryExtensionV2Ext" => Ok(Self::TrustLineEntryExtensionV2Ext),
49459            "TrustLineEntry" => Ok(Self::TrustLineEntry),
49460            "TrustLineEntryExt" => Ok(Self::TrustLineEntryExt),
49461            "TrustLineEntryV1" => Ok(Self::TrustLineEntryV1),
49462            "TrustLineEntryV1Ext" => Ok(Self::TrustLineEntryV1Ext),
49463            "OfferEntryFlags" => Ok(Self::OfferEntryFlags),
49464            "OfferEntry" => Ok(Self::OfferEntry),
49465            "OfferEntryExt" => Ok(Self::OfferEntryExt),
49466            "DataEntry" => Ok(Self::DataEntry),
49467            "DataEntryExt" => Ok(Self::DataEntryExt),
49468            "ClaimPredicateType" => Ok(Self::ClaimPredicateType),
49469            "ClaimPredicate" => Ok(Self::ClaimPredicate),
49470            "ClaimantType" => Ok(Self::ClaimantType),
49471            "Claimant" => Ok(Self::Claimant),
49472            "ClaimantV0" => Ok(Self::ClaimantV0),
49473            "ClaimableBalanceIdType" => Ok(Self::ClaimableBalanceIdType),
49474            "ClaimableBalanceId" => Ok(Self::ClaimableBalanceId),
49475            "ClaimableBalanceFlags" => Ok(Self::ClaimableBalanceFlags),
49476            "ClaimableBalanceEntryExtensionV1" => Ok(Self::ClaimableBalanceEntryExtensionV1),
49477            "ClaimableBalanceEntryExtensionV1Ext" => Ok(Self::ClaimableBalanceEntryExtensionV1Ext),
49478            "ClaimableBalanceEntry" => Ok(Self::ClaimableBalanceEntry),
49479            "ClaimableBalanceEntryExt" => Ok(Self::ClaimableBalanceEntryExt),
49480            "LiquidityPoolConstantProductParameters" => {
49481                Ok(Self::LiquidityPoolConstantProductParameters)
49482            }
49483            "LiquidityPoolEntry" => Ok(Self::LiquidityPoolEntry),
49484            "LiquidityPoolEntryBody" => Ok(Self::LiquidityPoolEntryBody),
49485            "LiquidityPoolEntryConstantProduct" => Ok(Self::LiquidityPoolEntryConstantProduct),
49486            "ContractDataDurability" => Ok(Self::ContractDataDurability),
49487            "ContractDataEntry" => Ok(Self::ContractDataEntry),
49488            "ContractCodeCostInputs" => Ok(Self::ContractCodeCostInputs),
49489            "ContractCodeEntry" => Ok(Self::ContractCodeEntry),
49490            "ContractCodeEntryExt" => Ok(Self::ContractCodeEntryExt),
49491            "ContractCodeEntryV1" => Ok(Self::ContractCodeEntryV1),
49492            "TtlEntry" => Ok(Self::TtlEntry),
49493            "LedgerEntryExtensionV1" => Ok(Self::LedgerEntryExtensionV1),
49494            "LedgerEntryExtensionV1Ext" => Ok(Self::LedgerEntryExtensionV1Ext),
49495            "LedgerEntry" => Ok(Self::LedgerEntry),
49496            "LedgerEntryData" => Ok(Self::LedgerEntryData),
49497            "LedgerEntryExt" => Ok(Self::LedgerEntryExt),
49498            "LedgerKey" => Ok(Self::LedgerKey),
49499            "LedgerKeyAccount" => Ok(Self::LedgerKeyAccount),
49500            "LedgerKeyTrustLine" => Ok(Self::LedgerKeyTrustLine),
49501            "LedgerKeyOffer" => Ok(Self::LedgerKeyOffer),
49502            "LedgerKeyData" => Ok(Self::LedgerKeyData),
49503            "LedgerKeyClaimableBalance" => Ok(Self::LedgerKeyClaimableBalance),
49504            "LedgerKeyLiquidityPool" => Ok(Self::LedgerKeyLiquidityPool),
49505            "LedgerKeyContractData" => Ok(Self::LedgerKeyContractData),
49506            "LedgerKeyContractCode" => Ok(Self::LedgerKeyContractCode),
49507            "LedgerKeyConfigSetting" => Ok(Self::LedgerKeyConfigSetting),
49508            "LedgerKeyTtl" => Ok(Self::LedgerKeyTtl),
49509            "EnvelopeType" => Ok(Self::EnvelopeType),
49510            "BucketListType" => Ok(Self::BucketListType),
49511            "BucketEntryType" => Ok(Self::BucketEntryType),
49512            "HotArchiveBucketEntryType" => Ok(Self::HotArchiveBucketEntryType),
49513            "ColdArchiveBucketEntryType" => Ok(Self::ColdArchiveBucketEntryType),
49514            "BucketMetadata" => Ok(Self::BucketMetadata),
49515            "BucketMetadataExt" => Ok(Self::BucketMetadataExt),
49516            "BucketEntry" => Ok(Self::BucketEntry),
49517            "HotArchiveBucketEntry" => Ok(Self::HotArchiveBucketEntry),
49518            "ColdArchiveArchivedLeaf" => Ok(Self::ColdArchiveArchivedLeaf),
49519            "ColdArchiveDeletedLeaf" => Ok(Self::ColdArchiveDeletedLeaf),
49520            "ColdArchiveBoundaryLeaf" => Ok(Self::ColdArchiveBoundaryLeaf),
49521            "ColdArchiveHashEntry" => Ok(Self::ColdArchiveHashEntry),
49522            "ColdArchiveBucketEntry" => Ok(Self::ColdArchiveBucketEntry),
49523            "UpgradeType" => Ok(Self::UpgradeType),
49524            "StellarValueType" => Ok(Self::StellarValueType),
49525            "LedgerCloseValueSignature" => Ok(Self::LedgerCloseValueSignature),
49526            "StellarValue" => Ok(Self::StellarValue),
49527            "StellarValueExt" => Ok(Self::StellarValueExt),
49528            "LedgerHeaderFlags" => Ok(Self::LedgerHeaderFlags),
49529            "LedgerHeaderExtensionV1" => Ok(Self::LedgerHeaderExtensionV1),
49530            "LedgerHeaderExtensionV1Ext" => Ok(Self::LedgerHeaderExtensionV1Ext),
49531            "LedgerHeader" => Ok(Self::LedgerHeader),
49532            "LedgerHeaderExt" => Ok(Self::LedgerHeaderExt),
49533            "LedgerUpgradeType" => Ok(Self::LedgerUpgradeType),
49534            "ConfigUpgradeSetKey" => Ok(Self::ConfigUpgradeSetKey),
49535            "LedgerUpgrade" => Ok(Self::LedgerUpgrade),
49536            "ConfigUpgradeSet" => Ok(Self::ConfigUpgradeSet),
49537            "TxSetComponentType" => Ok(Self::TxSetComponentType),
49538            "TxExecutionThread" => Ok(Self::TxExecutionThread),
49539            "ParallelTxExecutionStage" => Ok(Self::ParallelTxExecutionStage),
49540            "ParallelTxsComponent" => Ok(Self::ParallelTxsComponent),
49541            "TxSetComponent" => Ok(Self::TxSetComponent),
49542            "TxSetComponentTxsMaybeDiscountedFee" => Ok(Self::TxSetComponentTxsMaybeDiscountedFee),
49543            "TransactionPhase" => Ok(Self::TransactionPhase),
49544            "TransactionSet" => Ok(Self::TransactionSet),
49545            "TransactionSetV1" => Ok(Self::TransactionSetV1),
49546            "GeneralizedTransactionSet" => Ok(Self::GeneralizedTransactionSet),
49547            "TransactionResultPair" => Ok(Self::TransactionResultPair),
49548            "TransactionResultSet" => Ok(Self::TransactionResultSet),
49549            "TransactionHistoryEntry" => Ok(Self::TransactionHistoryEntry),
49550            "TransactionHistoryEntryExt" => Ok(Self::TransactionHistoryEntryExt),
49551            "TransactionHistoryResultEntry" => Ok(Self::TransactionHistoryResultEntry),
49552            "TransactionHistoryResultEntryExt" => Ok(Self::TransactionHistoryResultEntryExt),
49553            "LedgerHeaderHistoryEntry" => Ok(Self::LedgerHeaderHistoryEntry),
49554            "LedgerHeaderHistoryEntryExt" => Ok(Self::LedgerHeaderHistoryEntryExt),
49555            "LedgerScpMessages" => Ok(Self::LedgerScpMessages),
49556            "ScpHistoryEntryV0" => Ok(Self::ScpHistoryEntryV0),
49557            "ScpHistoryEntry" => Ok(Self::ScpHistoryEntry),
49558            "LedgerEntryChangeType" => Ok(Self::LedgerEntryChangeType),
49559            "LedgerEntryChange" => Ok(Self::LedgerEntryChange),
49560            "LedgerEntryChanges" => Ok(Self::LedgerEntryChanges),
49561            "OperationMeta" => Ok(Self::OperationMeta),
49562            "TransactionMetaV1" => Ok(Self::TransactionMetaV1),
49563            "TransactionMetaV2" => Ok(Self::TransactionMetaV2),
49564            "ContractEventType" => Ok(Self::ContractEventType),
49565            "ContractEvent" => Ok(Self::ContractEvent),
49566            "ContractEventBody" => Ok(Self::ContractEventBody),
49567            "ContractEventV0" => Ok(Self::ContractEventV0),
49568            "DiagnosticEvent" => Ok(Self::DiagnosticEvent),
49569            "SorobanTransactionMetaExtV1" => Ok(Self::SorobanTransactionMetaExtV1),
49570            "SorobanTransactionMetaExt" => Ok(Self::SorobanTransactionMetaExt),
49571            "SorobanTransactionMeta" => Ok(Self::SorobanTransactionMeta),
49572            "TransactionMetaV3" => Ok(Self::TransactionMetaV3),
49573            "InvokeHostFunctionSuccessPreImage" => Ok(Self::InvokeHostFunctionSuccessPreImage),
49574            "TransactionMeta" => Ok(Self::TransactionMeta),
49575            "TransactionResultMeta" => Ok(Self::TransactionResultMeta),
49576            "UpgradeEntryMeta" => Ok(Self::UpgradeEntryMeta),
49577            "LedgerCloseMetaV0" => Ok(Self::LedgerCloseMetaV0),
49578            "LedgerCloseMetaExtV1" => Ok(Self::LedgerCloseMetaExtV1),
49579            "LedgerCloseMetaExtV2" => Ok(Self::LedgerCloseMetaExtV2),
49580            "LedgerCloseMetaExt" => Ok(Self::LedgerCloseMetaExt),
49581            "LedgerCloseMetaV1" => Ok(Self::LedgerCloseMetaV1),
49582            "LedgerCloseMeta" => Ok(Self::LedgerCloseMeta),
49583            "ErrorCode" => Ok(Self::ErrorCode),
49584            "SError" => Ok(Self::SError),
49585            "SendMore" => Ok(Self::SendMore),
49586            "SendMoreExtended" => Ok(Self::SendMoreExtended),
49587            "AuthCert" => Ok(Self::AuthCert),
49588            "Hello" => Ok(Self::Hello),
49589            "Auth" => Ok(Self::Auth),
49590            "IpAddrType" => Ok(Self::IpAddrType),
49591            "PeerAddress" => Ok(Self::PeerAddress),
49592            "PeerAddressIp" => Ok(Self::PeerAddressIp),
49593            "MessageType" => Ok(Self::MessageType),
49594            "DontHave" => Ok(Self::DontHave),
49595            "SurveyMessageCommandType" => Ok(Self::SurveyMessageCommandType),
49596            "SurveyMessageResponseType" => Ok(Self::SurveyMessageResponseType),
49597            "TimeSlicedSurveyStartCollectingMessage" => {
49598                Ok(Self::TimeSlicedSurveyStartCollectingMessage)
49599            }
49600            "SignedTimeSlicedSurveyStartCollectingMessage" => {
49601                Ok(Self::SignedTimeSlicedSurveyStartCollectingMessage)
49602            }
49603            "TimeSlicedSurveyStopCollectingMessage" => {
49604                Ok(Self::TimeSlicedSurveyStopCollectingMessage)
49605            }
49606            "SignedTimeSlicedSurveyStopCollectingMessage" => {
49607                Ok(Self::SignedTimeSlicedSurveyStopCollectingMessage)
49608            }
49609            "SurveyRequestMessage" => Ok(Self::SurveyRequestMessage),
49610            "TimeSlicedSurveyRequestMessage" => Ok(Self::TimeSlicedSurveyRequestMessage),
49611            "SignedSurveyRequestMessage" => Ok(Self::SignedSurveyRequestMessage),
49612            "SignedTimeSlicedSurveyRequestMessage" => {
49613                Ok(Self::SignedTimeSlicedSurveyRequestMessage)
49614            }
49615            "EncryptedBody" => Ok(Self::EncryptedBody),
49616            "SurveyResponseMessage" => Ok(Self::SurveyResponseMessage),
49617            "TimeSlicedSurveyResponseMessage" => Ok(Self::TimeSlicedSurveyResponseMessage),
49618            "SignedSurveyResponseMessage" => Ok(Self::SignedSurveyResponseMessage),
49619            "SignedTimeSlicedSurveyResponseMessage" => {
49620                Ok(Self::SignedTimeSlicedSurveyResponseMessage)
49621            }
49622            "PeerStats" => Ok(Self::PeerStats),
49623            "PeerStatList" => Ok(Self::PeerStatList),
49624            "TimeSlicedNodeData" => Ok(Self::TimeSlicedNodeData),
49625            "TimeSlicedPeerData" => Ok(Self::TimeSlicedPeerData),
49626            "TimeSlicedPeerDataList" => Ok(Self::TimeSlicedPeerDataList),
49627            "TopologyResponseBodyV0" => Ok(Self::TopologyResponseBodyV0),
49628            "TopologyResponseBodyV1" => Ok(Self::TopologyResponseBodyV1),
49629            "TopologyResponseBodyV2" => Ok(Self::TopologyResponseBodyV2),
49630            "SurveyResponseBody" => Ok(Self::SurveyResponseBody),
49631            "TxAdvertVector" => Ok(Self::TxAdvertVector),
49632            "FloodAdvert" => Ok(Self::FloodAdvert),
49633            "TxDemandVector" => Ok(Self::TxDemandVector),
49634            "FloodDemand" => Ok(Self::FloodDemand),
49635            "StellarMessage" => Ok(Self::StellarMessage),
49636            "AuthenticatedMessage" => Ok(Self::AuthenticatedMessage),
49637            "AuthenticatedMessageV0" => Ok(Self::AuthenticatedMessageV0),
49638            "LiquidityPoolParameters" => Ok(Self::LiquidityPoolParameters),
49639            "MuxedAccount" => Ok(Self::MuxedAccount),
49640            "MuxedAccountMed25519" => Ok(Self::MuxedAccountMed25519),
49641            "DecoratedSignature" => Ok(Self::DecoratedSignature),
49642            "OperationType" => Ok(Self::OperationType),
49643            "CreateAccountOp" => Ok(Self::CreateAccountOp),
49644            "PaymentOp" => Ok(Self::PaymentOp),
49645            "PathPaymentStrictReceiveOp" => Ok(Self::PathPaymentStrictReceiveOp),
49646            "PathPaymentStrictSendOp" => Ok(Self::PathPaymentStrictSendOp),
49647            "ManageSellOfferOp" => Ok(Self::ManageSellOfferOp),
49648            "ManageBuyOfferOp" => Ok(Self::ManageBuyOfferOp),
49649            "CreatePassiveSellOfferOp" => Ok(Self::CreatePassiveSellOfferOp),
49650            "SetOptionsOp" => Ok(Self::SetOptionsOp),
49651            "ChangeTrustAsset" => Ok(Self::ChangeTrustAsset),
49652            "ChangeTrustOp" => Ok(Self::ChangeTrustOp),
49653            "AllowTrustOp" => Ok(Self::AllowTrustOp),
49654            "ManageDataOp" => Ok(Self::ManageDataOp),
49655            "BumpSequenceOp" => Ok(Self::BumpSequenceOp),
49656            "CreateClaimableBalanceOp" => Ok(Self::CreateClaimableBalanceOp),
49657            "ClaimClaimableBalanceOp" => Ok(Self::ClaimClaimableBalanceOp),
49658            "BeginSponsoringFutureReservesOp" => Ok(Self::BeginSponsoringFutureReservesOp),
49659            "RevokeSponsorshipType" => Ok(Self::RevokeSponsorshipType),
49660            "RevokeSponsorshipOp" => Ok(Self::RevokeSponsorshipOp),
49661            "RevokeSponsorshipOpSigner" => Ok(Self::RevokeSponsorshipOpSigner),
49662            "ClawbackOp" => Ok(Self::ClawbackOp),
49663            "ClawbackClaimableBalanceOp" => Ok(Self::ClawbackClaimableBalanceOp),
49664            "SetTrustLineFlagsOp" => Ok(Self::SetTrustLineFlagsOp),
49665            "LiquidityPoolDepositOp" => Ok(Self::LiquidityPoolDepositOp),
49666            "LiquidityPoolWithdrawOp" => Ok(Self::LiquidityPoolWithdrawOp),
49667            "HostFunctionType" => Ok(Self::HostFunctionType),
49668            "ContractIdPreimageType" => Ok(Self::ContractIdPreimageType),
49669            "ContractIdPreimage" => Ok(Self::ContractIdPreimage),
49670            "ContractIdPreimageFromAddress" => Ok(Self::ContractIdPreimageFromAddress),
49671            "CreateContractArgs" => Ok(Self::CreateContractArgs),
49672            "CreateContractArgsV2" => Ok(Self::CreateContractArgsV2),
49673            "InvokeContractArgs" => Ok(Self::InvokeContractArgs),
49674            "HostFunction" => Ok(Self::HostFunction),
49675            "SorobanAuthorizedFunctionType" => Ok(Self::SorobanAuthorizedFunctionType),
49676            "SorobanAuthorizedFunction" => Ok(Self::SorobanAuthorizedFunction),
49677            "SorobanAuthorizedInvocation" => Ok(Self::SorobanAuthorizedInvocation),
49678            "SorobanAddressCredentials" => Ok(Self::SorobanAddressCredentials),
49679            "SorobanCredentialsType" => Ok(Self::SorobanCredentialsType),
49680            "SorobanCredentials" => Ok(Self::SorobanCredentials),
49681            "SorobanAuthorizationEntry" => Ok(Self::SorobanAuthorizationEntry),
49682            "InvokeHostFunctionOp" => Ok(Self::InvokeHostFunctionOp),
49683            "ExtendFootprintTtlOp" => Ok(Self::ExtendFootprintTtlOp),
49684            "RestoreFootprintOp" => Ok(Self::RestoreFootprintOp),
49685            "Operation" => Ok(Self::Operation),
49686            "OperationBody" => Ok(Self::OperationBody),
49687            "HashIdPreimage" => Ok(Self::HashIdPreimage),
49688            "HashIdPreimageOperationId" => Ok(Self::HashIdPreimageOperationId),
49689            "HashIdPreimageRevokeId" => Ok(Self::HashIdPreimageRevokeId),
49690            "HashIdPreimageContractId" => Ok(Self::HashIdPreimageContractId),
49691            "HashIdPreimageSorobanAuthorization" => Ok(Self::HashIdPreimageSorobanAuthorization),
49692            "MemoType" => Ok(Self::MemoType),
49693            "Memo" => Ok(Self::Memo),
49694            "TimeBounds" => Ok(Self::TimeBounds),
49695            "LedgerBounds" => Ok(Self::LedgerBounds),
49696            "PreconditionsV2" => Ok(Self::PreconditionsV2),
49697            "PreconditionType" => Ok(Self::PreconditionType),
49698            "Preconditions" => Ok(Self::Preconditions),
49699            "LedgerFootprint" => Ok(Self::LedgerFootprint),
49700            "ArchivalProofType" => Ok(Self::ArchivalProofType),
49701            "ArchivalProofNode" => Ok(Self::ArchivalProofNode),
49702            "ProofLevel" => Ok(Self::ProofLevel),
49703            "ExistenceProofBody" => Ok(Self::ExistenceProofBody),
49704            "NonexistenceProofBody" => Ok(Self::NonexistenceProofBody),
49705            "ArchivalProof" => Ok(Self::ArchivalProof),
49706            "ArchivalProofBody" => Ok(Self::ArchivalProofBody),
49707            "SorobanResources" => Ok(Self::SorobanResources),
49708            "SorobanTransactionData" => Ok(Self::SorobanTransactionData),
49709            "SorobanTransactionDataExt" => Ok(Self::SorobanTransactionDataExt),
49710            "TransactionV0" => Ok(Self::TransactionV0),
49711            "TransactionV0Ext" => Ok(Self::TransactionV0Ext),
49712            "TransactionV0Envelope" => Ok(Self::TransactionV0Envelope),
49713            "Transaction" => Ok(Self::Transaction),
49714            "TransactionExt" => Ok(Self::TransactionExt),
49715            "TransactionV1Envelope" => Ok(Self::TransactionV1Envelope),
49716            "FeeBumpTransaction" => Ok(Self::FeeBumpTransaction),
49717            "FeeBumpTransactionInnerTx" => Ok(Self::FeeBumpTransactionInnerTx),
49718            "FeeBumpTransactionExt" => Ok(Self::FeeBumpTransactionExt),
49719            "FeeBumpTransactionEnvelope" => Ok(Self::FeeBumpTransactionEnvelope),
49720            "TransactionEnvelope" => Ok(Self::TransactionEnvelope),
49721            "TransactionSignaturePayload" => Ok(Self::TransactionSignaturePayload),
49722            "TransactionSignaturePayloadTaggedTransaction" => {
49723                Ok(Self::TransactionSignaturePayloadTaggedTransaction)
49724            }
49725            "ClaimAtomType" => Ok(Self::ClaimAtomType),
49726            "ClaimOfferAtomV0" => Ok(Self::ClaimOfferAtomV0),
49727            "ClaimOfferAtom" => Ok(Self::ClaimOfferAtom),
49728            "ClaimLiquidityAtom" => Ok(Self::ClaimLiquidityAtom),
49729            "ClaimAtom" => Ok(Self::ClaimAtom),
49730            "CreateAccountResultCode" => Ok(Self::CreateAccountResultCode),
49731            "CreateAccountResult" => Ok(Self::CreateAccountResult),
49732            "PaymentResultCode" => Ok(Self::PaymentResultCode),
49733            "PaymentResult" => Ok(Self::PaymentResult),
49734            "PathPaymentStrictReceiveResultCode" => Ok(Self::PathPaymentStrictReceiveResultCode),
49735            "SimplePaymentResult" => Ok(Self::SimplePaymentResult),
49736            "PathPaymentStrictReceiveResult" => Ok(Self::PathPaymentStrictReceiveResult),
49737            "PathPaymentStrictReceiveResultSuccess" => {
49738                Ok(Self::PathPaymentStrictReceiveResultSuccess)
49739            }
49740            "PathPaymentStrictSendResultCode" => Ok(Self::PathPaymentStrictSendResultCode),
49741            "PathPaymentStrictSendResult" => Ok(Self::PathPaymentStrictSendResult),
49742            "PathPaymentStrictSendResultSuccess" => Ok(Self::PathPaymentStrictSendResultSuccess),
49743            "ManageSellOfferResultCode" => Ok(Self::ManageSellOfferResultCode),
49744            "ManageOfferEffect" => Ok(Self::ManageOfferEffect),
49745            "ManageOfferSuccessResult" => Ok(Self::ManageOfferSuccessResult),
49746            "ManageOfferSuccessResultOffer" => Ok(Self::ManageOfferSuccessResultOffer),
49747            "ManageSellOfferResult" => Ok(Self::ManageSellOfferResult),
49748            "ManageBuyOfferResultCode" => Ok(Self::ManageBuyOfferResultCode),
49749            "ManageBuyOfferResult" => Ok(Self::ManageBuyOfferResult),
49750            "SetOptionsResultCode" => Ok(Self::SetOptionsResultCode),
49751            "SetOptionsResult" => Ok(Self::SetOptionsResult),
49752            "ChangeTrustResultCode" => Ok(Self::ChangeTrustResultCode),
49753            "ChangeTrustResult" => Ok(Self::ChangeTrustResult),
49754            "AllowTrustResultCode" => Ok(Self::AllowTrustResultCode),
49755            "AllowTrustResult" => Ok(Self::AllowTrustResult),
49756            "AccountMergeResultCode" => Ok(Self::AccountMergeResultCode),
49757            "AccountMergeResult" => Ok(Self::AccountMergeResult),
49758            "InflationResultCode" => Ok(Self::InflationResultCode),
49759            "InflationPayout" => Ok(Self::InflationPayout),
49760            "InflationResult" => Ok(Self::InflationResult),
49761            "ManageDataResultCode" => Ok(Self::ManageDataResultCode),
49762            "ManageDataResult" => Ok(Self::ManageDataResult),
49763            "BumpSequenceResultCode" => Ok(Self::BumpSequenceResultCode),
49764            "BumpSequenceResult" => Ok(Self::BumpSequenceResult),
49765            "CreateClaimableBalanceResultCode" => Ok(Self::CreateClaimableBalanceResultCode),
49766            "CreateClaimableBalanceResult" => Ok(Self::CreateClaimableBalanceResult),
49767            "ClaimClaimableBalanceResultCode" => Ok(Self::ClaimClaimableBalanceResultCode),
49768            "ClaimClaimableBalanceResult" => Ok(Self::ClaimClaimableBalanceResult),
49769            "BeginSponsoringFutureReservesResultCode" => {
49770                Ok(Self::BeginSponsoringFutureReservesResultCode)
49771            }
49772            "BeginSponsoringFutureReservesResult" => Ok(Self::BeginSponsoringFutureReservesResult),
49773            "EndSponsoringFutureReservesResultCode" => {
49774                Ok(Self::EndSponsoringFutureReservesResultCode)
49775            }
49776            "EndSponsoringFutureReservesResult" => Ok(Self::EndSponsoringFutureReservesResult),
49777            "RevokeSponsorshipResultCode" => Ok(Self::RevokeSponsorshipResultCode),
49778            "RevokeSponsorshipResult" => Ok(Self::RevokeSponsorshipResult),
49779            "ClawbackResultCode" => Ok(Self::ClawbackResultCode),
49780            "ClawbackResult" => Ok(Self::ClawbackResult),
49781            "ClawbackClaimableBalanceResultCode" => Ok(Self::ClawbackClaimableBalanceResultCode),
49782            "ClawbackClaimableBalanceResult" => Ok(Self::ClawbackClaimableBalanceResult),
49783            "SetTrustLineFlagsResultCode" => Ok(Self::SetTrustLineFlagsResultCode),
49784            "SetTrustLineFlagsResult" => Ok(Self::SetTrustLineFlagsResult),
49785            "LiquidityPoolDepositResultCode" => Ok(Self::LiquidityPoolDepositResultCode),
49786            "LiquidityPoolDepositResult" => Ok(Self::LiquidityPoolDepositResult),
49787            "LiquidityPoolWithdrawResultCode" => Ok(Self::LiquidityPoolWithdrawResultCode),
49788            "LiquidityPoolWithdrawResult" => Ok(Self::LiquidityPoolWithdrawResult),
49789            "InvokeHostFunctionResultCode" => Ok(Self::InvokeHostFunctionResultCode),
49790            "InvokeHostFunctionResult" => Ok(Self::InvokeHostFunctionResult),
49791            "ExtendFootprintTtlResultCode" => Ok(Self::ExtendFootprintTtlResultCode),
49792            "ExtendFootprintTtlResult" => Ok(Self::ExtendFootprintTtlResult),
49793            "RestoreFootprintResultCode" => Ok(Self::RestoreFootprintResultCode),
49794            "RestoreFootprintResult" => Ok(Self::RestoreFootprintResult),
49795            "OperationResultCode" => Ok(Self::OperationResultCode),
49796            "OperationResult" => Ok(Self::OperationResult),
49797            "OperationResultTr" => Ok(Self::OperationResultTr),
49798            "TransactionResultCode" => Ok(Self::TransactionResultCode),
49799            "InnerTransactionResult" => Ok(Self::InnerTransactionResult),
49800            "InnerTransactionResultResult" => Ok(Self::InnerTransactionResultResult),
49801            "InnerTransactionResultExt" => Ok(Self::InnerTransactionResultExt),
49802            "InnerTransactionResultPair" => Ok(Self::InnerTransactionResultPair),
49803            "TransactionResult" => Ok(Self::TransactionResult),
49804            "TransactionResultResult" => Ok(Self::TransactionResultResult),
49805            "TransactionResultExt" => Ok(Self::TransactionResultExt),
49806            "Hash" => Ok(Self::Hash),
49807            "Uint256" => Ok(Self::Uint256),
49808            "Uint32" => Ok(Self::Uint32),
49809            "Int32" => Ok(Self::Int32),
49810            "Uint64" => Ok(Self::Uint64),
49811            "Int64" => Ok(Self::Int64),
49812            "TimePoint" => Ok(Self::TimePoint),
49813            "Duration" => Ok(Self::Duration),
49814            "ExtensionPoint" => Ok(Self::ExtensionPoint),
49815            "CryptoKeyType" => Ok(Self::CryptoKeyType),
49816            "PublicKeyType" => Ok(Self::PublicKeyType),
49817            "SignerKeyType" => Ok(Self::SignerKeyType),
49818            "PublicKey" => Ok(Self::PublicKey),
49819            "SignerKey" => Ok(Self::SignerKey),
49820            "SignerKeyEd25519SignedPayload" => Ok(Self::SignerKeyEd25519SignedPayload),
49821            "Signature" => Ok(Self::Signature),
49822            "SignatureHint" => Ok(Self::SignatureHint),
49823            "NodeId" => Ok(Self::NodeId),
49824            "AccountId" => Ok(Self::AccountId),
49825            "Curve25519Secret" => Ok(Self::Curve25519Secret),
49826            "Curve25519Public" => Ok(Self::Curve25519Public),
49827            "HmacSha256Key" => Ok(Self::HmacSha256Key),
49828            "HmacSha256Mac" => Ok(Self::HmacSha256Mac),
49829            "ShortHashSeed" => Ok(Self::ShortHashSeed),
49830            "BinaryFuseFilterType" => Ok(Self::BinaryFuseFilterType),
49831            "SerializedBinaryFuseFilter" => Ok(Self::SerializedBinaryFuseFilter),
49832            _ => Err(Error::Invalid),
49833        }
49834    }
49835}
49836
49837#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
49838#[cfg_attr(
49839    all(feature = "serde", feature = "alloc"),
49840    derive(serde::Serialize, serde::Deserialize),
49841    serde(rename_all = "snake_case"),
49842    serde(untagged)
49843)]
49844#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
49845pub enum Type {
49846    Value(Box<Value>),
49847    ScpBallot(Box<ScpBallot>),
49848    ScpStatementType(Box<ScpStatementType>),
49849    ScpNomination(Box<ScpNomination>),
49850    ScpStatement(Box<ScpStatement>),
49851    ScpStatementPledges(Box<ScpStatementPledges>),
49852    ScpStatementPrepare(Box<ScpStatementPrepare>),
49853    ScpStatementConfirm(Box<ScpStatementConfirm>),
49854    ScpStatementExternalize(Box<ScpStatementExternalize>),
49855    ScpEnvelope(Box<ScpEnvelope>),
49856    ScpQuorumSet(Box<ScpQuorumSet>),
49857    ConfigSettingContractExecutionLanesV0(Box<ConfigSettingContractExecutionLanesV0>),
49858    ConfigSettingContractComputeV0(Box<ConfigSettingContractComputeV0>),
49859    ConfigSettingContractParallelComputeV0(Box<ConfigSettingContractParallelComputeV0>),
49860    ConfigSettingContractLedgerCostV0(Box<ConfigSettingContractLedgerCostV0>),
49861    ConfigSettingContractHistoricalDataV0(Box<ConfigSettingContractHistoricalDataV0>),
49862    ConfigSettingContractEventsV0(Box<ConfigSettingContractEventsV0>),
49863    ConfigSettingContractBandwidthV0(Box<ConfigSettingContractBandwidthV0>),
49864    ContractCostType(Box<ContractCostType>),
49865    ContractCostParamEntry(Box<ContractCostParamEntry>),
49866    StateArchivalSettings(Box<StateArchivalSettings>),
49867    EvictionIterator(Box<EvictionIterator>),
49868    ContractCostParams(Box<ContractCostParams>),
49869    ConfigSettingId(Box<ConfigSettingId>),
49870    ConfigSettingEntry(Box<ConfigSettingEntry>),
49871    ScEnvMetaKind(Box<ScEnvMetaKind>),
49872    ScEnvMetaEntry(Box<ScEnvMetaEntry>),
49873    ScEnvMetaEntryInterfaceVersion(Box<ScEnvMetaEntryInterfaceVersion>),
49874    ScMetaV0(Box<ScMetaV0>),
49875    ScMetaKind(Box<ScMetaKind>),
49876    ScMetaEntry(Box<ScMetaEntry>),
49877    ScSpecType(Box<ScSpecType>),
49878    ScSpecTypeOption(Box<ScSpecTypeOption>),
49879    ScSpecTypeResult(Box<ScSpecTypeResult>),
49880    ScSpecTypeVec(Box<ScSpecTypeVec>),
49881    ScSpecTypeMap(Box<ScSpecTypeMap>),
49882    ScSpecTypeTuple(Box<ScSpecTypeTuple>),
49883    ScSpecTypeBytesN(Box<ScSpecTypeBytesN>),
49884    ScSpecTypeUdt(Box<ScSpecTypeUdt>),
49885    ScSpecTypeDef(Box<ScSpecTypeDef>),
49886    ScSpecUdtStructFieldV0(Box<ScSpecUdtStructFieldV0>),
49887    ScSpecUdtStructV0(Box<ScSpecUdtStructV0>),
49888    ScSpecUdtUnionCaseVoidV0(Box<ScSpecUdtUnionCaseVoidV0>),
49889    ScSpecUdtUnionCaseTupleV0(Box<ScSpecUdtUnionCaseTupleV0>),
49890    ScSpecUdtUnionCaseV0Kind(Box<ScSpecUdtUnionCaseV0Kind>),
49891    ScSpecUdtUnionCaseV0(Box<ScSpecUdtUnionCaseV0>),
49892    ScSpecUdtUnionV0(Box<ScSpecUdtUnionV0>),
49893    ScSpecUdtEnumCaseV0(Box<ScSpecUdtEnumCaseV0>),
49894    ScSpecUdtEnumV0(Box<ScSpecUdtEnumV0>),
49895    ScSpecUdtErrorEnumCaseV0(Box<ScSpecUdtErrorEnumCaseV0>),
49896    ScSpecUdtErrorEnumV0(Box<ScSpecUdtErrorEnumV0>),
49897    ScSpecFunctionInputV0(Box<ScSpecFunctionInputV0>),
49898    ScSpecFunctionV0(Box<ScSpecFunctionV0>),
49899    ScSpecEntryKind(Box<ScSpecEntryKind>),
49900    ScSpecEntry(Box<ScSpecEntry>),
49901    ScValType(Box<ScValType>),
49902    ScErrorType(Box<ScErrorType>),
49903    ScErrorCode(Box<ScErrorCode>),
49904    ScError(Box<ScError>),
49905    UInt128Parts(Box<UInt128Parts>),
49906    Int128Parts(Box<Int128Parts>),
49907    UInt256Parts(Box<UInt256Parts>),
49908    Int256Parts(Box<Int256Parts>),
49909    ContractExecutableType(Box<ContractExecutableType>),
49910    ContractExecutable(Box<ContractExecutable>),
49911    ScAddressType(Box<ScAddressType>),
49912    ScAddress(Box<ScAddress>),
49913    ScVec(Box<ScVec>),
49914    ScMap(Box<ScMap>),
49915    ScBytes(Box<ScBytes>),
49916    ScString(Box<ScString>),
49917    ScSymbol(Box<ScSymbol>),
49918    ScNonceKey(Box<ScNonceKey>),
49919    ScContractInstance(Box<ScContractInstance>),
49920    ScVal(Box<ScVal>),
49921    ScMapEntry(Box<ScMapEntry>),
49922    StoredTransactionSet(Box<StoredTransactionSet>),
49923    StoredDebugTransactionSet(Box<StoredDebugTransactionSet>),
49924    PersistedScpStateV0(Box<PersistedScpStateV0>),
49925    PersistedScpStateV1(Box<PersistedScpStateV1>),
49926    PersistedScpState(Box<PersistedScpState>),
49927    Thresholds(Box<Thresholds>),
49928    String32(Box<String32>),
49929    String64(Box<String64>),
49930    SequenceNumber(Box<SequenceNumber>),
49931    DataValue(Box<DataValue>),
49932    PoolId(Box<PoolId>),
49933    AssetCode4(Box<AssetCode4>),
49934    AssetCode12(Box<AssetCode12>),
49935    AssetType(Box<AssetType>),
49936    AssetCode(Box<AssetCode>),
49937    AlphaNum4(Box<AlphaNum4>),
49938    AlphaNum12(Box<AlphaNum12>),
49939    Asset(Box<Asset>),
49940    Price(Box<Price>),
49941    Liabilities(Box<Liabilities>),
49942    ThresholdIndexes(Box<ThresholdIndexes>),
49943    LedgerEntryType(Box<LedgerEntryType>),
49944    Signer(Box<Signer>),
49945    AccountFlags(Box<AccountFlags>),
49946    SponsorshipDescriptor(Box<SponsorshipDescriptor>),
49947    AccountEntryExtensionV3(Box<AccountEntryExtensionV3>),
49948    AccountEntryExtensionV2(Box<AccountEntryExtensionV2>),
49949    AccountEntryExtensionV2Ext(Box<AccountEntryExtensionV2Ext>),
49950    AccountEntryExtensionV1(Box<AccountEntryExtensionV1>),
49951    AccountEntryExtensionV1Ext(Box<AccountEntryExtensionV1Ext>),
49952    AccountEntry(Box<AccountEntry>),
49953    AccountEntryExt(Box<AccountEntryExt>),
49954    TrustLineFlags(Box<TrustLineFlags>),
49955    LiquidityPoolType(Box<LiquidityPoolType>),
49956    TrustLineAsset(Box<TrustLineAsset>),
49957    TrustLineEntryExtensionV2(Box<TrustLineEntryExtensionV2>),
49958    TrustLineEntryExtensionV2Ext(Box<TrustLineEntryExtensionV2Ext>),
49959    TrustLineEntry(Box<TrustLineEntry>),
49960    TrustLineEntryExt(Box<TrustLineEntryExt>),
49961    TrustLineEntryV1(Box<TrustLineEntryV1>),
49962    TrustLineEntryV1Ext(Box<TrustLineEntryV1Ext>),
49963    OfferEntryFlags(Box<OfferEntryFlags>),
49964    OfferEntry(Box<OfferEntry>),
49965    OfferEntryExt(Box<OfferEntryExt>),
49966    DataEntry(Box<DataEntry>),
49967    DataEntryExt(Box<DataEntryExt>),
49968    ClaimPredicateType(Box<ClaimPredicateType>),
49969    ClaimPredicate(Box<ClaimPredicate>),
49970    ClaimantType(Box<ClaimantType>),
49971    Claimant(Box<Claimant>),
49972    ClaimantV0(Box<ClaimantV0>),
49973    ClaimableBalanceIdType(Box<ClaimableBalanceIdType>),
49974    ClaimableBalanceId(Box<ClaimableBalanceId>),
49975    ClaimableBalanceFlags(Box<ClaimableBalanceFlags>),
49976    ClaimableBalanceEntryExtensionV1(Box<ClaimableBalanceEntryExtensionV1>),
49977    ClaimableBalanceEntryExtensionV1Ext(Box<ClaimableBalanceEntryExtensionV1Ext>),
49978    ClaimableBalanceEntry(Box<ClaimableBalanceEntry>),
49979    ClaimableBalanceEntryExt(Box<ClaimableBalanceEntryExt>),
49980    LiquidityPoolConstantProductParameters(Box<LiquidityPoolConstantProductParameters>),
49981    LiquidityPoolEntry(Box<LiquidityPoolEntry>),
49982    LiquidityPoolEntryBody(Box<LiquidityPoolEntryBody>),
49983    LiquidityPoolEntryConstantProduct(Box<LiquidityPoolEntryConstantProduct>),
49984    ContractDataDurability(Box<ContractDataDurability>),
49985    ContractDataEntry(Box<ContractDataEntry>),
49986    ContractCodeCostInputs(Box<ContractCodeCostInputs>),
49987    ContractCodeEntry(Box<ContractCodeEntry>),
49988    ContractCodeEntryExt(Box<ContractCodeEntryExt>),
49989    ContractCodeEntryV1(Box<ContractCodeEntryV1>),
49990    TtlEntry(Box<TtlEntry>),
49991    LedgerEntryExtensionV1(Box<LedgerEntryExtensionV1>),
49992    LedgerEntryExtensionV1Ext(Box<LedgerEntryExtensionV1Ext>),
49993    LedgerEntry(Box<LedgerEntry>),
49994    LedgerEntryData(Box<LedgerEntryData>),
49995    LedgerEntryExt(Box<LedgerEntryExt>),
49996    LedgerKey(Box<LedgerKey>),
49997    LedgerKeyAccount(Box<LedgerKeyAccount>),
49998    LedgerKeyTrustLine(Box<LedgerKeyTrustLine>),
49999    LedgerKeyOffer(Box<LedgerKeyOffer>),
50000    LedgerKeyData(Box<LedgerKeyData>),
50001    LedgerKeyClaimableBalance(Box<LedgerKeyClaimableBalance>),
50002    LedgerKeyLiquidityPool(Box<LedgerKeyLiquidityPool>),
50003    LedgerKeyContractData(Box<LedgerKeyContractData>),
50004    LedgerKeyContractCode(Box<LedgerKeyContractCode>),
50005    LedgerKeyConfigSetting(Box<LedgerKeyConfigSetting>),
50006    LedgerKeyTtl(Box<LedgerKeyTtl>),
50007    EnvelopeType(Box<EnvelopeType>),
50008    BucketListType(Box<BucketListType>),
50009    BucketEntryType(Box<BucketEntryType>),
50010    HotArchiveBucketEntryType(Box<HotArchiveBucketEntryType>),
50011    ColdArchiveBucketEntryType(Box<ColdArchiveBucketEntryType>),
50012    BucketMetadata(Box<BucketMetadata>),
50013    BucketMetadataExt(Box<BucketMetadataExt>),
50014    BucketEntry(Box<BucketEntry>),
50015    HotArchiveBucketEntry(Box<HotArchiveBucketEntry>),
50016    ColdArchiveArchivedLeaf(Box<ColdArchiveArchivedLeaf>),
50017    ColdArchiveDeletedLeaf(Box<ColdArchiveDeletedLeaf>),
50018    ColdArchiveBoundaryLeaf(Box<ColdArchiveBoundaryLeaf>),
50019    ColdArchiveHashEntry(Box<ColdArchiveHashEntry>),
50020    ColdArchiveBucketEntry(Box<ColdArchiveBucketEntry>),
50021    UpgradeType(Box<UpgradeType>),
50022    StellarValueType(Box<StellarValueType>),
50023    LedgerCloseValueSignature(Box<LedgerCloseValueSignature>),
50024    StellarValue(Box<StellarValue>),
50025    StellarValueExt(Box<StellarValueExt>),
50026    LedgerHeaderFlags(Box<LedgerHeaderFlags>),
50027    LedgerHeaderExtensionV1(Box<LedgerHeaderExtensionV1>),
50028    LedgerHeaderExtensionV1Ext(Box<LedgerHeaderExtensionV1Ext>),
50029    LedgerHeader(Box<LedgerHeader>),
50030    LedgerHeaderExt(Box<LedgerHeaderExt>),
50031    LedgerUpgradeType(Box<LedgerUpgradeType>),
50032    ConfigUpgradeSetKey(Box<ConfigUpgradeSetKey>),
50033    LedgerUpgrade(Box<LedgerUpgrade>),
50034    ConfigUpgradeSet(Box<ConfigUpgradeSet>),
50035    TxSetComponentType(Box<TxSetComponentType>),
50036    TxExecutionThread(Box<TxExecutionThread>),
50037    ParallelTxExecutionStage(Box<ParallelTxExecutionStage>),
50038    ParallelTxsComponent(Box<ParallelTxsComponent>),
50039    TxSetComponent(Box<TxSetComponent>),
50040    TxSetComponentTxsMaybeDiscountedFee(Box<TxSetComponentTxsMaybeDiscountedFee>),
50041    TransactionPhase(Box<TransactionPhase>),
50042    TransactionSet(Box<TransactionSet>),
50043    TransactionSetV1(Box<TransactionSetV1>),
50044    GeneralizedTransactionSet(Box<GeneralizedTransactionSet>),
50045    TransactionResultPair(Box<TransactionResultPair>),
50046    TransactionResultSet(Box<TransactionResultSet>),
50047    TransactionHistoryEntry(Box<TransactionHistoryEntry>),
50048    TransactionHistoryEntryExt(Box<TransactionHistoryEntryExt>),
50049    TransactionHistoryResultEntry(Box<TransactionHistoryResultEntry>),
50050    TransactionHistoryResultEntryExt(Box<TransactionHistoryResultEntryExt>),
50051    LedgerHeaderHistoryEntry(Box<LedgerHeaderHistoryEntry>),
50052    LedgerHeaderHistoryEntryExt(Box<LedgerHeaderHistoryEntryExt>),
50053    LedgerScpMessages(Box<LedgerScpMessages>),
50054    ScpHistoryEntryV0(Box<ScpHistoryEntryV0>),
50055    ScpHistoryEntry(Box<ScpHistoryEntry>),
50056    LedgerEntryChangeType(Box<LedgerEntryChangeType>),
50057    LedgerEntryChange(Box<LedgerEntryChange>),
50058    LedgerEntryChanges(Box<LedgerEntryChanges>),
50059    OperationMeta(Box<OperationMeta>),
50060    TransactionMetaV1(Box<TransactionMetaV1>),
50061    TransactionMetaV2(Box<TransactionMetaV2>),
50062    ContractEventType(Box<ContractEventType>),
50063    ContractEvent(Box<ContractEvent>),
50064    ContractEventBody(Box<ContractEventBody>),
50065    ContractEventV0(Box<ContractEventV0>),
50066    DiagnosticEvent(Box<DiagnosticEvent>),
50067    SorobanTransactionMetaExtV1(Box<SorobanTransactionMetaExtV1>),
50068    SorobanTransactionMetaExt(Box<SorobanTransactionMetaExt>),
50069    SorobanTransactionMeta(Box<SorobanTransactionMeta>),
50070    TransactionMetaV3(Box<TransactionMetaV3>),
50071    InvokeHostFunctionSuccessPreImage(Box<InvokeHostFunctionSuccessPreImage>),
50072    TransactionMeta(Box<TransactionMeta>),
50073    TransactionResultMeta(Box<TransactionResultMeta>),
50074    UpgradeEntryMeta(Box<UpgradeEntryMeta>),
50075    LedgerCloseMetaV0(Box<LedgerCloseMetaV0>),
50076    LedgerCloseMetaExtV1(Box<LedgerCloseMetaExtV1>),
50077    LedgerCloseMetaExtV2(Box<LedgerCloseMetaExtV2>),
50078    LedgerCloseMetaExt(Box<LedgerCloseMetaExt>),
50079    LedgerCloseMetaV1(Box<LedgerCloseMetaV1>),
50080    LedgerCloseMeta(Box<LedgerCloseMeta>),
50081    ErrorCode(Box<ErrorCode>),
50082    SError(Box<SError>),
50083    SendMore(Box<SendMore>),
50084    SendMoreExtended(Box<SendMoreExtended>),
50085    AuthCert(Box<AuthCert>),
50086    Hello(Box<Hello>),
50087    Auth(Box<Auth>),
50088    IpAddrType(Box<IpAddrType>),
50089    PeerAddress(Box<PeerAddress>),
50090    PeerAddressIp(Box<PeerAddressIp>),
50091    MessageType(Box<MessageType>),
50092    DontHave(Box<DontHave>),
50093    SurveyMessageCommandType(Box<SurveyMessageCommandType>),
50094    SurveyMessageResponseType(Box<SurveyMessageResponseType>),
50095    TimeSlicedSurveyStartCollectingMessage(Box<TimeSlicedSurveyStartCollectingMessage>),
50096    SignedTimeSlicedSurveyStartCollectingMessage(Box<SignedTimeSlicedSurveyStartCollectingMessage>),
50097    TimeSlicedSurveyStopCollectingMessage(Box<TimeSlicedSurveyStopCollectingMessage>),
50098    SignedTimeSlicedSurveyStopCollectingMessage(Box<SignedTimeSlicedSurveyStopCollectingMessage>),
50099    SurveyRequestMessage(Box<SurveyRequestMessage>),
50100    TimeSlicedSurveyRequestMessage(Box<TimeSlicedSurveyRequestMessage>),
50101    SignedSurveyRequestMessage(Box<SignedSurveyRequestMessage>),
50102    SignedTimeSlicedSurveyRequestMessage(Box<SignedTimeSlicedSurveyRequestMessage>),
50103    EncryptedBody(Box<EncryptedBody>),
50104    SurveyResponseMessage(Box<SurveyResponseMessage>),
50105    TimeSlicedSurveyResponseMessage(Box<TimeSlicedSurveyResponseMessage>),
50106    SignedSurveyResponseMessage(Box<SignedSurveyResponseMessage>),
50107    SignedTimeSlicedSurveyResponseMessage(Box<SignedTimeSlicedSurveyResponseMessage>),
50108    PeerStats(Box<PeerStats>),
50109    PeerStatList(Box<PeerStatList>),
50110    TimeSlicedNodeData(Box<TimeSlicedNodeData>),
50111    TimeSlicedPeerData(Box<TimeSlicedPeerData>),
50112    TimeSlicedPeerDataList(Box<TimeSlicedPeerDataList>),
50113    TopologyResponseBodyV0(Box<TopologyResponseBodyV0>),
50114    TopologyResponseBodyV1(Box<TopologyResponseBodyV1>),
50115    TopologyResponseBodyV2(Box<TopologyResponseBodyV2>),
50116    SurveyResponseBody(Box<SurveyResponseBody>),
50117    TxAdvertVector(Box<TxAdvertVector>),
50118    FloodAdvert(Box<FloodAdvert>),
50119    TxDemandVector(Box<TxDemandVector>),
50120    FloodDemand(Box<FloodDemand>),
50121    StellarMessage(Box<StellarMessage>),
50122    AuthenticatedMessage(Box<AuthenticatedMessage>),
50123    AuthenticatedMessageV0(Box<AuthenticatedMessageV0>),
50124    LiquidityPoolParameters(Box<LiquidityPoolParameters>),
50125    MuxedAccount(Box<MuxedAccount>),
50126    MuxedAccountMed25519(Box<MuxedAccountMed25519>),
50127    DecoratedSignature(Box<DecoratedSignature>),
50128    OperationType(Box<OperationType>),
50129    CreateAccountOp(Box<CreateAccountOp>),
50130    PaymentOp(Box<PaymentOp>),
50131    PathPaymentStrictReceiveOp(Box<PathPaymentStrictReceiveOp>),
50132    PathPaymentStrictSendOp(Box<PathPaymentStrictSendOp>),
50133    ManageSellOfferOp(Box<ManageSellOfferOp>),
50134    ManageBuyOfferOp(Box<ManageBuyOfferOp>),
50135    CreatePassiveSellOfferOp(Box<CreatePassiveSellOfferOp>),
50136    SetOptionsOp(Box<SetOptionsOp>),
50137    ChangeTrustAsset(Box<ChangeTrustAsset>),
50138    ChangeTrustOp(Box<ChangeTrustOp>),
50139    AllowTrustOp(Box<AllowTrustOp>),
50140    ManageDataOp(Box<ManageDataOp>),
50141    BumpSequenceOp(Box<BumpSequenceOp>),
50142    CreateClaimableBalanceOp(Box<CreateClaimableBalanceOp>),
50143    ClaimClaimableBalanceOp(Box<ClaimClaimableBalanceOp>),
50144    BeginSponsoringFutureReservesOp(Box<BeginSponsoringFutureReservesOp>),
50145    RevokeSponsorshipType(Box<RevokeSponsorshipType>),
50146    RevokeSponsorshipOp(Box<RevokeSponsorshipOp>),
50147    RevokeSponsorshipOpSigner(Box<RevokeSponsorshipOpSigner>),
50148    ClawbackOp(Box<ClawbackOp>),
50149    ClawbackClaimableBalanceOp(Box<ClawbackClaimableBalanceOp>),
50150    SetTrustLineFlagsOp(Box<SetTrustLineFlagsOp>),
50151    LiquidityPoolDepositOp(Box<LiquidityPoolDepositOp>),
50152    LiquidityPoolWithdrawOp(Box<LiquidityPoolWithdrawOp>),
50153    HostFunctionType(Box<HostFunctionType>),
50154    ContractIdPreimageType(Box<ContractIdPreimageType>),
50155    ContractIdPreimage(Box<ContractIdPreimage>),
50156    ContractIdPreimageFromAddress(Box<ContractIdPreimageFromAddress>),
50157    CreateContractArgs(Box<CreateContractArgs>),
50158    CreateContractArgsV2(Box<CreateContractArgsV2>),
50159    InvokeContractArgs(Box<InvokeContractArgs>),
50160    HostFunction(Box<HostFunction>),
50161    SorobanAuthorizedFunctionType(Box<SorobanAuthorizedFunctionType>),
50162    SorobanAuthorizedFunction(Box<SorobanAuthorizedFunction>),
50163    SorobanAuthorizedInvocation(Box<SorobanAuthorizedInvocation>),
50164    SorobanAddressCredentials(Box<SorobanAddressCredentials>),
50165    SorobanCredentialsType(Box<SorobanCredentialsType>),
50166    SorobanCredentials(Box<SorobanCredentials>),
50167    SorobanAuthorizationEntry(Box<SorobanAuthorizationEntry>),
50168    InvokeHostFunctionOp(Box<InvokeHostFunctionOp>),
50169    ExtendFootprintTtlOp(Box<ExtendFootprintTtlOp>),
50170    RestoreFootprintOp(Box<RestoreFootprintOp>),
50171    Operation(Box<Operation>),
50172    OperationBody(Box<OperationBody>),
50173    HashIdPreimage(Box<HashIdPreimage>),
50174    HashIdPreimageOperationId(Box<HashIdPreimageOperationId>),
50175    HashIdPreimageRevokeId(Box<HashIdPreimageRevokeId>),
50176    HashIdPreimageContractId(Box<HashIdPreimageContractId>),
50177    HashIdPreimageSorobanAuthorization(Box<HashIdPreimageSorobanAuthorization>),
50178    MemoType(Box<MemoType>),
50179    Memo(Box<Memo>),
50180    TimeBounds(Box<TimeBounds>),
50181    LedgerBounds(Box<LedgerBounds>),
50182    PreconditionsV2(Box<PreconditionsV2>),
50183    PreconditionType(Box<PreconditionType>),
50184    Preconditions(Box<Preconditions>),
50185    LedgerFootprint(Box<LedgerFootprint>),
50186    ArchivalProofType(Box<ArchivalProofType>),
50187    ArchivalProofNode(Box<ArchivalProofNode>),
50188    ProofLevel(Box<ProofLevel>),
50189    ExistenceProofBody(Box<ExistenceProofBody>),
50190    NonexistenceProofBody(Box<NonexistenceProofBody>),
50191    ArchivalProof(Box<ArchivalProof>),
50192    ArchivalProofBody(Box<ArchivalProofBody>),
50193    SorobanResources(Box<SorobanResources>),
50194    SorobanTransactionData(Box<SorobanTransactionData>),
50195    SorobanTransactionDataExt(Box<SorobanTransactionDataExt>),
50196    TransactionV0(Box<TransactionV0>),
50197    TransactionV0Ext(Box<TransactionV0Ext>),
50198    TransactionV0Envelope(Box<TransactionV0Envelope>),
50199    Transaction(Box<Transaction>),
50200    TransactionExt(Box<TransactionExt>),
50201    TransactionV1Envelope(Box<TransactionV1Envelope>),
50202    FeeBumpTransaction(Box<FeeBumpTransaction>),
50203    FeeBumpTransactionInnerTx(Box<FeeBumpTransactionInnerTx>),
50204    FeeBumpTransactionExt(Box<FeeBumpTransactionExt>),
50205    FeeBumpTransactionEnvelope(Box<FeeBumpTransactionEnvelope>),
50206    TransactionEnvelope(Box<TransactionEnvelope>),
50207    TransactionSignaturePayload(Box<TransactionSignaturePayload>),
50208    TransactionSignaturePayloadTaggedTransaction(Box<TransactionSignaturePayloadTaggedTransaction>),
50209    ClaimAtomType(Box<ClaimAtomType>),
50210    ClaimOfferAtomV0(Box<ClaimOfferAtomV0>),
50211    ClaimOfferAtom(Box<ClaimOfferAtom>),
50212    ClaimLiquidityAtom(Box<ClaimLiquidityAtom>),
50213    ClaimAtom(Box<ClaimAtom>),
50214    CreateAccountResultCode(Box<CreateAccountResultCode>),
50215    CreateAccountResult(Box<CreateAccountResult>),
50216    PaymentResultCode(Box<PaymentResultCode>),
50217    PaymentResult(Box<PaymentResult>),
50218    PathPaymentStrictReceiveResultCode(Box<PathPaymentStrictReceiveResultCode>),
50219    SimplePaymentResult(Box<SimplePaymentResult>),
50220    PathPaymentStrictReceiveResult(Box<PathPaymentStrictReceiveResult>),
50221    PathPaymentStrictReceiveResultSuccess(Box<PathPaymentStrictReceiveResultSuccess>),
50222    PathPaymentStrictSendResultCode(Box<PathPaymentStrictSendResultCode>),
50223    PathPaymentStrictSendResult(Box<PathPaymentStrictSendResult>),
50224    PathPaymentStrictSendResultSuccess(Box<PathPaymentStrictSendResultSuccess>),
50225    ManageSellOfferResultCode(Box<ManageSellOfferResultCode>),
50226    ManageOfferEffect(Box<ManageOfferEffect>),
50227    ManageOfferSuccessResult(Box<ManageOfferSuccessResult>),
50228    ManageOfferSuccessResultOffer(Box<ManageOfferSuccessResultOffer>),
50229    ManageSellOfferResult(Box<ManageSellOfferResult>),
50230    ManageBuyOfferResultCode(Box<ManageBuyOfferResultCode>),
50231    ManageBuyOfferResult(Box<ManageBuyOfferResult>),
50232    SetOptionsResultCode(Box<SetOptionsResultCode>),
50233    SetOptionsResult(Box<SetOptionsResult>),
50234    ChangeTrustResultCode(Box<ChangeTrustResultCode>),
50235    ChangeTrustResult(Box<ChangeTrustResult>),
50236    AllowTrustResultCode(Box<AllowTrustResultCode>),
50237    AllowTrustResult(Box<AllowTrustResult>),
50238    AccountMergeResultCode(Box<AccountMergeResultCode>),
50239    AccountMergeResult(Box<AccountMergeResult>),
50240    InflationResultCode(Box<InflationResultCode>),
50241    InflationPayout(Box<InflationPayout>),
50242    InflationResult(Box<InflationResult>),
50243    ManageDataResultCode(Box<ManageDataResultCode>),
50244    ManageDataResult(Box<ManageDataResult>),
50245    BumpSequenceResultCode(Box<BumpSequenceResultCode>),
50246    BumpSequenceResult(Box<BumpSequenceResult>),
50247    CreateClaimableBalanceResultCode(Box<CreateClaimableBalanceResultCode>),
50248    CreateClaimableBalanceResult(Box<CreateClaimableBalanceResult>),
50249    ClaimClaimableBalanceResultCode(Box<ClaimClaimableBalanceResultCode>),
50250    ClaimClaimableBalanceResult(Box<ClaimClaimableBalanceResult>),
50251    BeginSponsoringFutureReservesResultCode(Box<BeginSponsoringFutureReservesResultCode>),
50252    BeginSponsoringFutureReservesResult(Box<BeginSponsoringFutureReservesResult>),
50253    EndSponsoringFutureReservesResultCode(Box<EndSponsoringFutureReservesResultCode>),
50254    EndSponsoringFutureReservesResult(Box<EndSponsoringFutureReservesResult>),
50255    RevokeSponsorshipResultCode(Box<RevokeSponsorshipResultCode>),
50256    RevokeSponsorshipResult(Box<RevokeSponsorshipResult>),
50257    ClawbackResultCode(Box<ClawbackResultCode>),
50258    ClawbackResult(Box<ClawbackResult>),
50259    ClawbackClaimableBalanceResultCode(Box<ClawbackClaimableBalanceResultCode>),
50260    ClawbackClaimableBalanceResult(Box<ClawbackClaimableBalanceResult>),
50261    SetTrustLineFlagsResultCode(Box<SetTrustLineFlagsResultCode>),
50262    SetTrustLineFlagsResult(Box<SetTrustLineFlagsResult>),
50263    LiquidityPoolDepositResultCode(Box<LiquidityPoolDepositResultCode>),
50264    LiquidityPoolDepositResult(Box<LiquidityPoolDepositResult>),
50265    LiquidityPoolWithdrawResultCode(Box<LiquidityPoolWithdrawResultCode>),
50266    LiquidityPoolWithdrawResult(Box<LiquidityPoolWithdrawResult>),
50267    InvokeHostFunctionResultCode(Box<InvokeHostFunctionResultCode>),
50268    InvokeHostFunctionResult(Box<InvokeHostFunctionResult>),
50269    ExtendFootprintTtlResultCode(Box<ExtendFootprintTtlResultCode>),
50270    ExtendFootprintTtlResult(Box<ExtendFootprintTtlResult>),
50271    RestoreFootprintResultCode(Box<RestoreFootprintResultCode>),
50272    RestoreFootprintResult(Box<RestoreFootprintResult>),
50273    OperationResultCode(Box<OperationResultCode>),
50274    OperationResult(Box<OperationResult>),
50275    OperationResultTr(Box<OperationResultTr>),
50276    TransactionResultCode(Box<TransactionResultCode>),
50277    InnerTransactionResult(Box<InnerTransactionResult>),
50278    InnerTransactionResultResult(Box<InnerTransactionResultResult>),
50279    InnerTransactionResultExt(Box<InnerTransactionResultExt>),
50280    InnerTransactionResultPair(Box<InnerTransactionResultPair>),
50281    TransactionResult(Box<TransactionResult>),
50282    TransactionResultResult(Box<TransactionResultResult>),
50283    TransactionResultExt(Box<TransactionResultExt>),
50284    Hash(Box<Hash>),
50285    Uint256(Box<Uint256>),
50286    Uint32(Box<Uint32>),
50287    Int32(Box<Int32>),
50288    Uint64(Box<Uint64>),
50289    Int64(Box<Int64>),
50290    TimePoint(Box<TimePoint>),
50291    Duration(Box<Duration>),
50292    ExtensionPoint(Box<ExtensionPoint>),
50293    CryptoKeyType(Box<CryptoKeyType>),
50294    PublicKeyType(Box<PublicKeyType>),
50295    SignerKeyType(Box<SignerKeyType>),
50296    PublicKey(Box<PublicKey>),
50297    SignerKey(Box<SignerKey>),
50298    SignerKeyEd25519SignedPayload(Box<SignerKeyEd25519SignedPayload>),
50299    Signature(Box<Signature>),
50300    SignatureHint(Box<SignatureHint>),
50301    NodeId(Box<NodeId>),
50302    AccountId(Box<AccountId>),
50303    Curve25519Secret(Box<Curve25519Secret>),
50304    Curve25519Public(Box<Curve25519Public>),
50305    HmacSha256Key(Box<HmacSha256Key>),
50306    HmacSha256Mac(Box<HmacSha256Mac>),
50307    ShortHashSeed(Box<ShortHashSeed>),
50308    BinaryFuseFilterType(Box<BinaryFuseFilterType>),
50309    SerializedBinaryFuseFilter(Box<SerializedBinaryFuseFilter>),
50310}
50311
50312impl Type {
50313    pub const VARIANTS: [TypeVariant; 464] = [
50314        TypeVariant::Value,
50315        TypeVariant::ScpBallot,
50316        TypeVariant::ScpStatementType,
50317        TypeVariant::ScpNomination,
50318        TypeVariant::ScpStatement,
50319        TypeVariant::ScpStatementPledges,
50320        TypeVariant::ScpStatementPrepare,
50321        TypeVariant::ScpStatementConfirm,
50322        TypeVariant::ScpStatementExternalize,
50323        TypeVariant::ScpEnvelope,
50324        TypeVariant::ScpQuorumSet,
50325        TypeVariant::ConfigSettingContractExecutionLanesV0,
50326        TypeVariant::ConfigSettingContractComputeV0,
50327        TypeVariant::ConfigSettingContractParallelComputeV0,
50328        TypeVariant::ConfigSettingContractLedgerCostV0,
50329        TypeVariant::ConfigSettingContractHistoricalDataV0,
50330        TypeVariant::ConfigSettingContractEventsV0,
50331        TypeVariant::ConfigSettingContractBandwidthV0,
50332        TypeVariant::ContractCostType,
50333        TypeVariant::ContractCostParamEntry,
50334        TypeVariant::StateArchivalSettings,
50335        TypeVariant::EvictionIterator,
50336        TypeVariant::ContractCostParams,
50337        TypeVariant::ConfigSettingId,
50338        TypeVariant::ConfigSettingEntry,
50339        TypeVariant::ScEnvMetaKind,
50340        TypeVariant::ScEnvMetaEntry,
50341        TypeVariant::ScEnvMetaEntryInterfaceVersion,
50342        TypeVariant::ScMetaV0,
50343        TypeVariant::ScMetaKind,
50344        TypeVariant::ScMetaEntry,
50345        TypeVariant::ScSpecType,
50346        TypeVariant::ScSpecTypeOption,
50347        TypeVariant::ScSpecTypeResult,
50348        TypeVariant::ScSpecTypeVec,
50349        TypeVariant::ScSpecTypeMap,
50350        TypeVariant::ScSpecTypeTuple,
50351        TypeVariant::ScSpecTypeBytesN,
50352        TypeVariant::ScSpecTypeUdt,
50353        TypeVariant::ScSpecTypeDef,
50354        TypeVariant::ScSpecUdtStructFieldV0,
50355        TypeVariant::ScSpecUdtStructV0,
50356        TypeVariant::ScSpecUdtUnionCaseVoidV0,
50357        TypeVariant::ScSpecUdtUnionCaseTupleV0,
50358        TypeVariant::ScSpecUdtUnionCaseV0Kind,
50359        TypeVariant::ScSpecUdtUnionCaseV0,
50360        TypeVariant::ScSpecUdtUnionV0,
50361        TypeVariant::ScSpecUdtEnumCaseV0,
50362        TypeVariant::ScSpecUdtEnumV0,
50363        TypeVariant::ScSpecUdtErrorEnumCaseV0,
50364        TypeVariant::ScSpecUdtErrorEnumV0,
50365        TypeVariant::ScSpecFunctionInputV0,
50366        TypeVariant::ScSpecFunctionV0,
50367        TypeVariant::ScSpecEntryKind,
50368        TypeVariant::ScSpecEntry,
50369        TypeVariant::ScValType,
50370        TypeVariant::ScErrorType,
50371        TypeVariant::ScErrorCode,
50372        TypeVariant::ScError,
50373        TypeVariant::UInt128Parts,
50374        TypeVariant::Int128Parts,
50375        TypeVariant::UInt256Parts,
50376        TypeVariant::Int256Parts,
50377        TypeVariant::ContractExecutableType,
50378        TypeVariant::ContractExecutable,
50379        TypeVariant::ScAddressType,
50380        TypeVariant::ScAddress,
50381        TypeVariant::ScVec,
50382        TypeVariant::ScMap,
50383        TypeVariant::ScBytes,
50384        TypeVariant::ScString,
50385        TypeVariant::ScSymbol,
50386        TypeVariant::ScNonceKey,
50387        TypeVariant::ScContractInstance,
50388        TypeVariant::ScVal,
50389        TypeVariant::ScMapEntry,
50390        TypeVariant::StoredTransactionSet,
50391        TypeVariant::StoredDebugTransactionSet,
50392        TypeVariant::PersistedScpStateV0,
50393        TypeVariant::PersistedScpStateV1,
50394        TypeVariant::PersistedScpState,
50395        TypeVariant::Thresholds,
50396        TypeVariant::String32,
50397        TypeVariant::String64,
50398        TypeVariant::SequenceNumber,
50399        TypeVariant::DataValue,
50400        TypeVariant::PoolId,
50401        TypeVariant::AssetCode4,
50402        TypeVariant::AssetCode12,
50403        TypeVariant::AssetType,
50404        TypeVariant::AssetCode,
50405        TypeVariant::AlphaNum4,
50406        TypeVariant::AlphaNum12,
50407        TypeVariant::Asset,
50408        TypeVariant::Price,
50409        TypeVariant::Liabilities,
50410        TypeVariant::ThresholdIndexes,
50411        TypeVariant::LedgerEntryType,
50412        TypeVariant::Signer,
50413        TypeVariant::AccountFlags,
50414        TypeVariant::SponsorshipDescriptor,
50415        TypeVariant::AccountEntryExtensionV3,
50416        TypeVariant::AccountEntryExtensionV2,
50417        TypeVariant::AccountEntryExtensionV2Ext,
50418        TypeVariant::AccountEntryExtensionV1,
50419        TypeVariant::AccountEntryExtensionV1Ext,
50420        TypeVariant::AccountEntry,
50421        TypeVariant::AccountEntryExt,
50422        TypeVariant::TrustLineFlags,
50423        TypeVariant::LiquidityPoolType,
50424        TypeVariant::TrustLineAsset,
50425        TypeVariant::TrustLineEntryExtensionV2,
50426        TypeVariant::TrustLineEntryExtensionV2Ext,
50427        TypeVariant::TrustLineEntry,
50428        TypeVariant::TrustLineEntryExt,
50429        TypeVariant::TrustLineEntryV1,
50430        TypeVariant::TrustLineEntryV1Ext,
50431        TypeVariant::OfferEntryFlags,
50432        TypeVariant::OfferEntry,
50433        TypeVariant::OfferEntryExt,
50434        TypeVariant::DataEntry,
50435        TypeVariant::DataEntryExt,
50436        TypeVariant::ClaimPredicateType,
50437        TypeVariant::ClaimPredicate,
50438        TypeVariant::ClaimantType,
50439        TypeVariant::Claimant,
50440        TypeVariant::ClaimantV0,
50441        TypeVariant::ClaimableBalanceIdType,
50442        TypeVariant::ClaimableBalanceId,
50443        TypeVariant::ClaimableBalanceFlags,
50444        TypeVariant::ClaimableBalanceEntryExtensionV1,
50445        TypeVariant::ClaimableBalanceEntryExtensionV1Ext,
50446        TypeVariant::ClaimableBalanceEntry,
50447        TypeVariant::ClaimableBalanceEntryExt,
50448        TypeVariant::LiquidityPoolConstantProductParameters,
50449        TypeVariant::LiquidityPoolEntry,
50450        TypeVariant::LiquidityPoolEntryBody,
50451        TypeVariant::LiquidityPoolEntryConstantProduct,
50452        TypeVariant::ContractDataDurability,
50453        TypeVariant::ContractDataEntry,
50454        TypeVariant::ContractCodeCostInputs,
50455        TypeVariant::ContractCodeEntry,
50456        TypeVariant::ContractCodeEntryExt,
50457        TypeVariant::ContractCodeEntryV1,
50458        TypeVariant::TtlEntry,
50459        TypeVariant::LedgerEntryExtensionV1,
50460        TypeVariant::LedgerEntryExtensionV1Ext,
50461        TypeVariant::LedgerEntry,
50462        TypeVariant::LedgerEntryData,
50463        TypeVariant::LedgerEntryExt,
50464        TypeVariant::LedgerKey,
50465        TypeVariant::LedgerKeyAccount,
50466        TypeVariant::LedgerKeyTrustLine,
50467        TypeVariant::LedgerKeyOffer,
50468        TypeVariant::LedgerKeyData,
50469        TypeVariant::LedgerKeyClaimableBalance,
50470        TypeVariant::LedgerKeyLiquidityPool,
50471        TypeVariant::LedgerKeyContractData,
50472        TypeVariant::LedgerKeyContractCode,
50473        TypeVariant::LedgerKeyConfigSetting,
50474        TypeVariant::LedgerKeyTtl,
50475        TypeVariant::EnvelopeType,
50476        TypeVariant::BucketListType,
50477        TypeVariant::BucketEntryType,
50478        TypeVariant::HotArchiveBucketEntryType,
50479        TypeVariant::ColdArchiveBucketEntryType,
50480        TypeVariant::BucketMetadata,
50481        TypeVariant::BucketMetadataExt,
50482        TypeVariant::BucketEntry,
50483        TypeVariant::HotArchiveBucketEntry,
50484        TypeVariant::ColdArchiveArchivedLeaf,
50485        TypeVariant::ColdArchiveDeletedLeaf,
50486        TypeVariant::ColdArchiveBoundaryLeaf,
50487        TypeVariant::ColdArchiveHashEntry,
50488        TypeVariant::ColdArchiveBucketEntry,
50489        TypeVariant::UpgradeType,
50490        TypeVariant::StellarValueType,
50491        TypeVariant::LedgerCloseValueSignature,
50492        TypeVariant::StellarValue,
50493        TypeVariant::StellarValueExt,
50494        TypeVariant::LedgerHeaderFlags,
50495        TypeVariant::LedgerHeaderExtensionV1,
50496        TypeVariant::LedgerHeaderExtensionV1Ext,
50497        TypeVariant::LedgerHeader,
50498        TypeVariant::LedgerHeaderExt,
50499        TypeVariant::LedgerUpgradeType,
50500        TypeVariant::ConfigUpgradeSetKey,
50501        TypeVariant::LedgerUpgrade,
50502        TypeVariant::ConfigUpgradeSet,
50503        TypeVariant::TxSetComponentType,
50504        TypeVariant::TxExecutionThread,
50505        TypeVariant::ParallelTxExecutionStage,
50506        TypeVariant::ParallelTxsComponent,
50507        TypeVariant::TxSetComponent,
50508        TypeVariant::TxSetComponentTxsMaybeDiscountedFee,
50509        TypeVariant::TransactionPhase,
50510        TypeVariant::TransactionSet,
50511        TypeVariant::TransactionSetV1,
50512        TypeVariant::GeneralizedTransactionSet,
50513        TypeVariant::TransactionResultPair,
50514        TypeVariant::TransactionResultSet,
50515        TypeVariant::TransactionHistoryEntry,
50516        TypeVariant::TransactionHistoryEntryExt,
50517        TypeVariant::TransactionHistoryResultEntry,
50518        TypeVariant::TransactionHistoryResultEntryExt,
50519        TypeVariant::LedgerHeaderHistoryEntry,
50520        TypeVariant::LedgerHeaderHistoryEntryExt,
50521        TypeVariant::LedgerScpMessages,
50522        TypeVariant::ScpHistoryEntryV0,
50523        TypeVariant::ScpHistoryEntry,
50524        TypeVariant::LedgerEntryChangeType,
50525        TypeVariant::LedgerEntryChange,
50526        TypeVariant::LedgerEntryChanges,
50527        TypeVariant::OperationMeta,
50528        TypeVariant::TransactionMetaV1,
50529        TypeVariant::TransactionMetaV2,
50530        TypeVariant::ContractEventType,
50531        TypeVariant::ContractEvent,
50532        TypeVariant::ContractEventBody,
50533        TypeVariant::ContractEventV0,
50534        TypeVariant::DiagnosticEvent,
50535        TypeVariant::SorobanTransactionMetaExtV1,
50536        TypeVariant::SorobanTransactionMetaExt,
50537        TypeVariant::SorobanTransactionMeta,
50538        TypeVariant::TransactionMetaV3,
50539        TypeVariant::InvokeHostFunctionSuccessPreImage,
50540        TypeVariant::TransactionMeta,
50541        TypeVariant::TransactionResultMeta,
50542        TypeVariant::UpgradeEntryMeta,
50543        TypeVariant::LedgerCloseMetaV0,
50544        TypeVariant::LedgerCloseMetaExtV1,
50545        TypeVariant::LedgerCloseMetaExtV2,
50546        TypeVariant::LedgerCloseMetaExt,
50547        TypeVariant::LedgerCloseMetaV1,
50548        TypeVariant::LedgerCloseMeta,
50549        TypeVariant::ErrorCode,
50550        TypeVariant::SError,
50551        TypeVariant::SendMore,
50552        TypeVariant::SendMoreExtended,
50553        TypeVariant::AuthCert,
50554        TypeVariant::Hello,
50555        TypeVariant::Auth,
50556        TypeVariant::IpAddrType,
50557        TypeVariant::PeerAddress,
50558        TypeVariant::PeerAddressIp,
50559        TypeVariant::MessageType,
50560        TypeVariant::DontHave,
50561        TypeVariant::SurveyMessageCommandType,
50562        TypeVariant::SurveyMessageResponseType,
50563        TypeVariant::TimeSlicedSurveyStartCollectingMessage,
50564        TypeVariant::SignedTimeSlicedSurveyStartCollectingMessage,
50565        TypeVariant::TimeSlicedSurveyStopCollectingMessage,
50566        TypeVariant::SignedTimeSlicedSurveyStopCollectingMessage,
50567        TypeVariant::SurveyRequestMessage,
50568        TypeVariant::TimeSlicedSurveyRequestMessage,
50569        TypeVariant::SignedSurveyRequestMessage,
50570        TypeVariant::SignedTimeSlicedSurveyRequestMessage,
50571        TypeVariant::EncryptedBody,
50572        TypeVariant::SurveyResponseMessage,
50573        TypeVariant::TimeSlicedSurveyResponseMessage,
50574        TypeVariant::SignedSurveyResponseMessage,
50575        TypeVariant::SignedTimeSlicedSurveyResponseMessage,
50576        TypeVariant::PeerStats,
50577        TypeVariant::PeerStatList,
50578        TypeVariant::TimeSlicedNodeData,
50579        TypeVariant::TimeSlicedPeerData,
50580        TypeVariant::TimeSlicedPeerDataList,
50581        TypeVariant::TopologyResponseBodyV0,
50582        TypeVariant::TopologyResponseBodyV1,
50583        TypeVariant::TopologyResponseBodyV2,
50584        TypeVariant::SurveyResponseBody,
50585        TypeVariant::TxAdvertVector,
50586        TypeVariant::FloodAdvert,
50587        TypeVariant::TxDemandVector,
50588        TypeVariant::FloodDemand,
50589        TypeVariant::StellarMessage,
50590        TypeVariant::AuthenticatedMessage,
50591        TypeVariant::AuthenticatedMessageV0,
50592        TypeVariant::LiquidityPoolParameters,
50593        TypeVariant::MuxedAccount,
50594        TypeVariant::MuxedAccountMed25519,
50595        TypeVariant::DecoratedSignature,
50596        TypeVariant::OperationType,
50597        TypeVariant::CreateAccountOp,
50598        TypeVariant::PaymentOp,
50599        TypeVariant::PathPaymentStrictReceiveOp,
50600        TypeVariant::PathPaymentStrictSendOp,
50601        TypeVariant::ManageSellOfferOp,
50602        TypeVariant::ManageBuyOfferOp,
50603        TypeVariant::CreatePassiveSellOfferOp,
50604        TypeVariant::SetOptionsOp,
50605        TypeVariant::ChangeTrustAsset,
50606        TypeVariant::ChangeTrustOp,
50607        TypeVariant::AllowTrustOp,
50608        TypeVariant::ManageDataOp,
50609        TypeVariant::BumpSequenceOp,
50610        TypeVariant::CreateClaimableBalanceOp,
50611        TypeVariant::ClaimClaimableBalanceOp,
50612        TypeVariant::BeginSponsoringFutureReservesOp,
50613        TypeVariant::RevokeSponsorshipType,
50614        TypeVariant::RevokeSponsorshipOp,
50615        TypeVariant::RevokeSponsorshipOpSigner,
50616        TypeVariant::ClawbackOp,
50617        TypeVariant::ClawbackClaimableBalanceOp,
50618        TypeVariant::SetTrustLineFlagsOp,
50619        TypeVariant::LiquidityPoolDepositOp,
50620        TypeVariant::LiquidityPoolWithdrawOp,
50621        TypeVariant::HostFunctionType,
50622        TypeVariant::ContractIdPreimageType,
50623        TypeVariant::ContractIdPreimage,
50624        TypeVariant::ContractIdPreimageFromAddress,
50625        TypeVariant::CreateContractArgs,
50626        TypeVariant::CreateContractArgsV2,
50627        TypeVariant::InvokeContractArgs,
50628        TypeVariant::HostFunction,
50629        TypeVariant::SorobanAuthorizedFunctionType,
50630        TypeVariant::SorobanAuthorizedFunction,
50631        TypeVariant::SorobanAuthorizedInvocation,
50632        TypeVariant::SorobanAddressCredentials,
50633        TypeVariant::SorobanCredentialsType,
50634        TypeVariant::SorobanCredentials,
50635        TypeVariant::SorobanAuthorizationEntry,
50636        TypeVariant::InvokeHostFunctionOp,
50637        TypeVariant::ExtendFootprintTtlOp,
50638        TypeVariant::RestoreFootprintOp,
50639        TypeVariant::Operation,
50640        TypeVariant::OperationBody,
50641        TypeVariant::HashIdPreimage,
50642        TypeVariant::HashIdPreimageOperationId,
50643        TypeVariant::HashIdPreimageRevokeId,
50644        TypeVariant::HashIdPreimageContractId,
50645        TypeVariant::HashIdPreimageSorobanAuthorization,
50646        TypeVariant::MemoType,
50647        TypeVariant::Memo,
50648        TypeVariant::TimeBounds,
50649        TypeVariant::LedgerBounds,
50650        TypeVariant::PreconditionsV2,
50651        TypeVariant::PreconditionType,
50652        TypeVariant::Preconditions,
50653        TypeVariant::LedgerFootprint,
50654        TypeVariant::ArchivalProofType,
50655        TypeVariant::ArchivalProofNode,
50656        TypeVariant::ProofLevel,
50657        TypeVariant::ExistenceProofBody,
50658        TypeVariant::NonexistenceProofBody,
50659        TypeVariant::ArchivalProof,
50660        TypeVariant::ArchivalProofBody,
50661        TypeVariant::SorobanResources,
50662        TypeVariant::SorobanTransactionData,
50663        TypeVariant::SorobanTransactionDataExt,
50664        TypeVariant::TransactionV0,
50665        TypeVariant::TransactionV0Ext,
50666        TypeVariant::TransactionV0Envelope,
50667        TypeVariant::Transaction,
50668        TypeVariant::TransactionExt,
50669        TypeVariant::TransactionV1Envelope,
50670        TypeVariant::FeeBumpTransaction,
50671        TypeVariant::FeeBumpTransactionInnerTx,
50672        TypeVariant::FeeBumpTransactionExt,
50673        TypeVariant::FeeBumpTransactionEnvelope,
50674        TypeVariant::TransactionEnvelope,
50675        TypeVariant::TransactionSignaturePayload,
50676        TypeVariant::TransactionSignaturePayloadTaggedTransaction,
50677        TypeVariant::ClaimAtomType,
50678        TypeVariant::ClaimOfferAtomV0,
50679        TypeVariant::ClaimOfferAtom,
50680        TypeVariant::ClaimLiquidityAtom,
50681        TypeVariant::ClaimAtom,
50682        TypeVariant::CreateAccountResultCode,
50683        TypeVariant::CreateAccountResult,
50684        TypeVariant::PaymentResultCode,
50685        TypeVariant::PaymentResult,
50686        TypeVariant::PathPaymentStrictReceiveResultCode,
50687        TypeVariant::SimplePaymentResult,
50688        TypeVariant::PathPaymentStrictReceiveResult,
50689        TypeVariant::PathPaymentStrictReceiveResultSuccess,
50690        TypeVariant::PathPaymentStrictSendResultCode,
50691        TypeVariant::PathPaymentStrictSendResult,
50692        TypeVariant::PathPaymentStrictSendResultSuccess,
50693        TypeVariant::ManageSellOfferResultCode,
50694        TypeVariant::ManageOfferEffect,
50695        TypeVariant::ManageOfferSuccessResult,
50696        TypeVariant::ManageOfferSuccessResultOffer,
50697        TypeVariant::ManageSellOfferResult,
50698        TypeVariant::ManageBuyOfferResultCode,
50699        TypeVariant::ManageBuyOfferResult,
50700        TypeVariant::SetOptionsResultCode,
50701        TypeVariant::SetOptionsResult,
50702        TypeVariant::ChangeTrustResultCode,
50703        TypeVariant::ChangeTrustResult,
50704        TypeVariant::AllowTrustResultCode,
50705        TypeVariant::AllowTrustResult,
50706        TypeVariant::AccountMergeResultCode,
50707        TypeVariant::AccountMergeResult,
50708        TypeVariant::InflationResultCode,
50709        TypeVariant::InflationPayout,
50710        TypeVariant::InflationResult,
50711        TypeVariant::ManageDataResultCode,
50712        TypeVariant::ManageDataResult,
50713        TypeVariant::BumpSequenceResultCode,
50714        TypeVariant::BumpSequenceResult,
50715        TypeVariant::CreateClaimableBalanceResultCode,
50716        TypeVariant::CreateClaimableBalanceResult,
50717        TypeVariant::ClaimClaimableBalanceResultCode,
50718        TypeVariant::ClaimClaimableBalanceResult,
50719        TypeVariant::BeginSponsoringFutureReservesResultCode,
50720        TypeVariant::BeginSponsoringFutureReservesResult,
50721        TypeVariant::EndSponsoringFutureReservesResultCode,
50722        TypeVariant::EndSponsoringFutureReservesResult,
50723        TypeVariant::RevokeSponsorshipResultCode,
50724        TypeVariant::RevokeSponsorshipResult,
50725        TypeVariant::ClawbackResultCode,
50726        TypeVariant::ClawbackResult,
50727        TypeVariant::ClawbackClaimableBalanceResultCode,
50728        TypeVariant::ClawbackClaimableBalanceResult,
50729        TypeVariant::SetTrustLineFlagsResultCode,
50730        TypeVariant::SetTrustLineFlagsResult,
50731        TypeVariant::LiquidityPoolDepositResultCode,
50732        TypeVariant::LiquidityPoolDepositResult,
50733        TypeVariant::LiquidityPoolWithdrawResultCode,
50734        TypeVariant::LiquidityPoolWithdrawResult,
50735        TypeVariant::InvokeHostFunctionResultCode,
50736        TypeVariant::InvokeHostFunctionResult,
50737        TypeVariant::ExtendFootprintTtlResultCode,
50738        TypeVariant::ExtendFootprintTtlResult,
50739        TypeVariant::RestoreFootprintResultCode,
50740        TypeVariant::RestoreFootprintResult,
50741        TypeVariant::OperationResultCode,
50742        TypeVariant::OperationResult,
50743        TypeVariant::OperationResultTr,
50744        TypeVariant::TransactionResultCode,
50745        TypeVariant::InnerTransactionResult,
50746        TypeVariant::InnerTransactionResultResult,
50747        TypeVariant::InnerTransactionResultExt,
50748        TypeVariant::InnerTransactionResultPair,
50749        TypeVariant::TransactionResult,
50750        TypeVariant::TransactionResultResult,
50751        TypeVariant::TransactionResultExt,
50752        TypeVariant::Hash,
50753        TypeVariant::Uint256,
50754        TypeVariant::Uint32,
50755        TypeVariant::Int32,
50756        TypeVariant::Uint64,
50757        TypeVariant::Int64,
50758        TypeVariant::TimePoint,
50759        TypeVariant::Duration,
50760        TypeVariant::ExtensionPoint,
50761        TypeVariant::CryptoKeyType,
50762        TypeVariant::PublicKeyType,
50763        TypeVariant::SignerKeyType,
50764        TypeVariant::PublicKey,
50765        TypeVariant::SignerKey,
50766        TypeVariant::SignerKeyEd25519SignedPayload,
50767        TypeVariant::Signature,
50768        TypeVariant::SignatureHint,
50769        TypeVariant::NodeId,
50770        TypeVariant::AccountId,
50771        TypeVariant::Curve25519Secret,
50772        TypeVariant::Curve25519Public,
50773        TypeVariant::HmacSha256Key,
50774        TypeVariant::HmacSha256Mac,
50775        TypeVariant::ShortHashSeed,
50776        TypeVariant::BinaryFuseFilterType,
50777        TypeVariant::SerializedBinaryFuseFilter,
50778    ];
50779    pub const VARIANTS_STR: [&'static str; 464] = [
50780        "Value",
50781        "ScpBallot",
50782        "ScpStatementType",
50783        "ScpNomination",
50784        "ScpStatement",
50785        "ScpStatementPledges",
50786        "ScpStatementPrepare",
50787        "ScpStatementConfirm",
50788        "ScpStatementExternalize",
50789        "ScpEnvelope",
50790        "ScpQuorumSet",
50791        "ConfigSettingContractExecutionLanesV0",
50792        "ConfigSettingContractComputeV0",
50793        "ConfigSettingContractParallelComputeV0",
50794        "ConfigSettingContractLedgerCostV0",
50795        "ConfigSettingContractHistoricalDataV0",
50796        "ConfigSettingContractEventsV0",
50797        "ConfigSettingContractBandwidthV0",
50798        "ContractCostType",
50799        "ContractCostParamEntry",
50800        "StateArchivalSettings",
50801        "EvictionIterator",
50802        "ContractCostParams",
50803        "ConfigSettingId",
50804        "ConfigSettingEntry",
50805        "ScEnvMetaKind",
50806        "ScEnvMetaEntry",
50807        "ScEnvMetaEntryInterfaceVersion",
50808        "ScMetaV0",
50809        "ScMetaKind",
50810        "ScMetaEntry",
50811        "ScSpecType",
50812        "ScSpecTypeOption",
50813        "ScSpecTypeResult",
50814        "ScSpecTypeVec",
50815        "ScSpecTypeMap",
50816        "ScSpecTypeTuple",
50817        "ScSpecTypeBytesN",
50818        "ScSpecTypeUdt",
50819        "ScSpecTypeDef",
50820        "ScSpecUdtStructFieldV0",
50821        "ScSpecUdtStructV0",
50822        "ScSpecUdtUnionCaseVoidV0",
50823        "ScSpecUdtUnionCaseTupleV0",
50824        "ScSpecUdtUnionCaseV0Kind",
50825        "ScSpecUdtUnionCaseV0",
50826        "ScSpecUdtUnionV0",
50827        "ScSpecUdtEnumCaseV0",
50828        "ScSpecUdtEnumV0",
50829        "ScSpecUdtErrorEnumCaseV0",
50830        "ScSpecUdtErrorEnumV0",
50831        "ScSpecFunctionInputV0",
50832        "ScSpecFunctionV0",
50833        "ScSpecEntryKind",
50834        "ScSpecEntry",
50835        "ScValType",
50836        "ScErrorType",
50837        "ScErrorCode",
50838        "ScError",
50839        "UInt128Parts",
50840        "Int128Parts",
50841        "UInt256Parts",
50842        "Int256Parts",
50843        "ContractExecutableType",
50844        "ContractExecutable",
50845        "ScAddressType",
50846        "ScAddress",
50847        "ScVec",
50848        "ScMap",
50849        "ScBytes",
50850        "ScString",
50851        "ScSymbol",
50852        "ScNonceKey",
50853        "ScContractInstance",
50854        "ScVal",
50855        "ScMapEntry",
50856        "StoredTransactionSet",
50857        "StoredDebugTransactionSet",
50858        "PersistedScpStateV0",
50859        "PersistedScpStateV1",
50860        "PersistedScpState",
50861        "Thresholds",
50862        "String32",
50863        "String64",
50864        "SequenceNumber",
50865        "DataValue",
50866        "PoolId",
50867        "AssetCode4",
50868        "AssetCode12",
50869        "AssetType",
50870        "AssetCode",
50871        "AlphaNum4",
50872        "AlphaNum12",
50873        "Asset",
50874        "Price",
50875        "Liabilities",
50876        "ThresholdIndexes",
50877        "LedgerEntryType",
50878        "Signer",
50879        "AccountFlags",
50880        "SponsorshipDescriptor",
50881        "AccountEntryExtensionV3",
50882        "AccountEntryExtensionV2",
50883        "AccountEntryExtensionV2Ext",
50884        "AccountEntryExtensionV1",
50885        "AccountEntryExtensionV1Ext",
50886        "AccountEntry",
50887        "AccountEntryExt",
50888        "TrustLineFlags",
50889        "LiquidityPoolType",
50890        "TrustLineAsset",
50891        "TrustLineEntryExtensionV2",
50892        "TrustLineEntryExtensionV2Ext",
50893        "TrustLineEntry",
50894        "TrustLineEntryExt",
50895        "TrustLineEntryV1",
50896        "TrustLineEntryV1Ext",
50897        "OfferEntryFlags",
50898        "OfferEntry",
50899        "OfferEntryExt",
50900        "DataEntry",
50901        "DataEntryExt",
50902        "ClaimPredicateType",
50903        "ClaimPredicate",
50904        "ClaimantType",
50905        "Claimant",
50906        "ClaimantV0",
50907        "ClaimableBalanceIdType",
50908        "ClaimableBalanceId",
50909        "ClaimableBalanceFlags",
50910        "ClaimableBalanceEntryExtensionV1",
50911        "ClaimableBalanceEntryExtensionV1Ext",
50912        "ClaimableBalanceEntry",
50913        "ClaimableBalanceEntryExt",
50914        "LiquidityPoolConstantProductParameters",
50915        "LiquidityPoolEntry",
50916        "LiquidityPoolEntryBody",
50917        "LiquidityPoolEntryConstantProduct",
50918        "ContractDataDurability",
50919        "ContractDataEntry",
50920        "ContractCodeCostInputs",
50921        "ContractCodeEntry",
50922        "ContractCodeEntryExt",
50923        "ContractCodeEntryV1",
50924        "TtlEntry",
50925        "LedgerEntryExtensionV1",
50926        "LedgerEntryExtensionV1Ext",
50927        "LedgerEntry",
50928        "LedgerEntryData",
50929        "LedgerEntryExt",
50930        "LedgerKey",
50931        "LedgerKeyAccount",
50932        "LedgerKeyTrustLine",
50933        "LedgerKeyOffer",
50934        "LedgerKeyData",
50935        "LedgerKeyClaimableBalance",
50936        "LedgerKeyLiquidityPool",
50937        "LedgerKeyContractData",
50938        "LedgerKeyContractCode",
50939        "LedgerKeyConfigSetting",
50940        "LedgerKeyTtl",
50941        "EnvelopeType",
50942        "BucketListType",
50943        "BucketEntryType",
50944        "HotArchiveBucketEntryType",
50945        "ColdArchiveBucketEntryType",
50946        "BucketMetadata",
50947        "BucketMetadataExt",
50948        "BucketEntry",
50949        "HotArchiveBucketEntry",
50950        "ColdArchiveArchivedLeaf",
50951        "ColdArchiveDeletedLeaf",
50952        "ColdArchiveBoundaryLeaf",
50953        "ColdArchiveHashEntry",
50954        "ColdArchiveBucketEntry",
50955        "UpgradeType",
50956        "StellarValueType",
50957        "LedgerCloseValueSignature",
50958        "StellarValue",
50959        "StellarValueExt",
50960        "LedgerHeaderFlags",
50961        "LedgerHeaderExtensionV1",
50962        "LedgerHeaderExtensionV1Ext",
50963        "LedgerHeader",
50964        "LedgerHeaderExt",
50965        "LedgerUpgradeType",
50966        "ConfigUpgradeSetKey",
50967        "LedgerUpgrade",
50968        "ConfigUpgradeSet",
50969        "TxSetComponentType",
50970        "TxExecutionThread",
50971        "ParallelTxExecutionStage",
50972        "ParallelTxsComponent",
50973        "TxSetComponent",
50974        "TxSetComponentTxsMaybeDiscountedFee",
50975        "TransactionPhase",
50976        "TransactionSet",
50977        "TransactionSetV1",
50978        "GeneralizedTransactionSet",
50979        "TransactionResultPair",
50980        "TransactionResultSet",
50981        "TransactionHistoryEntry",
50982        "TransactionHistoryEntryExt",
50983        "TransactionHistoryResultEntry",
50984        "TransactionHistoryResultEntryExt",
50985        "LedgerHeaderHistoryEntry",
50986        "LedgerHeaderHistoryEntryExt",
50987        "LedgerScpMessages",
50988        "ScpHistoryEntryV0",
50989        "ScpHistoryEntry",
50990        "LedgerEntryChangeType",
50991        "LedgerEntryChange",
50992        "LedgerEntryChanges",
50993        "OperationMeta",
50994        "TransactionMetaV1",
50995        "TransactionMetaV2",
50996        "ContractEventType",
50997        "ContractEvent",
50998        "ContractEventBody",
50999        "ContractEventV0",
51000        "DiagnosticEvent",
51001        "SorobanTransactionMetaExtV1",
51002        "SorobanTransactionMetaExt",
51003        "SorobanTransactionMeta",
51004        "TransactionMetaV3",
51005        "InvokeHostFunctionSuccessPreImage",
51006        "TransactionMeta",
51007        "TransactionResultMeta",
51008        "UpgradeEntryMeta",
51009        "LedgerCloseMetaV0",
51010        "LedgerCloseMetaExtV1",
51011        "LedgerCloseMetaExtV2",
51012        "LedgerCloseMetaExt",
51013        "LedgerCloseMetaV1",
51014        "LedgerCloseMeta",
51015        "ErrorCode",
51016        "SError",
51017        "SendMore",
51018        "SendMoreExtended",
51019        "AuthCert",
51020        "Hello",
51021        "Auth",
51022        "IpAddrType",
51023        "PeerAddress",
51024        "PeerAddressIp",
51025        "MessageType",
51026        "DontHave",
51027        "SurveyMessageCommandType",
51028        "SurveyMessageResponseType",
51029        "TimeSlicedSurveyStartCollectingMessage",
51030        "SignedTimeSlicedSurveyStartCollectingMessage",
51031        "TimeSlicedSurveyStopCollectingMessage",
51032        "SignedTimeSlicedSurveyStopCollectingMessage",
51033        "SurveyRequestMessage",
51034        "TimeSlicedSurveyRequestMessage",
51035        "SignedSurveyRequestMessage",
51036        "SignedTimeSlicedSurveyRequestMessage",
51037        "EncryptedBody",
51038        "SurveyResponseMessage",
51039        "TimeSlicedSurveyResponseMessage",
51040        "SignedSurveyResponseMessage",
51041        "SignedTimeSlicedSurveyResponseMessage",
51042        "PeerStats",
51043        "PeerStatList",
51044        "TimeSlicedNodeData",
51045        "TimeSlicedPeerData",
51046        "TimeSlicedPeerDataList",
51047        "TopologyResponseBodyV0",
51048        "TopologyResponseBodyV1",
51049        "TopologyResponseBodyV2",
51050        "SurveyResponseBody",
51051        "TxAdvertVector",
51052        "FloodAdvert",
51053        "TxDemandVector",
51054        "FloodDemand",
51055        "StellarMessage",
51056        "AuthenticatedMessage",
51057        "AuthenticatedMessageV0",
51058        "LiquidityPoolParameters",
51059        "MuxedAccount",
51060        "MuxedAccountMed25519",
51061        "DecoratedSignature",
51062        "OperationType",
51063        "CreateAccountOp",
51064        "PaymentOp",
51065        "PathPaymentStrictReceiveOp",
51066        "PathPaymentStrictSendOp",
51067        "ManageSellOfferOp",
51068        "ManageBuyOfferOp",
51069        "CreatePassiveSellOfferOp",
51070        "SetOptionsOp",
51071        "ChangeTrustAsset",
51072        "ChangeTrustOp",
51073        "AllowTrustOp",
51074        "ManageDataOp",
51075        "BumpSequenceOp",
51076        "CreateClaimableBalanceOp",
51077        "ClaimClaimableBalanceOp",
51078        "BeginSponsoringFutureReservesOp",
51079        "RevokeSponsorshipType",
51080        "RevokeSponsorshipOp",
51081        "RevokeSponsorshipOpSigner",
51082        "ClawbackOp",
51083        "ClawbackClaimableBalanceOp",
51084        "SetTrustLineFlagsOp",
51085        "LiquidityPoolDepositOp",
51086        "LiquidityPoolWithdrawOp",
51087        "HostFunctionType",
51088        "ContractIdPreimageType",
51089        "ContractIdPreimage",
51090        "ContractIdPreimageFromAddress",
51091        "CreateContractArgs",
51092        "CreateContractArgsV2",
51093        "InvokeContractArgs",
51094        "HostFunction",
51095        "SorobanAuthorizedFunctionType",
51096        "SorobanAuthorizedFunction",
51097        "SorobanAuthorizedInvocation",
51098        "SorobanAddressCredentials",
51099        "SorobanCredentialsType",
51100        "SorobanCredentials",
51101        "SorobanAuthorizationEntry",
51102        "InvokeHostFunctionOp",
51103        "ExtendFootprintTtlOp",
51104        "RestoreFootprintOp",
51105        "Operation",
51106        "OperationBody",
51107        "HashIdPreimage",
51108        "HashIdPreimageOperationId",
51109        "HashIdPreimageRevokeId",
51110        "HashIdPreimageContractId",
51111        "HashIdPreimageSorobanAuthorization",
51112        "MemoType",
51113        "Memo",
51114        "TimeBounds",
51115        "LedgerBounds",
51116        "PreconditionsV2",
51117        "PreconditionType",
51118        "Preconditions",
51119        "LedgerFootprint",
51120        "ArchivalProofType",
51121        "ArchivalProofNode",
51122        "ProofLevel",
51123        "ExistenceProofBody",
51124        "NonexistenceProofBody",
51125        "ArchivalProof",
51126        "ArchivalProofBody",
51127        "SorobanResources",
51128        "SorobanTransactionData",
51129        "SorobanTransactionDataExt",
51130        "TransactionV0",
51131        "TransactionV0Ext",
51132        "TransactionV0Envelope",
51133        "Transaction",
51134        "TransactionExt",
51135        "TransactionV1Envelope",
51136        "FeeBumpTransaction",
51137        "FeeBumpTransactionInnerTx",
51138        "FeeBumpTransactionExt",
51139        "FeeBumpTransactionEnvelope",
51140        "TransactionEnvelope",
51141        "TransactionSignaturePayload",
51142        "TransactionSignaturePayloadTaggedTransaction",
51143        "ClaimAtomType",
51144        "ClaimOfferAtomV0",
51145        "ClaimOfferAtom",
51146        "ClaimLiquidityAtom",
51147        "ClaimAtom",
51148        "CreateAccountResultCode",
51149        "CreateAccountResult",
51150        "PaymentResultCode",
51151        "PaymentResult",
51152        "PathPaymentStrictReceiveResultCode",
51153        "SimplePaymentResult",
51154        "PathPaymentStrictReceiveResult",
51155        "PathPaymentStrictReceiveResultSuccess",
51156        "PathPaymentStrictSendResultCode",
51157        "PathPaymentStrictSendResult",
51158        "PathPaymentStrictSendResultSuccess",
51159        "ManageSellOfferResultCode",
51160        "ManageOfferEffect",
51161        "ManageOfferSuccessResult",
51162        "ManageOfferSuccessResultOffer",
51163        "ManageSellOfferResult",
51164        "ManageBuyOfferResultCode",
51165        "ManageBuyOfferResult",
51166        "SetOptionsResultCode",
51167        "SetOptionsResult",
51168        "ChangeTrustResultCode",
51169        "ChangeTrustResult",
51170        "AllowTrustResultCode",
51171        "AllowTrustResult",
51172        "AccountMergeResultCode",
51173        "AccountMergeResult",
51174        "InflationResultCode",
51175        "InflationPayout",
51176        "InflationResult",
51177        "ManageDataResultCode",
51178        "ManageDataResult",
51179        "BumpSequenceResultCode",
51180        "BumpSequenceResult",
51181        "CreateClaimableBalanceResultCode",
51182        "CreateClaimableBalanceResult",
51183        "ClaimClaimableBalanceResultCode",
51184        "ClaimClaimableBalanceResult",
51185        "BeginSponsoringFutureReservesResultCode",
51186        "BeginSponsoringFutureReservesResult",
51187        "EndSponsoringFutureReservesResultCode",
51188        "EndSponsoringFutureReservesResult",
51189        "RevokeSponsorshipResultCode",
51190        "RevokeSponsorshipResult",
51191        "ClawbackResultCode",
51192        "ClawbackResult",
51193        "ClawbackClaimableBalanceResultCode",
51194        "ClawbackClaimableBalanceResult",
51195        "SetTrustLineFlagsResultCode",
51196        "SetTrustLineFlagsResult",
51197        "LiquidityPoolDepositResultCode",
51198        "LiquidityPoolDepositResult",
51199        "LiquidityPoolWithdrawResultCode",
51200        "LiquidityPoolWithdrawResult",
51201        "InvokeHostFunctionResultCode",
51202        "InvokeHostFunctionResult",
51203        "ExtendFootprintTtlResultCode",
51204        "ExtendFootprintTtlResult",
51205        "RestoreFootprintResultCode",
51206        "RestoreFootprintResult",
51207        "OperationResultCode",
51208        "OperationResult",
51209        "OperationResultTr",
51210        "TransactionResultCode",
51211        "InnerTransactionResult",
51212        "InnerTransactionResultResult",
51213        "InnerTransactionResultExt",
51214        "InnerTransactionResultPair",
51215        "TransactionResult",
51216        "TransactionResultResult",
51217        "TransactionResultExt",
51218        "Hash",
51219        "Uint256",
51220        "Uint32",
51221        "Int32",
51222        "Uint64",
51223        "Int64",
51224        "TimePoint",
51225        "Duration",
51226        "ExtensionPoint",
51227        "CryptoKeyType",
51228        "PublicKeyType",
51229        "SignerKeyType",
51230        "PublicKey",
51231        "SignerKey",
51232        "SignerKeyEd25519SignedPayload",
51233        "Signature",
51234        "SignatureHint",
51235        "NodeId",
51236        "AccountId",
51237        "Curve25519Secret",
51238        "Curve25519Public",
51239        "HmacSha256Key",
51240        "HmacSha256Mac",
51241        "ShortHashSeed",
51242        "BinaryFuseFilterType",
51243        "SerializedBinaryFuseFilter",
51244    ];
51245
51246    #[cfg(feature = "std")]
51247    #[allow(clippy::too_many_lines)]
51248    pub fn read_xdr<R: Read>(v: TypeVariant, r: &mut Limited<R>) -> Result<Self> {
51249        match v {
51250            TypeVariant::Value => {
51251                r.with_limited_depth(|r| Ok(Self::Value(Box::new(Value::read_xdr(r)?))))
51252            }
51253            TypeVariant::ScpBallot => {
51254                r.with_limited_depth(|r| Ok(Self::ScpBallot(Box::new(ScpBallot::read_xdr(r)?))))
51255            }
51256            TypeVariant::ScpStatementType => r.with_limited_depth(|r| {
51257                Ok(Self::ScpStatementType(Box::new(
51258                    ScpStatementType::read_xdr(r)?,
51259                )))
51260            }),
51261            TypeVariant::ScpNomination => r.with_limited_depth(|r| {
51262                Ok(Self::ScpNomination(Box::new(ScpNomination::read_xdr(r)?)))
51263            }),
51264            TypeVariant::ScpStatement => r.with_limited_depth(|r| {
51265                Ok(Self::ScpStatement(Box::new(ScpStatement::read_xdr(r)?)))
51266            }),
51267            TypeVariant::ScpStatementPledges => r.with_limited_depth(|r| {
51268                Ok(Self::ScpStatementPledges(Box::new(
51269                    ScpStatementPledges::read_xdr(r)?,
51270                )))
51271            }),
51272            TypeVariant::ScpStatementPrepare => r.with_limited_depth(|r| {
51273                Ok(Self::ScpStatementPrepare(Box::new(
51274                    ScpStatementPrepare::read_xdr(r)?,
51275                )))
51276            }),
51277            TypeVariant::ScpStatementConfirm => r.with_limited_depth(|r| {
51278                Ok(Self::ScpStatementConfirm(Box::new(
51279                    ScpStatementConfirm::read_xdr(r)?,
51280                )))
51281            }),
51282            TypeVariant::ScpStatementExternalize => r.with_limited_depth(|r| {
51283                Ok(Self::ScpStatementExternalize(Box::new(
51284                    ScpStatementExternalize::read_xdr(r)?,
51285                )))
51286            }),
51287            TypeVariant::ScpEnvelope => {
51288                r.with_limited_depth(|r| Ok(Self::ScpEnvelope(Box::new(ScpEnvelope::read_xdr(r)?))))
51289            }
51290            TypeVariant::ScpQuorumSet => r.with_limited_depth(|r| {
51291                Ok(Self::ScpQuorumSet(Box::new(ScpQuorumSet::read_xdr(r)?)))
51292            }),
51293            TypeVariant::ConfigSettingContractExecutionLanesV0 => r.with_limited_depth(|r| {
51294                Ok(Self::ConfigSettingContractExecutionLanesV0(Box::new(
51295                    ConfigSettingContractExecutionLanesV0::read_xdr(r)?,
51296                )))
51297            }),
51298            TypeVariant::ConfigSettingContractComputeV0 => r.with_limited_depth(|r| {
51299                Ok(Self::ConfigSettingContractComputeV0(Box::new(
51300                    ConfigSettingContractComputeV0::read_xdr(r)?,
51301                )))
51302            }),
51303            TypeVariant::ConfigSettingContractParallelComputeV0 => r.with_limited_depth(|r| {
51304                Ok(Self::ConfigSettingContractParallelComputeV0(Box::new(
51305                    ConfigSettingContractParallelComputeV0::read_xdr(r)?,
51306                )))
51307            }),
51308            TypeVariant::ConfigSettingContractLedgerCostV0 => r.with_limited_depth(|r| {
51309                Ok(Self::ConfigSettingContractLedgerCostV0(Box::new(
51310                    ConfigSettingContractLedgerCostV0::read_xdr(r)?,
51311                )))
51312            }),
51313            TypeVariant::ConfigSettingContractHistoricalDataV0 => r.with_limited_depth(|r| {
51314                Ok(Self::ConfigSettingContractHistoricalDataV0(Box::new(
51315                    ConfigSettingContractHistoricalDataV0::read_xdr(r)?,
51316                )))
51317            }),
51318            TypeVariant::ConfigSettingContractEventsV0 => r.with_limited_depth(|r| {
51319                Ok(Self::ConfigSettingContractEventsV0(Box::new(
51320                    ConfigSettingContractEventsV0::read_xdr(r)?,
51321                )))
51322            }),
51323            TypeVariant::ConfigSettingContractBandwidthV0 => r.with_limited_depth(|r| {
51324                Ok(Self::ConfigSettingContractBandwidthV0(Box::new(
51325                    ConfigSettingContractBandwidthV0::read_xdr(r)?,
51326                )))
51327            }),
51328            TypeVariant::ContractCostType => r.with_limited_depth(|r| {
51329                Ok(Self::ContractCostType(Box::new(
51330                    ContractCostType::read_xdr(r)?,
51331                )))
51332            }),
51333            TypeVariant::ContractCostParamEntry => r.with_limited_depth(|r| {
51334                Ok(Self::ContractCostParamEntry(Box::new(
51335                    ContractCostParamEntry::read_xdr(r)?,
51336                )))
51337            }),
51338            TypeVariant::StateArchivalSettings => r.with_limited_depth(|r| {
51339                Ok(Self::StateArchivalSettings(Box::new(
51340                    StateArchivalSettings::read_xdr(r)?,
51341                )))
51342            }),
51343            TypeVariant::EvictionIterator => r.with_limited_depth(|r| {
51344                Ok(Self::EvictionIterator(Box::new(
51345                    EvictionIterator::read_xdr(r)?,
51346                )))
51347            }),
51348            TypeVariant::ContractCostParams => r.with_limited_depth(|r| {
51349                Ok(Self::ContractCostParams(Box::new(
51350                    ContractCostParams::read_xdr(r)?,
51351                )))
51352            }),
51353            TypeVariant::ConfigSettingId => r.with_limited_depth(|r| {
51354                Ok(Self::ConfigSettingId(Box::new(ConfigSettingId::read_xdr(
51355                    r,
51356                )?)))
51357            }),
51358            TypeVariant::ConfigSettingEntry => r.with_limited_depth(|r| {
51359                Ok(Self::ConfigSettingEntry(Box::new(
51360                    ConfigSettingEntry::read_xdr(r)?,
51361                )))
51362            }),
51363            TypeVariant::ScEnvMetaKind => r.with_limited_depth(|r| {
51364                Ok(Self::ScEnvMetaKind(Box::new(ScEnvMetaKind::read_xdr(r)?)))
51365            }),
51366            TypeVariant::ScEnvMetaEntry => r.with_limited_depth(|r| {
51367                Ok(Self::ScEnvMetaEntry(Box::new(ScEnvMetaEntry::read_xdr(r)?)))
51368            }),
51369            TypeVariant::ScEnvMetaEntryInterfaceVersion => r.with_limited_depth(|r| {
51370                Ok(Self::ScEnvMetaEntryInterfaceVersion(Box::new(
51371                    ScEnvMetaEntryInterfaceVersion::read_xdr(r)?,
51372                )))
51373            }),
51374            TypeVariant::ScMetaV0 => {
51375                r.with_limited_depth(|r| Ok(Self::ScMetaV0(Box::new(ScMetaV0::read_xdr(r)?))))
51376            }
51377            TypeVariant::ScMetaKind => {
51378                r.with_limited_depth(|r| Ok(Self::ScMetaKind(Box::new(ScMetaKind::read_xdr(r)?))))
51379            }
51380            TypeVariant::ScMetaEntry => {
51381                r.with_limited_depth(|r| Ok(Self::ScMetaEntry(Box::new(ScMetaEntry::read_xdr(r)?))))
51382            }
51383            TypeVariant::ScSpecType => {
51384                r.with_limited_depth(|r| Ok(Self::ScSpecType(Box::new(ScSpecType::read_xdr(r)?))))
51385            }
51386            TypeVariant::ScSpecTypeOption => r.with_limited_depth(|r| {
51387                Ok(Self::ScSpecTypeOption(Box::new(
51388                    ScSpecTypeOption::read_xdr(r)?,
51389                )))
51390            }),
51391            TypeVariant::ScSpecTypeResult => r.with_limited_depth(|r| {
51392                Ok(Self::ScSpecTypeResult(Box::new(
51393                    ScSpecTypeResult::read_xdr(r)?,
51394                )))
51395            }),
51396            TypeVariant::ScSpecTypeVec => r.with_limited_depth(|r| {
51397                Ok(Self::ScSpecTypeVec(Box::new(ScSpecTypeVec::read_xdr(r)?)))
51398            }),
51399            TypeVariant::ScSpecTypeMap => r.with_limited_depth(|r| {
51400                Ok(Self::ScSpecTypeMap(Box::new(ScSpecTypeMap::read_xdr(r)?)))
51401            }),
51402            TypeVariant::ScSpecTypeTuple => r.with_limited_depth(|r| {
51403                Ok(Self::ScSpecTypeTuple(Box::new(ScSpecTypeTuple::read_xdr(
51404                    r,
51405                )?)))
51406            }),
51407            TypeVariant::ScSpecTypeBytesN => r.with_limited_depth(|r| {
51408                Ok(Self::ScSpecTypeBytesN(Box::new(
51409                    ScSpecTypeBytesN::read_xdr(r)?,
51410                )))
51411            }),
51412            TypeVariant::ScSpecTypeUdt => r.with_limited_depth(|r| {
51413                Ok(Self::ScSpecTypeUdt(Box::new(ScSpecTypeUdt::read_xdr(r)?)))
51414            }),
51415            TypeVariant::ScSpecTypeDef => r.with_limited_depth(|r| {
51416                Ok(Self::ScSpecTypeDef(Box::new(ScSpecTypeDef::read_xdr(r)?)))
51417            }),
51418            TypeVariant::ScSpecUdtStructFieldV0 => r.with_limited_depth(|r| {
51419                Ok(Self::ScSpecUdtStructFieldV0(Box::new(
51420                    ScSpecUdtStructFieldV0::read_xdr(r)?,
51421                )))
51422            }),
51423            TypeVariant::ScSpecUdtStructV0 => r.with_limited_depth(|r| {
51424                Ok(Self::ScSpecUdtStructV0(Box::new(
51425                    ScSpecUdtStructV0::read_xdr(r)?,
51426                )))
51427            }),
51428            TypeVariant::ScSpecUdtUnionCaseVoidV0 => r.with_limited_depth(|r| {
51429                Ok(Self::ScSpecUdtUnionCaseVoidV0(Box::new(
51430                    ScSpecUdtUnionCaseVoidV0::read_xdr(r)?,
51431                )))
51432            }),
51433            TypeVariant::ScSpecUdtUnionCaseTupleV0 => r.with_limited_depth(|r| {
51434                Ok(Self::ScSpecUdtUnionCaseTupleV0(Box::new(
51435                    ScSpecUdtUnionCaseTupleV0::read_xdr(r)?,
51436                )))
51437            }),
51438            TypeVariant::ScSpecUdtUnionCaseV0Kind => r.with_limited_depth(|r| {
51439                Ok(Self::ScSpecUdtUnionCaseV0Kind(Box::new(
51440                    ScSpecUdtUnionCaseV0Kind::read_xdr(r)?,
51441                )))
51442            }),
51443            TypeVariant::ScSpecUdtUnionCaseV0 => r.with_limited_depth(|r| {
51444                Ok(Self::ScSpecUdtUnionCaseV0(Box::new(
51445                    ScSpecUdtUnionCaseV0::read_xdr(r)?,
51446                )))
51447            }),
51448            TypeVariant::ScSpecUdtUnionV0 => r.with_limited_depth(|r| {
51449                Ok(Self::ScSpecUdtUnionV0(Box::new(
51450                    ScSpecUdtUnionV0::read_xdr(r)?,
51451                )))
51452            }),
51453            TypeVariant::ScSpecUdtEnumCaseV0 => r.with_limited_depth(|r| {
51454                Ok(Self::ScSpecUdtEnumCaseV0(Box::new(
51455                    ScSpecUdtEnumCaseV0::read_xdr(r)?,
51456                )))
51457            }),
51458            TypeVariant::ScSpecUdtEnumV0 => r.with_limited_depth(|r| {
51459                Ok(Self::ScSpecUdtEnumV0(Box::new(ScSpecUdtEnumV0::read_xdr(
51460                    r,
51461                )?)))
51462            }),
51463            TypeVariant::ScSpecUdtErrorEnumCaseV0 => r.with_limited_depth(|r| {
51464                Ok(Self::ScSpecUdtErrorEnumCaseV0(Box::new(
51465                    ScSpecUdtErrorEnumCaseV0::read_xdr(r)?,
51466                )))
51467            }),
51468            TypeVariant::ScSpecUdtErrorEnumV0 => r.with_limited_depth(|r| {
51469                Ok(Self::ScSpecUdtErrorEnumV0(Box::new(
51470                    ScSpecUdtErrorEnumV0::read_xdr(r)?,
51471                )))
51472            }),
51473            TypeVariant::ScSpecFunctionInputV0 => r.with_limited_depth(|r| {
51474                Ok(Self::ScSpecFunctionInputV0(Box::new(
51475                    ScSpecFunctionInputV0::read_xdr(r)?,
51476                )))
51477            }),
51478            TypeVariant::ScSpecFunctionV0 => r.with_limited_depth(|r| {
51479                Ok(Self::ScSpecFunctionV0(Box::new(
51480                    ScSpecFunctionV0::read_xdr(r)?,
51481                )))
51482            }),
51483            TypeVariant::ScSpecEntryKind => r.with_limited_depth(|r| {
51484                Ok(Self::ScSpecEntryKind(Box::new(ScSpecEntryKind::read_xdr(
51485                    r,
51486                )?)))
51487            }),
51488            TypeVariant::ScSpecEntry => {
51489                r.with_limited_depth(|r| Ok(Self::ScSpecEntry(Box::new(ScSpecEntry::read_xdr(r)?))))
51490            }
51491            TypeVariant::ScValType => {
51492                r.with_limited_depth(|r| Ok(Self::ScValType(Box::new(ScValType::read_xdr(r)?))))
51493            }
51494            TypeVariant::ScErrorType => {
51495                r.with_limited_depth(|r| Ok(Self::ScErrorType(Box::new(ScErrorType::read_xdr(r)?))))
51496            }
51497            TypeVariant::ScErrorCode => {
51498                r.with_limited_depth(|r| Ok(Self::ScErrorCode(Box::new(ScErrorCode::read_xdr(r)?))))
51499            }
51500            TypeVariant::ScError => {
51501                r.with_limited_depth(|r| Ok(Self::ScError(Box::new(ScError::read_xdr(r)?))))
51502            }
51503            TypeVariant::UInt128Parts => r.with_limited_depth(|r| {
51504                Ok(Self::UInt128Parts(Box::new(UInt128Parts::read_xdr(r)?)))
51505            }),
51506            TypeVariant::Int128Parts => {
51507                r.with_limited_depth(|r| Ok(Self::Int128Parts(Box::new(Int128Parts::read_xdr(r)?))))
51508            }
51509            TypeVariant::UInt256Parts => r.with_limited_depth(|r| {
51510                Ok(Self::UInt256Parts(Box::new(UInt256Parts::read_xdr(r)?)))
51511            }),
51512            TypeVariant::Int256Parts => {
51513                r.with_limited_depth(|r| Ok(Self::Int256Parts(Box::new(Int256Parts::read_xdr(r)?))))
51514            }
51515            TypeVariant::ContractExecutableType => r.with_limited_depth(|r| {
51516                Ok(Self::ContractExecutableType(Box::new(
51517                    ContractExecutableType::read_xdr(r)?,
51518                )))
51519            }),
51520            TypeVariant::ContractExecutable => r.with_limited_depth(|r| {
51521                Ok(Self::ContractExecutable(Box::new(
51522                    ContractExecutable::read_xdr(r)?,
51523                )))
51524            }),
51525            TypeVariant::ScAddressType => r.with_limited_depth(|r| {
51526                Ok(Self::ScAddressType(Box::new(ScAddressType::read_xdr(r)?)))
51527            }),
51528            TypeVariant::ScAddress => {
51529                r.with_limited_depth(|r| Ok(Self::ScAddress(Box::new(ScAddress::read_xdr(r)?))))
51530            }
51531            TypeVariant::ScVec => {
51532                r.with_limited_depth(|r| Ok(Self::ScVec(Box::new(ScVec::read_xdr(r)?))))
51533            }
51534            TypeVariant::ScMap => {
51535                r.with_limited_depth(|r| Ok(Self::ScMap(Box::new(ScMap::read_xdr(r)?))))
51536            }
51537            TypeVariant::ScBytes => {
51538                r.with_limited_depth(|r| Ok(Self::ScBytes(Box::new(ScBytes::read_xdr(r)?))))
51539            }
51540            TypeVariant::ScString => {
51541                r.with_limited_depth(|r| Ok(Self::ScString(Box::new(ScString::read_xdr(r)?))))
51542            }
51543            TypeVariant::ScSymbol => {
51544                r.with_limited_depth(|r| Ok(Self::ScSymbol(Box::new(ScSymbol::read_xdr(r)?))))
51545            }
51546            TypeVariant::ScNonceKey => {
51547                r.with_limited_depth(|r| Ok(Self::ScNonceKey(Box::new(ScNonceKey::read_xdr(r)?))))
51548            }
51549            TypeVariant::ScContractInstance => r.with_limited_depth(|r| {
51550                Ok(Self::ScContractInstance(Box::new(
51551                    ScContractInstance::read_xdr(r)?,
51552                )))
51553            }),
51554            TypeVariant::ScVal => {
51555                r.with_limited_depth(|r| Ok(Self::ScVal(Box::new(ScVal::read_xdr(r)?))))
51556            }
51557            TypeVariant::ScMapEntry => {
51558                r.with_limited_depth(|r| Ok(Self::ScMapEntry(Box::new(ScMapEntry::read_xdr(r)?))))
51559            }
51560            TypeVariant::StoredTransactionSet => r.with_limited_depth(|r| {
51561                Ok(Self::StoredTransactionSet(Box::new(
51562                    StoredTransactionSet::read_xdr(r)?,
51563                )))
51564            }),
51565            TypeVariant::StoredDebugTransactionSet => r.with_limited_depth(|r| {
51566                Ok(Self::StoredDebugTransactionSet(Box::new(
51567                    StoredDebugTransactionSet::read_xdr(r)?,
51568                )))
51569            }),
51570            TypeVariant::PersistedScpStateV0 => r.with_limited_depth(|r| {
51571                Ok(Self::PersistedScpStateV0(Box::new(
51572                    PersistedScpStateV0::read_xdr(r)?,
51573                )))
51574            }),
51575            TypeVariant::PersistedScpStateV1 => r.with_limited_depth(|r| {
51576                Ok(Self::PersistedScpStateV1(Box::new(
51577                    PersistedScpStateV1::read_xdr(r)?,
51578                )))
51579            }),
51580            TypeVariant::PersistedScpState => r.with_limited_depth(|r| {
51581                Ok(Self::PersistedScpState(Box::new(
51582                    PersistedScpState::read_xdr(r)?,
51583                )))
51584            }),
51585            TypeVariant::Thresholds => {
51586                r.with_limited_depth(|r| Ok(Self::Thresholds(Box::new(Thresholds::read_xdr(r)?))))
51587            }
51588            TypeVariant::String32 => {
51589                r.with_limited_depth(|r| Ok(Self::String32(Box::new(String32::read_xdr(r)?))))
51590            }
51591            TypeVariant::String64 => {
51592                r.with_limited_depth(|r| Ok(Self::String64(Box::new(String64::read_xdr(r)?))))
51593            }
51594            TypeVariant::SequenceNumber => r.with_limited_depth(|r| {
51595                Ok(Self::SequenceNumber(Box::new(SequenceNumber::read_xdr(r)?)))
51596            }),
51597            TypeVariant::DataValue => {
51598                r.with_limited_depth(|r| Ok(Self::DataValue(Box::new(DataValue::read_xdr(r)?))))
51599            }
51600            TypeVariant::PoolId => {
51601                r.with_limited_depth(|r| Ok(Self::PoolId(Box::new(PoolId::read_xdr(r)?))))
51602            }
51603            TypeVariant::AssetCode4 => {
51604                r.with_limited_depth(|r| Ok(Self::AssetCode4(Box::new(AssetCode4::read_xdr(r)?))))
51605            }
51606            TypeVariant::AssetCode12 => {
51607                r.with_limited_depth(|r| Ok(Self::AssetCode12(Box::new(AssetCode12::read_xdr(r)?))))
51608            }
51609            TypeVariant::AssetType => {
51610                r.with_limited_depth(|r| Ok(Self::AssetType(Box::new(AssetType::read_xdr(r)?))))
51611            }
51612            TypeVariant::AssetCode => {
51613                r.with_limited_depth(|r| Ok(Self::AssetCode(Box::new(AssetCode::read_xdr(r)?))))
51614            }
51615            TypeVariant::AlphaNum4 => {
51616                r.with_limited_depth(|r| Ok(Self::AlphaNum4(Box::new(AlphaNum4::read_xdr(r)?))))
51617            }
51618            TypeVariant::AlphaNum12 => {
51619                r.with_limited_depth(|r| Ok(Self::AlphaNum12(Box::new(AlphaNum12::read_xdr(r)?))))
51620            }
51621            TypeVariant::Asset => {
51622                r.with_limited_depth(|r| Ok(Self::Asset(Box::new(Asset::read_xdr(r)?))))
51623            }
51624            TypeVariant::Price => {
51625                r.with_limited_depth(|r| Ok(Self::Price(Box::new(Price::read_xdr(r)?))))
51626            }
51627            TypeVariant::Liabilities => {
51628                r.with_limited_depth(|r| Ok(Self::Liabilities(Box::new(Liabilities::read_xdr(r)?))))
51629            }
51630            TypeVariant::ThresholdIndexes => r.with_limited_depth(|r| {
51631                Ok(Self::ThresholdIndexes(Box::new(
51632                    ThresholdIndexes::read_xdr(r)?,
51633                )))
51634            }),
51635            TypeVariant::LedgerEntryType => r.with_limited_depth(|r| {
51636                Ok(Self::LedgerEntryType(Box::new(LedgerEntryType::read_xdr(
51637                    r,
51638                )?)))
51639            }),
51640            TypeVariant::Signer => {
51641                r.with_limited_depth(|r| Ok(Self::Signer(Box::new(Signer::read_xdr(r)?))))
51642            }
51643            TypeVariant::AccountFlags => r.with_limited_depth(|r| {
51644                Ok(Self::AccountFlags(Box::new(AccountFlags::read_xdr(r)?)))
51645            }),
51646            TypeVariant::SponsorshipDescriptor => r.with_limited_depth(|r| {
51647                Ok(Self::SponsorshipDescriptor(Box::new(
51648                    SponsorshipDescriptor::read_xdr(r)?,
51649                )))
51650            }),
51651            TypeVariant::AccountEntryExtensionV3 => r.with_limited_depth(|r| {
51652                Ok(Self::AccountEntryExtensionV3(Box::new(
51653                    AccountEntryExtensionV3::read_xdr(r)?,
51654                )))
51655            }),
51656            TypeVariant::AccountEntryExtensionV2 => r.with_limited_depth(|r| {
51657                Ok(Self::AccountEntryExtensionV2(Box::new(
51658                    AccountEntryExtensionV2::read_xdr(r)?,
51659                )))
51660            }),
51661            TypeVariant::AccountEntryExtensionV2Ext => r.with_limited_depth(|r| {
51662                Ok(Self::AccountEntryExtensionV2Ext(Box::new(
51663                    AccountEntryExtensionV2Ext::read_xdr(r)?,
51664                )))
51665            }),
51666            TypeVariant::AccountEntryExtensionV1 => r.with_limited_depth(|r| {
51667                Ok(Self::AccountEntryExtensionV1(Box::new(
51668                    AccountEntryExtensionV1::read_xdr(r)?,
51669                )))
51670            }),
51671            TypeVariant::AccountEntryExtensionV1Ext => r.with_limited_depth(|r| {
51672                Ok(Self::AccountEntryExtensionV1Ext(Box::new(
51673                    AccountEntryExtensionV1Ext::read_xdr(r)?,
51674                )))
51675            }),
51676            TypeVariant::AccountEntry => r.with_limited_depth(|r| {
51677                Ok(Self::AccountEntry(Box::new(AccountEntry::read_xdr(r)?)))
51678            }),
51679            TypeVariant::AccountEntryExt => r.with_limited_depth(|r| {
51680                Ok(Self::AccountEntryExt(Box::new(AccountEntryExt::read_xdr(
51681                    r,
51682                )?)))
51683            }),
51684            TypeVariant::TrustLineFlags => r.with_limited_depth(|r| {
51685                Ok(Self::TrustLineFlags(Box::new(TrustLineFlags::read_xdr(r)?)))
51686            }),
51687            TypeVariant::LiquidityPoolType => r.with_limited_depth(|r| {
51688                Ok(Self::LiquidityPoolType(Box::new(
51689                    LiquidityPoolType::read_xdr(r)?,
51690                )))
51691            }),
51692            TypeVariant::TrustLineAsset => r.with_limited_depth(|r| {
51693                Ok(Self::TrustLineAsset(Box::new(TrustLineAsset::read_xdr(r)?)))
51694            }),
51695            TypeVariant::TrustLineEntryExtensionV2 => r.with_limited_depth(|r| {
51696                Ok(Self::TrustLineEntryExtensionV2(Box::new(
51697                    TrustLineEntryExtensionV2::read_xdr(r)?,
51698                )))
51699            }),
51700            TypeVariant::TrustLineEntryExtensionV2Ext => r.with_limited_depth(|r| {
51701                Ok(Self::TrustLineEntryExtensionV2Ext(Box::new(
51702                    TrustLineEntryExtensionV2Ext::read_xdr(r)?,
51703                )))
51704            }),
51705            TypeVariant::TrustLineEntry => r.with_limited_depth(|r| {
51706                Ok(Self::TrustLineEntry(Box::new(TrustLineEntry::read_xdr(r)?)))
51707            }),
51708            TypeVariant::TrustLineEntryExt => r.with_limited_depth(|r| {
51709                Ok(Self::TrustLineEntryExt(Box::new(
51710                    TrustLineEntryExt::read_xdr(r)?,
51711                )))
51712            }),
51713            TypeVariant::TrustLineEntryV1 => r.with_limited_depth(|r| {
51714                Ok(Self::TrustLineEntryV1(Box::new(
51715                    TrustLineEntryV1::read_xdr(r)?,
51716                )))
51717            }),
51718            TypeVariant::TrustLineEntryV1Ext => r.with_limited_depth(|r| {
51719                Ok(Self::TrustLineEntryV1Ext(Box::new(
51720                    TrustLineEntryV1Ext::read_xdr(r)?,
51721                )))
51722            }),
51723            TypeVariant::OfferEntryFlags => r.with_limited_depth(|r| {
51724                Ok(Self::OfferEntryFlags(Box::new(OfferEntryFlags::read_xdr(
51725                    r,
51726                )?)))
51727            }),
51728            TypeVariant::OfferEntry => {
51729                r.with_limited_depth(|r| Ok(Self::OfferEntry(Box::new(OfferEntry::read_xdr(r)?))))
51730            }
51731            TypeVariant::OfferEntryExt => r.with_limited_depth(|r| {
51732                Ok(Self::OfferEntryExt(Box::new(OfferEntryExt::read_xdr(r)?)))
51733            }),
51734            TypeVariant::DataEntry => {
51735                r.with_limited_depth(|r| Ok(Self::DataEntry(Box::new(DataEntry::read_xdr(r)?))))
51736            }
51737            TypeVariant::DataEntryExt => r.with_limited_depth(|r| {
51738                Ok(Self::DataEntryExt(Box::new(DataEntryExt::read_xdr(r)?)))
51739            }),
51740            TypeVariant::ClaimPredicateType => r.with_limited_depth(|r| {
51741                Ok(Self::ClaimPredicateType(Box::new(
51742                    ClaimPredicateType::read_xdr(r)?,
51743                )))
51744            }),
51745            TypeVariant::ClaimPredicate => r.with_limited_depth(|r| {
51746                Ok(Self::ClaimPredicate(Box::new(ClaimPredicate::read_xdr(r)?)))
51747            }),
51748            TypeVariant::ClaimantType => r.with_limited_depth(|r| {
51749                Ok(Self::ClaimantType(Box::new(ClaimantType::read_xdr(r)?)))
51750            }),
51751            TypeVariant::Claimant => {
51752                r.with_limited_depth(|r| Ok(Self::Claimant(Box::new(Claimant::read_xdr(r)?))))
51753            }
51754            TypeVariant::ClaimantV0 => {
51755                r.with_limited_depth(|r| Ok(Self::ClaimantV0(Box::new(ClaimantV0::read_xdr(r)?))))
51756            }
51757            TypeVariant::ClaimableBalanceIdType => r.with_limited_depth(|r| {
51758                Ok(Self::ClaimableBalanceIdType(Box::new(
51759                    ClaimableBalanceIdType::read_xdr(r)?,
51760                )))
51761            }),
51762            TypeVariant::ClaimableBalanceId => r.with_limited_depth(|r| {
51763                Ok(Self::ClaimableBalanceId(Box::new(
51764                    ClaimableBalanceId::read_xdr(r)?,
51765                )))
51766            }),
51767            TypeVariant::ClaimableBalanceFlags => r.with_limited_depth(|r| {
51768                Ok(Self::ClaimableBalanceFlags(Box::new(
51769                    ClaimableBalanceFlags::read_xdr(r)?,
51770                )))
51771            }),
51772            TypeVariant::ClaimableBalanceEntryExtensionV1 => r.with_limited_depth(|r| {
51773                Ok(Self::ClaimableBalanceEntryExtensionV1(Box::new(
51774                    ClaimableBalanceEntryExtensionV1::read_xdr(r)?,
51775                )))
51776            }),
51777            TypeVariant::ClaimableBalanceEntryExtensionV1Ext => r.with_limited_depth(|r| {
51778                Ok(Self::ClaimableBalanceEntryExtensionV1Ext(Box::new(
51779                    ClaimableBalanceEntryExtensionV1Ext::read_xdr(r)?,
51780                )))
51781            }),
51782            TypeVariant::ClaimableBalanceEntry => r.with_limited_depth(|r| {
51783                Ok(Self::ClaimableBalanceEntry(Box::new(
51784                    ClaimableBalanceEntry::read_xdr(r)?,
51785                )))
51786            }),
51787            TypeVariant::ClaimableBalanceEntryExt => r.with_limited_depth(|r| {
51788                Ok(Self::ClaimableBalanceEntryExt(Box::new(
51789                    ClaimableBalanceEntryExt::read_xdr(r)?,
51790                )))
51791            }),
51792            TypeVariant::LiquidityPoolConstantProductParameters => r.with_limited_depth(|r| {
51793                Ok(Self::LiquidityPoolConstantProductParameters(Box::new(
51794                    LiquidityPoolConstantProductParameters::read_xdr(r)?,
51795                )))
51796            }),
51797            TypeVariant::LiquidityPoolEntry => r.with_limited_depth(|r| {
51798                Ok(Self::LiquidityPoolEntry(Box::new(
51799                    LiquidityPoolEntry::read_xdr(r)?,
51800                )))
51801            }),
51802            TypeVariant::LiquidityPoolEntryBody => r.with_limited_depth(|r| {
51803                Ok(Self::LiquidityPoolEntryBody(Box::new(
51804                    LiquidityPoolEntryBody::read_xdr(r)?,
51805                )))
51806            }),
51807            TypeVariant::LiquidityPoolEntryConstantProduct => r.with_limited_depth(|r| {
51808                Ok(Self::LiquidityPoolEntryConstantProduct(Box::new(
51809                    LiquidityPoolEntryConstantProduct::read_xdr(r)?,
51810                )))
51811            }),
51812            TypeVariant::ContractDataDurability => r.with_limited_depth(|r| {
51813                Ok(Self::ContractDataDurability(Box::new(
51814                    ContractDataDurability::read_xdr(r)?,
51815                )))
51816            }),
51817            TypeVariant::ContractDataEntry => r.with_limited_depth(|r| {
51818                Ok(Self::ContractDataEntry(Box::new(
51819                    ContractDataEntry::read_xdr(r)?,
51820                )))
51821            }),
51822            TypeVariant::ContractCodeCostInputs => r.with_limited_depth(|r| {
51823                Ok(Self::ContractCodeCostInputs(Box::new(
51824                    ContractCodeCostInputs::read_xdr(r)?,
51825                )))
51826            }),
51827            TypeVariant::ContractCodeEntry => r.with_limited_depth(|r| {
51828                Ok(Self::ContractCodeEntry(Box::new(
51829                    ContractCodeEntry::read_xdr(r)?,
51830                )))
51831            }),
51832            TypeVariant::ContractCodeEntryExt => r.with_limited_depth(|r| {
51833                Ok(Self::ContractCodeEntryExt(Box::new(
51834                    ContractCodeEntryExt::read_xdr(r)?,
51835                )))
51836            }),
51837            TypeVariant::ContractCodeEntryV1 => r.with_limited_depth(|r| {
51838                Ok(Self::ContractCodeEntryV1(Box::new(
51839                    ContractCodeEntryV1::read_xdr(r)?,
51840                )))
51841            }),
51842            TypeVariant::TtlEntry => {
51843                r.with_limited_depth(|r| Ok(Self::TtlEntry(Box::new(TtlEntry::read_xdr(r)?))))
51844            }
51845            TypeVariant::LedgerEntryExtensionV1 => r.with_limited_depth(|r| {
51846                Ok(Self::LedgerEntryExtensionV1(Box::new(
51847                    LedgerEntryExtensionV1::read_xdr(r)?,
51848                )))
51849            }),
51850            TypeVariant::LedgerEntryExtensionV1Ext => r.with_limited_depth(|r| {
51851                Ok(Self::LedgerEntryExtensionV1Ext(Box::new(
51852                    LedgerEntryExtensionV1Ext::read_xdr(r)?,
51853                )))
51854            }),
51855            TypeVariant::LedgerEntry => {
51856                r.with_limited_depth(|r| Ok(Self::LedgerEntry(Box::new(LedgerEntry::read_xdr(r)?))))
51857            }
51858            TypeVariant::LedgerEntryData => r.with_limited_depth(|r| {
51859                Ok(Self::LedgerEntryData(Box::new(LedgerEntryData::read_xdr(
51860                    r,
51861                )?)))
51862            }),
51863            TypeVariant::LedgerEntryExt => r.with_limited_depth(|r| {
51864                Ok(Self::LedgerEntryExt(Box::new(LedgerEntryExt::read_xdr(r)?)))
51865            }),
51866            TypeVariant::LedgerKey => {
51867                r.with_limited_depth(|r| Ok(Self::LedgerKey(Box::new(LedgerKey::read_xdr(r)?))))
51868            }
51869            TypeVariant::LedgerKeyAccount => r.with_limited_depth(|r| {
51870                Ok(Self::LedgerKeyAccount(Box::new(
51871                    LedgerKeyAccount::read_xdr(r)?,
51872                )))
51873            }),
51874            TypeVariant::LedgerKeyTrustLine => r.with_limited_depth(|r| {
51875                Ok(Self::LedgerKeyTrustLine(Box::new(
51876                    LedgerKeyTrustLine::read_xdr(r)?,
51877                )))
51878            }),
51879            TypeVariant::LedgerKeyOffer => r.with_limited_depth(|r| {
51880                Ok(Self::LedgerKeyOffer(Box::new(LedgerKeyOffer::read_xdr(r)?)))
51881            }),
51882            TypeVariant::LedgerKeyData => r.with_limited_depth(|r| {
51883                Ok(Self::LedgerKeyData(Box::new(LedgerKeyData::read_xdr(r)?)))
51884            }),
51885            TypeVariant::LedgerKeyClaimableBalance => r.with_limited_depth(|r| {
51886                Ok(Self::LedgerKeyClaimableBalance(Box::new(
51887                    LedgerKeyClaimableBalance::read_xdr(r)?,
51888                )))
51889            }),
51890            TypeVariant::LedgerKeyLiquidityPool => r.with_limited_depth(|r| {
51891                Ok(Self::LedgerKeyLiquidityPool(Box::new(
51892                    LedgerKeyLiquidityPool::read_xdr(r)?,
51893                )))
51894            }),
51895            TypeVariant::LedgerKeyContractData => r.with_limited_depth(|r| {
51896                Ok(Self::LedgerKeyContractData(Box::new(
51897                    LedgerKeyContractData::read_xdr(r)?,
51898                )))
51899            }),
51900            TypeVariant::LedgerKeyContractCode => r.with_limited_depth(|r| {
51901                Ok(Self::LedgerKeyContractCode(Box::new(
51902                    LedgerKeyContractCode::read_xdr(r)?,
51903                )))
51904            }),
51905            TypeVariant::LedgerKeyConfigSetting => r.with_limited_depth(|r| {
51906                Ok(Self::LedgerKeyConfigSetting(Box::new(
51907                    LedgerKeyConfigSetting::read_xdr(r)?,
51908                )))
51909            }),
51910            TypeVariant::LedgerKeyTtl => r.with_limited_depth(|r| {
51911                Ok(Self::LedgerKeyTtl(Box::new(LedgerKeyTtl::read_xdr(r)?)))
51912            }),
51913            TypeVariant::EnvelopeType => r.with_limited_depth(|r| {
51914                Ok(Self::EnvelopeType(Box::new(EnvelopeType::read_xdr(r)?)))
51915            }),
51916            TypeVariant::BucketListType => r.with_limited_depth(|r| {
51917                Ok(Self::BucketListType(Box::new(BucketListType::read_xdr(r)?)))
51918            }),
51919            TypeVariant::BucketEntryType => r.with_limited_depth(|r| {
51920                Ok(Self::BucketEntryType(Box::new(BucketEntryType::read_xdr(
51921                    r,
51922                )?)))
51923            }),
51924            TypeVariant::HotArchiveBucketEntryType => r.with_limited_depth(|r| {
51925                Ok(Self::HotArchiveBucketEntryType(Box::new(
51926                    HotArchiveBucketEntryType::read_xdr(r)?,
51927                )))
51928            }),
51929            TypeVariant::ColdArchiveBucketEntryType => r.with_limited_depth(|r| {
51930                Ok(Self::ColdArchiveBucketEntryType(Box::new(
51931                    ColdArchiveBucketEntryType::read_xdr(r)?,
51932                )))
51933            }),
51934            TypeVariant::BucketMetadata => r.with_limited_depth(|r| {
51935                Ok(Self::BucketMetadata(Box::new(BucketMetadata::read_xdr(r)?)))
51936            }),
51937            TypeVariant::BucketMetadataExt => r.with_limited_depth(|r| {
51938                Ok(Self::BucketMetadataExt(Box::new(
51939                    BucketMetadataExt::read_xdr(r)?,
51940                )))
51941            }),
51942            TypeVariant::BucketEntry => {
51943                r.with_limited_depth(|r| Ok(Self::BucketEntry(Box::new(BucketEntry::read_xdr(r)?))))
51944            }
51945            TypeVariant::HotArchiveBucketEntry => r.with_limited_depth(|r| {
51946                Ok(Self::HotArchiveBucketEntry(Box::new(
51947                    HotArchiveBucketEntry::read_xdr(r)?,
51948                )))
51949            }),
51950            TypeVariant::ColdArchiveArchivedLeaf => r.with_limited_depth(|r| {
51951                Ok(Self::ColdArchiveArchivedLeaf(Box::new(
51952                    ColdArchiveArchivedLeaf::read_xdr(r)?,
51953                )))
51954            }),
51955            TypeVariant::ColdArchiveDeletedLeaf => r.with_limited_depth(|r| {
51956                Ok(Self::ColdArchiveDeletedLeaf(Box::new(
51957                    ColdArchiveDeletedLeaf::read_xdr(r)?,
51958                )))
51959            }),
51960            TypeVariant::ColdArchiveBoundaryLeaf => r.with_limited_depth(|r| {
51961                Ok(Self::ColdArchiveBoundaryLeaf(Box::new(
51962                    ColdArchiveBoundaryLeaf::read_xdr(r)?,
51963                )))
51964            }),
51965            TypeVariant::ColdArchiveHashEntry => r.with_limited_depth(|r| {
51966                Ok(Self::ColdArchiveHashEntry(Box::new(
51967                    ColdArchiveHashEntry::read_xdr(r)?,
51968                )))
51969            }),
51970            TypeVariant::ColdArchiveBucketEntry => r.with_limited_depth(|r| {
51971                Ok(Self::ColdArchiveBucketEntry(Box::new(
51972                    ColdArchiveBucketEntry::read_xdr(r)?,
51973                )))
51974            }),
51975            TypeVariant::UpgradeType => {
51976                r.with_limited_depth(|r| Ok(Self::UpgradeType(Box::new(UpgradeType::read_xdr(r)?))))
51977            }
51978            TypeVariant::StellarValueType => r.with_limited_depth(|r| {
51979                Ok(Self::StellarValueType(Box::new(
51980                    StellarValueType::read_xdr(r)?,
51981                )))
51982            }),
51983            TypeVariant::LedgerCloseValueSignature => r.with_limited_depth(|r| {
51984                Ok(Self::LedgerCloseValueSignature(Box::new(
51985                    LedgerCloseValueSignature::read_xdr(r)?,
51986                )))
51987            }),
51988            TypeVariant::StellarValue => r.with_limited_depth(|r| {
51989                Ok(Self::StellarValue(Box::new(StellarValue::read_xdr(r)?)))
51990            }),
51991            TypeVariant::StellarValueExt => r.with_limited_depth(|r| {
51992                Ok(Self::StellarValueExt(Box::new(StellarValueExt::read_xdr(
51993                    r,
51994                )?)))
51995            }),
51996            TypeVariant::LedgerHeaderFlags => r.with_limited_depth(|r| {
51997                Ok(Self::LedgerHeaderFlags(Box::new(
51998                    LedgerHeaderFlags::read_xdr(r)?,
51999                )))
52000            }),
52001            TypeVariant::LedgerHeaderExtensionV1 => r.with_limited_depth(|r| {
52002                Ok(Self::LedgerHeaderExtensionV1(Box::new(
52003                    LedgerHeaderExtensionV1::read_xdr(r)?,
52004                )))
52005            }),
52006            TypeVariant::LedgerHeaderExtensionV1Ext => r.with_limited_depth(|r| {
52007                Ok(Self::LedgerHeaderExtensionV1Ext(Box::new(
52008                    LedgerHeaderExtensionV1Ext::read_xdr(r)?,
52009                )))
52010            }),
52011            TypeVariant::LedgerHeader => r.with_limited_depth(|r| {
52012                Ok(Self::LedgerHeader(Box::new(LedgerHeader::read_xdr(r)?)))
52013            }),
52014            TypeVariant::LedgerHeaderExt => r.with_limited_depth(|r| {
52015                Ok(Self::LedgerHeaderExt(Box::new(LedgerHeaderExt::read_xdr(
52016                    r,
52017                )?)))
52018            }),
52019            TypeVariant::LedgerUpgradeType => r.with_limited_depth(|r| {
52020                Ok(Self::LedgerUpgradeType(Box::new(
52021                    LedgerUpgradeType::read_xdr(r)?,
52022                )))
52023            }),
52024            TypeVariant::ConfigUpgradeSetKey => r.with_limited_depth(|r| {
52025                Ok(Self::ConfigUpgradeSetKey(Box::new(
52026                    ConfigUpgradeSetKey::read_xdr(r)?,
52027                )))
52028            }),
52029            TypeVariant::LedgerUpgrade => r.with_limited_depth(|r| {
52030                Ok(Self::LedgerUpgrade(Box::new(LedgerUpgrade::read_xdr(r)?)))
52031            }),
52032            TypeVariant::ConfigUpgradeSet => r.with_limited_depth(|r| {
52033                Ok(Self::ConfigUpgradeSet(Box::new(
52034                    ConfigUpgradeSet::read_xdr(r)?,
52035                )))
52036            }),
52037            TypeVariant::TxSetComponentType => r.with_limited_depth(|r| {
52038                Ok(Self::TxSetComponentType(Box::new(
52039                    TxSetComponentType::read_xdr(r)?,
52040                )))
52041            }),
52042            TypeVariant::TxExecutionThread => r.with_limited_depth(|r| {
52043                Ok(Self::TxExecutionThread(Box::new(
52044                    TxExecutionThread::read_xdr(r)?,
52045                )))
52046            }),
52047            TypeVariant::ParallelTxExecutionStage => r.with_limited_depth(|r| {
52048                Ok(Self::ParallelTxExecutionStage(Box::new(
52049                    ParallelTxExecutionStage::read_xdr(r)?,
52050                )))
52051            }),
52052            TypeVariant::ParallelTxsComponent => r.with_limited_depth(|r| {
52053                Ok(Self::ParallelTxsComponent(Box::new(
52054                    ParallelTxsComponent::read_xdr(r)?,
52055                )))
52056            }),
52057            TypeVariant::TxSetComponent => r.with_limited_depth(|r| {
52058                Ok(Self::TxSetComponent(Box::new(TxSetComponent::read_xdr(r)?)))
52059            }),
52060            TypeVariant::TxSetComponentTxsMaybeDiscountedFee => r.with_limited_depth(|r| {
52061                Ok(Self::TxSetComponentTxsMaybeDiscountedFee(Box::new(
52062                    TxSetComponentTxsMaybeDiscountedFee::read_xdr(r)?,
52063                )))
52064            }),
52065            TypeVariant::TransactionPhase => r.with_limited_depth(|r| {
52066                Ok(Self::TransactionPhase(Box::new(
52067                    TransactionPhase::read_xdr(r)?,
52068                )))
52069            }),
52070            TypeVariant::TransactionSet => r.with_limited_depth(|r| {
52071                Ok(Self::TransactionSet(Box::new(TransactionSet::read_xdr(r)?)))
52072            }),
52073            TypeVariant::TransactionSetV1 => r.with_limited_depth(|r| {
52074                Ok(Self::TransactionSetV1(Box::new(
52075                    TransactionSetV1::read_xdr(r)?,
52076                )))
52077            }),
52078            TypeVariant::GeneralizedTransactionSet => r.with_limited_depth(|r| {
52079                Ok(Self::GeneralizedTransactionSet(Box::new(
52080                    GeneralizedTransactionSet::read_xdr(r)?,
52081                )))
52082            }),
52083            TypeVariant::TransactionResultPair => r.with_limited_depth(|r| {
52084                Ok(Self::TransactionResultPair(Box::new(
52085                    TransactionResultPair::read_xdr(r)?,
52086                )))
52087            }),
52088            TypeVariant::TransactionResultSet => r.with_limited_depth(|r| {
52089                Ok(Self::TransactionResultSet(Box::new(
52090                    TransactionResultSet::read_xdr(r)?,
52091                )))
52092            }),
52093            TypeVariant::TransactionHistoryEntry => r.with_limited_depth(|r| {
52094                Ok(Self::TransactionHistoryEntry(Box::new(
52095                    TransactionHistoryEntry::read_xdr(r)?,
52096                )))
52097            }),
52098            TypeVariant::TransactionHistoryEntryExt => r.with_limited_depth(|r| {
52099                Ok(Self::TransactionHistoryEntryExt(Box::new(
52100                    TransactionHistoryEntryExt::read_xdr(r)?,
52101                )))
52102            }),
52103            TypeVariant::TransactionHistoryResultEntry => r.with_limited_depth(|r| {
52104                Ok(Self::TransactionHistoryResultEntry(Box::new(
52105                    TransactionHistoryResultEntry::read_xdr(r)?,
52106                )))
52107            }),
52108            TypeVariant::TransactionHistoryResultEntryExt => r.with_limited_depth(|r| {
52109                Ok(Self::TransactionHistoryResultEntryExt(Box::new(
52110                    TransactionHistoryResultEntryExt::read_xdr(r)?,
52111                )))
52112            }),
52113            TypeVariant::LedgerHeaderHistoryEntry => r.with_limited_depth(|r| {
52114                Ok(Self::LedgerHeaderHistoryEntry(Box::new(
52115                    LedgerHeaderHistoryEntry::read_xdr(r)?,
52116                )))
52117            }),
52118            TypeVariant::LedgerHeaderHistoryEntryExt => r.with_limited_depth(|r| {
52119                Ok(Self::LedgerHeaderHistoryEntryExt(Box::new(
52120                    LedgerHeaderHistoryEntryExt::read_xdr(r)?,
52121                )))
52122            }),
52123            TypeVariant::LedgerScpMessages => r.with_limited_depth(|r| {
52124                Ok(Self::LedgerScpMessages(Box::new(
52125                    LedgerScpMessages::read_xdr(r)?,
52126                )))
52127            }),
52128            TypeVariant::ScpHistoryEntryV0 => r.with_limited_depth(|r| {
52129                Ok(Self::ScpHistoryEntryV0(Box::new(
52130                    ScpHistoryEntryV0::read_xdr(r)?,
52131                )))
52132            }),
52133            TypeVariant::ScpHistoryEntry => r.with_limited_depth(|r| {
52134                Ok(Self::ScpHistoryEntry(Box::new(ScpHistoryEntry::read_xdr(
52135                    r,
52136                )?)))
52137            }),
52138            TypeVariant::LedgerEntryChangeType => r.with_limited_depth(|r| {
52139                Ok(Self::LedgerEntryChangeType(Box::new(
52140                    LedgerEntryChangeType::read_xdr(r)?,
52141                )))
52142            }),
52143            TypeVariant::LedgerEntryChange => r.with_limited_depth(|r| {
52144                Ok(Self::LedgerEntryChange(Box::new(
52145                    LedgerEntryChange::read_xdr(r)?,
52146                )))
52147            }),
52148            TypeVariant::LedgerEntryChanges => r.with_limited_depth(|r| {
52149                Ok(Self::LedgerEntryChanges(Box::new(
52150                    LedgerEntryChanges::read_xdr(r)?,
52151                )))
52152            }),
52153            TypeVariant::OperationMeta => r.with_limited_depth(|r| {
52154                Ok(Self::OperationMeta(Box::new(OperationMeta::read_xdr(r)?)))
52155            }),
52156            TypeVariant::TransactionMetaV1 => r.with_limited_depth(|r| {
52157                Ok(Self::TransactionMetaV1(Box::new(
52158                    TransactionMetaV1::read_xdr(r)?,
52159                )))
52160            }),
52161            TypeVariant::TransactionMetaV2 => r.with_limited_depth(|r| {
52162                Ok(Self::TransactionMetaV2(Box::new(
52163                    TransactionMetaV2::read_xdr(r)?,
52164                )))
52165            }),
52166            TypeVariant::ContractEventType => r.with_limited_depth(|r| {
52167                Ok(Self::ContractEventType(Box::new(
52168                    ContractEventType::read_xdr(r)?,
52169                )))
52170            }),
52171            TypeVariant::ContractEvent => r.with_limited_depth(|r| {
52172                Ok(Self::ContractEvent(Box::new(ContractEvent::read_xdr(r)?)))
52173            }),
52174            TypeVariant::ContractEventBody => r.with_limited_depth(|r| {
52175                Ok(Self::ContractEventBody(Box::new(
52176                    ContractEventBody::read_xdr(r)?,
52177                )))
52178            }),
52179            TypeVariant::ContractEventV0 => r.with_limited_depth(|r| {
52180                Ok(Self::ContractEventV0(Box::new(ContractEventV0::read_xdr(
52181                    r,
52182                )?)))
52183            }),
52184            TypeVariant::DiagnosticEvent => r.with_limited_depth(|r| {
52185                Ok(Self::DiagnosticEvent(Box::new(DiagnosticEvent::read_xdr(
52186                    r,
52187                )?)))
52188            }),
52189            TypeVariant::SorobanTransactionMetaExtV1 => r.with_limited_depth(|r| {
52190                Ok(Self::SorobanTransactionMetaExtV1(Box::new(
52191                    SorobanTransactionMetaExtV1::read_xdr(r)?,
52192                )))
52193            }),
52194            TypeVariant::SorobanTransactionMetaExt => r.with_limited_depth(|r| {
52195                Ok(Self::SorobanTransactionMetaExt(Box::new(
52196                    SorobanTransactionMetaExt::read_xdr(r)?,
52197                )))
52198            }),
52199            TypeVariant::SorobanTransactionMeta => r.with_limited_depth(|r| {
52200                Ok(Self::SorobanTransactionMeta(Box::new(
52201                    SorobanTransactionMeta::read_xdr(r)?,
52202                )))
52203            }),
52204            TypeVariant::TransactionMetaV3 => r.with_limited_depth(|r| {
52205                Ok(Self::TransactionMetaV3(Box::new(
52206                    TransactionMetaV3::read_xdr(r)?,
52207                )))
52208            }),
52209            TypeVariant::InvokeHostFunctionSuccessPreImage => r.with_limited_depth(|r| {
52210                Ok(Self::InvokeHostFunctionSuccessPreImage(Box::new(
52211                    InvokeHostFunctionSuccessPreImage::read_xdr(r)?,
52212                )))
52213            }),
52214            TypeVariant::TransactionMeta => r.with_limited_depth(|r| {
52215                Ok(Self::TransactionMeta(Box::new(TransactionMeta::read_xdr(
52216                    r,
52217                )?)))
52218            }),
52219            TypeVariant::TransactionResultMeta => r.with_limited_depth(|r| {
52220                Ok(Self::TransactionResultMeta(Box::new(
52221                    TransactionResultMeta::read_xdr(r)?,
52222                )))
52223            }),
52224            TypeVariant::UpgradeEntryMeta => r.with_limited_depth(|r| {
52225                Ok(Self::UpgradeEntryMeta(Box::new(
52226                    UpgradeEntryMeta::read_xdr(r)?,
52227                )))
52228            }),
52229            TypeVariant::LedgerCloseMetaV0 => r.with_limited_depth(|r| {
52230                Ok(Self::LedgerCloseMetaV0(Box::new(
52231                    LedgerCloseMetaV0::read_xdr(r)?,
52232                )))
52233            }),
52234            TypeVariant::LedgerCloseMetaExtV1 => r.with_limited_depth(|r| {
52235                Ok(Self::LedgerCloseMetaExtV1(Box::new(
52236                    LedgerCloseMetaExtV1::read_xdr(r)?,
52237                )))
52238            }),
52239            TypeVariant::LedgerCloseMetaExtV2 => r.with_limited_depth(|r| {
52240                Ok(Self::LedgerCloseMetaExtV2(Box::new(
52241                    LedgerCloseMetaExtV2::read_xdr(r)?,
52242                )))
52243            }),
52244            TypeVariant::LedgerCloseMetaExt => r.with_limited_depth(|r| {
52245                Ok(Self::LedgerCloseMetaExt(Box::new(
52246                    LedgerCloseMetaExt::read_xdr(r)?,
52247                )))
52248            }),
52249            TypeVariant::LedgerCloseMetaV1 => r.with_limited_depth(|r| {
52250                Ok(Self::LedgerCloseMetaV1(Box::new(
52251                    LedgerCloseMetaV1::read_xdr(r)?,
52252                )))
52253            }),
52254            TypeVariant::LedgerCloseMeta => r.with_limited_depth(|r| {
52255                Ok(Self::LedgerCloseMeta(Box::new(LedgerCloseMeta::read_xdr(
52256                    r,
52257                )?)))
52258            }),
52259            TypeVariant::ErrorCode => {
52260                r.with_limited_depth(|r| Ok(Self::ErrorCode(Box::new(ErrorCode::read_xdr(r)?))))
52261            }
52262            TypeVariant::SError => {
52263                r.with_limited_depth(|r| Ok(Self::SError(Box::new(SError::read_xdr(r)?))))
52264            }
52265            TypeVariant::SendMore => {
52266                r.with_limited_depth(|r| Ok(Self::SendMore(Box::new(SendMore::read_xdr(r)?))))
52267            }
52268            TypeVariant::SendMoreExtended => r.with_limited_depth(|r| {
52269                Ok(Self::SendMoreExtended(Box::new(
52270                    SendMoreExtended::read_xdr(r)?,
52271                )))
52272            }),
52273            TypeVariant::AuthCert => {
52274                r.with_limited_depth(|r| Ok(Self::AuthCert(Box::new(AuthCert::read_xdr(r)?))))
52275            }
52276            TypeVariant::Hello => {
52277                r.with_limited_depth(|r| Ok(Self::Hello(Box::new(Hello::read_xdr(r)?))))
52278            }
52279            TypeVariant::Auth => {
52280                r.with_limited_depth(|r| Ok(Self::Auth(Box::new(Auth::read_xdr(r)?))))
52281            }
52282            TypeVariant::IpAddrType => {
52283                r.with_limited_depth(|r| Ok(Self::IpAddrType(Box::new(IpAddrType::read_xdr(r)?))))
52284            }
52285            TypeVariant::PeerAddress => {
52286                r.with_limited_depth(|r| Ok(Self::PeerAddress(Box::new(PeerAddress::read_xdr(r)?))))
52287            }
52288            TypeVariant::PeerAddressIp => r.with_limited_depth(|r| {
52289                Ok(Self::PeerAddressIp(Box::new(PeerAddressIp::read_xdr(r)?)))
52290            }),
52291            TypeVariant::MessageType => {
52292                r.with_limited_depth(|r| Ok(Self::MessageType(Box::new(MessageType::read_xdr(r)?))))
52293            }
52294            TypeVariant::DontHave => {
52295                r.with_limited_depth(|r| Ok(Self::DontHave(Box::new(DontHave::read_xdr(r)?))))
52296            }
52297            TypeVariant::SurveyMessageCommandType => r.with_limited_depth(|r| {
52298                Ok(Self::SurveyMessageCommandType(Box::new(
52299                    SurveyMessageCommandType::read_xdr(r)?,
52300                )))
52301            }),
52302            TypeVariant::SurveyMessageResponseType => r.with_limited_depth(|r| {
52303                Ok(Self::SurveyMessageResponseType(Box::new(
52304                    SurveyMessageResponseType::read_xdr(r)?,
52305                )))
52306            }),
52307            TypeVariant::TimeSlicedSurveyStartCollectingMessage => r.with_limited_depth(|r| {
52308                Ok(Self::TimeSlicedSurveyStartCollectingMessage(Box::new(
52309                    TimeSlicedSurveyStartCollectingMessage::read_xdr(r)?,
52310                )))
52311            }),
52312            TypeVariant::SignedTimeSlicedSurveyStartCollectingMessage => {
52313                r.with_limited_depth(|r| {
52314                    Ok(Self::SignedTimeSlicedSurveyStartCollectingMessage(
52315                        Box::new(SignedTimeSlicedSurveyStartCollectingMessage::read_xdr(r)?),
52316                    ))
52317                })
52318            }
52319            TypeVariant::TimeSlicedSurveyStopCollectingMessage => r.with_limited_depth(|r| {
52320                Ok(Self::TimeSlicedSurveyStopCollectingMessage(Box::new(
52321                    TimeSlicedSurveyStopCollectingMessage::read_xdr(r)?,
52322                )))
52323            }),
52324            TypeVariant::SignedTimeSlicedSurveyStopCollectingMessage => r.with_limited_depth(|r| {
52325                Ok(Self::SignedTimeSlicedSurveyStopCollectingMessage(Box::new(
52326                    SignedTimeSlicedSurveyStopCollectingMessage::read_xdr(r)?,
52327                )))
52328            }),
52329            TypeVariant::SurveyRequestMessage => r.with_limited_depth(|r| {
52330                Ok(Self::SurveyRequestMessage(Box::new(
52331                    SurveyRequestMessage::read_xdr(r)?,
52332                )))
52333            }),
52334            TypeVariant::TimeSlicedSurveyRequestMessage => r.with_limited_depth(|r| {
52335                Ok(Self::TimeSlicedSurveyRequestMessage(Box::new(
52336                    TimeSlicedSurveyRequestMessage::read_xdr(r)?,
52337                )))
52338            }),
52339            TypeVariant::SignedSurveyRequestMessage => r.with_limited_depth(|r| {
52340                Ok(Self::SignedSurveyRequestMessage(Box::new(
52341                    SignedSurveyRequestMessage::read_xdr(r)?,
52342                )))
52343            }),
52344            TypeVariant::SignedTimeSlicedSurveyRequestMessage => r.with_limited_depth(|r| {
52345                Ok(Self::SignedTimeSlicedSurveyRequestMessage(Box::new(
52346                    SignedTimeSlicedSurveyRequestMessage::read_xdr(r)?,
52347                )))
52348            }),
52349            TypeVariant::EncryptedBody => r.with_limited_depth(|r| {
52350                Ok(Self::EncryptedBody(Box::new(EncryptedBody::read_xdr(r)?)))
52351            }),
52352            TypeVariant::SurveyResponseMessage => r.with_limited_depth(|r| {
52353                Ok(Self::SurveyResponseMessage(Box::new(
52354                    SurveyResponseMessage::read_xdr(r)?,
52355                )))
52356            }),
52357            TypeVariant::TimeSlicedSurveyResponseMessage => r.with_limited_depth(|r| {
52358                Ok(Self::TimeSlicedSurveyResponseMessage(Box::new(
52359                    TimeSlicedSurveyResponseMessage::read_xdr(r)?,
52360                )))
52361            }),
52362            TypeVariant::SignedSurveyResponseMessage => r.with_limited_depth(|r| {
52363                Ok(Self::SignedSurveyResponseMessage(Box::new(
52364                    SignedSurveyResponseMessage::read_xdr(r)?,
52365                )))
52366            }),
52367            TypeVariant::SignedTimeSlicedSurveyResponseMessage => r.with_limited_depth(|r| {
52368                Ok(Self::SignedTimeSlicedSurveyResponseMessage(Box::new(
52369                    SignedTimeSlicedSurveyResponseMessage::read_xdr(r)?,
52370                )))
52371            }),
52372            TypeVariant::PeerStats => {
52373                r.with_limited_depth(|r| Ok(Self::PeerStats(Box::new(PeerStats::read_xdr(r)?))))
52374            }
52375            TypeVariant::PeerStatList => r.with_limited_depth(|r| {
52376                Ok(Self::PeerStatList(Box::new(PeerStatList::read_xdr(r)?)))
52377            }),
52378            TypeVariant::TimeSlicedNodeData => r.with_limited_depth(|r| {
52379                Ok(Self::TimeSlicedNodeData(Box::new(
52380                    TimeSlicedNodeData::read_xdr(r)?,
52381                )))
52382            }),
52383            TypeVariant::TimeSlicedPeerData => r.with_limited_depth(|r| {
52384                Ok(Self::TimeSlicedPeerData(Box::new(
52385                    TimeSlicedPeerData::read_xdr(r)?,
52386                )))
52387            }),
52388            TypeVariant::TimeSlicedPeerDataList => r.with_limited_depth(|r| {
52389                Ok(Self::TimeSlicedPeerDataList(Box::new(
52390                    TimeSlicedPeerDataList::read_xdr(r)?,
52391                )))
52392            }),
52393            TypeVariant::TopologyResponseBodyV0 => r.with_limited_depth(|r| {
52394                Ok(Self::TopologyResponseBodyV0(Box::new(
52395                    TopologyResponseBodyV0::read_xdr(r)?,
52396                )))
52397            }),
52398            TypeVariant::TopologyResponseBodyV1 => r.with_limited_depth(|r| {
52399                Ok(Self::TopologyResponseBodyV1(Box::new(
52400                    TopologyResponseBodyV1::read_xdr(r)?,
52401                )))
52402            }),
52403            TypeVariant::TopologyResponseBodyV2 => r.with_limited_depth(|r| {
52404                Ok(Self::TopologyResponseBodyV2(Box::new(
52405                    TopologyResponseBodyV2::read_xdr(r)?,
52406                )))
52407            }),
52408            TypeVariant::SurveyResponseBody => r.with_limited_depth(|r| {
52409                Ok(Self::SurveyResponseBody(Box::new(
52410                    SurveyResponseBody::read_xdr(r)?,
52411                )))
52412            }),
52413            TypeVariant::TxAdvertVector => r.with_limited_depth(|r| {
52414                Ok(Self::TxAdvertVector(Box::new(TxAdvertVector::read_xdr(r)?)))
52415            }),
52416            TypeVariant::FloodAdvert => {
52417                r.with_limited_depth(|r| Ok(Self::FloodAdvert(Box::new(FloodAdvert::read_xdr(r)?))))
52418            }
52419            TypeVariant::TxDemandVector => r.with_limited_depth(|r| {
52420                Ok(Self::TxDemandVector(Box::new(TxDemandVector::read_xdr(r)?)))
52421            }),
52422            TypeVariant::FloodDemand => {
52423                r.with_limited_depth(|r| Ok(Self::FloodDemand(Box::new(FloodDemand::read_xdr(r)?))))
52424            }
52425            TypeVariant::StellarMessage => r.with_limited_depth(|r| {
52426                Ok(Self::StellarMessage(Box::new(StellarMessage::read_xdr(r)?)))
52427            }),
52428            TypeVariant::AuthenticatedMessage => r.with_limited_depth(|r| {
52429                Ok(Self::AuthenticatedMessage(Box::new(
52430                    AuthenticatedMessage::read_xdr(r)?,
52431                )))
52432            }),
52433            TypeVariant::AuthenticatedMessageV0 => r.with_limited_depth(|r| {
52434                Ok(Self::AuthenticatedMessageV0(Box::new(
52435                    AuthenticatedMessageV0::read_xdr(r)?,
52436                )))
52437            }),
52438            TypeVariant::LiquidityPoolParameters => r.with_limited_depth(|r| {
52439                Ok(Self::LiquidityPoolParameters(Box::new(
52440                    LiquidityPoolParameters::read_xdr(r)?,
52441                )))
52442            }),
52443            TypeVariant::MuxedAccount => r.with_limited_depth(|r| {
52444                Ok(Self::MuxedAccount(Box::new(MuxedAccount::read_xdr(r)?)))
52445            }),
52446            TypeVariant::MuxedAccountMed25519 => r.with_limited_depth(|r| {
52447                Ok(Self::MuxedAccountMed25519(Box::new(
52448                    MuxedAccountMed25519::read_xdr(r)?,
52449                )))
52450            }),
52451            TypeVariant::DecoratedSignature => r.with_limited_depth(|r| {
52452                Ok(Self::DecoratedSignature(Box::new(
52453                    DecoratedSignature::read_xdr(r)?,
52454                )))
52455            }),
52456            TypeVariant::OperationType => r.with_limited_depth(|r| {
52457                Ok(Self::OperationType(Box::new(OperationType::read_xdr(r)?)))
52458            }),
52459            TypeVariant::CreateAccountOp => r.with_limited_depth(|r| {
52460                Ok(Self::CreateAccountOp(Box::new(CreateAccountOp::read_xdr(
52461                    r,
52462                )?)))
52463            }),
52464            TypeVariant::PaymentOp => {
52465                r.with_limited_depth(|r| Ok(Self::PaymentOp(Box::new(PaymentOp::read_xdr(r)?))))
52466            }
52467            TypeVariant::PathPaymentStrictReceiveOp => r.with_limited_depth(|r| {
52468                Ok(Self::PathPaymentStrictReceiveOp(Box::new(
52469                    PathPaymentStrictReceiveOp::read_xdr(r)?,
52470                )))
52471            }),
52472            TypeVariant::PathPaymentStrictSendOp => r.with_limited_depth(|r| {
52473                Ok(Self::PathPaymentStrictSendOp(Box::new(
52474                    PathPaymentStrictSendOp::read_xdr(r)?,
52475                )))
52476            }),
52477            TypeVariant::ManageSellOfferOp => r.with_limited_depth(|r| {
52478                Ok(Self::ManageSellOfferOp(Box::new(
52479                    ManageSellOfferOp::read_xdr(r)?,
52480                )))
52481            }),
52482            TypeVariant::ManageBuyOfferOp => r.with_limited_depth(|r| {
52483                Ok(Self::ManageBuyOfferOp(Box::new(
52484                    ManageBuyOfferOp::read_xdr(r)?,
52485                )))
52486            }),
52487            TypeVariant::CreatePassiveSellOfferOp => r.with_limited_depth(|r| {
52488                Ok(Self::CreatePassiveSellOfferOp(Box::new(
52489                    CreatePassiveSellOfferOp::read_xdr(r)?,
52490                )))
52491            }),
52492            TypeVariant::SetOptionsOp => r.with_limited_depth(|r| {
52493                Ok(Self::SetOptionsOp(Box::new(SetOptionsOp::read_xdr(r)?)))
52494            }),
52495            TypeVariant::ChangeTrustAsset => r.with_limited_depth(|r| {
52496                Ok(Self::ChangeTrustAsset(Box::new(
52497                    ChangeTrustAsset::read_xdr(r)?,
52498                )))
52499            }),
52500            TypeVariant::ChangeTrustOp => r.with_limited_depth(|r| {
52501                Ok(Self::ChangeTrustOp(Box::new(ChangeTrustOp::read_xdr(r)?)))
52502            }),
52503            TypeVariant::AllowTrustOp => r.with_limited_depth(|r| {
52504                Ok(Self::AllowTrustOp(Box::new(AllowTrustOp::read_xdr(r)?)))
52505            }),
52506            TypeVariant::ManageDataOp => r.with_limited_depth(|r| {
52507                Ok(Self::ManageDataOp(Box::new(ManageDataOp::read_xdr(r)?)))
52508            }),
52509            TypeVariant::BumpSequenceOp => r.with_limited_depth(|r| {
52510                Ok(Self::BumpSequenceOp(Box::new(BumpSequenceOp::read_xdr(r)?)))
52511            }),
52512            TypeVariant::CreateClaimableBalanceOp => r.with_limited_depth(|r| {
52513                Ok(Self::CreateClaimableBalanceOp(Box::new(
52514                    CreateClaimableBalanceOp::read_xdr(r)?,
52515                )))
52516            }),
52517            TypeVariant::ClaimClaimableBalanceOp => r.with_limited_depth(|r| {
52518                Ok(Self::ClaimClaimableBalanceOp(Box::new(
52519                    ClaimClaimableBalanceOp::read_xdr(r)?,
52520                )))
52521            }),
52522            TypeVariant::BeginSponsoringFutureReservesOp => r.with_limited_depth(|r| {
52523                Ok(Self::BeginSponsoringFutureReservesOp(Box::new(
52524                    BeginSponsoringFutureReservesOp::read_xdr(r)?,
52525                )))
52526            }),
52527            TypeVariant::RevokeSponsorshipType => r.with_limited_depth(|r| {
52528                Ok(Self::RevokeSponsorshipType(Box::new(
52529                    RevokeSponsorshipType::read_xdr(r)?,
52530                )))
52531            }),
52532            TypeVariant::RevokeSponsorshipOp => r.with_limited_depth(|r| {
52533                Ok(Self::RevokeSponsorshipOp(Box::new(
52534                    RevokeSponsorshipOp::read_xdr(r)?,
52535                )))
52536            }),
52537            TypeVariant::RevokeSponsorshipOpSigner => r.with_limited_depth(|r| {
52538                Ok(Self::RevokeSponsorshipOpSigner(Box::new(
52539                    RevokeSponsorshipOpSigner::read_xdr(r)?,
52540                )))
52541            }),
52542            TypeVariant::ClawbackOp => {
52543                r.with_limited_depth(|r| Ok(Self::ClawbackOp(Box::new(ClawbackOp::read_xdr(r)?))))
52544            }
52545            TypeVariant::ClawbackClaimableBalanceOp => r.with_limited_depth(|r| {
52546                Ok(Self::ClawbackClaimableBalanceOp(Box::new(
52547                    ClawbackClaimableBalanceOp::read_xdr(r)?,
52548                )))
52549            }),
52550            TypeVariant::SetTrustLineFlagsOp => r.with_limited_depth(|r| {
52551                Ok(Self::SetTrustLineFlagsOp(Box::new(
52552                    SetTrustLineFlagsOp::read_xdr(r)?,
52553                )))
52554            }),
52555            TypeVariant::LiquidityPoolDepositOp => r.with_limited_depth(|r| {
52556                Ok(Self::LiquidityPoolDepositOp(Box::new(
52557                    LiquidityPoolDepositOp::read_xdr(r)?,
52558                )))
52559            }),
52560            TypeVariant::LiquidityPoolWithdrawOp => r.with_limited_depth(|r| {
52561                Ok(Self::LiquidityPoolWithdrawOp(Box::new(
52562                    LiquidityPoolWithdrawOp::read_xdr(r)?,
52563                )))
52564            }),
52565            TypeVariant::HostFunctionType => r.with_limited_depth(|r| {
52566                Ok(Self::HostFunctionType(Box::new(
52567                    HostFunctionType::read_xdr(r)?,
52568                )))
52569            }),
52570            TypeVariant::ContractIdPreimageType => r.with_limited_depth(|r| {
52571                Ok(Self::ContractIdPreimageType(Box::new(
52572                    ContractIdPreimageType::read_xdr(r)?,
52573                )))
52574            }),
52575            TypeVariant::ContractIdPreimage => r.with_limited_depth(|r| {
52576                Ok(Self::ContractIdPreimage(Box::new(
52577                    ContractIdPreimage::read_xdr(r)?,
52578                )))
52579            }),
52580            TypeVariant::ContractIdPreimageFromAddress => r.with_limited_depth(|r| {
52581                Ok(Self::ContractIdPreimageFromAddress(Box::new(
52582                    ContractIdPreimageFromAddress::read_xdr(r)?,
52583                )))
52584            }),
52585            TypeVariant::CreateContractArgs => r.with_limited_depth(|r| {
52586                Ok(Self::CreateContractArgs(Box::new(
52587                    CreateContractArgs::read_xdr(r)?,
52588                )))
52589            }),
52590            TypeVariant::CreateContractArgsV2 => r.with_limited_depth(|r| {
52591                Ok(Self::CreateContractArgsV2(Box::new(
52592                    CreateContractArgsV2::read_xdr(r)?,
52593                )))
52594            }),
52595            TypeVariant::InvokeContractArgs => r.with_limited_depth(|r| {
52596                Ok(Self::InvokeContractArgs(Box::new(
52597                    InvokeContractArgs::read_xdr(r)?,
52598                )))
52599            }),
52600            TypeVariant::HostFunction => r.with_limited_depth(|r| {
52601                Ok(Self::HostFunction(Box::new(HostFunction::read_xdr(r)?)))
52602            }),
52603            TypeVariant::SorobanAuthorizedFunctionType => r.with_limited_depth(|r| {
52604                Ok(Self::SorobanAuthorizedFunctionType(Box::new(
52605                    SorobanAuthorizedFunctionType::read_xdr(r)?,
52606                )))
52607            }),
52608            TypeVariant::SorobanAuthorizedFunction => r.with_limited_depth(|r| {
52609                Ok(Self::SorobanAuthorizedFunction(Box::new(
52610                    SorobanAuthorizedFunction::read_xdr(r)?,
52611                )))
52612            }),
52613            TypeVariant::SorobanAuthorizedInvocation => r.with_limited_depth(|r| {
52614                Ok(Self::SorobanAuthorizedInvocation(Box::new(
52615                    SorobanAuthorizedInvocation::read_xdr(r)?,
52616                )))
52617            }),
52618            TypeVariant::SorobanAddressCredentials => r.with_limited_depth(|r| {
52619                Ok(Self::SorobanAddressCredentials(Box::new(
52620                    SorobanAddressCredentials::read_xdr(r)?,
52621                )))
52622            }),
52623            TypeVariant::SorobanCredentialsType => r.with_limited_depth(|r| {
52624                Ok(Self::SorobanCredentialsType(Box::new(
52625                    SorobanCredentialsType::read_xdr(r)?,
52626                )))
52627            }),
52628            TypeVariant::SorobanCredentials => r.with_limited_depth(|r| {
52629                Ok(Self::SorobanCredentials(Box::new(
52630                    SorobanCredentials::read_xdr(r)?,
52631                )))
52632            }),
52633            TypeVariant::SorobanAuthorizationEntry => r.with_limited_depth(|r| {
52634                Ok(Self::SorobanAuthorizationEntry(Box::new(
52635                    SorobanAuthorizationEntry::read_xdr(r)?,
52636                )))
52637            }),
52638            TypeVariant::InvokeHostFunctionOp => r.with_limited_depth(|r| {
52639                Ok(Self::InvokeHostFunctionOp(Box::new(
52640                    InvokeHostFunctionOp::read_xdr(r)?,
52641                )))
52642            }),
52643            TypeVariant::ExtendFootprintTtlOp => r.with_limited_depth(|r| {
52644                Ok(Self::ExtendFootprintTtlOp(Box::new(
52645                    ExtendFootprintTtlOp::read_xdr(r)?,
52646                )))
52647            }),
52648            TypeVariant::RestoreFootprintOp => r.with_limited_depth(|r| {
52649                Ok(Self::RestoreFootprintOp(Box::new(
52650                    RestoreFootprintOp::read_xdr(r)?,
52651                )))
52652            }),
52653            TypeVariant::Operation => {
52654                r.with_limited_depth(|r| Ok(Self::Operation(Box::new(Operation::read_xdr(r)?))))
52655            }
52656            TypeVariant::OperationBody => r.with_limited_depth(|r| {
52657                Ok(Self::OperationBody(Box::new(OperationBody::read_xdr(r)?)))
52658            }),
52659            TypeVariant::HashIdPreimage => r.with_limited_depth(|r| {
52660                Ok(Self::HashIdPreimage(Box::new(HashIdPreimage::read_xdr(r)?)))
52661            }),
52662            TypeVariant::HashIdPreimageOperationId => r.with_limited_depth(|r| {
52663                Ok(Self::HashIdPreimageOperationId(Box::new(
52664                    HashIdPreimageOperationId::read_xdr(r)?,
52665                )))
52666            }),
52667            TypeVariant::HashIdPreimageRevokeId => r.with_limited_depth(|r| {
52668                Ok(Self::HashIdPreimageRevokeId(Box::new(
52669                    HashIdPreimageRevokeId::read_xdr(r)?,
52670                )))
52671            }),
52672            TypeVariant::HashIdPreimageContractId => r.with_limited_depth(|r| {
52673                Ok(Self::HashIdPreimageContractId(Box::new(
52674                    HashIdPreimageContractId::read_xdr(r)?,
52675                )))
52676            }),
52677            TypeVariant::HashIdPreimageSorobanAuthorization => r.with_limited_depth(|r| {
52678                Ok(Self::HashIdPreimageSorobanAuthorization(Box::new(
52679                    HashIdPreimageSorobanAuthorization::read_xdr(r)?,
52680                )))
52681            }),
52682            TypeVariant::MemoType => {
52683                r.with_limited_depth(|r| Ok(Self::MemoType(Box::new(MemoType::read_xdr(r)?))))
52684            }
52685            TypeVariant::Memo => {
52686                r.with_limited_depth(|r| Ok(Self::Memo(Box::new(Memo::read_xdr(r)?))))
52687            }
52688            TypeVariant::TimeBounds => {
52689                r.with_limited_depth(|r| Ok(Self::TimeBounds(Box::new(TimeBounds::read_xdr(r)?))))
52690            }
52691            TypeVariant::LedgerBounds => r.with_limited_depth(|r| {
52692                Ok(Self::LedgerBounds(Box::new(LedgerBounds::read_xdr(r)?)))
52693            }),
52694            TypeVariant::PreconditionsV2 => r.with_limited_depth(|r| {
52695                Ok(Self::PreconditionsV2(Box::new(PreconditionsV2::read_xdr(
52696                    r,
52697                )?)))
52698            }),
52699            TypeVariant::PreconditionType => r.with_limited_depth(|r| {
52700                Ok(Self::PreconditionType(Box::new(
52701                    PreconditionType::read_xdr(r)?,
52702                )))
52703            }),
52704            TypeVariant::Preconditions => r.with_limited_depth(|r| {
52705                Ok(Self::Preconditions(Box::new(Preconditions::read_xdr(r)?)))
52706            }),
52707            TypeVariant::LedgerFootprint => r.with_limited_depth(|r| {
52708                Ok(Self::LedgerFootprint(Box::new(LedgerFootprint::read_xdr(
52709                    r,
52710                )?)))
52711            }),
52712            TypeVariant::ArchivalProofType => r.with_limited_depth(|r| {
52713                Ok(Self::ArchivalProofType(Box::new(
52714                    ArchivalProofType::read_xdr(r)?,
52715                )))
52716            }),
52717            TypeVariant::ArchivalProofNode => r.with_limited_depth(|r| {
52718                Ok(Self::ArchivalProofNode(Box::new(
52719                    ArchivalProofNode::read_xdr(r)?,
52720                )))
52721            }),
52722            TypeVariant::ProofLevel => {
52723                r.with_limited_depth(|r| Ok(Self::ProofLevel(Box::new(ProofLevel::read_xdr(r)?))))
52724            }
52725            TypeVariant::ExistenceProofBody => r.with_limited_depth(|r| {
52726                Ok(Self::ExistenceProofBody(Box::new(
52727                    ExistenceProofBody::read_xdr(r)?,
52728                )))
52729            }),
52730            TypeVariant::NonexistenceProofBody => r.with_limited_depth(|r| {
52731                Ok(Self::NonexistenceProofBody(Box::new(
52732                    NonexistenceProofBody::read_xdr(r)?,
52733                )))
52734            }),
52735            TypeVariant::ArchivalProof => r.with_limited_depth(|r| {
52736                Ok(Self::ArchivalProof(Box::new(ArchivalProof::read_xdr(r)?)))
52737            }),
52738            TypeVariant::ArchivalProofBody => r.with_limited_depth(|r| {
52739                Ok(Self::ArchivalProofBody(Box::new(
52740                    ArchivalProofBody::read_xdr(r)?,
52741                )))
52742            }),
52743            TypeVariant::SorobanResources => r.with_limited_depth(|r| {
52744                Ok(Self::SorobanResources(Box::new(
52745                    SorobanResources::read_xdr(r)?,
52746                )))
52747            }),
52748            TypeVariant::SorobanTransactionData => r.with_limited_depth(|r| {
52749                Ok(Self::SorobanTransactionData(Box::new(
52750                    SorobanTransactionData::read_xdr(r)?,
52751                )))
52752            }),
52753            TypeVariant::SorobanTransactionDataExt => r.with_limited_depth(|r| {
52754                Ok(Self::SorobanTransactionDataExt(Box::new(
52755                    SorobanTransactionDataExt::read_xdr(r)?,
52756                )))
52757            }),
52758            TypeVariant::TransactionV0 => r.with_limited_depth(|r| {
52759                Ok(Self::TransactionV0(Box::new(TransactionV0::read_xdr(r)?)))
52760            }),
52761            TypeVariant::TransactionV0Ext => r.with_limited_depth(|r| {
52762                Ok(Self::TransactionV0Ext(Box::new(
52763                    TransactionV0Ext::read_xdr(r)?,
52764                )))
52765            }),
52766            TypeVariant::TransactionV0Envelope => r.with_limited_depth(|r| {
52767                Ok(Self::TransactionV0Envelope(Box::new(
52768                    TransactionV0Envelope::read_xdr(r)?,
52769                )))
52770            }),
52771            TypeVariant::Transaction => {
52772                r.with_limited_depth(|r| Ok(Self::Transaction(Box::new(Transaction::read_xdr(r)?))))
52773            }
52774            TypeVariant::TransactionExt => r.with_limited_depth(|r| {
52775                Ok(Self::TransactionExt(Box::new(TransactionExt::read_xdr(r)?)))
52776            }),
52777            TypeVariant::TransactionV1Envelope => r.with_limited_depth(|r| {
52778                Ok(Self::TransactionV1Envelope(Box::new(
52779                    TransactionV1Envelope::read_xdr(r)?,
52780                )))
52781            }),
52782            TypeVariant::FeeBumpTransaction => r.with_limited_depth(|r| {
52783                Ok(Self::FeeBumpTransaction(Box::new(
52784                    FeeBumpTransaction::read_xdr(r)?,
52785                )))
52786            }),
52787            TypeVariant::FeeBumpTransactionInnerTx => r.with_limited_depth(|r| {
52788                Ok(Self::FeeBumpTransactionInnerTx(Box::new(
52789                    FeeBumpTransactionInnerTx::read_xdr(r)?,
52790                )))
52791            }),
52792            TypeVariant::FeeBumpTransactionExt => r.with_limited_depth(|r| {
52793                Ok(Self::FeeBumpTransactionExt(Box::new(
52794                    FeeBumpTransactionExt::read_xdr(r)?,
52795                )))
52796            }),
52797            TypeVariant::FeeBumpTransactionEnvelope => r.with_limited_depth(|r| {
52798                Ok(Self::FeeBumpTransactionEnvelope(Box::new(
52799                    FeeBumpTransactionEnvelope::read_xdr(r)?,
52800                )))
52801            }),
52802            TypeVariant::TransactionEnvelope => r.with_limited_depth(|r| {
52803                Ok(Self::TransactionEnvelope(Box::new(
52804                    TransactionEnvelope::read_xdr(r)?,
52805                )))
52806            }),
52807            TypeVariant::TransactionSignaturePayload => r.with_limited_depth(|r| {
52808                Ok(Self::TransactionSignaturePayload(Box::new(
52809                    TransactionSignaturePayload::read_xdr(r)?,
52810                )))
52811            }),
52812            TypeVariant::TransactionSignaturePayloadTaggedTransaction => {
52813                r.with_limited_depth(|r| {
52814                    Ok(Self::TransactionSignaturePayloadTaggedTransaction(
52815                        Box::new(TransactionSignaturePayloadTaggedTransaction::read_xdr(r)?),
52816                    ))
52817                })
52818            }
52819            TypeVariant::ClaimAtomType => r.with_limited_depth(|r| {
52820                Ok(Self::ClaimAtomType(Box::new(ClaimAtomType::read_xdr(r)?)))
52821            }),
52822            TypeVariant::ClaimOfferAtomV0 => r.with_limited_depth(|r| {
52823                Ok(Self::ClaimOfferAtomV0(Box::new(
52824                    ClaimOfferAtomV0::read_xdr(r)?,
52825                )))
52826            }),
52827            TypeVariant::ClaimOfferAtom => r.with_limited_depth(|r| {
52828                Ok(Self::ClaimOfferAtom(Box::new(ClaimOfferAtom::read_xdr(r)?)))
52829            }),
52830            TypeVariant::ClaimLiquidityAtom => r.with_limited_depth(|r| {
52831                Ok(Self::ClaimLiquidityAtom(Box::new(
52832                    ClaimLiquidityAtom::read_xdr(r)?,
52833                )))
52834            }),
52835            TypeVariant::ClaimAtom => {
52836                r.with_limited_depth(|r| Ok(Self::ClaimAtom(Box::new(ClaimAtom::read_xdr(r)?))))
52837            }
52838            TypeVariant::CreateAccountResultCode => r.with_limited_depth(|r| {
52839                Ok(Self::CreateAccountResultCode(Box::new(
52840                    CreateAccountResultCode::read_xdr(r)?,
52841                )))
52842            }),
52843            TypeVariant::CreateAccountResult => r.with_limited_depth(|r| {
52844                Ok(Self::CreateAccountResult(Box::new(
52845                    CreateAccountResult::read_xdr(r)?,
52846                )))
52847            }),
52848            TypeVariant::PaymentResultCode => r.with_limited_depth(|r| {
52849                Ok(Self::PaymentResultCode(Box::new(
52850                    PaymentResultCode::read_xdr(r)?,
52851                )))
52852            }),
52853            TypeVariant::PaymentResult => r.with_limited_depth(|r| {
52854                Ok(Self::PaymentResult(Box::new(PaymentResult::read_xdr(r)?)))
52855            }),
52856            TypeVariant::PathPaymentStrictReceiveResultCode => r.with_limited_depth(|r| {
52857                Ok(Self::PathPaymentStrictReceiveResultCode(Box::new(
52858                    PathPaymentStrictReceiveResultCode::read_xdr(r)?,
52859                )))
52860            }),
52861            TypeVariant::SimplePaymentResult => r.with_limited_depth(|r| {
52862                Ok(Self::SimplePaymentResult(Box::new(
52863                    SimplePaymentResult::read_xdr(r)?,
52864                )))
52865            }),
52866            TypeVariant::PathPaymentStrictReceiveResult => r.with_limited_depth(|r| {
52867                Ok(Self::PathPaymentStrictReceiveResult(Box::new(
52868                    PathPaymentStrictReceiveResult::read_xdr(r)?,
52869                )))
52870            }),
52871            TypeVariant::PathPaymentStrictReceiveResultSuccess => r.with_limited_depth(|r| {
52872                Ok(Self::PathPaymentStrictReceiveResultSuccess(Box::new(
52873                    PathPaymentStrictReceiveResultSuccess::read_xdr(r)?,
52874                )))
52875            }),
52876            TypeVariant::PathPaymentStrictSendResultCode => r.with_limited_depth(|r| {
52877                Ok(Self::PathPaymentStrictSendResultCode(Box::new(
52878                    PathPaymentStrictSendResultCode::read_xdr(r)?,
52879                )))
52880            }),
52881            TypeVariant::PathPaymentStrictSendResult => r.with_limited_depth(|r| {
52882                Ok(Self::PathPaymentStrictSendResult(Box::new(
52883                    PathPaymentStrictSendResult::read_xdr(r)?,
52884                )))
52885            }),
52886            TypeVariant::PathPaymentStrictSendResultSuccess => r.with_limited_depth(|r| {
52887                Ok(Self::PathPaymentStrictSendResultSuccess(Box::new(
52888                    PathPaymentStrictSendResultSuccess::read_xdr(r)?,
52889                )))
52890            }),
52891            TypeVariant::ManageSellOfferResultCode => r.with_limited_depth(|r| {
52892                Ok(Self::ManageSellOfferResultCode(Box::new(
52893                    ManageSellOfferResultCode::read_xdr(r)?,
52894                )))
52895            }),
52896            TypeVariant::ManageOfferEffect => r.with_limited_depth(|r| {
52897                Ok(Self::ManageOfferEffect(Box::new(
52898                    ManageOfferEffect::read_xdr(r)?,
52899                )))
52900            }),
52901            TypeVariant::ManageOfferSuccessResult => r.with_limited_depth(|r| {
52902                Ok(Self::ManageOfferSuccessResult(Box::new(
52903                    ManageOfferSuccessResult::read_xdr(r)?,
52904                )))
52905            }),
52906            TypeVariant::ManageOfferSuccessResultOffer => r.with_limited_depth(|r| {
52907                Ok(Self::ManageOfferSuccessResultOffer(Box::new(
52908                    ManageOfferSuccessResultOffer::read_xdr(r)?,
52909                )))
52910            }),
52911            TypeVariant::ManageSellOfferResult => r.with_limited_depth(|r| {
52912                Ok(Self::ManageSellOfferResult(Box::new(
52913                    ManageSellOfferResult::read_xdr(r)?,
52914                )))
52915            }),
52916            TypeVariant::ManageBuyOfferResultCode => r.with_limited_depth(|r| {
52917                Ok(Self::ManageBuyOfferResultCode(Box::new(
52918                    ManageBuyOfferResultCode::read_xdr(r)?,
52919                )))
52920            }),
52921            TypeVariant::ManageBuyOfferResult => r.with_limited_depth(|r| {
52922                Ok(Self::ManageBuyOfferResult(Box::new(
52923                    ManageBuyOfferResult::read_xdr(r)?,
52924                )))
52925            }),
52926            TypeVariant::SetOptionsResultCode => r.with_limited_depth(|r| {
52927                Ok(Self::SetOptionsResultCode(Box::new(
52928                    SetOptionsResultCode::read_xdr(r)?,
52929                )))
52930            }),
52931            TypeVariant::SetOptionsResult => r.with_limited_depth(|r| {
52932                Ok(Self::SetOptionsResult(Box::new(
52933                    SetOptionsResult::read_xdr(r)?,
52934                )))
52935            }),
52936            TypeVariant::ChangeTrustResultCode => r.with_limited_depth(|r| {
52937                Ok(Self::ChangeTrustResultCode(Box::new(
52938                    ChangeTrustResultCode::read_xdr(r)?,
52939                )))
52940            }),
52941            TypeVariant::ChangeTrustResult => r.with_limited_depth(|r| {
52942                Ok(Self::ChangeTrustResult(Box::new(
52943                    ChangeTrustResult::read_xdr(r)?,
52944                )))
52945            }),
52946            TypeVariant::AllowTrustResultCode => r.with_limited_depth(|r| {
52947                Ok(Self::AllowTrustResultCode(Box::new(
52948                    AllowTrustResultCode::read_xdr(r)?,
52949                )))
52950            }),
52951            TypeVariant::AllowTrustResult => r.with_limited_depth(|r| {
52952                Ok(Self::AllowTrustResult(Box::new(
52953                    AllowTrustResult::read_xdr(r)?,
52954                )))
52955            }),
52956            TypeVariant::AccountMergeResultCode => r.with_limited_depth(|r| {
52957                Ok(Self::AccountMergeResultCode(Box::new(
52958                    AccountMergeResultCode::read_xdr(r)?,
52959                )))
52960            }),
52961            TypeVariant::AccountMergeResult => r.with_limited_depth(|r| {
52962                Ok(Self::AccountMergeResult(Box::new(
52963                    AccountMergeResult::read_xdr(r)?,
52964                )))
52965            }),
52966            TypeVariant::InflationResultCode => r.with_limited_depth(|r| {
52967                Ok(Self::InflationResultCode(Box::new(
52968                    InflationResultCode::read_xdr(r)?,
52969                )))
52970            }),
52971            TypeVariant::InflationPayout => r.with_limited_depth(|r| {
52972                Ok(Self::InflationPayout(Box::new(InflationPayout::read_xdr(
52973                    r,
52974                )?)))
52975            }),
52976            TypeVariant::InflationResult => r.with_limited_depth(|r| {
52977                Ok(Self::InflationResult(Box::new(InflationResult::read_xdr(
52978                    r,
52979                )?)))
52980            }),
52981            TypeVariant::ManageDataResultCode => r.with_limited_depth(|r| {
52982                Ok(Self::ManageDataResultCode(Box::new(
52983                    ManageDataResultCode::read_xdr(r)?,
52984                )))
52985            }),
52986            TypeVariant::ManageDataResult => r.with_limited_depth(|r| {
52987                Ok(Self::ManageDataResult(Box::new(
52988                    ManageDataResult::read_xdr(r)?,
52989                )))
52990            }),
52991            TypeVariant::BumpSequenceResultCode => r.with_limited_depth(|r| {
52992                Ok(Self::BumpSequenceResultCode(Box::new(
52993                    BumpSequenceResultCode::read_xdr(r)?,
52994                )))
52995            }),
52996            TypeVariant::BumpSequenceResult => r.with_limited_depth(|r| {
52997                Ok(Self::BumpSequenceResult(Box::new(
52998                    BumpSequenceResult::read_xdr(r)?,
52999                )))
53000            }),
53001            TypeVariant::CreateClaimableBalanceResultCode => r.with_limited_depth(|r| {
53002                Ok(Self::CreateClaimableBalanceResultCode(Box::new(
53003                    CreateClaimableBalanceResultCode::read_xdr(r)?,
53004                )))
53005            }),
53006            TypeVariant::CreateClaimableBalanceResult => r.with_limited_depth(|r| {
53007                Ok(Self::CreateClaimableBalanceResult(Box::new(
53008                    CreateClaimableBalanceResult::read_xdr(r)?,
53009                )))
53010            }),
53011            TypeVariant::ClaimClaimableBalanceResultCode => r.with_limited_depth(|r| {
53012                Ok(Self::ClaimClaimableBalanceResultCode(Box::new(
53013                    ClaimClaimableBalanceResultCode::read_xdr(r)?,
53014                )))
53015            }),
53016            TypeVariant::ClaimClaimableBalanceResult => r.with_limited_depth(|r| {
53017                Ok(Self::ClaimClaimableBalanceResult(Box::new(
53018                    ClaimClaimableBalanceResult::read_xdr(r)?,
53019                )))
53020            }),
53021            TypeVariant::BeginSponsoringFutureReservesResultCode => r.with_limited_depth(|r| {
53022                Ok(Self::BeginSponsoringFutureReservesResultCode(Box::new(
53023                    BeginSponsoringFutureReservesResultCode::read_xdr(r)?,
53024                )))
53025            }),
53026            TypeVariant::BeginSponsoringFutureReservesResult => r.with_limited_depth(|r| {
53027                Ok(Self::BeginSponsoringFutureReservesResult(Box::new(
53028                    BeginSponsoringFutureReservesResult::read_xdr(r)?,
53029                )))
53030            }),
53031            TypeVariant::EndSponsoringFutureReservesResultCode => r.with_limited_depth(|r| {
53032                Ok(Self::EndSponsoringFutureReservesResultCode(Box::new(
53033                    EndSponsoringFutureReservesResultCode::read_xdr(r)?,
53034                )))
53035            }),
53036            TypeVariant::EndSponsoringFutureReservesResult => r.with_limited_depth(|r| {
53037                Ok(Self::EndSponsoringFutureReservesResult(Box::new(
53038                    EndSponsoringFutureReservesResult::read_xdr(r)?,
53039                )))
53040            }),
53041            TypeVariant::RevokeSponsorshipResultCode => r.with_limited_depth(|r| {
53042                Ok(Self::RevokeSponsorshipResultCode(Box::new(
53043                    RevokeSponsorshipResultCode::read_xdr(r)?,
53044                )))
53045            }),
53046            TypeVariant::RevokeSponsorshipResult => r.with_limited_depth(|r| {
53047                Ok(Self::RevokeSponsorshipResult(Box::new(
53048                    RevokeSponsorshipResult::read_xdr(r)?,
53049                )))
53050            }),
53051            TypeVariant::ClawbackResultCode => r.with_limited_depth(|r| {
53052                Ok(Self::ClawbackResultCode(Box::new(
53053                    ClawbackResultCode::read_xdr(r)?,
53054                )))
53055            }),
53056            TypeVariant::ClawbackResult => r.with_limited_depth(|r| {
53057                Ok(Self::ClawbackResult(Box::new(ClawbackResult::read_xdr(r)?)))
53058            }),
53059            TypeVariant::ClawbackClaimableBalanceResultCode => r.with_limited_depth(|r| {
53060                Ok(Self::ClawbackClaimableBalanceResultCode(Box::new(
53061                    ClawbackClaimableBalanceResultCode::read_xdr(r)?,
53062                )))
53063            }),
53064            TypeVariant::ClawbackClaimableBalanceResult => r.with_limited_depth(|r| {
53065                Ok(Self::ClawbackClaimableBalanceResult(Box::new(
53066                    ClawbackClaimableBalanceResult::read_xdr(r)?,
53067                )))
53068            }),
53069            TypeVariant::SetTrustLineFlagsResultCode => r.with_limited_depth(|r| {
53070                Ok(Self::SetTrustLineFlagsResultCode(Box::new(
53071                    SetTrustLineFlagsResultCode::read_xdr(r)?,
53072                )))
53073            }),
53074            TypeVariant::SetTrustLineFlagsResult => r.with_limited_depth(|r| {
53075                Ok(Self::SetTrustLineFlagsResult(Box::new(
53076                    SetTrustLineFlagsResult::read_xdr(r)?,
53077                )))
53078            }),
53079            TypeVariant::LiquidityPoolDepositResultCode => r.with_limited_depth(|r| {
53080                Ok(Self::LiquidityPoolDepositResultCode(Box::new(
53081                    LiquidityPoolDepositResultCode::read_xdr(r)?,
53082                )))
53083            }),
53084            TypeVariant::LiquidityPoolDepositResult => r.with_limited_depth(|r| {
53085                Ok(Self::LiquidityPoolDepositResult(Box::new(
53086                    LiquidityPoolDepositResult::read_xdr(r)?,
53087                )))
53088            }),
53089            TypeVariant::LiquidityPoolWithdrawResultCode => r.with_limited_depth(|r| {
53090                Ok(Self::LiquidityPoolWithdrawResultCode(Box::new(
53091                    LiquidityPoolWithdrawResultCode::read_xdr(r)?,
53092                )))
53093            }),
53094            TypeVariant::LiquidityPoolWithdrawResult => r.with_limited_depth(|r| {
53095                Ok(Self::LiquidityPoolWithdrawResult(Box::new(
53096                    LiquidityPoolWithdrawResult::read_xdr(r)?,
53097                )))
53098            }),
53099            TypeVariant::InvokeHostFunctionResultCode => r.with_limited_depth(|r| {
53100                Ok(Self::InvokeHostFunctionResultCode(Box::new(
53101                    InvokeHostFunctionResultCode::read_xdr(r)?,
53102                )))
53103            }),
53104            TypeVariant::InvokeHostFunctionResult => r.with_limited_depth(|r| {
53105                Ok(Self::InvokeHostFunctionResult(Box::new(
53106                    InvokeHostFunctionResult::read_xdr(r)?,
53107                )))
53108            }),
53109            TypeVariant::ExtendFootprintTtlResultCode => r.with_limited_depth(|r| {
53110                Ok(Self::ExtendFootprintTtlResultCode(Box::new(
53111                    ExtendFootprintTtlResultCode::read_xdr(r)?,
53112                )))
53113            }),
53114            TypeVariant::ExtendFootprintTtlResult => r.with_limited_depth(|r| {
53115                Ok(Self::ExtendFootprintTtlResult(Box::new(
53116                    ExtendFootprintTtlResult::read_xdr(r)?,
53117                )))
53118            }),
53119            TypeVariant::RestoreFootprintResultCode => r.with_limited_depth(|r| {
53120                Ok(Self::RestoreFootprintResultCode(Box::new(
53121                    RestoreFootprintResultCode::read_xdr(r)?,
53122                )))
53123            }),
53124            TypeVariant::RestoreFootprintResult => r.with_limited_depth(|r| {
53125                Ok(Self::RestoreFootprintResult(Box::new(
53126                    RestoreFootprintResult::read_xdr(r)?,
53127                )))
53128            }),
53129            TypeVariant::OperationResultCode => r.with_limited_depth(|r| {
53130                Ok(Self::OperationResultCode(Box::new(
53131                    OperationResultCode::read_xdr(r)?,
53132                )))
53133            }),
53134            TypeVariant::OperationResult => r.with_limited_depth(|r| {
53135                Ok(Self::OperationResult(Box::new(OperationResult::read_xdr(
53136                    r,
53137                )?)))
53138            }),
53139            TypeVariant::OperationResultTr => r.with_limited_depth(|r| {
53140                Ok(Self::OperationResultTr(Box::new(
53141                    OperationResultTr::read_xdr(r)?,
53142                )))
53143            }),
53144            TypeVariant::TransactionResultCode => r.with_limited_depth(|r| {
53145                Ok(Self::TransactionResultCode(Box::new(
53146                    TransactionResultCode::read_xdr(r)?,
53147                )))
53148            }),
53149            TypeVariant::InnerTransactionResult => r.with_limited_depth(|r| {
53150                Ok(Self::InnerTransactionResult(Box::new(
53151                    InnerTransactionResult::read_xdr(r)?,
53152                )))
53153            }),
53154            TypeVariant::InnerTransactionResultResult => r.with_limited_depth(|r| {
53155                Ok(Self::InnerTransactionResultResult(Box::new(
53156                    InnerTransactionResultResult::read_xdr(r)?,
53157                )))
53158            }),
53159            TypeVariant::InnerTransactionResultExt => r.with_limited_depth(|r| {
53160                Ok(Self::InnerTransactionResultExt(Box::new(
53161                    InnerTransactionResultExt::read_xdr(r)?,
53162                )))
53163            }),
53164            TypeVariant::InnerTransactionResultPair => r.with_limited_depth(|r| {
53165                Ok(Self::InnerTransactionResultPair(Box::new(
53166                    InnerTransactionResultPair::read_xdr(r)?,
53167                )))
53168            }),
53169            TypeVariant::TransactionResult => r.with_limited_depth(|r| {
53170                Ok(Self::TransactionResult(Box::new(
53171                    TransactionResult::read_xdr(r)?,
53172                )))
53173            }),
53174            TypeVariant::TransactionResultResult => r.with_limited_depth(|r| {
53175                Ok(Self::TransactionResultResult(Box::new(
53176                    TransactionResultResult::read_xdr(r)?,
53177                )))
53178            }),
53179            TypeVariant::TransactionResultExt => r.with_limited_depth(|r| {
53180                Ok(Self::TransactionResultExt(Box::new(
53181                    TransactionResultExt::read_xdr(r)?,
53182                )))
53183            }),
53184            TypeVariant::Hash => {
53185                r.with_limited_depth(|r| Ok(Self::Hash(Box::new(Hash::read_xdr(r)?))))
53186            }
53187            TypeVariant::Uint256 => {
53188                r.with_limited_depth(|r| Ok(Self::Uint256(Box::new(Uint256::read_xdr(r)?))))
53189            }
53190            TypeVariant::Uint32 => {
53191                r.with_limited_depth(|r| Ok(Self::Uint32(Box::new(Uint32::read_xdr(r)?))))
53192            }
53193            TypeVariant::Int32 => {
53194                r.with_limited_depth(|r| Ok(Self::Int32(Box::new(Int32::read_xdr(r)?))))
53195            }
53196            TypeVariant::Uint64 => {
53197                r.with_limited_depth(|r| Ok(Self::Uint64(Box::new(Uint64::read_xdr(r)?))))
53198            }
53199            TypeVariant::Int64 => {
53200                r.with_limited_depth(|r| Ok(Self::Int64(Box::new(Int64::read_xdr(r)?))))
53201            }
53202            TypeVariant::TimePoint => {
53203                r.with_limited_depth(|r| Ok(Self::TimePoint(Box::new(TimePoint::read_xdr(r)?))))
53204            }
53205            TypeVariant::Duration => {
53206                r.with_limited_depth(|r| Ok(Self::Duration(Box::new(Duration::read_xdr(r)?))))
53207            }
53208            TypeVariant::ExtensionPoint => r.with_limited_depth(|r| {
53209                Ok(Self::ExtensionPoint(Box::new(ExtensionPoint::read_xdr(r)?)))
53210            }),
53211            TypeVariant::CryptoKeyType => r.with_limited_depth(|r| {
53212                Ok(Self::CryptoKeyType(Box::new(CryptoKeyType::read_xdr(r)?)))
53213            }),
53214            TypeVariant::PublicKeyType => r.with_limited_depth(|r| {
53215                Ok(Self::PublicKeyType(Box::new(PublicKeyType::read_xdr(r)?)))
53216            }),
53217            TypeVariant::SignerKeyType => r.with_limited_depth(|r| {
53218                Ok(Self::SignerKeyType(Box::new(SignerKeyType::read_xdr(r)?)))
53219            }),
53220            TypeVariant::PublicKey => {
53221                r.with_limited_depth(|r| Ok(Self::PublicKey(Box::new(PublicKey::read_xdr(r)?))))
53222            }
53223            TypeVariant::SignerKey => {
53224                r.with_limited_depth(|r| Ok(Self::SignerKey(Box::new(SignerKey::read_xdr(r)?))))
53225            }
53226            TypeVariant::SignerKeyEd25519SignedPayload => r.with_limited_depth(|r| {
53227                Ok(Self::SignerKeyEd25519SignedPayload(Box::new(
53228                    SignerKeyEd25519SignedPayload::read_xdr(r)?,
53229                )))
53230            }),
53231            TypeVariant::Signature => {
53232                r.with_limited_depth(|r| Ok(Self::Signature(Box::new(Signature::read_xdr(r)?))))
53233            }
53234            TypeVariant::SignatureHint => r.with_limited_depth(|r| {
53235                Ok(Self::SignatureHint(Box::new(SignatureHint::read_xdr(r)?)))
53236            }),
53237            TypeVariant::NodeId => {
53238                r.with_limited_depth(|r| Ok(Self::NodeId(Box::new(NodeId::read_xdr(r)?))))
53239            }
53240            TypeVariant::AccountId => {
53241                r.with_limited_depth(|r| Ok(Self::AccountId(Box::new(AccountId::read_xdr(r)?))))
53242            }
53243            TypeVariant::Curve25519Secret => r.with_limited_depth(|r| {
53244                Ok(Self::Curve25519Secret(Box::new(
53245                    Curve25519Secret::read_xdr(r)?,
53246                )))
53247            }),
53248            TypeVariant::Curve25519Public => r.with_limited_depth(|r| {
53249                Ok(Self::Curve25519Public(Box::new(
53250                    Curve25519Public::read_xdr(r)?,
53251                )))
53252            }),
53253            TypeVariant::HmacSha256Key => r.with_limited_depth(|r| {
53254                Ok(Self::HmacSha256Key(Box::new(HmacSha256Key::read_xdr(r)?)))
53255            }),
53256            TypeVariant::HmacSha256Mac => r.with_limited_depth(|r| {
53257                Ok(Self::HmacSha256Mac(Box::new(HmacSha256Mac::read_xdr(r)?)))
53258            }),
53259            TypeVariant::ShortHashSeed => r.with_limited_depth(|r| {
53260                Ok(Self::ShortHashSeed(Box::new(ShortHashSeed::read_xdr(r)?)))
53261            }),
53262            TypeVariant::BinaryFuseFilterType => r.with_limited_depth(|r| {
53263                Ok(Self::BinaryFuseFilterType(Box::new(
53264                    BinaryFuseFilterType::read_xdr(r)?,
53265                )))
53266            }),
53267            TypeVariant::SerializedBinaryFuseFilter => r.with_limited_depth(|r| {
53268                Ok(Self::SerializedBinaryFuseFilter(Box::new(
53269                    SerializedBinaryFuseFilter::read_xdr(r)?,
53270                )))
53271            }),
53272        }
53273    }
53274
53275    #[cfg(feature = "base64")]
53276    pub fn read_xdr_base64<R: Read>(v: TypeVariant, r: &mut Limited<R>) -> Result<Self> {
53277        let mut dec = Limited::new(
53278            base64::read::DecoderReader::new(&mut r.inner, base64::STANDARD),
53279            r.limits.clone(),
53280        );
53281        let t = Self::read_xdr(v, &mut dec)?;
53282        Ok(t)
53283    }
53284
53285    #[cfg(feature = "std")]
53286    pub fn read_xdr_to_end<R: Read>(v: TypeVariant, r: &mut Limited<R>) -> Result<Self> {
53287        let s = Self::read_xdr(v, r)?;
53288        // Check that any further reads, such as this read of one byte, read no
53289        // data, indicating EOF. If a byte is read the data is invalid.
53290        if r.read(&mut [0u8; 1])? == 0 {
53291            Ok(s)
53292        } else {
53293            Err(Error::Invalid)
53294        }
53295    }
53296
53297    #[cfg(feature = "base64")]
53298    pub fn read_xdr_base64_to_end<R: Read>(v: TypeVariant, r: &mut Limited<R>) -> Result<Self> {
53299        let mut dec = Limited::new(
53300            base64::read::DecoderReader::new(&mut r.inner, base64::STANDARD),
53301            r.limits.clone(),
53302        );
53303        let t = Self::read_xdr_to_end(v, &mut dec)?;
53304        Ok(t)
53305    }
53306
53307    #[cfg(feature = "std")]
53308    #[allow(clippy::too_many_lines)]
53309    pub fn read_xdr_iter<R: Read>(
53310        v: TypeVariant,
53311        r: &mut Limited<R>,
53312    ) -> Box<dyn Iterator<Item = Result<Self>> + '_> {
53313        match v {
53314            TypeVariant::Value => Box::new(
53315                ReadXdrIter::<_, Value>::new(&mut r.inner, r.limits.clone())
53316                    .map(|r| r.map(|t| Self::Value(Box::new(t)))),
53317            ),
53318            TypeVariant::ScpBallot => Box::new(
53319                ReadXdrIter::<_, ScpBallot>::new(&mut r.inner, r.limits.clone())
53320                    .map(|r| r.map(|t| Self::ScpBallot(Box::new(t)))),
53321            ),
53322            TypeVariant::ScpStatementType => Box::new(
53323                ReadXdrIter::<_, ScpStatementType>::new(&mut r.inner, r.limits.clone())
53324                    .map(|r| r.map(|t| Self::ScpStatementType(Box::new(t)))),
53325            ),
53326            TypeVariant::ScpNomination => Box::new(
53327                ReadXdrIter::<_, ScpNomination>::new(&mut r.inner, r.limits.clone())
53328                    .map(|r| r.map(|t| Self::ScpNomination(Box::new(t)))),
53329            ),
53330            TypeVariant::ScpStatement => Box::new(
53331                ReadXdrIter::<_, ScpStatement>::new(&mut r.inner, r.limits.clone())
53332                    .map(|r| r.map(|t| Self::ScpStatement(Box::new(t)))),
53333            ),
53334            TypeVariant::ScpStatementPledges => Box::new(
53335                ReadXdrIter::<_, ScpStatementPledges>::new(&mut r.inner, r.limits.clone())
53336                    .map(|r| r.map(|t| Self::ScpStatementPledges(Box::new(t)))),
53337            ),
53338            TypeVariant::ScpStatementPrepare => Box::new(
53339                ReadXdrIter::<_, ScpStatementPrepare>::new(&mut r.inner, r.limits.clone())
53340                    .map(|r| r.map(|t| Self::ScpStatementPrepare(Box::new(t)))),
53341            ),
53342            TypeVariant::ScpStatementConfirm => Box::new(
53343                ReadXdrIter::<_, ScpStatementConfirm>::new(&mut r.inner, r.limits.clone())
53344                    .map(|r| r.map(|t| Self::ScpStatementConfirm(Box::new(t)))),
53345            ),
53346            TypeVariant::ScpStatementExternalize => Box::new(
53347                ReadXdrIter::<_, ScpStatementExternalize>::new(&mut r.inner, r.limits.clone())
53348                    .map(|r| r.map(|t| Self::ScpStatementExternalize(Box::new(t)))),
53349            ),
53350            TypeVariant::ScpEnvelope => Box::new(
53351                ReadXdrIter::<_, ScpEnvelope>::new(&mut r.inner, r.limits.clone())
53352                    .map(|r| r.map(|t| Self::ScpEnvelope(Box::new(t)))),
53353            ),
53354            TypeVariant::ScpQuorumSet => Box::new(
53355                ReadXdrIter::<_, ScpQuorumSet>::new(&mut r.inner, r.limits.clone())
53356                    .map(|r| r.map(|t| Self::ScpQuorumSet(Box::new(t)))),
53357            ),
53358            TypeVariant::ConfigSettingContractExecutionLanesV0 => Box::new(
53359                ReadXdrIter::<_, ConfigSettingContractExecutionLanesV0>::new(
53360                    &mut r.inner,
53361                    r.limits.clone(),
53362                )
53363                .map(|r| r.map(|t| Self::ConfigSettingContractExecutionLanesV0(Box::new(t)))),
53364            ),
53365            TypeVariant::ConfigSettingContractComputeV0 => Box::new(
53366                ReadXdrIter::<_, ConfigSettingContractComputeV0>::new(
53367                    &mut r.inner,
53368                    r.limits.clone(),
53369                )
53370                .map(|r| r.map(|t| Self::ConfigSettingContractComputeV0(Box::new(t)))),
53371            ),
53372            TypeVariant::ConfigSettingContractParallelComputeV0 => Box::new(
53373                ReadXdrIter::<_, ConfigSettingContractParallelComputeV0>::new(
53374                    &mut r.inner,
53375                    r.limits.clone(),
53376                )
53377                .map(|r| r.map(|t| Self::ConfigSettingContractParallelComputeV0(Box::new(t)))),
53378            ),
53379            TypeVariant::ConfigSettingContractLedgerCostV0 => Box::new(
53380                ReadXdrIter::<_, ConfigSettingContractLedgerCostV0>::new(
53381                    &mut r.inner,
53382                    r.limits.clone(),
53383                )
53384                .map(|r| r.map(|t| Self::ConfigSettingContractLedgerCostV0(Box::new(t)))),
53385            ),
53386            TypeVariant::ConfigSettingContractHistoricalDataV0 => Box::new(
53387                ReadXdrIter::<_, ConfigSettingContractHistoricalDataV0>::new(
53388                    &mut r.inner,
53389                    r.limits.clone(),
53390                )
53391                .map(|r| r.map(|t| Self::ConfigSettingContractHistoricalDataV0(Box::new(t)))),
53392            ),
53393            TypeVariant::ConfigSettingContractEventsV0 => Box::new(
53394                ReadXdrIter::<_, ConfigSettingContractEventsV0>::new(
53395                    &mut r.inner,
53396                    r.limits.clone(),
53397                )
53398                .map(|r| r.map(|t| Self::ConfigSettingContractEventsV0(Box::new(t)))),
53399            ),
53400            TypeVariant::ConfigSettingContractBandwidthV0 => Box::new(
53401                ReadXdrIter::<_, ConfigSettingContractBandwidthV0>::new(
53402                    &mut r.inner,
53403                    r.limits.clone(),
53404                )
53405                .map(|r| r.map(|t| Self::ConfigSettingContractBandwidthV0(Box::new(t)))),
53406            ),
53407            TypeVariant::ContractCostType => Box::new(
53408                ReadXdrIter::<_, ContractCostType>::new(&mut r.inner, r.limits.clone())
53409                    .map(|r| r.map(|t| Self::ContractCostType(Box::new(t)))),
53410            ),
53411            TypeVariant::ContractCostParamEntry => Box::new(
53412                ReadXdrIter::<_, ContractCostParamEntry>::new(&mut r.inner, r.limits.clone())
53413                    .map(|r| r.map(|t| Self::ContractCostParamEntry(Box::new(t)))),
53414            ),
53415            TypeVariant::StateArchivalSettings => Box::new(
53416                ReadXdrIter::<_, StateArchivalSettings>::new(&mut r.inner, r.limits.clone())
53417                    .map(|r| r.map(|t| Self::StateArchivalSettings(Box::new(t)))),
53418            ),
53419            TypeVariant::EvictionIterator => Box::new(
53420                ReadXdrIter::<_, EvictionIterator>::new(&mut r.inner, r.limits.clone())
53421                    .map(|r| r.map(|t| Self::EvictionIterator(Box::new(t)))),
53422            ),
53423            TypeVariant::ContractCostParams => Box::new(
53424                ReadXdrIter::<_, ContractCostParams>::new(&mut r.inner, r.limits.clone())
53425                    .map(|r| r.map(|t| Self::ContractCostParams(Box::new(t)))),
53426            ),
53427            TypeVariant::ConfigSettingId => Box::new(
53428                ReadXdrIter::<_, ConfigSettingId>::new(&mut r.inner, r.limits.clone())
53429                    .map(|r| r.map(|t| Self::ConfigSettingId(Box::new(t)))),
53430            ),
53431            TypeVariant::ConfigSettingEntry => Box::new(
53432                ReadXdrIter::<_, ConfigSettingEntry>::new(&mut r.inner, r.limits.clone())
53433                    .map(|r| r.map(|t| Self::ConfigSettingEntry(Box::new(t)))),
53434            ),
53435            TypeVariant::ScEnvMetaKind => Box::new(
53436                ReadXdrIter::<_, ScEnvMetaKind>::new(&mut r.inner, r.limits.clone())
53437                    .map(|r| r.map(|t| Self::ScEnvMetaKind(Box::new(t)))),
53438            ),
53439            TypeVariant::ScEnvMetaEntry => Box::new(
53440                ReadXdrIter::<_, ScEnvMetaEntry>::new(&mut r.inner, r.limits.clone())
53441                    .map(|r| r.map(|t| Self::ScEnvMetaEntry(Box::new(t)))),
53442            ),
53443            TypeVariant::ScEnvMetaEntryInterfaceVersion => Box::new(
53444                ReadXdrIter::<_, ScEnvMetaEntryInterfaceVersion>::new(
53445                    &mut r.inner,
53446                    r.limits.clone(),
53447                )
53448                .map(|r| r.map(|t| Self::ScEnvMetaEntryInterfaceVersion(Box::new(t)))),
53449            ),
53450            TypeVariant::ScMetaV0 => Box::new(
53451                ReadXdrIter::<_, ScMetaV0>::new(&mut r.inner, r.limits.clone())
53452                    .map(|r| r.map(|t| Self::ScMetaV0(Box::new(t)))),
53453            ),
53454            TypeVariant::ScMetaKind => Box::new(
53455                ReadXdrIter::<_, ScMetaKind>::new(&mut r.inner, r.limits.clone())
53456                    .map(|r| r.map(|t| Self::ScMetaKind(Box::new(t)))),
53457            ),
53458            TypeVariant::ScMetaEntry => Box::new(
53459                ReadXdrIter::<_, ScMetaEntry>::new(&mut r.inner, r.limits.clone())
53460                    .map(|r| r.map(|t| Self::ScMetaEntry(Box::new(t)))),
53461            ),
53462            TypeVariant::ScSpecType => Box::new(
53463                ReadXdrIter::<_, ScSpecType>::new(&mut r.inner, r.limits.clone())
53464                    .map(|r| r.map(|t| Self::ScSpecType(Box::new(t)))),
53465            ),
53466            TypeVariant::ScSpecTypeOption => Box::new(
53467                ReadXdrIter::<_, ScSpecTypeOption>::new(&mut r.inner, r.limits.clone())
53468                    .map(|r| r.map(|t| Self::ScSpecTypeOption(Box::new(t)))),
53469            ),
53470            TypeVariant::ScSpecTypeResult => Box::new(
53471                ReadXdrIter::<_, ScSpecTypeResult>::new(&mut r.inner, r.limits.clone())
53472                    .map(|r| r.map(|t| Self::ScSpecTypeResult(Box::new(t)))),
53473            ),
53474            TypeVariant::ScSpecTypeVec => Box::new(
53475                ReadXdrIter::<_, ScSpecTypeVec>::new(&mut r.inner, r.limits.clone())
53476                    .map(|r| r.map(|t| Self::ScSpecTypeVec(Box::new(t)))),
53477            ),
53478            TypeVariant::ScSpecTypeMap => Box::new(
53479                ReadXdrIter::<_, ScSpecTypeMap>::new(&mut r.inner, r.limits.clone())
53480                    .map(|r| r.map(|t| Self::ScSpecTypeMap(Box::new(t)))),
53481            ),
53482            TypeVariant::ScSpecTypeTuple => Box::new(
53483                ReadXdrIter::<_, ScSpecTypeTuple>::new(&mut r.inner, r.limits.clone())
53484                    .map(|r| r.map(|t| Self::ScSpecTypeTuple(Box::new(t)))),
53485            ),
53486            TypeVariant::ScSpecTypeBytesN => Box::new(
53487                ReadXdrIter::<_, ScSpecTypeBytesN>::new(&mut r.inner, r.limits.clone())
53488                    .map(|r| r.map(|t| Self::ScSpecTypeBytesN(Box::new(t)))),
53489            ),
53490            TypeVariant::ScSpecTypeUdt => Box::new(
53491                ReadXdrIter::<_, ScSpecTypeUdt>::new(&mut r.inner, r.limits.clone())
53492                    .map(|r| r.map(|t| Self::ScSpecTypeUdt(Box::new(t)))),
53493            ),
53494            TypeVariant::ScSpecTypeDef => Box::new(
53495                ReadXdrIter::<_, ScSpecTypeDef>::new(&mut r.inner, r.limits.clone())
53496                    .map(|r| r.map(|t| Self::ScSpecTypeDef(Box::new(t)))),
53497            ),
53498            TypeVariant::ScSpecUdtStructFieldV0 => Box::new(
53499                ReadXdrIter::<_, ScSpecUdtStructFieldV0>::new(&mut r.inner, r.limits.clone())
53500                    .map(|r| r.map(|t| Self::ScSpecUdtStructFieldV0(Box::new(t)))),
53501            ),
53502            TypeVariant::ScSpecUdtStructV0 => Box::new(
53503                ReadXdrIter::<_, ScSpecUdtStructV0>::new(&mut r.inner, r.limits.clone())
53504                    .map(|r| r.map(|t| Self::ScSpecUdtStructV0(Box::new(t)))),
53505            ),
53506            TypeVariant::ScSpecUdtUnionCaseVoidV0 => Box::new(
53507                ReadXdrIter::<_, ScSpecUdtUnionCaseVoidV0>::new(&mut r.inner, r.limits.clone())
53508                    .map(|r| r.map(|t| Self::ScSpecUdtUnionCaseVoidV0(Box::new(t)))),
53509            ),
53510            TypeVariant::ScSpecUdtUnionCaseTupleV0 => Box::new(
53511                ReadXdrIter::<_, ScSpecUdtUnionCaseTupleV0>::new(&mut r.inner, r.limits.clone())
53512                    .map(|r| r.map(|t| Self::ScSpecUdtUnionCaseTupleV0(Box::new(t)))),
53513            ),
53514            TypeVariant::ScSpecUdtUnionCaseV0Kind => Box::new(
53515                ReadXdrIter::<_, ScSpecUdtUnionCaseV0Kind>::new(&mut r.inner, r.limits.clone())
53516                    .map(|r| r.map(|t| Self::ScSpecUdtUnionCaseV0Kind(Box::new(t)))),
53517            ),
53518            TypeVariant::ScSpecUdtUnionCaseV0 => Box::new(
53519                ReadXdrIter::<_, ScSpecUdtUnionCaseV0>::new(&mut r.inner, r.limits.clone())
53520                    .map(|r| r.map(|t| Self::ScSpecUdtUnionCaseV0(Box::new(t)))),
53521            ),
53522            TypeVariant::ScSpecUdtUnionV0 => Box::new(
53523                ReadXdrIter::<_, ScSpecUdtUnionV0>::new(&mut r.inner, r.limits.clone())
53524                    .map(|r| r.map(|t| Self::ScSpecUdtUnionV0(Box::new(t)))),
53525            ),
53526            TypeVariant::ScSpecUdtEnumCaseV0 => Box::new(
53527                ReadXdrIter::<_, ScSpecUdtEnumCaseV0>::new(&mut r.inner, r.limits.clone())
53528                    .map(|r| r.map(|t| Self::ScSpecUdtEnumCaseV0(Box::new(t)))),
53529            ),
53530            TypeVariant::ScSpecUdtEnumV0 => Box::new(
53531                ReadXdrIter::<_, ScSpecUdtEnumV0>::new(&mut r.inner, r.limits.clone())
53532                    .map(|r| r.map(|t| Self::ScSpecUdtEnumV0(Box::new(t)))),
53533            ),
53534            TypeVariant::ScSpecUdtErrorEnumCaseV0 => Box::new(
53535                ReadXdrIter::<_, ScSpecUdtErrorEnumCaseV0>::new(&mut r.inner, r.limits.clone())
53536                    .map(|r| r.map(|t| Self::ScSpecUdtErrorEnumCaseV0(Box::new(t)))),
53537            ),
53538            TypeVariant::ScSpecUdtErrorEnumV0 => Box::new(
53539                ReadXdrIter::<_, ScSpecUdtErrorEnumV0>::new(&mut r.inner, r.limits.clone())
53540                    .map(|r| r.map(|t| Self::ScSpecUdtErrorEnumV0(Box::new(t)))),
53541            ),
53542            TypeVariant::ScSpecFunctionInputV0 => Box::new(
53543                ReadXdrIter::<_, ScSpecFunctionInputV0>::new(&mut r.inner, r.limits.clone())
53544                    .map(|r| r.map(|t| Self::ScSpecFunctionInputV0(Box::new(t)))),
53545            ),
53546            TypeVariant::ScSpecFunctionV0 => Box::new(
53547                ReadXdrIter::<_, ScSpecFunctionV0>::new(&mut r.inner, r.limits.clone())
53548                    .map(|r| r.map(|t| Self::ScSpecFunctionV0(Box::new(t)))),
53549            ),
53550            TypeVariant::ScSpecEntryKind => Box::new(
53551                ReadXdrIter::<_, ScSpecEntryKind>::new(&mut r.inner, r.limits.clone())
53552                    .map(|r| r.map(|t| Self::ScSpecEntryKind(Box::new(t)))),
53553            ),
53554            TypeVariant::ScSpecEntry => Box::new(
53555                ReadXdrIter::<_, ScSpecEntry>::new(&mut r.inner, r.limits.clone())
53556                    .map(|r| r.map(|t| Self::ScSpecEntry(Box::new(t)))),
53557            ),
53558            TypeVariant::ScValType => Box::new(
53559                ReadXdrIter::<_, ScValType>::new(&mut r.inner, r.limits.clone())
53560                    .map(|r| r.map(|t| Self::ScValType(Box::new(t)))),
53561            ),
53562            TypeVariant::ScErrorType => Box::new(
53563                ReadXdrIter::<_, ScErrorType>::new(&mut r.inner, r.limits.clone())
53564                    .map(|r| r.map(|t| Self::ScErrorType(Box::new(t)))),
53565            ),
53566            TypeVariant::ScErrorCode => Box::new(
53567                ReadXdrIter::<_, ScErrorCode>::new(&mut r.inner, r.limits.clone())
53568                    .map(|r| r.map(|t| Self::ScErrorCode(Box::new(t)))),
53569            ),
53570            TypeVariant::ScError => Box::new(
53571                ReadXdrIter::<_, ScError>::new(&mut r.inner, r.limits.clone())
53572                    .map(|r| r.map(|t| Self::ScError(Box::new(t)))),
53573            ),
53574            TypeVariant::UInt128Parts => Box::new(
53575                ReadXdrIter::<_, UInt128Parts>::new(&mut r.inner, r.limits.clone())
53576                    .map(|r| r.map(|t| Self::UInt128Parts(Box::new(t)))),
53577            ),
53578            TypeVariant::Int128Parts => Box::new(
53579                ReadXdrIter::<_, Int128Parts>::new(&mut r.inner, r.limits.clone())
53580                    .map(|r| r.map(|t| Self::Int128Parts(Box::new(t)))),
53581            ),
53582            TypeVariant::UInt256Parts => Box::new(
53583                ReadXdrIter::<_, UInt256Parts>::new(&mut r.inner, r.limits.clone())
53584                    .map(|r| r.map(|t| Self::UInt256Parts(Box::new(t)))),
53585            ),
53586            TypeVariant::Int256Parts => Box::new(
53587                ReadXdrIter::<_, Int256Parts>::new(&mut r.inner, r.limits.clone())
53588                    .map(|r| r.map(|t| Self::Int256Parts(Box::new(t)))),
53589            ),
53590            TypeVariant::ContractExecutableType => Box::new(
53591                ReadXdrIter::<_, ContractExecutableType>::new(&mut r.inner, r.limits.clone())
53592                    .map(|r| r.map(|t| Self::ContractExecutableType(Box::new(t)))),
53593            ),
53594            TypeVariant::ContractExecutable => Box::new(
53595                ReadXdrIter::<_, ContractExecutable>::new(&mut r.inner, r.limits.clone())
53596                    .map(|r| r.map(|t| Self::ContractExecutable(Box::new(t)))),
53597            ),
53598            TypeVariant::ScAddressType => Box::new(
53599                ReadXdrIter::<_, ScAddressType>::new(&mut r.inner, r.limits.clone())
53600                    .map(|r| r.map(|t| Self::ScAddressType(Box::new(t)))),
53601            ),
53602            TypeVariant::ScAddress => Box::new(
53603                ReadXdrIter::<_, ScAddress>::new(&mut r.inner, r.limits.clone())
53604                    .map(|r| r.map(|t| Self::ScAddress(Box::new(t)))),
53605            ),
53606            TypeVariant::ScVec => Box::new(
53607                ReadXdrIter::<_, ScVec>::new(&mut r.inner, r.limits.clone())
53608                    .map(|r| r.map(|t| Self::ScVec(Box::new(t)))),
53609            ),
53610            TypeVariant::ScMap => Box::new(
53611                ReadXdrIter::<_, ScMap>::new(&mut r.inner, r.limits.clone())
53612                    .map(|r| r.map(|t| Self::ScMap(Box::new(t)))),
53613            ),
53614            TypeVariant::ScBytes => Box::new(
53615                ReadXdrIter::<_, ScBytes>::new(&mut r.inner, r.limits.clone())
53616                    .map(|r| r.map(|t| Self::ScBytes(Box::new(t)))),
53617            ),
53618            TypeVariant::ScString => Box::new(
53619                ReadXdrIter::<_, ScString>::new(&mut r.inner, r.limits.clone())
53620                    .map(|r| r.map(|t| Self::ScString(Box::new(t)))),
53621            ),
53622            TypeVariant::ScSymbol => Box::new(
53623                ReadXdrIter::<_, ScSymbol>::new(&mut r.inner, r.limits.clone())
53624                    .map(|r| r.map(|t| Self::ScSymbol(Box::new(t)))),
53625            ),
53626            TypeVariant::ScNonceKey => Box::new(
53627                ReadXdrIter::<_, ScNonceKey>::new(&mut r.inner, r.limits.clone())
53628                    .map(|r| r.map(|t| Self::ScNonceKey(Box::new(t)))),
53629            ),
53630            TypeVariant::ScContractInstance => Box::new(
53631                ReadXdrIter::<_, ScContractInstance>::new(&mut r.inner, r.limits.clone())
53632                    .map(|r| r.map(|t| Self::ScContractInstance(Box::new(t)))),
53633            ),
53634            TypeVariant::ScVal => Box::new(
53635                ReadXdrIter::<_, ScVal>::new(&mut r.inner, r.limits.clone())
53636                    .map(|r| r.map(|t| Self::ScVal(Box::new(t)))),
53637            ),
53638            TypeVariant::ScMapEntry => Box::new(
53639                ReadXdrIter::<_, ScMapEntry>::new(&mut r.inner, r.limits.clone())
53640                    .map(|r| r.map(|t| Self::ScMapEntry(Box::new(t)))),
53641            ),
53642            TypeVariant::StoredTransactionSet => Box::new(
53643                ReadXdrIter::<_, StoredTransactionSet>::new(&mut r.inner, r.limits.clone())
53644                    .map(|r| r.map(|t| Self::StoredTransactionSet(Box::new(t)))),
53645            ),
53646            TypeVariant::StoredDebugTransactionSet => Box::new(
53647                ReadXdrIter::<_, StoredDebugTransactionSet>::new(&mut r.inner, r.limits.clone())
53648                    .map(|r| r.map(|t| Self::StoredDebugTransactionSet(Box::new(t)))),
53649            ),
53650            TypeVariant::PersistedScpStateV0 => Box::new(
53651                ReadXdrIter::<_, PersistedScpStateV0>::new(&mut r.inner, r.limits.clone())
53652                    .map(|r| r.map(|t| Self::PersistedScpStateV0(Box::new(t)))),
53653            ),
53654            TypeVariant::PersistedScpStateV1 => Box::new(
53655                ReadXdrIter::<_, PersistedScpStateV1>::new(&mut r.inner, r.limits.clone())
53656                    .map(|r| r.map(|t| Self::PersistedScpStateV1(Box::new(t)))),
53657            ),
53658            TypeVariant::PersistedScpState => Box::new(
53659                ReadXdrIter::<_, PersistedScpState>::new(&mut r.inner, r.limits.clone())
53660                    .map(|r| r.map(|t| Self::PersistedScpState(Box::new(t)))),
53661            ),
53662            TypeVariant::Thresholds => Box::new(
53663                ReadXdrIter::<_, Thresholds>::new(&mut r.inner, r.limits.clone())
53664                    .map(|r| r.map(|t| Self::Thresholds(Box::new(t)))),
53665            ),
53666            TypeVariant::String32 => Box::new(
53667                ReadXdrIter::<_, String32>::new(&mut r.inner, r.limits.clone())
53668                    .map(|r| r.map(|t| Self::String32(Box::new(t)))),
53669            ),
53670            TypeVariant::String64 => Box::new(
53671                ReadXdrIter::<_, String64>::new(&mut r.inner, r.limits.clone())
53672                    .map(|r| r.map(|t| Self::String64(Box::new(t)))),
53673            ),
53674            TypeVariant::SequenceNumber => Box::new(
53675                ReadXdrIter::<_, SequenceNumber>::new(&mut r.inner, r.limits.clone())
53676                    .map(|r| r.map(|t| Self::SequenceNumber(Box::new(t)))),
53677            ),
53678            TypeVariant::DataValue => Box::new(
53679                ReadXdrIter::<_, DataValue>::new(&mut r.inner, r.limits.clone())
53680                    .map(|r| r.map(|t| Self::DataValue(Box::new(t)))),
53681            ),
53682            TypeVariant::PoolId => Box::new(
53683                ReadXdrIter::<_, PoolId>::new(&mut r.inner, r.limits.clone())
53684                    .map(|r| r.map(|t| Self::PoolId(Box::new(t)))),
53685            ),
53686            TypeVariant::AssetCode4 => Box::new(
53687                ReadXdrIter::<_, AssetCode4>::new(&mut r.inner, r.limits.clone())
53688                    .map(|r| r.map(|t| Self::AssetCode4(Box::new(t)))),
53689            ),
53690            TypeVariant::AssetCode12 => Box::new(
53691                ReadXdrIter::<_, AssetCode12>::new(&mut r.inner, r.limits.clone())
53692                    .map(|r| r.map(|t| Self::AssetCode12(Box::new(t)))),
53693            ),
53694            TypeVariant::AssetType => Box::new(
53695                ReadXdrIter::<_, AssetType>::new(&mut r.inner, r.limits.clone())
53696                    .map(|r| r.map(|t| Self::AssetType(Box::new(t)))),
53697            ),
53698            TypeVariant::AssetCode => Box::new(
53699                ReadXdrIter::<_, AssetCode>::new(&mut r.inner, r.limits.clone())
53700                    .map(|r| r.map(|t| Self::AssetCode(Box::new(t)))),
53701            ),
53702            TypeVariant::AlphaNum4 => Box::new(
53703                ReadXdrIter::<_, AlphaNum4>::new(&mut r.inner, r.limits.clone())
53704                    .map(|r| r.map(|t| Self::AlphaNum4(Box::new(t)))),
53705            ),
53706            TypeVariant::AlphaNum12 => Box::new(
53707                ReadXdrIter::<_, AlphaNum12>::new(&mut r.inner, r.limits.clone())
53708                    .map(|r| r.map(|t| Self::AlphaNum12(Box::new(t)))),
53709            ),
53710            TypeVariant::Asset => Box::new(
53711                ReadXdrIter::<_, Asset>::new(&mut r.inner, r.limits.clone())
53712                    .map(|r| r.map(|t| Self::Asset(Box::new(t)))),
53713            ),
53714            TypeVariant::Price => Box::new(
53715                ReadXdrIter::<_, Price>::new(&mut r.inner, r.limits.clone())
53716                    .map(|r| r.map(|t| Self::Price(Box::new(t)))),
53717            ),
53718            TypeVariant::Liabilities => Box::new(
53719                ReadXdrIter::<_, Liabilities>::new(&mut r.inner, r.limits.clone())
53720                    .map(|r| r.map(|t| Self::Liabilities(Box::new(t)))),
53721            ),
53722            TypeVariant::ThresholdIndexes => Box::new(
53723                ReadXdrIter::<_, ThresholdIndexes>::new(&mut r.inner, r.limits.clone())
53724                    .map(|r| r.map(|t| Self::ThresholdIndexes(Box::new(t)))),
53725            ),
53726            TypeVariant::LedgerEntryType => Box::new(
53727                ReadXdrIter::<_, LedgerEntryType>::new(&mut r.inner, r.limits.clone())
53728                    .map(|r| r.map(|t| Self::LedgerEntryType(Box::new(t)))),
53729            ),
53730            TypeVariant::Signer => Box::new(
53731                ReadXdrIter::<_, Signer>::new(&mut r.inner, r.limits.clone())
53732                    .map(|r| r.map(|t| Self::Signer(Box::new(t)))),
53733            ),
53734            TypeVariant::AccountFlags => Box::new(
53735                ReadXdrIter::<_, AccountFlags>::new(&mut r.inner, r.limits.clone())
53736                    .map(|r| r.map(|t| Self::AccountFlags(Box::new(t)))),
53737            ),
53738            TypeVariant::SponsorshipDescriptor => Box::new(
53739                ReadXdrIter::<_, SponsorshipDescriptor>::new(&mut r.inner, r.limits.clone())
53740                    .map(|r| r.map(|t| Self::SponsorshipDescriptor(Box::new(t)))),
53741            ),
53742            TypeVariant::AccountEntryExtensionV3 => Box::new(
53743                ReadXdrIter::<_, AccountEntryExtensionV3>::new(&mut r.inner, r.limits.clone())
53744                    .map(|r| r.map(|t| Self::AccountEntryExtensionV3(Box::new(t)))),
53745            ),
53746            TypeVariant::AccountEntryExtensionV2 => Box::new(
53747                ReadXdrIter::<_, AccountEntryExtensionV2>::new(&mut r.inner, r.limits.clone())
53748                    .map(|r| r.map(|t| Self::AccountEntryExtensionV2(Box::new(t)))),
53749            ),
53750            TypeVariant::AccountEntryExtensionV2Ext => Box::new(
53751                ReadXdrIter::<_, AccountEntryExtensionV2Ext>::new(&mut r.inner, r.limits.clone())
53752                    .map(|r| r.map(|t| Self::AccountEntryExtensionV2Ext(Box::new(t)))),
53753            ),
53754            TypeVariant::AccountEntryExtensionV1 => Box::new(
53755                ReadXdrIter::<_, AccountEntryExtensionV1>::new(&mut r.inner, r.limits.clone())
53756                    .map(|r| r.map(|t| Self::AccountEntryExtensionV1(Box::new(t)))),
53757            ),
53758            TypeVariant::AccountEntryExtensionV1Ext => Box::new(
53759                ReadXdrIter::<_, AccountEntryExtensionV1Ext>::new(&mut r.inner, r.limits.clone())
53760                    .map(|r| r.map(|t| Self::AccountEntryExtensionV1Ext(Box::new(t)))),
53761            ),
53762            TypeVariant::AccountEntry => Box::new(
53763                ReadXdrIter::<_, AccountEntry>::new(&mut r.inner, r.limits.clone())
53764                    .map(|r| r.map(|t| Self::AccountEntry(Box::new(t)))),
53765            ),
53766            TypeVariant::AccountEntryExt => Box::new(
53767                ReadXdrIter::<_, AccountEntryExt>::new(&mut r.inner, r.limits.clone())
53768                    .map(|r| r.map(|t| Self::AccountEntryExt(Box::new(t)))),
53769            ),
53770            TypeVariant::TrustLineFlags => Box::new(
53771                ReadXdrIter::<_, TrustLineFlags>::new(&mut r.inner, r.limits.clone())
53772                    .map(|r| r.map(|t| Self::TrustLineFlags(Box::new(t)))),
53773            ),
53774            TypeVariant::LiquidityPoolType => Box::new(
53775                ReadXdrIter::<_, LiquidityPoolType>::new(&mut r.inner, r.limits.clone())
53776                    .map(|r| r.map(|t| Self::LiquidityPoolType(Box::new(t)))),
53777            ),
53778            TypeVariant::TrustLineAsset => Box::new(
53779                ReadXdrIter::<_, TrustLineAsset>::new(&mut r.inner, r.limits.clone())
53780                    .map(|r| r.map(|t| Self::TrustLineAsset(Box::new(t)))),
53781            ),
53782            TypeVariant::TrustLineEntryExtensionV2 => Box::new(
53783                ReadXdrIter::<_, TrustLineEntryExtensionV2>::new(&mut r.inner, r.limits.clone())
53784                    .map(|r| r.map(|t| Self::TrustLineEntryExtensionV2(Box::new(t)))),
53785            ),
53786            TypeVariant::TrustLineEntryExtensionV2Ext => Box::new(
53787                ReadXdrIter::<_, TrustLineEntryExtensionV2Ext>::new(&mut r.inner, r.limits.clone())
53788                    .map(|r| r.map(|t| Self::TrustLineEntryExtensionV2Ext(Box::new(t)))),
53789            ),
53790            TypeVariant::TrustLineEntry => Box::new(
53791                ReadXdrIter::<_, TrustLineEntry>::new(&mut r.inner, r.limits.clone())
53792                    .map(|r| r.map(|t| Self::TrustLineEntry(Box::new(t)))),
53793            ),
53794            TypeVariant::TrustLineEntryExt => Box::new(
53795                ReadXdrIter::<_, TrustLineEntryExt>::new(&mut r.inner, r.limits.clone())
53796                    .map(|r| r.map(|t| Self::TrustLineEntryExt(Box::new(t)))),
53797            ),
53798            TypeVariant::TrustLineEntryV1 => Box::new(
53799                ReadXdrIter::<_, TrustLineEntryV1>::new(&mut r.inner, r.limits.clone())
53800                    .map(|r| r.map(|t| Self::TrustLineEntryV1(Box::new(t)))),
53801            ),
53802            TypeVariant::TrustLineEntryV1Ext => Box::new(
53803                ReadXdrIter::<_, TrustLineEntryV1Ext>::new(&mut r.inner, r.limits.clone())
53804                    .map(|r| r.map(|t| Self::TrustLineEntryV1Ext(Box::new(t)))),
53805            ),
53806            TypeVariant::OfferEntryFlags => Box::new(
53807                ReadXdrIter::<_, OfferEntryFlags>::new(&mut r.inner, r.limits.clone())
53808                    .map(|r| r.map(|t| Self::OfferEntryFlags(Box::new(t)))),
53809            ),
53810            TypeVariant::OfferEntry => Box::new(
53811                ReadXdrIter::<_, OfferEntry>::new(&mut r.inner, r.limits.clone())
53812                    .map(|r| r.map(|t| Self::OfferEntry(Box::new(t)))),
53813            ),
53814            TypeVariant::OfferEntryExt => Box::new(
53815                ReadXdrIter::<_, OfferEntryExt>::new(&mut r.inner, r.limits.clone())
53816                    .map(|r| r.map(|t| Self::OfferEntryExt(Box::new(t)))),
53817            ),
53818            TypeVariant::DataEntry => Box::new(
53819                ReadXdrIter::<_, DataEntry>::new(&mut r.inner, r.limits.clone())
53820                    .map(|r| r.map(|t| Self::DataEntry(Box::new(t)))),
53821            ),
53822            TypeVariant::DataEntryExt => Box::new(
53823                ReadXdrIter::<_, DataEntryExt>::new(&mut r.inner, r.limits.clone())
53824                    .map(|r| r.map(|t| Self::DataEntryExt(Box::new(t)))),
53825            ),
53826            TypeVariant::ClaimPredicateType => Box::new(
53827                ReadXdrIter::<_, ClaimPredicateType>::new(&mut r.inner, r.limits.clone())
53828                    .map(|r| r.map(|t| Self::ClaimPredicateType(Box::new(t)))),
53829            ),
53830            TypeVariant::ClaimPredicate => Box::new(
53831                ReadXdrIter::<_, ClaimPredicate>::new(&mut r.inner, r.limits.clone())
53832                    .map(|r| r.map(|t| Self::ClaimPredicate(Box::new(t)))),
53833            ),
53834            TypeVariant::ClaimantType => Box::new(
53835                ReadXdrIter::<_, ClaimantType>::new(&mut r.inner, r.limits.clone())
53836                    .map(|r| r.map(|t| Self::ClaimantType(Box::new(t)))),
53837            ),
53838            TypeVariant::Claimant => Box::new(
53839                ReadXdrIter::<_, Claimant>::new(&mut r.inner, r.limits.clone())
53840                    .map(|r| r.map(|t| Self::Claimant(Box::new(t)))),
53841            ),
53842            TypeVariant::ClaimantV0 => Box::new(
53843                ReadXdrIter::<_, ClaimantV0>::new(&mut r.inner, r.limits.clone())
53844                    .map(|r| r.map(|t| Self::ClaimantV0(Box::new(t)))),
53845            ),
53846            TypeVariant::ClaimableBalanceIdType => Box::new(
53847                ReadXdrIter::<_, ClaimableBalanceIdType>::new(&mut r.inner, r.limits.clone())
53848                    .map(|r| r.map(|t| Self::ClaimableBalanceIdType(Box::new(t)))),
53849            ),
53850            TypeVariant::ClaimableBalanceId => Box::new(
53851                ReadXdrIter::<_, ClaimableBalanceId>::new(&mut r.inner, r.limits.clone())
53852                    .map(|r| r.map(|t| Self::ClaimableBalanceId(Box::new(t)))),
53853            ),
53854            TypeVariant::ClaimableBalanceFlags => Box::new(
53855                ReadXdrIter::<_, ClaimableBalanceFlags>::new(&mut r.inner, r.limits.clone())
53856                    .map(|r| r.map(|t| Self::ClaimableBalanceFlags(Box::new(t)))),
53857            ),
53858            TypeVariant::ClaimableBalanceEntryExtensionV1 => Box::new(
53859                ReadXdrIter::<_, ClaimableBalanceEntryExtensionV1>::new(
53860                    &mut r.inner,
53861                    r.limits.clone(),
53862                )
53863                .map(|r| r.map(|t| Self::ClaimableBalanceEntryExtensionV1(Box::new(t)))),
53864            ),
53865            TypeVariant::ClaimableBalanceEntryExtensionV1Ext => Box::new(
53866                ReadXdrIter::<_, ClaimableBalanceEntryExtensionV1Ext>::new(
53867                    &mut r.inner,
53868                    r.limits.clone(),
53869                )
53870                .map(|r| r.map(|t| Self::ClaimableBalanceEntryExtensionV1Ext(Box::new(t)))),
53871            ),
53872            TypeVariant::ClaimableBalanceEntry => Box::new(
53873                ReadXdrIter::<_, ClaimableBalanceEntry>::new(&mut r.inner, r.limits.clone())
53874                    .map(|r| r.map(|t| Self::ClaimableBalanceEntry(Box::new(t)))),
53875            ),
53876            TypeVariant::ClaimableBalanceEntryExt => Box::new(
53877                ReadXdrIter::<_, ClaimableBalanceEntryExt>::new(&mut r.inner, r.limits.clone())
53878                    .map(|r| r.map(|t| Self::ClaimableBalanceEntryExt(Box::new(t)))),
53879            ),
53880            TypeVariant::LiquidityPoolConstantProductParameters => Box::new(
53881                ReadXdrIter::<_, LiquidityPoolConstantProductParameters>::new(
53882                    &mut r.inner,
53883                    r.limits.clone(),
53884                )
53885                .map(|r| r.map(|t| Self::LiquidityPoolConstantProductParameters(Box::new(t)))),
53886            ),
53887            TypeVariant::LiquidityPoolEntry => Box::new(
53888                ReadXdrIter::<_, LiquidityPoolEntry>::new(&mut r.inner, r.limits.clone())
53889                    .map(|r| r.map(|t| Self::LiquidityPoolEntry(Box::new(t)))),
53890            ),
53891            TypeVariant::LiquidityPoolEntryBody => Box::new(
53892                ReadXdrIter::<_, LiquidityPoolEntryBody>::new(&mut r.inner, r.limits.clone())
53893                    .map(|r| r.map(|t| Self::LiquidityPoolEntryBody(Box::new(t)))),
53894            ),
53895            TypeVariant::LiquidityPoolEntryConstantProduct => Box::new(
53896                ReadXdrIter::<_, LiquidityPoolEntryConstantProduct>::new(
53897                    &mut r.inner,
53898                    r.limits.clone(),
53899                )
53900                .map(|r| r.map(|t| Self::LiquidityPoolEntryConstantProduct(Box::new(t)))),
53901            ),
53902            TypeVariant::ContractDataDurability => Box::new(
53903                ReadXdrIter::<_, ContractDataDurability>::new(&mut r.inner, r.limits.clone())
53904                    .map(|r| r.map(|t| Self::ContractDataDurability(Box::new(t)))),
53905            ),
53906            TypeVariant::ContractDataEntry => Box::new(
53907                ReadXdrIter::<_, ContractDataEntry>::new(&mut r.inner, r.limits.clone())
53908                    .map(|r| r.map(|t| Self::ContractDataEntry(Box::new(t)))),
53909            ),
53910            TypeVariant::ContractCodeCostInputs => Box::new(
53911                ReadXdrIter::<_, ContractCodeCostInputs>::new(&mut r.inner, r.limits.clone())
53912                    .map(|r| r.map(|t| Self::ContractCodeCostInputs(Box::new(t)))),
53913            ),
53914            TypeVariant::ContractCodeEntry => Box::new(
53915                ReadXdrIter::<_, ContractCodeEntry>::new(&mut r.inner, r.limits.clone())
53916                    .map(|r| r.map(|t| Self::ContractCodeEntry(Box::new(t)))),
53917            ),
53918            TypeVariant::ContractCodeEntryExt => Box::new(
53919                ReadXdrIter::<_, ContractCodeEntryExt>::new(&mut r.inner, r.limits.clone())
53920                    .map(|r| r.map(|t| Self::ContractCodeEntryExt(Box::new(t)))),
53921            ),
53922            TypeVariant::ContractCodeEntryV1 => Box::new(
53923                ReadXdrIter::<_, ContractCodeEntryV1>::new(&mut r.inner, r.limits.clone())
53924                    .map(|r| r.map(|t| Self::ContractCodeEntryV1(Box::new(t)))),
53925            ),
53926            TypeVariant::TtlEntry => Box::new(
53927                ReadXdrIter::<_, TtlEntry>::new(&mut r.inner, r.limits.clone())
53928                    .map(|r| r.map(|t| Self::TtlEntry(Box::new(t)))),
53929            ),
53930            TypeVariant::LedgerEntryExtensionV1 => Box::new(
53931                ReadXdrIter::<_, LedgerEntryExtensionV1>::new(&mut r.inner, r.limits.clone())
53932                    .map(|r| r.map(|t| Self::LedgerEntryExtensionV1(Box::new(t)))),
53933            ),
53934            TypeVariant::LedgerEntryExtensionV1Ext => Box::new(
53935                ReadXdrIter::<_, LedgerEntryExtensionV1Ext>::new(&mut r.inner, r.limits.clone())
53936                    .map(|r| r.map(|t| Self::LedgerEntryExtensionV1Ext(Box::new(t)))),
53937            ),
53938            TypeVariant::LedgerEntry => Box::new(
53939                ReadXdrIter::<_, LedgerEntry>::new(&mut r.inner, r.limits.clone())
53940                    .map(|r| r.map(|t| Self::LedgerEntry(Box::new(t)))),
53941            ),
53942            TypeVariant::LedgerEntryData => Box::new(
53943                ReadXdrIter::<_, LedgerEntryData>::new(&mut r.inner, r.limits.clone())
53944                    .map(|r| r.map(|t| Self::LedgerEntryData(Box::new(t)))),
53945            ),
53946            TypeVariant::LedgerEntryExt => Box::new(
53947                ReadXdrIter::<_, LedgerEntryExt>::new(&mut r.inner, r.limits.clone())
53948                    .map(|r| r.map(|t| Self::LedgerEntryExt(Box::new(t)))),
53949            ),
53950            TypeVariant::LedgerKey => Box::new(
53951                ReadXdrIter::<_, LedgerKey>::new(&mut r.inner, r.limits.clone())
53952                    .map(|r| r.map(|t| Self::LedgerKey(Box::new(t)))),
53953            ),
53954            TypeVariant::LedgerKeyAccount => Box::new(
53955                ReadXdrIter::<_, LedgerKeyAccount>::new(&mut r.inner, r.limits.clone())
53956                    .map(|r| r.map(|t| Self::LedgerKeyAccount(Box::new(t)))),
53957            ),
53958            TypeVariant::LedgerKeyTrustLine => Box::new(
53959                ReadXdrIter::<_, LedgerKeyTrustLine>::new(&mut r.inner, r.limits.clone())
53960                    .map(|r| r.map(|t| Self::LedgerKeyTrustLine(Box::new(t)))),
53961            ),
53962            TypeVariant::LedgerKeyOffer => Box::new(
53963                ReadXdrIter::<_, LedgerKeyOffer>::new(&mut r.inner, r.limits.clone())
53964                    .map(|r| r.map(|t| Self::LedgerKeyOffer(Box::new(t)))),
53965            ),
53966            TypeVariant::LedgerKeyData => Box::new(
53967                ReadXdrIter::<_, LedgerKeyData>::new(&mut r.inner, r.limits.clone())
53968                    .map(|r| r.map(|t| Self::LedgerKeyData(Box::new(t)))),
53969            ),
53970            TypeVariant::LedgerKeyClaimableBalance => Box::new(
53971                ReadXdrIter::<_, LedgerKeyClaimableBalance>::new(&mut r.inner, r.limits.clone())
53972                    .map(|r| r.map(|t| Self::LedgerKeyClaimableBalance(Box::new(t)))),
53973            ),
53974            TypeVariant::LedgerKeyLiquidityPool => Box::new(
53975                ReadXdrIter::<_, LedgerKeyLiquidityPool>::new(&mut r.inner, r.limits.clone())
53976                    .map(|r| r.map(|t| Self::LedgerKeyLiquidityPool(Box::new(t)))),
53977            ),
53978            TypeVariant::LedgerKeyContractData => Box::new(
53979                ReadXdrIter::<_, LedgerKeyContractData>::new(&mut r.inner, r.limits.clone())
53980                    .map(|r| r.map(|t| Self::LedgerKeyContractData(Box::new(t)))),
53981            ),
53982            TypeVariant::LedgerKeyContractCode => Box::new(
53983                ReadXdrIter::<_, LedgerKeyContractCode>::new(&mut r.inner, r.limits.clone())
53984                    .map(|r| r.map(|t| Self::LedgerKeyContractCode(Box::new(t)))),
53985            ),
53986            TypeVariant::LedgerKeyConfigSetting => Box::new(
53987                ReadXdrIter::<_, LedgerKeyConfigSetting>::new(&mut r.inner, r.limits.clone())
53988                    .map(|r| r.map(|t| Self::LedgerKeyConfigSetting(Box::new(t)))),
53989            ),
53990            TypeVariant::LedgerKeyTtl => Box::new(
53991                ReadXdrIter::<_, LedgerKeyTtl>::new(&mut r.inner, r.limits.clone())
53992                    .map(|r| r.map(|t| Self::LedgerKeyTtl(Box::new(t)))),
53993            ),
53994            TypeVariant::EnvelopeType => Box::new(
53995                ReadXdrIter::<_, EnvelopeType>::new(&mut r.inner, r.limits.clone())
53996                    .map(|r| r.map(|t| Self::EnvelopeType(Box::new(t)))),
53997            ),
53998            TypeVariant::BucketListType => Box::new(
53999                ReadXdrIter::<_, BucketListType>::new(&mut r.inner, r.limits.clone())
54000                    .map(|r| r.map(|t| Self::BucketListType(Box::new(t)))),
54001            ),
54002            TypeVariant::BucketEntryType => Box::new(
54003                ReadXdrIter::<_, BucketEntryType>::new(&mut r.inner, r.limits.clone())
54004                    .map(|r| r.map(|t| Self::BucketEntryType(Box::new(t)))),
54005            ),
54006            TypeVariant::HotArchiveBucketEntryType => Box::new(
54007                ReadXdrIter::<_, HotArchiveBucketEntryType>::new(&mut r.inner, r.limits.clone())
54008                    .map(|r| r.map(|t| Self::HotArchiveBucketEntryType(Box::new(t)))),
54009            ),
54010            TypeVariant::ColdArchiveBucketEntryType => Box::new(
54011                ReadXdrIter::<_, ColdArchiveBucketEntryType>::new(&mut r.inner, r.limits.clone())
54012                    .map(|r| r.map(|t| Self::ColdArchiveBucketEntryType(Box::new(t)))),
54013            ),
54014            TypeVariant::BucketMetadata => Box::new(
54015                ReadXdrIter::<_, BucketMetadata>::new(&mut r.inner, r.limits.clone())
54016                    .map(|r| r.map(|t| Self::BucketMetadata(Box::new(t)))),
54017            ),
54018            TypeVariant::BucketMetadataExt => Box::new(
54019                ReadXdrIter::<_, BucketMetadataExt>::new(&mut r.inner, r.limits.clone())
54020                    .map(|r| r.map(|t| Self::BucketMetadataExt(Box::new(t)))),
54021            ),
54022            TypeVariant::BucketEntry => Box::new(
54023                ReadXdrIter::<_, BucketEntry>::new(&mut r.inner, r.limits.clone())
54024                    .map(|r| r.map(|t| Self::BucketEntry(Box::new(t)))),
54025            ),
54026            TypeVariant::HotArchiveBucketEntry => Box::new(
54027                ReadXdrIter::<_, HotArchiveBucketEntry>::new(&mut r.inner, r.limits.clone())
54028                    .map(|r| r.map(|t| Self::HotArchiveBucketEntry(Box::new(t)))),
54029            ),
54030            TypeVariant::ColdArchiveArchivedLeaf => Box::new(
54031                ReadXdrIter::<_, ColdArchiveArchivedLeaf>::new(&mut r.inner, r.limits.clone())
54032                    .map(|r| r.map(|t| Self::ColdArchiveArchivedLeaf(Box::new(t)))),
54033            ),
54034            TypeVariant::ColdArchiveDeletedLeaf => Box::new(
54035                ReadXdrIter::<_, ColdArchiveDeletedLeaf>::new(&mut r.inner, r.limits.clone())
54036                    .map(|r| r.map(|t| Self::ColdArchiveDeletedLeaf(Box::new(t)))),
54037            ),
54038            TypeVariant::ColdArchiveBoundaryLeaf => Box::new(
54039                ReadXdrIter::<_, ColdArchiveBoundaryLeaf>::new(&mut r.inner, r.limits.clone())
54040                    .map(|r| r.map(|t| Self::ColdArchiveBoundaryLeaf(Box::new(t)))),
54041            ),
54042            TypeVariant::ColdArchiveHashEntry => Box::new(
54043                ReadXdrIter::<_, ColdArchiveHashEntry>::new(&mut r.inner, r.limits.clone())
54044                    .map(|r| r.map(|t| Self::ColdArchiveHashEntry(Box::new(t)))),
54045            ),
54046            TypeVariant::ColdArchiveBucketEntry => Box::new(
54047                ReadXdrIter::<_, ColdArchiveBucketEntry>::new(&mut r.inner, r.limits.clone())
54048                    .map(|r| r.map(|t| Self::ColdArchiveBucketEntry(Box::new(t)))),
54049            ),
54050            TypeVariant::UpgradeType => Box::new(
54051                ReadXdrIter::<_, UpgradeType>::new(&mut r.inner, r.limits.clone())
54052                    .map(|r| r.map(|t| Self::UpgradeType(Box::new(t)))),
54053            ),
54054            TypeVariant::StellarValueType => Box::new(
54055                ReadXdrIter::<_, StellarValueType>::new(&mut r.inner, r.limits.clone())
54056                    .map(|r| r.map(|t| Self::StellarValueType(Box::new(t)))),
54057            ),
54058            TypeVariant::LedgerCloseValueSignature => Box::new(
54059                ReadXdrIter::<_, LedgerCloseValueSignature>::new(&mut r.inner, r.limits.clone())
54060                    .map(|r| r.map(|t| Self::LedgerCloseValueSignature(Box::new(t)))),
54061            ),
54062            TypeVariant::StellarValue => Box::new(
54063                ReadXdrIter::<_, StellarValue>::new(&mut r.inner, r.limits.clone())
54064                    .map(|r| r.map(|t| Self::StellarValue(Box::new(t)))),
54065            ),
54066            TypeVariant::StellarValueExt => Box::new(
54067                ReadXdrIter::<_, StellarValueExt>::new(&mut r.inner, r.limits.clone())
54068                    .map(|r| r.map(|t| Self::StellarValueExt(Box::new(t)))),
54069            ),
54070            TypeVariant::LedgerHeaderFlags => Box::new(
54071                ReadXdrIter::<_, LedgerHeaderFlags>::new(&mut r.inner, r.limits.clone())
54072                    .map(|r| r.map(|t| Self::LedgerHeaderFlags(Box::new(t)))),
54073            ),
54074            TypeVariant::LedgerHeaderExtensionV1 => Box::new(
54075                ReadXdrIter::<_, LedgerHeaderExtensionV1>::new(&mut r.inner, r.limits.clone())
54076                    .map(|r| r.map(|t| Self::LedgerHeaderExtensionV1(Box::new(t)))),
54077            ),
54078            TypeVariant::LedgerHeaderExtensionV1Ext => Box::new(
54079                ReadXdrIter::<_, LedgerHeaderExtensionV1Ext>::new(&mut r.inner, r.limits.clone())
54080                    .map(|r| r.map(|t| Self::LedgerHeaderExtensionV1Ext(Box::new(t)))),
54081            ),
54082            TypeVariant::LedgerHeader => Box::new(
54083                ReadXdrIter::<_, LedgerHeader>::new(&mut r.inner, r.limits.clone())
54084                    .map(|r| r.map(|t| Self::LedgerHeader(Box::new(t)))),
54085            ),
54086            TypeVariant::LedgerHeaderExt => Box::new(
54087                ReadXdrIter::<_, LedgerHeaderExt>::new(&mut r.inner, r.limits.clone())
54088                    .map(|r| r.map(|t| Self::LedgerHeaderExt(Box::new(t)))),
54089            ),
54090            TypeVariant::LedgerUpgradeType => Box::new(
54091                ReadXdrIter::<_, LedgerUpgradeType>::new(&mut r.inner, r.limits.clone())
54092                    .map(|r| r.map(|t| Self::LedgerUpgradeType(Box::new(t)))),
54093            ),
54094            TypeVariant::ConfigUpgradeSetKey => Box::new(
54095                ReadXdrIter::<_, ConfigUpgradeSetKey>::new(&mut r.inner, r.limits.clone())
54096                    .map(|r| r.map(|t| Self::ConfigUpgradeSetKey(Box::new(t)))),
54097            ),
54098            TypeVariant::LedgerUpgrade => Box::new(
54099                ReadXdrIter::<_, LedgerUpgrade>::new(&mut r.inner, r.limits.clone())
54100                    .map(|r| r.map(|t| Self::LedgerUpgrade(Box::new(t)))),
54101            ),
54102            TypeVariant::ConfigUpgradeSet => Box::new(
54103                ReadXdrIter::<_, ConfigUpgradeSet>::new(&mut r.inner, r.limits.clone())
54104                    .map(|r| r.map(|t| Self::ConfigUpgradeSet(Box::new(t)))),
54105            ),
54106            TypeVariant::TxSetComponentType => Box::new(
54107                ReadXdrIter::<_, TxSetComponentType>::new(&mut r.inner, r.limits.clone())
54108                    .map(|r| r.map(|t| Self::TxSetComponentType(Box::new(t)))),
54109            ),
54110            TypeVariant::TxExecutionThread => Box::new(
54111                ReadXdrIter::<_, TxExecutionThread>::new(&mut r.inner, r.limits.clone())
54112                    .map(|r| r.map(|t| Self::TxExecutionThread(Box::new(t)))),
54113            ),
54114            TypeVariant::ParallelTxExecutionStage => Box::new(
54115                ReadXdrIter::<_, ParallelTxExecutionStage>::new(&mut r.inner, r.limits.clone())
54116                    .map(|r| r.map(|t| Self::ParallelTxExecutionStage(Box::new(t)))),
54117            ),
54118            TypeVariant::ParallelTxsComponent => Box::new(
54119                ReadXdrIter::<_, ParallelTxsComponent>::new(&mut r.inner, r.limits.clone())
54120                    .map(|r| r.map(|t| Self::ParallelTxsComponent(Box::new(t)))),
54121            ),
54122            TypeVariant::TxSetComponent => Box::new(
54123                ReadXdrIter::<_, TxSetComponent>::new(&mut r.inner, r.limits.clone())
54124                    .map(|r| r.map(|t| Self::TxSetComponent(Box::new(t)))),
54125            ),
54126            TypeVariant::TxSetComponentTxsMaybeDiscountedFee => Box::new(
54127                ReadXdrIter::<_, TxSetComponentTxsMaybeDiscountedFee>::new(
54128                    &mut r.inner,
54129                    r.limits.clone(),
54130                )
54131                .map(|r| r.map(|t| Self::TxSetComponentTxsMaybeDiscountedFee(Box::new(t)))),
54132            ),
54133            TypeVariant::TransactionPhase => Box::new(
54134                ReadXdrIter::<_, TransactionPhase>::new(&mut r.inner, r.limits.clone())
54135                    .map(|r| r.map(|t| Self::TransactionPhase(Box::new(t)))),
54136            ),
54137            TypeVariant::TransactionSet => Box::new(
54138                ReadXdrIter::<_, TransactionSet>::new(&mut r.inner, r.limits.clone())
54139                    .map(|r| r.map(|t| Self::TransactionSet(Box::new(t)))),
54140            ),
54141            TypeVariant::TransactionSetV1 => Box::new(
54142                ReadXdrIter::<_, TransactionSetV1>::new(&mut r.inner, r.limits.clone())
54143                    .map(|r| r.map(|t| Self::TransactionSetV1(Box::new(t)))),
54144            ),
54145            TypeVariant::GeneralizedTransactionSet => Box::new(
54146                ReadXdrIter::<_, GeneralizedTransactionSet>::new(&mut r.inner, r.limits.clone())
54147                    .map(|r| r.map(|t| Self::GeneralizedTransactionSet(Box::new(t)))),
54148            ),
54149            TypeVariant::TransactionResultPair => Box::new(
54150                ReadXdrIter::<_, TransactionResultPair>::new(&mut r.inner, r.limits.clone())
54151                    .map(|r| r.map(|t| Self::TransactionResultPair(Box::new(t)))),
54152            ),
54153            TypeVariant::TransactionResultSet => Box::new(
54154                ReadXdrIter::<_, TransactionResultSet>::new(&mut r.inner, r.limits.clone())
54155                    .map(|r| r.map(|t| Self::TransactionResultSet(Box::new(t)))),
54156            ),
54157            TypeVariant::TransactionHistoryEntry => Box::new(
54158                ReadXdrIter::<_, TransactionHistoryEntry>::new(&mut r.inner, r.limits.clone())
54159                    .map(|r| r.map(|t| Self::TransactionHistoryEntry(Box::new(t)))),
54160            ),
54161            TypeVariant::TransactionHistoryEntryExt => Box::new(
54162                ReadXdrIter::<_, TransactionHistoryEntryExt>::new(&mut r.inner, r.limits.clone())
54163                    .map(|r| r.map(|t| Self::TransactionHistoryEntryExt(Box::new(t)))),
54164            ),
54165            TypeVariant::TransactionHistoryResultEntry => Box::new(
54166                ReadXdrIter::<_, TransactionHistoryResultEntry>::new(
54167                    &mut r.inner,
54168                    r.limits.clone(),
54169                )
54170                .map(|r| r.map(|t| Self::TransactionHistoryResultEntry(Box::new(t)))),
54171            ),
54172            TypeVariant::TransactionHistoryResultEntryExt => Box::new(
54173                ReadXdrIter::<_, TransactionHistoryResultEntryExt>::new(
54174                    &mut r.inner,
54175                    r.limits.clone(),
54176                )
54177                .map(|r| r.map(|t| Self::TransactionHistoryResultEntryExt(Box::new(t)))),
54178            ),
54179            TypeVariant::LedgerHeaderHistoryEntry => Box::new(
54180                ReadXdrIter::<_, LedgerHeaderHistoryEntry>::new(&mut r.inner, r.limits.clone())
54181                    .map(|r| r.map(|t| Self::LedgerHeaderHistoryEntry(Box::new(t)))),
54182            ),
54183            TypeVariant::LedgerHeaderHistoryEntryExt => Box::new(
54184                ReadXdrIter::<_, LedgerHeaderHistoryEntryExt>::new(&mut r.inner, r.limits.clone())
54185                    .map(|r| r.map(|t| Self::LedgerHeaderHistoryEntryExt(Box::new(t)))),
54186            ),
54187            TypeVariant::LedgerScpMessages => Box::new(
54188                ReadXdrIter::<_, LedgerScpMessages>::new(&mut r.inner, r.limits.clone())
54189                    .map(|r| r.map(|t| Self::LedgerScpMessages(Box::new(t)))),
54190            ),
54191            TypeVariant::ScpHistoryEntryV0 => Box::new(
54192                ReadXdrIter::<_, ScpHistoryEntryV0>::new(&mut r.inner, r.limits.clone())
54193                    .map(|r| r.map(|t| Self::ScpHistoryEntryV0(Box::new(t)))),
54194            ),
54195            TypeVariant::ScpHistoryEntry => Box::new(
54196                ReadXdrIter::<_, ScpHistoryEntry>::new(&mut r.inner, r.limits.clone())
54197                    .map(|r| r.map(|t| Self::ScpHistoryEntry(Box::new(t)))),
54198            ),
54199            TypeVariant::LedgerEntryChangeType => Box::new(
54200                ReadXdrIter::<_, LedgerEntryChangeType>::new(&mut r.inner, r.limits.clone())
54201                    .map(|r| r.map(|t| Self::LedgerEntryChangeType(Box::new(t)))),
54202            ),
54203            TypeVariant::LedgerEntryChange => Box::new(
54204                ReadXdrIter::<_, LedgerEntryChange>::new(&mut r.inner, r.limits.clone())
54205                    .map(|r| r.map(|t| Self::LedgerEntryChange(Box::new(t)))),
54206            ),
54207            TypeVariant::LedgerEntryChanges => Box::new(
54208                ReadXdrIter::<_, LedgerEntryChanges>::new(&mut r.inner, r.limits.clone())
54209                    .map(|r| r.map(|t| Self::LedgerEntryChanges(Box::new(t)))),
54210            ),
54211            TypeVariant::OperationMeta => Box::new(
54212                ReadXdrIter::<_, OperationMeta>::new(&mut r.inner, r.limits.clone())
54213                    .map(|r| r.map(|t| Self::OperationMeta(Box::new(t)))),
54214            ),
54215            TypeVariant::TransactionMetaV1 => Box::new(
54216                ReadXdrIter::<_, TransactionMetaV1>::new(&mut r.inner, r.limits.clone())
54217                    .map(|r| r.map(|t| Self::TransactionMetaV1(Box::new(t)))),
54218            ),
54219            TypeVariant::TransactionMetaV2 => Box::new(
54220                ReadXdrIter::<_, TransactionMetaV2>::new(&mut r.inner, r.limits.clone())
54221                    .map(|r| r.map(|t| Self::TransactionMetaV2(Box::new(t)))),
54222            ),
54223            TypeVariant::ContractEventType => Box::new(
54224                ReadXdrIter::<_, ContractEventType>::new(&mut r.inner, r.limits.clone())
54225                    .map(|r| r.map(|t| Self::ContractEventType(Box::new(t)))),
54226            ),
54227            TypeVariant::ContractEvent => Box::new(
54228                ReadXdrIter::<_, ContractEvent>::new(&mut r.inner, r.limits.clone())
54229                    .map(|r| r.map(|t| Self::ContractEvent(Box::new(t)))),
54230            ),
54231            TypeVariant::ContractEventBody => Box::new(
54232                ReadXdrIter::<_, ContractEventBody>::new(&mut r.inner, r.limits.clone())
54233                    .map(|r| r.map(|t| Self::ContractEventBody(Box::new(t)))),
54234            ),
54235            TypeVariant::ContractEventV0 => Box::new(
54236                ReadXdrIter::<_, ContractEventV0>::new(&mut r.inner, r.limits.clone())
54237                    .map(|r| r.map(|t| Self::ContractEventV0(Box::new(t)))),
54238            ),
54239            TypeVariant::DiagnosticEvent => Box::new(
54240                ReadXdrIter::<_, DiagnosticEvent>::new(&mut r.inner, r.limits.clone())
54241                    .map(|r| r.map(|t| Self::DiagnosticEvent(Box::new(t)))),
54242            ),
54243            TypeVariant::SorobanTransactionMetaExtV1 => Box::new(
54244                ReadXdrIter::<_, SorobanTransactionMetaExtV1>::new(&mut r.inner, r.limits.clone())
54245                    .map(|r| r.map(|t| Self::SorobanTransactionMetaExtV1(Box::new(t)))),
54246            ),
54247            TypeVariant::SorobanTransactionMetaExt => Box::new(
54248                ReadXdrIter::<_, SorobanTransactionMetaExt>::new(&mut r.inner, r.limits.clone())
54249                    .map(|r| r.map(|t| Self::SorobanTransactionMetaExt(Box::new(t)))),
54250            ),
54251            TypeVariant::SorobanTransactionMeta => Box::new(
54252                ReadXdrIter::<_, SorobanTransactionMeta>::new(&mut r.inner, r.limits.clone())
54253                    .map(|r| r.map(|t| Self::SorobanTransactionMeta(Box::new(t)))),
54254            ),
54255            TypeVariant::TransactionMetaV3 => Box::new(
54256                ReadXdrIter::<_, TransactionMetaV3>::new(&mut r.inner, r.limits.clone())
54257                    .map(|r| r.map(|t| Self::TransactionMetaV3(Box::new(t)))),
54258            ),
54259            TypeVariant::InvokeHostFunctionSuccessPreImage => Box::new(
54260                ReadXdrIter::<_, InvokeHostFunctionSuccessPreImage>::new(
54261                    &mut r.inner,
54262                    r.limits.clone(),
54263                )
54264                .map(|r| r.map(|t| Self::InvokeHostFunctionSuccessPreImage(Box::new(t)))),
54265            ),
54266            TypeVariant::TransactionMeta => Box::new(
54267                ReadXdrIter::<_, TransactionMeta>::new(&mut r.inner, r.limits.clone())
54268                    .map(|r| r.map(|t| Self::TransactionMeta(Box::new(t)))),
54269            ),
54270            TypeVariant::TransactionResultMeta => Box::new(
54271                ReadXdrIter::<_, TransactionResultMeta>::new(&mut r.inner, r.limits.clone())
54272                    .map(|r| r.map(|t| Self::TransactionResultMeta(Box::new(t)))),
54273            ),
54274            TypeVariant::UpgradeEntryMeta => Box::new(
54275                ReadXdrIter::<_, UpgradeEntryMeta>::new(&mut r.inner, r.limits.clone())
54276                    .map(|r| r.map(|t| Self::UpgradeEntryMeta(Box::new(t)))),
54277            ),
54278            TypeVariant::LedgerCloseMetaV0 => Box::new(
54279                ReadXdrIter::<_, LedgerCloseMetaV0>::new(&mut r.inner, r.limits.clone())
54280                    .map(|r| r.map(|t| Self::LedgerCloseMetaV0(Box::new(t)))),
54281            ),
54282            TypeVariant::LedgerCloseMetaExtV1 => Box::new(
54283                ReadXdrIter::<_, LedgerCloseMetaExtV1>::new(&mut r.inner, r.limits.clone())
54284                    .map(|r| r.map(|t| Self::LedgerCloseMetaExtV1(Box::new(t)))),
54285            ),
54286            TypeVariant::LedgerCloseMetaExtV2 => Box::new(
54287                ReadXdrIter::<_, LedgerCloseMetaExtV2>::new(&mut r.inner, r.limits.clone())
54288                    .map(|r| r.map(|t| Self::LedgerCloseMetaExtV2(Box::new(t)))),
54289            ),
54290            TypeVariant::LedgerCloseMetaExt => Box::new(
54291                ReadXdrIter::<_, LedgerCloseMetaExt>::new(&mut r.inner, r.limits.clone())
54292                    .map(|r| r.map(|t| Self::LedgerCloseMetaExt(Box::new(t)))),
54293            ),
54294            TypeVariant::LedgerCloseMetaV1 => Box::new(
54295                ReadXdrIter::<_, LedgerCloseMetaV1>::new(&mut r.inner, r.limits.clone())
54296                    .map(|r| r.map(|t| Self::LedgerCloseMetaV1(Box::new(t)))),
54297            ),
54298            TypeVariant::LedgerCloseMeta => Box::new(
54299                ReadXdrIter::<_, LedgerCloseMeta>::new(&mut r.inner, r.limits.clone())
54300                    .map(|r| r.map(|t| Self::LedgerCloseMeta(Box::new(t)))),
54301            ),
54302            TypeVariant::ErrorCode => Box::new(
54303                ReadXdrIter::<_, ErrorCode>::new(&mut r.inner, r.limits.clone())
54304                    .map(|r| r.map(|t| Self::ErrorCode(Box::new(t)))),
54305            ),
54306            TypeVariant::SError => Box::new(
54307                ReadXdrIter::<_, SError>::new(&mut r.inner, r.limits.clone())
54308                    .map(|r| r.map(|t| Self::SError(Box::new(t)))),
54309            ),
54310            TypeVariant::SendMore => Box::new(
54311                ReadXdrIter::<_, SendMore>::new(&mut r.inner, r.limits.clone())
54312                    .map(|r| r.map(|t| Self::SendMore(Box::new(t)))),
54313            ),
54314            TypeVariant::SendMoreExtended => Box::new(
54315                ReadXdrIter::<_, SendMoreExtended>::new(&mut r.inner, r.limits.clone())
54316                    .map(|r| r.map(|t| Self::SendMoreExtended(Box::new(t)))),
54317            ),
54318            TypeVariant::AuthCert => Box::new(
54319                ReadXdrIter::<_, AuthCert>::new(&mut r.inner, r.limits.clone())
54320                    .map(|r| r.map(|t| Self::AuthCert(Box::new(t)))),
54321            ),
54322            TypeVariant::Hello => Box::new(
54323                ReadXdrIter::<_, Hello>::new(&mut r.inner, r.limits.clone())
54324                    .map(|r| r.map(|t| Self::Hello(Box::new(t)))),
54325            ),
54326            TypeVariant::Auth => Box::new(
54327                ReadXdrIter::<_, Auth>::new(&mut r.inner, r.limits.clone())
54328                    .map(|r| r.map(|t| Self::Auth(Box::new(t)))),
54329            ),
54330            TypeVariant::IpAddrType => Box::new(
54331                ReadXdrIter::<_, IpAddrType>::new(&mut r.inner, r.limits.clone())
54332                    .map(|r| r.map(|t| Self::IpAddrType(Box::new(t)))),
54333            ),
54334            TypeVariant::PeerAddress => Box::new(
54335                ReadXdrIter::<_, PeerAddress>::new(&mut r.inner, r.limits.clone())
54336                    .map(|r| r.map(|t| Self::PeerAddress(Box::new(t)))),
54337            ),
54338            TypeVariant::PeerAddressIp => Box::new(
54339                ReadXdrIter::<_, PeerAddressIp>::new(&mut r.inner, r.limits.clone())
54340                    .map(|r| r.map(|t| Self::PeerAddressIp(Box::new(t)))),
54341            ),
54342            TypeVariant::MessageType => Box::new(
54343                ReadXdrIter::<_, MessageType>::new(&mut r.inner, r.limits.clone())
54344                    .map(|r| r.map(|t| Self::MessageType(Box::new(t)))),
54345            ),
54346            TypeVariant::DontHave => Box::new(
54347                ReadXdrIter::<_, DontHave>::new(&mut r.inner, r.limits.clone())
54348                    .map(|r| r.map(|t| Self::DontHave(Box::new(t)))),
54349            ),
54350            TypeVariant::SurveyMessageCommandType => Box::new(
54351                ReadXdrIter::<_, SurveyMessageCommandType>::new(&mut r.inner, r.limits.clone())
54352                    .map(|r| r.map(|t| Self::SurveyMessageCommandType(Box::new(t)))),
54353            ),
54354            TypeVariant::SurveyMessageResponseType => Box::new(
54355                ReadXdrIter::<_, SurveyMessageResponseType>::new(&mut r.inner, r.limits.clone())
54356                    .map(|r| r.map(|t| Self::SurveyMessageResponseType(Box::new(t)))),
54357            ),
54358            TypeVariant::TimeSlicedSurveyStartCollectingMessage => Box::new(
54359                ReadXdrIter::<_, TimeSlicedSurveyStartCollectingMessage>::new(
54360                    &mut r.inner,
54361                    r.limits.clone(),
54362                )
54363                .map(|r| r.map(|t| Self::TimeSlicedSurveyStartCollectingMessage(Box::new(t)))),
54364            ),
54365            TypeVariant::SignedTimeSlicedSurveyStartCollectingMessage => Box::new(
54366                ReadXdrIter::<_, SignedTimeSlicedSurveyStartCollectingMessage>::new(
54367                    &mut r.inner,
54368                    r.limits.clone(),
54369                )
54370                .map(|r| {
54371                    r.map(|t| Self::SignedTimeSlicedSurveyStartCollectingMessage(Box::new(t)))
54372                }),
54373            ),
54374            TypeVariant::TimeSlicedSurveyStopCollectingMessage => Box::new(
54375                ReadXdrIter::<_, TimeSlicedSurveyStopCollectingMessage>::new(
54376                    &mut r.inner,
54377                    r.limits.clone(),
54378                )
54379                .map(|r| r.map(|t| Self::TimeSlicedSurveyStopCollectingMessage(Box::new(t)))),
54380            ),
54381            TypeVariant::SignedTimeSlicedSurveyStopCollectingMessage => Box::new(
54382                ReadXdrIter::<_, SignedTimeSlicedSurveyStopCollectingMessage>::new(
54383                    &mut r.inner,
54384                    r.limits.clone(),
54385                )
54386                .map(|r| r.map(|t| Self::SignedTimeSlicedSurveyStopCollectingMessage(Box::new(t)))),
54387            ),
54388            TypeVariant::SurveyRequestMessage => Box::new(
54389                ReadXdrIter::<_, SurveyRequestMessage>::new(&mut r.inner, r.limits.clone())
54390                    .map(|r| r.map(|t| Self::SurveyRequestMessage(Box::new(t)))),
54391            ),
54392            TypeVariant::TimeSlicedSurveyRequestMessage => Box::new(
54393                ReadXdrIter::<_, TimeSlicedSurveyRequestMessage>::new(
54394                    &mut r.inner,
54395                    r.limits.clone(),
54396                )
54397                .map(|r| r.map(|t| Self::TimeSlicedSurveyRequestMessage(Box::new(t)))),
54398            ),
54399            TypeVariant::SignedSurveyRequestMessage => Box::new(
54400                ReadXdrIter::<_, SignedSurveyRequestMessage>::new(&mut r.inner, r.limits.clone())
54401                    .map(|r| r.map(|t| Self::SignedSurveyRequestMessage(Box::new(t)))),
54402            ),
54403            TypeVariant::SignedTimeSlicedSurveyRequestMessage => Box::new(
54404                ReadXdrIter::<_, SignedTimeSlicedSurveyRequestMessage>::new(
54405                    &mut r.inner,
54406                    r.limits.clone(),
54407                )
54408                .map(|r| r.map(|t| Self::SignedTimeSlicedSurveyRequestMessage(Box::new(t)))),
54409            ),
54410            TypeVariant::EncryptedBody => Box::new(
54411                ReadXdrIter::<_, EncryptedBody>::new(&mut r.inner, r.limits.clone())
54412                    .map(|r| r.map(|t| Self::EncryptedBody(Box::new(t)))),
54413            ),
54414            TypeVariant::SurveyResponseMessage => Box::new(
54415                ReadXdrIter::<_, SurveyResponseMessage>::new(&mut r.inner, r.limits.clone())
54416                    .map(|r| r.map(|t| Self::SurveyResponseMessage(Box::new(t)))),
54417            ),
54418            TypeVariant::TimeSlicedSurveyResponseMessage => Box::new(
54419                ReadXdrIter::<_, TimeSlicedSurveyResponseMessage>::new(
54420                    &mut r.inner,
54421                    r.limits.clone(),
54422                )
54423                .map(|r| r.map(|t| Self::TimeSlicedSurveyResponseMessage(Box::new(t)))),
54424            ),
54425            TypeVariant::SignedSurveyResponseMessage => Box::new(
54426                ReadXdrIter::<_, SignedSurveyResponseMessage>::new(&mut r.inner, r.limits.clone())
54427                    .map(|r| r.map(|t| Self::SignedSurveyResponseMessage(Box::new(t)))),
54428            ),
54429            TypeVariant::SignedTimeSlicedSurveyResponseMessage => Box::new(
54430                ReadXdrIter::<_, SignedTimeSlicedSurveyResponseMessage>::new(
54431                    &mut r.inner,
54432                    r.limits.clone(),
54433                )
54434                .map(|r| r.map(|t| Self::SignedTimeSlicedSurveyResponseMessage(Box::new(t)))),
54435            ),
54436            TypeVariant::PeerStats => Box::new(
54437                ReadXdrIter::<_, PeerStats>::new(&mut r.inner, r.limits.clone())
54438                    .map(|r| r.map(|t| Self::PeerStats(Box::new(t)))),
54439            ),
54440            TypeVariant::PeerStatList => Box::new(
54441                ReadXdrIter::<_, PeerStatList>::new(&mut r.inner, r.limits.clone())
54442                    .map(|r| r.map(|t| Self::PeerStatList(Box::new(t)))),
54443            ),
54444            TypeVariant::TimeSlicedNodeData => Box::new(
54445                ReadXdrIter::<_, TimeSlicedNodeData>::new(&mut r.inner, r.limits.clone())
54446                    .map(|r| r.map(|t| Self::TimeSlicedNodeData(Box::new(t)))),
54447            ),
54448            TypeVariant::TimeSlicedPeerData => Box::new(
54449                ReadXdrIter::<_, TimeSlicedPeerData>::new(&mut r.inner, r.limits.clone())
54450                    .map(|r| r.map(|t| Self::TimeSlicedPeerData(Box::new(t)))),
54451            ),
54452            TypeVariant::TimeSlicedPeerDataList => Box::new(
54453                ReadXdrIter::<_, TimeSlicedPeerDataList>::new(&mut r.inner, r.limits.clone())
54454                    .map(|r| r.map(|t| Self::TimeSlicedPeerDataList(Box::new(t)))),
54455            ),
54456            TypeVariant::TopologyResponseBodyV0 => Box::new(
54457                ReadXdrIter::<_, TopologyResponseBodyV0>::new(&mut r.inner, r.limits.clone())
54458                    .map(|r| r.map(|t| Self::TopologyResponseBodyV0(Box::new(t)))),
54459            ),
54460            TypeVariant::TopologyResponseBodyV1 => Box::new(
54461                ReadXdrIter::<_, TopologyResponseBodyV1>::new(&mut r.inner, r.limits.clone())
54462                    .map(|r| r.map(|t| Self::TopologyResponseBodyV1(Box::new(t)))),
54463            ),
54464            TypeVariant::TopologyResponseBodyV2 => Box::new(
54465                ReadXdrIter::<_, TopologyResponseBodyV2>::new(&mut r.inner, r.limits.clone())
54466                    .map(|r| r.map(|t| Self::TopologyResponseBodyV2(Box::new(t)))),
54467            ),
54468            TypeVariant::SurveyResponseBody => Box::new(
54469                ReadXdrIter::<_, SurveyResponseBody>::new(&mut r.inner, r.limits.clone())
54470                    .map(|r| r.map(|t| Self::SurveyResponseBody(Box::new(t)))),
54471            ),
54472            TypeVariant::TxAdvertVector => Box::new(
54473                ReadXdrIter::<_, TxAdvertVector>::new(&mut r.inner, r.limits.clone())
54474                    .map(|r| r.map(|t| Self::TxAdvertVector(Box::new(t)))),
54475            ),
54476            TypeVariant::FloodAdvert => Box::new(
54477                ReadXdrIter::<_, FloodAdvert>::new(&mut r.inner, r.limits.clone())
54478                    .map(|r| r.map(|t| Self::FloodAdvert(Box::new(t)))),
54479            ),
54480            TypeVariant::TxDemandVector => Box::new(
54481                ReadXdrIter::<_, TxDemandVector>::new(&mut r.inner, r.limits.clone())
54482                    .map(|r| r.map(|t| Self::TxDemandVector(Box::new(t)))),
54483            ),
54484            TypeVariant::FloodDemand => Box::new(
54485                ReadXdrIter::<_, FloodDemand>::new(&mut r.inner, r.limits.clone())
54486                    .map(|r| r.map(|t| Self::FloodDemand(Box::new(t)))),
54487            ),
54488            TypeVariant::StellarMessage => Box::new(
54489                ReadXdrIter::<_, StellarMessage>::new(&mut r.inner, r.limits.clone())
54490                    .map(|r| r.map(|t| Self::StellarMessage(Box::new(t)))),
54491            ),
54492            TypeVariant::AuthenticatedMessage => Box::new(
54493                ReadXdrIter::<_, AuthenticatedMessage>::new(&mut r.inner, r.limits.clone())
54494                    .map(|r| r.map(|t| Self::AuthenticatedMessage(Box::new(t)))),
54495            ),
54496            TypeVariant::AuthenticatedMessageV0 => Box::new(
54497                ReadXdrIter::<_, AuthenticatedMessageV0>::new(&mut r.inner, r.limits.clone())
54498                    .map(|r| r.map(|t| Self::AuthenticatedMessageV0(Box::new(t)))),
54499            ),
54500            TypeVariant::LiquidityPoolParameters => Box::new(
54501                ReadXdrIter::<_, LiquidityPoolParameters>::new(&mut r.inner, r.limits.clone())
54502                    .map(|r| r.map(|t| Self::LiquidityPoolParameters(Box::new(t)))),
54503            ),
54504            TypeVariant::MuxedAccount => Box::new(
54505                ReadXdrIter::<_, MuxedAccount>::new(&mut r.inner, r.limits.clone())
54506                    .map(|r| r.map(|t| Self::MuxedAccount(Box::new(t)))),
54507            ),
54508            TypeVariant::MuxedAccountMed25519 => Box::new(
54509                ReadXdrIter::<_, MuxedAccountMed25519>::new(&mut r.inner, r.limits.clone())
54510                    .map(|r| r.map(|t| Self::MuxedAccountMed25519(Box::new(t)))),
54511            ),
54512            TypeVariant::DecoratedSignature => Box::new(
54513                ReadXdrIter::<_, DecoratedSignature>::new(&mut r.inner, r.limits.clone())
54514                    .map(|r| r.map(|t| Self::DecoratedSignature(Box::new(t)))),
54515            ),
54516            TypeVariant::OperationType => Box::new(
54517                ReadXdrIter::<_, OperationType>::new(&mut r.inner, r.limits.clone())
54518                    .map(|r| r.map(|t| Self::OperationType(Box::new(t)))),
54519            ),
54520            TypeVariant::CreateAccountOp => Box::new(
54521                ReadXdrIter::<_, CreateAccountOp>::new(&mut r.inner, r.limits.clone())
54522                    .map(|r| r.map(|t| Self::CreateAccountOp(Box::new(t)))),
54523            ),
54524            TypeVariant::PaymentOp => Box::new(
54525                ReadXdrIter::<_, PaymentOp>::new(&mut r.inner, r.limits.clone())
54526                    .map(|r| r.map(|t| Self::PaymentOp(Box::new(t)))),
54527            ),
54528            TypeVariant::PathPaymentStrictReceiveOp => Box::new(
54529                ReadXdrIter::<_, PathPaymentStrictReceiveOp>::new(&mut r.inner, r.limits.clone())
54530                    .map(|r| r.map(|t| Self::PathPaymentStrictReceiveOp(Box::new(t)))),
54531            ),
54532            TypeVariant::PathPaymentStrictSendOp => Box::new(
54533                ReadXdrIter::<_, PathPaymentStrictSendOp>::new(&mut r.inner, r.limits.clone())
54534                    .map(|r| r.map(|t| Self::PathPaymentStrictSendOp(Box::new(t)))),
54535            ),
54536            TypeVariant::ManageSellOfferOp => Box::new(
54537                ReadXdrIter::<_, ManageSellOfferOp>::new(&mut r.inner, r.limits.clone())
54538                    .map(|r| r.map(|t| Self::ManageSellOfferOp(Box::new(t)))),
54539            ),
54540            TypeVariant::ManageBuyOfferOp => Box::new(
54541                ReadXdrIter::<_, ManageBuyOfferOp>::new(&mut r.inner, r.limits.clone())
54542                    .map(|r| r.map(|t| Self::ManageBuyOfferOp(Box::new(t)))),
54543            ),
54544            TypeVariant::CreatePassiveSellOfferOp => Box::new(
54545                ReadXdrIter::<_, CreatePassiveSellOfferOp>::new(&mut r.inner, r.limits.clone())
54546                    .map(|r| r.map(|t| Self::CreatePassiveSellOfferOp(Box::new(t)))),
54547            ),
54548            TypeVariant::SetOptionsOp => Box::new(
54549                ReadXdrIter::<_, SetOptionsOp>::new(&mut r.inner, r.limits.clone())
54550                    .map(|r| r.map(|t| Self::SetOptionsOp(Box::new(t)))),
54551            ),
54552            TypeVariant::ChangeTrustAsset => Box::new(
54553                ReadXdrIter::<_, ChangeTrustAsset>::new(&mut r.inner, r.limits.clone())
54554                    .map(|r| r.map(|t| Self::ChangeTrustAsset(Box::new(t)))),
54555            ),
54556            TypeVariant::ChangeTrustOp => Box::new(
54557                ReadXdrIter::<_, ChangeTrustOp>::new(&mut r.inner, r.limits.clone())
54558                    .map(|r| r.map(|t| Self::ChangeTrustOp(Box::new(t)))),
54559            ),
54560            TypeVariant::AllowTrustOp => Box::new(
54561                ReadXdrIter::<_, AllowTrustOp>::new(&mut r.inner, r.limits.clone())
54562                    .map(|r| r.map(|t| Self::AllowTrustOp(Box::new(t)))),
54563            ),
54564            TypeVariant::ManageDataOp => Box::new(
54565                ReadXdrIter::<_, ManageDataOp>::new(&mut r.inner, r.limits.clone())
54566                    .map(|r| r.map(|t| Self::ManageDataOp(Box::new(t)))),
54567            ),
54568            TypeVariant::BumpSequenceOp => Box::new(
54569                ReadXdrIter::<_, BumpSequenceOp>::new(&mut r.inner, r.limits.clone())
54570                    .map(|r| r.map(|t| Self::BumpSequenceOp(Box::new(t)))),
54571            ),
54572            TypeVariant::CreateClaimableBalanceOp => Box::new(
54573                ReadXdrIter::<_, CreateClaimableBalanceOp>::new(&mut r.inner, r.limits.clone())
54574                    .map(|r| r.map(|t| Self::CreateClaimableBalanceOp(Box::new(t)))),
54575            ),
54576            TypeVariant::ClaimClaimableBalanceOp => Box::new(
54577                ReadXdrIter::<_, ClaimClaimableBalanceOp>::new(&mut r.inner, r.limits.clone())
54578                    .map(|r| r.map(|t| Self::ClaimClaimableBalanceOp(Box::new(t)))),
54579            ),
54580            TypeVariant::BeginSponsoringFutureReservesOp => Box::new(
54581                ReadXdrIter::<_, BeginSponsoringFutureReservesOp>::new(
54582                    &mut r.inner,
54583                    r.limits.clone(),
54584                )
54585                .map(|r| r.map(|t| Self::BeginSponsoringFutureReservesOp(Box::new(t)))),
54586            ),
54587            TypeVariant::RevokeSponsorshipType => Box::new(
54588                ReadXdrIter::<_, RevokeSponsorshipType>::new(&mut r.inner, r.limits.clone())
54589                    .map(|r| r.map(|t| Self::RevokeSponsorshipType(Box::new(t)))),
54590            ),
54591            TypeVariant::RevokeSponsorshipOp => Box::new(
54592                ReadXdrIter::<_, RevokeSponsorshipOp>::new(&mut r.inner, r.limits.clone())
54593                    .map(|r| r.map(|t| Self::RevokeSponsorshipOp(Box::new(t)))),
54594            ),
54595            TypeVariant::RevokeSponsorshipOpSigner => Box::new(
54596                ReadXdrIter::<_, RevokeSponsorshipOpSigner>::new(&mut r.inner, r.limits.clone())
54597                    .map(|r| r.map(|t| Self::RevokeSponsorshipOpSigner(Box::new(t)))),
54598            ),
54599            TypeVariant::ClawbackOp => Box::new(
54600                ReadXdrIter::<_, ClawbackOp>::new(&mut r.inner, r.limits.clone())
54601                    .map(|r| r.map(|t| Self::ClawbackOp(Box::new(t)))),
54602            ),
54603            TypeVariant::ClawbackClaimableBalanceOp => Box::new(
54604                ReadXdrIter::<_, ClawbackClaimableBalanceOp>::new(&mut r.inner, r.limits.clone())
54605                    .map(|r| r.map(|t| Self::ClawbackClaimableBalanceOp(Box::new(t)))),
54606            ),
54607            TypeVariant::SetTrustLineFlagsOp => Box::new(
54608                ReadXdrIter::<_, SetTrustLineFlagsOp>::new(&mut r.inner, r.limits.clone())
54609                    .map(|r| r.map(|t| Self::SetTrustLineFlagsOp(Box::new(t)))),
54610            ),
54611            TypeVariant::LiquidityPoolDepositOp => Box::new(
54612                ReadXdrIter::<_, LiquidityPoolDepositOp>::new(&mut r.inner, r.limits.clone())
54613                    .map(|r| r.map(|t| Self::LiquidityPoolDepositOp(Box::new(t)))),
54614            ),
54615            TypeVariant::LiquidityPoolWithdrawOp => Box::new(
54616                ReadXdrIter::<_, LiquidityPoolWithdrawOp>::new(&mut r.inner, r.limits.clone())
54617                    .map(|r| r.map(|t| Self::LiquidityPoolWithdrawOp(Box::new(t)))),
54618            ),
54619            TypeVariant::HostFunctionType => Box::new(
54620                ReadXdrIter::<_, HostFunctionType>::new(&mut r.inner, r.limits.clone())
54621                    .map(|r| r.map(|t| Self::HostFunctionType(Box::new(t)))),
54622            ),
54623            TypeVariant::ContractIdPreimageType => Box::new(
54624                ReadXdrIter::<_, ContractIdPreimageType>::new(&mut r.inner, r.limits.clone())
54625                    .map(|r| r.map(|t| Self::ContractIdPreimageType(Box::new(t)))),
54626            ),
54627            TypeVariant::ContractIdPreimage => Box::new(
54628                ReadXdrIter::<_, ContractIdPreimage>::new(&mut r.inner, r.limits.clone())
54629                    .map(|r| r.map(|t| Self::ContractIdPreimage(Box::new(t)))),
54630            ),
54631            TypeVariant::ContractIdPreimageFromAddress => Box::new(
54632                ReadXdrIter::<_, ContractIdPreimageFromAddress>::new(
54633                    &mut r.inner,
54634                    r.limits.clone(),
54635                )
54636                .map(|r| r.map(|t| Self::ContractIdPreimageFromAddress(Box::new(t)))),
54637            ),
54638            TypeVariant::CreateContractArgs => Box::new(
54639                ReadXdrIter::<_, CreateContractArgs>::new(&mut r.inner, r.limits.clone())
54640                    .map(|r| r.map(|t| Self::CreateContractArgs(Box::new(t)))),
54641            ),
54642            TypeVariant::CreateContractArgsV2 => Box::new(
54643                ReadXdrIter::<_, CreateContractArgsV2>::new(&mut r.inner, r.limits.clone())
54644                    .map(|r| r.map(|t| Self::CreateContractArgsV2(Box::new(t)))),
54645            ),
54646            TypeVariant::InvokeContractArgs => Box::new(
54647                ReadXdrIter::<_, InvokeContractArgs>::new(&mut r.inner, r.limits.clone())
54648                    .map(|r| r.map(|t| Self::InvokeContractArgs(Box::new(t)))),
54649            ),
54650            TypeVariant::HostFunction => Box::new(
54651                ReadXdrIter::<_, HostFunction>::new(&mut r.inner, r.limits.clone())
54652                    .map(|r| r.map(|t| Self::HostFunction(Box::new(t)))),
54653            ),
54654            TypeVariant::SorobanAuthorizedFunctionType => Box::new(
54655                ReadXdrIter::<_, SorobanAuthorizedFunctionType>::new(
54656                    &mut r.inner,
54657                    r.limits.clone(),
54658                )
54659                .map(|r| r.map(|t| Self::SorobanAuthorizedFunctionType(Box::new(t)))),
54660            ),
54661            TypeVariant::SorobanAuthorizedFunction => Box::new(
54662                ReadXdrIter::<_, SorobanAuthorizedFunction>::new(&mut r.inner, r.limits.clone())
54663                    .map(|r| r.map(|t| Self::SorobanAuthorizedFunction(Box::new(t)))),
54664            ),
54665            TypeVariant::SorobanAuthorizedInvocation => Box::new(
54666                ReadXdrIter::<_, SorobanAuthorizedInvocation>::new(&mut r.inner, r.limits.clone())
54667                    .map(|r| r.map(|t| Self::SorobanAuthorizedInvocation(Box::new(t)))),
54668            ),
54669            TypeVariant::SorobanAddressCredentials => Box::new(
54670                ReadXdrIter::<_, SorobanAddressCredentials>::new(&mut r.inner, r.limits.clone())
54671                    .map(|r| r.map(|t| Self::SorobanAddressCredentials(Box::new(t)))),
54672            ),
54673            TypeVariant::SorobanCredentialsType => Box::new(
54674                ReadXdrIter::<_, SorobanCredentialsType>::new(&mut r.inner, r.limits.clone())
54675                    .map(|r| r.map(|t| Self::SorobanCredentialsType(Box::new(t)))),
54676            ),
54677            TypeVariant::SorobanCredentials => Box::new(
54678                ReadXdrIter::<_, SorobanCredentials>::new(&mut r.inner, r.limits.clone())
54679                    .map(|r| r.map(|t| Self::SorobanCredentials(Box::new(t)))),
54680            ),
54681            TypeVariant::SorobanAuthorizationEntry => Box::new(
54682                ReadXdrIter::<_, SorobanAuthorizationEntry>::new(&mut r.inner, r.limits.clone())
54683                    .map(|r| r.map(|t| Self::SorobanAuthorizationEntry(Box::new(t)))),
54684            ),
54685            TypeVariant::InvokeHostFunctionOp => Box::new(
54686                ReadXdrIter::<_, InvokeHostFunctionOp>::new(&mut r.inner, r.limits.clone())
54687                    .map(|r| r.map(|t| Self::InvokeHostFunctionOp(Box::new(t)))),
54688            ),
54689            TypeVariant::ExtendFootprintTtlOp => Box::new(
54690                ReadXdrIter::<_, ExtendFootprintTtlOp>::new(&mut r.inner, r.limits.clone())
54691                    .map(|r| r.map(|t| Self::ExtendFootprintTtlOp(Box::new(t)))),
54692            ),
54693            TypeVariant::RestoreFootprintOp => Box::new(
54694                ReadXdrIter::<_, RestoreFootprintOp>::new(&mut r.inner, r.limits.clone())
54695                    .map(|r| r.map(|t| Self::RestoreFootprintOp(Box::new(t)))),
54696            ),
54697            TypeVariant::Operation => Box::new(
54698                ReadXdrIter::<_, Operation>::new(&mut r.inner, r.limits.clone())
54699                    .map(|r| r.map(|t| Self::Operation(Box::new(t)))),
54700            ),
54701            TypeVariant::OperationBody => Box::new(
54702                ReadXdrIter::<_, OperationBody>::new(&mut r.inner, r.limits.clone())
54703                    .map(|r| r.map(|t| Self::OperationBody(Box::new(t)))),
54704            ),
54705            TypeVariant::HashIdPreimage => Box::new(
54706                ReadXdrIter::<_, HashIdPreimage>::new(&mut r.inner, r.limits.clone())
54707                    .map(|r| r.map(|t| Self::HashIdPreimage(Box::new(t)))),
54708            ),
54709            TypeVariant::HashIdPreimageOperationId => Box::new(
54710                ReadXdrIter::<_, HashIdPreimageOperationId>::new(&mut r.inner, r.limits.clone())
54711                    .map(|r| r.map(|t| Self::HashIdPreimageOperationId(Box::new(t)))),
54712            ),
54713            TypeVariant::HashIdPreimageRevokeId => Box::new(
54714                ReadXdrIter::<_, HashIdPreimageRevokeId>::new(&mut r.inner, r.limits.clone())
54715                    .map(|r| r.map(|t| Self::HashIdPreimageRevokeId(Box::new(t)))),
54716            ),
54717            TypeVariant::HashIdPreimageContractId => Box::new(
54718                ReadXdrIter::<_, HashIdPreimageContractId>::new(&mut r.inner, r.limits.clone())
54719                    .map(|r| r.map(|t| Self::HashIdPreimageContractId(Box::new(t)))),
54720            ),
54721            TypeVariant::HashIdPreimageSorobanAuthorization => Box::new(
54722                ReadXdrIter::<_, HashIdPreimageSorobanAuthorization>::new(
54723                    &mut r.inner,
54724                    r.limits.clone(),
54725                )
54726                .map(|r| r.map(|t| Self::HashIdPreimageSorobanAuthorization(Box::new(t)))),
54727            ),
54728            TypeVariant::MemoType => Box::new(
54729                ReadXdrIter::<_, MemoType>::new(&mut r.inner, r.limits.clone())
54730                    .map(|r| r.map(|t| Self::MemoType(Box::new(t)))),
54731            ),
54732            TypeVariant::Memo => Box::new(
54733                ReadXdrIter::<_, Memo>::new(&mut r.inner, r.limits.clone())
54734                    .map(|r| r.map(|t| Self::Memo(Box::new(t)))),
54735            ),
54736            TypeVariant::TimeBounds => Box::new(
54737                ReadXdrIter::<_, TimeBounds>::new(&mut r.inner, r.limits.clone())
54738                    .map(|r| r.map(|t| Self::TimeBounds(Box::new(t)))),
54739            ),
54740            TypeVariant::LedgerBounds => Box::new(
54741                ReadXdrIter::<_, LedgerBounds>::new(&mut r.inner, r.limits.clone())
54742                    .map(|r| r.map(|t| Self::LedgerBounds(Box::new(t)))),
54743            ),
54744            TypeVariant::PreconditionsV2 => Box::new(
54745                ReadXdrIter::<_, PreconditionsV2>::new(&mut r.inner, r.limits.clone())
54746                    .map(|r| r.map(|t| Self::PreconditionsV2(Box::new(t)))),
54747            ),
54748            TypeVariant::PreconditionType => Box::new(
54749                ReadXdrIter::<_, PreconditionType>::new(&mut r.inner, r.limits.clone())
54750                    .map(|r| r.map(|t| Self::PreconditionType(Box::new(t)))),
54751            ),
54752            TypeVariant::Preconditions => Box::new(
54753                ReadXdrIter::<_, Preconditions>::new(&mut r.inner, r.limits.clone())
54754                    .map(|r| r.map(|t| Self::Preconditions(Box::new(t)))),
54755            ),
54756            TypeVariant::LedgerFootprint => Box::new(
54757                ReadXdrIter::<_, LedgerFootprint>::new(&mut r.inner, r.limits.clone())
54758                    .map(|r| r.map(|t| Self::LedgerFootprint(Box::new(t)))),
54759            ),
54760            TypeVariant::ArchivalProofType => Box::new(
54761                ReadXdrIter::<_, ArchivalProofType>::new(&mut r.inner, r.limits.clone())
54762                    .map(|r| r.map(|t| Self::ArchivalProofType(Box::new(t)))),
54763            ),
54764            TypeVariant::ArchivalProofNode => Box::new(
54765                ReadXdrIter::<_, ArchivalProofNode>::new(&mut r.inner, r.limits.clone())
54766                    .map(|r| r.map(|t| Self::ArchivalProofNode(Box::new(t)))),
54767            ),
54768            TypeVariant::ProofLevel => Box::new(
54769                ReadXdrIter::<_, ProofLevel>::new(&mut r.inner, r.limits.clone())
54770                    .map(|r| r.map(|t| Self::ProofLevel(Box::new(t)))),
54771            ),
54772            TypeVariant::ExistenceProofBody => Box::new(
54773                ReadXdrIter::<_, ExistenceProofBody>::new(&mut r.inner, r.limits.clone())
54774                    .map(|r| r.map(|t| Self::ExistenceProofBody(Box::new(t)))),
54775            ),
54776            TypeVariant::NonexistenceProofBody => Box::new(
54777                ReadXdrIter::<_, NonexistenceProofBody>::new(&mut r.inner, r.limits.clone())
54778                    .map(|r| r.map(|t| Self::NonexistenceProofBody(Box::new(t)))),
54779            ),
54780            TypeVariant::ArchivalProof => Box::new(
54781                ReadXdrIter::<_, ArchivalProof>::new(&mut r.inner, r.limits.clone())
54782                    .map(|r| r.map(|t| Self::ArchivalProof(Box::new(t)))),
54783            ),
54784            TypeVariant::ArchivalProofBody => Box::new(
54785                ReadXdrIter::<_, ArchivalProofBody>::new(&mut r.inner, r.limits.clone())
54786                    .map(|r| r.map(|t| Self::ArchivalProofBody(Box::new(t)))),
54787            ),
54788            TypeVariant::SorobanResources => Box::new(
54789                ReadXdrIter::<_, SorobanResources>::new(&mut r.inner, r.limits.clone())
54790                    .map(|r| r.map(|t| Self::SorobanResources(Box::new(t)))),
54791            ),
54792            TypeVariant::SorobanTransactionData => Box::new(
54793                ReadXdrIter::<_, SorobanTransactionData>::new(&mut r.inner, r.limits.clone())
54794                    .map(|r| r.map(|t| Self::SorobanTransactionData(Box::new(t)))),
54795            ),
54796            TypeVariant::SorobanTransactionDataExt => Box::new(
54797                ReadXdrIter::<_, SorobanTransactionDataExt>::new(&mut r.inner, r.limits.clone())
54798                    .map(|r| r.map(|t| Self::SorobanTransactionDataExt(Box::new(t)))),
54799            ),
54800            TypeVariant::TransactionV0 => Box::new(
54801                ReadXdrIter::<_, TransactionV0>::new(&mut r.inner, r.limits.clone())
54802                    .map(|r| r.map(|t| Self::TransactionV0(Box::new(t)))),
54803            ),
54804            TypeVariant::TransactionV0Ext => Box::new(
54805                ReadXdrIter::<_, TransactionV0Ext>::new(&mut r.inner, r.limits.clone())
54806                    .map(|r| r.map(|t| Self::TransactionV0Ext(Box::new(t)))),
54807            ),
54808            TypeVariant::TransactionV0Envelope => Box::new(
54809                ReadXdrIter::<_, TransactionV0Envelope>::new(&mut r.inner, r.limits.clone())
54810                    .map(|r| r.map(|t| Self::TransactionV0Envelope(Box::new(t)))),
54811            ),
54812            TypeVariant::Transaction => Box::new(
54813                ReadXdrIter::<_, Transaction>::new(&mut r.inner, r.limits.clone())
54814                    .map(|r| r.map(|t| Self::Transaction(Box::new(t)))),
54815            ),
54816            TypeVariant::TransactionExt => Box::new(
54817                ReadXdrIter::<_, TransactionExt>::new(&mut r.inner, r.limits.clone())
54818                    .map(|r| r.map(|t| Self::TransactionExt(Box::new(t)))),
54819            ),
54820            TypeVariant::TransactionV1Envelope => Box::new(
54821                ReadXdrIter::<_, TransactionV1Envelope>::new(&mut r.inner, r.limits.clone())
54822                    .map(|r| r.map(|t| Self::TransactionV1Envelope(Box::new(t)))),
54823            ),
54824            TypeVariant::FeeBumpTransaction => Box::new(
54825                ReadXdrIter::<_, FeeBumpTransaction>::new(&mut r.inner, r.limits.clone())
54826                    .map(|r| r.map(|t| Self::FeeBumpTransaction(Box::new(t)))),
54827            ),
54828            TypeVariant::FeeBumpTransactionInnerTx => Box::new(
54829                ReadXdrIter::<_, FeeBumpTransactionInnerTx>::new(&mut r.inner, r.limits.clone())
54830                    .map(|r| r.map(|t| Self::FeeBumpTransactionInnerTx(Box::new(t)))),
54831            ),
54832            TypeVariant::FeeBumpTransactionExt => Box::new(
54833                ReadXdrIter::<_, FeeBumpTransactionExt>::new(&mut r.inner, r.limits.clone())
54834                    .map(|r| r.map(|t| Self::FeeBumpTransactionExt(Box::new(t)))),
54835            ),
54836            TypeVariant::FeeBumpTransactionEnvelope => Box::new(
54837                ReadXdrIter::<_, FeeBumpTransactionEnvelope>::new(&mut r.inner, r.limits.clone())
54838                    .map(|r| r.map(|t| Self::FeeBumpTransactionEnvelope(Box::new(t)))),
54839            ),
54840            TypeVariant::TransactionEnvelope => Box::new(
54841                ReadXdrIter::<_, TransactionEnvelope>::new(&mut r.inner, r.limits.clone())
54842                    .map(|r| r.map(|t| Self::TransactionEnvelope(Box::new(t)))),
54843            ),
54844            TypeVariant::TransactionSignaturePayload => Box::new(
54845                ReadXdrIter::<_, TransactionSignaturePayload>::new(&mut r.inner, r.limits.clone())
54846                    .map(|r| r.map(|t| Self::TransactionSignaturePayload(Box::new(t)))),
54847            ),
54848            TypeVariant::TransactionSignaturePayloadTaggedTransaction => Box::new(
54849                ReadXdrIter::<_, TransactionSignaturePayloadTaggedTransaction>::new(
54850                    &mut r.inner,
54851                    r.limits.clone(),
54852                )
54853                .map(|r| {
54854                    r.map(|t| Self::TransactionSignaturePayloadTaggedTransaction(Box::new(t)))
54855                }),
54856            ),
54857            TypeVariant::ClaimAtomType => Box::new(
54858                ReadXdrIter::<_, ClaimAtomType>::new(&mut r.inner, r.limits.clone())
54859                    .map(|r| r.map(|t| Self::ClaimAtomType(Box::new(t)))),
54860            ),
54861            TypeVariant::ClaimOfferAtomV0 => Box::new(
54862                ReadXdrIter::<_, ClaimOfferAtomV0>::new(&mut r.inner, r.limits.clone())
54863                    .map(|r| r.map(|t| Self::ClaimOfferAtomV0(Box::new(t)))),
54864            ),
54865            TypeVariant::ClaimOfferAtom => Box::new(
54866                ReadXdrIter::<_, ClaimOfferAtom>::new(&mut r.inner, r.limits.clone())
54867                    .map(|r| r.map(|t| Self::ClaimOfferAtom(Box::new(t)))),
54868            ),
54869            TypeVariant::ClaimLiquidityAtom => Box::new(
54870                ReadXdrIter::<_, ClaimLiquidityAtom>::new(&mut r.inner, r.limits.clone())
54871                    .map(|r| r.map(|t| Self::ClaimLiquidityAtom(Box::new(t)))),
54872            ),
54873            TypeVariant::ClaimAtom => Box::new(
54874                ReadXdrIter::<_, ClaimAtom>::new(&mut r.inner, r.limits.clone())
54875                    .map(|r| r.map(|t| Self::ClaimAtom(Box::new(t)))),
54876            ),
54877            TypeVariant::CreateAccountResultCode => Box::new(
54878                ReadXdrIter::<_, CreateAccountResultCode>::new(&mut r.inner, r.limits.clone())
54879                    .map(|r| r.map(|t| Self::CreateAccountResultCode(Box::new(t)))),
54880            ),
54881            TypeVariant::CreateAccountResult => Box::new(
54882                ReadXdrIter::<_, CreateAccountResult>::new(&mut r.inner, r.limits.clone())
54883                    .map(|r| r.map(|t| Self::CreateAccountResult(Box::new(t)))),
54884            ),
54885            TypeVariant::PaymentResultCode => Box::new(
54886                ReadXdrIter::<_, PaymentResultCode>::new(&mut r.inner, r.limits.clone())
54887                    .map(|r| r.map(|t| Self::PaymentResultCode(Box::new(t)))),
54888            ),
54889            TypeVariant::PaymentResult => Box::new(
54890                ReadXdrIter::<_, PaymentResult>::new(&mut r.inner, r.limits.clone())
54891                    .map(|r| r.map(|t| Self::PaymentResult(Box::new(t)))),
54892            ),
54893            TypeVariant::PathPaymentStrictReceiveResultCode => Box::new(
54894                ReadXdrIter::<_, PathPaymentStrictReceiveResultCode>::new(
54895                    &mut r.inner,
54896                    r.limits.clone(),
54897                )
54898                .map(|r| r.map(|t| Self::PathPaymentStrictReceiveResultCode(Box::new(t)))),
54899            ),
54900            TypeVariant::SimplePaymentResult => Box::new(
54901                ReadXdrIter::<_, SimplePaymentResult>::new(&mut r.inner, r.limits.clone())
54902                    .map(|r| r.map(|t| Self::SimplePaymentResult(Box::new(t)))),
54903            ),
54904            TypeVariant::PathPaymentStrictReceiveResult => Box::new(
54905                ReadXdrIter::<_, PathPaymentStrictReceiveResult>::new(
54906                    &mut r.inner,
54907                    r.limits.clone(),
54908                )
54909                .map(|r| r.map(|t| Self::PathPaymentStrictReceiveResult(Box::new(t)))),
54910            ),
54911            TypeVariant::PathPaymentStrictReceiveResultSuccess => Box::new(
54912                ReadXdrIter::<_, PathPaymentStrictReceiveResultSuccess>::new(
54913                    &mut r.inner,
54914                    r.limits.clone(),
54915                )
54916                .map(|r| r.map(|t| Self::PathPaymentStrictReceiveResultSuccess(Box::new(t)))),
54917            ),
54918            TypeVariant::PathPaymentStrictSendResultCode => Box::new(
54919                ReadXdrIter::<_, PathPaymentStrictSendResultCode>::new(
54920                    &mut r.inner,
54921                    r.limits.clone(),
54922                )
54923                .map(|r| r.map(|t| Self::PathPaymentStrictSendResultCode(Box::new(t)))),
54924            ),
54925            TypeVariant::PathPaymentStrictSendResult => Box::new(
54926                ReadXdrIter::<_, PathPaymentStrictSendResult>::new(&mut r.inner, r.limits.clone())
54927                    .map(|r| r.map(|t| Self::PathPaymentStrictSendResult(Box::new(t)))),
54928            ),
54929            TypeVariant::PathPaymentStrictSendResultSuccess => Box::new(
54930                ReadXdrIter::<_, PathPaymentStrictSendResultSuccess>::new(
54931                    &mut r.inner,
54932                    r.limits.clone(),
54933                )
54934                .map(|r| r.map(|t| Self::PathPaymentStrictSendResultSuccess(Box::new(t)))),
54935            ),
54936            TypeVariant::ManageSellOfferResultCode => Box::new(
54937                ReadXdrIter::<_, ManageSellOfferResultCode>::new(&mut r.inner, r.limits.clone())
54938                    .map(|r| r.map(|t| Self::ManageSellOfferResultCode(Box::new(t)))),
54939            ),
54940            TypeVariant::ManageOfferEffect => Box::new(
54941                ReadXdrIter::<_, ManageOfferEffect>::new(&mut r.inner, r.limits.clone())
54942                    .map(|r| r.map(|t| Self::ManageOfferEffect(Box::new(t)))),
54943            ),
54944            TypeVariant::ManageOfferSuccessResult => Box::new(
54945                ReadXdrIter::<_, ManageOfferSuccessResult>::new(&mut r.inner, r.limits.clone())
54946                    .map(|r| r.map(|t| Self::ManageOfferSuccessResult(Box::new(t)))),
54947            ),
54948            TypeVariant::ManageOfferSuccessResultOffer => Box::new(
54949                ReadXdrIter::<_, ManageOfferSuccessResultOffer>::new(
54950                    &mut r.inner,
54951                    r.limits.clone(),
54952                )
54953                .map(|r| r.map(|t| Self::ManageOfferSuccessResultOffer(Box::new(t)))),
54954            ),
54955            TypeVariant::ManageSellOfferResult => Box::new(
54956                ReadXdrIter::<_, ManageSellOfferResult>::new(&mut r.inner, r.limits.clone())
54957                    .map(|r| r.map(|t| Self::ManageSellOfferResult(Box::new(t)))),
54958            ),
54959            TypeVariant::ManageBuyOfferResultCode => Box::new(
54960                ReadXdrIter::<_, ManageBuyOfferResultCode>::new(&mut r.inner, r.limits.clone())
54961                    .map(|r| r.map(|t| Self::ManageBuyOfferResultCode(Box::new(t)))),
54962            ),
54963            TypeVariant::ManageBuyOfferResult => Box::new(
54964                ReadXdrIter::<_, ManageBuyOfferResult>::new(&mut r.inner, r.limits.clone())
54965                    .map(|r| r.map(|t| Self::ManageBuyOfferResult(Box::new(t)))),
54966            ),
54967            TypeVariant::SetOptionsResultCode => Box::new(
54968                ReadXdrIter::<_, SetOptionsResultCode>::new(&mut r.inner, r.limits.clone())
54969                    .map(|r| r.map(|t| Self::SetOptionsResultCode(Box::new(t)))),
54970            ),
54971            TypeVariant::SetOptionsResult => Box::new(
54972                ReadXdrIter::<_, SetOptionsResult>::new(&mut r.inner, r.limits.clone())
54973                    .map(|r| r.map(|t| Self::SetOptionsResult(Box::new(t)))),
54974            ),
54975            TypeVariant::ChangeTrustResultCode => Box::new(
54976                ReadXdrIter::<_, ChangeTrustResultCode>::new(&mut r.inner, r.limits.clone())
54977                    .map(|r| r.map(|t| Self::ChangeTrustResultCode(Box::new(t)))),
54978            ),
54979            TypeVariant::ChangeTrustResult => Box::new(
54980                ReadXdrIter::<_, ChangeTrustResult>::new(&mut r.inner, r.limits.clone())
54981                    .map(|r| r.map(|t| Self::ChangeTrustResult(Box::new(t)))),
54982            ),
54983            TypeVariant::AllowTrustResultCode => Box::new(
54984                ReadXdrIter::<_, AllowTrustResultCode>::new(&mut r.inner, r.limits.clone())
54985                    .map(|r| r.map(|t| Self::AllowTrustResultCode(Box::new(t)))),
54986            ),
54987            TypeVariant::AllowTrustResult => Box::new(
54988                ReadXdrIter::<_, AllowTrustResult>::new(&mut r.inner, r.limits.clone())
54989                    .map(|r| r.map(|t| Self::AllowTrustResult(Box::new(t)))),
54990            ),
54991            TypeVariant::AccountMergeResultCode => Box::new(
54992                ReadXdrIter::<_, AccountMergeResultCode>::new(&mut r.inner, r.limits.clone())
54993                    .map(|r| r.map(|t| Self::AccountMergeResultCode(Box::new(t)))),
54994            ),
54995            TypeVariant::AccountMergeResult => Box::new(
54996                ReadXdrIter::<_, AccountMergeResult>::new(&mut r.inner, r.limits.clone())
54997                    .map(|r| r.map(|t| Self::AccountMergeResult(Box::new(t)))),
54998            ),
54999            TypeVariant::InflationResultCode => Box::new(
55000                ReadXdrIter::<_, InflationResultCode>::new(&mut r.inner, r.limits.clone())
55001                    .map(|r| r.map(|t| Self::InflationResultCode(Box::new(t)))),
55002            ),
55003            TypeVariant::InflationPayout => Box::new(
55004                ReadXdrIter::<_, InflationPayout>::new(&mut r.inner, r.limits.clone())
55005                    .map(|r| r.map(|t| Self::InflationPayout(Box::new(t)))),
55006            ),
55007            TypeVariant::InflationResult => Box::new(
55008                ReadXdrIter::<_, InflationResult>::new(&mut r.inner, r.limits.clone())
55009                    .map(|r| r.map(|t| Self::InflationResult(Box::new(t)))),
55010            ),
55011            TypeVariant::ManageDataResultCode => Box::new(
55012                ReadXdrIter::<_, ManageDataResultCode>::new(&mut r.inner, r.limits.clone())
55013                    .map(|r| r.map(|t| Self::ManageDataResultCode(Box::new(t)))),
55014            ),
55015            TypeVariant::ManageDataResult => Box::new(
55016                ReadXdrIter::<_, ManageDataResult>::new(&mut r.inner, r.limits.clone())
55017                    .map(|r| r.map(|t| Self::ManageDataResult(Box::new(t)))),
55018            ),
55019            TypeVariant::BumpSequenceResultCode => Box::new(
55020                ReadXdrIter::<_, BumpSequenceResultCode>::new(&mut r.inner, r.limits.clone())
55021                    .map(|r| r.map(|t| Self::BumpSequenceResultCode(Box::new(t)))),
55022            ),
55023            TypeVariant::BumpSequenceResult => Box::new(
55024                ReadXdrIter::<_, BumpSequenceResult>::new(&mut r.inner, r.limits.clone())
55025                    .map(|r| r.map(|t| Self::BumpSequenceResult(Box::new(t)))),
55026            ),
55027            TypeVariant::CreateClaimableBalanceResultCode => Box::new(
55028                ReadXdrIter::<_, CreateClaimableBalanceResultCode>::new(
55029                    &mut r.inner,
55030                    r.limits.clone(),
55031                )
55032                .map(|r| r.map(|t| Self::CreateClaimableBalanceResultCode(Box::new(t)))),
55033            ),
55034            TypeVariant::CreateClaimableBalanceResult => Box::new(
55035                ReadXdrIter::<_, CreateClaimableBalanceResult>::new(&mut r.inner, r.limits.clone())
55036                    .map(|r| r.map(|t| Self::CreateClaimableBalanceResult(Box::new(t)))),
55037            ),
55038            TypeVariant::ClaimClaimableBalanceResultCode => Box::new(
55039                ReadXdrIter::<_, ClaimClaimableBalanceResultCode>::new(
55040                    &mut r.inner,
55041                    r.limits.clone(),
55042                )
55043                .map(|r| r.map(|t| Self::ClaimClaimableBalanceResultCode(Box::new(t)))),
55044            ),
55045            TypeVariant::ClaimClaimableBalanceResult => Box::new(
55046                ReadXdrIter::<_, ClaimClaimableBalanceResult>::new(&mut r.inner, r.limits.clone())
55047                    .map(|r| r.map(|t| Self::ClaimClaimableBalanceResult(Box::new(t)))),
55048            ),
55049            TypeVariant::BeginSponsoringFutureReservesResultCode => Box::new(
55050                ReadXdrIter::<_, BeginSponsoringFutureReservesResultCode>::new(
55051                    &mut r.inner,
55052                    r.limits.clone(),
55053                )
55054                .map(|r| r.map(|t| Self::BeginSponsoringFutureReservesResultCode(Box::new(t)))),
55055            ),
55056            TypeVariant::BeginSponsoringFutureReservesResult => Box::new(
55057                ReadXdrIter::<_, BeginSponsoringFutureReservesResult>::new(
55058                    &mut r.inner,
55059                    r.limits.clone(),
55060                )
55061                .map(|r| r.map(|t| Self::BeginSponsoringFutureReservesResult(Box::new(t)))),
55062            ),
55063            TypeVariant::EndSponsoringFutureReservesResultCode => Box::new(
55064                ReadXdrIter::<_, EndSponsoringFutureReservesResultCode>::new(
55065                    &mut r.inner,
55066                    r.limits.clone(),
55067                )
55068                .map(|r| r.map(|t| Self::EndSponsoringFutureReservesResultCode(Box::new(t)))),
55069            ),
55070            TypeVariant::EndSponsoringFutureReservesResult => Box::new(
55071                ReadXdrIter::<_, EndSponsoringFutureReservesResult>::new(
55072                    &mut r.inner,
55073                    r.limits.clone(),
55074                )
55075                .map(|r| r.map(|t| Self::EndSponsoringFutureReservesResult(Box::new(t)))),
55076            ),
55077            TypeVariant::RevokeSponsorshipResultCode => Box::new(
55078                ReadXdrIter::<_, RevokeSponsorshipResultCode>::new(&mut r.inner, r.limits.clone())
55079                    .map(|r| r.map(|t| Self::RevokeSponsorshipResultCode(Box::new(t)))),
55080            ),
55081            TypeVariant::RevokeSponsorshipResult => Box::new(
55082                ReadXdrIter::<_, RevokeSponsorshipResult>::new(&mut r.inner, r.limits.clone())
55083                    .map(|r| r.map(|t| Self::RevokeSponsorshipResult(Box::new(t)))),
55084            ),
55085            TypeVariant::ClawbackResultCode => Box::new(
55086                ReadXdrIter::<_, ClawbackResultCode>::new(&mut r.inner, r.limits.clone())
55087                    .map(|r| r.map(|t| Self::ClawbackResultCode(Box::new(t)))),
55088            ),
55089            TypeVariant::ClawbackResult => Box::new(
55090                ReadXdrIter::<_, ClawbackResult>::new(&mut r.inner, r.limits.clone())
55091                    .map(|r| r.map(|t| Self::ClawbackResult(Box::new(t)))),
55092            ),
55093            TypeVariant::ClawbackClaimableBalanceResultCode => Box::new(
55094                ReadXdrIter::<_, ClawbackClaimableBalanceResultCode>::new(
55095                    &mut r.inner,
55096                    r.limits.clone(),
55097                )
55098                .map(|r| r.map(|t| Self::ClawbackClaimableBalanceResultCode(Box::new(t)))),
55099            ),
55100            TypeVariant::ClawbackClaimableBalanceResult => Box::new(
55101                ReadXdrIter::<_, ClawbackClaimableBalanceResult>::new(
55102                    &mut r.inner,
55103                    r.limits.clone(),
55104                )
55105                .map(|r| r.map(|t| Self::ClawbackClaimableBalanceResult(Box::new(t)))),
55106            ),
55107            TypeVariant::SetTrustLineFlagsResultCode => Box::new(
55108                ReadXdrIter::<_, SetTrustLineFlagsResultCode>::new(&mut r.inner, r.limits.clone())
55109                    .map(|r| r.map(|t| Self::SetTrustLineFlagsResultCode(Box::new(t)))),
55110            ),
55111            TypeVariant::SetTrustLineFlagsResult => Box::new(
55112                ReadXdrIter::<_, SetTrustLineFlagsResult>::new(&mut r.inner, r.limits.clone())
55113                    .map(|r| r.map(|t| Self::SetTrustLineFlagsResult(Box::new(t)))),
55114            ),
55115            TypeVariant::LiquidityPoolDepositResultCode => Box::new(
55116                ReadXdrIter::<_, LiquidityPoolDepositResultCode>::new(
55117                    &mut r.inner,
55118                    r.limits.clone(),
55119                )
55120                .map(|r| r.map(|t| Self::LiquidityPoolDepositResultCode(Box::new(t)))),
55121            ),
55122            TypeVariant::LiquidityPoolDepositResult => Box::new(
55123                ReadXdrIter::<_, LiquidityPoolDepositResult>::new(&mut r.inner, r.limits.clone())
55124                    .map(|r| r.map(|t| Self::LiquidityPoolDepositResult(Box::new(t)))),
55125            ),
55126            TypeVariant::LiquidityPoolWithdrawResultCode => Box::new(
55127                ReadXdrIter::<_, LiquidityPoolWithdrawResultCode>::new(
55128                    &mut r.inner,
55129                    r.limits.clone(),
55130                )
55131                .map(|r| r.map(|t| Self::LiquidityPoolWithdrawResultCode(Box::new(t)))),
55132            ),
55133            TypeVariant::LiquidityPoolWithdrawResult => Box::new(
55134                ReadXdrIter::<_, LiquidityPoolWithdrawResult>::new(&mut r.inner, r.limits.clone())
55135                    .map(|r| r.map(|t| Self::LiquidityPoolWithdrawResult(Box::new(t)))),
55136            ),
55137            TypeVariant::InvokeHostFunctionResultCode => Box::new(
55138                ReadXdrIter::<_, InvokeHostFunctionResultCode>::new(&mut r.inner, r.limits.clone())
55139                    .map(|r| r.map(|t| Self::InvokeHostFunctionResultCode(Box::new(t)))),
55140            ),
55141            TypeVariant::InvokeHostFunctionResult => Box::new(
55142                ReadXdrIter::<_, InvokeHostFunctionResult>::new(&mut r.inner, r.limits.clone())
55143                    .map(|r| r.map(|t| Self::InvokeHostFunctionResult(Box::new(t)))),
55144            ),
55145            TypeVariant::ExtendFootprintTtlResultCode => Box::new(
55146                ReadXdrIter::<_, ExtendFootprintTtlResultCode>::new(&mut r.inner, r.limits.clone())
55147                    .map(|r| r.map(|t| Self::ExtendFootprintTtlResultCode(Box::new(t)))),
55148            ),
55149            TypeVariant::ExtendFootprintTtlResult => Box::new(
55150                ReadXdrIter::<_, ExtendFootprintTtlResult>::new(&mut r.inner, r.limits.clone())
55151                    .map(|r| r.map(|t| Self::ExtendFootprintTtlResult(Box::new(t)))),
55152            ),
55153            TypeVariant::RestoreFootprintResultCode => Box::new(
55154                ReadXdrIter::<_, RestoreFootprintResultCode>::new(&mut r.inner, r.limits.clone())
55155                    .map(|r| r.map(|t| Self::RestoreFootprintResultCode(Box::new(t)))),
55156            ),
55157            TypeVariant::RestoreFootprintResult => Box::new(
55158                ReadXdrIter::<_, RestoreFootprintResult>::new(&mut r.inner, r.limits.clone())
55159                    .map(|r| r.map(|t| Self::RestoreFootprintResult(Box::new(t)))),
55160            ),
55161            TypeVariant::OperationResultCode => Box::new(
55162                ReadXdrIter::<_, OperationResultCode>::new(&mut r.inner, r.limits.clone())
55163                    .map(|r| r.map(|t| Self::OperationResultCode(Box::new(t)))),
55164            ),
55165            TypeVariant::OperationResult => Box::new(
55166                ReadXdrIter::<_, OperationResult>::new(&mut r.inner, r.limits.clone())
55167                    .map(|r| r.map(|t| Self::OperationResult(Box::new(t)))),
55168            ),
55169            TypeVariant::OperationResultTr => Box::new(
55170                ReadXdrIter::<_, OperationResultTr>::new(&mut r.inner, r.limits.clone())
55171                    .map(|r| r.map(|t| Self::OperationResultTr(Box::new(t)))),
55172            ),
55173            TypeVariant::TransactionResultCode => Box::new(
55174                ReadXdrIter::<_, TransactionResultCode>::new(&mut r.inner, r.limits.clone())
55175                    .map(|r| r.map(|t| Self::TransactionResultCode(Box::new(t)))),
55176            ),
55177            TypeVariant::InnerTransactionResult => Box::new(
55178                ReadXdrIter::<_, InnerTransactionResult>::new(&mut r.inner, r.limits.clone())
55179                    .map(|r| r.map(|t| Self::InnerTransactionResult(Box::new(t)))),
55180            ),
55181            TypeVariant::InnerTransactionResultResult => Box::new(
55182                ReadXdrIter::<_, InnerTransactionResultResult>::new(&mut r.inner, r.limits.clone())
55183                    .map(|r| r.map(|t| Self::InnerTransactionResultResult(Box::new(t)))),
55184            ),
55185            TypeVariant::InnerTransactionResultExt => Box::new(
55186                ReadXdrIter::<_, InnerTransactionResultExt>::new(&mut r.inner, r.limits.clone())
55187                    .map(|r| r.map(|t| Self::InnerTransactionResultExt(Box::new(t)))),
55188            ),
55189            TypeVariant::InnerTransactionResultPair => Box::new(
55190                ReadXdrIter::<_, InnerTransactionResultPair>::new(&mut r.inner, r.limits.clone())
55191                    .map(|r| r.map(|t| Self::InnerTransactionResultPair(Box::new(t)))),
55192            ),
55193            TypeVariant::TransactionResult => Box::new(
55194                ReadXdrIter::<_, TransactionResult>::new(&mut r.inner, r.limits.clone())
55195                    .map(|r| r.map(|t| Self::TransactionResult(Box::new(t)))),
55196            ),
55197            TypeVariant::TransactionResultResult => Box::new(
55198                ReadXdrIter::<_, TransactionResultResult>::new(&mut r.inner, r.limits.clone())
55199                    .map(|r| r.map(|t| Self::TransactionResultResult(Box::new(t)))),
55200            ),
55201            TypeVariant::TransactionResultExt => Box::new(
55202                ReadXdrIter::<_, TransactionResultExt>::new(&mut r.inner, r.limits.clone())
55203                    .map(|r| r.map(|t| Self::TransactionResultExt(Box::new(t)))),
55204            ),
55205            TypeVariant::Hash => Box::new(
55206                ReadXdrIter::<_, Hash>::new(&mut r.inner, r.limits.clone())
55207                    .map(|r| r.map(|t| Self::Hash(Box::new(t)))),
55208            ),
55209            TypeVariant::Uint256 => Box::new(
55210                ReadXdrIter::<_, Uint256>::new(&mut r.inner, r.limits.clone())
55211                    .map(|r| r.map(|t| Self::Uint256(Box::new(t)))),
55212            ),
55213            TypeVariant::Uint32 => Box::new(
55214                ReadXdrIter::<_, Uint32>::new(&mut r.inner, r.limits.clone())
55215                    .map(|r| r.map(|t| Self::Uint32(Box::new(t)))),
55216            ),
55217            TypeVariant::Int32 => Box::new(
55218                ReadXdrIter::<_, Int32>::new(&mut r.inner, r.limits.clone())
55219                    .map(|r| r.map(|t| Self::Int32(Box::new(t)))),
55220            ),
55221            TypeVariant::Uint64 => Box::new(
55222                ReadXdrIter::<_, Uint64>::new(&mut r.inner, r.limits.clone())
55223                    .map(|r| r.map(|t| Self::Uint64(Box::new(t)))),
55224            ),
55225            TypeVariant::Int64 => Box::new(
55226                ReadXdrIter::<_, Int64>::new(&mut r.inner, r.limits.clone())
55227                    .map(|r| r.map(|t| Self::Int64(Box::new(t)))),
55228            ),
55229            TypeVariant::TimePoint => Box::new(
55230                ReadXdrIter::<_, TimePoint>::new(&mut r.inner, r.limits.clone())
55231                    .map(|r| r.map(|t| Self::TimePoint(Box::new(t)))),
55232            ),
55233            TypeVariant::Duration => Box::new(
55234                ReadXdrIter::<_, Duration>::new(&mut r.inner, r.limits.clone())
55235                    .map(|r| r.map(|t| Self::Duration(Box::new(t)))),
55236            ),
55237            TypeVariant::ExtensionPoint => Box::new(
55238                ReadXdrIter::<_, ExtensionPoint>::new(&mut r.inner, r.limits.clone())
55239                    .map(|r| r.map(|t| Self::ExtensionPoint(Box::new(t)))),
55240            ),
55241            TypeVariant::CryptoKeyType => Box::new(
55242                ReadXdrIter::<_, CryptoKeyType>::new(&mut r.inner, r.limits.clone())
55243                    .map(|r| r.map(|t| Self::CryptoKeyType(Box::new(t)))),
55244            ),
55245            TypeVariant::PublicKeyType => Box::new(
55246                ReadXdrIter::<_, PublicKeyType>::new(&mut r.inner, r.limits.clone())
55247                    .map(|r| r.map(|t| Self::PublicKeyType(Box::new(t)))),
55248            ),
55249            TypeVariant::SignerKeyType => Box::new(
55250                ReadXdrIter::<_, SignerKeyType>::new(&mut r.inner, r.limits.clone())
55251                    .map(|r| r.map(|t| Self::SignerKeyType(Box::new(t)))),
55252            ),
55253            TypeVariant::PublicKey => Box::new(
55254                ReadXdrIter::<_, PublicKey>::new(&mut r.inner, r.limits.clone())
55255                    .map(|r| r.map(|t| Self::PublicKey(Box::new(t)))),
55256            ),
55257            TypeVariant::SignerKey => Box::new(
55258                ReadXdrIter::<_, SignerKey>::new(&mut r.inner, r.limits.clone())
55259                    .map(|r| r.map(|t| Self::SignerKey(Box::new(t)))),
55260            ),
55261            TypeVariant::SignerKeyEd25519SignedPayload => Box::new(
55262                ReadXdrIter::<_, SignerKeyEd25519SignedPayload>::new(
55263                    &mut r.inner,
55264                    r.limits.clone(),
55265                )
55266                .map(|r| r.map(|t| Self::SignerKeyEd25519SignedPayload(Box::new(t)))),
55267            ),
55268            TypeVariant::Signature => Box::new(
55269                ReadXdrIter::<_, Signature>::new(&mut r.inner, r.limits.clone())
55270                    .map(|r| r.map(|t| Self::Signature(Box::new(t)))),
55271            ),
55272            TypeVariant::SignatureHint => Box::new(
55273                ReadXdrIter::<_, SignatureHint>::new(&mut r.inner, r.limits.clone())
55274                    .map(|r| r.map(|t| Self::SignatureHint(Box::new(t)))),
55275            ),
55276            TypeVariant::NodeId => Box::new(
55277                ReadXdrIter::<_, NodeId>::new(&mut r.inner, r.limits.clone())
55278                    .map(|r| r.map(|t| Self::NodeId(Box::new(t)))),
55279            ),
55280            TypeVariant::AccountId => Box::new(
55281                ReadXdrIter::<_, AccountId>::new(&mut r.inner, r.limits.clone())
55282                    .map(|r| r.map(|t| Self::AccountId(Box::new(t)))),
55283            ),
55284            TypeVariant::Curve25519Secret => Box::new(
55285                ReadXdrIter::<_, Curve25519Secret>::new(&mut r.inner, r.limits.clone())
55286                    .map(|r| r.map(|t| Self::Curve25519Secret(Box::new(t)))),
55287            ),
55288            TypeVariant::Curve25519Public => Box::new(
55289                ReadXdrIter::<_, Curve25519Public>::new(&mut r.inner, r.limits.clone())
55290                    .map(|r| r.map(|t| Self::Curve25519Public(Box::new(t)))),
55291            ),
55292            TypeVariant::HmacSha256Key => Box::new(
55293                ReadXdrIter::<_, HmacSha256Key>::new(&mut r.inner, r.limits.clone())
55294                    .map(|r| r.map(|t| Self::HmacSha256Key(Box::new(t)))),
55295            ),
55296            TypeVariant::HmacSha256Mac => Box::new(
55297                ReadXdrIter::<_, HmacSha256Mac>::new(&mut r.inner, r.limits.clone())
55298                    .map(|r| r.map(|t| Self::HmacSha256Mac(Box::new(t)))),
55299            ),
55300            TypeVariant::ShortHashSeed => Box::new(
55301                ReadXdrIter::<_, ShortHashSeed>::new(&mut r.inner, r.limits.clone())
55302                    .map(|r| r.map(|t| Self::ShortHashSeed(Box::new(t)))),
55303            ),
55304            TypeVariant::BinaryFuseFilterType => Box::new(
55305                ReadXdrIter::<_, BinaryFuseFilterType>::new(&mut r.inner, r.limits.clone())
55306                    .map(|r| r.map(|t| Self::BinaryFuseFilterType(Box::new(t)))),
55307            ),
55308            TypeVariant::SerializedBinaryFuseFilter => Box::new(
55309                ReadXdrIter::<_, SerializedBinaryFuseFilter>::new(&mut r.inner, r.limits.clone())
55310                    .map(|r| r.map(|t| Self::SerializedBinaryFuseFilter(Box::new(t)))),
55311            ),
55312        }
55313    }
55314
55315    #[cfg(feature = "std")]
55316    #[allow(clippy::too_many_lines)]
55317    pub fn read_xdr_framed_iter<R: Read>(
55318        v: TypeVariant,
55319        r: &mut Limited<R>,
55320    ) -> Box<dyn Iterator<Item = Result<Self>> + '_> {
55321        match v {
55322            TypeVariant::Value => Box::new(
55323                ReadXdrIter::<_, Frame<Value>>::new(&mut r.inner, r.limits.clone())
55324                    .map(|r| r.map(|t| Self::Value(Box::new(t.0)))),
55325            ),
55326            TypeVariant::ScpBallot => Box::new(
55327                ReadXdrIter::<_, Frame<ScpBallot>>::new(&mut r.inner, r.limits.clone())
55328                    .map(|r| r.map(|t| Self::ScpBallot(Box::new(t.0)))),
55329            ),
55330            TypeVariant::ScpStatementType => Box::new(
55331                ReadXdrIter::<_, Frame<ScpStatementType>>::new(&mut r.inner, r.limits.clone())
55332                    .map(|r| r.map(|t| Self::ScpStatementType(Box::new(t.0)))),
55333            ),
55334            TypeVariant::ScpNomination => Box::new(
55335                ReadXdrIter::<_, Frame<ScpNomination>>::new(&mut r.inner, r.limits.clone())
55336                    .map(|r| r.map(|t| Self::ScpNomination(Box::new(t.0)))),
55337            ),
55338            TypeVariant::ScpStatement => Box::new(
55339                ReadXdrIter::<_, Frame<ScpStatement>>::new(&mut r.inner, r.limits.clone())
55340                    .map(|r| r.map(|t| Self::ScpStatement(Box::new(t.0)))),
55341            ),
55342            TypeVariant::ScpStatementPledges => Box::new(
55343                ReadXdrIter::<_, Frame<ScpStatementPledges>>::new(&mut r.inner, r.limits.clone())
55344                    .map(|r| r.map(|t| Self::ScpStatementPledges(Box::new(t.0)))),
55345            ),
55346            TypeVariant::ScpStatementPrepare => Box::new(
55347                ReadXdrIter::<_, Frame<ScpStatementPrepare>>::new(&mut r.inner, r.limits.clone())
55348                    .map(|r| r.map(|t| Self::ScpStatementPrepare(Box::new(t.0)))),
55349            ),
55350            TypeVariant::ScpStatementConfirm => Box::new(
55351                ReadXdrIter::<_, Frame<ScpStatementConfirm>>::new(&mut r.inner, r.limits.clone())
55352                    .map(|r| r.map(|t| Self::ScpStatementConfirm(Box::new(t.0)))),
55353            ),
55354            TypeVariant::ScpStatementExternalize => Box::new(
55355                ReadXdrIter::<_, Frame<ScpStatementExternalize>>::new(
55356                    &mut r.inner,
55357                    r.limits.clone(),
55358                )
55359                .map(|r| r.map(|t| Self::ScpStatementExternalize(Box::new(t.0)))),
55360            ),
55361            TypeVariant::ScpEnvelope => Box::new(
55362                ReadXdrIter::<_, Frame<ScpEnvelope>>::new(&mut r.inner, r.limits.clone())
55363                    .map(|r| r.map(|t| Self::ScpEnvelope(Box::new(t.0)))),
55364            ),
55365            TypeVariant::ScpQuorumSet => Box::new(
55366                ReadXdrIter::<_, Frame<ScpQuorumSet>>::new(&mut r.inner, r.limits.clone())
55367                    .map(|r| r.map(|t| Self::ScpQuorumSet(Box::new(t.0)))),
55368            ),
55369            TypeVariant::ConfigSettingContractExecutionLanesV0 => Box::new(
55370                ReadXdrIter::<_, Frame<ConfigSettingContractExecutionLanesV0>>::new(
55371                    &mut r.inner,
55372                    r.limits.clone(),
55373                )
55374                .map(|r| r.map(|t| Self::ConfigSettingContractExecutionLanesV0(Box::new(t.0)))),
55375            ),
55376            TypeVariant::ConfigSettingContractComputeV0 => Box::new(
55377                ReadXdrIter::<_, Frame<ConfigSettingContractComputeV0>>::new(
55378                    &mut r.inner,
55379                    r.limits.clone(),
55380                )
55381                .map(|r| r.map(|t| Self::ConfigSettingContractComputeV0(Box::new(t.0)))),
55382            ),
55383            TypeVariant::ConfigSettingContractParallelComputeV0 => Box::new(
55384                ReadXdrIter::<_, Frame<ConfigSettingContractParallelComputeV0>>::new(
55385                    &mut r.inner,
55386                    r.limits.clone(),
55387                )
55388                .map(|r| r.map(|t| Self::ConfigSettingContractParallelComputeV0(Box::new(t.0)))),
55389            ),
55390            TypeVariant::ConfigSettingContractLedgerCostV0 => Box::new(
55391                ReadXdrIter::<_, Frame<ConfigSettingContractLedgerCostV0>>::new(
55392                    &mut r.inner,
55393                    r.limits.clone(),
55394                )
55395                .map(|r| r.map(|t| Self::ConfigSettingContractLedgerCostV0(Box::new(t.0)))),
55396            ),
55397            TypeVariant::ConfigSettingContractHistoricalDataV0 => Box::new(
55398                ReadXdrIter::<_, Frame<ConfigSettingContractHistoricalDataV0>>::new(
55399                    &mut r.inner,
55400                    r.limits.clone(),
55401                )
55402                .map(|r| r.map(|t| Self::ConfigSettingContractHistoricalDataV0(Box::new(t.0)))),
55403            ),
55404            TypeVariant::ConfigSettingContractEventsV0 => Box::new(
55405                ReadXdrIter::<_, Frame<ConfigSettingContractEventsV0>>::new(
55406                    &mut r.inner,
55407                    r.limits.clone(),
55408                )
55409                .map(|r| r.map(|t| Self::ConfigSettingContractEventsV0(Box::new(t.0)))),
55410            ),
55411            TypeVariant::ConfigSettingContractBandwidthV0 => Box::new(
55412                ReadXdrIter::<_, Frame<ConfigSettingContractBandwidthV0>>::new(
55413                    &mut r.inner,
55414                    r.limits.clone(),
55415                )
55416                .map(|r| r.map(|t| Self::ConfigSettingContractBandwidthV0(Box::new(t.0)))),
55417            ),
55418            TypeVariant::ContractCostType => Box::new(
55419                ReadXdrIter::<_, Frame<ContractCostType>>::new(&mut r.inner, r.limits.clone())
55420                    .map(|r| r.map(|t| Self::ContractCostType(Box::new(t.0)))),
55421            ),
55422            TypeVariant::ContractCostParamEntry => Box::new(
55423                ReadXdrIter::<_, Frame<ContractCostParamEntry>>::new(
55424                    &mut r.inner,
55425                    r.limits.clone(),
55426                )
55427                .map(|r| r.map(|t| Self::ContractCostParamEntry(Box::new(t.0)))),
55428            ),
55429            TypeVariant::StateArchivalSettings => Box::new(
55430                ReadXdrIter::<_, Frame<StateArchivalSettings>>::new(&mut r.inner, r.limits.clone())
55431                    .map(|r| r.map(|t| Self::StateArchivalSettings(Box::new(t.0)))),
55432            ),
55433            TypeVariant::EvictionIterator => Box::new(
55434                ReadXdrIter::<_, Frame<EvictionIterator>>::new(&mut r.inner, r.limits.clone())
55435                    .map(|r| r.map(|t| Self::EvictionIterator(Box::new(t.0)))),
55436            ),
55437            TypeVariant::ContractCostParams => Box::new(
55438                ReadXdrIter::<_, Frame<ContractCostParams>>::new(&mut r.inner, r.limits.clone())
55439                    .map(|r| r.map(|t| Self::ContractCostParams(Box::new(t.0)))),
55440            ),
55441            TypeVariant::ConfigSettingId => Box::new(
55442                ReadXdrIter::<_, Frame<ConfigSettingId>>::new(&mut r.inner, r.limits.clone())
55443                    .map(|r| r.map(|t| Self::ConfigSettingId(Box::new(t.0)))),
55444            ),
55445            TypeVariant::ConfigSettingEntry => Box::new(
55446                ReadXdrIter::<_, Frame<ConfigSettingEntry>>::new(&mut r.inner, r.limits.clone())
55447                    .map(|r| r.map(|t| Self::ConfigSettingEntry(Box::new(t.0)))),
55448            ),
55449            TypeVariant::ScEnvMetaKind => Box::new(
55450                ReadXdrIter::<_, Frame<ScEnvMetaKind>>::new(&mut r.inner, r.limits.clone())
55451                    .map(|r| r.map(|t| Self::ScEnvMetaKind(Box::new(t.0)))),
55452            ),
55453            TypeVariant::ScEnvMetaEntry => Box::new(
55454                ReadXdrIter::<_, Frame<ScEnvMetaEntry>>::new(&mut r.inner, r.limits.clone())
55455                    .map(|r| r.map(|t| Self::ScEnvMetaEntry(Box::new(t.0)))),
55456            ),
55457            TypeVariant::ScEnvMetaEntryInterfaceVersion => Box::new(
55458                ReadXdrIter::<_, Frame<ScEnvMetaEntryInterfaceVersion>>::new(
55459                    &mut r.inner,
55460                    r.limits.clone(),
55461                )
55462                .map(|r| r.map(|t| Self::ScEnvMetaEntryInterfaceVersion(Box::new(t.0)))),
55463            ),
55464            TypeVariant::ScMetaV0 => Box::new(
55465                ReadXdrIter::<_, Frame<ScMetaV0>>::new(&mut r.inner, r.limits.clone())
55466                    .map(|r| r.map(|t| Self::ScMetaV0(Box::new(t.0)))),
55467            ),
55468            TypeVariant::ScMetaKind => Box::new(
55469                ReadXdrIter::<_, Frame<ScMetaKind>>::new(&mut r.inner, r.limits.clone())
55470                    .map(|r| r.map(|t| Self::ScMetaKind(Box::new(t.0)))),
55471            ),
55472            TypeVariant::ScMetaEntry => Box::new(
55473                ReadXdrIter::<_, Frame<ScMetaEntry>>::new(&mut r.inner, r.limits.clone())
55474                    .map(|r| r.map(|t| Self::ScMetaEntry(Box::new(t.0)))),
55475            ),
55476            TypeVariant::ScSpecType => Box::new(
55477                ReadXdrIter::<_, Frame<ScSpecType>>::new(&mut r.inner, r.limits.clone())
55478                    .map(|r| r.map(|t| Self::ScSpecType(Box::new(t.0)))),
55479            ),
55480            TypeVariant::ScSpecTypeOption => Box::new(
55481                ReadXdrIter::<_, Frame<ScSpecTypeOption>>::new(&mut r.inner, r.limits.clone())
55482                    .map(|r| r.map(|t| Self::ScSpecTypeOption(Box::new(t.0)))),
55483            ),
55484            TypeVariant::ScSpecTypeResult => Box::new(
55485                ReadXdrIter::<_, Frame<ScSpecTypeResult>>::new(&mut r.inner, r.limits.clone())
55486                    .map(|r| r.map(|t| Self::ScSpecTypeResult(Box::new(t.0)))),
55487            ),
55488            TypeVariant::ScSpecTypeVec => Box::new(
55489                ReadXdrIter::<_, Frame<ScSpecTypeVec>>::new(&mut r.inner, r.limits.clone())
55490                    .map(|r| r.map(|t| Self::ScSpecTypeVec(Box::new(t.0)))),
55491            ),
55492            TypeVariant::ScSpecTypeMap => Box::new(
55493                ReadXdrIter::<_, Frame<ScSpecTypeMap>>::new(&mut r.inner, r.limits.clone())
55494                    .map(|r| r.map(|t| Self::ScSpecTypeMap(Box::new(t.0)))),
55495            ),
55496            TypeVariant::ScSpecTypeTuple => Box::new(
55497                ReadXdrIter::<_, Frame<ScSpecTypeTuple>>::new(&mut r.inner, r.limits.clone())
55498                    .map(|r| r.map(|t| Self::ScSpecTypeTuple(Box::new(t.0)))),
55499            ),
55500            TypeVariant::ScSpecTypeBytesN => Box::new(
55501                ReadXdrIter::<_, Frame<ScSpecTypeBytesN>>::new(&mut r.inner, r.limits.clone())
55502                    .map(|r| r.map(|t| Self::ScSpecTypeBytesN(Box::new(t.0)))),
55503            ),
55504            TypeVariant::ScSpecTypeUdt => Box::new(
55505                ReadXdrIter::<_, Frame<ScSpecTypeUdt>>::new(&mut r.inner, r.limits.clone())
55506                    .map(|r| r.map(|t| Self::ScSpecTypeUdt(Box::new(t.0)))),
55507            ),
55508            TypeVariant::ScSpecTypeDef => Box::new(
55509                ReadXdrIter::<_, Frame<ScSpecTypeDef>>::new(&mut r.inner, r.limits.clone())
55510                    .map(|r| r.map(|t| Self::ScSpecTypeDef(Box::new(t.0)))),
55511            ),
55512            TypeVariant::ScSpecUdtStructFieldV0 => Box::new(
55513                ReadXdrIter::<_, Frame<ScSpecUdtStructFieldV0>>::new(
55514                    &mut r.inner,
55515                    r.limits.clone(),
55516                )
55517                .map(|r| r.map(|t| Self::ScSpecUdtStructFieldV0(Box::new(t.0)))),
55518            ),
55519            TypeVariant::ScSpecUdtStructV0 => Box::new(
55520                ReadXdrIter::<_, Frame<ScSpecUdtStructV0>>::new(&mut r.inner, r.limits.clone())
55521                    .map(|r| r.map(|t| Self::ScSpecUdtStructV0(Box::new(t.0)))),
55522            ),
55523            TypeVariant::ScSpecUdtUnionCaseVoidV0 => Box::new(
55524                ReadXdrIter::<_, Frame<ScSpecUdtUnionCaseVoidV0>>::new(
55525                    &mut r.inner,
55526                    r.limits.clone(),
55527                )
55528                .map(|r| r.map(|t| Self::ScSpecUdtUnionCaseVoidV0(Box::new(t.0)))),
55529            ),
55530            TypeVariant::ScSpecUdtUnionCaseTupleV0 => Box::new(
55531                ReadXdrIter::<_, Frame<ScSpecUdtUnionCaseTupleV0>>::new(
55532                    &mut r.inner,
55533                    r.limits.clone(),
55534                )
55535                .map(|r| r.map(|t| Self::ScSpecUdtUnionCaseTupleV0(Box::new(t.0)))),
55536            ),
55537            TypeVariant::ScSpecUdtUnionCaseV0Kind => Box::new(
55538                ReadXdrIter::<_, Frame<ScSpecUdtUnionCaseV0Kind>>::new(
55539                    &mut r.inner,
55540                    r.limits.clone(),
55541                )
55542                .map(|r| r.map(|t| Self::ScSpecUdtUnionCaseV0Kind(Box::new(t.0)))),
55543            ),
55544            TypeVariant::ScSpecUdtUnionCaseV0 => Box::new(
55545                ReadXdrIter::<_, Frame<ScSpecUdtUnionCaseV0>>::new(&mut r.inner, r.limits.clone())
55546                    .map(|r| r.map(|t| Self::ScSpecUdtUnionCaseV0(Box::new(t.0)))),
55547            ),
55548            TypeVariant::ScSpecUdtUnionV0 => Box::new(
55549                ReadXdrIter::<_, Frame<ScSpecUdtUnionV0>>::new(&mut r.inner, r.limits.clone())
55550                    .map(|r| r.map(|t| Self::ScSpecUdtUnionV0(Box::new(t.0)))),
55551            ),
55552            TypeVariant::ScSpecUdtEnumCaseV0 => Box::new(
55553                ReadXdrIter::<_, Frame<ScSpecUdtEnumCaseV0>>::new(&mut r.inner, r.limits.clone())
55554                    .map(|r| r.map(|t| Self::ScSpecUdtEnumCaseV0(Box::new(t.0)))),
55555            ),
55556            TypeVariant::ScSpecUdtEnumV0 => Box::new(
55557                ReadXdrIter::<_, Frame<ScSpecUdtEnumV0>>::new(&mut r.inner, r.limits.clone())
55558                    .map(|r| r.map(|t| Self::ScSpecUdtEnumV0(Box::new(t.0)))),
55559            ),
55560            TypeVariant::ScSpecUdtErrorEnumCaseV0 => Box::new(
55561                ReadXdrIter::<_, Frame<ScSpecUdtErrorEnumCaseV0>>::new(
55562                    &mut r.inner,
55563                    r.limits.clone(),
55564                )
55565                .map(|r| r.map(|t| Self::ScSpecUdtErrorEnumCaseV0(Box::new(t.0)))),
55566            ),
55567            TypeVariant::ScSpecUdtErrorEnumV0 => Box::new(
55568                ReadXdrIter::<_, Frame<ScSpecUdtErrorEnumV0>>::new(&mut r.inner, r.limits.clone())
55569                    .map(|r| r.map(|t| Self::ScSpecUdtErrorEnumV0(Box::new(t.0)))),
55570            ),
55571            TypeVariant::ScSpecFunctionInputV0 => Box::new(
55572                ReadXdrIter::<_, Frame<ScSpecFunctionInputV0>>::new(&mut r.inner, r.limits.clone())
55573                    .map(|r| r.map(|t| Self::ScSpecFunctionInputV0(Box::new(t.0)))),
55574            ),
55575            TypeVariant::ScSpecFunctionV0 => Box::new(
55576                ReadXdrIter::<_, Frame<ScSpecFunctionV0>>::new(&mut r.inner, r.limits.clone())
55577                    .map(|r| r.map(|t| Self::ScSpecFunctionV0(Box::new(t.0)))),
55578            ),
55579            TypeVariant::ScSpecEntryKind => Box::new(
55580                ReadXdrIter::<_, Frame<ScSpecEntryKind>>::new(&mut r.inner, r.limits.clone())
55581                    .map(|r| r.map(|t| Self::ScSpecEntryKind(Box::new(t.0)))),
55582            ),
55583            TypeVariant::ScSpecEntry => Box::new(
55584                ReadXdrIter::<_, Frame<ScSpecEntry>>::new(&mut r.inner, r.limits.clone())
55585                    .map(|r| r.map(|t| Self::ScSpecEntry(Box::new(t.0)))),
55586            ),
55587            TypeVariant::ScValType => Box::new(
55588                ReadXdrIter::<_, Frame<ScValType>>::new(&mut r.inner, r.limits.clone())
55589                    .map(|r| r.map(|t| Self::ScValType(Box::new(t.0)))),
55590            ),
55591            TypeVariant::ScErrorType => Box::new(
55592                ReadXdrIter::<_, Frame<ScErrorType>>::new(&mut r.inner, r.limits.clone())
55593                    .map(|r| r.map(|t| Self::ScErrorType(Box::new(t.0)))),
55594            ),
55595            TypeVariant::ScErrorCode => Box::new(
55596                ReadXdrIter::<_, Frame<ScErrorCode>>::new(&mut r.inner, r.limits.clone())
55597                    .map(|r| r.map(|t| Self::ScErrorCode(Box::new(t.0)))),
55598            ),
55599            TypeVariant::ScError => Box::new(
55600                ReadXdrIter::<_, Frame<ScError>>::new(&mut r.inner, r.limits.clone())
55601                    .map(|r| r.map(|t| Self::ScError(Box::new(t.0)))),
55602            ),
55603            TypeVariant::UInt128Parts => Box::new(
55604                ReadXdrIter::<_, Frame<UInt128Parts>>::new(&mut r.inner, r.limits.clone())
55605                    .map(|r| r.map(|t| Self::UInt128Parts(Box::new(t.0)))),
55606            ),
55607            TypeVariant::Int128Parts => Box::new(
55608                ReadXdrIter::<_, Frame<Int128Parts>>::new(&mut r.inner, r.limits.clone())
55609                    .map(|r| r.map(|t| Self::Int128Parts(Box::new(t.0)))),
55610            ),
55611            TypeVariant::UInt256Parts => Box::new(
55612                ReadXdrIter::<_, Frame<UInt256Parts>>::new(&mut r.inner, r.limits.clone())
55613                    .map(|r| r.map(|t| Self::UInt256Parts(Box::new(t.0)))),
55614            ),
55615            TypeVariant::Int256Parts => Box::new(
55616                ReadXdrIter::<_, Frame<Int256Parts>>::new(&mut r.inner, r.limits.clone())
55617                    .map(|r| r.map(|t| Self::Int256Parts(Box::new(t.0)))),
55618            ),
55619            TypeVariant::ContractExecutableType => Box::new(
55620                ReadXdrIter::<_, Frame<ContractExecutableType>>::new(
55621                    &mut r.inner,
55622                    r.limits.clone(),
55623                )
55624                .map(|r| r.map(|t| Self::ContractExecutableType(Box::new(t.0)))),
55625            ),
55626            TypeVariant::ContractExecutable => Box::new(
55627                ReadXdrIter::<_, Frame<ContractExecutable>>::new(&mut r.inner, r.limits.clone())
55628                    .map(|r| r.map(|t| Self::ContractExecutable(Box::new(t.0)))),
55629            ),
55630            TypeVariant::ScAddressType => Box::new(
55631                ReadXdrIter::<_, Frame<ScAddressType>>::new(&mut r.inner, r.limits.clone())
55632                    .map(|r| r.map(|t| Self::ScAddressType(Box::new(t.0)))),
55633            ),
55634            TypeVariant::ScAddress => Box::new(
55635                ReadXdrIter::<_, Frame<ScAddress>>::new(&mut r.inner, r.limits.clone())
55636                    .map(|r| r.map(|t| Self::ScAddress(Box::new(t.0)))),
55637            ),
55638            TypeVariant::ScVec => Box::new(
55639                ReadXdrIter::<_, Frame<ScVec>>::new(&mut r.inner, r.limits.clone())
55640                    .map(|r| r.map(|t| Self::ScVec(Box::new(t.0)))),
55641            ),
55642            TypeVariant::ScMap => Box::new(
55643                ReadXdrIter::<_, Frame<ScMap>>::new(&mut r.inner, r.limits.clone())
55644                    .map(|r| r.map(|t| Self::ScMap(Box::new(t.0)))),
55645            ),
55646            TypeVariant::ScBytes => Box::new(
55647                ReadXdrIter::<_, Frame<ScBytes>>::new(&mut r.inner, r.limits.clone())
55648                    .map(|r| r.map(|t| Self::ScBytes(Box::new(t.0)))),
55649            ),
55650            TypeVariant::ScString => Box::new(
55651                ReadXdrIter::<_, Frame<ScString>>::new(&mut r.inner, r.limits.clone())
55652                    .map(|r| r.map(|t| Self::ScString(Box::new(t.0)))),
55653            ),
55654            TypeVariant::ScSymbol => Box::new(
55655                ReadXdrIter::<_, Frame<ScSymbol>>::new(&mut r.inner, r.limits.clone())
55656                    .map(|r| r.map(|t| Self::ScSymbol(Box::new(t.0)))),
55657            ),
55658            TypeVariant::ScNonceKey => Box::new(
55659                ReadXdrIter::<_, Frame<ScNonceKey>>::new(&mut r.inner, r.limits.clone())
55660                    .map(|r| r.map(|t| Self::ScNonceKey(Box::new(t.0)))),
55661            ),
55662            TypeVariant::ScContractInstance => Box::new(
55663                ReadXdrIter::<_, Frame<ScContractInstance>>::new(&mut r.inner, r.limits.clone())
55664                    .map(|r| r.map(|t| Self::ScContractInstance(Box::new(t.0)))),
55665            ),
55666            TypeVariant::ScVal => Box::new(
55667                ReadXdrIter::<_, Frame<ScVal>>::new(&mut r.inner, r.limits.clone())
55668                    .map(|r| r.map(|t| Self::ScVal(Box::new(t.0)))),
55669            ),
55670            TypeVariant::ScMapEntry => Box::new(
55671                ReadXdrIter::<_, Frame<ScMapEntry>>::new(&mut r.inner, r.limits.clone())
55672                    .map(|r| r.map(|t| Self::ScMapEntry(Box::new(t.0)))),
55673            ),
55674            TypeVariant::StoredTransactionSet => Box::new(
55675                ReadXdrIter::<_, Frame<StoredTransactionSet>>::new(&mut r.inner, r.limits.clone())
55676                    .map(|r| r.map(|t| Self::StoredTransactionSet(Box::new(t.0)))),
55677            ),
55678            TypeVariant::StoredDebugTransactionSet => Box::new(
55679                ReadXdrIter::<_, Frame<StoredDebugTransactionSet>>::new(
55680                    &mut r.inner,
55681                    r.limits.clone(),
55682                )
55683                .map(|r| r.map(|t| Self::StoredDebugTransactionSet(Box::new(t.0)))),
55684            ),
55685            TypeVariant::PersistedScpStateV0 => Box::new(
55686                ReadXdrIter::<_, Frame<PersistedScpStateV0>>::new(&mut r.inner, r.limits.clone())
55687                    .map(|r| r.map(|t| Self::PersistedScpStateV0(Box::new(t.0)))),
55688            ),
55689            TypeVariant::PersistedScpStateV1 => Box::new(
55690                ReadXdrIter::<_, Frame<PersistedScpStateV1>>::new(&mut r.inner, r.limits.clone())
55691                    .map(|r| r.map(|t| Self::PersistedScpStateV1(Box::new(t.0)))),
55692            ),
55693            TypeVariant::PersistedScpState => Box::new(
55694                ReadXdrIter::<_, Frame<PersistedScpState>>::new(&mut r.inner, r.limits.clone())
55695                    .map(|r| r.map(|t| Self::PersistedScpState(Box::new(t.0)))),
55696            ),
55697            TypeVariant::Thresholds => Box::new(
55698                ReadXdrIter::<_, Frame<Thresholds>>::new(&mut r.inner, r.limits.clone())
55699                    .map(|r| r.map(|t| Self::Thresholds(Box::new(t.0)))),
55700            ),
55701            TypeVariant::String32 => Box::new(
55702                ReadXdrIter::<_, Frame<String32>>::new(&mut r.inner, r.limits.clone())
55703                    .map(|r| r.map(|t| Self::String32(Box::new(t.0)))),
55704            ),
55705            TypeVariant::String64 => Box::new(
55706                ReadXdrIter::<_, Frame<String64>>::new(&mut r.inner, r.limits.clone())
55707                    .map(|r| r.map(|t| Self::String64(Box::new(t.0)))),
55708            ),
55709            TypeVariant::SequenceNumber => Box::new(
55710                ReadXdrIter::<_, Frame<SequenceNumber>>::new(&mut r.inner, r.limits.clone())
55711                    .map(|r| r.map(|t| Self::SequenceNumber(Box::new(t.0)))),
55712            ),
55713            TypeVariant::DataValue => Box::new(
55714                ReadXdrIter::<_, Frame<DataValue>>::new(&mut r.inner, r.limits.clone())
55715                    .map(|r| r.map(|t| Self::DataValue(Box::new(t.0)))),
55716            ),
55717            TypeVariant::PoolId => Box::new(
55718                ReadXdrIter::<_, Frame<PoolId>>::new(&mut r.inner, r.limits.clone())
55719                    .map(|r| r.map(|t| Self::PoolId(Box::new(t.0)))),
55720            ),
55721            TypeVariant::AssetCode4 => Box::new(
55722                ReadXdrIter::<_, Frame<AssetCode4>>::new(&mut r.inner, r.limits.clone())
55723                    .map(|r| r.map(|t| Self::AssetCode4(Box::new(t.0)))),
55724            ),
55725            TypeVariant::AssetCode12 => Box::new(
55726                ReadXdrIter::<_, Frame<AssetCode12>>::new(&mut r.inner, r.limits.clone())
55727                    .map(|r| r.map(|t| Self::AssetCode12(Box::new(t.0)))),
55728            ),
55729            TypeVariant::AssetType => Box::new(
55730                ReadXdrIter::<_, Frame<AssetType>>::new(&mut r.inner, r.limits.clone())
55731                    .map(|r| r.map(|t| Self::AssetType(Box::new(t.0)))),
55732            ),
55733            TypeVariant::AssetCode => Box::new(
55734                ReadXdrIter::<_, Frame<AssetCode>>::new(&mut r.inner, r.limits.clone())
55735                    .map(|r| r.map(|t| Self::AssetCode(Box::new(t.0)))),
55736            ),
55737            TypeVariant::AlphaNum4 => Box::new(
55738                ReadXdrIter::<_, Frame<AlphaNum4>>::new(&mut r.inner, r.limits.clone())
55739                    .map(|r| r.map(|t| Self::AlphaNum4(Box::new(t.0)))),
55740            ),
55741            TypeVariant::AlphaNum12 => Box::new(
55742                ReadXdrIter::<_, Frame<AlphaNum12>>::new(&mut r.inner, r.limits.clone())
55743                    .map(|r| r.map(|t| Self::AlphaNum12(Box::new(t.0)))),
55744            ),
55745            TypeVariant::Asset => Box::new(
55746                ReadXdrIter::<_, Frame<Asset>>::new(&mut r.inner, r.limits.clone())
55747                    .map(|r| r.map(|t| Self::Asset(Box::new(t.0)))),
55748            ),
55749            TypeVariant::Price => Box::new(
55750                ReadXdrIter::<_, Frame<Price>>::new(&mut r.inner, r.limits.clone())
55751                    .map(|r| r.map(|t| Self::Price(Box::new(t.0)))),
55752            ),
55753            TypeVariant::Liabilities => Box::new(
55754                ReadXdrIter::<_, Frame<Liabilities>>::new(&mut r.inner, r.limits.clone())
55755                    .map(|r| r.map(|t| Self::Liabilities(Box::new(t.0)))),
55756            ),
55757            TypeVariant::ThresholdIndexes => Box::new(
55758                ReadXdrIter::<_, Frame<ThresholdIndexes>>::new(&mut r.inner, r.limits.clone())
55759                    .map(|r| r.map(|t| Self::ThresholdIndexes(Box::new(t.0)))),
55760            ),
55761            TypeVariant::LedgerEntryType => Box::new(
55762                ReadXdrIter::<_, Frame<LedgerEntryType>>::new(&mut r.inner, r.limits.clone())
55763                    .map(|r| r.map(|t| Self::LedgerEntryType(Box::new(t.0)))),
55764            ),
55765            TypeVariant::Signer => Box::new(
55766                ReadXdrIter::<_, Frame<Signer>>::new(&mut r.inner, r.limits.clone())
55767                    .map(|r| r.map(|t| Self::Signer(Box::new(t.0)))),
55768            ),
55769            TypeVariant::AccountFlags => Box::new(
55770                ReadXdrIter::<_, Frame<AccountFlags>>::new(&mut r.inner, r.limits.clone())
55771                    .map(|r| r.map(|t| Self::AccountFlags(Box::new(t.0)))),
55772            ),
55773            TypeVariant::SponsorshipDescriptor => Box::new(
55774                ReadXdrIter::<_, Frame<SponsorshipDescriptor>>::new(&mut r.inner, r.limits.clone())
55775                    .map(|r| r.map(|t| Self::SponsorshipDescriptor(Box::new(t.0)))),
55776            ),
55777            TypeVariant::AccountEntryExtensionV3 => Box::new(
55778                ReadXdrIter::<_, Frame<AccountEntryExtensionV3>>::new(
55779                    &mut r.inner,
55780                    r.limits.clone(),
55781                )
55782                .map(|r| r.map(|t| Self::AccountEntryExtensionV3(Box::new(t.0)))),
55783            ),
55784            TypeVariant::AccountEntryExtensionV2 => Box::new(
55785                ReadXdrIter::<_, Frame<AccountEntryExtensionV2>>::new(
55786                    &mut r.inner,
55787                    r.limits.clone(),
55788                )
55789                .map(|r| r.map(|t| Self::AccountEntryExtensionV2(Box::new(t.0)))),
55790            ),
55791            TypeVariant::AccountEntryExtensionV2Ext => Box::new(
55792                ReadXdrIter::<_, Frame<AccountEntryExtensionV2Ext>>::new(
55793                    &mut r.inner,
55794                    r.limits.clone(),
55795                )
55796                .map(|r| r.map(|t| Self::AccountEntryExtensionV2Ext(Box::new(t.0)))),
55797            ),
55798            TypeVariant::AccountEntryExtensionV1 => Box::new(
55799                ReadXdrIter::<_, Frame<AccountEntryExtensionV1>>::new(
55800                    &mut r.inner,
55801                    r.limits.clone(),
55802                )
55803                .map(|r| r.map(|t| Self::AccountEntryExtensionV1(Box::new(t.0)))),
55804            ),
55805            TypeVariant::AccountEntryExtensionV1Ext => Box::new(
55806                ReadXdrIter::<_, Frame<AccountEntryExtensionV1Ext>>::new(
55807                    &mut r.inner,
55808                    r.limits.clone(),
55809                )
55810                .map(|r| r.map(|t| Self::AccountEntryExtensionV1Ext(Box::new(t.0)))),
55811            ),
55812            TypeVariant::AccountEntry => Box::new(
55813                ReadXdrIter::<_, Frame<AccountEntry>>::new(&mut r.inner, r.limits.clone())
55814                    .map(|r| r.map(|t| Self::AccountEntry(Box::new(t.0)))),
55815            ),
55816            TypeVariant::AccountEntryExt => Box::new(
55817                ReadXdrIter::<_, Frame<AccountEntryExt>>::new(&mut r.inner, r.limits.clone())
55818                    .map(|r| r.map(|t| Self::AccountEntryExt(Box::new(t.0)))),
55819            ),
55820            TypeVariant::TrustLineFlags => Box::new(
55821                ReadXdrIter::<_, Frame<TrustLineFlags>>::new(&mut r.inner, r.limits.clone())
55822                    .map(|r| r.map(|t| Self::TrustLineFlags(Box::new(t.0)))),
55823            ),
55824            TypeVariant::LiquidityPoolType => Box::new(
55825                ReadXdrIter::<_, Frame<LiquidityPoolType>>::new(&mut r.inner, r.limits.clone())
55826                    .map(|r| r.map(|t| Self::LiquidityPoolType(Box::new(t.0)))),
55827            ),
55828            TypeVariant::TrustLineAsset => Box::new(
55829                ReadXdrIter::<_, Frame<TrustLineAsset>>::new(&mut r.inner, r.limits.clone())
55830                    .map(|r| r.map(|t| Self::TrustLineAsset(Box::new(t.0)))),
55831            ),
55832            TypeVariant::TrustLineEntryExtensionV2 => Box::new(
55833                ReadXdrIter::<_, Frame<TrustLineEntryExtensionV2>>::new(
55834                    &mut r.inner,
55835                    r.limits.clone(),
55836                )
55837                .map(|r| r.map(|t| Self::TrustLineEntryExtensionV2(Box::new(t.0)))),
55838            ),
55839            TypeVariant::TrustLineEntryExtensionV2Ext => Box::new(
55840                ReadXdrIter::<_, Frame<TrustLineEntryExtensionV2Ext>>::new(
55841                    &mut r.inner,
55842                    r.limits.clone(),
55843                )
55844                .map(|r| r.map(|t| Self::TrustLineEntryExtensionV2Ext(Box::new(t.0)))),
55845            ),
55846            TypeVariant::TrustLineEntry => Box::new(
55847                ReadXdrIter::<_, Frame<TrustLineEntry>>::new(&mut r.inner, r.limits.clone())
55848                    .map(|r| r.map(|t| Self::TrustLineEntry(Box::new(t.0)))),
55849            ),
55850            TypeVariant::TrustLineEntryExt => Box::new(
55851                ReadXdrIter::<_, Frame<TrustLineEntryExt>>::new(&mut r.inner, r.limits.clone())
55852                    .map(|r| r.map(|t| Self::TrustLineEntryExt(Box::new(t.0)))),
55853            ),
55854            TypeVariant::TrustLineEntryV1 => Box::new(
55855                ReadXdrIter::<_, Frame<TrustLineEntryV1>>::new(&mut r.inner, r.limits.clone())
55856                    .map(|r| r.map(|t| Self::TrustLineEntryV1(Box::new(t.0)))),
55857            ),
55858            TypeVariant::TrustLineEntryV1Ext => Box::new(
55859                ReadXdrIter::<_, Frame<TrustLineEntryV1Ext>>::new(&mut r.inner, r.limits.clone())
55860                    .map(|r| r.map(|t| Self::TrustLineEntryV1Ext(Box::new(t.0)))),
55861            ),
55862            TypeVariant::OfferEntryFlags => Box::new(
55863                ReadXdrIter::<_, Frame<OfferEntryFlags>>::new(&mut r.inner, r.limits.clone())
55864                    .map(|r| r.map(|t| Self::OfferEntryFlags(Box::new(t.0)))),
55865            ),
55866            TypeVariant::OfferEntry => Box::new(
55867                ReadXdrIter::<_, Frame<OfferEntry>>::new(&mut r.inner, r.limits.clone())
55868                    .map(|r| r.map(|t| Self::OfferEntry(Box::new(t.0)))),
55869            ),
55870            TypeVariant::OfferEntryExt => Box::new(
55871                ReadXdrIter::<_, Frame<OfferEntryExt>>::new(&mut r.inner, r.limits.clone())
55872                    .map(|r| r.map(|t| Self::OfferEntryExt(Box::new(t.0)))),
55873            ),
55874            TypeVariant::DataEntry => Box::new(
55875                ReadXdrIter::<_, Frame<DataEntry>>::new(&mut r.inner, r.limits.clone())
55876                    .map(|r| r.map(|t| Self::DataEntry(Box::new(t.0)))),
55877            ),
55878            TypeVariant::DataEntryExt => Box::new(
55879                ReadXdrIter::<_, Frame<DataEntryExt>>::new(&mut r.inner, r.limits.clone())
55880                    .map(|r| r.map(|t| Self::DataEntryExt(Box::new(t.0)))),
55881            ),
55882            TypeVariant::ClaimPredicateType => Box::new(
55883                ReadXdrIter::<_, Frame<ClaimPredicateType>>::new(&mut r.inner, r.limits.clone())
55884                    .map(|r| r.map(|t| Self::ClaimPredicateType(Box::new(t.0)))),
55885            ),
55886            TypeVariant::ClaimPredicate => Box::new(
55887                ReadXdrIter::<_, Frame<ClaimPredicate>>::new(&mut r.inner, r.limits.clone())
55888                    .map(|r| r.map(|t| Self::ClaimPredicate(Box::new(t.0)))),
55889            ),
55890            TypeVariant::ClaimantType => Box::new(
55891                ReadXdrIter::<_, Frame<ClaimantType>>::new(&mut r.inner, r.limits.clone())
55892                    .map(|r| r.map(|t| Self::ClaimantType(Box::new(t.0)))),
55893            ),
55894            TypeVariant::Claimant => Box::new(
55895                ReadXdrIter::<_, Frame<Claimant>>::new(&mut r.inner, r.limits.clone())
55896                    .map(|r| r.map(|t| Self::Claimant(Box::new(t.0)))),
55897            ),
55898            TypeVariant::ClaimantV0 => Box::new(
55899                ReadXdrIter::<_, Frame<ClaimantV0>>::new(&mut r.inner, r.limits.clone())
55900                    .map(|r| r.map(|t| Self::ClaimantV0(Box::new(t.0)))),
55901            ),
55902            TypeVariant::ClaimableBalanceIdType => Box::new(
55903                ReadXdrIter::<_, Frame<ClaimableBalanceIdType>>::new(
55904                    &mut r.inner,
55905                    r.limits.clone(),
55906                )
55907                .map(|r| r.map(|t| Self::ClaimableBalanceIdType(Box::new(t.0)))),
55908            ),
55909            TypeVariant::ClaimableBalanceId => Box::new(
55910                ReadXdrIter::<_, Frame<ClaimableBalanceId>>::new(&mut r.inner, r.limits.clone())
55911                    .map(|r| r.map(|t| Self::ClaimableBalanceId(Box::new(t.0)))),
55912            ),
55913            TypeVariant::ClaimableBalanceFlags => Box::new(
55914                ReadXdrIter::<_, Frame<ClaimableBalanceFlags>>::new(&mut r.inner, r.limits.clone())
55915                    .map(|r| r.map(|t| Self::ClaimableBalanceFlags(Box::new(t.0)))),
55916            ),
55917            TypeVariant::ClaimableBalanceEntryExtensionV1 => Box::new(
55918                ReadXdrIter::<_, Frame<ClaimableBalanceEntryExtensionV1>>::new(
55919                    &mut r.inner,
55920                    r.limits.clone(),
55921                )
55922                .map(|r| r.map(|t| Self::ClaimableBalanceEntryExtensionV1(Box::new(t.0)))),
55923            ),
55924            TypeVariant::ClaimableBalanceEntryExtensionV1Ext => Box::new(
55925                ReadXdrIter::<_, Frame<ClaimableBalanceEntryExtensionV1Ext>>::new(
55926                    &mut r.inner,
55927                    r.limits.clone(),
55928                )
55929                .map(|r| r.map(|t| Self::ClaimableBalanceEntryExtensionV1Ext(Box::new(t.0)))),
55930            ),
55931            TypeVariant::ClaimableBalanceEntry => Box::new(
55932                ReadXdrIter::<_, Frame<ClaimableBalanceEntry>>::new(&mut r.inner, r.limits.clone())
55933                    .map(|r| r.map(|t| Self::ClaimableBalanceEntry(Box::new(t.0)))),
55934            ),
55935            TypeVariant::ClaimableBalanceEntryExt => Box::new(
55936                ReadXdrIter::<_, Frame<ClaimableBalanceEntryExt>>::new(
55937                    &mut r.inner,
55938                    r.limits.clone(),
55939                )
55940                .map(|r| r.map(|t| Self::ClaimableBalanceEntryExt(Box::new(t.0)))),
55941            ),
55942            TypeVariant::LiquidityPoolConstantProductParameters => Box::new(
55943                ReadXdrIter::<_, Frame<LiquidityPoolConstantProductParameters>>::new(
55944                    &mut r.inner,
55945                    r.limits.clone(),
55946                )
55947                .map(|r| r.map(|t| Self::LiquidityPoolConstantProductParameters(Box::new(t.0)))),
55948            ),
55949            TypeVariant::LiquidityPoolEntry => Box::new(
55950                ReadXdrIter::<_, Frame<LiquidityPoolEntry>>::new(&mut r.inner, r.limits.clone())
55951                    .map(|r| r.map(|t| Self::LiquidityPoolEntry(Box::new(t.0)))),
55952            ),
55953            TypeVariant::LiquidityPoolEntryBody => Box::new(
55954                ReadXdrIter::<_, Frame<LiquidityPoolEntryBody>>::new(
55955                    &mut r.inner,
55956                    r.limits.clone(),
55957                )
55958                .map(|r| r.map(|t| Self::LiquidityPoolEntryBody(Box::new(t.0)))),
55959            ),
55960            TypeVariant::LiquidityPoolEntryConstantProduct => Box::new(
55961                ReadXdrIter::<_, Frame<LiquidityPoolEntryConstantProduct>>::new(
55962                    &mut r.inner,
55963                    r.limits.clone(),
55964                )
55965                .map(|r| r.map(|t| Self::LiquidityPoolEntryConstantProduct(Box::new(t.0)))),
55966            ),
55967            TypeVariant::ContractDataDurability => Box::new(
55968                ReadXdrIter::<_, Frame<ContractDataDurability>>::new(
55969                    &mut r.inner,
55970                    r.limits.clone(),
55971                )
55972                .map(|r| r.map(|t| Self::ContractDataDurability(Box::new(t.0)))),
55973            ),
55974            TypeVariant::ContractDataEntry => Box::new(
55975                ReadXdrIter::<_, Frame<ContractDataEntry>>::new(&mut r.inner, r.limits.clone())
55976                    .map(|r| r.map(|t| Self::ContractDataEntry(Box::new(t.0)))),
55977            ),
55978            TypeVariant::ContractCodeCostInputs => Box::new(
55979                ReadXdrIter::<_, Frame<ContractCodeCostInputs>>::new(
55980                    &mut r.inner,
55981                    r.limits.clone(),
55982                )
55983                .map(|r| r.map(|t| Self::ContractCodeCostInputs(Box::new(t.0)))),
55984            ),
55985            TypeVariant::ContractCodeEntry => Box::new(
55986                ReadXdrIter::<_, Frame<ContractCodeEntry>>::new(&mut r.inner, r.limits.clone())
55987                    .map(|r| r.map(|t| Self::ContractCodeEntry(Box::new(t.0)))),
55988            ),
55989            TypeVariant::ContractCodeEntryExt => Box::new(
55990                ReadXdrIter::<_, Frame<ContractCodeEntryExt>>::new(&mut r.inner, r.limits.clone())
55991                    .map(|r| r.map(|t| Self::ContractCodeEntryExt(Box::new(t.0)))),
55992            ),
55993            TypeVariant::ContractCodeEntryV1 => Box::new(
55994                ReadXdrIter::<_, Frame<ContractCodeEntryV1>>::new(&mut r.inner, r.limits.clone())
55995                    .map(|r| r.map(|t| Self::ContractCodeEntryV1(Box::new(t.0)))),
55996            ),
55997            TypeVariant::TtlEntry => Box::new(
55998                ReadXdrIter::<_, Frame<TtlEntry>>::new(&mut r.inner, r.limits.clone())
55999                    .map(|r| r.map(|t| Self::TtlEntry(Box::new(t.0)))),
56000            ),
56001            TypeVariant::LedgerEntryExtensionV1 => Box::new(
56002                ReadXdrIter::<_, Frame<LedgerEntryExtensionV1>>::new(
56003                    &mut r.inner,
56004                    r.limits.clone(),
56005                )
56006                .map(|r| r.map(|t| Self::LedgerEntryExtensionV1(Box::new(t.0)))),
56007            ),
56008            TypeVariant::LedgerEntryExtensionV1Ext => Box::new(
56009                ReadXdrIter::<_, Frame<LedgerEntryExtensionV1Ext>>::new(
56010                    &mut r.inner,
56011                    r.limits.clone(),
56012                )
56013                .map(|r| r.map(|t| Self::LedgerEntryExtensionV1Ext(Box::new(t.0)))),
56014            ),
56015            TypeVariant::LedgerEntry => Box::new(
56016                ReadXdrIter::<_, Frame<LedgerEntry>>::new(&mut r.inner, r.limits.clone())
56017                    .map(|r| r.map(|t| Self::LedgerEntry(Box::new(t.0)))),
56018            ),
56019            TypeVariant::LedgerEntryData => Box::new(
56020                ReadXdrIter::<_, Frame<LedgerEntryData>>::new(&mut r.inner, r.limits.clone())
56021                    .map(|r| r.map(|t| Self::LedgerEntryData(Box::new(t.0)))),
56022            ),
56023            TypeVariant::LedgerEntryExt => Box::new(
56024                ReadXdrIter::<_, Frame<LedgerEntryExt>>::new(&mut r.inner, r.limits.clone())
56025                    .map(|r| r.map(|t| Self::LedgerEntryExt(Box::new(t.0)))),
56026            ),
56027            TypeVariant::LedgerKey => Box::new(
56028                ReadXdrIter::<_, Frame<LedgerKey>>::new(&mut r.inner, r.limits.clone())
56029                    .map(|r| r.map(|t| Self::LedgerKey(Box::new(t.0)))),
56030            ),
56031            TypeVariant::LedgerKeyAccount => Box::new(
56032                ReadXdrIter::<_, Frame<LedgerKeyAccount>>::new(&mut r.inner, r.limits.clone())
56033                    .map(|r| r.map(|t| Self::LedgerKeyAccount(Box::new(t.0)))),
56034            ),
56035            TypeVariant::LedgerKeyTrustLine => Box::new(
56036                ReadXdrIter::<_, Frame<LedgerKeyTrustLine>>::new(&mut r.inner, r.limits.clone())
56037                    .map(|r| r.map(|t| Self::LedgerKeyTrustLine(Box::new(t.0)))),
56038            ),
56039            TypeVariant::LedgerKeyOffer => Box::new(
56040                ReadXdrIter::<_, Frame<LedgerKeyOffer>>::new(&mut r.inner, r.limits.clone())
56041                    .map(|r| r.map(|t| Self::LedgerKeyOffer(Box::new(t.0)))),
56042            ),
56043            TypeVariant::LedgerKeyData => Box::new(
56044                ReadXdrIter::<_, Frame<LedgerKeyData>>::new(&mut r.inner, r.limits.clone())
56045                    .map(|r| r.map(|t| Self::LedgerKeyData(Box::new(t.0)))),
56046            ),
56047            TypeVariant::LedgerKeyClaimableBalance => Box::new(
56048                ReadXdrIter::<_, Frame<LedgerKeyClaimableBalance>>::new(
56049                    &mut r.inner,
56050                    r.limits.clone(),
56051                )
56052                .map(|r| r.map(|t| Self::LedgerKeyClaimableBalance(Box::new(t.0)))),
56053            ),
56054            TypeVariant::LedgerKeyLiquidityPool => Box::new(
56055                ReadXdrIter::<_, Frame<LedgerKeyLiquidityPool>>::new(
56056                    &mut r.inner,
56057                    r.limits.clone(),
56058                )
56059                .map(|r| r.map(|t| Self::LedgerKeyLiquidityPool(Box::new(t.0)))),
56060            ),
56061            TypeVariant::LedgerKeyContractData => Box::new(
56062                ReadXdrIter::<_, Frame<LedgerKeyContractData>>::new(&mut r.inner, r.limits.clone())
56063                    .map(|r| r.map(|t| Self::LedgerKeyContractData(Box::new(t.0)))),
56064            ),
56065            TypeVariant::LedgerKeyContractCode => Box::new(
56066                ReadXdrIter::<_, Frame<LedgerKeyContractCode>>::new(&mut r.inner, r.limits.clone())
56067                    .map(|r| r.map(|t| Self::LedgerKeyContractCode(Box::new(t.0)))),
56068            ),
56069            TypeVariant::LedgerKeyConfigSetting => Box::new(
56070                ReadXdrIter::<_, Frame<LedgerKeyConfigSetting>>::new(
56071                    &mut r.inner,
56072                    r.limits.clone(),
56073                )
56074                .map(|r| r.map(|t| Self::LedgerKeyConfigSetting(Box::new(t.0)))),
56075            ),
56076            TypeVariant::LedgerKeyTtl => Box::new(
56077                ReadXdrIter::<_, Frame<LedgerKeyTtl>>::new(&mut r.inner, r.limits.clone())
56078                    .map(|r| r.map(|t| Self::LedgerKeyTtl(Box::new(t.0)))),
56079            ),
56080            TypeVariant::EnvelopeType => Box::new(
56081                ReadXdrIter::<_, Frame<EnvelopeType>>::new(&mut r.inner, r.limits.clone())
56082                    .map(|r| r.map(|t| Self::EnvelopeType(Box::new(t.0)))),
56083            ),
56084            TypeVariant::BucketListType => Box::new(
56085                ReadXdrIter::<_, Frame<BucketListType>>::new(&mut r.inner, r.limits.clone())
56086                    .map(|r| r.map(|t| Self::BucketListType(Box::new(t.0)))),
56087            ),
56088            TypeVariant::BucketEntryType => Box::new(
56089                ReadXdrIter::<_, Frame<BucketEntryType>>::new(&mut r.inner, r.limits.clone())
56090                    .map(|r| r.map(|t| Self::BucketEntryType(Box::new(t.0)))),
56091            ),
56092            TypeVariant::HotArchiveBucketEntryType => Box::new(
56093                ReadXdrIter::<_, Frame<HotArchiveBucketEntryType>>::new(
56094                    &mut r.inner,
56095                    r.limits.clone(),
56096                )
56097                .map(|r| r.map(|t| Self::HotArchiveBucketEntryType(Box::new(t.0)))),
56098            ),
56099            TypeVariant::ColdArchiveBucketEntryType => Box::new(
56100                ReadXdrIter::<_, Frame<ColdArchiveBucketEntryType>>::new(
56101                    &mut r.inner,
56102                    r.limits.clone(),
56103                )
56104                .map(|r| r.map(|t| Self::ColdArchiveBucketEntryType(Box::new(t.0)))),
56105            ),
56106            TypeVariant::BucketMetadata => Box::new(
56107                ReadXdrIter::<_, Frame<BucketMetadata>>::new(&mut r.inner, r.limits.clone())
56108                    .map(|r| r.map(|t| Self::BucketMetadata(Box::new(t.0)))),
56109            ),
56110            TypeVariant::BucketMetadataExt => Box::new(
56111                ReadXdrIter::<_, Frame<BucketMetadataExt>>::new(&mut r.inner, r.limits.clone())
56112                    .map(|r| r.map(|t| Self::BucketMetadataExt(Box::new(t.0)))),
56113            ),
56114            TypeVariant::BucketEntry => Box::new(
56115                ReadXdrIter::<_, Frame<BucketEntry>>::new(&mut r.inner, r.limits.clone())
56116                    .map(|r| r.map(|t| Self::BucketEntry(Box::new(t.0)))),
56117            ),
56118            TypeVariant::HotArchiveBucketEntry => Box::new(
56119                ReadXdrIter::<_, Frame<HotArchiveBucketEntry>>::new(&mut r.inner, r.limits.clone())
56120                    .map(|r| r.map(|t| Self::HotArchiveBucketEntry(Box::new(t.0)))),
56121            ),
56122            TypeVariant::ColdArchiveArchivedLeaf => Box::new(
56123                ReadXdrIter::<_, Frame<ColdArchiveArchivedLeaf>>::new(
56124                    &mut r.inner,
56125                    r.limits.clone(),
56126                )
56127                .map(|r| r.map(|t| Self::ColdArchiveArchivedLeaf(Box::new(t.0)))),
56128            ),
56129            TypeVariant::ColdArchiveDeletedLeaf => Box::new(
56130                ReadXdrIter::<_, Frame<ColdArchiveDeletedLeaf>>::new(
56131                    &mut r.inner,
56132                    r.limits.clone(),
56133                )
56134                .map(|r| r.map(|t| Self::ColdArchiveDeletedLeaf(Box::new(t.0)))),
56135            ),
56136            TypeVariant::ColdArchiveBoundaryLeaf => Box::new(
56137                ReadXdrIter::<_, Frame<ColdArchiveBoundaryLeaf>>::new(
56138                    &mut r.inner,
56139                    r.limits.clone(),
56140                )
56141                .map(|r| r.map(|t| Self::ColdArchiveBoundaryLeaf(Box::new(t.0)))),
56142            ),
56143            TypeVariant::ColdArchiveHashEntry => Box::new(
56144                ReadXdrIter::<_, Frame<ColdArchiveHashEntry>>::new(&mut r.inner, r.limits.clone())
56145                    .map(|r| r.map(|t| Self::ColdArchiveHashEntry(Box::new(t.0)))),
56146            ),
56147            TypeVariant::ColdArchiveBucketEntry => Box::new(
56148                ReadXdrIter::<_, Frame<ColdArchiveBucketEntry>>::new(
56149                    &mut r.inner,
56150                    r.limits.clone(),
56151                )
56152                .map(|r| r.map(|t| Self::ColdArchiveBucketEntry(Box::new(t.0)))),
56153            ),
56154            TypeVariant::UpgradeType => Box::new(
56155                ReadXdrIter::<_, Frame<UpgradeType>>::new(&mut r.inner, r.limits.clone())
56156                    .map(|r| r.map(|t| Self::UpgradeType(Box::new(t.0)))),
56157            ),
56158            TypeVariant::StellarValueType => Box::new(
56159                ReadXdrIter::<_, Frame<StellarValueType>>::new(&mut r.inner, r.limits.clone())
56160                    .map(|r| r.map(|t| Self::StellarValueType(Box::new(t.0)))),
56161            ),
56162            TypeVariant::LedgerCloseValueSignature => Box::new(
56163                ReadXdrIter::<_, Frame<LedgerCloseValueSignature>>::new(
56164                    &mut r.inner,
56165                    r.limits.clone(),
56166                )
56167                .map(|r| r.map(|t| Self::LedgerCloseValueSignature(Box::new(t.0)))),
56168            ),
56169            TypeVariant::StellarValue => Box::new(
56170                ReadXdrIter::<_, Frame<StellarValue>>::new(&mut r.inner, r.limits.clone())
56171                    .map(|r| r.map(|t| Self::StellarValue(Box::new(t.0)))),
56172            ),
56173            TypeVariant::StellarValueExt => Box::new(
56174                ReadXdrIter::<_, Frame<StellarValueExt>>::new(&mut r.inner, r.limits.clone())
56175                    .map(|r| r.map(|t| Self::StellarValueExt(Box::new(t.0)))),
56176            ),
56177            TypeVariant::LedgerHeaderFlags => Box::new(
56178                ReadXdrIter::<_, Frame<LedgerHeaderFlags>>::new(&mut r.inner, r.limits.clone())
56179                    .map(|r| r.map(|t| Self::LedgerHeaderFlags(Box::new(t.0)))),
56180            ),
56181            TypeVariant::LedgerHeaderExtensionV1 => Box::new(
56182                ReadXdrIter::<_, Frame<LedgerHeaderExtensionV1>>::new(
56183                    &mut r.inner,
56184                    r.limits.clone(),
56185                )
56186                .map(|r| r.map(|t| Self::LedgerHeaderExtensionV1(Box::new(t.0)))),
56187            ),
56188            TypeVariant::LedgerHeaderExtensionV1Ext => Box::new(
56189                ReadXdrIter::<_, Frame<LedgerHeaderExtensionV1Ext>>::new(
56190                    &mut r.inner,
56191                    r.limits.clone(),
56192                )
56193                .map(|r| r.map(|t| Self::LedgerHeaderExtensionV1Ext(Box::new(t.0)))),
56194            ),
56195            TypeVariant::LedgerHeader => Box::new(
56196                ReadXdrIter::<_, Frame<LedgerHeader>>::new(&mut r.inner, r.limits.clone())
56197                    .map(|r| r.map(|t| Self::LedgerHeader(Box::new(t.0)))),
56198            ),
56199            TypeVariant::LedgerHeaderExt => Box::new(
56200                ReadXdrIter::<_, Frame<LedgerHeaderExt>>::new(&mut r.inner, r.limits.clone())
56201                    .map(|r| r.map(|t| Self::LedgerHeaderExt(Box::new(t.0)))),
56202            ),
56203            TypeVariant::LedgerUpgradeType => Box::new(
56204                ReadXdrIter::<_, Frame<LedgerUpgradeType>>::new(&mut r.inner, r.limits.clone())
56205                    .map(|r| r.map(|t| Self::LedgerUpgradeType(Box::new(t.0)))),
56206            ),
56207            TypeVariant::ConfigUpgradeSetKey => Box::new(
56208                ReadXdrIter::<_, Frame<ConfigUpgradeSetKey>>::new(&mut r.inner, r.limits.clone())
56209                    .map(|r| r.map(|t| Self::ConfigUpgradeSetKey(Box::new(t.0)))),
56210            ),
56211            TypeVariant::LedgerUpgrade => Box::new(
56212                ReadXdrIter::<_, Frame<LedgerUpgrade>>::new(&mut r.inner, r.limits.clone())
56213                    .map(|r| r.map(|t| Self::LedgerUpgrade(Box::new(t.0)))),
56214            ),
56215            TypeVariant::ConfigUpgradeSet => Box::new(
56216                ReadXdrIter::<_, Frame<ConfigUpgradeSet>>::new(&mut r.inner, r.limits.clone())
56217                    .map(|r| r.map(|t| Self::ConfigUpgradeSet(Box::new(t.0)))),
56218            ),
56219            TypeVariant::TxSetComponentType => Box::new(
56220                ReadXdrIter::<_, Frame<TxSetComponentType>>::new(&mut r.inner, r.limits.clone())
56221                    .map(|r| r.map(|t| Self::TxSetComponentType(Box::new(t.0)))),
56222            ),
56223            TypeVariant::TxExecutionThread => Box::new(
56224                ReadXdrIter::<_, Frame<TxExecutionThread>>::new(&mut r.inner, r.limits.clone())
56225                    .map(|r| r.map(|t| Self::TxExecutionThread(Box::new(t.0)))),
56226            ),
56227            TypeVariant::ParallelTxExecutionStage => Box::new(
56228                ReadXdrIter::<_, Frame<ParallelTxExecutionStage>>::new(
56229                    &mut r.inner,
56230                    r.limits.clone(),
56231                )
56232                .map(|r| r.map(|t| Self::ParallelTxExecutionStage(Box::new(t.0)))),
56233            ),
56234            TypeVariant::ParallelTxsComponent => Box::new(
56235                ReadXdrIter::<_, Frame<ParallelTxsComponent>>::new(&mut r.inner, r.limits.clone())
56236                    .map(|r| r.map(|t| Self::ParallelTxsComponent(Box::new(t.0)))),
56237            ),
56238            TypeVariant::TxSetComponent => Box::new(
56239                ReadXdrIter::<_, Frame<TxSetComponent>>::new(&mut r.inner, r.limits.clone())
56240                    .map(|r| r.map(|t| Self::TxSetComponent(Box::new(t.0)))),
56241            ),
56242            TypeVariant::TxSetComponentTxsMaybeDiscountedFee => Box::new(
56243                ReadXdrIter::<_, Frame<TxSetComponentTxsMaybeDiscountedFee>>::new(
56244                    &mut r.inner,
56245                    r.limits.clone(),
56246                )
56247                .map(|r| r.map(|t| Self::TxSetComponentTxsMaybeDiscountedFee(Box::new(t.0)))),
56248            ),
56249            TypeVariant::TransactionPhase => Box::new(
56250                ReadXdrIter::<_, Frame<TransactionPhase>>::new(&mut r.inner, r.limits.clone())
56251                    .map(|r| r.map(|t| Self::TransactionPhase(Box::new(t.0)))),
56252            ),
56253            TypeVariant::TransactionSet => Box::new(
56254                ReadXdrIter::<_, Frame<TransactionSet>>::new(&mut r.inner, r.limits.clone())
56255                    .map(|r| r.map(|t| Self::TransactionSet(Box::new(t.0)))),
56256            ),
56257            TypeVariant::TransactionSetV1 => Box::new(
56258                ReadXdrIter::<_, Frame<TransactionSetV1>>::new(&mut r.inner, r.limits.clone())
56259                    .map(|r| r.map(|t| Self::TransactionSetV1(Box::new(t.0)))),
56260            ),
56261            TypeVariant::GeneralizedTransactionSet => Box::new(
56262                ReadXdrIter::<_, Frame<GeneralizedTransactionSet>>::new(
56263                    &mut r.inner,
56264                    r.limits.clone(),
56265                )
56266                .map(|r| r.map(|t| Self::GeneralizedTransactionSet(Box::new(t.0)))),
56267            ),
56268            TypeVariant::TransactionResultPair => Box::new(
56269                ReadXdrIter::<_, Frame<TransactionResultPair>>::new(&mut r.inner, r.limits.clone())
56270                    .map(|r| r.map(|t| Self::TransactionResultPair(Box::new(t.0)))),
56271            ),
56272            TypeVariant::TransactionResultSet => Box::new(
56273                ReadXdrIter::<_, Frame<TransactionResultSet>>::new(&mut r.inner, r.limits.clone())
56274                    .map(|r| r.map(|t| Self::TransactionResultSet(Box::new(t.0)))),
56275            ),
56276            TypeVariant::TransactionHistoryEntry => Box::new(
56277                ReadXdrIter::<_, Frame<TransactionHistoryEntry>>::new(
56278                    &mut r.inner,
56279                    r.limits.clone(),
56280                )
56281                .map(|r| r.map(|t| Self::TransactionHistoryEntry(Box::new(t.0)))),
56282            ),
56283            TypeVariant::TransactionHistoryEntryExt => Box::new(
56284                ReadXdrIter::<_, Frame<TransactionHistoryEntryExt>>::new(
56285                    &mut r.inner,
56286                    r.limits.clone(),
56287                )
56288                .map(|r| r.map(|t| Self::TransactionHistoryEntryExt(Box::new(t.0)))),
56289            ),
56290            TypeVariant::TransactionHistoryResultEntry => Box::new(
56291                ReadXdrIter::<_, Frame<TransactionHistoryResultEntry>>::new(
56292                    &mut r.inner,
56293                    r.limits.clone(),
56294                )
56295                .map(|r| r.map(|t| Self::TransactionHistoryResultEntry(Box::new(t.0)))),
56296            ),
56297            TypeVariant::TransactionHistoryResultEntryExt => Box::new(
56298                ReadXdrIter::<_, Frame<TransactionHistoryResultEntryExt>>::new(
56299                    &mut r.inner,
56300                    r.limits.clone(),
56301                )
56302                .map(|r| r.map(|t| Self::TransactionHistoryResultEntryExt(Box::new(t.0)))),
56303            ),
56304            TypeVariant::LedgerHeaderHistoryEntry => Box::new(
56305                ReadXdrIter::<_, Frame<LedgerHeaderHistoryEntry>>::new(
56306                    &mut r.inner,
56307                    r.limits.clone(),
56308                )
56309                .map(|r| r.map(|t| Self::LedgerHeaderHistoryEntry(Box::new(t.0)))),
56310            ),
56311            TypeVariant::LedgerHeaderHistoryEntryExt => Box::new(
56312                ReadXdrIter::<_, Frame<LedgerHeaderHistoryEntryExt>>::new(
56313                    &mut r.inner,
56314                    r.limits.clone(),
56315                )
56316                .map(|r| r.map(|t| Self::LedgerHeaderHistoryEntryExt(Box::new(t.0)))),
56317            ),
56318            TypeVariant::LedgerScpMessages => Box::new(
56319                ReadXdrIter::<_, Frame<LedgerScpMessages>>::new(&mut r.inner, r.limits.clone())
56320                    .map(|r| r.map(|t| Self::LedgerScpMessages(Box::new(t.0)))),
56321            ),
56322            TypeVariant::ScpHistoryEntryV0 => Box::new(
56323                ReadXdrIter::<_, Frame<ScpHistoryEntryV0>>::new(&mut r.inner, r.limits.clone())
56324                    .map(|r| r.map(|t| Self::ScpHistoryEntryV0(Box::new(t.0)))),
56325            ),
56326            TypeVariant::ScpHistoryEntry => Box::new(
56327                ReadXdrIter::<_, Frame<ScpHistoryEntry>>::new(&mut r.inner, r.limits.clone())
56328                    .map(|r| r.map(|t| Self::ScpHistoryEntry(Box::new(t.0)))),
56329            ),
56330            TypeVariant::LedgerEntryChangeType => Box::new(
56331                ReadXdrIter::<_, Frame<LedgerEntryChangeType>>::new(&mut r.inner, r.limits.clone())
56332                    .map(|r| r.map(|t| Self::LedgerEntryChangeType(Box::new(t.0)))),
56333            ),
56334            TypeVariant::LedgerEntryChange => Box::new(
56335                ReadXdrIter::<_, Frame<LedgerEntryChange>>::new(&mut r.inner, r.limits.clone())
56336                    .map(|r| r.map(|t| Self::LedgerEntryChange(Box::new(t.0)))),
56337            ),
56338            TypeVariant::LedgerEntryChanges => Box::new(
56339                ReadXdrIter::<_, Frame<LedgerEntryChanges>>::new(&mut r.inner, r.limits.clone())
56340                    .map(|r| r.map(|t| Self::LedgerEntryChanges(Box::new(t.0)))),
56341            ),
56342            TypeVariant::OperationMeta => Box::new(
56343                ReadXdrIter::<_, Frame<OperationMeta>>::new(&mut r.inner, r.limits.clone())
56344                    .map(|r| r.map(|t| Self::OperationMeta(Box::new(t.0)))),
56345            ),
56346            TypeVariant::TransactionMetaV1 => Box::new(
56347                ReadXdrIter::<_, Frame<TransactionMetaV1>>::new(&mut r.inner, r.limits.clone())
56348                    .map(|r| r.map(|t| Self::TransactionMetaV1(Box::new(t.0)))),
56349            ),
56350            TypeVariant::TransactionMetaV2 => Box::new(
56351                ReadXdrIter::<_, Frame<TransactionMetaV2>>::new(&mut r.inner, r.limits.clone())
56352                    .map(|r| r.map(|t| Self::TransactionMetaV2(Box::new(t.0)))),
56353            ),
56354            TypeVariant::ContractEventType => Box::new(
56355                ReadXdrIter::<_, Frame<ContractEventType>>::new(&mut r.inner, r.limits.clone())
56356                    .map(|r| r.map(|t| Self::ContractEventType(Box::new(t.0)))),
56357            ),
56358            TypeVariant::ContractEvent => Box::new(
56359                ReadXdrIter::<_, Frame<ContractEvent>>::new(&mut r.inner, r.limits.clone())
56360                    .map(|r| r.map(|t| Self::ContractEvent(Box::new(t.0)))),
56361            ),
56362            TypeVariant::ContractEventBody => Box::new(
56363                ReadXdrIter::<_, Frame<ContractEventBody>>::new(&mut r.inner, r.limits.clone())
56364                    .map(|r| r.map(|t| Self::ContractEventBody(Box::new(t.0)))),
56365            ),
56366            TypeVariant::ContractEventV0 => Box::new(
56367                ReadXdrIter::<_, Frame<ContractEventV0>>::new(&mut r.inner, r.limits.clone())
56368                    .map(|r| r.map(|t| Self::ContractEventV0(Box::new(t.0)))),
56369            ),
56370            TypeVariant::DiagnosticEvent => Box::new(
56371                ReadXdrIter::<_, Frame<DiagnosticEvent>>::new(&mut r.inner, r.limits.clone())
56372                    .map(|r| r.map(|t| Self::DiagnosticEvent(Box::new(t.0)))),
56373            ),
56374            TypeVariant::SorobanTransactionMetaExtV1 => Box::new(
56375                ReadXdrIter::<_, Frame<SorobanTransactionMetaExtV1>>::new(
56376                    &mut r.inner,
56377                    r.limits.clone(),
56378                )
56379                .map(|r| r.map(|t| Self::SorobanTransactionMetaExtV1(Box::new(t.0)))),
56380            ),
56381            TypeVariant::SorobanTransactionMetaExt => Box::new(
56382                ReadXdrIter::<_, Frame<SorobanTransactionMetaExt>>::new(
56383                    &mut r.inner,
56384                    r.limits.clone(),
56385                )
56386                .map(|r| r.map(|t| Self::SorobanTransactionMetaExt(Box::new(t.0)))),
56387            ),
56388            TypeVariant::SorobanTransactionMeta => Box::new(
56389                ReadXdrIter::<_, Frame<SorobanTransactionMeta>>::new(
56390                    &mut r.inner,
56391                    r.limits.clone(),
56392                )
56393                .map(|r| r.map(|t| Self::SorobanTransactionMeta(Box::new(t.0)))),
56394            ),
56395            TypeVariant::TransactionMetaV3 => Box::new(
56396                ReadXdrIter::<_, Frame<TransactionMetaV3>>::new(&mut r.inner, r.limits.clone())
56397                    .map(|r| r.map(|t| Self::TransactionMetaV3(Box::new(t.0)))),
56398            ),
56399            TypeVariant::InvokeHostFunctionSuccessPreImage => Box::new(
56400                ReadXdrIter::<_, Frame<InvokeHostFunctionSuccessPreImage>>::new(
56401                    &mut r.inner,
56402                    r.limits.clone(),
56403                )
56404                .map(|r| r.map(|t| Self::InvokeHostFunctionSuccessPreImage(Box::new(t.0)))),
56405            ),
56406            TypeVariant::TransactionMeta => Box::new(
56407                ReadXdrIter::<_, Frame<TransactionMeta>>::new(&mut r.inner, r.limits.clone())
56408                    .map(|r| r.map(|t| Self::TransactionMeta(Box::new(t.0)))),
56409            ),
56410            TypeVariant::TransactionResultMeta => Box::new(
56411                ReadXdrIter::<_, Frame<TransactionResultMeta>>::new(&mut r.inner, r.limits.clone())
56412                    .map(|r| r.map(|t| Self::TransactionResultMeta(Box::new(t.0)))),
56413            ),
56414            TypeVariant::UpgradeEntryMeta => Box::new(
56415                ReadXdrIter::<_, Frame<UpgradeEntryMeta>>::new(&mut r.inner, r.limits.clone())
56416                    .map(|r| r.map(|t| Self::UpgradeEntryMeta(Box::new(t.0)))),
56417            ),
56418            TypeVariant::LedgerCloseMetaV0 => Box::new(
56419                ReadXdrIter::<_, Frame<LedgerCloseMetaV0>>::new(&mut r.inner, r.limits.clone())
56420                    .map(|r| r.map(|t| Self::LedgerCloseMetaV0(Box::new(t.0)))),
56421            ),
56422            TypeVariant::LedgerCloseMetaExtV1 => Box::new(
56423                ReadXdrIter::<_, Frame<LedgerCloseMetaExtV1>>::new(&mut r.inner, r.limits.clone())
56424                    .map(|r| r.map(|t| Self::LedgerCloseMetaExtV1(Box::new(t.0)))),
56425            ),
56426            TypeVariant::LedgerCloseMetaExtV2 => Box::new(
56427                ReadXdrIter::<_, Frame<LedgerCloseMetaExtV2>>::new(&mut r.inner, r.limits.clone())
56428                    .map(|r| r.map(|t| Self::LedgerCloseMetaExtV2(Box::new(t.0)))),
56429            ),
56430            TypeVariant::LedgerCloseMetaExt => Box::new(
56431                ReadXdrIter::<_, Frame<LedgerCloseMetaExt>>::new(&mut r.inner, r.limits.clone())
56432                    .map(|r| r.map(|t| Self::LedgerCloseMetaExt(Box::new(t.0)))),
56433            ),
56434            TypeVariant::LedgerCloseMetaV1 => Box::new(
56435                ReadXdrIter::<_, Frame<LedgerCloseMetaV1>>::new(&mut r.inner, r.limits.clone())
56436                    .map(|r| r.map(|t| Self::LedgerCloseMetaV1(Box::new(t.0)))),
56437            ),
56438            TypeVariant::LedgerCloseMeta => Box::new(
56439                ReadXdrIter::<_, Frame<LedgerCloseMeta>>::new(&mut r.inner, r.limits.clone())
56440                    .map(|r| r.map(|t| Self::LedgerCloseMeta(Box::new(t.0)))),
56441            ),
56442            TypeVariant::ErrorCode => Box::new(
56443                ReadXdrIter::<_, Frame<ErrorCode>>::new(&mut r.inner, r.limits.clone())
56444                    .map(|r| r.map(|t| Self::ErrorCode(Box::new(t.0)))),
56445            ),
56446            TypeVariant::SError => Box::new(
56447                ReadXdrIter::<_, Frame<SError>>::new(&mut r.inner, r.limits.clone())
56448                    .map(|r| r.map(|t| Self::SError(Box::new(t.0)))),
56449            ),
56450            TypeVariant::SendMore => Box::new(
56451                ReadXdrIter::<_, Frame<SendMore>>::new(&mut r.inner, r.limits.clone())
56452                    .map(|r| r.map(|t| Self::SendMore(Box::new(t.0)))),
56453            ),
56454            TypeVariant::SendMoreExtended => Box::new(
56455                ReadXdrIter::<_, Frame<SendMoreExtended>>::new(&mut r.inner, r.limits.clone())
56456                    .map(|r| r.map(|t| Self::SendMoreExtended(Box::new(t.0)))),
56457            ),
56458            TypeVariant::AuthCert => Box::new(
56459                ReadXdrIter::<_, Frame<AuthCert>>::new(&mut r.inner, r.limits.clone())
56460                    .map(|r| r.map(|t| Self::AuthCert(Box::new(t.0)))),
56461            ),
56462            TypeVariant::Hello => Box::new(
56463                ReadXdrIter::<_, Frame<Hello>>::new(&mut r.inner, r.limits.clone())
56464                    .map(|r| r.map(|t| Self::Hello(Box::new(t.0)))),
56465            ),
56466            TypeVariant::Auth => Box::new(
56467                ReadXdrIter::<_, Frame<Auth>>::new(&mut r.inner, r.limits.clone())
56468                    .map(|r| r.map(|t| Self::Auth(Box::new(t.0)))),
56469            ),
56470            TypeVariant::IpAddrType => Box::new(
56471                ReadXdrIter::<_, Frame<IpAddrType>>::new(&mut r.inner, r.limits.clone())
56472                    .map(|r| r.map(|t| Self::IpAddrType(Box::new(t.0)))),
56473            ),
56474            TypeVariant::PeerAddress => Box::new(
56475                ReadXdrIter::<_, Frame<PeerAddress>>::new(&mut r.inner, r.limits.clone())
56476                    .map(|r| r.map(|t| Self::PeerAddress(Box::new(t.0)))),
56477            ),
56478            TypeVariant::PeerAddressIp => Box::new(
56479                ReadXdrIter::<_, Frame<PeerAddressIp>>::new(&mut r.inner, r.limits.clone())
56480                    .map(|r| r.map(|t| Self::PeerAddressIp(Box::new(t.0)))),
56481            ),
56482            TypeVariant::MessageType => Box::new(
56483                ReadXdrIter::<_, Frame<MessageType>>::new(&mut r.inner, r.limits.clone())
56484                    .map(|r| r.map(|t| Self::MessageType(Box::new(t.0)))),
56485            ),
56486            TypeVariant::DontHave => Box::new(
56487                ReadXdrIter::<_, Frame<DontHave>>::new(&mut r.inner, r.limits.clone())
56488                    .map(|r| r.map(|t| Self::DontHave(Box::new(t.0)))),
56489            ),
56490            TypeVariant::SurveyMessageCommandType => Box::new(
56491                ReadXdrIter::<_, Frame<SurveyMessageCommandType>>::new(
56492                    &mut r.inner,
56493                    r.limits.clone(),
56494                )
56495                .map(|r| r.map(|t| Self::SurveyMessageCommandType(Box::new(t.0)))),
56496            ),
56497            TypeVariant::SurveyMessageResponseType => Box::new(
56498                ReadXdrIter::<_, Frame<SurveyMessageResponseType>>::new(
56499                    &mut r.inner,
56500                    r.limits.clone(),
56501                )
56502                .map(|r| r.map(|t| Self::SurveyMessageResponseType(Box::new(t.0)))),
56503            ),
56504            TypeVariant::TimeSlicedSurveyStartCollectingMessage => Box::new(
56505                ReadXdrIter::<_, Frame<TimeSlicedSurveyStartCollectingMessage>>::new(
56506                    &mut r.inner,
56507                    r.limits.clone(),
56508                )
56509                .map(|r| r.map(|t| Self::TimeSlicedSurveyStartCollectingMessage(Box::new(t.0)))),
56510            ),
56511            TypeVariant::SignedTimeSlicedSurveyStartCollectingMessage => Box::new(
56512                ReadXdrIter::<_, Frame<SignedTimeSlicedSurveyStartCollectingMessage>>::new(
56513                    &mut r.inner,
56514                    r.limits.clone(),
56515                )
56516                .map(|r| {
56517                    r.map(|t| Self::SignedTimeSlicedSurveyStartCollectingMessage(Box::new(t.0)))
56518                }),
56519            ),
56520            TypeVariant::TimeSlicedSurveyStopCollectingMessage => Box::new(
56521                ReadXdrIter::<_, Frame<TimeSlicedSurveyStopCollectingMessage>>::new(
56522                    &mut r.inner,
56523                    r.limits.clone(),
56524                )
56525                .map(|r| r.map(|t| Self::TimeSlicedSurveyStopCollectingMessage(Box::new(t.0)))),
56526            ),
56527            TypeVariant::SignedTimeSlicedSurveyStopCollectingMessage => Box::new(
56528                ReadXdrIter::<_, Frame<SignedTimeSlicedSurveyStopCollectingMessage>>::new(
56529                    &mut r.inner,
56530                    r.limits.clone(),
56531                )
56532                .map(|r| {
56533                    r.map(|t| Self::SignedTimeSlicedSurveyStopCollectingMessage(Box::new(t.0)))
56534                }),
56535            ),
56536            TypeVariant::SurveyRequestMessage => Box::new(
56537                ReadXdrIter::<_, Frame<SurveyRequestMessage>>::new(&mut r.inner, r.limits.clone())
56538                    .map(|r| r.map(|t| Self::SurveyRequestMessage(Box::new(t.0)))),
56539            ),
56540            TypeVariant::TimeSlicedSurveyRequestMessage => Box::new(
56541                ReadXdrIter::<_, Frame<TimeSlicedSurveyRequestMessage>>::new(
56542                    &mut r.inner,
56543                    r.limits.clone(),
56544                )
56545                .map(|r| r.map(|t| Self::TimeSlicedSurveyRequestMessage(Box::new(t.0)))),
56546            ),
56547            TypeVariant::SignedSurveyRequestMessage => Box::new(
56548                ReadXdrIter::<_, Frame<SignedSurveyRequestMessage>>::new(
56549                    &mut r.inner,
56550                    r.limits.clone(),
56551                )
56552                .map(|r| r.map(|t| Self::SignedSurveyRequestMessage(Box::new(t.0)))),
56553            ),
56554            TypeVariant::SignedTimeSlicedSurveyRequestMessage => Box::new(
56555                ReadXdrIter::<_, Frame<SignedTimeSlicedSurveyRequestMessage>>::new(
56556                    &mut r.inner,
56557                    r.limits.clone(),
56558                )
56559                .map(|r| r.map(|t| Self::SignedTimeSlicedSurveyRequestMessage(Box::new(t.0)))),
56560            ),
56561            TypeVariant::EncryptedBody => Box::new(
56562                ReadXdrIter::<_, Frame<EncryptedBody>>::new(&mut r.inner, r.limits.clone())
56563                    .map(|r| r.map(|t| Self::EncryptedBody(Box::new(t.0)))),
56564            ),
56565            TypeVariant::SurveyResponseMessage => Box::new(
56566                ReadXdrIter::<_, Frame<SurveyResponseMessage>>::new(&mut r.inner, r.limits.clone())
56567                    .map(|r| r.map(|t| Self::SurveyResponseMessage(Box::new(t.0)))),
56568            ),
56569            TypeVariant::TimeSlicedSurveyResponseMessage => Box::new(
56570                ReadXdrIter::<_, Frame<TimeSlicedSurveyResponseMessage>>::new(
56571                    &mut r.inner,
56572                    r.limits.clone(),
56573                )
56574                .map(|r| r.map(|t| Self::TimeSlicedSurveyResponseMessage(Box::new(t.0)))),
56575            ),
56576            TypeVariant::SignedSurveyResponseMessage => Box::new(
56577                ReadXdrIter::<_, Frame<SignedSurveyResponseMessage>>::new(
56578                    &mut r.inner,
56579                    r.limits.clone(),
56580                )
56581                .map(|r| r.map(|t| Self::SignedSurveyResponseMessage(Box::new(t.0)))),
56582            ),
56583            TypeVariant::SignedTimeSlicedSurveyResponseMessage => Box::new(
56584                ReadXdrIter::<_, Frame<SignedTimeSlicedSurveyResponseMessage>>::new(
56585                    &mut r.inner,
56586                    r.limits.clone(),
56587                )
56588                .map(|r| r.map(|t| Self::SignedTimeSlicedSurveyResponseMessage(Box::new(t.0)))),
56589            ),
56590            TypeVariant::PeerStats => Box::new(
56591                ReadXdrIter::<_, Frame<PeerStats>>::new(&mut r.inner, r.limits.clone())
56592                    .map(|r| r.map(|t| Self::PeerStats(Box::new(t.0)))),
56593            ),
56594            TypeVariant::PeerStatList => Box::new(
56595                ReadXdrIter::<_, Frame<PeerStatList>>::new(&mut r.inner, r.limits.clone())
56596                    .map(|r| r.map(|t| Self::PeerStatList(Box::new(t.0)))),
56597            ),
56598            TypeVariant::TimeSlicedNodeData => Box::new(
56599                ReadXdrIter::<_, Frame<TimeSlicedNodeData>>::new(&mut r.inner, r.limits.clone())
56600                    .map(|r| r.map(|t| Self::TimeSlicedNodeData(Box::new(t.0)))),
56601            ),
56602            TypeVariant::TimeSlicedPeerData => Box::new(
56603                ReadXdrIter::<_, Frame<TimeSlicedPeerData>>::new(&mut r.inner, r.limits.clone())
56604                    .map(|r| r.map(|t| Self::TimeSlicedPeerData(Box::new(t.0)))),
56605            ),
56606            TypeVariant::TimeSlicedPeerDataList => Box::new(
56607                ReadXdrIter::<_, Frame<TimeSlicedPeerDataList>>::new(
56608                    &mut r.inner,
56609                    r.limits.clone(),
56610                )
56611                .map(|r| r.map(|t| Self::TimeSlicedPeerDataList(Box::new(t.0)))),
56612            ),
56613            TypeVariant::TopologyResponseBodyV0 => Box::new(
56614                ReadXdrIter::<_, Frame<TopologyResponseBodyV0>>::new(
56615                    &mut r.inner,
56616                    r.limits.clone(),
56617                )
56618                .map(|r| r.map(|t| Self::TopologyResponseBodyV0(Box::new(t.0)))),
56619            ),
56620            TypeVariant::TopologyResponseBodyV1 => Box::new(
56621                ReadXdrIter::<_, Frame<TopologyResponseBodyV1>>::new(
56622                    &mut r.inner,
56623                    r.limits.clone(),
56624                )
56625                .map(|r| r.map(|t| Self::TopologyResponseBodyV1(Box::new(t.0)))),
56626            ),
56627            TypeVariant::TopologyResponseBodyV2 => Box::new(
56628                ReadXdrIter::<_, Frame<TopologyResponseBodyV2>>::new(
56629                    &mut r.inner,
56630                    r.limits.clone(),
56631                )
56632                .map(|r| r.map(|t| Self::TopologyResponseBodyV2(Box::new(t.0)))),
56633            ),
56634            TypeVariant::SurveyResponseBody => Box::new(
56635                ReadXdrIter::<_, Frame<SurveyResponseBody>>::new(&mut r.inner, r.limits.clone())
56636                    .map(|r| r.map(|t| Self::SurveyResponseBody(Box::new(t.0)))),
56637            ),
56638            TypeVariant::TxAdvertVector => Box::new(
56639                ReadXdrIter::<_, Frame<TxAdvertVector>>::new(&mut r.inner, r.limits.clone())
56640                    .map(|r| r.map(|t| Self::TxAdvertVector(Box::new(t.0)))),
56641            ),
56642            TypeVariant::FloodAdvert => Box::new(
56643                ReadXdrIter::<_, Frame<FloodAdvert>>::new(&mut r.inner, r.limits.clone())
56644                    .map(|r| r.map(|t| Self::FloodAdvert(Box::new(t.0)))),
56645            ),
56646            TypeVariant::TxDemandVector => Box::new(
56647                ReadXdrIter::<_, Frame<TxDemandVector>>::new(&mut r.inner, r.limits.clone())
56648                    .map(|r| r.map(|t| Self::TxDemandVector(Box::new(t.0)))),
56649            ),
56650            TypeVariant::FloodDemand => Box::new(
56651                ReadXdrIter::<_, Frame<FloodDemand>>::new(&mut r.inner, r.limits.clone())
56652                    .map(|r| r.map(|t| Self::FloodDemand(Box::new(t.0)))),
56653            ),
56654            TypeVariant::StellarMessage => Box::new(
56655                ReadXdrIter::<_, Frame<StellarMessage>>::new(&mut r.inner, r.limits.clone())
56656                    .map(|r| r.map(|t| Self::StellarMessage(Box::new(t.0)))),
56657            ),
56658            TypeVariant::AuthenticatedMessage => Box::new(
56659                ReadXdrIter::<_, Frame<AuthenticatedMessage>>::new(&mut r.inner, r.limits.clone())
56660                    .map(|r| r.map(|t| Self::AuthenticatedMessage(Box::new(t.0)))),
56661            ),
56662            TypeVariant::AuthenticatedMessageV0 => Box::new(
56663                ReadXdrIter::<_, Frame<AuthenticatedMessageV0>>::new(
56664                    &mut r.inner,
56665                    r.limits.clone(),
56666                )
56667                .map(|r| r.map(|t| Self::AuthenticatedMessageV0(Box::new(t.0)))),
56668            ),
56669            TypeVariant::LiquidityPoolParameters => Box::new(
56670                ReadXdrIter::<_, Frame<LiquidityPoolParameters>>::new(
56671                    &mut r.inner,
56672                    r.limits.clone(),
56673                )
56674                .map(|r| r.map(|t| Self::LiquidityPoolParameters(Box::new(t.0)))),
56675            ),
56676            TypeVariant::MuxedAccount => Box::new(
56677                ReadXdrIter::<_, Frame<MuxedAccount>>::new(&mut r.inner, r.limits.clone())
56678                    .map(|r| r.map(|t| Self::MuxedAccount(Box::new(t.0)))),
56679            ),
56680            TypeVariant::MuxedAccountMed25519 => Box::new(
56681                ReadXdrIter::<_, Frame<MuxedAccountMed25519>>::new(&mut r.inner, r.limits.clone())
56682                    .map(|r| r.map(|t| Self::MuxedAccountMed25519(Box::new(t.0)))),
56683            ),
56684            TypeVariant::DecoratedSignature => Box::new(
56685                ReadXdrIter::<_, Frame<DecoratedSignature>>::new(&mut r.inner, r.limits.clone())
56686                    .map(|r| r.map(|t| Self::DecoratedSignature(Box::new(t.0)))),
56687            ),
56688            TypeVariant::OperationType => Box::new(
56689                ReadXdrIter::<_, Frame<OperationType>>::new(&mut r.inner, r.limits.clone())
56690                    .map(|r| r.map(|t| Self::OperationType(Box::new(t.0)))),
56691            ),
56692            TypeVariant::CreateAccountOp => Box::new(
56693                ReadXdrIter::<_, Frame<CreateAccountOp>>::new(&mut r.inner, r.limits.clone())
56694                    .map(|r| r.map(|t| Self::CreateAccountOp(Box::new(t.0)))),
56695            ),
56696            TypeVariant::PaymentOp => Box::new(
56697                ReadXdrIter::<_, Frame<PaymentOp>>::new(&mut r.inner, r.limits.clone())
56698                    .map(|r| r.map(|t| Self::PaymentOp(Box::new(t.0)))),
56699            ),
56700            TypeVariant::PathPaymentStrictReceiveOp => Box::new(
56701                ReadXdrIter::<_, Frame<PathPaymentStrictReceiveOp>>::new(
56702                    &mut r.inner,
56703                    r.limits.clone(),
56704                )
56705                .map(|r| r.map(|t| Self::PathPaymentStrictReceiveOp(Box::new(t.0)))),
56706            ),
56707            TypeVariant::PathPaymentStrictSendOp => Box::new(
56708                ReadXdrIter::<_, Frame<PathPaymentStrictSendOp>>::new(
56709                    &mut r.inner,
56710                    r.limits.clone(),
56711                )
56712                .map(|r| r.map(|t| Self::PathPaymentStrictSendOp(Box::new(t.0)))),
56713            ),
56714            TypeVariant::ManageSellOfferOp => Box::new(
56715                ReadXdrIter::<_, Frame<ManageSellOfferOp>>::new(&mut r.inner, r.limits.clone())
56716                    .map(|r| r.map(|t| Self::ManageSellOfferOp(Box::new(t.0)))),
56717            ),
56718            TypeVariant::ManageBuyOfferOp => Box::new(
56719                ReadXdrIter::<_, Frame<ManageBuyOfferOp>>::new(&mut r.inner, r.limits.clone())
56720                    .map(|r| r.map(|t| Self::ManageBuyOfferOp(Box::new(t.0)))),
56721            ),
56722            TypeVariant::CreatePassiveSellOfferOp => Box::new(
56723                ReadXdrIter::<_, Frame<CreatePassiveSellOfferOp>>::new(
56724                    &mut r.inner,
56725                    r.limits.clone(),
56726                )
56727                .map(|r| r.map(|t| Self::CreatePassiveSellOfferOp(Box::new(t.0)))),
56728            ),
56729            TypeVariant::SetOptionsOp => Box::new(
56730                ReadXdrIter::<_, Frame<SetOptionsOp>>::new(&mut r.inner, r.limits.clone())
56731                    .map(|r| r.map(|t| Self::SetOptionsOp(Box::new(t.0)))),
56732            ),
56733            TypeVariant::ChangeTrustAsset => Box::new(
56734                ReadXdrIter::<_, Frame<ChangeTrustAsset>>::new(&mut r.inner, r.limits.clone())
56735                    .map(|r| r.map(|t| Self::ChangeTrustAsset(Box::new(t.0)))),
56736            ),
56737            TypeVariant::ChangeTrustOp => Box::new(
56738                ReadXdrIter::<_, Frame<ChangeTrustOp>>::new(&mut r.inner, r.limits.clone())
56739                    .map(|r| r.map(|t| Self::ChangeTrustOp(Box::new(t.0)))),
56740            ),
56741            TypeVariant::AllowTrustOp => Box::new(
56742                ReadXdrIter::<_, Frame<AllowTrustOp>>::new(&mut r.inner, r.limits.clone())
56743                    .map(|r| r.map(|t| Self::AllowTrustOp(Box::new(t.0)))),
56744            ),
56745            TypeVariant::ManageDataOp => Box::new(
56746                ReadXdrIter::<_, Frame<ManageDataOp>>::new(&mut r.inner, r.limits.clone())
56747                    .map(|r| r.map(|t| Self::ManageDataOp(Box::new(t.0)))),
56748            ),
56749            TypeVariant::BumpSequenceOp => Box::new(
56750                ReadXdrIter::<_, Frame<BumpSequenceOp>>::new(&mut r.inner, r.limits.clone())
56751                    .map(|r| r.map(|t| Self::BumpSequenceOp(Box::new(t.0)))),
56752            ),
56753            TypeVariant::CreateClaimableBalanceOp => Box::new(
56754                ReadXdrIter::<_, Frame<CreateClaimableBalanceOp>>::new(
56755                    &mut r.inner,
56756                    r.limits.clone(),
56757                )
56758                .map(|r| r.map(|t| Self::CreateClaimableBalanceOp(Box::new(t.0)))),
56759            ),
56760            TypeVariant::ClaimClaimableBalanceOp => Box::new(
56761                ReadXdrIter::<_, Frame<ClaimClaimableBalanceOp>>::new(
56762                    &mut r.inner,
56763                    r.limits.clone(),
56764                )
56765                .map(|r| r.map(|t| Self::ClaimClaimableBalanceOp(Box::new(t.0)))),
56766            ),
56767            TypeVariant::BeginSponsoringFutureReservesOp => Box::new(
56768                ReadXdrIter::<_, Frame<BeginSponsoringFutureReservesOp>>::new(
56769                    &mut r.inner,
56770                    r.limits.clone(),
56771                )
56772                .map(|r| r.map(|t| Self::BeginSponsoringFutureReservesOp(Box::new(t.0)))),
56773            ),
56774            TypeVariant::RevokeSponsorshipType => Box::new(
56775                ReadXdrIter::<_, Frame<RevokeSponsorshipType>>::new(&mut r.inner, r.limits.clone())
56776                    .map(|r| r.map(|t| Self::RevokeSponsorshipType(Box::new(t.0)))),
56777            ),
56778            TypeVariant::RevokeSponsorshipOp => Box::new(
56779                ReadXdrIter::<_, Frame<RevokeSponsorshipOp>>::new(&mut r.inner, r.limits.clone())
56780                    .map(|r| r.map(|t| Self::RevokeSponsorshipOp(Box::new(t.0)))),
56781            ),
56782            TypeVariant::RevokeSponsorshipOpSigner => Box::new(
56783                ReadXdrIter::<_, Frame<RevokeSponsorshipOpSigner>>::new(
56784                    &mut r.inner,
56785                    r.limits.clone(),
56786                )
56787                .map(|r| r.map(|t| Self::RevokeSponsorshipOpSigner(Box::new(t.0)))),
56788            ),
56789            TypeVariant::ClawbackOp => Box::new(
56790                ReadXdrIter::<_, Frame<ClawbackOp>>::new(&mut r.inner, r.limits.clone())
56791                    .map(|r| r.map(|t| Self::ClawbackOp(Box::new(t.0)))),
56792            ),
56793            TypeVariant::ClawbackClaimableBalanceOp => Box::new(
56794                ReadXdrIter::<_, Frame<ClawbackClaimableBalanceOp>>::new(
56795                    &mut r.inner,
56796                    r.limits.clone(),
56797                )
56798                .map(|r| r.map(|t| Self::ClawbackClaimableBalanceOp(Box::new(t.0)))),
56799            ),
56800            TypeVariant::SetTrustLineFlagsOp => Box::new(
56801                ReadXdrIter::<_, Frame<SetTrustLineFlagsOp>>::new(&mut r.inner, r.limits.clone())
56802                    .map(|r| r.map(|t| Self::SetTrustLineFlagsOp(Box::new(t.0)))),
56803            ),
56804            TypeVariant::LiquidityPoolDepositOp => Box::new(
56805                ReadXdrIter::<_, Frame<LiquidityPoolDepositOp>>::new(
56806                    &mut r.inner,
56807                    r.limits.clone(),
56808                )
56809                .map(|r| r.map(|t| Self::LiquidityPoolDepositOp(Box::new(t.0)))),
56810            ),
56811            TypeVariant::LiquidityPoolWithdrawOp => Box::new(
56812                ReadXdrIter::<_, Frame<LiquidityPoolWithdrawOp>>::new(
56813                    &mut r.inner,
56814                    r.limits.clone(),
56815                )
56816                .map(|r| r.map(|t| Self::LiquidityPoolWithdrawOp(Box::new(t.0)))),
56817            ),
56818            TypeVariant::HostFunctionType => Box::new(
56819                ReadXdrIter::<_, Frame<HostFunctionType>>::new(&mut r.inner, r.limits.clone())
56820                    .map(|r| r.map(|t| Self::HostFunctionType(Box::new(t.0)))),
56821            ),
56822            TypeVariant::ContractIdPreimageType => Box::new(
56823                ReadXdrIter::<_, Frame<ContractIdPreimageType>>::new(
56824                    &mut r.inner,
56825                    r.limits.clone(),
56826                )
56827                .map(|r| r.map(|t| Self::ContractIdPreimageType(Box::new(t.0)))),
56828            ),
56829            TypeVariant::ContractIdPreimage => Box::new(
56830                ReadXdrIter::<_, Frame<ContractIdPreimage>>::new(&mut r.inner, r.limits.clone())
56831                    .map(|r| r.map(|t| Self::ContractIdPreimage(Box::new(t.0)))),
56832            ),
56833            TypeVariant::ContractIdPreimageFromAddress => Box::new(
56834                ReadXdrIter::<_, Frame<ContractIdPreimageFromAddress>>::new(
56835                    &mut r.inner,
56836                    r.limits.clone(),
56837                )
56838                .map(|r| r.map(|t| Self::ContractIdPreimageFromAddress(Box::new(t.0)))),
56839            ),
56840            TypeVariant::CreateContractArgs => Box::new(
56841                ReadXdrIter::<_, Frame<CreateContractArgs>>::new(&mut r.inner, r.limits.clone())
56842                    .map(|r| r.map(|t| Self::CreateContractArgs(Box::new(t.0)))),
56843            ),
56844            TypeVariant::CreateContractArgsV2 => Box::new(
56845                ReadXdrIter::<_, Frame<CreateContractArgsV2>>::new(&mut r.inner, r.limits.clone())
56846                    .map(|r| r.map(|t| Self::CreateContractArgsV2(Box::new(t.0)))),
56847            ),
56848            TypeVariant::InvokeContractArgs => Box::new(
56849                ReadXdrIter::<_, Frame<InvokeContractArgs>>::new(&mut r.inner, r.limits.clone())
56850                    .map(|r| r.map(|t| Self::InvokeContractArgs(Box::new(t.0)))),
56851            ),
56852            TypeVariant::HostFunction => Box::new(
56853                ReadXdrIter::<_, Frame<HostFunction>>::new(&mut r.inner, r.limits.clone())
56854                    .map(|r| r.map(|t| Self::HostFunction(Box::new(t.0)))),
56855            ),
56856            TypeVariant::SorobanAuthorizedFunctionType => Box::new(
56857                ReadXdrIter::<_, Frame<SorobanAuthorizedFunctionType>>::new(
56858                    &mut r.inner,
56859                    r.limits.clone(),
56860                )
56861                .map(|r| r.map(|t| Self::SorobanAuthorizedFunctionType(Box::new(t.0)))),
56862            ),
56863            TypeVariant::SorobanAuthorizedFunction => Box::new(
56864                ReadXdrIter::<_, Frame<SorobanAuthorizedFunction>>::new(
56865                    &mut r.inner,
56866                    r.limits.clone(),
56867                )
56868                .map(|r| r.map(|t| Self::SorobanAuthorizedFunction(Box::new(t.0)))),
56869            ),
56870            TypeVariant::SorobanAuthorizedInvocation => Box::new(
56871                ReadXdrIter::<_, Frame<SorobanAuthorizedInvocation>>::new(
56872                    &mut r.inner,
56873                    r.limits.clone(),
56874                )
56875                .map(|r| r.map(|t| Self::SorobanAuthorizedInvocation(Box::new(t.0)))),
56876            ),
56877            TypeVariant::SorobanAddressCredentials => Box::new(
56878                ReadXdrIter::<_, Frame<SorobanAddressCredentials>>::new(
56879                    &mut r.inner,
56880                    r.limits.clone(),
56881                )
56882                .map(|r| r.map(|t| Self::SorobanAddressCredentials(Box::new(t.0)))),
56883            ),
56884            TypeVariant::SorobanCredentialsType => Box::new(
56885                ReadXdrIter::<_, Frame<SorobanCredentialsType>>::new(
56886                    &mut r.inner,
56887                    r.limits.clone(),
56888                )
56889                .map(|r| r.map(|t| Self::SorobanCredentialsType(Box::new(t.0)))),
56890            ),
56891            TypeVariant::SorobanCredentials => Box::new(
56892                ReadXdrIter::<_, Frame<SorobanCredentials>>::new(&mut r.inner, r.limits.clone())
56893                    .map(|r| r.map(|t| Self::SorobanCredentials(Box::new(t.0)))),
56894            ),
56895            TypeVariant::SorobanAuthorizationEntry => Box::new(
56896                ReadXdrIter::<_, Frame<SorobanAuthorizationEntry>>::new(
56897                    &mut r.inner,
56898                    r.limits.clone(),
56899                )
56900                .map(|r| r.map(|t| Self::SorobanAuthorizationEntry(Box::new(t.0)))),
56901            ),
56902            TypeVariant::InvokeHostFunctionOp => Box::new(
56903                ReadXdrIter::<_, Frame<InvokeHostFunctionOp>>::new(&mut r.inner, r.limits.clone())
56904                    .map(|r| r.map(|t| Self::InvokeHostFunctionOp(Box::new(t.0)))),
56905            ),
56906            TypeVariant::ExtendFootprintTtlOp => Box::new(
56907                ReadXdrIter::<_, Frame<ExtendFootprintTtlOp>>::new(&mut r.inner, r.limits.clone())
56908                    .map(|r| r.map(|t| Self::ExtendFootprintTtlOp(Box::new(t.0)))),
56909            ),
56910            TypeVariant::RestoreFootprintOp => Box::new(
56911                ReadXdrIter::<_, Frame<RestoreFootprintOp>>::new(&mut r.inner, r.limits.clone())
56912                    .map(|r| r.map(|t| Self::RestoreFootprintOp(Box::new(t.0)))),
56913            ),
56914            TypeVariant::Operation => Box::new(
56915                ReadXdrIter::<_, Frame<Operation>>::new(&mut r.inner, r.limits.clone())
56916                    .map(|r| r.map(|t| Self::Operation(Box::new(t.0)))),
56917            ),
56918            TypeVariant::OperationBody => Box::new(
56919                ReadXdrIter::<_, Frame<OperationBody>>::new(&mut r.inner, r.limits.clone())
56920                    .map(|r| r.map(|t| Self::OperationBody(Box::new(t.0)))),
56921            ),
56922            TypeVariant::HashIdPreimage => Box::new(
56923                ReadXdrIter::<_, Frame<HashIdPreimage>>::new(&mut r.inner, r.limits.clone())
56924                    .map(|r| r.map(|t| Self::HashIdPreimage(Box::new(t.0)))),
56925            ),
56926            TypeVariant::HashIdPreimageOperationId => Box::new(
56927                ReadXdrIter::<_, Frame<HashIdPreimageOperationId>>::new(
56928                    &mut r.inner,
56929                    r.limits.clone(),
56930                )
56931                .map(|r| r.map(|t| Self::HashIdPreimageOperationId(Box::new(t.0)))),
56932            ),
56933            TypeVariant::HashIdPreimageRevokeId => Box::new(
56934                ReadXdrIter::<_, Frame<HashIdPreimageRevokeId>>::new(
56935                    &mut r.inner,
56936                    r.limits.clone(),
56937                )
56938                .map(|r| r.map(|t| Self::HashIdPreimageRevokeId(Box::new(t.0)))),
56939            ),
56940            TypeVariant::HashIdPreimageContractId => Box::new(
56941                ReadXdrIter::<_, Frame<HashIdPreimageContractId>>::new(
56942                    &mut r.inner,
56943                    r.limits.clone(),
56944                )
56945                .map(|r| r.map(|t| Self::HashIdPreimageContractId(Box::new(t.0)))),
56946            ),
56947            TypeVariant::HashIdPreimageSorobanAuthorization => Box::new(
56948                ReadXdrIter::<_, Frame<HashIdPreimageSorobanAuthorization>>::new(
56949                    &mut r.inner,
56950                    r.limits.clone(),
56951                )
56952                .map(|r| r.map(|t| Self::HashIdPreimageSorobanAuthorization(Box::new(t.0)))),
56953            ),
56954            TypeVariant::MemoType => Box::new(
56955                ReadXdrIter::<_, Frame<MemoType>>::new(&mut r.inner, r.limits.clone())
56956                    .map(|r| r.map(|t| Self::MemoType(Box::new(t.0)))),
56957            ),
56958            TypeVariant::Memo => Box::new(
56959                ReadXdrIter::<_, Frame<Memo>>::new(&mut r.inner, r.limits.clone())
56960                    .map(|r| r.map(|t| Self::Memo(Box::new(t.0)))),
56961            ),
56962            TypeVariant::TimeBounds => Box::new(
56963                ReadXdrIter::<_, Frame<TimeBounds>>::new(&mut r.inner, r.limits.clone())
56964                    .map(|r| r.map(|t| Self::TimeBounds(Box::new(t.0)))),
56965            ),
56966            TypeVariant::LedgerBounds => Box::new(
56967                ReadXdrIter::<_, Frame<LedgerBounds>>::new(&mut r.inner, r.limits.clone())
56968                    .map(|r| r.map(|t| Self::LedgerBounds(Box::new(t.0)))),
56969            ),
56970            TypeVariant::PreconditionsV2 => Box::new(
56971                ReadXdrIter::<_, Frame<PreconditionsV2>>::new(&mut r.inner, r.limits.clone())
56972                    .map(|r| r.map(|t| Self::PreconditionsV2(Box::new(t.0)))),
56973            ),
56974            TypeVariant::PreconditionType => Box::new(
56975                ReadXdrIter::<_, Frame<PreconditionType>>::new(&mut r.inner, r.limits.clone())
56976                    .map(|r| r.map(|t| Self::PreconditionType(Box::new(t.0)))),
56977            ),
56978            TypeVariant::Preconditions => Box::new(
56979                ReadXdrIter::<_, Frame<Preconditions>>::new(&mut r.inner, r.limits.clone())
56980                    .map(|r| r.map(|t| Self::Preconditions(Box::new(t.0)))),
56981            ),
56982            TypeVariant::LedgerFootprint => Box::new(
56983                ReadXdrIter::<_, Frame<LedgerFootprint>>::new(&mut r.inner, r.limits.clone())
56984                    .map(|r| r.map(|t| Self::LedgerFootprint(Box::new(t.0)))),
56985            ),
56986            TypeVariant::ArchivalProofType => Box::new(
56987                ReadXdrIter::<_, Frame<ArchivalProofType>>::new(&mut r.inner, r.limits.clone())
56988                    .map(|r| r.map(|t| Self::ArchivalProofType(Box::new(t.0)))),
56989            ),
56990            TypeVariant::ArchivalProofNode => Box::new(
56991                ReadXdrIter::<_, Frame<ArchivalProofNode>>::new(&mut r.inner, r.limits.clone())
56992                    .map(|r| r.map(|t| Self::ArchivalProofNode(Box::new(t.0)))),
56993            ),
56994            TypeVariant::ProofLevel => Box::new(
56995                ReadXdrIter::<_, Frame<ProofLevel>>::new(&mut r.inner, r.limits.clone())
56996                    .map(|r| r.map(|t| Self::ProofLevel(Box::new(t.0)))),
56997            ),
56998            TypeVariant::ExistenceProofBody => Box::new(
56999                ReadXdrIter::<_, Frame<ExistenceProofBody>>::new(&mut r.inner, r.limits.clone())
57000                    .map(|r| r.map(|t| Self::ExistenceProofBody(Box::new(t.0)))),
57001            ),
57002            TypeVariant::NonexistenceProofBody => Box::new(
57003                ReadXdrIter::<_, Frame<NonexistenceProofBody>>::new(&mut r.inner, r.limits.clone())
57004                    .map(|r| r.map(|t| Self::NonexistenceProofBody(Box::new(t.0)))),
57005            ),
57006            TypeVariant::ArchivalProof => Box::new(
57007                ReadXdrIter::<_, Frame<ArchivalProof>>::new(&mut r.inner, r.limits.clone())
57008                    .map(|r| r.map(|t| Self::ArchivalProof(Box::new(t.0)))),
57009            ),
57010            TypeVariant::ArchivalProofBody => Box::new(
57011                ReadXdrIter::<_, Frame<ArchivalProofBody>>::new(&mut r.inner, r.limits.clone())
57012                    .map(|r| r.map(|t| Self::ArchivalProofBody(Box::new(t.0)))),
57013            ),
57014            TypeVariant::SorobanResources => Box::new(
57015                ReadXdrIter::<_, Frame<SorobanResources>>::new(&mut r.inner, r.limits.clone())
57016                    .map(|r| r.map(|t| Self::SorobanResources(Box::new(t.0)))),
57017            ),
57018            TypeVariant::SorobanTransactionData => Box::new(
57019                ReadXdrIter::<_, Frame<SorobanTransactionData>>::new(
57020                    &mut r.inner,
57021                    r.limits.clone(),
57022                )
57023                .map(|r| r.map(|t| Self::SorobanTransactionData(Box::new(t.0)))),
57024            ),
57025            TypeVariant::SorobanTransactionDataExt => Box::new(
57026                ReadXdrIter::<_, Frame<SorobanTransactionDataExt>>::new(
57027                    &mut r.inner,
57028                    r.limits.clone(),
57029                )
57030                .map(|r| r.map(|t| Self::SorobanTransactionDataExt(Box::new(t.0)))),
57031            ),
57032            TypeVariant::TransactionV0 => Box::new(
57033                ReadXdrIter::<_, Frame<TransactionV0>>::new(&mut r.inner, r.limits.clone())
57034                    .map(|r| r.map(|t| Self::TransactionV0(Box::new(t.0)))),
57035            ),
57036            TypeVariant::TransactionV0Ext => Box::new(
57037                ReadXdrIter::<_, Frame<TransactionV0Ext>>::new(&mut r.inner, r.limits.clone())
57038                    .map(|r| r.map(|t| Self::TransactionV0Ext(Box::new(t.0)))),
57039            ),
57040            TypeVariant::TransactionV0Envelope => Box::new(
57041                ReadXdrIter::<_, Frame<TransactionV0Envelope>>::new(&mut r.inner, r.limits.clone())
57042                    .map(|r| r.map(|t| Self::TransactionV0Envelope(Box::new(t.0)))),
57043            ),
57044            TypeVariant::Transaction => Box::new(
57045                ReadXdrIter::<_, Frame<Transaction>>::new(&mut r.inner, r.limits.clone())
57046                    .map(|r| r.map(|t| Self::Transaction(Box::new(t.0)))),
57047            ),
57048            TypeVariant::TransactionExt => Box::new(
57049                ReadXdrIter::<_, Frame<TransactionExt>>::new(&mut r.inner, r.limits.clone())
57050                    .map(|r| r.map(|t| Self::TransactionExt(Box::new(t.0)))),
57051            ),
57052            TypeVariant::TransactionV1Envelope => Box::new(
57053                ReadXdrIter::<_, Frame<TransactionV1Envelope>>::new(&mut r.inner, r.limits.clone())
57054                    .map(|r| r.map(|t| Self::TransactionV1Envelope(Box::new(t.0)))),
57055            ),
57056            TypeVariant::FeeBumpTransaction => Box::new(
57057                ReadXdrIter::<_, Frame<FeeBumpTransaction>>::new(&mut r.inner, r.limits.clone())
57058                    .map(|r| r.map(|t| Self::FeeBumpTransaction(Box::new(t.0)))),
57059            ),
57060            TypeVariant::FeeBumpTransactionInnerTx => Box::new(
57061                ReadXdrIter::<_, Frame<FeeBumpTransactionInnerTx>>::new(
57062                    &mut r.inner,
57063                    r.limits.clone(),
57064                )
57065                .map(|r| r.map(|t| Self::FeeBumpTransactionInnerTx(Box::new(t.0)))),
57066            ),
57067            TypeVariant::FeeBumpTransactionExt => Box::new(
57068                ReadXdrIter::<_, Frame<FeeBumpTransactionExt>>::new(&mut r.inner, r.limits.clone())
57069                    .map(|r| r.map(|t| Self::FeeBumpTransactionExt(Box::new(t.0)))),
57070            ),
57071            TypeVariant::FeeBumpTransactionEnvelope => Box::new(
57072                ReadXdrIter::<_, Frame<FeeBumpTransactionEnvelope>>::new(
57073                    &mut r.inner,
57074                    r.limits.clone(),
57075                )
57076                .map(|r| r.map(|t| Self::FeeBumpTransactionEnvelope(Box::new(t.0)))),
57077            ),
57078            TypeVariant::TransactionEnvelope => Box::new(
57079                ReadXdrIter::<_, Frame<TransactionEnvelope>>::new(&mut r.inner, r.limits.clone())
57080                    .map(|r| r.map(|t| Self::TransactionEnvelope(Box::new(t.0)))),
57081            ),
57082            TypeVariant::TransactionSignaturePayload => Box::new(
57083                ReadXdrIter::<_, Frame<TransactionSignaturePayload>>::new(
57084                    &mut r.inner,
57085                    r.limits.clone(),
57086                )
57087                .map(|r| r.map(|t| Self::TransactionSignaturePayload(Box::new(t.0)))),
57088            ),
57089            TypeVariant::TransactionSignaturePayloadTaggedTransaction => Box::new(
57090                ReadXdrIter::<_, Frame<TransactionSignaturePayloadTaggedTransaction>>::new(
57091                    &mut r.inner,
57092                    r.limits.clone(),
57093                )
57094                .map(|r| {
57095                    r.map(|t| Self::TransactionSignaturePayloadTaggedTransaction(Box::new(t.0)))
57096                }),
57097            ),
57098            TypeVariant::ClaimAtomType => Box::new(
57099                ReadXdrIter::<_, Frame<ClaimAtomType>>::new(&mut r.inner, r.limits.clone())
57100                    .map(|r| r.map(|t| Self::ClaimAtomType(Box::new(t.0)))),
57101            ),
57102            TypeVariant::ClaimOfferAtomV0 => Box::new(
57103                ReadXdrIter::<_, Frame<ClaimOfferAtomV0>>::new(&mut r.inner, r.limits.clone())
57104                    .map(|r| r.map(|t| Self::ClaimOfferAtomV0(Box::new(t.0)))),
57105            ),
57106            TypeVariant::ClaimOfferAtom => Box::new(
57107                ReadXdrIter::<_, Frame<ClaimOfferAtom>>::new(&mut r.inner, r.limits.clone())
57108                    .map(|r| r.map(|t| Self::ClaimOfferAtom(Box::new(t.0)))),
57109            ),
57110            TypeVariant::ClaimLiquidityAtom => Box::new(
57111                ReadXdrIter::<_, Frame<ClaimLiquidityAtom>>::new(&mut r.inner, r.limits.clone())
57112                    .map(|r| r.map(|t| Self::ClaimLiquidityAtom(Box::new(t.0)))),
57113            ),
57114            TypeVariant::ClaimAtom => Box::new(
57115                ReadXdrIter::<_, Frame<ClaimAtom>>::new(&mut r.inner, r.limits.clone())
57116                    .map(|r| r.map(|t| Self::ClaimAtom(Box::new(t.0)))),
57117            ),
57118            TypeVariant::CreateAccountResultCode => Box::new(
57119                ReadXdrIter::<_, Frame<CreateAccountResultCode>>::new(
57120                    &mut r.inner,
57121                    r.limits.clone(),
57122                )
57123                .map(|r| r.map(|t| Self::CreateAccountResultCode(Box::new(t.0)))),
57124            ),
57125            TypeVariant::CreateAccountResult => Box::new(
57126                ReadXdrIter::<_, Frame<CreateAccountResult>>::new(&mut r.inner, r.limits.clone())
57127                    .map(|r| r.map(|t| Self::CreateAccountResult(Box::new(t.0)))),
57128            ),
57129            TypeVariant::PaymentResultCode => Box::new(
57130                ReadXdrIter::<_, Frame<PaymentResultCode>>::new(&mut r.inner, r.limits.clone())
57131                    .map(|r| r.map(|t| Self::PaymentResultCode(Box::new(t.0)))),
57132            ),
57133            TypeVariant::PaymentResult => Box::new(
57134                ReadXdrIter::<_, Frame<PaymentResult>>::new(&mut r.inner, r.limits.clone())
57135                    .map(|r| r.map(|t| Self::PaymentResult(Box::new(t.0)))),
57136            ),
57137            TypeVariant::PathPaymentStrictReceiveResultCode => Box::new(
57138                ReadXdrIter::<_, Frame<PathPaymentStrictReceiveResultCode>>::new(
57139                    &mut r.inner,
57140                    r.limits.clone(),
57141                )
57142                .map(|r| r.map(|t| Self::PathPaymentStrictReceiveResultCode(Box::new(t.0)))),
57143            ),
57144            TypeVariant::SimplePaymentResult => Box::new(
57145                ReadXdrIter::<_, Frame<SimplePaymentResult>>::new(&mut r.inner, r.limits.clone())
57146                    .map(|r| r.map(|t| Self::SimplePaymentResult(Box::new(t.0)))),
57147            ),
57148            TypeVariant::PathPaymentStrictReceiveResult => Box::new(
57149                ReadXdrIter::<_, Frame<PathPaymentStrictReceiveResult>>::new(
57150                    &mut r.inner,
57151                    r.limits.clone(),
57152                )
57153                .map(|r| r.map(|t| Self::PathPaymentStrictReceiveResult(Box::new(t.0)))),
57154            ),
57155            TypeVariant::PathPaymentStrictReceiveResultSuccess => Box::new(
57156                ReadXdrIter::<_, Frame<PathPaymentStrictReceiveResultSuccess>>::new(
57157                    &mut r.inner,
57158                    r.limits.clone(),
57159                )
57160                .map(|r| r.map(|t| Self::PathPaymentStrictReceiveResultSuccess(Box::new(t.0)))),
57161            ),
57162            TypeVariant::PathPaymentStrictSendResultCode => Box::new(
57163                ReadXdrIter::<_, Frame<PathPaymentStrictSendResultCode>>::new(
57164                    &mut r.inner,
57165                    r.limits.clone(),
57166                )
57167                .map(|r| r.map(|t| Self::PathPaymentStrictSendResultCode(Box::new(t.0)))),
57168            ),
57169            TypeVariant::PathPaymentStrictSendResult => Box::new(
57170                ReadXdrIter::<_, Frame<PathPaymentStrictSendResult>>::new(
57171                    &mut r.inner,
57172                    r.limits.clone(),
57173                )
57174                .map(|r| r.map(|t| Self::PathPaymentStrictSendResult(Box::new(t.0)))),
57175            ),
57176            TypeVariant::PathPaymentStrictSendResultSuccess => Box::new(
57177                ReadXdrIter::<_, Frame<PathPaymentStrictSendResultSuccess>>::new(
57178                    &mut r.inner,
57179                    r.limits.clone(),
57180                )
57181                .map(|r| r.map(|t| Self::PathPaymentStrictSendResultSuccess(Box::new(t.0)))),
57182            ),
57183            TypeVariant::ManageSellOfferResultCode => Box::new(
57184                ReadXdrIter::<_, Frame<ManageSellOfferResultCode>>::new(
57185                    &mut r.inner,
57186                    r.limits.clone(),
57187                )
57188                .map(|r| r.map(|t| Self::ManageSellOfferResultCode(Box::new(t.0)))),
57189            ),
57190            TypeVariant::ManageOfferEffect => Box::new(
57191                ReadXdrIter::<_, Frame<ManageOfferEffect>>::new(&mut r.inner, r.limits.clone())
57192                    .map(|r| r.map(|t| Self::ManageOfferEffect(Box::new(t.0)))),
57193            ),
57194            TypeVariant::ManageOfferSuccessResult => Box::new(
57195                ReadXdrIter::<_, Frame<ManageOfferSuccessResult>>::new(
57196                    &mut r.inner,
57197                    r.limits.clone(),
57198                )
57199                .map(|r| r.map(|t| Self::ManageOfferSuccessResult(Box::new(t.0)))),
57200            ),
57201            TypeVariant::ManageOfferSuccessResultOffer => Box::new(
57202                ReadXdrIter::<_, Frame<ManageOfferSuccessResultOffer>>::new(
57203                    &mut r.inner,
57204                    r.limits.clone(),
57205                )
57206                .map(|r| r.map(|t| Self::ManageOfferSuccessResultOffer(Box::new(t.0)))),
57207            ),
57208            TypeVariant::ManageSellOfferResult => Box::new(
57209                ReadXdrIter::<_, Frame<ManageSellOfferResult>>::new(&mut r.inner, r.limits.clone())
57210                    .map(|r| r.map(|t| Self::ManageSellOfferResult(Box::new(t.0)))),
57211            ),
57212            TypeVariant::ManageBuyOfferResultCode => Box::new(
57213                ReadXdrIter::<_, Frame<ManageBuyOfferResultCode>>::new(
57214                    &mut r.inner,
57215                    r.limits.clone(),
57216                )
57217                .map(|r| r.map(|t| Self::ManageBuyOfferResultCode(Box::new(t.0)))),
57218            ),
57219            TypeVariant::ManageBuyOfferResult => Box::new(
57220                ReadXdrIter::<_, Frame<ManageBuyOfferResult>>::new(&mut r.inner, r.limits.clone())
57221                    .map(|r| r.map(|t| Self::ManageBuyOfferResult(Box::new(t.0)))),
57222            ),
57223            TypeVariant::SetOptionsResultCode => Box::new(
57224                ReadXdrIter::<_, Frame<SetOptionsResultCode>>::new(&mut r.inner, r.limits.clone())
57225                    .map(|r| r.map(|t| Self::SetOptionsResultCode(Box::new(t.0)))),
57226            ),
57227            TypeVariant::SetOptionsResult => Box::new(
57228                ReadXdrIter::<_, Frame<SetOptionsResult>>::new(&mut r.inner, r.limits.clone())
57229                    .map(|r| r.map(|t| Self::SetOptionsResult(Box::new(t.0)))),
57230            ),
57231            TypeVariant::ChangeTrustResultCode => Box::new(
57232                ReadXdrIter::<_, Frame<ChangeTrustResultCode>>::new(&mut r.inner, r.limits.clone())
57233                    .map(|r| r.map(|t| Self::ChangeTrustResultCode(Box::new(t.0)))),
57234            ),
57235            TypeVariant::ChangeTrustResult => Box::new(
57236                ReadXdrIter::<_, Frame<ChangeTrustResult>>::new(&mut r.inner, r.limits.clone())
57237                    .map(|r| r.map(|t| Self::ChangeTrustResult(Box::new(t.0)))),
57238            ),
57239            TypeVariant::AllowTrustResultCode => Box::new(
57240                ReadXdrIter::<_, Frame<AllowTrustResultCode>>::new(&mut r.inner, r.limits.clone())
57241                    .map(|r| r.map(|t| Self::AllowTrustResultCode(Box::new(t.0)))),
57242            ),
57243            TypeVariant::AllowTrustResult => Box::new(
57244                ReadXdrIter::<_, Frame<AllowTrustResult>>::new(&mut r.inner, r.limits.clone())
57245                    .map(|r| r.map(|t| Self::AllowTrustResult(Box::new(t.0)))),
57246            ),
57247            TypeVariant::AccountMergeResultCode => Box::new(
57248                ReadXdrIter::<_, Frame<AccountMergeResultCode>>::new(
57249                    &mut r.inner,
57250                    r.limits.clone(),
57251                )
57252                .map(|r| r.map(|t| Self::AccountMergeResultCode(Box::new(t.0)))),
57253            ),
57254            TypeVariant::AccountMergeResult => Box::new(
57255                ReadXdrIter::<_, Frame<AccountMergeResult>>::new(&mut r.inner, r.limits.clone())
57256                    .map(|r| r.map(|t| Self::AccountMergeResult(Box::new(t.0)))),
57257            ),
57258            TypeVariant::InflationResultCode => Box::new(
57259                ReadXdrIter::<_, Frame<InflationResultCode>>::new(&mut r.inner, r.limits.clone())
57260                    .map(|r| r.map(|t| Self::InflationResultCode(Box::new(t.0)))),
57261            ),
57262            TypeVariant::InflationPayout => Box::new(
57263                ReadXdrIter::<_, Frame<InflationPayout>>::new(&mut r.inner, r.limits.clone())
57264                    .map(|r| r.map(|t| Self::InflationPayout(Box::new(t.0)))),
57265            ),
57266            TypeVariant::InflationResult => Box::new(
57267                ReadXdrIter::<_, Frame<InflationResult>>::new(&mut r.inner, r.limits.clone())
57268                    .map(|r| r.map(|t| Self::InflationResult(Box::new(t.0)))),
57269            ),
57270            TypeVariant::ManageDataResultCode => Box::new(
57271                ReadXdrIter::<_, Frame<ManageDataResultCode>>::new(&mut r.inner, r.limits.clone())
57272                    .map(|r| r.map(|t| Self::ManageDataResultCode(Box::new(t.0)))),
57273            ),
57274            TypeVariant::ManageDataResult => Box::new(
57275                ReadXdrIter::<_, Frame<ManageDataResult>>::new(&mut r.inner, r.limits.clone())
57276                    .map(|r| r.map(|t| Self::ManageDataResult(Box::new(t.0)))),
57277            ),
57278            TypeVariant::BumpSequenceResultCode => Box::new(
57279                ReadXdrIter::<_, Frame<BumpSequenceResultCode>>::new(
57280                    &mut r.inner,
57281                    r.limits.clone(),
57282                )
57283                .map(|r| r.map(|t| Self::BumpSequenceResultCode(Box::new(t.0)))),
57284            ),
57285            TypeVariant::BumpSequenceResult => Box::new(
57286                ReadXdrIter::<_, Frame<BumpSequenceResult>>::new(&mut r.inner, r.limits.clone())
57287                    .map(|r| r.map(|t| Self::BumpSequenceResult(Box::new(t.0)))),
57288            ),
57289            TypeVariant::CreateClaimableBalanceResultCode => Box::new(
57290                ReadXdrIter::<_, Frame<CreateClaimableBalanceResultCode>>::new(
57291                    &mut r.inner,
57292                    r.limits.clone(),
57293                )
57294                .map(|r| r.map(|t| Self::CreateClaimableBalanceResultCode(Box::new(t.0)))),
57295            ),
57296            TypeVariant::CreateClaimableBalanceResult => Box::new(
57297                ReadXdrIter::<_, Frame<CreateClaimableBalanceResult>>::new(
57298                    &mut r.inner,
57299                    r.limits.clone(),
57300                )
57301                .map(|r| r.map(|t| Self::CreateClaimableBalanceResult(Box::new(t.0)))),
57302            ),
57303            TypeVariant::ClaimClaimableBalanceResultCode => Box::new(
57304                ReadXdrIter::<_, Frame<ClaimClaimableBalanceResultCode>>::new(
57305                    &mut r.inner,
57306                    r.limits.clone(),
57307                )
57308                .map(|r| r.map(|t| Self::ClaimClaimableBalanceResultCode(Box::new(t.0)))),
57309            ),
57310            TypeVariant::ClaimClaimableBalanceResult => Box::new(
57311                ReadXdrIter::<_, Frame<ClaimClaimableBalanceResult>>::new(
57312                    &mut r.inner,
57313                    r.limits.clone(),
57314                )
57315                .map(|r| r.map(|t| Self::ClaimClaimableBalanceResult(Box::new(t.0)))),
57316            ),
57317            TypeVariant::BeginSponsoringFutureReservesResultCode => Box::new(
57318                ReadXdrIter::<_, Frame<BeginSponsoringFutureReservesResultCode>>::new(
57319                    &mut r.inner,
57320                    r.limits.clone(),
57321                )
57322                .map(|r| r.map(|t| Self::BeginSponsoringFutureReservesResultCode(Box::new(t.0)))),
57323            ),
57324            TypeVariant::BeginSponsoringFutureReservesResult => Box::new(
57325                ReadXdrIter::<_, Frame<BeginSponsoringFutureReservesResult>>::new(
57326                    &mut r.inner,
57327                    r.limits.clone(),
57328                )
57329                .map(|r| r.map(|t| Self::BeginSponsoringFutureReservesResult(Box::new(t.0)))),
57330            ),
57331            TypeVariant::EndSponsoringFutureReservesResultCode => Box::new(
57332                ReadXdrIter::<_, Frame<EndSponsoringFutureReservesResultCode>>::new(
57333                    &mut r.inner,
57334                    r.limits.clone(),
57335                )
57336                .map(|r| r.map(|t| Self::EndSponsoringFutureReservesResultCode(Box::new(t.0)))),
57337            ),
57338            TypeVariant::EndSponsoringFutureReservesResult => Box::new(
57339                ReadXdrIter::<_, Frame<EndSponsoringFutureReservesResult>>::new(
57340                    &mut r.inner,
57341                    r.limits.clone(),
57342                )
57343                .map(|r| r.map(|t| Self::EndSponsoringFutureReservesResult(Box::new(t.0)))),
57344            ),
57345            TypeVariant::RevokeSponsorshipResultCode => Box::new(
57346                ReadXdrIter::<_, Frame<RevokeSponsorshipResultCode>>::new(
57347                    &mut r.inner,
57348                    r.limits.clone(),
57349                )
57350                .map(|r| r.map(|t| Self::RevokeSponsorshipResultCode(Box::new(t.0)))),
57351            ),
57352            TypeVariant::RevokeSponsorshipResult => Box::new(
57353                ReadXdrIter::<_, Frame<RevokeSponsorshipResult>>::new(
57354                    &mut r.inner,
57355                    r.limits.clone(),
57356                )
57357                .map(|r| r.map(|t| Self::RevokeSponsorshipResult(Box::new(t.0)))),
57358            ),
57359            TypeVariant::ClawbackResultCode => Box::new(
57360                ReadXdrIter::<_, Frame<ClawbackResultCode>>::new(&mut r.inner, r.limits.clone())
57361                    .map(|r| r.map(|t| Self::ClawbackResultCode(Box::new(t.0)))),
57362            ),
57363            TypeVariant::ClawbackResult => Box::new(
57364                ReadXdrIter::<_, Frame<ClawbackResult>>::new(&mut r.inner, r.limits.clone())
57365                    .map(|r| r.map(|t| Self::ClawbackResult(Box::new(t.0)))),
57366            ),
57367            TypeVariant::ClawbackClaimableBalanceResultCode => Box::new(
57368                ReadXdrIter::<_, Frame<ClawbackClaimableBalanceResultCode>>::new(
57369                    &mut r.inner,
57370                    r.limits.clone(),
57371                )
57372                .map(|r| r.map(|t| Self::ClawbackClaimableBalanceResultCode(Box::new(t.0)))),
57373            ),
57374            TypeVariant::ClawbackClaimableBalanceResult => Box::new(
57375                ReadXdrIter::<_, Frame<ClawbackClaimableBalanceResult>>::new(
57376                    &mut r.inner,
57377                    r.limits.clone(),
57378                )
57379                .map(|r| r.map(|t| Self::ClawbackClaimableBalanceResult(Box::new(t.0)))),
57380            ),
57381            TypeVariant::SetTrustLineFlagsResultCode => Box::new(
57382                ReadXdrIter::<_, Frame<SetTrustLineFlagsResultCode>>::new(
57383                    &mut r.inner,
57384                    r.limits.clone(),
57385                )
57386                .map(|r| r.map(|t| Self::SetTrustLineFlagsResultCode(Box::new(t.0)))),
57387            ),
57388            TypeVariant::SetTrustLineFlagsResult => Box::new(
57389                ReadXdrIter::<_, Frame<SetTrustLineFlagsResult>>::new(
57390                    &mut r.inner,
57391                    r.limits.clone(),
57392                )
57393                .map(|r| r.map(|t| Self::SetTrustLineFlagsResult(Box::new(t.0)))),
57394            ),
57395            TypeVariant::LiquidityPoolDepositResultCode => Box::new(
57396                ReadXdrIter::<_, Frame<LiquidityPoolDepositResultCode>>::new(
57397                    &mut r.inner,
57398                    r.limits.clone(),
57399                )
57400                .map(|r| r.map(|t| Self::LiquidityPoolDepositResultCode(Box::new(t.0)))),
57401            ),
57402            TypeVariant::LiquidityPoolDepositResult => Box::new(
57403                ReadXdrIter::<_, Frame<LiquidityPoolDepositResult>>::new(
57404                    &mut r.inner,
57405                    r.limits.clone(),
57406                )
57407                .map(|r| r.map(|t| Self::LiquidityPoolDepositResult(Box::new(t.0)))),
57408            ),
57409            TypeVariant::LiquidityPoolWithdrawResultCode => Box::new(
57410                ReadXdrIter::<_, Frame<LiquidityPoolWithdrawResultCode>>::new(
57411                    &mut r.inner,
57412                    r.limits.clone(),
57413                )
57414                .map(|r| r.map(|t| Self::LiquidityPoolWithdrawResultCode(Box::new(t.0)))),
57415            ),
57416            TypeVariant::LiquidityPoolWithdrawResult => Box::new(
57417                ReadXdrIter::<_, Frame<LiquidityPoolWithdrawResult>>::new(
57418                    &mut r.inner,
57419                    r.limits.clone(),
57420                )
57421                .map(|r| r.map(|t| Self::LiquidityPoolWithdrawResult(Box::new(t.0)))),
57422            ),
57423            TypeVariant::InvokeHostFunctionResultCode => Box::new(
57424                ReadXdrIter::<_, Frame<InvokeHostFunctionResultCode>>::new(
57425                    &mut r.inner,
57426                    r.limits.clone(),
57427                )
57428                .map(|r| r.map(|t| Self::InvokeHostFunctionResultCode(Box::new(t.0)))),
57429            ),
57430            TypeVariant::InvokeHostFunctionResult => Box::new(
57431                ReadXdrIter::<_, Frame<InvokeHostFunctionResult>>::new(
57432                    &mut r.inner,
57433                    r.limits.clone(),
57434                )
57435                .map(|r| r.map(|t| Self::InvokeHostFunctionResult(Box::new(t.0)))),
57436            ),
57437            TypeVariant::ExtendFootprintTtlResultCode => Box::new(
57438                ReadXdrIter::<_, Frame<ExtendFootprintTtlResultCode>>::new(
57439                    &mut r.inner,
57440                    r.limits.clone(),
57441                )
57442                .map(|r| r.map(|t| Self::ExtendFootprintTtlResultCode(Box::new(t.0)))),
57443            ),
57444            TypeVariant::ExtendFootprintTtlResult => Box::new(
57445                ReadXdrIter::<_, Frame<ExtendFootprintTtlResult>>::new(
57446                    &mut r.inner,
57447                    r.limits.clone(),
57448                )
57449                .map(|r| r.map(|t| Self::ExtendFootprintTtlResult(Box::new(t.0)))),
57450            ),
57451            TypeVariant::RestoreFootprintResultCode => Box::new(
57452                ReadXdrIter::<_, Frame<RestoreFootprintResultCode>>::new(
57453                    &mut r.inner,
57454                    r.limits.clone(),
57455                )
57456                .map(|r| r.map(|t| Self::RestoreFootprintResultCode(Box::new(t.0)))),
57457            ),
57458            TypeVariant::RestoreFootprintResult => Box::new(
57459                ReadXdrIter::<_, Frame<RestoreFootprintResult>>::new(
57460                    &mut r.inner,
57461                    r.limits.clone(),
57462                )
57463                .map(|r| r.map(|t| Self::RestoreFootprintResult(Box::new(t.0)))),
57464            ),
57465            TypeVariant::OperationResultCode => Box::new(
57466                ReadXdrIter::<_, Frame<OperationResultCode>>::new(&mut r.inner, r.limits.clone())
57467                    .map(|r| r.map(|t| Self::OperationResultCode(Box::new(t.0)))),
57468            ),
57469            TypeVariant::OperationResult => Box::new(
57470                ReadXdrIter::<_, Frame<OperationResult>>::new(&mut r.inner, r.limits.clone())
57471                    .map(|r| r.map(|t| Self::OperationResult(Box::new(t.0)))),
57472            ),
57473            TypeVariant::OperationResultTr => Box::new(
57474                ReadXdrIter::<_, Frame<OperationResultTr>>::new(&mut r.inner, r.limits.clone())
57475                    .map(|r| r.map(|t| Self::OperationResultTr(Box::new(t.0)))),
57476            ),
57477            TypeVariant::TransactionResultCode => Box::new(
57478                ReadXdrIter::<_, Frame<TransactionResultCode>>::new(&mut r.inner, r.limits.clone())
57479                    .map(|r| r.map(|t| Self::TransactionResultCode(Box::new(t.0)))),
57480            ),
57481            TypeVariant::InnerTransactionResult => Box::new(
57482                ReadXdrIter::<_, Frame<InnerTransactionResult>>::new(
57483                    &mut r.inner,
57484                    r.limits.clone(),
57485                )
57486                .map(|r| r.map(|t| Self::InnerTransactionResult(Box::new(t.0)))),
57487            ),
57488            TypeVariant::InnerTransactionResultResult => Box::new(
57489                ReadXdrIter::<_, Frame<InnerTransactionResultResult>>::new(
57490                    &mut r.inner,
57491                    r.limits.clone(),
57492                )
57493                .map(|r| r.map(|t| Self::InnerTransactionResultResult(Box::new(t.0)))),
57494            ),
57495            TypeVariant::InnerTransactionResultExt => Box::new(
57496                ReadXdrIter::<_, Frame<InnerTransactionResultExt>>::new(
57497                    &mut r.inner,
57498                    r.limits.clone(),
57499                )
57500                .map(|r| r.map(|t| Self::InnerTransactionResultExt(Box::new(t.0)))),
57501            ),
57502            TypeVariant::InnerTransactionResultPair => Box::new(
57503                ReadXdrIter::<_, Frame<InnerTransactionResultPair>>::new(
57504                    &mut r.inner,
57505                    r.limits.clone(),
57506                )
57507                .map(|r| r.map(|t| Self::InnerTransactionResultPair(Box::new(t.0)))),
57508            ),
57509            TypeVariant::TransactionResult => Box::new(
57510                ReadXdrIter::<_, Frame<TransactionResult>>::new(&mut r.inner, r.limits.clone())
57511                    .map(|r| r.map(|t| Self::TransactionResult(Box::new(t.0)))),
57512            ),
57513            TypeVariant::TransactionResultResult => Box::new(
57514                ReadXdrIter::<_, Frame<TransactionResultResult>>::new(
57515                    &mut r.inner,
57516                    r.limits.clone(),
57517                )
57518                .map(|r| r.map(|t| Self::TransactionResultResult(Box::new(t.0)))),
57519            ),
57520            TypeVariant::TransactionResultExt => Box::new(
57521                ReadXdrIter::<_, Frame<TransactionResultExt>>::new(&mut r.inner, r.limits.clone())
57522                    .map(|r| r.map(|t| Self::TransactionResultExt(Box::new(t.0)))),
57523            ),
57524            TypeVariant::Hash => Box::new(
57525                ReadXdrIter::<_, Frame<Hash>>::new(&mut r.inner, r.limits.clone())
57526                    .map(|r| r.map(|t| Self::Hash(Box::new(t.0)))),
57527            ),
57528            TypeVariant::Uint256 => Box::new(
57529                ReadXdrIter::<_, Frame<Uint256>>::new(&mut r.inner, r.limits.clone())
57530                    .map(|r| r.map(|t| Self::Uint256(Box::new(t.0)))),
57531            ),
57532            TypeVariant::Uint32 => Box::new(
57533                ReadXdrIter::<_, Frame<Uint32>>::new(&mut r.inner, r.limits.clone())
57534                    .map(|r| r.map(|t| Self::Uint32(Box::new(t.0)))),
57535            ),
57536            TypeVariant::Int32 => Box::new(
57537                ReadXdrIter::<_, Frame<Int32>>::new(&mut r.inner, r.limits.clone())
57538                    .map(|r| r.map(|t| Self::Int32(Box::new(t.0)))),
57539            ),
57540            TypeVariant::Uint64 => Box::new(
57541                ReadXdrIter::<_, Frame<Uint64>>::new(&mut r.inner, r.limits.clone())
57542                    .map(|r| r.map(|t| Self::Uint64(Box::new(t.0)))),
57543            ),
57544            TypeVariant::Int64 => Box::new(
57545                ReadXdrIter::<_, Frame<Int64>>::new(&mut r.inner, r.limits.clone())
57546                    .map(|r| r.map(|t| Self::Int64(Box::new(t.0)))),
57547            ),
57548            TypeVariant::TimePoint => Box::new(
57549                ReadXdrIter::<_, Frame<TimePoint>>::new(&mut r.inner, r.limits.clone())
57550                    .map(|r| r.map(|t| Self::TimePoint(Box::new(t.0)))),
57551            ),
57552            TypeVariant::Duration => Box::new(
57553                ReadXdrIter::<_, Frame<Duration>>::new(&mut r.inner, r.limits.clone())
57554                    .map(|r| r.map(|t| Self::Duration(Box::new(t.0)))),
57555            ),
57556            TypeVariant::ExtensionPoint => Box::new(
57557                ReadXdrIter::<_, Frame<ExtensionPoint>>::new(&mut r.inner, r.limits.clone())
57558                    .map(|r| r.map(|t| Self::ExtensionPoint(Box::new(t.0)))),
57559            ),
57560            TypeVariant::CryptoKeyType => Box::new(
57561                ReadXdrIter::<_, Frame<CryptoKeyType>>::new(&mut r.inner, r.limits.clone())
57562                    .map(|r| r.map(|t| Self::CryptoKeyType(Box::new(t.0)))),
57563            ),
57564            TypeVariant::PublicKeyType => Box::new(
57565                ReadXdrIter::<_, Frame<PublicKeyType>>::new(&mut r.inner, r.limits.clone())
57566                    .map(|r| r.map(|t| Self::PublicKeyType(Box::new(t.0)))),
57567            ),
57568            TypeVariant::SignerKeyType => Box::new(
57569                ReadXdrIter::<_, Frame<SignerKeyType>>::new(&mut r.inner, r.limits.clone())
57570                    .map(|r| r.map(|t| Self::SignerKeyType(Box::new(t.0)))),
57571            ),
57572            TypeVariant::PublicKey => Box::new(
57573                ReadXdrIter::<_, Frame<PublicKey>>::new(&mut r.inner, r.limits.clone())
57574                    .map(|r| r.map(|t| Self::PublicKey(Box::new(t.0)))),
57575            ),
57576            TypeVariant::SignerKey => Box::new(
57577                ReadXdrIter::<_, Frame<SignerKey>>::new(&mut r.inner, r.limits.clone())
57578                    .map(|r| r.map(|t| Self::SignerKey(Box::new(t.0)))),
57579            ),
57580            TypeVariant::SignerKeyEd25519SignedPayload => Box::new(
57581                ReadXdrIter::<_, Frame<SignerKeyEd25519SignedPayload>>::new(
57582                    &mut r.inner,
57583                    r.limits.clone(),
57584                )
57585                .map(|r| r.map(|t| Self::SignerKeyEd25519SignedPayload(Box::new(t.0)))),
57586            ),
57587            TypeVariant::Signature => Box::new(
57588                ReadXdrIter::<_, Frame<Signature>>::new(&mut r.inner, r.limits.clone())
57589                    .map(|r| r.map(|t| Self::Signature(Box::new(t.0)))),
57590            ),
57591            TypeVariant::SignatureHint => Box::new(
57592                ReadXdrIter::<_, Frame<SignatureHint>>::new(&mut r.inner, r.limits.clone())
57593                    .map(|r| r.map(|t| Self::SignatureHint(Box::new(t.0)))),
57594            ),
57595            TypeVariant::NodeId => Box::new(
57596                ReadXdrIter::<_, Frame<NodeId>>::new(&mut r.inner, r.limits.clone())
57597                    .map(|r| r.map(|t| Self::NodeId(Box::new(t.0)))),
57598            ),
57599            TypeVariant::AccountId => Box::new(
57600                ReadXdrIter::<_, Frame<AccountId>>::new(&mut r.inner, r.limits.clone())
57601                    .map(|r| r.map(|t| Self::AccountId(Box::new(t.0)))),
57602            ),
57603            TypeVariant::Curve25519Secret => Box::new(
57604                ReadXdrIter::<_, Frame<Curve25519Secret>>::new(&mut r.inner, r.limits.clone())
57605                    .map(|r| r.map(|t| Self::Curve25519Secret(Box::new(t.0)))),
57606            ),
57607            TypeVariant::Curve25519Public => Box::new(
57608                ReadXdrIter::<_, Frame<Curve25519Public>>::new(&mut r.inner, r.limits.clone())
57609                    .map(|r| r.map(|t| Self::Curve25519Public(Box::new(t.0)))),
57610            ),
57611            TypeVariant::HmacSha256Key => Box::new(
57612                ReadXdrIter::<_, Frame<HmacSha256Key>>::new(&mut r.inner, r.limits.clone())
57613                    .map(|r| r.map(|t| Self::HmacSha256Key(Box::new(t.0)))),
57614            ),
57615            TypeVariant::HmacSha256Mac => Box::new(
57616                ReadXdrIter::<_, Frame<HmacSha256Mac>>::new(&mut r.inner, r.limits.clone())
57617                    .map(|r| r.map(|t| Self::HmacSha256Mac(Box::new(t.0)))),
57618            ),
57619            TypeVariant::ShortHashSeed => Box::new(
57620                ReadXdrIter::<_, Frame<ShortHashSeed>>::new(&mut r.inner, r.limits.clone())
57621                    .map(|r| r.map(|t| Self::ShortHashSeed(Box::new(t.0)))),
57622            ),
57623            TypeVariant::BinaryFuseFilterType => Box::new(
57624                ReadXdrIter::<_, Frame<BinaryFuseFilterType>>::new(&mut r.inner, r.limits.clone())
57625                    .map(|r| r.map(|t| Self::BinaryFuseFilterType(Box::new(t.0)))),
57626            ),
57627            TypeVariant::SerializedBinaryFuseFilter => Box::new(
57628                ReadXdrIter::<_, Frame<SerializedBinaryFuseFilter>>::new(
57629                    &mut r.inner,
57630                    r.limits.clone(),
57631                )
57632                .map(|r| r.map(|t| Self::SerializedBinaryFuseFilter(Box::new(t.0)))),
57633            ),
57634        }
57635    }
57636
57637    #[cfg(feature = "base64")]
57638    #[allow(clippy::too_many_lines)]
57639    pub fn read_xdr_base64_iter<R: Read>(
57640        v: TypeVariant,
57641        r: &mut Limited<R>,
57642    ) -> Box<dyn Iterator<Item = Result<Self>> + '_> {
57643        let dec = base64::read::DecoderReader::new(&mut r.inner, base64::STANDARD);
57644        match v {
57645            TypeVariant::Value => Box::new(
57646                ReadXdrIter::<_, Value>::new(dec, r.limits.clone())
57647                    .map(|r| r.map(|t| Self::Value(Box::new(t)))),
57648            ),
57649            TypeVariant::ScpBallot => Box::new(
57650                ReadXdrIter::<_, ScpBallot>::new(dec, r.limits.clone())
57651                    .map(|r| r.map(|t| Self::ScpBallot(Box::new(t)))),
57652            ),
57653            TypeVariant::ScpStatementType => Box::new(
57654                ReadXdrIter::<_, ScpStatementType>::new(dec, r.limits.clone())
57655                    .map(|r| r.map(|t| Self::ScpStatementType(Box::new(t)))),
57656            ),
57657            TypeVariant::ScpNomination => Box::new(
57658                ReadXdrIter::<_, ScpNomination>::new(dec, r.limits.clone())
57659                    .map(|r| r.map(|t| Self::ScpNomination(Box::new(t)))),
57660            ),
57661            TypeVariant::ScpStatement => Box::new(
57662                ReadXdrIter::<_, ScpStatement>::new(dec, r.limits.clone())
57663                    .map(|r| r.map(|t| Self::ScpStatement(Box::new(t)))),
57664            ),
57665            TypeVariant::ScpStatementPledges => Box::new(
57666                ReadXdrIter::<_, ScpStatementPledges>::new(dec, r.limits.clone())
57667                    .map(|r| r.map(|t| Self::ScpStatementPledges(Box::new(t)))),
57668            ),
57669            TypeVariant::ScpStatementPrepare => Box::new(
57670                ReadXdrIter::<_, ScpStatementPrepare>::new(dec, r.limits.clone())
57671                    .map(|r| r.map(|t| Self::ScpStatementPrepare(Box::new(t)))),
57672            ),
57673            TypeVariant::ScpStatementConfirm => Box::new(
57674                ReadXdrIter::<_, ScpStatementConfirm>::new(dec, r.limits.clone())
57675                    .map(|r| r.map(|t| Self::ScpStatementConfirm(Box::new(t)))),
57676            ),
57677            TypeVariant::ScpStatementExternalize => Box::new(
57678                ReadXdrIter::<_, ScpStatementExternalize>::new(dec, r.limits.clone())
57679                    .map(|r| r.map(|t| Self::ScpStatementExternalize(Box::new(t)))),
57680            ),
57681            TypeVariant::ScpEnvelope => Box::new(
57682                ReadXdrIter::<_, ScpEnvelope>::new(dec, r.limits.clone())
57683                    .map(|r| r.map(|t| Self::ScpEnvelope(Box::new(t)))),
57684            ),
57685            TypeVariant::ScpQuorumSet => Box::new(
57686                ReadXdrIter::<_, ScpQuorumSet>::new(dec, r.limits.clone())
57687                    .map(|r| r.map(|t| Self::ScpQuorumSet(Box::new(t)))),
57688            ),
57689            TypeVariant::ConfigSettingContractExecutionLanesV0 => Box::new(
57690                ReadXdrIter::<_, ConfigSettingContractExecutionLanesV0>::new(dec, r.limits.clone())
57691                    .map(|r| r.map(|t| Self::ConfigSettingContractExecutionLanesV0(Box::new(t)))),
57692            ),
57693            TypeVariant::ConfigSettingContractComputeV0 => Box::new(
57694                ReadXdrIter::<_, ConfigSettingContractComputeV0>::new(dec, r.limits.clone())
57695                    .map(|r| r.map(|t| Self::ConfigSettingContractComputeV0(Box::new(t)))),
57696            ),
57697            TypeVariant::ConfigSettingContractParallelComputeV0 => Box::new(
57698                ReadXdrIter::<_, ConfigSettingContractParallelComputeV0>::new(
57699                    dec,
57700                    r.limits.clone(),
57701                )
57702                .map(|r| r.map(|t| Self::ConfigSettingContractParallelComputeV0(Box::new(t)))),
57703            ),
57704            TypeVariant::ConfigSettingContractLedgerCostV0 => Box::new(
57705                ReadXdrIter::<_, ConfigSettingContractLedgerCostV0>::new(dec, r.limits.clone())
57706                    .map(|r| r.map(|t| Self::ConfigSettingContractLedgerCostV0(Box::new(t)))),
57707            ),
57708            TypeVariant::ConfigSettingContractHistoricalDataV0 => Box::new(
57709                ReadXdrIter::<_, ConfigSettingContractHistoricalDataV0>::new(dec, r.limits.clone())
57710                    .map(|r| r.map(|t| Self::ConfigSettingContractHistoricalDataV0(Box::new(t)))),
57711            ),
57712            TypeVariant::ConfigSettingContractEventsV0 => Box::new(
57713                ReadXdrIter::<_, ConfigSettingContractEventsV0>::new(dec, r.limits.clone())
57714                    .map(|r| r.map(|t| Self::ConfigSettingContractEventsV0(Box::new(t)))),
57715            ),
57716            TypeVariant::ConfigSettingContractBandwidthV0 => Box::new(
57717                ReadXdrIter::<_, ConfigSettingContractBandwidthV0>::new(dec, r.limits.clone())
57718                    .map(|r| r.map(|t| Self::ConfigSettingContractBandwidthV0(Box::new(t)))),
57719            ),
57720            TypeVariant::ContractCostType => Box::new(
57721                ReadXdrIter::<_, ContractCostType>::new(dec, r.limits.clone())
57722                    .map(|r| r.map(|t| Self::ContractCostType(Box::new(t)))),
57723            ),
57724            TypeVariant::ContractCostParamEntry => Box::new(
57725                ReadXdrIter::<_, ContractCostParamEntry>::new(dec, r.limits.clone())
57726                    .map(|r| r.map(|t| Self::ContractCostParamEntry(Box::new(t)))),
57727            ),
57728            TypeVariant::StateArchivalSettings => Box::new(
57729                ReadXdrIter::<_, StateArchivalSettings>::new(dec, r.limits.clone())
57730                    .map(|r| r.map(|t| Self::StateArchivalSettings(Box::new(t)))),
57731            ),
57732            TypeVariant::EvictionIterator => Box::new(
57733                ReadXdrIter::<_, EvictionIterator>::new(dec, r.limits.clone())
57734                    .map(|r| r.map(|t| Self::EvictionIterator(Box::new(t)))),
57735            ),
57736            TypeVariant::ContractCostParams => Box::new(
57737                ReadXdrIter::<_, ContractCostParams>::new(dec, r.limits.clone())
57738                    .map(|r| r.map(|t| Self::ContractCostParams(Box::new(t)))),
57739            ),
57740            TypeVariant::ConfigSettingId => Box::new(
57741                ReadXdrIter::<_, ConfigSettingId>::new(dec, r.limits.clone())
57742                    .map(|r| r.map(|t| Self::ConfigSettingId(Box::new(t)))),
57743            ),
57744            TypeVariant::ConfigSettingEntry => Box::new(
57745                ReadXdrIter::<_, ConfigSettingEntry>::new(dec, r.limits.clone())
57746                    .map(|r| r.map(|t| Self::ConfigSettingEntry(Box::new(t)))),
57747            ),
57748            TypeVariant::ScEnvMetaKind => Box::new(
57749                ReadXdrIter::<_, ScEnvMetaKind>::new(dec, r.limits.clone())
57750                    .map(|r| r.map(|t| Self::ScEnvMetaKind(Box::new(t)))),
57751            ),
57752            TypeVariant::ScEnvMetaEntry => Box::new(
57753                ReadXdrIter::<_, ScEnvMetaEntry>::new(dec, r.limits.clone())
57754                    .map(|r| r.map(|t| Self::ScEnvMetaEntry(Box::new(t)))),
57755            ),
57756            TypeVariant::ScEnvMetaEntryInterfaceVersion => Box::new(
57757                ReadXdrIter::<_, ScEnvMetaEntryInterfaceVersion>::new(dec, r.limits.clone())
57758                    .map(|r| r.map(|t| Self::ScEnvMetaEntryInterfaceVersion(Box::new(t)))),
57759            ),
57760            TypeVariant::ScMetaV0 => Box::new(
57761                ReadXdrIter::<_, ScMetaV0>::new(dec, r.limits.clone())
57762                    .map(|r| r.map(|t| Self::ScMetaV0(Box::new(t)))),
57763            ),
57764            TypeVariant::ScMetaKind => Box::new(
57765                ReadXdrIter::<_, ScMetaKind>::new(dec, r.limits.clone())
57766                    .map(|r| r.map(|t| Self::ScMetaKind(Box::new(t)))),
57767            ),
57768            TypeVariant::ScMetaEntry => Box::new(
57769                ReadXdrIter::<_, ScMetaEntry>::new(dec, r.limits.clone())
57770                    .map(|r| r.map(|t| Self::ScMetaEntry(Box::new(t)))),
57771            ),
57772            TypeVariant::ScSpecType => Box::new(
57773                ReadXdrIter::<_, ScSpecType>::new(dec, r.limits.clone())
57774                    .map(|r| r.map(|t| Self::ScSpecType(Box::new(t)))),
57775            ),
57776            TypeVariant::ScSpecTypeOption => Box::new(
57777                ReadXdrIter::<_, ScSpecTypeOption>::new(dec, r.limits.clone())
57778                    .map(|r| r.map(|t| Self::ScSpecTypeOption(Box::new(t)))),
57779            ),
57780            TypeVariant::ScSpecTypeResult => Box::new(
57781                ReadXdrIter::<_, ScSpecTypeResult>::new(dec, r.limits.clone())
57782                    .map(|r| r.map(|t| Self::ScSpecTypeResult(Box::new(t)))),
57783            ),
57784            TypeVariant::ScSpecTypeVec => Box::new(
57785                ReadXdrIter::<_, ScSpecTypeVec>::new(dec, r.limits.clone())
57786                    .map(|r| r.map(|t| Self::ScSpecTypeVec(Box::new(t)))),
57787            ),
57788            TypeVariant::ScSpecTypeMap => Box::new(
57789                ReadXdrIter::<_, ScSpecTypeMap>::new(dec, r.limits.clone())
57790                    .map(|r| r.map(|t| Self::ScSpecTypeMap(Box::new(t)))),
57791            ),
57792            TypeVariant::ScSpecTypeTuple => Box::new(
57793                ReadXdrIter::<_, ScSpecTypeTuple>::new(dec, r.limits.clone())
57794                    .map(|r| r.map(|t| Self::ScSpecTypeTuple(Box::new(t)))),
57795            ),
57796            TypeVariant::ScSpecTypeBytesN => Box::new(
57797                ReadXdrIter::<_, ScSpecTypeBytesN>::new(dec, r.limits.clone())
57798                    .map(|r| r.map(|t| Self::ScSpecTypeBytesN(Box::new(t)))),
57799            ),
57800            TypeVariant::ScSpecTypeUdt => Box::new(
57801                ReadXdrIter::<_, ScSpecTypeUdt>::new(dec, r.limits.clone())
57802                    .map(|r| r.map(|t| Self::ScSpecTypeUdt(Box::new(t)))),
57803            ),
57804            TypeVariant::ScSpecTypeDef => Box::new(
57805                ReadXdrIter::<_, ScSpecTypeDef>::new(dec, r.limits.clone())
57806                    .map(|r| r.map(|t| Self::ScSpecTypeDef(Box::new(t)))),
57807            ),
57808            TypeVariant::ScSpecUdtStructFieldV0 => Box::new(
57809                ReadXdrIter::<_, ScSpecUdtStructFieldV0>::new(dec, r.limits.clone())
57810                    .map(|r| r.map(|t| Self::ScSpecUdtStructFieldV0(Box::new(t)))),
57811            ),
57812            TypeVariant::ScSpecUdtStructV0 => Box::new(
57813                ReadXdrIter::<_, ScSpecUdtStructV0>::new(dec, r.limits.clone())
57814                    .map(|r| r.map(|t| Self::ScSpecUdtStructV0(Box::new(t)))),
57815            ),
57816            TypeVariant::ScSpecUdtUnionCaseVoidV0 => Box::new(
57817                ReadXdrIter::<_, ScSpecUdtUnionCaseVoidV0>::new(dec, r.limits.clone())
57818                    .map(|r| r.map(|t| Self::ScSpecUdtUnionCaseVoidV0(Box::new(t)))),
57819            ),
57820            TypeVariant::ScSpecUdtUnionCaseTupleV0 => Box::new(
57821                ReadXdrIter::<_, ScSpecUdtUnionCaseTupleV0>::new(dec, r.limits.clone())
57822                    .map(|r| r.map(|t| Self::ScSpecUdtUnionCaseTupleV0(Box::new(t)))),
57823            ),
57824            TypeVariant::ScSpecUdtUnionCaseV0Kind => Box::new(
57825                ReadXdrIter::<_, ScSpecUdtUnionCaseV0Kind>::new(dec, r.limits.clone())
57826                    .map(|r| r.map(|t| Self::ScSpecUdtUnionCaseV0Kind(Box::new(t)))),
57827            ),
57828            TypeVariant::ScSpecUdtUnionCaseV0 => Box::new(
57829                ReadXdrIter::<_, ScSpecUdtUnionCaseV0>::new(dec, r.limits.clone())
57830                    .map(|r| r.map(|t| Self::ScSpecUdtUnionCaseV0(Box::new(t)))),
57831            ),
57832            TypeVariant::ScSpecUdtUnionV0 => Box::new(
57833                ReadXdrIter::<_, ScSpecUdtUnionV0>::new(dec, r.limits.clone())
57834                    .map(|r| r.map(|t| Self::ScSpecUdtUnionV0(Box::new(t)))),
57835            ),
57836            TypeVariant::ScSpecUdtEnumCaseV0 => Box::new(
57837                ReadXdrIter::<_, ScSpecUdtEnumCaseV0>::new(dec, r.limits.clone())
57838                    .map(|r| r.map(|t| Self::ScSpecUdtEnumCaseV0(Box::new(t)))),
57839            ),
57840            TypeVariant::ScSpecUdtEnumV0 => Box::new(
57841                ReadXdrIter::<_, ScSpecUdtEnumV0>::new(dec, r.limits.clone())
57842                    .map(|r| r.map(|t| Self::ScSpecUdtEnumV0(Box::new(t)))),
57843            ),
57844            TypeVariant::ScSpecUdtErrorEnumCaseV0 => Box::new(
57845                ReadXdrIter::<_, ScSpecUdtErrorEnumCaseV0>::new(dec, r.limits.clone())
57846                    .map(|r| r.map(|t| Self::ScSpecUdtErrorEnumCaseV0(Box::new(t)))),
57847            ),
57848            TypeVariant::ScSpecUdtErrorEnumV0 => Box::new(
57849                ReadXdrIter::<_, ScSpecUdtErrorEnumV0>::new(dec, r.limits.clone())
57850                    .map(|r| r.map(|t| Self::ScSpecUdtErrorEnumV0(Box::new(t)))),
57851            ),
57852            TypeVariant::ScSpecFunctionInputV0 => Box::new(
57853                ReadXdrIter::<_, ScSpecFunctionInputV0>::new(dec, r.limits.clone())
57854                    .map(|r| r.map(|t| Self::ScSpecFunctionInputV0(Box::new(t)))),
57855            ),
57856            TypeVariant::ScSpecFunctionV0 => Box::new(
57857                ReadXdrIter::<_, ScSpecFunctionV0>::new(dec, r.limits.clone())
57858                    .map(|r| r.map(|t| Self::ScSpecFunctionV0(Box::new(t)))),
57859            ),
57860            TypeVariant::ScSpecEntryKind => Box::new(
57861                ReadXdrIter::<_, ScSpecEntryKind>::new(dec, r.limits.clone())
57862                    .map(|r| r.map(|t| Self::ScSpecEntryKind(Box::new(t)))),
57863            ),
57864            TypeVariant::ScSpecEntry => Box::new(
57865                ReadXdrIter::<_, ScSpecEntry>::new(dec, r.limits.clone())
57866                    .map(|r| r.map(|t| Self::ScSpecEntry(Box::new(t)))),
57867            ),
57868            TypeVariant::ScValType => Box::new(
57869                ReadXdrIter::<_, ScValType>::new(dec, r.limits.clone())
57870                    .map(|r| r.map(|t| Self::ScValType(Box::new(t)))),
57871            ),
57872            TypeVariant::ScErrorType => Box::new(
57873                ReadXdrIter::<_, ScErrorType>::new(dec, r.limits.clone())
57874                    .map(|r| r.map(|t| Self::ScErrorType(Box::new(t)))),
57875            ),
57876            TypeVariant::ScErrorCode => Box::new(
57877                ReadXdrIter::<_, ScErrorCode>::new(dec, r.limits.clone())
57878                    .map(|r| r.map(|t| Self::ScErrorCode(Box::new(t)))),
57879            ),
57880            TypeVariant::ScError => Box::new(
57881                ReadXdrIter::<_, ScError>::new(dec, r.limits.clone())
57882                    .map(|r| r.map(|t| Self::ScError(Box::new(t)))),
57883            ),
57884            TypeVariant::UInt128Parts => Box::new(
57885                ReadXdrIter::<_, UInt128Parts>::new(dec, r.limits.clone())
57886                    .map(|r| r.map(|t| Self::UInt128Parts(Box::new(t)))),
57887            ),
57888            TypeVariant::Int128Parts => Box::new(
57889                ReadXdrIter::<_, Int128Parts>::new(dec, r.limits.clone())
57890                    .map(|r| r.map(|t| Self::Int128Parts(Box::new(t)))),
57891            ),
57892            TypeVariant::UInt256Parts => Box::new(
57893                ReadXdrIter::<_, UInt256Parts>::new(dec, r.limits.clone())
57894                    .map(|r| r.map(|t| Self::UInt256Parts(Box::new(t)))),
57895            ),
57896            TypeVariant::Int256Parts => Box::new(
57897                ReadXdrIter::<_, Int256Parts>::new(dec, r.limits.clone())
57898                    .map(|r| r.map(|t| Self::Int256Parts(Box::new(t)))),
57899            ),
57900            TypeVariant::ContractExecutableType => Box::new(
57901                ReadXdrIter::<_, ContractExecutableType>::new(dec, r.limits.clone())
57902                    .map(|r| r.map(|t| Self::ContractExecutableType(Box::new(t)))),
57903            ),
57904            TypeVariant::ContractExecutable => Box::new(
57905                ReadXdrIter::<_, ContractExecutable>::new(dec, r.limits.clone())
57906                    .map(|r| r.map(|t| Self::ContractExecutable(Box::new(t)))),
57907            ),
57908            TypeVariant::ScAddressType => Box::new(
57909                ReadXdrIter::<_, ScAddressType>::new(dec, r.limits.clone())
57910                    .map(|r| r.map(|t| Self::ScAddressType(Box::new(t)))),
57911            ),
57912            TypeVariant::ScAddress => Box::new(
57913                ReadXdrIter::<_, ScAddress>::new(dec, r.limits.clone())
57914                    .map(|r| r.map(|t| Self::ScAddress(Box::new(t)))),
57915            ),
57916            TypeVariant::ScVec => Box::new(
57917                ReadXdrIter::<_, ScVec>::new(dec, r.limits.clone())
57918                    .map(|r| r.map(|t| Self::ScVec(Box::new(t)))),
57919            ),
57920            TypeVariant::ScMap => Box::new(
57921                ReadXdrIter::<_, ScMap>::new(dec, r.limits.clone())
57922                    .map(|r| r.map(|t| Self::ScMap(Box::new(t)))),
57923            ),
57924            TypeVariant::ScBytes => Box::new(
57925                ReadXdrIter::<_, ScBytes>::new(dec, r.limits.clone())
57926                    .map(|r| r.map(|t| Self::ScBytes(Box::new(t)))),
57927            ),
57928            TypeVariant::ScString => Box::new(
57929                ReadXdrIter::<_, ScString>::new(dec, r.limits.clone())
57930                    .map(|r| r.map(|t| Self::ScString(Box::new(t)))),
57931            ),
57932            TypeVariant::ScSymbol => Box::new(
57933                ReadXdrIter::<_, ScSymbol>::new(dec, r.limits.clone())
57934                    .map(|r| r.map(|t| Self::ScSymbol(Box::new(t)))),
57935            ),
57936            TypeVariant::ScNonceKey => Box::new(
57937                ReadXdrIter::<_, ScNonceKey>::new(dec, r.limits.clone())
57938                    .map(|r| r.map(|t| Self::ScNonceKey(Box::new(t)))),
57939            ),
57940            TypeVariant::ScContractInstance => Box::new(
57941                ReadXdrIter::<_, ScContractInstance>::new(dec, r.limits.clone())
57942                    .map(|r| r.map(|t| Self::ScContractInstance(Box::new(t)))),
57943            ),
57944            TypeVariant::ScVal => Box::new(
57945                ReadXdrIter::<_, ScVal>::new(dec, r.limits.clone())
57946                    .map(|r| r.map(|t| Self::ScVal(Box::new(t)))),
57947            ),
57948            TypeVariant::ScMapEntry => Box::new(
57949                ReadXdrIter::<_, ScMapEntry>::new(dec, r.limits.clone())
57950                    .map(|r| r.map(|t| Self::ScMapEntry(Box::new(t)))),
57951            ),
57952            TypeVariant::StoredTransactionSet => Box::new(
57953                ReadXdrIter::<_, StoredTransactionSet>::new(dec, r.limits.clone())
57954                    .map(|r| r.map(|t| Self::StoredTransactionSet(Box::new(t)))),
57955            ),
57956            TypeVariant::StoredDebugTransactionSet => Box::new(
57957                ReadXdrIter::<_, StoredDebugTransactionSet>::new(dec, r.limits.clone())
57958                    .map(|r| r.map(|t| Self::StoredDebugTransactionSet(Box::new(t)))),
57959            ),
57960            TypeVariant::PersistedScpStateV0 => Box::new(
57961                ReadXdrIter::<_, PersistedScpStateV0>::new(dec, r.limits.clone())
57962                    .map(|r| r.map(|t| Self::PersistedScpStateV0(Box::new(t)))),
57963            ),
57964            TypeVariant::PersistedScpStateV1 => Box::new(
57965                ReadXdrIter::<_, PersistedScpStateV1>::new(dec, r.limits.clone())
57966                    .map(|r| r.map(|t| Self::PersistedScpStateV1(Box::new(t)))),
57967            ),
57968            TypeVariant::PersistedScpState => Box::new(
57969                ReadXdrIter::<_, PersistedScpState>::new(dec, r.limits.clone())
57970                    .map(|r| r.map(|t| Self::PersistedScpState(Box::new(t)))),
57971            ),
57972            TypeVariant::Thresholds => Box::new(
57973                ReadXdrIter::<_, Thresholds>::new(dec, r.limits.clone())
57974                    .map(|r| r.map(|t| Self::Thresholds(Box::new(t)))),
57975            ),
57976            TypeVariant::String32 => Box::new(
57977                ReadXdrIter::<_, String32>::new(dec, r.limits.clone())
57978                    .map(|r| r.map(|t| Self::String32(Box::new(t)))),
57979            ),
57980            TypeVariant::String64 => Box::new(
57981                ReadXdrIter::<_, String64>::new(dec, r.limits.clone())
57982                    .map(|r| r.map(|t| Self::String64(Box::new(t)))),
57983            ),
57984            TypeVariant::SequenceNumber => Box::new(
57985                ReadXdrIter::<_, SequenceNumber>::new(dec, r.limits.clone())
57986                    .map(|r| r.map(|t| Self::SequenceNumber(Box::new(t)))),
57987            ),
57988            TypeVariant::DataValue => Box::new(
57989                ReadXdrIter::<_, DataValue>::new(dec, r.limits.clone())
57990                    .map(|r| r.map(|t| Self::DataValue(Box::new(t)))),
57991            ),
57992            TypeVariant::PoolId => Box::new(
57993                ReadXdrIter::<_, PoolId>::new(dec, r.limits.clone())
57994                    .map(|r| r.map(|t| Self::PoolId(Box::new(t)))),
57995            ),
57996            TypeVariant::AssetCode4 => Box::new(
57997                ReadXdrIter::<_, AssetCode4>::new(dec, r.limits.clone())
57998                    .map(|r| r.map(|t| Self::AssetCode4(Box::new(t)))),
57999            ),
58000            TypeVariant::AssetCode12 => Box::new(
58001                ReadXdrIter::<_, AssetCode12>::new(dec, r.limits.clone())
58002                    .map(|r| r.map(|t| Self::AssetCode12(Box::new(t)))),
58003            ),
58004            TypeVariant::AssetType => Box::new(
58005                ReadXdrIter::<_, AssetType>::new(dec, r.limits.clone())
58006                    .map(|r| r.map(|t| Self::AssetType(Box::new(t)))),
58007            ),
58008            TypeVariant::AssetCode => Box::new(
58009                ReadXdrIter::<_, AssetCode>::new(dec, r.limits.clone())
58010                    .map(|r| r.map(|t| Self::AssetCode(Box::new(t)))),
58011            ),
58012            TypeVariant::AlphaNum4 => Box::new(
58013                ReadXdrIter::<_, AlphaNum4>::new(dec, r.limits.clone())
58014                    .map(|r| r.map(|t| Self::AlphaNum4(Box::new(t)))),
58015            ),
58016            TypeVariant::AlphaNum12 => Box::new(
58017                ReadXdrIter::<_, AlphaNum12>::new(dec, r.limits.clone())
58018                    .map(|r| r.map(|t| Self::AlphaNum12(Box::new(t)))),
58019            ),
58020            TypeVariant::Asset => Box::new(
58021                ReadXdrIter::<_, Asset>::new(dec, r.limits.clone())
58022                    .map(|r| r.map(|t| Self::Asset(Box::new(t)))),
58023            ),
58024            TypeVariant::Price => Box::new(
58025                ReadXdrIter::<_, Price>::new(dec, r.limits.clone())
58026                    .map(|r| r.map(|t| Self::Price(Box::new(t)))),
58027            ),
58028            TypeVariant::Liabilities => Box::new(
58029                ReadXdrIter::<_, Liabilities>::new(dec, r.limits.clone())
58030                    .map(|r| r.map(|t| Self::Liabilities(Box::new(t)))),
58031            ),
58032            TypeVariant::ThresholdIndexes => Box::new(
58033                ReadXdrIter::<_, ThresholdIndexes>::new(dec, r.limits.clone())
58034                    .map(|r| r.map(|t| Self::ThresholdIndexes(Box::new(t)))),
58035            ),
58036            TypeVariant::LedgerEntryType => Box::new(
58037                ReadXdrIter::<_, LedgerEntryType>::new(dec, r.limits.clone())
58038                    .map(|r| r.map(|t| Self::LedgerEntryType(Box::new(t)))),
58039            ),
58040            TypeVariant::Signer => Box::new(
58041                ReadXdrIter::<_, Signer>::new(dec, r.limits.clone())
58042                    .map(|r| r.map(|t| Self::Signer(Box::new(t)))),
58043            ),
58044            TypeVariant::AccountFlags => Box::new(
58045                ReadXdrIter::<_, AccountFlags>::new(dec, r.limits.clone())
58046                    .map(|r| r.map(|t| Self::AccountFlags(Box::new(t)))),
58047            ),
58048            TypeVariant::SponsorshipDescriptor => Box::new(
58049                ReadXdrIter::<_, SponsorshipDescriptor>::new(dec, r.limits.clone())
58050                    .map(|r| r.map(|t| Self::SponsorshipDescriptor(Box::new(t)))),
58051            ),
58052            TypeVariant::AccountEntryExtensionV3 => Box::new(
58053                ReadXdrIter::<_, AccountEntryExtensionV3>::new(dec, r.limits.clone())
58054                    .map(|r| r.map(|t| Self::AccountEntryExtensionV3(Box::new(t)))),
58055            ),
58056            TypeVariant::AccountEntryExtensionV2 => Box::new(
58057                ReadXdrIter::<_, AccountEntryExtensionV2>::new(dec, r.limits.clone())
58058                    .map(|r| r.map(|t| Self::AccountEntryExtensionV2(Box::new(t)))),
58059            ),
58060            TypeVariant::AccountEntryExtensionV2Ext => Box::new(
58061                ReadXdrIter::<_, AccountEntryExtensionV2Ext>::new(dec, r.limits.clone())
58062                    .map(|r| r.map(|t| Self::AccountEntryExtensionV2Ext(Box::new(t)))),
58063            ),
58064            TypeVariant::AccountEntryExtensionV1 => Box::new(
58065                ReadXdrIter::<_, AccountEntryExtensionV1>::new(dec, r.limits.clone())
58066                    .map(|r| r.map(|t| Self::AccountEntryExtensionV1(Box::new(t)))),
58067            ),
58068            TypeVariant::AccountEntryExtensionV1Ext => Box::new(
58069                ReadXdrIter::<_, AccountEntryExtensionV1Ext>::new(dec, r.limits.clone())
58070                    .map(|r| r.map(|t| Self::AccountEntryExtensionV1Ext(Box::new(t)))),
58071            ),
58072            TypeVariant::AccountEntry => Box::new(
58073                ReadXdrIter::<_, AccountEntry>::new(dec, r.limits.clone())
58074                    .map(|r| r.map(|t| Self::AccountEntry(Box::new(t)))),
58075            ),
58076            TypeVariant::AccountEntryExt => Box::new(
58077                ReadXdrIter::<_, AccountEntryExt>::new(dec, r.limits.clone())
58078                    .map(|r| r.map(|t| Self::AccountEntryExt(Box::new(t)))),
58079            ),
58080            TypeVariant::TrustLineFlags => Box::new(
58081                ReadXdrIter::<_, TrustLineFlags>::new(dec, r.limits.clone())
58082                    .map(|r| r.map(|t| Self::TrustLineFlags(Box::new(t)))),
58083            ),
58084            TypeVariant::LiquidityPoolType => Box::new(
58085                ReadXdrIter::<_, LiquidityPoolType>::new(dec, r.limits.clone())
58086                    .map(|r| r.map(|t| Self::LiquidityPoolType(Box::new(t)))),
58087            ),
58088            TypeVariant::TrustLineAsset => Box::new(
58089                ReadXdrIter::<_, TrustLineAsset>::new(dec, r.limits.clone())
58090                    .map(|r| r.map(|t| Self::TrustLineAsset(Box::new(t)))),
58091            ),
58092            TypeVariant::TrustLineEntryExtensionV2 => Box::new(
58093                ReadXdrIter::<_, TrustLineEntryExtensionV2>::new(dec, r.limits.clone())
58094                    .map(|r| r.map(|t| Self::TrustLineEntryExtensionV2(Box::new(t)))),
58095            ),
58096            TypeVariant::TrustLineEntryExtensionV2Ext => Box::new(
58097                ReadXdrIter::<_, TrustLineEntryExtensionV2Ext>::new(dec, r.limits.clone())
58098                    .map(|r| r.map(|t| Self::TrustLineEntryExtensionV2Ext(Box::new(t)))),
58099            ),
58100            TypeVariant::TrustLineEntry => Box::new(
58101                ReadXdrIter::<_, TrustLineEntry>::new(dec, r.limits.clone())
58102                    .map(|r| r.map(|t| Self::TrustLineEntry(Box::new(t)))),
58103            ),
58104            TypeVariant::TrustLineEntryExt => Box::new(
58105                ReadXdrIter::<_, TrustLineEntryExt>::new(dec, r.limits.clone())
58106                    .map(|r| r.map(|t| Self::TrustLineEntryExt(Box::new(t)))),
58107            ),
58108            TypeVariant::TrustLineEntryV1 => Box::new(
58109                ReadXdrIter::<_, TrustLineEntryV1>::new(dec, r.limits.clone())
58110                    .map(|r| r.map(|t| Self::TrustLineEntryV1(Box::new(t)))),
58111            ),
58112            TypeVariant::TrustLineEntryV1Ext => Box::new(
58113                ReadXdrIter::<_, TrustLineEntryV1Ext>::new(dec, r.limits.clone())
58114                    .map(|r| r.map(|t| Self::TrustLineEntryV1Ext(Box::new(t)))),
58115            ),
58116            TypeVariant::OfferEntryFlags => Box::new(
58117                ReadXdrIter::<_, OfferEntryFlags>::new(dec, r.limits.clone())
58118                    .map(|r| r.map(|t| Self::OfferEntryFlags(Box::new(t)))),
58119            ),
58120            TypeVariant::OfferEntry => Box::new(
58121                ReadXdrIter::<_, OfferEntry>::new(dec, r.limits.clone())
58122                    .map(|r| r.map(|t| Self::OfferEntry(Box::new(t)))),
58123            ),
58124            TypeVariant::OfferEntryExt => Box::new(
58125                ReadXdrIter::<_, OfferEntryExt>::new(dec, r.limits.clone())
58126                    .map(|r| r.map(|t| Self::OfferEntryExt(Box::new(t)))),
58127            ),
58128            TypeVariant::DataEntry => Box::new(
58129                ReadXdrIter::<_, DataEntry>::new(dec, r.limits.clone())
58130                    .map(|r| r.map(|t| Self::DataEntry(Box::new(t)))),
58131            ),
58132            TypeVariant::DataEntryExt => Box::new(
58133                ReadXdrIter::<_, DataEntryExt>::new(dec, r.limits.clone())
58134                    .map(|r| r.map(|t| Self::DataEntryExt(Box::new(t)))),
58135            ),
58136            TypeVariant::ClaimPredicateType => Box::new(
58137                ReadXdrIter::<_, ClaimPredicateType>::new(dec, r.limits.clone())
58138                    .map(|r| r.map(|t| Self::ClaimPredicateType(Box::new(t)))),
58139            ),
58140            TypeVariant::ClaimPredicate => Box::new(
58141                ReadXdrIter::<_, ClaimPredicate>::new(dec, r.limits.clone())
58142                    .map(|r| r.map(|t| Self::ClaimPredicate(Box::new(t)))),
58143            ),
58144            TypeVariant::ClaimantType => Box::new(
58145                ReadXdrIter::<_, ClaimantType>::new(dec, r.limits.clone())
58146                    .map(|r| r.map(|t| Self::ClaimantType(Box::new(t)))),
58147            ),
58148            TypeVariant::Claimant => Box::new(
58149                ReadXdrIter::<_, Claimant>::new(dec, r.limits.clone())
58150                    .map(|r| r.map(|t| Self::Claimant(Box::new(t)))),
58151            ),
58152            TypeVariant::ClaimantV0 => Box::new(
58153                ReadXdrIter::<_, ClaimantV0>::new(dec, r.limits.clone())
58154                    .map(|r| r.map(|t| Self::ClaimantV0(Box::new(t)))),
58155            ),
58156            TypeVariant::ClaimableBalanceIdType => Box::new(
58157                ReadXdrIter::<_, ClaimableBalanceIdType>::new(dec, r.limits.clone())
58158                    .map(|r| r.map(|t| Self::ClaimableBalanceIdType(Box::new(t)))),
58159            ),
58160            TypeVariant::ClaimableBalanceId => Box::new(
58161                ReadXdrIter::<_, ClaimableBalanceId>::new(dec, r.limits.clone())
58162                    .map(|r| r.map(|t| Self::ClaimableBalanceId(Box::new(t)))),
58163            ),
58164            TypeVariant::ClaimableBalanceFlags => Box::new(
58165                ReadXdrIter::<_, ClaimableBalanceFlags>::new(dec, r.limits.clone())
58166                    .map(|r| r.map(|t| Self::ClaimableBalanceFlags(Box::new(t)))),
58167            ),
58168            TypeVariant::ClaimableBalanceEntryExtensionV1 => Box::new(
58169                ReadXdrIter::<_, ClaimableBalanceEntryExtensionV1>::new(dec, r.limits.clone())
58170                    .map(|r| r.map(|t| Self::ClaimableBalanceEntryExtensionV1(Box::new(t)))),
58171            ),
58172            TypeVariant::ClaimableBalanceEntryExtensionV1Ext => Box::new(
58173                ReadXdrIter::<_, ClaimableBalanceEntryExtensionV1Ext>::new(dec, r.limits.clone())
58174                    .map(|r| r.map(|t| Self::ClaimableBalanceEntryExtensionV1Ext(Box::new(t)))),
58175            ),
58176            TypeVariant::ClaimableBalanceEntry => Box::new(
58177                ReadXdrIter::<_, ClaimableBalanceEntry>::new(dec, r.limits.clone())
58178                    .map(|r| r.map(|t| Self::ClaimableBalanceEntry(Box::new(t)))),
58179            ),
58180            TypeVariant::ClaimableBalanceEntryExt => Box::new(
58181                ReadXdrIter::<_, ClaimableBalanceEntryExt>::new(dec, r.limits.clone())
58182                    .map(|r| r.map(|t| Self::ClaimableBalanceEntryExt(Box::new(t)))),
58183            ),
58184            TypeVariant::LiquidityPoolConstantProductParameters => Box::new(
58185                ReadXdrIter::<_, LiquidityPoolConstantProductParameters>::new(
58186                    dec,
58187                    r.limits.clone(),
58188                )
58189                .map(|r| r.map(|t| Self::LiquidityPoolConstantProductParameters(Box::new(t)))),
58190            ),
58191            TypeVariant::LiquidityPoolEntry => Box::new(
58192                ReadXdrIter::<_, LiquidityPoolEntry>::new(dec, r.limits.clone())
58193                    .map(|r| r.map(|t| Self::LiquidityPoolEntry(Box::new(t)))),
58194            ),
58195            TypeVariant::LiquidityPoolEntryBody => Box::new(
58196                ReadXdrIter::<_, LiquidityPoolEntryBody>::new(dec, r.limits.clone())
58197                    .map(|r| r.map(|t| Self::LiquidityPoolEntryBody(Box::new(t)))),
58198            ),
58199            TypeVariant::LiquidityPoolEntryConstantProduct => Box::new(
58200                ReadXdrIter::<_, LiquidityPoolEntryConstantProduct>::new(dec, r.limits.clone())
58201                    .map(|r| r.map(|t| Self::LiquidityPoolEntryConstantProduct(Box::new(t)))),
58202            ),
58203            TypeVariant::ContractDataDurability => Box::new(
58204                ReadXdrIter::<_, ContractDataDurability>::new(dec, r.limits.clone())
58205                    .map(|r| r.map(|t| Self::ContractDataDurability(Box::new(t)))),
58206            ),
58207            TypeVariant::ContractDataEntry => Box::new(
58208                ReadXdrIter::<_, ContractDataEntry>::new(dec, r.limits.clone())
58209                    .map(|r| r.map(|t| Self::ContractDataEntry(Box::new(t)))),
58210            ),
58211            TypeVariant::ContractCodeCostInputs => Box::new(
58212                ReadXdrIter::<_, ContractCodeCostInputs>::new(dec, r.limits.clone())
58213                    .map(|r| r.map(|t| Self::ContractCodeCostInputs(Box::new(t)))),
58214            ),
58215            TypeVariant::ContractCodeEntry => Box::new(
58216                ReadXdrIter::<_, ContractCodeEntry>::new(dec, r.limits.clone())
58217                    .map(|r| r.map(|t| Self::ContractCodeEntry(Box::new(t)))),
58218            ),
58219            TypeVariant::ContractCodeEntryExt => Box::new(
58220                ReadXdrIter::<_, ContractCodeEntryExt>::new(dec, r.limits.clone())
58221                    .map(|r| r.map(|t| Self::ContractCodeEntryExt(Box::new(t)))),
58222            ),
58223            TypeVariant::ContractCodeEntryV1 => Box::new(
58224                ReadXdrIter::<_, ContractCodeEntryV1>::new(dec, r.limits.clone())
58225                    .map(|r| r.map(|t| Self::ContractCodeEntryV1(Box::new(t)))),
58226            ),
58227            TypeVariant::TtlEntry => Box::new(
58228                ReadXdrIter::<_, TtlEntry>::new(dec, r.limits.clone())
58229                    .map(|r| r.map(|t| Self::TtlEntry(Box::new(t)))),
58230            ),
58231            TypeVariant::LedgerEntryExtensionV1 => Box::new(
58232                ReadXdrIter::<_, LedgerEntryExtensionV1>::new(dec, r.limits.clone())
58233                    .map(|r| r.map(|t| Self::LedgerEntryExtensionV1(Box::new(t)))),
58234            ),
58235            TypeVariant::LedgerEntryExtensionV1Ext => Box::new(
58236                ReadXdrIter::<_, LedgerEntryExtensionV1Ext>::new(dec, r.limits.clone())
58237                    .map(|r| r.map(|t| Self::LedgerEntryExtensionV1Ext(Box::new(t)))),
58238            ),
58239            TypeVariant::LedgerEntry => Box::new(
58240                ReadXdrIter::<_, LedgerEntry>::new(dec, r.limits.clone())
58241                    .map(|r| r.map(|t| Self::LedgerEntry(Box::new(t)))),
58242            ),
58243            TypeVariant::LedgerEntryData => Box::new(
58244                ReadXdrIter::<_, LedgerEntryData>::new(dec, r.limits.clone())
58245                    .map(|r| r.map(|t| Self::LedgerEntryData(Box::new(t)))),
58246            ),
58247            TypeVariant::LedgerEntryExt => Box::new(
58248                ReadXdrIter::<_, LedgerEntryExt>::new(dec, r.limits.clone())
58249                    .map(|r| r.map(|t| Self::LedgerEntryExt(Box::new(t)))),
58250            ),
58251            TypeVariant::LedgerKey => Box::new(
58252                ReadXdrIter::<_, LedgerKey>::new(dec, r.limits.clone())
58253                    .map(|r| r.map(|t| Self::LedgerKey(Box::new(t)))),
58254            ),
58255            TypeVariant::LedgerKeyAccount => Box::new(
58256                ReadXdrIter::<_, LedgerKeyAccount>::new(dec, r.limits.clone())
58257                    .map(|r| r.map(|t| Self::LedgerKeyAccount(Box::new(t)))),
58258            ),
58259            TypeVariant::LedgerKeyTrustLine => Box::new(
58260                ReadXdrIter::<_, LedgerKeyTrustLine>::new(dec, r.limits.clone())
58261                    .map(|r| r.map(|t| Self::LedgerKeyTrustLine(Box::new(t)))),
58262            ),
58263            TypeVariant::LedgerKeyOffer => Box::new(
58264                ReadXdrIter::<_, LedgerKeyOffer>::new(dec, r.limits.clone())
58265                    .map(|r| r.map(|t| Self::LedgerKeyOffer(Box::new(t)))),
58266            ),
58267            TypeVariant::LedgerKeyData => Box::new(
58268                ReadXdrIter::<_, LedgerKeyData>::new(dec, r.limits.clone())
58269                    .map(|r| r.map(|t| Self::LedgerKeyData(Box::new(t)))),
58270            ),
58271            TypeVariant::LedgerKeyClaimableBalance => Box::new(
58272                ReadXdrIter::<_, LedgerKeyClaimableBalance>::new(dec, r.limits.clone())
58273                    .map(|r| r.map(|t| Self::LedgerKeyClaimableBalance(Box::new(t)))),
58274            ),
58275            TypeVariant::LedgerKeyLiquidityPool => Box::new(
58276                ReadXdrIter::<_, LedgerKeyLiquidityPool>::new(dec, r.limits.clone())
58277                    .map(|r| r.map(|t| Self::LedgerKeyLiquidityPool(Box::new(t)))),
58278            ),
58279            TypeVariant::LedgerKeyContractData => Box::new(
58280                ReadXdrIter::<_, LedgerKeyContractData>::new(dec, r.limits.clone())
58281                    .map(|r| r.map(|t| Self::LedgerKeyContractData(Box::new(t)))),
58282            ),
58283            TypeVariant::LedgerKeyContractCode => Box::new(
58284                ReadXdrIter::<_, LedgerKeyContractCode>::new(dec, r.limits.clone())
58285                    .map(|r| r.map(|t| Self::LedgerKeyContractCode(Box::new(t)))),
58286            ),
58287            TypeVariant::LedgerKeyConfigSetting => Box::new(
58288                ReadXdrIter::<_, LedgerKeyConfigSetting>::new(dec, r.limits.clone())
58289                    .map(|r| r.map(|t| Self::LedgerKeyConfigSetting(Box::new(t)))),
58290            ),
58291            TypeVariant::LedgerKeyTtl => Box::new(
58292                ReadXdrIter::<_, LedgerKeyTtl>::new(dec, r.limits.clone())
58293                    .map(|r| r.map(|t| Self::LedgerKeyTtl(Box::new(t)))),
58294            ),
58295            TypeVariant::EnvelopeType => Box::new(
58296                ReadXdrIter::<_, EnvelopeType>::new(dec, r.limits.clone())
58297                    .map(|r| r.map(|t| Self::EnvelopeType(Box::new(t)))),
58298            ),
58299            TypeVariant::BucketListType => Box::new(
58300                ReadXdrIter::<_, BucketListType>::new(dec, r.limits.clone())
58301                    .map(|r| r.map(|t| Self::BucketListType(Box::new(t)))),
58302            ),
58303            TypeVariant::BucketEntryType => Box::new(
58304                ReadXdrIter::<_, BucketEntryType>::new(dec, r.limits.clone())
58305                    .map(|r| r.map(|t| Self::BucketEntryType(Box::new(t)))),
58306            ),
58307            TypeVariant::HotArchiveBucketEntryType => Box::new(
58308                ReadXdrIter::<_, HotArchiveBucketEntryType>::new(dec, r.limits.clone())
58309                    .map(|r| r.map(|t| Self::HotArchiveBucketEntryType(Box::new(t)))),
58310            ),
58311            TypeVariant::ColdArchiveBucketEntryType => Box::new(
58312                ReadXdrIter::<_, ColdArchiveBucketEntryType>::new(dec, r.limits.clone())
58313                    .map(|r| r.map(|t| Self::ColdArchiveBucketEntryType(Box::new(t)))),
58314            ),
58315            TypeVariant::BucketMetadata => Box::new(
58316                ReadXdrIter::<_, BucketMetadata>::new(dec, r.limits.clone())
58317                    .map(|r| r.map(|t| Self::BucketMetadata(Box::new(t)))),
58318            ),
58319            TypeVariant::BucketMetadataExt => Box::new(
58320                ReadXdrIter::<_, BucketMetadataExt>::new(dec, r.limits.clone())
58321                    .map(|r| r.map(|t| Self::BucketMetadataExt(Box::new(t)))),
58322            ),
58323            TypeVariant::BucketEntry => Box::new(
58324                ReadXdrIter::<_, BucketEntry>::new(dec, r.limits.clone())
58325                    .map(|r| r.map(|t| Self::BucketEntry(Box::new(t)))),
58326            ),
58327            TypeVariant::HotArchiveBucketEntry => Box::new(
58328                ReadXdrIter::<_, HotArchiveBucketEntry>::new(dec, r.limits.clone())
58329                    .map(|r| r.map(|t| Self::HotArchiveBucketEntry(Box::new(t)))),
58330            ),
58331            TypeVariant::ColdArchiveArchivedLeaf => Box::new(
58332                ReadXdrIter::<_, ColdArchiveArchivedLeaf>::new(dec, r.limits.clone())
58333                    .map(|r| r.map(|t| Self::ColdArchiveArchivedLeaf(Box::new(t)))),
58334            ),
58335            TypeVariant::ColdArchiveDeletedLeaf => Box::new(
58336                ReadXdrIter::<_, ColdArchiveDeletedLeaf>::new(dec, r.limits.clone())
58337                    .map(|r| r.map(|t| Self::ColdArchiveDeletedLeaf(Box::new(t)))),
58338            ),
58339            TypeVariant::ColdArchiveBoundaryLeaf => Box::new(
58340                ReadXdrIter::<_, ColdArchiveBoundaryLeaf>::new(dec, r.limits.clone())
58341                    .map(|r| r.map(|t| Self::ColdArchiveBoundaryLeaf(Box::new(t)))),
58342            ),
58343            TypeVariant::ColdArchiveHashEntry => Box::new(
58344                ReadXdrIter::<_, ColdArchiveHashEntry>::new(dec, r.limits.clone())
58345                    .map(|r| r.map(|t| Self::ColdArchiveHashEntry(Box::new(t)))),
58346            ),
58347            TypeVariant::ColdArchiveBucketEntry => Box::new(
58348                ReadXdrIter::<_, ColdArchiveBucketEntry>::new(dec, r.limits.clone())
58349                    .map(|r| r.map(|t| Self::ColdArchiveBucketEntry(Box::new(t)))),
58350            ),
58351            TypeVariant::UpgradeType => Box::new(
58352                ReadXdrIter::<_, UpgradeType>::new(dec, r.limits.clone())
58353                    .map(|r| r.map(|t| Self::UpgradeType(Box::new(t)))),
58354            ),
58355            TypeVariant::StellarValueType => Box::new(
58356                ReadXdrIter::<_, StellarValueType>::new(dec, r.limits.clone())
58357                    .map(|r| r.map(|t| Self::StellarValueType(Box::new(t)))),
58358            ),
58359            TypeVariant::LedgerCloseValueSignature => Box::new(
58360                ReadXdrIter::<_, LedgerCloseValueSignature>::new(dec, r.limits.clone())
58361                    .map(|r| r.map(|t| Self::LedgerCloseValueSignature(Box::new(t)))),
58362            ),
58363            TypeVariant::StellarValue => Box::new(
58364                ReadXdrIter::<_, StellarValue>::new(dec, r.limits.clone())
58365                    .map(|r| r.map(|t| Self::StellarValue(Box::new(t)))),
58366            ),
58367            TypeVariant::StellarValueExt => Box::new(
58368                ReadXdrIter::<_, StellarValueExt>::new(dec, r.limits.clone())
58369                    .map(|r| r.map(|t| Self::StellarValueExt(Box::new(t)))),
58370            ),
58371            TypeVariant::LedgerHeaderFlags => Box::new(
58372                ReadXdrIter::<_, LedgerHeaderFlags>::new(dec, r.limits.clone())
58373                    .map(|r| r.map(|t| Self::LedgerHeaderFlags(Box::new(t)))),
58374            ),
58375            TypeVariant::LedgerHeaderExtensionV1 => Box::new(
58376                ReadXdrIter::<_, LedgerHeaderExtensionV1>::new(dec, r.limits.clone())
58377                    .map(|r| r.map(|t| Self::LedgerHeaderExtensionV1(Box::new(t)))),
58378            ),
58379            TypeVariant::LedgerHeaderExtensionV1Ext => Box::new(
58380                ReadXdrIter::<_, LedgerHeaderExtensionV1Ext>::new(dec, r.limits.clone())
58381                    .map(|r| r.map(|t| Self::LedgerHeaderExtensionV1Ext(Box::new(t)))),
58382            ),
58383            TypeVariant::LedgerHeader => Box::new(
58384                ReadXdrIter::<_, LedgerHeader>::new(dec, r.limits.clone())
58385                    .map(|r| r.map(|t| Self::LedgerHeader(Box::new(t)))),
58386            ),
58387            TypeVariant::LedgerHeaderExt => Box::new(
58388                ReadXdrIter::<_, LedgerHeaderExt>::new(dec, r.limits.clone())
58389                    .map(|r| r.map(|t| Self::LedgerHeaderExt(Box::new(t)))),
58390            ),
58391            TypeVariant::LedgerUpgradeType => Box::new(
58392                ReadXdrIter::<_, LedgerUpgradeType>::new(dec, r.limits.clone())
58393                    .map(|r| r.map(|t| Self::LedgerUpgradeType(Box::new(t)))),
58394            ),
58395            TypeVariant::ConfigUpgradeSetKey => Box::new(
58396                ReadXdrIter::<_, ConfigUpgradeSetKey>::new(dec, r.limits.clone())
58397                    .map(|r| r.map(|t| Self::ConfigUpgradeSetKey(Box::new(t)))),
58398            ),
58399            TypeVariant::LedgerUpgrade => Box::new(
58400                ReadXdrIter::<_, LedgerUpgrade>::new(dec, r.limits.clone())
58401                    .map(|r| r.map(|t| Self::LedgerUpgrade(Box::new(t)))),
58402            ),
58403            TypeVariant::ConfigUpgradeSet => Box::new(
58404                ReadXdrIter::<_, ConfigUpgradeSet>::new(dec, r.limits.clone())
58405                    .map(|r| r.map(|t| Self::ConfigUpgradeSet(Box::new(t)))),
58406            ),
58407            TypeVariant::TxSetComponentType => Box::new(
58408                ReadXdrIter::<_, TxSetComponentType>::new(dec, r.limits.clone())
58409                    .map(|r| r.map(|t| Self::TxSetComponentType(Box::new(t)))),
58410            ),
58411            TypeVariant::TxExecutionThread => Box::new(
58412                ReadXdrIter::<_, TxExecutionThread>::new(dec, r.limits.clone())
58413                    .map(|r| r.map(|t| Self::TxExecutionThread(Box::new(t)))),
58414            ),
58415            TypeVariant::ParallelTxExecutionStage => Box::new(
58416                ReadXdrIter::<_, ParallelTxExecutionStage>::new(dec, r.limits.clone())
58417                    .map(|r| r.map(|t| Self::ParallelTxExecutionStage(Box::new(t)))),
58418            ),
58419            TypeVariant::ParallelTxsComponent => Box::new(
58420                ReadXdrIter::<_, ParallelTxsComponent>::new(dec, r.limits.clone())
58421                    .map(|r| r.map(|t| Self::ParallelTxsComponent(Box::new(t)))),
58422            ),
58423            TypeVariant::TxSetComponent => Box::new(
58424                ReadXdrIter::<_, TxSetComponent>::new(dec, r.limits.clone())
58425                    .map(|r| r.map(|t| Self::TxSetComponent(Box::new(t)))),
58426            ),
58427            TypeVariant::TxSetComponentTxsMaybeDiscountedFee => Box::new(
58428                ReadXdrIter::<_, TxSetComponentTxsMaybeDiscountedFee>::new(dec, r.limits.clone())
58429                    .map(|r| r.map(|t| Self::TxSetComponentTxsMaybeDiscountedFee(Box::new(t)))),
58430            ),
58431            TypeVariant::TransactionPhase => Box::new(
58432                ReadXdrIter::<_, TransactionPhase>::new(dec, r.limits.clone())
58433                    .map(|r| r.map(|t| Self::TransactionPhase(Box::new(t)))),
58434            ),
58435            TypeVariant::TransactionSet => Box::new(
58436                ReadXdrIter::<_, TransactionSet>::new(dec, r.limits.clone())
58437                    .map(|r| r.map(|t| Self::TransactionSet(Box::new(t)))),
58438            ),
58439            TypeVariant::TransactionSetV1 => Box::new(
58440                ReadXdrIter::<_, TransactionSetV1>::new(dec, r.limits.clone())
58441                    .map(|r| r.map(|t| Self::TransactionSetV1(Box::new(t)))),
58442            ),
58443            TypeVariant::GeneralizedTransactionSet => Box::new(
58444                ReadXdrIter::<_, GeneralizedTransactionSet>::new(dec, r.limits.clone())
58445                    .map(|r| r.map(|t| Self::GeneralizedTransactionSet(Box::new(t)))),
58446            ),
58447            TypeVariant::TransactionResultPair => Box::new(
58448                ReadXdrIter::<_, TransactionResultPair>::new(dec, r.limits.clone())
58449                    .map(|r| r.map(|t| Self::TransactionResultPair(Box::new(t)))),
58450            ),
58451            TypeVariant::TransactionResultSet => Box::new(
58452                ReadXdrIter::<_, TransactionResultSet>::new(dec, r.limits.clone())
58453                    .map(|r| r.map(|t| Self::TransactionResultSet(Box::new(t)))),
58454            ),
58455            TypeVariant::TransactionHistoryEntry => Box::new(
58456                ReadXdrIter::<_, TransactionHistoryEntry>::new(dec, r.limits.clone())
58457                    .map(|r| r.map(|t| Self::TransactionHistoryEntry(Box::new(t)))),
58458            ),
58459            TypeVariant::TransactionHistoryEntryExt => Box::new(
58460                ReadXdrIter::<_, TransactionHistoryEntryExt>::new(dec, r.limits.clone())
58461                    .map(|r| r.map(|t| Self::TransactionHistoryEntryExt(Box::new(t)))),
58462            ),
58463            TypeVariant::TransactionHistoryResultEntry => Box::new(
58464                ReadXdrIter::<_, TransactionHistoryResultEntry>::new(dec, r.limits.clone())
58465                    .map(|r| r.map(|t| Self::TransactionHistoryResultEntry(Box::new(t)))),
58466            ),
58467            TypeVariant::TransactionHistoryResultEntryExt => Box::new(
58468                ReadXdrIter::<_, TransactionHistoryResultEntryExt>::new(dec, r.limits.clone())
58469                    .map(|r| r.map(|t| Self::TransactionHistoryResultEntryExt(Box::new(t)))),
58470            ),
58471            TypeVariant::LedgerHeaderHistoryEntry => Box::new(
58472                ReadXdrIter::<_, LedgerHeaderHistoryEntry>::new(dec, r.limits.clone())
58473                    .map(|r| r.map(|t| Self::LedgerHeaderHistoryEntry(Box::new(t)))),
58474            ),
58475            TypeVariant::LedgerHeaderHistoryEntryExt => Box::new(
58476                ReadXdrIter::<_, LedgerHeaderHistoryEntryExt>::new(dec, r.limits.clone())
58477                    .map(|r| r.map(|t| Self::LedgerHeaderHistoryEntryExt(Box::new(t)))),
58478            ),
58479            TypeVariant::LedgerScpMessages => Box::new(
58480                ReadXdrIter::<_, LedgerScpMessages>::new(dec, r.limits.clone())
58481                    .map(|r| r.map(|t| Self::LedgerScpMessages(Box::new(t)))),
58482            ),
58483            TypeVariant::ScpHistoryEntryV0 => Box::new(
58484                ReadXdrIter::<_, ScpHistoryEntryV0>::new(dec, r.limits.clone())
58485                    .map(|r| r.map(|t| Self::ScpHistoryEntryV0(Box::new(t)))),
58486            ),
58487            TypeVariant::ScpHistoryEntry => Box::new(
58488                ReadXdrIter::<_, ScpHistoryEntry>::new(dec, r.limits.clone())
58489                    .map(|r| r.map(|t| Self::ScpHistoryEntry(Box::new(t)))),
58490            ),
58491            TypeVariant::LedgerEntryChangeType => Box::new(
58492                ReadXdrIter::<_, LedgerEntryChangeType>::new(dec, r.limits.clone())
58493                    .map(|r| r.map(|t| Self::LedgerEntryChangeType(Box::new(t)))),
58494            ),
58495            TypeVariant::LedgerEntryChange => Box::new(
58496                ReadXdrIter::<_, LedgerEntryChange>::new(dec, r.limits.clone())
58497                    .map(|r| r.map(|t| Self::LedgerEntryChange(Box::new(t)))),
58498            ),
58499            TypeVariant::LedgerEntryChanges => Box::new(
58500                ReadXdrIter::<_, LedgerEntryChanges>::new(dec, r.limits.clone())
58501                    .map(|r| r.map(|t| Self::LedgerEntryChanges(Box::new(t)))),
58502            ),
58503            TypeVariant::OperationMeta => Box::new(
58504                ReadXdrIter::<_, OperationMeta>::new(dec, r.limits.clone())
58505                    .map(|r| r.map(|t| Self::OperationMeta(Box::new(t)))),
58506            ),
58507            TypeVariant::TransactionMetaV1 => Box::new(
58508                ReadXdrIter::<_, TransactionMetaV1>::new(dec, r.limits.clone())
58509                    .map(|r| r.map(|t| Self::TransactionMetaV1(Box::new(t)))),
58510            ),
58511            TypeVariant::TransactionMetaV2 => Box::new(
58512                ReadXdrIter::<_, TransactionMetaV2>::new(dec, r.limits.clone())
58513                    .map(|r| r.map(|t| Self::TransactionMetaV2(Box::new(t)))),
58514            ),
58515            TypeVariant::ContractEventType => Box::new(
58516                ReadXdrIter::<_, ContractEventType>::new(dec, r.limits.clone())
58517                    .map(|r| r.map(|t| Self::ContractEventType(Box::new(t)))),
58518            ),
58519            TypeVariant::ContractEvent => Box::new(
58520                ReadXdrIter::<_, ContractEvent>::new(dec, r.limits.clone())
58521                    .map(|r| r.map(|t| Self::ContractEvent(Box::new(t)))),
58522            ),
58523            TypeVariant::ContractEventBody => Box::new(
58524                ReadXdrIter::<_, ContractEventBody>::new(dec, r.limits.clone())
58525                    .map(|r| r.map(|t| Self::ContractEventBody(Box::new(t)))),
58526            ),
58527            TypeVariant::ContractEventV0 => Box::new(
58528                ReadXdrIter::<_, ContractEventV0>::new(dec, r.limits.clone())
58529                    .map(|r| r.map(|t| Self::ContractEventV0(Box::new(t)))),
58530            ),
58531            TypeVariant::DiagnosticEvent => Box::new(
58532                ReadXdrIter::<_, DiagnosticEvent>::new(dec, r.limits.clone())
58533                    .map(|r| r.map(|t| Self::DiagnosticEvent(Box::new(t)))),
58534            ),
58535            TypeVariant::SorobanTransactionMetaExtV1 => Box::new(
58536                ReadXdrIter::<_, SorobanTransactionMetaExtV1>::new(dec, r.limits.clone())
58537                    .map(|r| r.map(|t| Self::SorobanTransactionMetaExtV1(Box::new(t)))),
58538            ),
58539            TypeVariant::SorobanTransactionMetaExt => Box::new(
58540                ReadXdrIter::<_, SorobanTransactionMetaExt>::new(dec, r.limits.clone())
58541                    .map(|r| r.map(|t| Self::SorobanTransactionMetaExt(Box::new(t)))),
58542            ),
58543            TypeVariant::SorobanTransactionMeta => Box::new(
58544                ReadXdrIter::<_, SorobanTransactionMeta>::new(dec, r.limits.clone())
58545                    .map(|r| r.map(|t| Self::SorobanTransactionMeta(Box::new(t)))),
58546            ),
58547            TypeVariant::TransactionMetaV3 => Box::new(
58548                ReadXdrIter::<_, TransactionMetaV3>::new(dec, r.limits.clone())
58549                    .map(|r| r.map(|t| Self::TransactionMetaV3(Box::new(t)))),
58550            ),
58551            TypeVariant::InvokeHostFunctionSuccessPreImage => Box::new(
58552                ReadXdrIter::<_, InvokeHostFunctionSuccessPreImage>::new(dec, r.limits.clone())
58553                    .map(|r| r.map(|t| Self::InvokeHostFunctionSuccessPreImage(Box::new(t)))),
58554            ),
58555            TypeVariant::TransactionMeta => Box::new(
58556                ReadXdrIter::<_, TransactionMeta>::new(dec, r.limits.clone())
58557                    .map(|r| r.map(|t| Self::TransactionMeta(Box::new(t)))),
58558            ),
58559            TypeVariant::TransactionResultMeta => Box::new(
58560                ReadXdrIter::<_, TransactionResultMeta>::new(dec, r.limits.clone())
58561                    .map(|r| r.map(|t| Self::TransactionResultMeta(Box::new(t)))),
58562            ),
58563            TypeVariant::UpgradeEntryMeta => Box::new(
58564                ReadXdrIter::<_, UpgradeEntryMeta>::new(dec, r.limits.clone())
58565                    .map(|r| r.map(|t| Self::UpgradeEntryMeta(Box::new(t)))),
58566            ),
58567            TypeVariant::LedgerCloseMetaV0 => Box::new(
58568                ReadXdrIter::<_, LedgerCloseMetaV0>::new(dec, r.limits.clone())
58569                    .map(|r| r.map(|t| Self::LedgerCloseMetaV0(Box::new(t)))),
58570            ),
58571            TypeVariant::LedgerCloseMetaExtV1 => Box::new(
58572                ReadXdrIter::<_, LedgerCloseMetaExtV1>::new(dec, r.limits.clone())
58573                    .map(|r| r.map(|t| Self::LedgerCloseMetaExtV1(Box::new(t)))),
58574            ),
58575            TypeVariant::LedgerCloseMetaExtV2 => Box::new(
58576                ReadXdrIter::<_, LedgerCloseMetaExtV2>::new(dec, r.limits.clone())
58577                    .map(|r| r.map(|t| Self::LedgerCloseMetaExtV2(Box::new(t)))),
58578            ),
58579            TypeVariant::LedgerCloseMetaExt => Box::new(
58580                ReadXdrIter::<_, LedgerCloseMetaExt>::new(dec, r.limits.clone())
58581                    .map(|r| r.map(|t| Self::LedgerCloseMetaExt(Box::new(t)))),
58582            ),
58583            TypeVariant::LedgerCloseMetaV1 => Box::new(
58584                ReadXdrIter::<_, LedgerCloseMetaV1>::new(dec, r.limits.clone())
58585                    .map(|r| r.map(|t| Self::LedgerCloseMetaV1(Box::new(t)))),
58586            ),
58587            TypeVariant::LedgerCloseMeta => Box::new(
58588                ReadXdrIter::<_, LedgerCloseMeta>::new(dec, r.limits.clone())
58589                    .map(|r| r.map(|t| Self::LedgerCloseMeta(Box::new(t)))),
58590            ),
58591            TypeVariant::ErrorCode => Box::new(
58592                ReadXdrIter::<_, ErrorCode>::new(dec, r.limits.clone())
58593                    .map(|r| r.map(|t| Self::ErrorCode(Box::new(t)))),
58594            ),
58595            TypeVariant::SError => Box::new(
58596                ReadXdrIter::<_, SError>::new(dec, r.limits.clone())
58597                    .map(|r| r.map(|t| Self::SError(Box::new(t)))),
58598            ),
58599            TypeVariant::SendMore => Box::new(
58600                ReadXdrIter::<_, SendMore>::new(dec, r.limits.clone())
58601                    .map(|r| r.map(|t| Self::SendMore(Box::new(t)))),
58602            ),
58603            TypeVariant::SendMoreExtended => Box::new(
58604                ReadXdrIter::<_, SendMoreExtended>::new(dec, r.limits.clone())
58605                    .map(|r| r.map(|t| Self::SendMoreExtended(Box::new(t)))),
58606            ),
58607            TypeVariant::AuthCert => Box::new(
58608                ReadXdrIter::<_, AuthCert>::new(dec, r.limits.clone())
58609                    .map(|r| r.map(|t| Self::AuthCert(Box::new(t)))),
58610            ),
58611            TypeVariant::Hello => Box::new(
58612                ReadXdrIter::<_, Hello>::new(dec, r.limits.clone())
58613                    .map(|r| r.map(|t| Self::Hello(Box::new(t)))),
58614            ),
58615            TypeVariant::Auth => Box::new(
58616                ReadXdrIter::<_, Auth>::new(dec, r.limits.clone())
58617                    .map(|r| r.map(|t| Self::Auth(Box::new(t)))),
58618            ),
58619            TypeVariant::IpAddrType => Box::new(
58620                ReadXdrIter::<_, IpAddrType>::new(dec, r.limits.clone())
58621                    .map(|r| r.map(|t| Self::IpAddrType(Box::new(t)))),
58622            ),
58623            TypeVariant::PeerAddress => Box::new(
58624                ReadXdrIter::<_, PeerAddress>::new(dec, r.limits.clone())
58625                    .map(|r| r.map(|t| Self::PeerAddress(Box::new(t)))),
58626            ),
58627            TypeVariant::PeerAddressIp => Box::new(
58628                ReadXdrIter::<_, PeerAddressIp>::new(dec, r.limits.clone())
58629                    .map(|r| r.map(|t| Self::PeerAddressIp(Box::new(t)))),
58630            ),
58631            TypeVariant::MessageType => Box::new(
58632                ReadXdrIter::<_, MessageType>::new(dec, r.limits.clone())
58633                    .map(|r| r.map(|t| Self::MessageType(Box::new(t)))),
58634            ),
58635            TypeVariant::DontHave => Box::new(
58636                ReadXdrIter::<_, DontHave>::new(dec, r.limits.clone())
58637                    .map(|r| r.map(|t| Self::DontHave(Box::new(t)))),
58638            ),
58639            TypeVariant::SurveyMessageCommandType => Box::new(
58640                ReadXdrIter::<_, SurveyMessageCommandType>::new(dec, r.limits.clone())
58641                    .map(|r| r.map(|t| Self::SurveyMessageCommandType(Box::new(t)))),
58642            ),
58643            TypeVariant::SurveyMessageResponseType => Box::new(
58644                ReadXdrIter::<_, SurveyMessageResponseType>::new(dec, r.limits.clone())
58645                    .map(|r| r.map(|t| Self::SurveyMessageResponseType(Box::new(t)))),
58646            ),
58647            TypeVariant::TimeSlicedSurveyStartCollectingMessage => Box::new(
58648                ReadXdrIter::<_, TimeSlicedSurveyStartCollectingMessage>::new(
58649                    dec,
58650                    r.limits.clone(),
58651                )
58652                .map(|r| r.map(|t| Self::TimeSlicedSurveyStartCollectingMessage(Box::new(t)))),
58653            ),
58654            TypeVariant::SignedTimeSlicedSurveyStartCollectingMessage => Box::new(
58655                ReadXdrIter::<_, SignedTimeSlicedSurveyStartCollectingMessage>::new(
58656                    dec,
58657                    r.limits.clone(),
58658                )
58659                .map(|r| {
58660                    r.map(|t| Self::SignedTimeSlicedSurveyStartCollectingMessage(Box::new(t)))
58661                }),
58662            ),
58663            TypeVariant::TimeSlicedSurveyStopCollectingMessage => Box::new(
58664                ReadXdrIter::<_, TimeSlicedSurveyStopCollectingMessage>::new(dec, r.limits.clone())
58665                    .map(|r| r.map(|t| Self::TimeSlicedSurveyStopCollectingMessage(Box::new(t)))),
58666            ),
58667            TypeVariant::SignedTimeSlicedSurveyStopCollectingMessage => Box::new(
58668                ReadXdrIter::<_, SignedTimeSlicedSurveyStopCollectingMessage>::new(
58669                    dec,
58670                    r.limits.clone(),
58671                )
58672                .map(|r| r.map(|t| Self::SignedTimeSlicedSurveyStopCollectingMessage(Box::new(t)))),
58673            ),
58674            TypeVariant::SurveyRequestMessage => Box::new(
58675                ReadXdrIter::<_, SurveyRequestMessage>::new(dec, r.limits.clone())
58676                    .map(|r| r.map(|t| Self::SurveyRequestMessage(Box::new(t)))),
58677            ),
58678            TypeVariant::TimeSlicedSurveyRequestMessage => Box::new(
58679                ReadXdrIter::<_, TimeSlicedSurveyRequestMessage>::new(dec, r.limits.clone())
58680                    .map(|r| r.map(|t| Self::TimeSlicedSurveyRequestMessage(Box::new(t)))),
58681            ),
58682            TypeVariant::SignedSurveyRequestMessage => Box::new(
58683                ReadXdrIter::<_, SignedSurveyRequestMessage>::new(dec, r.limits.clone())
58684                    .map(|r| r.map(|t| Self::SignedSurveyRequestMessage(Box::new(t)))),
58685            ),
58686            TypeVariant::SignedTimeSlicedSurveyRequestMessage => Box::new(
58687                ReadXdrIter::<_, SignedTimeSlicedSurveyRequestMessage>::new(dec, r.limits.clone())
58688                    .map(|r| r.map(|t| Self::SignedTimeSlicedSurveyRequestMessage(Box::new(t)))),
58689            ),
58690            TypeVariant::EncryptedBody => Box::new(
58691                ReadXdrIter::<_, EncryptedBody>::new(dec, r.limits.clone())
58692                    .map(|r| r.map(|t| Self::EncryptedBody(Box::new(t)))),
58693            ),
58694            TypeVariant::SurveyResponseMessage => Box::new(
58695                ReadXdrIter::<_, SurveyResponseMessage>::new(dec, r.limits.clone())
58696                    .map(|r| r.map(|t| Self::SurveyResponseMessage(Box::new(t)))),
58697            ),
58698            TypeVariant::TimeSlicedSurveyResponseMessage => Box::new(
58699                ReadXdrIter::<_, TimeSlicedSurveyResponseMessage>::new(dec, r.limits.clone())
58700                    .map(|r| r.map(|t| Self::TimeSlicedSurveyResponseMessage(Box::new(t)))),
58701            ),
58702            TypeVariant::SignedSurveyResponseMessage => Box::new(
58703                ReadXdrIter::<_, SignedSurveyResponseMessage>::new(dec, r.limits.clone())
58704                    .map(|r| r.map(|t| Self::SignedSurveyResponseMessage(Box::new(t)))),
58705            ),
58706            TypeVariant::SignedTimeSlicedSurveyResponseMessage => Box::new(
58707                ReadXdrIter::<_, SignedTimeSlicedSurveyResponseMessage>::new(dec, r.limits.clone())
58708                    .map(|r| r.map(|t| Self::SignedTimeSlicedSurveyResponseMessage(Box::new(t)))),
58709            ),
58710            TypeVariant::PeerStats => Box::new(
58711                ReadXdrIter::<_, PeerStats>::new(dec, r.limits.clone())
58712                    .map(|r| r.map(|t| Self::PeerStats(Box::new(t)))),
58713            ),
58714            TypeVariant::PeerStatList => Box::new(
58715                ReadXdrIter::<_, PeerStatList>::new(dec, r.limits.clone())
58716                    .map(|r| r.map(|t| Self::PeerStatList(Box::new(t)))),
58717            ),
58718            TypeVariant::TimeSlicedNodeData => Box::new(
58719                ReadXdrIter::<_, TimeSlicedNodeData>::new(dec, r.limits.clone())
58720                    .map(|r| r.map(|t| Self::TimeSlicedNodeData(Box::new(t)))),
58721            ),
58722            TypeVariant::TimeSlicedPeerData => Box::new(
58723                ReadXdrIter::<_, TimeSlicedPeerData>::new(dec, r.limits.clone())
58724                    .map(|r| r.map(|t| Self::TimeSlicedPeerData(Box::new(t)))),
58725            ),
58726            TypeVariant::TimeSlicedPeerDataList => Box::new(
58727                ReadXdrIter::<_, TimeSlicedPeerDataList>::new(dec, r.limits.clone())
58728                    .map(|r| r.map(|t| Self::TimeSlicedPeerDataList(Box::new(t)))),
58729            ),
58730            TypeVariant::TopologyResponseBodyV0 => Box::new(
58731                ReadXdrIter::<_, TopologyResponseBodyV0>::new(dec, r.limits.clone())
58732                    .map(|r| r.map(|t| Self::TopologyResponseBodyV0(Box::new(t)))),
58733            ),
58734            TypeVariant::TopologyResponseBodyV1 => Box::new(
58735                ReadXdrIter::<_, TopologyResponseBodyV1>::new(dec, r.limits.clone())
58736                    .map(|r| r.map(|t| Self::TopologyResponseBodyV1(Box::new(t)))),
58737            ),
58738            TypeVariant::TopologyResponseBodyV2 => Box::new(
58739                ReadXdrIter::<_, TopologyResponseBodyV2>::new(dec, r.limits.clone())
58740                    .map(|r| r.map(|t| Self::TopologyResponseBodyV2(Box::new(t)))),
58741            ),
58742            TypeVariant::SurveyResponseBody => Box::new(
58743                ReadXdrIter::<_, SurveyResponseBody>::new(dec, r.limits.clone())
58744                    .map(|r| r.map(|t| Self::SurveyResponseBody(Box::new(t)))),
58745            ),
58746            TypeVariant::TxAdvertVector => Box::new(
58747                ReadXdrIter::<_, TxAdvertVector>::new(dec, r.limits.clone())
58748                    .map(|r| r.map(|t| Self::TxAdvertVector(Box::new(t)))),
58749            ),
58750            TypeVariant::FloodAdvert => Box::new(
58751                ReadXdrIter::<_, FloodAdvert>::new(dec, r.limits.clone())
58752                    .map(|r| r.map(|t| Self::FloodAdvert(Box::new(t)))),
58753            ),
58754            TypeVariant::TxDemandVector => Box::new(
58755                ReadXdrIter::<_, TxDemandVector>::new(dec, r.limits.clone())
58756                    .map(|r| r.map(|t| Self::TxDemandVector(Box::new(t)))),
58757            ),
58758            TypeVariant::FloodDemand => Box::new(
58759                ReadXdrIter::<_, FloodDemand>::new(dec, r.limits.clone())
58760                    .map(|r| r.map(|t| Self::FloodDemand(Box::new(t)))),
58761            ),
58762            TypeVariant::StellarMessage => Box::new(
58763                ReadXdrIter::<_, StellarMessage>::new(dec, r.limits.clone())
58764                    .map(|r| r.map(|t| Self::StellarMessage(Box::new(t)))),
58765            ),
58766            TypeVariant::AuthenticatedMessage => Box::new(
58767                ReadXdrIter::<_, AuthenticatedMessage>::new(dec, r.limits.clone())
58768                    .map(|r| r.map(|t| Self::AuthenticatedMessage(Box::new(t)))),
58769            ),
58770            TypeVariant::AuthenticatedMessageV0 => Box::new(
58771                ReadXdrIter::<_, AuthenticatedMessageV0>::new(dec, r.limits.clone())
58772                    .map(|r| r.map(|t| Self::AuthenticatedMessageV0(Box::new(t)))),
58773            ),
58774            TypeVariant::LiquidityPoolParameters => Box::new(
58775                ReadXdrIter::<_, LiquidityPoolParameters>::new(dec, r.limits.clone())
58776                    .map(|r| r.map(|t| Self::LiquidityPoolParameters(Box::new(t)))),
58777            ),
58778            TypeVariant::MuxedAccount => Box::new(
58779                ReadXdrIter::<_, MuxedAccount>::new(dec, r.limits.clone())
58780                    .map(|r| r.map(|t| Self::MuxedAccount(Box::new(t)))),
58781            ),
58782            TypeVariant::MuxedAccountMed25519 => Box::new(
58783                ReadXdrIter::<_, MuxedAccountMed25519>::new(dec, r.limits.clone())
58784                    .map(|r| r.map(|t| Self::MuxedAccountMed25519(Box::new(t)))),
58785            ),
58786            TypeVariant::DecoratedSignature => Box::new(
58787                ReadXdrIter::<_, DecoratedSignature>::new(dec, r.limits.clone())
58788                    .map(|r| r.map(|t| Self::DecoratedSignature(Box::new(t)))),
58789            ),
58790            TypeVariant::OperationType => Box::new(
58791                ReadXdrIter::<_, OperationType>::new(dec, r.limits.clone())
58792                    .map(|r| r.map(|t| Self::OperationType(Box::new(t)))),
58793            ),
58794            TypeVariant::CreateAccountOp => Box::new(
58795                ReadXdrIter::<_, CreateAccountOp>::new(dec, r.limits.clone())
58796                    .map(|r| r.map(|t| Self::CreateAccountOp(Box::new(t)))),
58797            ),
58798            TypeVariant::PaymentOp => Box::new(
58799                ReadXdrIter::<_, PaymentOp>::new(dec, r.limits.clone())
58800                    .map(|r| r.map(|t| Self::PaymentOp(Box::new(t)))),
58801            ),
58802            TypeVariant::PathPaymentStrictReceiveOp => Box::new(
58803                ReadXdrIter::<_, PathPaymentStrictReceiveOp>::new(dec, r.limits.clone())
58804                    .map(|r| r.map(|t| Self::PathPaymentStrictReceiveOp(Box::new(t)))),
58805            ),
58806            TypeVariant::PathPaymentStrictSendOp => Box::new(
58807                ReadXdrIter::<_, PathPaymentStrictSendOp>::new(dec, r.limits.clone())
58808                    .map(|r| r.map(|t| Self::PathPaymentStrictSendOp(Box::new(t)))),
58809            ),
58810            TypeVariant::ManageSellOfferOp => Box::new(
58811                ReadXdrIter::<_, ManageSellOfferOp>::new(dec, r.limits.clone())
58812                    .map(|r| r.map(|t| Self::ManageSellOfferOp(Box::new(t)))),
58813            ),
58814            TypeVariant::ManageBuyOfferOp => Box::new(
58815                ReadXdrIter::<_, ManageBuyOfferOp>::new(dec, r.limits.clone())
58816                    .map(|r| r.map(|t| Self::ManageBuyOfferOp(Box::new(t)))),
58817            ),
58818            TypeVariant::CreatePassiveSellOfferOp => Box::new(
58819                ReadXdrIter::<_, CreatePassiveSellOfferOp>::new(dec, r.limits.clone())
58820                    .map(|r| r.map(|t| Self::CreatePassiveSellOfferOp(Box::new(t)))),
58821            ),
58822            TypeVariant::SetOptionsOp => Box::new(
58823                ReadXdrIter::<_, SetOptionsOp>::new(dec, r.limits.clone())
58824                    .map(|r| r.map(|t| Self::SetOptionsOp(Box::new(t)))),
58825            ),
58826            TypeVariant::ChangeTrustAsset => Box::new(
58827                ReadXdrIter::<_, ChangeTrustAsset>::new(dec, r.limits.clone())
58828                    .map(|r| r.map(|t| Self::ChangeTrustAsset(Box::new(t)))),
58829            ),
58830            TypeVariant::ChangeTrustOp => Box::new(
58831                ReadXdrIter::<_, ChangeTrustOp>::new(dec, r.limits.clone())
58832                    .map(|r| r.map(|t| Self::ChangeTrustOp(Box::new(t)))),
58833            ),
58834            TypeVariant::AllowTrustOp => Box::new(
58835                ReadXdrIter::<_, AllowTrustOp>::new(dec, r.limits.clone())
58836                    .map(|r| r.map(|t| Self::AllowTrustOp(Box::new(t)))),
58837            ),
58838            TypeVariant::ManageDataOp => Box::new(
58839                ReadXdrIter::<_, ManageDataOp>::new(dec, r.limits.clone())
58840                    .map(|r| r.map(|t| Self::ManageDataOp(Box::new(t)))),
58841            ),
58842            TypeVariant::BumpSequenceOp => Box::new(
58843                ReadXdrIter::<_, BumpSequenceOp>::new(dec, r.limits.clone())
58844                    .map(|r| r.map(|t| Self::BumpSequenceOp(Box::new(t)))),
58845            ),
58846            TypeVariant::CreateClaimableBalanceOp => Box::new(
58847                ReadXdrIter::<_, CreateClaimableBalanceOp>::new(dec, r.limits.clone())
58848                    .map(|r| r.map(|t| Self::CreateClaimableBalanceOp(Box::new(t)))),
58849            ),
58850            TypeVariant::ClaimClaimableBalanceOp => Box::new(
58851                ReadXdrIter::<_, ClaimClaimableBalanceOp>::new(dec, r.limits.clone())
58852                    .map(|r| r.map(|t| Self::ClaimClaimableBalanceOp(Box::new(t)))),
58853            ),
58854            TypeVariant::BeginSponsoringFutureReservesOp => Box::new(
58855                ReadXdrIter::<_, BeginSponsoringFutureReservesOp>::new(dec, r.limits.clone())
58856                    .map(|r| r.map(|t| Self::BeginSponsoringFutureReservesOp(Box::new(t)))),
58857            ),
58858            TypeVariant::RevokeSponsorshipType => Box::new(
58859                ReadXdrIter::<_, RevokeSponsorshipType>::new(dec, r.limits.clone())
58860                    .map(|r| r.map(|t| Self::RevokeSponsorshipType(Box::new(t)))),
58861            ),
58862            TypeVariant::RevokeSponsorshipOp => Box::new(
58863                ReadXdrIter::<_, RevokeSponsorshipOp>::new(dec, r.limits.clone())
58864                    .map(|r| r.map(|t| Self::RevokeSponsorshipOp(Box::new(t)))),
58865            ),
58866            TypeVariant::RevokeSponsorshipOpSigner => Box::new(
58867                ReadXdrIter::<_, RevokeSponsorshipOpSigner>::new(dec, r.limits.clone())
58868                    .map(|r| r.map(|t| Self::RevokeSponsorshipOpSigner(Box::new(t)))),
58869            ),
58870            TypeVariant::ClawbackOp => Box::new(
58871                ReadXdrIter::<_, ClawbackOp>::new(dec, r.limits.clone())
58872                    .map(|r| r.map(|t| Self::ClawbackOp(Box::new(t)))),
58873            ),
58874            TypeVariant::ClawbackClaimableBalanceOp => Box::new(
58875                ReadXdrIter::<_, ClawbackClaimableBalanceOp>::new(dec, r.limits.clone())
58876                    .map(|r| r.map(|t| Self::ClawbackClaimableBalanceOp(Box::new(t)))),
58877            ),
58878            TypeVariant::SetTrustLineFlagsOp => Box::new(
58879                ReadXdrIter::<_, SetTrustLineFlagsOp>::new(dec, r.limits.clone())
58880                    .map(|r| r.map(|t| Self::SetTrustLineFlagsOp(Box::new(t)))),
58881            ),
58882            TypeVariant::LiquidityPoolDepositOp => Box::new(
58883                ReadXdrIter::<_, LiquidityPoolDepositOp>::new(dec, r.limits.clone())
58884                    .map(|r| r.map(|t| Self::LiquidityPoolDepositOp(Box::new(t)))),
58885            ),
58886            TypeVariant::LiquidityPoolWithdrawOp => Box::new(
58887                ReadXdrIter::<_, LiquidityPoolWithdrawOp>::new(dec, r.limits.clone())
58888                    .map(|r| r.map(|t| Self::LiquidityPoolWithdrawOp(Box::new(t)))),
58889            ),
58890            TypeVariant::HostFunctionType => Box::new(
58891                ReadXdrIter::<_, HostFunctionType>::new(dec, r.limits.clone())
58892                    .map(|r| r.map(|t| Self::HostFunctionType(Box::new(t)))),
58893            ),
58894            TypeVariant::ContractIdPreimageType => Box::new(
58895                ReadXdrIter::<_, ContractIdPreimageType>::new(dec, r.limits.clone())
58896                    .map(|r| r.map(|t| Self::ContractIdPreimageType(Box::new(t)))),
58897            ),
58898            TypeVariant::ContractIdPreimage => Box::new(
58899                ReadXdrIter::<_, ContractIdPreimage>::new(dec, r.limits.clone())
58900                    .map(|r| r.map(|t| Self::ContractIdPreimage(Box::new(t)))),
58901            ),
58902            TypeVariant::ContractIdPreimageFromAddress => Box::new(
58903                ReadXdrIter::<_, ContractIdPreimageFromAddress>::new(dec, r.limits.clone())
58904                    .map(|r| r.map(|t| Self::ContractIdPreimageFromAddress(Box::new(t)))),
58905            ),
58906            TypeVariant::CreateContractArgs => Box::new(
58907                ReadXdrIter::<_, CreateContractArgs>::new(dec, r.limits.clone())
58908                    .map(|r| r.map(|t| Self::CreateContractArgs(Box::new(t)))),
58909            ),
58910            TypeVariant::CreateContractArgsV2 => Box::new(
58911                ReadXdrIter::<_, CreateContractArgsV2>::new(dec, r.limits.clone())
58912                    .map(|r| r.map(|t| Self::CreateContractArgsV2(Box::new(t)))),
58913            ),
58914            TypeVariant::InvokeContractArgs => Box::new(
58915                ReadXdrIter::<_, InvokeContractArgs>::new(dec, r.limits.clone())
58916                    .map(|r| r.map(|t| Self::InvokeContractArgs(Box::new(t)))),
58917            ),
58918            TypeVariant::HostFunction => Box::new(
58919                ReadXdrIter::<_, HostFunction>::new(dec, r.limits.clone())
58920                    .map(|r| r.map(|t| Self::HostFunction(Box::new(t)))),
58921            ),
58922            TypeVariant::SorobanAuthorizedFunctionType => Box::new(
58923                ReadXdrIter::<_, SorobanAuthorizedFunctionType>::new(dec, r.limits.clone())
58924                    .map(|r| r.map(|t| Self::SorobanAuthorizedFunctionType(Box::new(t)))),
58925            ),
58926            TypeVariant::SorobanAuthorizedFunction => Box::new(
58927                ReadXdrIter::<_, SorobanAuthorizedFunction>::new(dec, r.limits.clone())
58928                    .map(|r| r.map(|t| Self::SorobanAuthorizedFunction(Box::new(t)))),
58929            ),
58930            TypeVariant::SorobanAuthorizedInvocation => Box::new(
58931                ReadXdrIter::<_, SorobanAuthorizedInvocation>::new(dec, r.limits.clone())
58932                    .map(|r| r.map(|t| Self::SorobanAuthorizedInvocation(Box::new(t)))),
58933            ),
58934            TypeVariant::SorobanAddressCredentials => Box::new(
58935                ReadXdrIter::<_, SorobanAddressCredentials>::new(dec, r.limits.clone())
58936                    .map(|r| r.map(|t| Self::SorobanAddressCredentials(Box::new(t)))),
58937            ),
58938            TypeVariant::SorobanCredentialsType => Box::new(
58939                ReadXdrIter::<_, SorobanCredentialsType>::new(dec, r.limits.clone())
58940                    .map(|r| r.map(|t| Self::SorobanCredentialsType(Box::new(t)))),
58941            ),
58942            TypeVariant::SorobanCredentials => Box::new(
58943                ReadXdrIter::<_, SorobanCredentials>::new(dec, r.limits.clone())
58944                    .map(|r| r.map(|t| Self::SorobanCredentials(Box::new(t)))),
58945            ),
58946            TypeVariant::SorobanAuthorizationEntry => Box::new(
58947                ReadXdrIter::<_, SorobanAuthorizationEntry>::new(dec, r.limits.clone())
58948                    .map(|r| r.map(|t| Self::SorobanAuthorizationEntry(Box::new(t)))),
58949            ),
58950            TypeVariant::InvokeHostFunctionOp => Box::new(
58951                ReadXdrIter::<_, InvokeHostFunctionOp>::new(dec, r.limits.clone())
58952                    .map(|r| r.map(|t| Self::InvokeHostFunctionOp(Box::new(t)))),
58953            ),
58954            TypeVariant::ExtendFootprintTtlOp => Box::new(
58955                ReadXdrIter::<_, ExtendFootprintTtlOp>::new(dec, r.limits.clone())
58956                    .map(|r| r.map(|t| Self::ExtendFootprintTtlOp(Box::new(t)))),
58957            ),
58958            TypeVariant::RestoreFootprintOp => Box::new(
58959                ReadXdrIter::<_, RestoreFootprintOp>::new(dec, r.limits.clone())
58960                    .map(|r| r.map(|t| Self::RestoreFootprintOp(Box::new(t)))),
58961            ),
58962            TypeVariant::Operation => Box::new(
58963                ReadXdrIter::<_, Operation>::new(dec, r.limits.clone())
58964                    .map(|r| r.map(|t| Self::Operation(Box::new(t)))),
58965            ),
58966            TypeVariant::OperationBody => Box::new(
58967                ReadXdrIter::<_, OperationBody>::new(dec, r.limits.clone())
58968                    .map(|r| r.map(|t| Self::OperationBody(Box::new(t)))),
58969            ),
58970            TypeVariant::HashIdPreimage => Box::new(
58971                ReadXdrIter::<_, HashIdPreimage>::new(dec, r.limits.clone())
58972                    .map(|r| r.map(|t| Self::HashIdPreimage(Box::new(t)))),
58973            ),
58974            TypeVariant::HashIdPreimageOperationId => Box::new(
58975                ReadXdrIter::<_, HashIdPreimageOperationId>::new(dec, r.limits.clone())
58976                    .map(|r| r.map(|t| Self::HashIdPreimageOperationId(Box::new(t)))),
58977            ),
58978            TypeVariant::HashIdPreimageRevokeId => Box::new(
58979                ReadXdrIter::<_, HashIdPreimageRevokeId>::new(dec, r.limits.clone())
58980                    .map(|r| r.map(|t| Self::HashIdPreimageRevokeId(Box::new(t)))),
58981            ),
58982            TypeVariant::HashIdPreimageContractId => Box::new(
58983                ReadXdrIter::<_, HashIdPreimageContractId>::new(dec, r.limits.clone())
58984                    .map(|r| r.map(|t| Self::HashIdPreimageContractId(Box::new(t)))),
58985            ),
58986            TypeVariant::HashIdPreimageSorobanAuthorization => Box::new(
58987                ReadXdrIter::<_, HashIdPreimageSorobanAuthorization>::new(dec, r.limits.clone())
58988                    .map(|r| r.map(|t| Self::HashIdPreimageSorobanAuthorization(Box::new(t)))),
58989            ),
58990            TypeVariant::MemoType => Box::new(
58991                ReadXdrIter::<_, MemoType>::new(dec, r.limits.clone())
58992                    .map(|r| r.map(|t| Self::MemoType(Box::new(t)))),
58993            ),
58994            TypeVariant::Memo => Box::new(
58995                ReadXdrIter::<_, Memo>::new(dec, r.limits.clone())
58996                    .map(|r| r.map(|t| Self::Memo(Box::new(t)))),
58997            ),
58998            TypeVariant::TimeBounds => Box::new(
58999                ReadXdrIter::<_, TimeBounds>::new(dec, r.limits.clone())
59000                    .map(|r| r.map(|t| Self::TimeBounds(Box::new(t)))),
59001            ),
59002            TypeVariant::LedgerBounds => Box::new(
59003                ReadXdrIter::<_, LedgerBounds>::new(dec, r.limits.clone())
59004                    .map(|r| r.map(|t| Self::LedgerBounds(Box::new(t)))),
59005            ),
59006            TypeVariant::PreconditionsV2 => Box::new(
59007                ReadXdrIter::<_, PreconditionsV2>::new(dec, r.limits.clone())
59008                    .map(|r| r.map(|t| Self::PreconditionsV2(Box::new(t)))),
59009            ),
59010            TypeVariant::PreconditionType => Box::new(
59011                ReadXdrIter::<_, PreconditionType>::new(dec, r.limits.clone())
59012                    .map(|r| r.map(|t| Self::PreconditionType(Box::new(t)))),
59013            ),
59014            TypeVariant::Preconditions => Box::new(
59015                ReadXdrIter::<_, Preconditions>::new(dec, r.limits.clone())
59016                    .map(|r| r.map(|t| Self::Preconditions(Box::new(t)))),
59017            ),
59018            TypeVariant::LedgerFootprint => Box::new(
59019                ReadXdrIter::<_, LedgerFootprint>::new(dec, r.limits.clone())
59020                    .map(|r| r.map(|t| Self::LedgerFootprint(Box::new(t)))),
59021            ),
59022            TypeVariant::ArchivalProofType => Box::new(
59023                ReadXdrIter::<_, ArchivalProofType>::new(dec, r.limits.clone())
59024                    .map(|r| r.map(|t| Self::ArchivalProofType(Box::new(t)))),
59025            ),
59026            TypeVariant::ArchivalProofNode => Box::new(
59027                ReadXdrIter::<_, ArchivalProofNode>::new(dec, r.limits.clone())
59028                    .map(|r| r.map(|t| Self::ArchivalProofNode(Box::new(t)))),
59029            ),
59030            TypeVariant::ProofLevel => Box::new(
59031                ReadXdrIter::<_, ProofLevel>::new(dec, r.limits.clone())
59032                    .map(|r| r.map(|t| Self::ProofLevel(Box::new(t)))),
59033            ),
59034            TypeVariant::ExistenceProofBody => Box::new(
59035                ReadXdrIter::<_, ExistenceProofBody>::new(dec, r.limits.clone())
59036                    .map(|r| r.map(|t| Self::ExistenceProofBody(Box::new(t)))),
59037            ),
59038            TypeVariant::NonexistenceProofBody => Box::new(
59039                ReadXdrIter::<_, NonexistenceProofBody>::new(dec, r.limits.clone())
59040                    .map(|r| r.map(|t| Self::NonexistenceProofBody(Box::new(t)))),
59041            ),
59042            TypeVariant::ArchivalProof => Box::new(
59043                ReadXdrIter::<_, ArchivalProof>::new(dec, r.limits.clone())
59044                    .map(|r| r.map(|t| Self::ArchivalProof(Box::new(t)))),
59045            ),
59046            TypeVariant::ArchivalProofBody => Box::new(
59047                ReadXdrIter::<_, ArchivalProofBody>::new(dec, r.limits.clone())
59048                    .map(|r| r.map(|t| Self::ArchivalProofBody(Box::new(t)))),
59049            ),
59050            TypeVariant::SorobanResources => Box::new(
59051                ReadXdrIter::<_, SorobanResources>::new(dec, r.limits.clone())
59052                    .map(|r| r.map(|t| Self::SorobanResources(Box::new(t)))),
59053            ),
59054            TypeVariant::SorobanTransactionData => Box::new(
59055                ReadXdrIter::<_, SorobanTransactionData>::new(dec, r.limits.clone())
59056                    .map(|r| r.map(|t| Self::SorobanTransactionData(Box::new(t)))),
59057            ),
59058            TypeVariant::SorobanTransactionDataExt => Box::new(
59059                ReadXdrIter::<_, SorobanTransactionDataExt>::new(dec, r.limits.clone())
59060                    .map(|r| r.map(|t| Self::SorobanTransactionDataExt(Box::new(t)))),
59061            ),
59062            TypeVariant::TransactionV0 => Box::new(
59063                ReadXdrIter::<_, TransactionV0>::new(dec, r.limits.clone())
59064                    .map(|r| r.map(|t| Self::TransactionV0(Box::new(t)))),
59065            ),
59066            TypeVariant::TransactionV0Ext => Box::new(
59067                ReadXdrIter::<_, TransactionV0Ext>::new(dec, r.limits.clone())
59068                    .map(|r| r.map(|t| Self::TransactionV0Ext(Box::new(t)))),
59069            ),
59070            TypeVariant::TransactionV0Envelope => Box::new(
59071                ReadXdrIter::<_, TransactionV0Envelope>::new(dec, r.limits.clone())
59072                    .map(|r| r.map(|t| Self::TransactionV0Envelope(Box::new(t)))),
59073            ),
59074            TypeVariant::Transaction => Box::new(
59075                ReadXdrIter::<_, Transaction>::new(dec, r.limits.clone())
59076                    .map(|r| r.map(|t| Self::Transaction(Box::new(t)))),
59077            ),
59078            TypeVariant::TransactionExt => Box::new(
59079                ReadXdrIter::<_, TransactionExt>::new(dec, r.limits.clone())
59080                    .map(|r| r.map(|t| Self::TransactionExt(Box::new(t)))),
59081            ),
59082            TypeVariant::TransactionV1Envelope => Box::new(
59083                ReadXdrIter::<_, TransactionV1Envelope>::new(dec, r.limits.clone())
59084                    .map(|r| r.map(|t| Self::TransactionV1Envelope(Box::new(t)))),
59085            ),
59086            TypeVariant::FeeBumpTransaction => Box::new(
59087                ReadXdrIter::<_, FeeBumpTransaction>::new(dec, r.limits.clone())
59088                    .map(|r| r.map(|t| Self::FeeBumpTransaction(Box::new(t)))),
59089            ),
59090            TypeVariant::FeeBumpTransactionInnerTx => Box::new(
59091                ReadXdrIter::<_, FeeBumpTransactionInnerTx>::new(dec, r.limits.clone())
59092                    .map(|r| r.map(|t| Self::FeeBumpTransactionInnerTx(Box::new(t)))),
59093            ),
59094            TypeVariant::FeeBumpTransactionExt => Box::new(
59095                ReadXdrIter::<_, FeeBumpTransactionExt>::new(dec, r.limits.clone())
59096                    .map(|r| r.map(|t| Self::FeeBumpTransactionExt(Box::new(t)))),
59097            ),
59098            TypeVariant::FeeBumpTransactionEnvelope => Box::new(
59099                ReadXdrIter::<_, FeeBumpTransactionEnvelope>::new(dec, r.limits.clone())
59100                    .map(|r| r.map(|t| Self::FeeBumpTransactionEnvelope(Box::new(t)))),
59101            ),
59102            TypeVariant::TransactionEnvelope => Box::new(
59103                ReadXdrIter::<_, TransactionEnvelope>::new(dec, r.limits.clone())
59104                    .map(|r| r.map(|t| Self::TransactionEnvelope(Box::new(t)))),
59105            ),
59106            TypeVariant::TransactionSignaturePayload => Box::new(
59107                ReadXdrIter::<_, TransactionSignaturePayload>::new(dec, r.limits.clone())
59108                    .map(|r| r.map(|t| Self::TransactionSignaturePayload(Box::new(t)))),
59109            ),
59110            TypeVariant::TransactionSignaturePayloadTaggedTransaction => Box::new(
59111                ReadXdrIter::<_, TransactionSignaturePayloadTaggedTransaction>::new(
59112                    dec,
59113                    r.limits.clone(),
59114                )
59115                .map(|r| {
59116                    r.map(|t| Self::TransactionSignaturePayloadTaggedTransaction(Box::new(t)))
59117                }),
59118            ),
59119            TypeVariant::ClaimAtomType => Box::new(
59120                ReadXdrIter::<_, ClaimAtomType>::new(dec, r.limits.clone())
59121                    .map(|r| r.map(|t| Self::ClaimAtomType(Box::new(t)))),
59122            ),
59123            TypeVariant::ClaimOfferAtomV0 => Box::new(
59124                ReadXdrIter::<_, ClaimOfferAtomV0>::new(dec, r.limits.clone())
59125                    .map(|r| r.map(|t| Self::ClaimOfferAtomV0(Box::new(t)))),
59126            ),
59127            TypeVariant::ClaimOfferAtom => Box::new(
59128                ReadXdrIter::<_, ClaimOfferAtom>::new(dec, r.limits.clone())
59129                    .map(|r| r.map(|t| Self::ClaimOfferAtom(Box::new(t)))),
59130            ),
59131            TypeVariant::ClaimLiquidityAtom => Box::new(
59132                ReadXdrIter::<_, ClaimLiquidityAtom>::new(dec, r.limits.clone())
59133                    .map(|r| r.map(|t| Self::ClaimLiquidityAtom(Box::new(t)))),
59134            ),
59135            TypeVariant::ClaimAtom => Box::new(
59136                ReadXdrIter::<_, ClaimAtom>::new(dec, r.limits.clone())
59137                    .map(|r| r.map(|t| Self::ClaimAtom(Box::new(t)))),
59138            ),
59139            TypeVariant::CreateAccountResultCode => Box::new(
59140                ReadXdrIter::<_, CreateAccountResultCode>::new(dec, r.limits.clone())
59141                    .map(|r| r.map(|t| Self::CreateAccountResultCode(Box::new(t)))),
59142            ),
59143            TypeVariant::CreateAccountResult => Box::new(
59144                ReadXdrIter::<_, CreateAccountResult>::new(dec, r.limits.clone())
59145                    .map(|r| r.map(|t| Self::CreateAccountResult(Box::new(t)))),
59146            ),
59147            TypeVariant::PaymentResultCode => Box::new(
59148                ReadXdrIter::<_, PaymentResultCode>::new(dec, r.limits.clone())
59149                    .map(|r| r.map(|t| Self::PaymentResultCode(Box::new(t)))),
59150            ),
59151            TypeVariant::PaymentResult => Box::new(
59152                ReadXdrIter::<_, PaymentResult>::new(dec, r.limits.clone())
59153                    .map(|r| r.map(|t| Self::PaymentResult(Box::new(t)))),
59154            ),
59155            TypeVariant::PathPaymentStrictReceiveResultCode => Box::new(
59156                ReadXdrIter::<_, PathPaymentStrictReceiveResultCode>::new(dec, r.limits.clone())
59157                    .map(|r| r.map(|t| Self::PathPaymentStrictReceiveResultCode(Box::new(t)))),
59158            ),
59159            TypeVariant::SimplePaymentResult => Box::new(
59160                ReadXdrIter::<_, SimplePaymentResult>::new(dec, r.limits.clone())
59161                    .map(|r| r.map(|t| Self::SimplePaymentResult(Box::new(t)))),
59162            ),
59163            TypeVariant::PathPaymentStrictReceiveResult => Box::new(
59164                ReadXdrIter::<_, PathPaymentStrictReceiveResult>::new(dec, r.limits.clone())
59165                    .map(|r| r.map(|t| Self::PathPaymentStrictReceiveResult(Box::new(t)))),
59166            ),
59167            TypeVariant::PathPaymentStrictReceiveResultSuccess => Box::new(
59168                ReadXdrIter::<_, PathPaymentStrictReceiveResultSuccess>::new(dec, r.limits.clone())
59169                    .map(|r| r.map(|t| Self::PathPaymentStrictReceiveResultSuccess(Box::new(t)))),
59170            ),
59171            TypeVariant::PathPaymentStrictSendResultCode => Box::new(
59172                ReadXdrIter::<_, PathPaymentStrictSendResultCode>::new(dec, r.limits.clone())
59173                    .map(|r| r.map(|t| Self::PathPaymentStrictSendResultCode(Box::new(t)))),
59174            ),
59175            TypeVariant::PathPaymentStrictSendResult => Box::new(
59176                ReadXdrIter::<_, PathPaymentStrictSendResult>::new(dec, r.limits.clone())
59177                    .map(|r| r.map(|t| Self::PathPaymentStrictSendResult(Box::new(t)))),
59178            ),
59179            TypeVariant::PathPaymentStrictSendResultSuccess => Box::new(
59180                ReadXdrIter::<_, PathPaymentStrictSendResultSuccess>::new(dec, r.limits.clone())
59181                    .map(|r| r.map(|t| Self::PathPaymentStrictSendResultSuccess(Box::new(t)))),
59182            ),
59183            TypeVariant::ManageSellOfferResultCode => Box::new(
59184                ReadXdrIter::<_, ManageSellOfferResultCode>::new(dec, r.limits.clone())
59185                    .map(|r| r.map(|t| Self::ManageSellOfferResultCode(Box::new(t)))),
59186            ),
59187            TypeVariant::ManageOfferEffect => Box::new(
59188                ReadXdrIter::<_, ManageOfferEffect>::new(dec, r.limits.clone())
59189                    .map(|r| r.map(|t| Self::ManageOfferEffect(Box::new(t)))),
59190            ),
59191            TypeVariant::ManageOfferSuccessResult => Box::new(
59192                ReadXdrIter::<_, ManageOfferSuccessResult>::new(dec, r.limits.clone())
59193                    .map(|r| r.map(|t| Self::ManageOfferSuccessResult(Box::new(t)))),
59194            ),
59195            TypeVariant::ManageOfferSuccessResultOffer => Box::new(
59196                ReadXdrIter::<_, ManageOfferSuccessResultOffer>::new(dec, r.limits.clone())
59197                    .map(|r| r.map(|t| Self::ManageOfferSuccessResultOffer(Box::new(t)))),
59198            ),
59199            TypeVariant::ManageSellOfferResult => Box::new(
59200                ReadXdrIter::<_, ManageSellOfferResult>::new(dec, r.limits.clone())
59201                    .map(|r| r.map(|t| Self::ManageSellOfferResult(Box::new(t)))),
59202            ),
59203            TypeVariant::ManageBuyOfferResultCode => Box::new(
59204                ReadXdrIter::<_, ManageBuyOfferResultCode>::new(dec, r.limits.clone())
59205                    .map(|r| r.map(|t| Self::ManageBuyOfferResultCode(Box::new(t)))),
59206            ),
59207            TypeVariant::ManageBuyOfferResult => Box::new(
59208                ReadXdrIter::<_, ManageBuyOfferResult>::new(dec, r.limits.clone())
59209                    .map(|r| r.map(|t| Self::ManageBuyOfferResult(Box::new(t)))),
59210            ),
59211            TypeVariant::SetOptionsResultCode => Box::new(
59212                ReadXdrIter::<_, SetOptionsResultCode>::new(dec, r.limits.clone())
59213                    .map(|r| r.map(|t| Self::SetOptionsResultCode(Box::new(t)))),
59214            ),
59215            TypeVariant::SetOptionsResult => Box::new(
59216                ReadXdrIter::<_, SetOptionsResult>::new(dec, r.limits.clone())
59217                    .map(|r| r.map(|t| Self::SetOptionsResult(Box::new(t)))),
59218            ),
59219            TypeVariant::ChangeTrustResultCode => Box::new(
59220                ReadXdrIter::<_, ChangeTrustResultCode>::new(dec, r.limits.clone())
59221                    .map(|r| r.map(|t| Self::ChangeTrustResultCode(Box::new(t)))),
59222            ),
59223            TypeVariant::ChangeTrustResult => Box::new(
59224                ReadXdrIter::<_, ChangeTrustResult>::new(dec, r.limits.clone())
59225                    .map(|r| r.map(|t| Self::ChangeTrustResult(Box::new(t)))),
59226            ),
59227            TypeVariant::AllowTrustResultCode => Box::new(
59228                ReadXdrIter::<_, AllowTrustResultCode>::new(dec, r.limits.clone())
59229                    .map(|r| r.map(|t| Self::AllowTrustResultCode(Box::new(t)))),
59230            ),
59231            TypeVariant::AllowTrustResult => Box::new(
59232                ReadXdrIter::<_, AllowTrustResult>::new(dec, r.limits.clone())
59233                    .map(|r| r.map(|t| Self::AllowTrustResult(Box::new(t)))),
59234            ),
59235            TypeVariant::AccountMergeResultCode => Box::new(
59236                ReadXdrIter::<_, AccountMergeResultCode>::new(dec, r.limits.clone())
59237                    .map(|r| r.map(|t| Self::AccountMergeResultCode(Box::new(t)))),
59238            ),
59239            TypeVariant::AccountMergeResult => Box::new(
59240                ReadXdrIter::<_, AccountMergeResult>::new(dec, r.limits.clone())
59241                    .map(|r| r.map(|t| Self::AccountMergeResult(Box::new(t)))),
59242            ),
59243            TypeVariant::InflationResultCode => Box::new(
59244                ReadXdrIter::<_, InflationResultCode>::new(dec, r.limits.clone())
59245                    .map(|r| r.map(|t| Self::InflationResultCode(Box::new(t)))),
59246            ),
59247            TypeVariant::InflationPayout => Box::new(
59248                ReadXdrIter::<_, InflationPayout>::new(dec, r.limits.clone())
59249                    .map(|r| r.map(|t| Self::InflationPayout(Box::new(t)))),
59250            ),
59251            TypeVariant::InflationResult => Box::new(
59252                ReadXdrIter::<_, InflationResult>::new(dec, r.limits.clone())
59253                    .map(|r| r.map(|t| Self::InflationResult(Box::new(t)))),
59254            ),
59255            TypeVariant::ManageDataResultCode => Box::new(
59256                ReadXdrIter::<_, ManageDataResultCode>::new(dec, r.limits.clone())
59257                    .map(|r| r.map(|t| Self::ManageDataResultCode(Box::new(t)))),
59258            ),
59259            TypeVariant::ManageDataResult => Box::new(
59260                ReadXdrIter::<_, ManageDataResult>::new(dec, r.limits.clone())
59261                    .map(|r| r.map(|t| Self::ManageDataResult(Box::new(t)))),
59262            ),
59263            TypeVariant::BumpSequenceResultCode => Box::new(
59264                ReadXdrIter::<_, BumpSequenceResultCode>::new(dec, r.limits.clone())
59265                    .map(|r| r.map(|t| Self::BumpSequenceResultCode(Box::new(t)))),
59266            ),
59267            TypeVariant::BumpSequenceResult => Box::new(
59268                ReadXdrIter::<_, BumpSequenceResult>::new(dec, r.limits.clone())
59269                    .map(|r| r.map(|t| Self::BumpSequenceResult(Box::new(t)))),
59270            ),
59271            TypeVariant::CreateClaimableBalanceResultCode => Box::new(
59272                ReadXdrIter::<_, CreateClaimableBalanceResultCode>::new(dec, r.limits.clone())
59273                    .map(|r| r.map(|t| Self::CreateClaimableBalanceResultCode(Box::new(t)))),
59274            ),
59275            TypeVariant::CreateClaimableBalanceResult => Box::new(
59276                ReadXdrIter::<_, CreateClaimableBalanceResult>::new(dec, r.limits.clone())
59277                    .map(|r| r.map(|t| Self::CreateClaimableBalanceResult(Box::new(t)))),
59278            ),
59279            TypeVariant::ClaimClaimableBalanceResultCode => Box::new(
59280                ReadXdrIter::<_, ClaimClaimableBalanceResultCode>::new(dec, r.limits.clone())
59281                    .map(|r| r.map(|t| Self::ClaimClaimableBalanceResultCode(Box::new(t)))),
59282            ),
59283            TypeVariant::ClaimClaimableBalanceResult => Box::new(
59284                ReadXdrIter::<_, ClaimClaimableBalanceResult>::new(dec, r.limits.clone())
59285                    .map(|r| r.map(|t| Self::ClaimClaimableBalanceResult(Box::new(t)))),
59286            ),
59287            TypeVariant::BeginSponsoringFutureReservesResultCode => Box::new(
59288                ReadXdrIter::<_, BeginSponsoringFutureReservesResultCode>::new(
59289                    dec,
59290                    r.limits.clone(),
59291                )
59292                .map(|r| r.map(|t| Self::BeginSponsoringFutureReservesResultCode(Box::new(t)))),
59293            ),
59294            TypeVariant::BeginSponsoringFutureReservesResult => Box::new(
59295                ReadXdrIter::<_, BeginSponsoringFutureReservesResult>::new(dec, r.limits.clone())
59296                    .map(|r| r.map(|t| Self::BeginSponsoringFutureReservesResult(Box::new(t)))),
59297            ),
59298            TypeVariant::EndSponsoringFutureReservesResultCode => Box::new(
59299                ReadXdrIter::<_, EndSponsoringFutureReservesResultCode>::new(dec, r.limits.clone())
59300                    .map(|r| r.map(|t| Self::EndSponsoringFutureReservesResultCode(Box::new(t)))),
59301            ),
59302            TypeVariant::EndSponsoringFutureReservesResult => Box::new(
59303                ReadXdrIter::<_, EndSponsoringFutureReservesResult>::new(dec, r.limits.clone())
59304                    .map(|r| r.map(|t| Self::EndSponsoringFutureReservesResult(Box::new(t)))),
59305            ),
59306            TypeVariant::RevokeSponsorshipResultCode => Box::new(
59307                ReadXdrIter::<_, RevokeSponsorshipResultCode>::new(dec, r.limits.clone())
59308                    .map(|r| r.map(|t| Self::RevokeSponsorshipResultCode(Box::new(t)))),
59309            ),
59310            TypeVariant::RevokeSponsorshipResult => Box::new(
59311                ReadXdrIter::<_, RevokeSponsorshipResult>::new(dec, r.limits.clone())
59312                    .map(|r| r.map(|t| Self::RevokeSponsorshipResult(Box::new(t)))),
59313            ),
59314            TypeVariant::ClawbackResultCode => Box::new(
59315                ReadXdrIter::<_, ClawbackResultCode>::new(dec, r.limits.clone())
59316                    .map(|r| r.map(|t| Self::ClawbackResultCode(Box::new(t)))),
59317            ),
59318            TypeVariant::ClawbackResult => Box::new(
59319                ReadXdrIter::<_, ClawbackResult>::new(dec, r.limits.clone())
59320                    .map(|r| r.map(|t| Self::ClawbackResult(Box::new(t)))),
59321            ),
59322            TypeVariant::ClawbackClaimableBalanceResultCode => Box::new(
59323                ReadXdrIter::<_, ClawbackClaimableBalanceResultCode>::new(dec, r.limits.clone())
59324                    .map(|r| r.map(|t| Self::ClawbackClaimableBalanceResultCode(Box::new(t)))),
59325            ),
59326            TypeVariant::ClawbackClaimableBalanceResult => Box::new(
59327                ReadXdrIter::<_, ClawbackClaimableBalanceResult>::new(dec, r.limits.clone())
59328                    .map(|r| r.map(|t| Self::ClawbackClaimableBalanceResult(Box::new(t)))),
59329            ),
59330            TypeVariant::SetTrustLineFlagsResultCode => Box::new(
59331                ReadXdrIter::<_, SetTrustLineFlagsResultCode>::new(dec, r.limits.clone())
59332                    .map(|r| r.map(|t| Self::SetTrustLineFlagsResultCode(Box::new(t)))),
59333            ),
59334            TypeVariant::SetTrustLineFlagsResult => Box::new(
59335                ReadXdrIter::<_, SetTrustLineFlagsResult>::new(dec, r.limits.clone())
59336                    .map(|r| r.map(|t| Self::SetTrustLineFlagsResult(Box::new(t)))),
59337            ),
59338            TypeVariant::LiquidityPoolDepositResultCode => Box::new(
59339                ReadXdrIter::<_, LiquidityPoolDepositResultCode>::new(dec, r.limits.clone())
59340                    .map(|r| r.map(|t| Self::LiquidityPoolDepositResultCode(Box::new(t)))),
59341            ),
59342            TypeVariant::LiquidityPoolDepositResult => Box::new(
59343                ReadXdrIter::<_, LiquidityPoolDepositResult>::new(dec, r.limits.clone())
59344                    .map(|r| r.map(|t| Self::LiquidityPoolDepositResult(Box::new(t)))),
59345            ),
59346            TypeVariant::LiquidityPoolWithdrawResultCode => Box::new(
59347                ReadXdrIter::<_, LiquidityPoolWithdrawResultCode>::new(dec, r.limits.clone())
59348                    .map(|r| r.map(|t| Self::LiquidityPoolWithdrawResultCode(Box::new(t)))),
59349            ),
59350            TypeVariant::LiquidityPoolWithdrawResult => Box::new(
59351                ReadXdrIter::<_, LiquidityPoolWithdrawResult>::new(dec, r.limits.clone())
59352                    .map(|r| r.map(|t| Self::LiquidityPoolWithdrawResult(Box::new(t)))),
59353            ),
59354            TypeVariant::InvokeHostFunctionResultCode => Box::new(
59355                ReadXdrIter::<_, InvokeHostFunctionResultCode>::new(dec, r.limits.clone())
59356                    .map(|r| r.map(|t| Self::InvokeHostFunctionResultCode(Box::new(t)))),
59357            ),
59358            TypeVariant::InvokeHostFunctionResult => Box::new(
59359                ReadXdrIter::<_, InvokeHostFunctionResult>::new(dec, r.limits.clone())
59360                    .map(|r| r.map(|t| Self::InvokeHostFunctionResult(Box::new(t)))),
59361            ),
59362            TypeVariant::ExtendFootprintTtlResultCode => Box::new(
59363                ReadXdrIter::<_, ExtendFootprintTtlResultCode>::new(dec, r.limits.clone())
59364                    .map(|r| r.map(|t| Self::ExtendFootprintTtlResultCode(Box::new(t)))),
59365            ),
59366            TypeVariant::ExtendFootprintTtlResult => Box::new(
59367                ReadXdrIter::<_, ExtendFootprintTtlResult>::new(dec, r.limits.clone())
59368                    .map(|r| r.map(|t| Self::ExtendFootprintTtlResult(Box::new(t)))),
59369            ),
59370            TypeVariant::RestoreFootprintResultCode => Box::new(
59371                ReadXdrIter::<_, RestoreFootprintResultCode>::new(dec, r.limits.clone())
59372                    .map(|r| r.map(|t| Self::RestoreFootprintResultCode(Box::new(t)))),
59373            ),
59374            TypeVariant::RestoreFootprintResult => Box::new(
59375                ReadXdrIter::<_, RestoreFootprintResult>::new(dec, r.limits.clone())
59376                    .map(|r| r.map(|t| Self::RestoreFootprintResult(Box::new(t)))),
59377            ),
59378            TypeVariant::OperationResultCode => Box::new(
59379                ReadXdrIter::<_, OperationResultCode>::new(dec, r.limits.clone())
59380                    .map(|r| r.map(|t| Self::OperationResultCode(Box::new(t)))),
59381            ),
59382            TypeVariant::OperationResult => Box::new(
59383                ReadXdrIter::<_, OperationResult>::new(dec, r.limits.clone())
59384                    .map(|r| r.map(|t| Self::OperationResult(Box::new(t)))),
59385            ),
59386            TypeVariant::OperationResultTr => Box::new(
59387                ReadXdrIter::<_, OperationResultTr>::new(dec, r.limits.clone())
59388                    .map(|r| r.map(|t| Self::OperationResultTr(Box::new(t)))),
59389            ),
59390            TypeVariant::TransactionResultCode => Box::new(
59391                ReadXdrIter::<_, TransactionResultCode>::new(dec, r.limits.clone())
59392                    .map(|r| r.map(|t| Self::TransactionResultCode(Box::new(t)))),
59393            ),
59394            TypeVariant::InnerTransactionResult => Box::new(
59395                ReadXdrIter::<_, InnerTransactionResult>::new(dec, r.limits.clone())
59396                    .map(|r| r.map(|t| Self::InnerTransactionResult(Box::new(t)))),
59397            ),
59398            TypeVariant::InnerTransactionResultResult => Box::new(
59399                ReadXdrIter::<_, InnerTransactionResultResult>::new(dec, r.limits.clone())
59400                    .map(|r| r.map(|t| Self::InnerTransactionResultResult(Box::new(t)))),
59401            ),
59402            TypeVariant::InnerTransactionResultExt => Box::new(
59403                ReadXdrIter::<_, InnerTransactionResultExt>::new(dec, r.limits.clone())
59404                    .map(|r| r.map(|t| Self::InnerTransactionResultExt(Box::new(t)))),
59405            ),
59406            TypeVariant::InnerTransactionResultPair => Box::new(
59407                ReadXdrIter::<_, InnerTransactionResultPair>::new(dec, r.limits.clone())
59408                    .map(|r| r.map(|t| Self::InnerTransactionResultPair(Box::new(t)))),
59409            ),
59410            TypeVariant::TransactionResult => Box::new(
59411                ReadXdrIter::<_, TransactionResult>::new(dec, r.limits.clone())
59412                    .map(|r| r.map(|t| Self::TransactionResult(Box::new(t)))),
59413            ),
59414            TypeVariant::TransactionResultResult => Box::new(
59415                ReadXdrIter::<_, TransactionResultResult>::new(dec, r.limits.clone())
59416                    .map(|r| r.map(|t| Self::TransactionResultResult(Box::new(t)))),
59417            ),
59418            TypeVariant::TransactionResultExt => Box::new(
59419                ReadXdrIter::<_, TransactionResultExt>::new(dec, r.limits.clone())
59420                    .map(|r| r.map(|t| Self::TransactionResultExt(Box::new(t)))),
59421            ),
59422            TypeVariant::Hash => Box::new(
59423                ReadXdrIter::<_, Hash>::new(dec, r.limits.clone())
59424                    .map(|r| r.map(|t| Self::Hash(Box::new(t)))),
59425            ),
59426            TypeVariant::Uint256 => Box::new(
59427                ReadXdrIter::<_, Uint256>::new(dec, r.limits.clone())
59428                    .map(|r| r.map(|t| Self::Uint256(Box::new(t)))),
59429            ),
59430            TypeVariant::Uint32 => Box::new(
59431                ReadXdrIter::<_, Uint32>::new(dec, r.limits.clone())
59432                    .map(|r| r.map(|t| Self::Uint32(Box::new(t)))),
59433            ),
59434            TypeVariant::Int32 => Box::new(
59435                ReadXdrIter::<_, Int32>::new(dec, r.limits.clone())
59436                    .map(|r| r.map(|t| Self::Int32(Box::new(t)))),
59437            ),
59438            TypeVariant::Uint64 => Box::new(
59439                ReadXdrIter::<_, Uint64>::new(dec, r.limits.clone())
59440                    .map(|r| r.map(|t| Self::Uint64(Box::new(t)))),
59441            ),
59442            TypeVariant::Int64 => Box::new(
59443                ReadXdrIter::<_, Int64>::new(dec, r.limits.clone())
59444                    .map(|r| r.map(|t| Self::Int64(Box::new(t)))),
59445            ),
59446            TypeVariant::TimePoint => Box::new(
59447                ReadXdrIter::<_, TimePoint>::new(dec, r.limits.clone())
59448                    .map(|r| r.map(|t| Self::TimePoint(Box::new(t)))),
59449            ),
59450            TypeVariant::Duration => Box::new(
59451                ReadXdrIter::<_, Duration>::new(dec, r.limits.clone())
59452                    .map(|r| r.map(|t| Self::Duration(Box::new(t)))),
59453            ),
59454            TypeVariant::ExtensionPoint => Box::new(
59455                ReadXdrIter::<_, ExtensionPoint>::new(dec, r.limits.clone())
59456                    .map(|r| r.map(|t| Self::ExtensionPoint(Box::new(t)))),
59457            ),
59458            TypeVariant::CryptoKeyType => Box::new(
59459                ReadXdrIter::<_, CryptoKeyType>::new(dec, r.limits.clone())
59460                    .map(|r| r.map(|t| Self::CryptoKeyType(Box::new(t)))),
59461            ),
59462            TypeVariant::PublicKeyType => Box::new(
59463                ReadXdrIter::<_, PublicKeyType>::new(dec, r.limits.clone())
59464                    .map(|r| r.map(|t| Self::PublicKeyType(Box::new(t)))),
59465            ),
59466            TypeVariant::SignerKeyType => Box::new(
59467                ReadXdrIter::<_, SignerKeyType>::new(dec, r.limits.clone())
59468                    .map(|r| r.map(|t| Self::SignerKeyType(Box::new(t)))),
59469            ),
59470            TypeVariant::PublicKey => Box::new(
59471                ReadXdrIter::<_, PublicKey>::new(dec, r.limits.clone())
59472                    .map(|r| r.map(|t| Self::PublicKey(Box::new(t)))),
59473            ),
59474            TypeVariant::SignerKey => Box::new(
59475                ReadXdrIter::<_, SignerKey>::new(dec, r.limits.clone())
59476                    .map(|r| r.map(|t| Self::SignerKey(Box::new(t)))),
59477            ),
59478            TypeVariant::SignerKeyEd25519SignedPayload => Box::new(
59479                ReadXdrIter::<_, SignerKeyEd25519SignedPayload>::new(dec, r.limits.clone())
59480                    .map(|r| r.map(|t| Self::SignerKeyEd25519SignedPayload(Box::new(t)))),
59481            ),
59482            TypeVariant::Signature => Box::new(
59483                ReadXdrIter::<_, Signature>::new(dec, r.limits.clone())
59484                    .map(|r| r.map(|t| Self::Signature(Box::new(t)))),
59485            ),
59486            TypeVariant::SignatureHint => Box::new(
59487                ReadXdrIter::<_, SignatureHint>::new(dec, r.limits.clone())
59488                    .map(|r| r.map(|t| Self::SignatureHint(Box::new(t)))),
59489            ),
59490            TypeVariant::NodeId => Box::new(
59491                ReadXdrIter::<_, NodeId>::new(dec, r.limits.clone())
59492                    .map(|r| r.map(|t| Self::NodeId(Box::new(t)))),
59493            ),
59494            TypeVariant::AccountId => Box::new(
59495                ReadXdrIter::<_, AccountId>::new(dec, r.limits.clone())
59496                    .map(|r| r.map(|t| Self::AccountId(Box::new(t)))),
59497            ),
59498            TypeVariant::Curve25519Secret => Box::new(
59499                ReadXdrIter::<_, Curve25519Secret>::new(dec, r.limits.clone())
59500                    .map(|r| r.map(|t| Self::Curve25519Secret(Box::new(t)))),
59501            ),
59502            TypeVariant::Curve25519Public => Box::new(
59503                ReadXdrIter::<_, Curve25519Public>::new(dec, r.limits.clone())
59504                    .map(|r| r.map(|t| Self::Curve25519Public(Box::new(t)))),
59505            ),
59506            TypeVariant::HmacSha256Key => Box::new(
59507                ReadXdrIter::<_, HmacSha256Key>::new(dec, r.limits.clone())
59508                    .map(|r| r.map(|t| Self::HmacSha256Key(Box::new(t)))),
59509            ),
59510            TypeVariant::HmacSha256Mac => Box::new(
59511                ReadXdrIter::<_, HmacSha256Mac>::new(dec, r.limits.clone())
59512                    .map(|r| r.map(|t| Self::HmacSha256Mac(Box::new(t)))),
59513            ),
59514            TypeVariant::ShortHashSeed => Box::new(
59515                ReadXdrIter::<_, ShortHashSeed>::new(dec, r.limits.clone())
59516                    .map(|r| r.map(|t| Self::ShortHashSeed(Box::new(t)))),
59517            ),
59518            TypeVariant::BinaryFuseFilterType => Box::new(
59519                ReadXdrIter::<_, BinaryFuseFilterType>::new(dec, r.limits.clone())
59520                    .map(|r| r.map(|t| Self::BinaryFuseFilterType(Box::new(t)))),
59521            ),
59522            TypeVariant::SerializedBinaryFuseFilter => Box::new(
59523                ReadXdrIter::<_, SerializedBinaryFuseFilter>::new(dec, r.limits.clone())
59524                    .map(|r| r.map(|t| Self::SerializedBinaryFuseFilter(Box::new(t)))),
59525            ),
59526        }
59527    }
59528
59529    #[cfg(feature = "std")]
59530    pub fn from_xdr<B: AsRef<[u8]>>(v: TypeVariant, bytes: B, limits: Limits) -> Result<Self> {
59531        let mut cursor = Limited::new(Cursor::new(bytes.as_ref()), limits);
59532        let t = Self::read_xdr_to_end(v, &mut cursor)?;
59533        Ok(t)
59534    }
59535
59536    #[cfg(feature = "base64")]
59537    pub fn from_xdr_base64(v: TypeVariant, b64: impl AsRef<[u8]>, limits: Limits) -> Result<Self> {
59538        let mut b64_reader = Cursor::new(b64);
59539        let mut dec = Limited::new(
59540            base64::read::DecoderReader::new(&mut b64_reader, base64::STANDARD),
59541            limits,
59542        );
59543        let t = Self::read_xdr_to_end(v, &mut dec)?;
59544        Ok(t)
59545    }
59546
59547    #[cfg(all(feature = "std", feature = "serde_json"))]
59548    #[deprecated(note = "use from_json")]
59549    pub fn read_json(v: TypeVariant, r: impl Read) -> Result<Self> {
59550        Self::from_json(v, r)
59551    }
59552
59553    #[cfg(all(feature = "std", feature = "serde_json"))]
59554    #[allow(clippy::too_many_lines)]
59555    pub fn from_json(v: TypeVariant, r: impl Read) -> Result<Self> {
59556        match v {
59557            TypeVariant::Value => Ok(Self::Value(Box::new(serde_json::from_reader(r)?))),
59558            TypeVariant::ScpBallot => Ok(Self::ScpBallot(Box::new(serde_json::from_reader(r)?))),
59559            TypeVariant::ScpStatementType => Ok(Self::ScpStatementType(Box::new(
59560                serde_json::from_reader(r)?,
59561            ))),
59562            TypeVariant::ScpNomination => {
59563                Ok(Self::ScpNomination(Box::new(serde_json::from_reader(r)?)))
59564            }
59565            TypeVariant::ScpStatement => {
59566                Ok(Self::ScpStatement(Box::new(serde_json::from_reader(r)?)))
59567            }
59568            TypeVariant::ScpStatementPledges => Ok(Self::ScpStatementPledges(Box::new(
59569                serde_json::from_reader(r)?,
59570            ))),
59571            TypeVariant::ScpStatementPrepare => Ok(Self::ScpStatementPrepare(Box::new(
59572                serde_json::from_reader(r)?,
59573            ))),
59574            TypeVariant::ScpStatementConfirm => Ok(Self::ScpStatementConfirm(Box::new(
59575                serde_json::from_reader(r)?,
59576            ))),
59577            TypeVariant::ScpStatementExternalize => Ok(Self::ScpStatementExternalize(Box::new(
59578                serde_json::from_reader(r)?,
59579            ))),
59580            TypeVariant::ScpEnvelope => {
59581                Ok(Self::ScpEnvelope(Box::new(serde_json::from_reader(r)?)))
59582            }
59583            TypeVariant::ScpQuorumSet => {
59584                Ok(Self::ScpQuorumSet(Box::new(serde_json::from_reader(r)?)))
59585            }
59586            TypeVariant::ConfigSettingContractExecutionLanesV0 => Ok(
59587                Self::ConfigSettingContractExecutionLanesV0(Box::new(serde_json::from_reader(r)?)),
59588            ),
59589            TypeVariant::ConfigSettingContractComputeV0 => Ok(
59590                Self::ConfigSettingContractComputeV0(Box::new(serde_json::from_reader(r)?)),
59591            ),
59592            TypeVariant::ConfigSettingContractParallelComputeV0 => Ok(
59593                Self::ConfigSettingContractParallelComputeV0(Box::new(serde_json::from_reader(r)?)),
59594            ),
59595            TypeVariant::ConfigSettingContractLedgerCostV0 => Ok(
59596                Self::ConfigSettingContractLedgerCostV0(Box::new(serde_json::from_reader(r)?)),
59597            ),
59598            TypeVariant::ConfigSettingContractHistoricalDataV0 => Ok(
59599                Self::ConfigSettingContractHistoricalDataV0(Box::new(serde_json::from_reader(r)?)),
59600            ),
59601            TypeVariant::ConfigSettingContractEventsV0 => Ok(Self::ConfigSettingContractEventsV0(
59602                Box::new(serde_json::from_reader(r)?),
59603            )),
59604            TypeVariant::ConfigSettingContractBandwidthV0 => Ok(
59605                Self::ConfigSettingContractBandwidthV0(Box::new(serde_json::from_reader(r)?)),
59606            ),
59607            TypeVariant::ContractCostType => Ok(Self::ContractCostType(Box::new(
59608                serde_json::from_reader(r)?,
59609            ))),
59610            TypeVariant::ContractCostParamEntry => Ok(Self::ContractCostParamEntry(Box::new(
59611                serde_json::from_reader(r)?,
59612            ))),
59613            TypeVariant::StateArchivalSettings => Ok(Self::StateArchivalSettings(Box::new(
59614                serde_json::from_reader(r)?,
59615            ))),
59616            TypeVariant::EvictionIterator => Ok(Self::EvictionIterator(Box::new(
59617                serde_json::from_reader(r)?,
59618            ))),
59619            TypeVariant::ContractCostParams => Ok(Self::ContractCostParams(Box::new(
59620                serde_json::from_reader(r)?,
59621            ))),
59622            TypeVariant::ConfigSettingId => {
59623                Ok(Self::ConfigSettingId(Box::new(serde_json::from_reader(r)?)))
59624            }
59625            TypeVariant::ConfigSettingEntry => Ok(Self::ConfigSettingEntry(Box::new(
59626                serde_json::from_reader(r)?,
59627            ))),
59628            TypeVariant::ScEnvMetaKind => {
59629                Ok(Self::ScEnvMetaKind(Box::new(serde_json::from_reader(r)?)))
59630            }
59631            TypeVariant::ScEnvMetaEntry => {
59632                Ok(Self::ScEnvMetaEntry(Box::new(serde_json::from_reader(r)?)))
59633            }
59634            TypeVariant::ScEnvMetaEntryInterfaceVersion => Ok(
59635                Self::ScEnvMetaEntryInterfaceVersion(Box::new(serde_json::from_reader(r)?)),
59636            ),
59637            TypeVariant::ScMetaV0 => Ok(Self::ScMetaV0(Box::new(serde_json::from_reader(r)?))),
59638            TypeVariant::ScMetaKind => Ok(Self::ScMetaKind(Box::new(serde_json::from_reader(r)?))),
59639            TypeVariant::ScMetaEntry => {
59640                Ok(Self::ScMetaEntry(Box::new(serde_json::from_reader(r)?)))
59641            }
59642            TypeVariant::ScSpecType => Ok(Self::ScSpecType(Box::new(serde_json::from_reader(r)?))),
59643            TypeVariant::ScSpecTypeOption => Ok(Self::ScSpecTypeOption(Box::new(
59644                serde_json::from_reader(r)?,
59645            ))),
59646            TypeVariant::ScSpecTypeResult => Ok(Self::ScSpecTypeResult(Box::new(
59647                serde_json::from_reader(r)?,
59648            ))),
59649            TypeVariant::ScSpecTypeVec => {
59650                Ok(Self::ScSpecTypeVec(Box::new(serde_json::from_reader(r)?)))
59651            }
59652            TypeVariant::ScSpecTypeMap => {
59653                Ok(Self::ScSpecTypeMap(Box::new(serde_json::from_reader(r)?)))
59654            }
59655            TypeVariant::ScSpecTypeTuple => {
59656                Ok(Self::ScSpecTypeTuple(Box::new(serde_json::from_reader(r)?)))
59657            }
59658            TypeVariant::ScSpecTypeBytesN => Ok(Self::ScSpecTypeBytesN(Box::new(
59659                serde_json::from_reader(r)?,
59660            ))),
59661            TypeVariant::ScSpecTypeUdt => {
59662                Ok(Self::ScSpecTypeUdt(Box::new(serde_json::from_reader(r)?)))
59663            }
59664            TypeVariant::ScSpecTypeDef => {
59665                Ok(Self::ScSpecTypeDef(Box::new(serde_json::from_reader(r)?)))
59666            }
59667            TypeVariant::ScSpecUdtStructFieldV0 => Ok(Self::ScSpecUdtStructFieldV0(Box::new(
59668                serde_json::from_reader(r)?,
59669            ))),
59670            TypeVariant::ScSpecUdtStructV0 => Ok(Self::ScSpecUdtStructV0(Box::new(
59671                serde_json::from_reader(r)?,
59672            ))),
59673            TypeVariant::ScSpecUdtUnionCaseVoidV0 => Ok(Self::ScSpecUdtUnionCaseVoidV0(Box::new(
59674                serde_json::from_reader(r)?,
59675            ))),
59676            TypeVariant::ScSpecUdtUnionCaseTupleV0 => Ok(Self::ScSpecUdtUnionCaseTupleV0(
59677                Box::new(serde_json::from_reader(r)?),
59678            )),
59679            TypeVariant::ScSpecUdtUnionCaseV0Kind => Ok(Self::ScSpecUdtUnionCaseV0Kind(Box::new(
59680                serde_json::from_reader(r)?,
59681            ))),
59682            TypeVariant::ScSpecUdtUnionCaseV0 => Ok(Self::ScSpecUdtUnionCaseV0(Box::new(
59683                serde_json::from_reader(r)?,
59684            ))),
59685            TypeVariant::ScSpecUdtUnionV0 => Ok(Self::ScSpecUdtUnionV0(Box::new(
59686                serde_json::from_reader(r)?,
59687            ))),
59688            TypeVariant::ScSpecUdtEnumCaseV0 => Ok(Self::ScSpecUdtEnumCaseV0(Box::new(
59689                serde_json::from_reader(r)?,
59690            ))),
59691            TypeVariant::ScSpecUdtEnumV0 => {
59692                Ok(Self::ScSpecUdtEnumV0(Box::new(serde_json::from_reader(r)?)))
59693            }
59694            TypeVariant::ScSpecUdtErrorEnumCaseV0 => Ok(Self::ScSpecUdtErrorEnumCaseV0(Box::new(
59695                serde_json::from_reader(r)?,
59696            ))),
59697            TypeVariant::ScSpecUdtErrorEnumV0 => Ok(Self::ScSpecUdtErrorEnumV0(Box::new(
59698                serde_json::from_reader(r)?,
59699            ))),
59700            TypeVariant::ScSpecFunctionInputV0 => Ok(Self::ScSpecFunctionInputV0(Box::new(
59701                serde_json::from_reader(r)?,
59702            ))),
59703            TypeVariant::ScSpecFunctionV0 => Ok(Self::ScSpecFunctionV0(Box::new(
59704                serde_json::from_reader(r)?,
59705            ))),
59706            TypeVariant::ScSpecEntryKind => {
59707                Ok(Self::ScSpecEntryKind(Box::new(serde_json::from_reader(r)?)))
59708            }
59709            TypeVariant::ScSpecEntry => {
59710                Ok(Self::ScSpecEntry(Box::new(serde_json::from_reader(r)?)))
59711            }
59712            TypeVariant::ScValType => Ok(Self::ScValType(Box::new(serde_json::from_reader(r)?))),
59713            TypeVariant::ScErrorType => {
59714                Ok(Self::ScErrorType(Box::new(serde_json::from_reader(r)?)))
59715            }
59716            TypeVariant::ScErrorCode => {
59717                Ok(Self::ScErrorCode(Box::new(serde_json::from_reader(r)?)))
59718            }
59719            TypeVariant::ScError => Ok(Self::ScError(Box::new(serde_json::from_reader(r)?))),
59720            TypeVariant::UInt128Parts => {
59721                Ok(Self::UInt128Parts(Box::new(serde_json::from_reader(r)?)))
59722            }
59723            TypeVariant::Int128Parts => {
59724                Ok(Self::Int128Parts(Box::new(serde_json::from_reader(r)?)))
59725            }
59726            TypeVariant::UInt256Parts => {
59727                Ok(Self::UInt256Parts(Box::new(serde_json::from_reader(r)?)))
59728            }
59729            TypeVariant::Int256Parts => {
59730                Ok(Self::Int256Parts(Box::new(serde_json::from_reader(r)?)))
59731            }
59732            TypeVariant::ContractExecutableType => Ok(Self::ContractExecutableType(Box::new(
59733                serde_json::from_reader(r)?,
59734            ))),
59735            TypeVariant::ContractExecutable => Ok(Self::ContractExecutable(Box::new(
59736                serde_json::from_reader(r)?,
59737            ))),
59738            TypeVariant::ScAddressType => {
59739                Ok(Self::ScAddressType(Box::new(serde_json::from_reader(r)?)))
59740            }
59741            TypeVariant::ScAddress => Ok(Self::ScAddress(Box::new(serde_json::from_reader(r)?))),
59742            TypeVariant::ScVec => Ok(Self::ScVec(Box::new(serde_json::from_reader(r)?))),
59743            TypeVariant::ScMap => Ok(Self::ScMap(Box::new(serde_json::from_reader(r)?))),
59744            TypeVariant::ScBytes => Ok(Self::ScBytes(Box::new(serde_json::from_reader(r)?))),
59745            TypeVariant::ScString => Ok(Self::ScString(Box::new(serde_json::from_reader(r)?))),
59746            TypeVariant::ScSymbol => Ok(Self::ScSymbol(Box::new(serde_json::from_reader(r)?))),
59747            TypeVariant::ScNonceKey => Ok(Self::ScNonceKey(Box::new(serde_json::from_reader(r)?))),
59748            TypeVariant::ScContractInstance => Ok(Self::ScContractInstance(Box::new(
59749                serde_json::from_reader(r)?,
59750            ))),
59751            TypeVariant::ScVal => Ok(Self::ScVal(Box::new(serde_json::from_reader(r)?))),
59752            TypeVariant::ScMapEntry => Ok(Self::ScMapEntry(Box::new(serde_json::from_reader(r)?))),
59753            TypeVariant::StoredTransactionSet => Ok(Self::StoredTransactionSet(Box::new(
59754                serde_json::from_reader(r)?,
59755            ))),
59756            TypeVariant::StoredDebugTransactionSet => Ok(Self::StoredDebugTransactionSet(
59757                Box::new(serde_json::from_reader(r)?),
59758            )),
59759            TypeVariant::PersistedScpStateV0 => Ok(Self::PersistedScpStateV0(Box::new(
59760                serde_json::from_reader(r)?,
59761            ))),
59762            TypeVariant::PersistedScpStateV1 => Ok(Self::PersistedScpStateV1(Box::new(
59763                serde_json::from_reader(r)?,
59764            ))),
59765            TypeVariant::PersistedScpState => Ok(Self::PersistedScpState(Box::new(
59766                serde_json::from_reader(r)?,
59767            ))),
59768            TypeVariant::Thresholds => Ok(Self::Thresholds(Box::new(serde_json::from_reader(r)?))),
59769            TypeVariant::String32 => Ok(Self::String32(Box::new(serde_json::from_reader(r)?))),
59770            TypeVariant::String64 => Ok(Self::String64(Box::new(serde_json::from_reader(r)?))),
59771            TypeVariant::SequenceNumber => {
59772                Ok(Self::SequenceNumber(Box::new(serde_json::from_reader(r)?)))
59773            }
59774            TypeVariant::DataValue => Ok(Self::DataValue(Box::new(serde_json::from_reader(r)?))),
59775            TypeVariant::PoolId => Ok(Self::PoolId(Box::new(serde_json::from_reader(r)?))),
59776            TypeVariant::AssetCode4 => Ok(Self::AssetCode4(Box::new(serde_json::from_reader(r)?))),
59777            TypeVariant::AssetCode12 => {
59778                Ok(Self::AssetCode12(Box::new(serde_json::from_reader(r)?)))
59779            }
59780            TypeVariant::AssetType => Ok(Self::AssetType(Box::new(serde_json::from_reader(r)?))),
59781            TypeVariant::AssetCode => Ok(Self::AssetCode(Box::new(serde_json::from_reader(r)?))),
59782            TypeVariant::AlphaNum4 => Ok(Self::AlphaNum4(Box::new(serde_json::from_reader(r)?))),
59783            TypeVariant::AlphaNum12 => Ok(Self::AlphaNum12(Box::new(serde_json::from_reader(r)?))),
59784            TypeVariant::Asset => Ok(Self::Asset(Box::new(serde_json::from_reader(r)?))),
59785            TypeVariant::Price => Ok(Self::Price(Box::new(serde_json::from_reader(r)?))),
59786            TypeVariant::Liabilities => {
59787                Ok(Self::Liabilities(Box::new(serde_json::from_reader(r)?)))
59788            }
59789            TypeVariant::ThresholdIndexes => Ok(Self::ThresholdIndexes(Box::new(
59790                serde_json::from_reader(r)?,
59791            ))),
59792            TypeVariant::LedgerEntryType => {
59793                Ok(Self::LedgerEntryType(Box::new(serde_json::from_reader(r)?)))
59794            }
59795            TypeVariant::Signer => Ok(Self::Signer(Box::new(serde_json::from_reader(r)?))),
59796            TypeVariant::AccountFlags => {
59797                Ok(Self::AccountFlags(Box::new(serde_json::from_reader(r)?)))
59798            }
59799            TypeVariant::SponsorshipDescriptor => Ok(Self::SponsorshipDescriptor(Box::new(
59800                serde_json::from_reader(r)?,
59801            ))),
59802            TypeVariant::AccountEntryExtensionV3 => Ok(Self::AccountEntryExtensionV3(Box::new(
59803                serde_json::from_reader(r)?,
59804            ))),
59805            TypeVariant::AccountEntryExtensionV2 => Ok(Self::AccountEntryExtensionV2(Box::new(
59806                serde_json::from_reader(r)?,
59807            ))),
59808            TypeVariant::AccountEntryExtensionV2Ext => Ok(Self::AccountEntryExtensionV2Ext(
59809                Box::new(serde_json::from_reader(r)?),
59810            )),
59811            TypeVariant::AccountEntryExtensionV1 => Ok(Self::AccountEntryExtensionV1(Box::new(
59812                serde_json::from_reader(r)?,
59813            ))),
59814            TypeVariant::AccountEntryExtensionV1Ext => Ok(Self::AccountEntryExtensionV1Ext(
59815                Box::new(serde_json::from_reader(r)?),
59816            )),
59817            TypeVariant::AccountEntry => {
59818                Ok(Self::AccountEntry(Box::new(serde_json::from_reader(r)?)))
59819            }
59820            TypeVariant::AccountEntryExt => {
59821                Ok(Self::AccountEntryExt(Box::new(serde_json::from_reader(r)?)))
59822            }
59823            TypeVariant::TrustLineFlags => {
59824                Ok(Self::TrustLineFlags(Box::new(serde_json::from_reader(r)?)))
59825            }
59826            TypeVariant::LiquidityPoolType => Ok(Self::LiquidityPoolType(Box::new(
59827                serde_json::from_reader(r)?,
59828            ))),
59829            TypeVariant::TrustLineAsset => {
59830                Ok(Self::TrustLineAsset(Box::new(serde_json::from_reader(r)?)))
59831            }
59832            TypeVariant::TrustLineEntryExtensionV2 => Ok(Self::TrustLineEntryExtensionV2(
59833                Box::new(serde_json::from_reader(r)?),
59834            )),
59835            TypeVariant::TrustLineEntryExtensionV2Ext => Ok(Self::TrustLineEntryExtensionV2Ext(
59836                Box::new(serde_json::from_reader(r)?),
59837            )),
59838            TypeVariant::TrustLineEntry => {
59839                Ok(Self::TrustLineEntry(Box::new(serde_json::from_reader(r)?)))
59840            }
59841            TypeVariant::TrustLineEntryExt => Ok(Self::TrustLineEntryExt(Box::new(
59842                serde_json::from_reader(r)?,
59843            ))),
59844            TypeVariant::TrustLineEntryV1 => Ok(Self::TrustLineEntryV1(Box::new(
59845                serde_json::from_reader(r)?,
59846            ))),
59847            TypeVariant::TrustLineEntryV1Ext => Ok(Self::TrustLineEntryV1Ext(Box::new(
59848                serde_json::from_reader(r)?,
59849            ))),
59850            TypeVariant::OfferEntryFlags => {
59851                Ok(Self::OfferEntryFlags(Box::new(serde_json::from_reader(r)?)))
59852            }
59853            TypeVariant::OfferEntry => Ok(Self::OfferEntry(Box::new(serde_json::from_reader(r)?))),
59854            TypeVariant::OfferEntryExt => {
59855                Ok(Self::OfferEntryExt(Box::new(serde_json::from_reader(r)?)))
59856            }
59857            TypeVariant::DataEntry => Ok(Self::DataEntry(Box::new(serde_json::from_reader(r)?))),
59858            TypeVariant::DataEntryExt => {
59859                Ok(Self::DataEntryExt(Box::new(serde_json::from_reader(r)?)))
59860            }
59861            TypeVariant::ClaimPredicateType => Ok(Self::ClaimPredicateType(Box::new(
59862                serde_json::from_reader(r)?,
59863            ))),
59864            TypeVariant::ClaimPredicate => {
59865                Ok(Self::ClaimPredicate(Box::new(serde_json::from_reader(r)?)))
59866            }
59867            TypeVariant::ClaimantType => {
59868                Ok(Self::ClaimantType(Box::new(serde_json::from_reader(r)?)))
59869            }
59870            TypeVariant::Claimant => Ok(Self::Claimant(Box::new(serde_json::from_reader(r)?))),
59871            TypeVariant::ClaimantV0 => Ok(Self::ClaimantV0(Box::new(serde_json::from_reader(r)?))),
59872            TypeVariant::ClaimableBalanceIdType => Ok(Self::ClaimableBalanceIdType(Box::new(
59873                serde_json::from_reader(r)?,
59874            ))),
59875            TypeVariant::ClaimableBalanceId => Ok(Self::ClaimableBalanceId(Box::new(
59876                serde_json::from_reader(r)?,
59877            ))),
59878            TypeVariant::ClaimableBalanceFlags => Ok(Self::ClaimableBalanceFlags(Box::new(
59879                serde_json::from_reader(r)?,
59880            ))),
59881            TypeVariant::ClaimableBalanceEntryExtensionV1 => Ok(
59882                Self::ClaimableBalanceEntryExtensionV1(Box::new(serde_json::from_reader(r)?)),
59883            ),
59884            TypeVariant::ClaimableBalanceEntryExtensionV1Ext => Ok(
59885                Self::ClaimableBalanceEntryExtensionV1Ext(Box::new(serde_json::from_reader(r)?)),
59886            ),
59887            TypeVariant::ClaimableBalanceEntry => Ok(Self::ClaimableBalanceEntry(Box::new(
59888                serde_json::from_reader(r)?,
59889            ))),
59890            TypeVariant::ClaimableBalanceEntryExt => Ok(Self::ClaimableBalanceEntryExt(Box::new(
59891                serde_json::from_reader(r)?,
59892            ))),
59893            TypeVariant::LiquidityPoolConstantProductParameters => Ok(
59894                Self::LiquidityPoolConstantProductParameters(Box::new(serde_json::from_reader(r)?)),
59895            ),
59896            TypeVariant::LiquidityPoolEntry => Ok(Self::LiquidityPoolEntry(Box::new(
59897                serde_json::from_reader(r)?,
59898            ))),
59899            TypeVariant::LiquidityPoolEntryBody => Ok(Self::LiquidityPoolEntryBody(Box::new(
59900                serde_json::from_reader(r)?,
59901            ))),
59902            TypeVariant::LiquidityPoolEntryConstantProduct => Ok(
59903                Self::LiquidityPoolEntryConstantProduct(Box::new(serde_json::from_reader(r)?)),
59904            ),
59905            TypeVariant::ContractDataDurability => Ok(Self::ContractDataDurability(Box::new(
59906                serde_json::from_reader(r)?,
59907            ))),
59908            TypeVariant::ContractDataEntry => Ok(Self::ContractDataEntry(Box::new(
59909                serde_json::from_reader(r)?,
59910            ))),
59911            TypeVariant::ContractCodeCostInputs => Ok(Self::ContractCodeCostInputs(Box::new(
59912                serde_json::from_reader(r)?,
59913            ))),
59914            TypeVariant::ContractCodeEntry => Ok(Self::ContractCodeEntry(Box::new(
59915                serde_json::from_reader(r)?,
59916            ))),
59917            TypeVariant::ContractCodeEntryExt => Ok(Self::ContractCodeEntryExt(Box::new(
59918                serde_json::from_reader(r)?,
59919            ))),
59920            TypeVariant::ContractCodeEntryV1 => Ok(Self::ContractCodeEntryV1(Box::new(
59921                serde_json::from_reader(r)?,
59922            ))),
59923            TypeVariant::TtlEntry => Ok(Self::TtlEntry(Box::new(serde_json::from_reader(r)?))),
59924            TypeVariant::LedgerEntryExtensionV1 => Ok(Self::LedgerEntryExtensionV1(Box::new(
59925                serde_json::from_reader(r)?,
59926            ))),
59927            TypeVariant::LedgerEntryExtensionV1Ext => Ok(Self::LedgerEntryExtensionV1Ext(
59928                Box::new(serde_json::from_reader(r)?),
59929            )),
59930            TypeVariant::LedgerEntry => {
59931                Ok(Self::LedgerEntry(Box::new(serde_json::from_reader(r)?)))
59932            }
59933            TypeVariant::LedgerEntryData => {
59934                Ok(Self::LedgerEntryData(Box::new(serde_json::from_reader(r)?)))
59935            }
59936            TypeVariant::LedgerEntryExt => {
59937                Ok(Self::LedgerEntryExt(Box::new(serde_json::from_reader(r)?)))
59938            }
59939            TypeVariant::LedgerKey => Ok(Self::LedgerKey(Box::new(serde_json::from_reader(r)?))),
59940            TypeVariant::LedgerKeyAccount => Ok(Self::LedgerKeyAccount(Box::new(
59941                serde_json::from_reader(r)?,
59942            ))),
59943            TypeVariant::LedgerKeyTrustLine => Ok(Self::LedgerKeyTrustLine(Box::new(
59944                serde_json::from_reader(r)?,
59945            ))),
59946            TypeVariant::LedgerKeyOffer => {
59947                Ok(Self::LedgerKeyOffer(Box::new(serde_json::from_reader(r)?)))
59948            }
59949            TypeVariant::LedgerKeyData => {
59950                Ok(Self::LedgerKeyData(Box::new(serde_json::from_reader(r)?)))
59951            }
59952            TypeVariant::LedgerKeyClaimableBalance => Ok(Self::LedgerKeyClaimableBalance(
59953                Box::new(serde_json::from_reader(r)?),
59954            )),
59955            TypeVariant::LedgerKeyLiquidityPool => Ok(Self::LedgerKeyLiquidityPool(Box::new(
59956                serde_json::from_reader(r)?,
59957            ))),
59958            TypeVariant::LedgerKeyContractData => Ok(Self::LedgerKeyContractData(Box::new(
59959                serde_json::from_reader(r)?,
59960            ))),
59961            TypeVariant::LedgerKeyContractCode => Ok(Self::LedgerKeyContractCode(Box::new(
59962                serde_json::from_reader(r)?,
59963            ))),
59964            TypeVariant::LedgerKeyConfigSetting => Ok(Self::LedgerKeyConfigSetting(Box::new(
59965                serde_json::from_reader(r)?,
59966            ))),
59967            TypeVariant::LedgerKeyTtl => {
59968                Ok(Self::LedgerKeyTtl(Box::new(serde_json::from_reader(r)?)))
59969            }
59970            TypeVariant::EnvelopeType => {
59971                Ok(Self::EnvelopeType(Box::new(serde_json::from_reader(r)?)))
59972            }
59973            TypeVariant::BucketListType => {
59974                Ok(Self::BucketListType(Box::new(serde_json::from_reader(r)?)))
59975            }
59976            TypeVariant::BucketEntryType => {
59977                Ok(Self::BucketEntryType(Box::new(serde_json::from_reader(r)?)))
59978            }
59979            TypeVariant::HotArchiveBucketEntryType => Ok(Self::HotArchiveBucketEntryType(
59980                Box::new(serde_json::from_reader(r)?),
59981            )),
59982            TypeVariant::ColdArchiveBucketEntryType => Ok(Self::ColdArchiveBucketEntryType(
59983                Box::new(serde_json::from_reader(r)?),
59984            )),
59985            TypeVariant::BucketMetadata => {
59986                Ok(Self::BucketMetadata(Box::new(serde_json::from_reader(r)?)))
59987            }
59988            TypeVariant::BucketMetadataExt => Ok(Self::BucketMetadataExt(Box::new(
59989                serde_json::from_reader(r)?,
59990            ))),
59991            TypeVariant::BucketEntry => {
59992                Ok(Self::BucketEntry(Box::new(serde_json::from_reader(r)?)))
59993            }
59994            TypeVariant::HotArchiveBucketEntry => Ok(Self::HotArchiveBucketEntry(Box::new(
59995                serde_json::from_reader(r)?,
59996            ))),
59997            TypeVariant::ColdArchiveArchivedLeaf => Ok(Self::ColdArchiveArchivedLeaf(Box::new(
59998                serde_json::from_reader(r)?,
59999            ))),
60000            TypeVariant::ColdArchiveDeletedLeaf => Ok(Self::ColdArchiveDeletedLeaf(Box::new(
60001                serde_json::from_reader(r)?,
60002            ))),
60003            TypeVariant::ColdArchiveBoundaryLeaf => Ok(Self::ColdArchiveBoundaryLeaf(Box::new(
60004                serde_json::from_reader(r)?,
60005            ))),
60006            TypeVariant::ColdArchiveHashEntry => Ok(Self::ColdArchiveHashEntry(Box::new(
60007                serde_json::from_reader(r)?,
60008            ))),
60009            TypeVariant::ColdArchiveBucketEntry => Ok(Self::ColdArchiveBucketEntry(Box::new(
60010                serde_json::from_reader(r)?,
60011            ))),
60012            TypeVariant::UpgradeType => {
60013                Ok(Self::UpgradeType(Box::new(serde_json::from_reader(r)?)))
60014            }
60015            TypeVariant::StellarValueType => Ok(Self::StellarValueType(Box::new(
60016                serde_json::from_reader(r)?,
60017            ))),
60018            TypeVariant::LedgerCloseValueSignature => Ok(Self::LedgerCloseValueSignature(
60019                Box::new(serde_json::from_reader(r)?),
60020            )),
60021            TypeVariant::StellarValue => {
60022                Ok(Self::StellarValue(Box::new(serde_json::from_reader(r)?)))
60023            }
60024            TypeVariant::StellarValueExt => {
60025                Ok(Self::StellarValueExt(Box::new(serde_json::from_reader(r)?)))
60026            }
60027            TypeVariant::LedgerHeaderFlags => Ok(Self::LedgerHeaderFlags(Box::new(
60028                serde_json::from_reader(r)?,
60029            ))),
60030            TypeVariant::LedgerHeaderExtensionV1 => Ok(Self::LedgerHeaderExtensionV1(Box::new(
60031                serde_json::from_reader(r)?,
60032            ))),
60033            TypeVariant::LedgerHeaderExtensionV1Ext => Ok(Self::LedgerHeaderExtensionV1Ext(
60034                Box::new(serde_json::from_reader(r)?),
60035            )),
60036            TypeVariant::LedgerHeader => {
60037                Ok(Self::LedgerHeader(Box::new(serde_json::from_reader(r)?)))
60038            }
60039            TypeVariant::LedgerHeaderExt => {
60040                Ok(Self::LedgerHeaderExt(Box::new(serde_json::from_reader(r)?)))
60041            }
60042            TypeVariant::LedgerUpgradeType => Ok(Self::LedgerUpgradeType(Box::new(
60043                serde_json::from_reader(r)?,
60044            ))),
60045            TypeVariant::ConfigUpgradeSetKey => Ok(Self::ConfigUpgradeSetKey(Box::new(
60046                serde_json::from_reader(r)?,
60047            ))),
60048            TypeVariant::LedgerUpgrade => {
60049                Ok(Self::LedgerUpgrade(Box::new(serde_json::from_reader(r)?)))
60050            }
60051            TypeVariant::ConfigUpgradeSet => Ok(Self::ConfigUpgradeSet(Box::new(
60052                serde_json::from_reader(r)?,
60053            ))),
60054            TypeVariant::TxSetComponentType => Ok(Self::TxSetComponentType(Box::new(
60055                serde_json::from_reader(r)?,
60056            ))),
60057            TypeVariant::TxExecutionThread => Ok(Self::TxExecutionThread(Box::new(
60058                serde_json::from_reader(r)?,
60059            ))),
60060            TypeVariant::ParallelTxExecutionStage => Ok(Self::ParallelTxExecutionStage(Box::new(
60061                serde_json::from_reader(r)?,
60062            ))),
60063            TypeVariant::ParallelTxsComponent => Ok(Self::ParallelTxsComponent(Box::new(
60064                serde_json::from_reader(r)?,
60065            ))),
60066            TypeVariant::TxSetComponent => {
60067                Ok(Self::TxSetComponent(Box::new(serde_json::from_reader(r)?)))
60068            }
60069            TypeVariant::TxSetComponentTxsMaybeDiscountedFee => Ok(
60070                Self::TxSetComponentTxsMaybeDiscountedFee(Box::new(serde_json::from_reader(r)?)),
60071            ),
60072            TypeVariant::TransactionPhase => Ok(Self::TransactionPhase(Box::new(
60073                serde_json::from_reader(r)?,
60074            ))),
60075            TypeVariant::TransactionSet => {
60076                Ok(Self::TransactionSet(Box::new(serde_json::from_reader(r)?)))
60077            }
60078            TypeVariant::TransactionSetV1 => Ok(Self::TransactionSetV1(Box::new(
60079                serde_json::from_reader(r)?,
60080            ))),
60081            TypeVariant::GeneralizedTransactionSet => Ok(Self::GeneralizedTransactionSet(
60082                Box::new(serde_json::from_reader(r)?),
60083            )),
60084            TypeVariant::TransactionResultPair => Ok(Self::TransactionResultPair(Box::new(
60085                serde_json::from_reader(r)?,
60086            ))),
60087            TypeVariant::TransactionResultSet => Ok(Self::TransactionResultSet(Box::new(
60088                serde_json::from_reader(r)?,
60089            ))),
60090            TypeVariant::TransactionHistoryEntry => Ok(Self::TransactionHistoryEntry(Box::new(
60091                serde_json::from_reader(r)?,
60092            ))),
60093            TypeVariant::TransactionHistoryEntryExt => Ok(Self::TransactionHistoryEntryExt(
60094                Box::new(serde_json::from_reader(r)?),
60095            )),
60096            TypeVariant::TransactionHistoryResultEntry => Ok(Self::TransactionHistoryResultEntry(
60097                Box::new(serde_json::from_reader(r)?),
60098            )),
60099            TypeVariant::TransactionHistoryResultEntryExt => Ok(
60100                Self::TransactionHistoryResultEntryExt(Box::new(serde_json::from_reader(r)?)),
60101            ),
60102            TypeVariant::LedgerHeaderHistoryEntry => Ok(Self::LedgerHeaderHistoryEntry(Box::new(
60103                serde_json::from_reader(r)?,
60104            ))),
60105            TypeVariant::LedgerHeaderHistoryEntryExt => Ok(Self::LedgerHeaderHistoryEntryExt(
60106                Box::new(serde_json::from_reader(r)?),
60107            )),
60108            TypeVariant::LedgerScpMessages => Ok(Self::LedgerScpMessages(Box::new(
60109                serde_json::from_reader(r)?,
60110            ))),
60111            TypeVariant::ScpHistoryEntryV0 => Ok(Self::ScpHistoryEntryV0(Box::new(
60112                serde_json::from_reader(r)?,
60113            ))),
60114            TypeVariant::ScpHistoryEntry => {
60115                Ok(Self::ScpHistoryEntry(Box::new(serde_json::from_reader(r)?)))
60116            }
60117            TypeVariant::LedgerEntryChangeType => Ok(Self::LedgerEntryChangeType(Box::new(
60118                serde_json::from_reader(r)?,
60119            ))),
60120            TypeVariant::LedgerEntryChange => Ok(Self::LedgerEntryChange(Box::new(
60121                serde_json::from_reader(r)?,
60122            ))),
60123            TypeVariant::LedgerEntryChanges => Ok(Self::LedgerEntryChanges(Box::new(
60124                serde_json::from_reader(r)?,
60125            ))),
60126            TypeVariant::OperationMeta => {
60127                Ok(Self::OperationMeta(Box::new(serde_json::from_reader(r)?)))
60128            }
60129            TypeVariant::TransactionMetaV1 => Ok(Self::TransactionMetaV1(Box::new(
60130                serde_json::from_reader(r)?,
60131            ))),
60132            TypeVariant::TransactionMetaV2 => Ok(Self::TransactionMetaV2(Box::new(
60133                serde_json::from_reader(r)?,
60134            ))),
60135            TypeVariant::ContractEventType => Ok(Self::ContractEventType(Box::new(
60136                serde_json::from_reader(r)?,
60137            ))),
60138            TypeVariant::ContractEvent => {
60139                Ok(Self::ContractEvent(Box::new(serde_json::from_reader(r)?)))
60140            }
60141            TypeVariant::ContractEventBody => Ok(Self::ContractEventBody(Box::new(
60142                serde_json::from_reader(r)?,
60143            ))),
60144            TypeVariant::ContractEventV0 => {
60145                Ok(Self::ContractEventV0(Box::new(serde_json::from_reader(r)?)))
60146            }
60147            TypeVariant::DiagnosticEvent => {
60148                Ok(Self::DiagnosticEvent(Box::new(serde_json::from_reader(r)?)))
60149            }
60150            TypeVariant::SorobanTransactionMetaExtV1 => Ok(Self::SorobanTransactionMetaExtV1(
60151                Box::new(serde_json::from_reader(r)?),
60152            )),
60153            TypeVariant::SorobanTransactionMetaExt => Ok(Self::SorobanTransactionMetaExt(
60154                Box::new(serde_json::from_reader(r)?),
60155            )),
60156            TypeVariant::SorobanTransactionMeta => Ok(Self::SorobanTransactionMeta(Box::new(
60157                serde_json::from_reader(r)?,
60158            ))),
60159            TypeVariant::TransactionMetaV3 => Ok(Self::TransactionMetaV3(Box::new(
60160                serde_json::from_reader(r)?,
60161            ))),
60162            TypeVariant::InvokeHostFunctionSuccessPreImage => Ok(
60163                Self::InvokeHostFunctionSuccessPreImage(Box::new(serde_json::from_reader(r)?)),
60164            ),
60165            TypeVariant::TransactionMeta => {
60166                Ok(Self::TransactionMeta(Box::new(serde_json::from_reader(r)?)))
60167            }
60168            TypeVariant::TransactionResultMeta => Ok(Self::TransactionResultMeta(Box::new(
60169                serde_json::from_reader(r)?,
60170            ))),
60171            TypeVariant::UpgradeEntryMeta => Ok(Self::UpgradeEntryMeta(Box::new(
60172                serde_json::from_reader(r)?,
60173            ))),
60174            TypeVariant::LedgerCloseMetaV0 => Ok(Self::LedgerCloseMetaV0(Box::new(
60175                serde_json::from_reader(r)?,
60176            ))),
60177            TypeVariant::LedgerCloseMetaExtV1 => Ok(Self::LedgerCloseMetaExtV1(Box::new(
60178                serde_json::from_reader(r)?,
60179            ))),
60180            TypeVariant::LedgerCloseMetaExtV2 => Ok(Self::LedgerCloseMetaExtV2(Box::new(
60181                serde_json::from_reader(r)?,
60182            ))),
60183            TypeVariant::LedgerCloseMetaExt => Ok(Self::LedgerCloseMetaExt(Box::new(
60184                serde_json::from_reader(r)?,
60185            ))),
60186            TypeVariant::LedgerCloseMetaV1 => Ok(Self::LedgerCloseMetaV1(Box::new(
60187                serde_json::from_reader(r)?,
60188            ))),
60189            TypeVariant::LedgerCloseMeta => {
60190                Ok(Self::LedgerCloseMeta(Box::new(serde_json::from_reader(r)?)))
60191            }
60192            TypeVariant::ErrorCode => Ok(Self::ErrorCode(Box::new(serde_json::from_reader(r)?))),
60193            TypeVariant::SError => Ok(Self::SError(Box::new(serde_json::from_reader(r)?))),
60194            TypeVariant::SendMore => Ok(Self::SendMore(Box::new(serde_json::from_reader(r)?))),
60195            TypeVariant::SendMoreExtended => Ok(Self::SendMoreExtended(Box::new(
60196                serde_json::from_reader(r)?,
60197            ))),
60198            TypeVariant::AuthCert => Ok(Self::AuthCert(Box::new(serde_json::from_reader(r)?))),
60199            TypeVariant::Hello => Ok(Self::Hello(Box::new(serde_json::from_reader(r)?))),
60200            TypeVariant::Auth => Ok(Self::Auth(Box::new(serde_json::from_reader(r)?))),
60201            TypeVariant::IpAddrType => Ok(Self::IpAddrType(Box::new(serde_json::from_reader(r)?))),
60202            TypeVariant::PeerAddress => {
60203                Ok(Self::PeerAddress(Box::new(serde_json::from_reader(r)?)))
60204            }
60205            TypeVariant::PeerAddressIp => {
60206                Ok(Self::PeerAddressIp(Box::new(serde_json::from_reader(r)?)))
60207            }
60208            TypeVariant::MessageType => {
60209                Ok(Self::MessageType(Box::new(serde_json::from_reader(r)?)))
60210            }
60211            TypeVariant::DontHave => Ok(Self::DontHave(Box::new(serde_json::from_reader(r)?))),
60212            TypeVariant::SurveyMessageCommandType => Ok(Self::SurveyMessageCommandType(Box::new(
60213                serde_json::from_reader(r)?,
60214            ))),
60215            TypeVariant::SurveyMessageResponseType => Ok(Self::SurveyMessageResponseType(
60216                Box::new(serde_json::from_reader(r)?),
60217            )),
60218            TypeVariant::TimeSlicedSurveyStartCollectingMessage => Ok(
60219                Self::TimeSlicedSurveyStartCollectingMessage(Box::new(serde_json::from_reader(r)?)),
60220            ),
60221            TypeVariant::SignedTimeSlicedSurveyStartCollectingMessage => {
60222                Ok(Self::SignedTimeSlicedSurveyStartCollectingMessage(
60223                    Box::new(serde_json::from_reader(r)?),
60224                ))
60225            }
60226            TypeVariant::TimeSlicedSurveyStopCollectingMessage => Ok(
60227                Self::TimeSlicedSurveyStopCollectingMessage(Box::new(serde_json::from_reader(r)?)),
60228            ),
60229            TypeVariant::SignedTimeSlicedSurveyStopCollectingMessage => {
60230                Ok(Self::SignedTimeSlicedSurveyStopCollectingMessage(Box::new(
60231                    serde_json::from_reader(r)?,
60232                )))
60233            }
60234            TypeVariant::SurveyRequestMessage => Ok(Self::SurveyRequestMessage(Box::new(
60235                serde_json::from_reader(r)?,
60236            ))),
60237            TypeVariant::TimeSlicedSurveyRequestMessage => Ok(
60238                Self::TimeSlicedSurveyRequestMessage(Box::new(serde_json::from_reader(r)?)),
60239            ),
60240            TypeVariant::SignedSurveyRequestMessage => Ok(Self::SignedSurveyRequestMessage(
60241                Box::new(serde_json::from_reader(r)?),
60242            )),
60243            TypeVariant::SignedTimeSlicedSurveyRequestMessage => Ok(
60244                Self::SignedTimeSlicedSurveyRequestMessage(Box::new(serde_json::from_reader(r)?)),
60245            ),
60246            TypeVariant::EncryptedBody => {
60247                Ok(Self::EncryptedBody(Box::new(serde_json::from_reader(r)?)))
60248            }
60249            TypeVariant::SurveyResponseMessage => Ok(Self::SurveyResponseMessage(Box::new(
60250                serde_json::from_reader(r)?,
60251            ))),
60252            TypeVariant::TimeSlicedSurveyResponseMessage => Ok(
60253                Self::TimeSlicedSurveyResponseMessage(Box::new(serde_json::from_reader(r)?)),
60254            ),
60255            TypeVariant::SignedSurveyResponseMessage => Ok(Self::SignedSurveyResponseMessage(
60256                Box::new(serde_json::from_reader(r)?),
60257            )),
60258            TypeVariant::SignedTimeSlicedSurveyResponseMessage => Ok(
60259                Self::SignedTimeSlicedSurveyResponseMessage(Box::new(serde_json::from_reader(r)?)),
60260            ),
60261            TypeVariant::PeerStats => Ok(Self::PeerStats(Box::new(serde_json::from_reader(r)?))),
60262            TypeVariant::PeerStatList => {
60263                Ok(Self::PeerStatList(Box::new(serde_json::from_reader(r)?)))
60264            }
60265            TypeVariant::TimeSlicedNodeData => Ok(Self::TimeSlicedNodeData(Box::new(
60266                serde_json::from_reader(r)?,
60267            ))),
60268            TypeVariant::TimeSlicedPeerData => Ok(Self::TimeSlicedPeerData(Box::new(
60269                serde_json::from_reader(r)?,
60270            ))),
60271            TypeVariant::TimeSlicedPeerDataList => Ok(Self::TimeSlicedPeerDataList(Box::new(
60272                serde_json::from_reader(r)?,
60273            ))),
60274            TypeVariant::TopologyResponseBodyV0 => Ok(Self::TopologyResponseBodyV0(Box::new(
60275                serde_json::from_reader(r)?,
60276            ))),
60277            TypeVariant::TopologyResponseBodyV1 => Ok(Self::TopologyResponseBodyV1(Box::new(
60278                serde_json::from_reader(r)?,
60279            ))),
60280            TypeVariant::TopologyResponseBodyV2 => Ok(Self::TopologyResponseBodyV2(Box::new(
60281                serde_json::from_reader(r)?,
60282            ))),
60283            TypeVariant::SurveyResponseBody => Ok(Self::SurveyResponseBody(Box::new(
60284                serde_json::from_reader(r)?,
60285            ))),
60286            TypeVariant::TxAdvertVector => {
60287                Ok(Self::TxAdvertVector(Box::new(serde_json::from_reader(r)?)))
60288            }
60289            TypeVariant::FloodAdvert => {
60290                Ok(Self::FloodAdvert(Box::new(serde_json::from_reader(r)?)))
60291            }
60292            TypeVariant::TxDemandVector => {
60293                Ok(Self::TxDemandVector(Box::new(serde_json::from_reader(r)?)))
60294            }
60295            TypeVariant::FloodDemand => {
60296                Ok(Self::FloodDemand(Box::new(serde_json::from_reader(r)?)))
60297            }
60298            TypeVariant::StellarMessage => {
60299                Ok(Self::StellarMessage(Box::new(serde_json::from_reader(r)?)))
60300            }
60301            TypeVariant::AuthenticatedMessage => Ok(Self::AuthenticatedMessage(Box::new(
60302                serde_json::from_reader(r)?,
60303            ))),
60304            TypeVariant::AuthenticatedMessageV0 => Ok(Self::AuthenticatedMessageV0(Box::new(
60305                serde_json::from_reader(r)?,
60306            ))),
60307            TypeVariant::LiquidityPoolParameters => Ok(Self::LiquidityPoolParameters(Box::new(
60308                serde_json::from_reader(r)?,
60309            ))),
60310            TypeVariant::MuxedAccount => {
60311                Ok(Self::MuxedAccount(Box::new(serde_json::from_reader(r)?)))
60312            }
60313            TypeVariant::MuxedAccountMed25519 => Ok(Self::MuxedAccountMed25519(Box::new(
60314                serde_json::from_reader(r)?,
60315            ))),
60316            TypeVariant::DecoratedSignature => Ok(Self::DecoratedSignature(Box::new(
60317                serde_json::from_reader(r)?,
60318            ))),
60319            TypeVariant::OperationType => {
60320                Ok(Self::OperationType(Box::new(serde_json::from_reader(r)?)))
60321            }
60322            TypeVariant::CreateAccountOp => {
60323                Ok(Self::CreateAccountOp(Box::new(serde_json::from_reader(r)?)))
60324            }
60325            TypeVariant::PaymentOp => Ok(Self::PaymentOp(Box::new(serde_json::from_reader(r)?))),
60326            TypeVariant::PathPaymentStrictReceiveOp => Ok(Self::PathPaymentStrictReceiveOp(
60327                Box::new(serde_json::from_reader(r)?),
60328            )),
60329            TypeVariant::PathPaymentStrictSendOp => Ok(Self::PathPaymentStrictSendOp(Box::new(
60330                serde_json::from_reader(r)?,
60331            ))),
60332            TypeVariant::ManageSellOfferOp => Ok(Self::ManageSellOfferOp(Box::new(
60333                serde_json::from_reader(r)?,
60334            ))),
60335            TypeVariant::ManageBuyOfferOp => Ok(Self::ManageBuyOfferOp(Box::new(
60336                serde_json::from_reader(r)?,
60337            ))),
60338            TypeVariant::CreatePassiveSellOfferOp => Ok(Self::CreatePassiveSellOfferOp(Box::new(
60339                serde_json::from_reader(r)?,
60340            ))),
60341            TypeVariant::SetOptionsOp => {
60342                Ok(Self::SetOptionsOp(Box::new(serde_json::from_reader(r)?)))
60343            }
60344            TypeVariant::ChangeTrustAsset => Ok(Self::ChangeTrustAsset(Box::new(
60345                serde_json::from_reader(r)?,
60346            ))),
60347            TypeVariant::ChangeTrustOp => {
60348                Ok(Self::ChangeTrustOp(Box::new(serde_json::from_reader(r)?)))
60349            }
60350            TypeVariant::AllowTrustOp => {
60351                Ok(Self::AllowTrustOp(Box::new(serde_json::from_reader(r)?)))
60352            }
60353            TypeVariant::ManageDataOp => {
60354                Ok(Self::ManageDataOp(Box::new(serde_json::from_reader(r)?)))
60355            }
60356            TypeVariant::BumpSequenceOp => {
60357                Ok(Self::BumpSequenceOp(Box::new(serde_json::from_reader(r)?)))
60358            }
60359            TypeVariant::CreateClaimableBalanceOp => Ok(Self::CreateClaimableBalanceOp(Box::new(
60360                serde_json::from_reader(r)?,
60361            ))),
60362            TypeVariant::ClaimClaimableBalanceOp => Ok(Self::ClaimClaimableBalanceOp(Box::new(
60363                serde_json::from_reader(r)?,
60364            ))),
60365            TypeVariant::BeginSponsoringFutureReservesOp => Ok(
60366                Self::BeginSponsoringFutureReservesOp(Box::new(serde_json::from_reader(r)?)),
60367            ),
60368            TypeVariant::RevokeSponsorshipType => Ok(Self::RevokeSponsorshipType(Box::new(
60369                serde_json::from_reader(r)?,
60370            ))),
60371            TypeVariant::RevokeSponsorshipOp => Ok(Self::RevokeSponsorshipOp(Box::new(
60372                serde_json::from_reader(r)?,
60373            ))),
60374            TypeVariant::RevokeSponsorshipOpSigner => Ok(Self::RevokeSponsorshipOpSigner(
60375                Box::new(serde_json::from_reader(r)?),
60376            )),
60377            TypeVariant::ClawbackOp => Ok(Self::ClawbackOp(Box::new(serde_json::from_reader(r)?))),
60378            TypeVariant::ClawbackClaimableBalanceOp => Ok(Self::ClawbackClaimableBalanceOp(
60379                Box::new(serde_json::from_reader(r)?),
60380            )),
60381            TypeVariant::SetTrustLineFlagsOp => Ok(Self::SetTrustLineFlagsOp(Box::new(
60382                serde_json::from_reader(r)?,
60383            ))),
60384            TypeVariant::LiquidityPoolDepositOp => Ok(Self::LiquidityPoolDepositOp(Box::new(
60385                serde_json::from_reader(r)?,
60386            ))),
60387            TypeVariant::LiquidityPoolWithdrawOp => Ok(Self::LiquidityPoolWithdrawOp(Box::new(
60388                serde_json::from_reader(r)?,
60389            ))),
60390            TypeVariant::HostFunctionType => Ok(Self::HostFunctionType(Box::new(
60391                serde_json::from_reader(r)?,
60392            ))),
60393            TypeVariant::ContractIdPreimageType => Ok(Self::ContractIdPreimageType(Box::new(
60394                serde_json::from_reader(r)?,
60395            ))),
60396            TypeVariant::ContractIdPreimage => Ok(Self::ContractIdPreimage(Box::new(
60397                serde_json::from_reader(r)?,
60398            ))),
60399            TypeVariant::ContractIdPreimageFromAddress => Ok(Self::ContractIdPreimageFromAddress(
60400                Box::new(serde_json::from_reader(r)?),
60401            )),
60402            TypeVariant::CreateContractArgs => Ok(Self::CreateContractArgs(Box::new(
60403                serde_json::from_reader(r)?,
60404            ))),
60405            TypeVariant::CreateContractArgsV2 => Ok(Self::CreateContractArgsV2(Box::new(
60406                serde_json::from_reader(r)?,
60407            ))),
60408            TypeVariant::InvokeContractArgs => Ok(Self::InvokeContractArgs(Box::new(
60409                serde_json::from_reader(r)?,
60410            ))),
60411            TypeVariant::HostFunction => {
60412                Ok(Self::HostFunction(Box::new(serde_json::from_reader(r)?)))
60413            }
60414            TypeVariant::SorobanAuthorizedFunctionType => Ok(Self::SorobanAuthorizedFunctionType(
60415                Box::new(serde_json::from_reader(r)?),
60416            )),
60417            TypeVariant::SorobanAuthorizedFunction => Ok(Self::SorobanAuthorizedFunction(
60418                Box::new(serde_json::from_reader(r)?),
60419            )),
60420            TypeVariant::SorobanAuthorizedInvocation => Ok(Self::SorobanAuthorizedInvocation(
60421                Box::new(serde_json::from_reader(r)?),
60422            )),
60423            TypeVariant::SorobanAddressCredentials => Ok(Self::SorobanAddressCredentials(
60424                Box::new(serde_json::from_reader(r)?),
60425            )),
60426            TypeVariant::SorobanCredentialsType => Ok(Self::SorobanCredentialsType(Box::new(
60427                serde_json::from_reader(r)?,
60428            ))),
60429            TypeVariant::SorobanCredentials => Ok(Self::SorobanCredentials(Box::new(
60430                serde_json::from_reader(r)?,
60431            ))),
60432            TypeVariant::SorobanAuthorizationEntry => Ok(Self::SorobanAuthorizationEntry(
60433                Box::new(serde_json::from_reader(r)?),
60434            )),
60435            TypeVariant::InvokeHostFunctionOp => Ok(Self::InvokeHostFunctionOp(Box::new(
60436                serde_json::from_reader(r)?,
60437            ))),
60438            TypeVariant::ExtendFootprintTtlOp => Ok(Self::ExtendFootprintTtlOp(Box::new(
60439                serde_json::from_reader(r)?,
60440            ))),
60441            TypeVariant::RestoreFootprintOp => Ok(Self::RestoreFootprintOp(Box::new(
60442                serde_json::from_reader(r)?,
60443            ))),
60444            TypeVariant::Operation => Ok(Self::Operation(Box::new(serde_json::from_reader(r)?))),
60445            TypeVariant::OperationBody => {
60446                Ok(Self::OperationBody(Box::new(serde_json::from_reader(r)?)))
60447            }
60448            TypeVariant::HashIdPreimage => {
60449                Ok(Self::HashIdPreimage(Box::new(serde_json::from_reader(r)?)))
60450            }
60451            TypeVariant::HashIdPreimageOperationId => Ok(Self::HashIdPreimageOperationId(
60452                Box::new(serde_json::from_reader(r)?),
60453            )),
60454            TypeVariant::HashIdPreimageRevokeId => Ok(Self::HashIdPreimageRevokeId(Box::new(
60455                serde_json::from_reader(r)?,
60456            ))),
60457            TypeVariant::HashIdPreimageContractId => Ok(Self::HashIdPreimageContractId(Box::new(
60458                serde_json::from_reader(r)?,
60459            ))),
60460            TypeVariant::HashIdPreimageSorobanAuthorization => Ok(
60461                Self::HashIdPreimageSorobanAuthorization(Box::new(serde_json::from_reader(r)?)),
60462            ),
60463            TypeVariant::MemoType => Ok(Self::MemoType(Box::new(serde_json::from_reader(r)?))),
60464            TypeVariant::Memo => Ok(Self::Memo(Box::new(serde_json::from_reader(r)?))),
60465            TypeVariant::TimeBounds => Ok(Self::TimeBounds(Box::new(serde_json::from_reader(r)?))),
60466            TypeVariant::LedgerBounds => {
60467                Ok(Self::LedgerBounds(Box::new(serde_json::from_reader(r)?)))
60468            }
60469            TypeVariant::PreconditionsV2 => {
60470                Ok(Self::PreconditionsV2(Box::new(serde_json::from_reader(r)?)))
60471            }
60472            TypeVariant::PreconditionType => Ok(Self::PreconditionType(Box::new(
60473                serde_json::from_reader(r)?,
60474            ))),
60475            TypeVariant::Preconditions => {
60476                Ok(Self::Preconditions(Box::new(serde_json::from_reader(r)?)))
60477            }
60478            TypeVariant::LedgerFootprint => {
60479                Ok(Self::LedgerFootprint(Box::new(serde_json::from_reader(r)?)))
60480            }
60481            TypeVariant::ArchivalProofType => Ok(Self::ArchivalProofType(Box::new(
60482                serde_json::from_reader(r)?,
60483            ))),
60484            TypeVariant::ArchivalProofNode => Ok(Self::ArchivalProofNode(Box::new(
60485                serde_json::from_reader(r)?,
60486            ))),
60487            TypeVariant::ProofLevel => Ok(Self::ProofLevel(Box::new(serde_json::from_reader(r)?))),
60488            TypeVariant::ExistenceProofBody => Ok(Self::ExistenceProofBody(Box::new(
60489                serde_json::from_reader(r)?,
60490            ))),
60491            TypeVariant::NonexistenceProofBody => Ok(Self::NonexistenceProofBody(Box::new(
60492                serde_json::from_reader(r)?,
60493            ))),
60494            TypeVariant::ArchivalProof => {
60495                Ok(Self::ArchivalProof(Box::new(serde_json::from_reader(r)?)))
60496            }
60497            TypeVariant::ArchivalProofBody => Ok(Self::ArchivalProofBody(Box::new(
60498                serde_json::from_reader(r)?,
60499            ))),
60500            TypeVariant::SorobanResources => Ok(Self::SorobanResources(Box::new(
60501                serde_json::from_reader(r)?,
60502            ))),
60503            TypeVariant::SorobanTransactionData => Ok(Self::SorobanTransactionData(Box::new(
60504                serde_json::from_reader(r)?,
60505            ))),
60506            TypeVariant::SorobanTransactionDataExt => Ok(Self::SorobanTransactionDataExt(
60507                Box::new(serde_json::from_reader(r)?),
60508            )),
60509            TypeVariant::TransactionV0 => {
60510                Ok(Self::TransactionV0(Box::new(serde_json::from_reader(r)?)))
60511            }
60512            TypeVariant::TransactionV0Ext => Ok(Self::TransactionV0Ext(Box::new(
60513                serde_json::from_reader(r)?,
60514            ))),
60515            TypeVariant::TransactionV0Envelope => Ok(Self::TransactionV0Envelope(Box::new(
60516                serde_json::from_reader(r)?,
60517            ))),
60518            TypeVariant::Transaction => {
60519                Ok(Self::Transaction(Box::new(serde_json::from_reader(r)?)))
60520            }
60521            TypeVariant::TransactionExt => {
60522                Ok(Self::TransactionExt(Box::new(serde_json::from_reader(r)?)))
60523            }
60524            TypeVariant::TransactionV1Envelope => Ok(Self::TransactionV1Envelope(Box::new(
60525                serde_json::from_reader(r)?,
60526            ))),
60527            TypeVariant::FeeBumpTransaction => Ok(Self::FeeBumpTransaction(Box::new(
60528                serde_json::from_reader(r)?,
60529            ))),
60530            TypeVariant::FeeBumpTransactionInnerTx => Ok(Self::FeeBumpTransactionInnerTx(
60531                Box::new(serde_json::from_reader(r)?),
60532            )),
60533            TypeVariant::FeeBumpTransactionExt => Ok(Self::FeeBumpTransactionExt(Box::new(
60534                serde_json::from_reader(r)?,
60535            ))),
60536            TypeVariant::FeeBumpTransactionEnvelope => Ok(Self::FeeBumpTransactionEnvelope(
60537                Box::new(serde_json::from_reader(r)?),
60538            )),
60539            TypeVariant::TransactionEnvelope => Ok(Self::TransactionEnvelope(Box::new(
60540                serde_json::from_reader(r)?,
60541            ))),
60542            TypeVariant::TransactionSignaturePayload => Ok(Self::TransactionSignaturePayload(
60543                Box::new(serde_json::from_reader(r)?),
60544            )),
60545            TypeVariant::TransactionSignaturePayloadTaggedTransaction => {
60546                Ok(Self::TransactionSignaturePayloadTaggedTransaction(
60547                    Box::new(serde_json::from_reader(r)?),
60548                ))
60549            }
60550            TypeVariant::ClaimAtomType => {
60551                Ok(Self::ClaimAtomType(Box::new(serde_json::from_reader(r)?)))
60552            }
60553            TypeVariant::ClaimOfferAtomV0 => Ok(Self::ClaimOfferAtomV0(Box::new(
60554                serde_json::from_reader(r)?,
60555            ))),
60556            TypeVariant::ClaimOfferAtom => {
60557                Ok(Self::ClaimOfferAtom(Box::new(serde_json::from_reader(r)?)))
60558            }
60559            TypeVariant::ClaimLiquidityAtom => Ok(Self::ClaimLiquidityAtom(Box::new(
60560                serde_json::from_reader(r)?,
60561            ))),
60562            TypeVariant::ClaimAtom => Ok(Self::ClaimAtom(Box::new(serde_json::from_reader(r)?))),
60563            TypeVariant::CreateAccountResultCode => Ok(Self::CreateAccountResultCode(Box::new(
60564                serde_json::from_reader(r)?,
60565            ))),
60566            TypeVariant::CreateAccountResult => Ok(Self::CreateAccountResult(Box::new(
60567                serde_json::from_reader(r)?,
60568            ))),
60569            TypeVariant::PaymentResultCode => Ok(Self::PaymentResultCode(Box::new(
60570                serde_json::from_reader(r)?,
60571            ))),
60572            TypeVariant::PaymentResult => {
60573                Ok(Self::PaymentResult(Box::new(serde_json::from_reader(r)?)))
60574            }
60575            TypeVariant::PathPaymentStrictReceiveResultCode => Ok(
60576                Self::PathPaymentStrictReceiveResultCode(Box::new(serde_json::from_reader(r)?)),
60577            ),
60578            TypeVariant::SimplePaymentResult => Ok(Self::SimplePaymentResult(Box::new(
60579                serde_json::from_reader(r)?,
60580            ))),
60581            TypeVariant::PathPaymentStrictReceiveResult => Ok(
60582                Self::PathPaymentStrictReceiveResult(Box::new(serde_json::from_reader(r)?)),
60583            ),
60584            TypeVariant::PathPaymentStrictReceiveResultSuccess => Ok(
60585                Self::PathPaymentStrictReceiveResultSuccess(Box::new(serde_json::from_reader(r)?)),
60586            ),
60587            TypeVariant::PathPaymentStrictSendResultCode => Ok(
60588                Self::PathPaymentStrictSendResultCode(Box::new(serde_json::from_reader(r)?)),
60589            ),
60590            TypeVariant::PathPaymentStrictSendResult => Ok(Self::PathPaymentStrictSendResult(
60591                Box::new(serde_json::from_reader(r)?),
60592            )),
60593            TypeVariant::PathPaymentStrictSendResultSuccess => Ok(
60594                Self::PathPaymentStrictSendResultSuccess(Box::new(serde_json::from_reader(r)?)),
60595            ),
60596            TypeVariant::ManageSellOfferResultCode => Ok(Self::ManageSellOfferResultCode(
60597                Box::new(serde_json::from_reader(r)?),
60598            )),
60599            TypeVariant::ManageOfferEffect => Ok(Self::ManageOfferEffect(Box::new(
60600                serde_json::from_reader(r)?,
60601            ))),
60602            TypeVariant::ManageOfferSuccessResult => Ok(Self::ManageOfferSuccessResult(Box::new(
60603                serde_json::from_reader(r)?,
60604            ))),
60605            TypeVariant::ManageOfferSuccessResultOffer => Ok(Self::ManageOfferSuccessResultOffer(
60606                Box::new(serde_json::from_reader(r)?),
60607            )),
60608            TypeVariant::ManageSellOfferResult => Ok(Self::ManageSellOfferResult(Box::new(
60609                serde_json::from_reader(r)?,
60610            ))),
60611            TypeVariant::ManageBuyOfferResultCode => Ok(Self::ManageBuyOfferResultCode(Box::new(
60612                serde_json::from_reader(r)?,
60613            ))),
60614            TypeVariant::ManageBuyOfferResult => Ok(Self::ManageBuyOfferResult(Box::new(
60615                serde_json::from_reader(r)?,
60616            ))),
60617            TypeVariant::SetOptionsResultCode => Ok(Self::SetOptionsResultCode(Box::new(
60618                serde_json::from_reader(r)?,
60619            ))),
60620            TypeVariant::SetOptionsResult => Ok(Self::SetOptionsResult(Box::new(
60621                serde_json::from_reader(r)?,
60622            ))),
60623            TypeVariant::ChangeTrustResultCode => Ok(Self::ChangeTrustResultCode(Box::new(
60624                serde_json::from_reader(r)?,
60625            ))),
60626            TypeVariant::ChangeTrustResult => Ok(Self::ChangeTrustResult(Box::new(
60627                serde_json::from_reader(r)?,
60628            ))),
60629            TypeVariant::AllowTrustResultCode => Ok(Self::AllowTrustResultCode(Box::new(
60630                serde_json::from_reader(r)?,
60631            ))),
60632            TypeVariant::AllowTrustResult => Ok(Self::AllowTrustResult(Box::new(
60633                serde_json::from_reader(r)?,
60634            ))),
60635            TypeVariant::AccountMergeResultCode => Ok(Self::AccountMergeResultCode(Box::new(
60636                serde_json::from_reader(r)?,
60637            ))),
60638            TypeVariant::AccountMergeResult => Ok(Self::AccountMergeResult(Box::new(
60639                serde_json::from_reader(r)?,
60640            ))),
60641            TypeVariant::InflationResultCode => Ok(Self::InflationResultCode(Box::new(
60642                serde_json::from_reader(r)?,
60643            ))),
60644            TypeVariant::InflationPayout => {
60645                Ok(Self::InflationPayout(Box::new(serde_json::from_reader(r)?)))
60646            }
60647            TypeVariant::InflationResult => {
60648                Ok(Self::InflationResult(Box::new(serde_json::from_reader(r)?)))
60649            }
60650            TypeVariant::ManageDataResultCode => Ok(Self::ManageDataResultCode(Box::new(
60651                serde_json::from_reader(r)?,
60652            ))),
60653            TypeVariant::ManageDataResult => Ok(Self::ManageDataResult(Box::new(
60654                serde_json::from_reader(r)?,
60655            ))),
60656            TypeVariant::BumpSequenceResultCode => Ok(Self::BumpSequenceResultCode(Box::new(
60657                serde_json::from_reader(r)?,
60658            ))),
60659            TypeVariant::BumpSequenceResult => Ok(Self::BumpSequenceResult(Box::new(
60660                serde_json::from_reader(r)?,
60661            ))),
60662            TypeVariant::CreateClaimableBalanceResultCode => Ok(
60663                Self::CreateClaimableBalanceResultCode(Box::new(serde_json::from_reader(r)?)),
60664            ),
60665            TypeVariant::CreateClaimableBalanceResult => Ok(Self::CreateClaimableBalanceResult(
60666                Box::new(serde_json::from_reader(r)?),
60667            )),
60668            TypeVariant::ClaimClaimableBalanceResultCode => Ok(
60669                Self::ClaimClaimableBalanceResultCode(Box::new(serde_json::from_reader(r)?)),
60670            ),
60671            TypeVariant::ClaimClaimableBalanceResult => Ok(Self::ClaimClaimableBalanceResult(
60672                Box::new(serde_json::from_reader(r)?),
60673            )),
60674            TypeVariant::BeginSponsoringFutureReservesResultCode => {
60675                Ok(Self::BeginSponsoringFutureReservesResultCode(Box::new(
60676                    serde_json::from_reader(r)?,
60677                )))
60678            }
60679            TypeVariant::BeginSponsoringFutureReservesResult => Ok(
60680                Self::BeginSponsoringFutureReservesResult(Box::new(serde_json::from_reader(r)?)),
60681            ),
60682            TypeVariant::EndSponsoringFutureReservesResultCode => Ok(
60683                Self::EndSponsoringFutureReservesResultCode(Box::new(serde_json::from_reader(r)?)),
60684            ),
60685            TypeVariant::EndSponsoringFutureReservesResult => Ok(
60686                Self::EndSponsoringFutureReservesResult(Box::new(serde_json::from_reader(r)?)),
60687            ),
60688            TypeVariant::RevokeSponsorshipResultCode => Ok(Self::RevokeSponsorshipResultCode(
60689                Box::new(serde_json::from_reader(r)?),
60690            )),
60691            TypeVariant::RevokeSponsorshipResult => Ok(Self::RevokeSponsorshipResult(Box::new(
60692                serde_json::from_reader(r)?,
60693            ))),
60694            TypeVariant::ClawbackResultCode => Ok(Self::ClawbackResultCode(Box::new(
60695                serde_json::from_reader(r)?,
60696            ))),
60697            TypeVariant::ClawbackResult => {
60698                Ok(Self::ClawbackResult(Box::new(serde_json::from_reader(r)?)))
60699            }
60700            TypeVariant::ClawbackClaimableBalanceResultCode => Ok(
60701                Self::ClawbackClaimableBalanceResultCode(Box::new(serde_json::from_reader(r)?)),
60702            ),
60703            TypeVariant::ClawbackClaimableBalanceResult => Ok(
60704                Self::ClawbackClaimableBalanceResult(Box::new(serde_json::from_reader(r)?)),
60705            ),
60706            TypeVariant::SetTrustLineFlagsResultCode => Ok(Self::SetTrustLineFlagsResultCode(
60707                Box::new(serde_json::from_reader(r)?),
60708            )),
60709            TypeVariant::SetTrustLineFlagsResult => Ok(Self::SetTrustLineFlagsResult(Box::new(
60710                serde_json::from_reader(r)?,
60711            ))),
60712            TypeVariant::LiquidityPoolDepositResultCode => Ok(
60713                Self::LiquidityPoolDepositResultCode(Box::new(serde_json::from_reader(r)?)),
60714            ),
60715            TypeVariant::LiquidityPoolDepositResult => Ok(Self::LiquidityPoolDepositResult(
60716                Box::new(serde_json::from_reader(r)?),
60717            )),
60718            TypeVariant::LiquidityPoolWithdrawResultCode => Ok(
60719                Self::LiquidityPoolWithdrawResultCode(Box::new(serde_json::from_reader(r)?)),
60720            ),
60721            TypeVariant::LiquidityPoolWithdrawResult => Ok(Self::LiquidityPoolWithdrawResult(
60722                Box::new(serde_json::from_reader(r)?),
60723            )),
60724            TypeVariant::InvokeHostFunctionResultCode => Ok(Self::InvokeHostFunctionResultCode(
60725                Box::new(serde_json::from_reader(r)?),
60726            )),
60727            TypeVariant::InvokeHostFunctionResult => Ok(Self::InvokeHostFunctionResult(Box::new(
60728                serde_json::from_reader(r)?,
60729            ))),
60730            TypeVariant::ExtendFootprintTtlResultCode => Ok(Self::ExtendFootprintTtlResultCode(
60731                Box::new(serde_json::from_reader(r)?),
60732            )),
60733            TypeVariant::ExtendFootprintTtlResult => Ok(Self::ExtendFootprintTtlResult(Box::new(
60734                serde_json::from_reader(r)?,
60735            ))),
60736            TypeVariant::RestoreFootprintResultCode => Ok(Self::RestoreFootprintResultCode(
60737                Box::new(serde_json::from_reader(r)?),
60738            )),
60739            TypeVariant::RestoreFootprintResult => Ok(Self::RestoreFootprintResult(Box::new(
60740                serde_json::from_reader(r)?,
60741            ))),
60742            TypeVariant::OperationResultCode => Ok(Self::OperationResultCode(Box::new(
60743                serde_json::from_reader(r)?,
60744            ))),
60745            TypeVariant::OperationResult => {
60746                Ok(Self::OperationResult(Box::new(serde_json::from_reader(r)?)))
60747            }
60748            TypeVariant::OperationResultTr => Ok(Self::OperationResultTr(Box::new(
60749                serde_json::from_reader(r)?,
60750            ))),
60751            TypeVariant::TransactionResultCode => Ok(Self::TransactionResultCode(Box::new(
60752                serde_json::from_reader(r)?,
60753            ))),
60754            TypeVariant::InnerTransactionResult => Ok(Self::InnerTransactionResult(Box::new(
60755                serde_json::from_reader(r)?,
60756            ))),
60757            TypeVariant::InnerTransactionResultResult => Ok(Self::InnerTransactionResultResult(
60758                Box::new(serde_json::from_reader(r)?),
60759            )),
60760            TypeVariant::InnerTransactionResultExt => Ok(Self::InnerTransactionResultExt(
60761                Box::new(serde_json::from_reader(r)?),
60762            )),
60763            TypeVariant::InnerTransactionResultPair => Ok(Self::InnerTransactionResultPair(
60764                Box::new(serde_json::from_reader(r)?),
60765            )),
60766            TypeVariant::TransactionResult => Ok(Self::TransactionResult(Box::new(
60767                serde_json::from_reader(r)?,
60768            ))),
60769            TypeVariant::TransactionResultResult => Ok(Self::TransactionResultResult(Box::new(
60770                serde_json::from_reader(r)?,
60771            ))),
60772            TypeVariant::TransactionResultExt => Ok(Self::TransactionResultExt(Box::new(
60773                serde_json::from_reader(r)?,
60774            ))),
60775            TypeVariant::Hash => Ok(Self::Hash(Box::new(serde_json::from_reader(r)?))),
60776            TypeVariant::Uint256 => Ok(Self::Uint256(Box::new(serde_json::from_reader(r)?))),
60777            TypeVariant::Uint32 => Ok(Self::Uint32(Box::new(serde_json::from_reader(r)?))),
60778            TypeVariant::Int32 => Ok(Self::Int32(Box::new(serde_json::from_reader(r)?))),
60779            TypeVariant::Uint64 => Ok(Self::Uint64(Box::new(serde_json::from_reader(r)?))),
60780            TypeVariant::Int64 => Ok(Self::Int64(Box::new(serde_json::from_reader(r)?))),
60781            TypeVariant::TimePoint => Ok(Self::TimePoint(Box::new(serde_json::from_reader(r)?))),
60782            TypeVariant::Duration => Ok(Self::Duration(Box::new(serde_json::from_reader(r)?))),
60783            TypeVariant::ExtensionPoint => {
60784                Ok(Self::ExtensionPoint(Box::new(serde_json::from_reader(r)?)))
60785            }
60786            TypeVariant::CryptoKeyType => {
60787                Ok(Self::CryptoKeyType(Box::new(serde_json::from_reader(r)?)))
60788            }
60789            TypeVariant::PublicKeyType => {
60790                Ok(Self::PublicKeyType(Box::new(serde_json::from_reader(r)?)))
60791            }
60792            TypeVariant::SignerKeyType => {
60793                Ok(Self::SignerKeyType(Box::new(serde_json::from_reader(r)?)))
60794            }
60795            TypeVariant::PublicKey => Ok(Self::PublicKey(Box::new(serde_json::from_reader(r)?))),
60796            TypeVariant::SignerKey => Ok(Self::SignerKey(Box::new(serde_json::from_reader(r)?))),
60797            TypeVariant::SignerKeyEd25519SignedPayload => Ok(Self::SignerKeyEd25519SignedPayload(
60798                Box::new(serde_json::from_reader(r)?),
60799            )),
60800            TypeVariant::Signature => Ok(Self::Signature(Box::new(serde_json::from_reader(r)?))),
60801            TypeVariant::SignatureHint => {
60802                Ok(Self::SignatureHint(Box::new(serde_json::from_reader(r)?)))
60803            }
60804            TypeVariant::NodeId => Ok(Self::NodeId(Box::new(serde_json::from_reader(r)?))),
60805            TypeVariant::AccountId => Ok(Self::AccountId(Box::new(serde_json::from_reader(r)?))),
60806            TypeVariant::Curve25519Secret => Ok(Self::Curve25519Secret(Box::new(
60807                serde_json::from_reader(r)?,
60808            ))),
60809            TypeVariant::Curve25519Public => Ok(Self::Curve25519Public(Box::new(
60810                serde_json::from_reader(r)?,
60811            ))),
60812            TypeVariant::HmacSha256Key => {
60813                Ok(Self::HmacSha256Key(Box::new(serde_json::from_reader(r)?)))
60814            }
60815            TypeVariant::HmacSha256Mac => {
60816                Ok(Self::HmacSha256Mac(Box::new(serde_json::from_reader(r)?)))
60817            }
60818            TypeVariant::ShortHashSeed => {
60819                Ok(Self::ShortHashSeed(Box::new(serde_json::from_reader(r)?)))
60820            }
60821            TypeVariant::BinaryFuseFilterType => Ok(Self::BinaryFuseFilterType(Box::new(
60822                serde_json::from_reader(r)?,
60823            ))),
60824            TypeVariant::SerializedBinaryFuseFilter => Ok(Self::SerializedBinaryFuseFilter(
60825                Box::new(serde_json::from_reader(r)?),
60826            )),
60827        }
60828    }
60829
60830    #[cfg(all(feature = "std", feature = "serde_json"))]
60831    #[allow(clippy::too_many_lines)]
60832    pub fn deserialize_json<'r, R: serde_json::de::Read<'r>>(
60833        v: TypeVariant,
60834        r: &mut serde_json::de::Deserializer<R>,
60835    ) -> Result<Self> {
60836        match v {
60837            TypeVariant::Value => Ok(Self::Value(Box::new(serde::de::Deserialize::deserialize(
60838                r,
60839            )?))),
60840            TypeVariant::ScpBallot => Ok(Self::ScpBallot(Box::new(
60841                serde::de::Deserialize::deserialize(r)?,
60842            ))),
60843            TypeVariant::ScpStatementType => Ok(Self::ScpStatementType(Box::new(
60844                serde::de::Deserialize::deserialize(r)?,
60845            ))),
60846            TypeVariant::ScpNomination => Ok(Self::ScpNomination(Box::new(
60847                serde::de::Deserialize::deserialize(r)?,
60848            ))),
60849            TypeVariant::ScpStatement => Ok(Self::ScpStatement(Box::new(
60850                serde::de::Deserialize::deserialize(r)?,
60851            ))),
60852            TypeVariant::ScpStatementPledges => Ok(Self::ScpStatementPledges(Box::new(
60853                serde::de::Deserialize::deserialize(r)?,
60854            ))),
60855            TypeVariant::ScpStatementPrepare => Ok(Self::ScpStatementPrepare(Box::new(
60856                serde::de::Deserialize::deserialize(r)?,
60857            ))),
60858            TypeVariant::ScpStatementConfirm => Ok(Self::ScpStatementConfirm(Box::new(
60859                serde::de::Deserialize::deserialize(r)?,
60860            ))),
60861            TypeVariant::ScpStatementExternalize => Ok(Self::ScpStatementExternalize(Box::new(
60862                serde::de::Deserialize::deserialize(r)?,
60863            ))),
60864            TypeVariant::ScpEnvelope => Ok(Self::ScpEnvelope(Box::new(
60865                serde::de::Deserialize::deserialize(r)?,
60866            ))),
60867            TypeVariant::ScpQuorumSet => Ok(Self::ScpQuorumSet(Box::new(
60868                serde::de::Deserialize::deserialize(r)?,
60869            ))),
60870            TypeVariant::ConfigSettingContractExecutionLanesV0 => {
60871                Ok(Self::ConfigSettingContractExecutionLanesV0(Box::new(
60872                    serde::de::Deserialize::deserialize(r)?,
60873                )))
60874            }
60875            TypeVariant::ConfigSettingContractComputeV0 => {
60876                Ok(Self::ConfigSettingContractComputeV0(Box::new(
60877                    serde::de::Deserialize::deserialize(r)?,
60878                )))
60879            }
60880            TypeVariant::ConfigSettingContractParallelComputeV0 => {
60881                Ok(Self::ConfigSettingContractParallelComputeV0(Box::new(
60882                    serde::de::Deserialize::deserialize(r)?,
60883                )))
60884            }
60885            TypeVariant::ConfigSettingContractLedgerCostV0 => {
60886                Ok(Self::ConfigSettingContractLedgerCostV0(Box::new(
60887                    serde::de::Deserialize::deserialize(r)?,
60888                )))
60889            }
60890            TypeVariant::ConfigSettingContractHistoricalDataV0 => {
60891                Ok(Self::ConfigSettingContractHistoricalDataV0(Box::new(
60892                    serde::de::Deserialize::deserialize(r)?,
60893                )))
60894            }
60895            TypeVariant::ConfigSettingContractEventsV0 => Ok(Self::ConfigSettingContractEventsV0(
60896                Box::new(serde::de::Deserialize::deserialize(r)?),
60897            )),
60898            TypeVariant::ConfigSettingContractBandwidthV0 => {
60899                Ok(Self::ConfigSettingContractBandwidthV0(Box::new(
60900                    serde::de::Deserialize::deserialize(r)?,
60901                )))
60902            }
60903            TypeVariant::ContractCostType => Ok(Self::ContractCostType(Box::new(
60904                serde::de::Deserialize::deserialize(r)?,
60905            ))),
60906            TypeVariant::ContractCostParamEntry => Ok(Self::ContractCostParamEntry(Box::new(
60907                serde::de::Deserialize::deserialize(r)?,
60908            ))),
60909            TypeVariant::StateArchivalSettings => Ok(Self::StateArchivalSettings(Box::new(
60910                serde::de::Deserialize::deserialize(r)?,
60911            ))),
60912            TypeVariant::EvictionIterator => Ok(Self::EvictionIterator(Box::new(
60913                serde::de::Deserialize::deserialize(r)?,
60914            ))),
60915            TypeVariant::ContractCostParams => Ok(Self::ContractCostParams(Box::new(
60916                serde::de::Deserialize::deserialize(r)?,
60917            ))),
60918            TypeVariant::ConfigSettingId => Ok(Self::ConfigSettingId(Box::new(
60919                serde::de::Deserialize::deserialize(r)?,
60920            ))),
60921            TypeVariant::ConfigSettingEntry => Ok(Self::ConfigSettingEntry(Box::new(
60922                serde::de::Deserialize::deserialize(r)?,
60923            ))),
60924            TypeVariant::ScEnvMetaKind => Ok(Self::ScEnvMetaKind(Box::new(
60925                serde::de::Deserialize::deserialize(r)?,
60926            ))),
60927            TypeVariant::ScEnvMetaEntry => Ok(Self::ScEnvMetaEntry(Box::new(
60928                serde::de::Deserialize::deserialize(r)?,
60929            ))),
60930            TypeVariant::ScEnvMetaEntryInterfaceVersion => {
60931                Ok(Self::ScEnvMetaEntryInterfaceVersion(Box::new(
60932                    serde::de::Deserialize::deserialize(r)?,
60933                )))
60934            }
60935            TypeVariant::ScMetaV0 => Ok(Self::ScMetaV0(Box::new(
60936                serde::de::Deserialize::deserialize(r)?,
60937            ))),
60938            TypeVariant::ScMetaKind => Ok(Self::ScMetaKind(Box::new(
60939                serde::de::Deserialize::deserialize(r)?,
60940            ))),
60941            TypeVariant::ScMetaEntry => Ok(Self::ScMetaEntry(Box::new(
60942                serde::de::Deserialize::deserialize(r)?,
60943            ))),
60944            TypeVariant::ScSpecType => Ok(Self::ScSpecType(Box::new(
60945                serde::de::Deserialize::deserialize(r)?,
60946            ))),
60947            TypeVariant::ScSpecTypeOption => Ok(Self::ScSpecTypeOption(Box::new(
60948                serde::de::Deserialize::deserialize(r)?,
60949            ))),
60950            TypeVariant::ScSpecTypeResult => Ok(Self::ScSpecTypeResult(Box::new(
60951                serde::de::Deserialize::deserialize(r)?,
60952            ))),
60953            TypeVariant::ScSpecTypeVec => Ok(Self::ScSpecTypeVec(Box::new(
60954                serde::de::Deserialize::deserialize(r)?,
60955            ))),
60956            TypeVariant::ScSpecTypeMap => Ok(Self::ScSpecTypeMap(Box::new(
60957                serde::de::Deserialize::deserialize(r)?,
60958            ))),
60959            TypeVariant::ScSpecTypeTuple => Ok(Self::ScSpecTypeTuple(Box::new(
60960                serde::de::Deserialize::deserialize(r)?,
60961            ))),
60962            TypeVariant::ScSpecTypeBytesN => Ok(Self::ScSpecTypeBytesN(Box::new(
60963                serde::de::Deserialize::deserialize(r)?,
60964            ))),
60965            TypeVariant::ScSpecTypeUdt => Ok(Self::ScSpecTypeUdt(Box::new(
60966                serde::de::Deserialize::deserialize(r)?,
60967            ))),
60968            TypeVariant::ScSpecTypeDef => Ok(Self::ScSpecTypeDef(Box::new(
60969                serde::de::Deserialize::deserialize(r)?,
60970            ))),
60971            TypeVariant::ScSpecUdtStructFieldV0 => Ok(Self::ScSpecUdtStructFieldV0(Box::new(
60972                serde::de::Deserialize::deserialize(r)?,
60973            ))),
60974            TypeVariant::ScSpecUdtStructV0 => Ok(Self::ScSpecUdtStructV0(Box::new(
60975                serde::de::Deserialize::deserialize(r)?,
60976            ))),
60977            TypeVariant::ScSpecUdtUnionCaseVoidV0 => Ok(Self::ScSpecUdtUnionCaseVoidV0(Box::new(
60978                serde::de::Deserialize::deserialize(r)?,
60979            ))),
60980            TypeVariant::ScSpecUdtUnionCaseTupleV0 => Ok(Self::ScSpecUdtUnionCaseTupleV0(
60981                Box::new(serde::de::Deserialize::deserialize(r)?),
60982            )),
60983            TypeVariant::ScSpecUdtUnionCaseV0Kind => Ok(Self::ScSpecUdtUnionCaseV0Kind(Box::new(
60984                serde::de::Deserialize::deserialize(r)?,
60985            ))),
60986            TypeVariant::ScSpecUdtUnionCaseV0 => Ok(Self::ScSpecUdtUnionCaseV0(Box::new(
60987                serde::de::Deserialize::deserialize(r)?,
60988            ))),
60989            TypeVariant::ScSpecUdtUnionV0 => Ok(Self::ScSpecUdtUnionV0(Box::new(
60990                serde::de::Deserialize::deserialize(r)?,
60991            ))),
60992            TypeVariant::ScSpecUdtEnumCaseV0 => Ok(Self::ScSpecUdtEnumCaseV0(Box::new(
60993                serde::de::Deserialize::deserialize(r)?,
60994            ))),
60995            TypeVariant::ScSpecUdtEnumV0 => Ok(Self::ScSpecUdtEnumV0(Box::new(
60996                serde::de::Deserialize::deserialize(r)?,
60997            ))),
60998            TypeVariant::ScSpecUdtErrorEnumCaseV0 => Ok(Self::ScSpecUdtErrorEnumCaseV0(Box::new(
60999                serde::de::Deserialize::deserialize(r)?,
61000            ))),
61001            TypeVariant::ScSpecUdtErrorEnumV0 => Ok(Self::ScSpecUdtErrorEnumV0(Box::new(
61002                serde::de::Deserialize::deserialize(r)?,
61003            ))),
61004            TypeVariant::ScSpecFunctionInputV0 => Ok(Self::ScSpecFunctionInputV0(Box::new(
61005                serde::de::Deserialize::deserialize(r)?,
61006            ))),
61007            TypeVariant::ScSpecFunctionV0 => Ok(Self::ScSpecFunctionV0(Box::new(
61008                serde::de::Deserialize::deserialize(r)?,
61009            ))),
61010            TypeVariant::ScSpecEntryKind => Ok(Self::ScSpecEntryKind(Box::new(
61011                serde::de::Deserialize::deserialize(r)?,
61012            ))),
61013            TypeVariant::ScSpecEntry => Ok(Self::ScSpecEntry(Box::new(
61014                serde::de::Deserialize::deserialize(r)?,
61015            ))),
61016            TypeVariant::ScValType => Ok(Self::ScValType(Box::new(
61017                serde::de::Deserialize::deserialize(r)?,
61018            ))),
61019            TypeVariant::ScErrorType => Ok(Self::ScErrorType(Box::new(
61020                serde::de::Deserialize::deserialize(r)?,
61021            ))),
61022            TypeVariant::ScErrorCode => Ok(Self::ScErrorCode(Box::new(
61023                serde::de::Deserialize::deserialize(r)?,
61024            ))),
61025            TypeVariant::ScError => Ok(Self::ScError(Box::new(
61026                serde::de::Deserialize::deserialize(r)?,
61027            ))),
61028            TypeVariant::UInt128Parts => Ok(Self::UInt128Parts(Box::new(
61029                serde::de::Deserialize::deserialize(r)?,
61030            ))),
61031            TypeVariant::Int128Parts => Ok(Self::Int128Parts(Box::new(
61032                serde::de::Deserialize::deserialize(r)?,
61033            ))),
61034            TypeVariant::UInt256Parts => Ok(Self::UInt256Parts(Box::new(
61035                serde::de::Deserialize::deserialize(r)?,
61036            ))),
61037            TypeVariant::Int256Parts => Ok(Self::Int256Parts(Box::new(
61038                serde::de::Deserialize::deserialize(r)?,
61039            ))),
61040            TypeVariant::ContractExecutableType => Ok(Self::ContractExecutableType(Box::new(
61041                serde::de::Deserialize::deserialize(r)?,
61042            ))),
61043            TypeVariant::ContractExecutable => Ok(Self::ContractExecutable(Box::new(
61044                serde::de::Deserialize::deserialize(r)?,
61045            ))),
61046            TypeVariant::ScAddressType => Ok(Self::ScAddressType(Box::new(
61047                serde::de::Deserialize::deserialize(r)?,
61048            ))),
61049            TypeVariant::ScAddress => Ok(Self::ScAddress(Box::new(
61050                serde::de::Deserialize::deserialize(r)?,
61051            ))),
61052            TypeVariant::ScVec => Ok(Self::ScVec(Box::new(serde::de::Deserialize::deserialize(
61053                r,
61054            )?))),
61055            TypeVariant::ScMap => Ok(Self::ScMap(Box::new(serde::de::Deserialize::deserialize(
61056                r,
61057            )?))),
61058            TypeVariant::ScBytes => Ok(Self::ScBytes(Box::new(
61059                serde::de::Deserialize::deserialize(r)?,
61060            ))),
61061            TypeVariant::ScString => Ok(Self::ScString(Box::new(
61062                serde::de::Deserialize::deserialize(r)?,
61063            ))),
61064            TypeVariant::ScSymbol => Ok(Self::ScSymbol(Box::new(
61065                serde::de::Deserialize::deserialize(r)?,
61066            ))),
61067            TypeVariant::ScNonceKey => Ok(Self::ScNonceKey(Box::new(
61068                serde::de::Deserialize::deserialize(r)?,
61069            ))),
61070            TypeVariant::ScContractInstance => Ok(Self::ScContractInstance(Box::new(
61071                serde::de::Deserialize::deserialize(r)?,
61072            ))),
61073            TypeVariant::ScVal => Ok(Self::ScVal(Box::new(serde::de::Deserialize::deserialize(
61074                r,
61075            )?))),
61076            TypeVariant::ScMapEntry => Ok(Self::ScMapEntry(Box::new(
61077                serde::de::Deserialize::deserialize(r)?,
61078            ))),
61079            TypeVariant::StoredTransactionSet => Ok(Self::StoredTransactionSet(Box::new(
61080                serde::de::Deserialize::deserialize(r)?,
61081            ))),
61082            TypeVariant::StoredDebugTransactionSet => Ok(Self::StoredDebugTransactionSet(
61083                Box::new(serde::de::Deserialize::deserialize(r)?),
61084            )),
61085            TypeVariant::PersistedScpStateV0 => Ok(Self::PersistedScpStateV0(Box::new(
61086                serde::de::Deserialize::deserialize(r)?,
61087            ))),
61088            TypeVariant::PersistedScpStateV1 => Ok(Self::PersistedScpStateV1(Box::new(
61089                serde::de::Deserialize::deserialize(r)?,
61090            ))),
61091            TypeVariant::PersistedScpState => Ok(Self::PersistedScpState(Box::new(
61092                serde::de::Deserialize::deserialize(r)?,
61093            ))),
61094            TypeVariant::Thresholds => Ok(Self::Thresholds(Box::new(
61095                serde::de::Deserialize::deserialize(r)?,
61096            ))),
61097            TypeVariant::String32 => Ok(Self::String32(Box::new(
61098                serde::de::Deserialize::deserialize(r)?,
61099            ))),
61100            TypeVariant::String64 => Ok(Self::String64(Box::new(
61101                serde::de::Deserialize::deserialize(r)?,
61102            ))),
61103            TypeVariant::SequenceNumber => Ok(Self::SequenceNumber(Box::new(
61104                serde::de::Deserialize::deserialize(r)?,
61105            ))),
61106            TypeVariant::DataValue => Ok(Self::DataValue(Box::new(
61107                serde::de::Deserialize::deserialize(r)?,
61108            ))),
61109            TypeVariant::PoolId => Ok(Self::PoolId(Box::new(serde::de::Deserialize::deserialize(
61110                r,
61111            )?))),
61112            TypeVariant::AssetCode4 => Ok(Self::AssetCode4(Box::new(
61113                serde::de::Deserialize::deserialize(r)?,
61114            ))),
61115            TypeVariant::AssetCode12 => Ok(Self::AssetCode12(Box::new(
61116                serde::de::Deserialize::deserialize(r)?,
61117            ))),
61118            TypeVariant::AssetType => Ok(Self::AssetType(Box::new(
61119                serde::de::Deserialize::deserialize(r)?,
61120            ))),
61121            TypeVariant::AssetCode => Ok(Self::AssetCode(Box::new(
61122                serde::de::Deserialize::deserialize(r)?,
61123            ))),
61124            TypeVariant::AlphaNum4 => Ok(Self::AlphaNum4(Box::new(
61125                serde::de::Deserialize::deserialize(r)?,
61126            ))),
61127            TypeVariant::AlphaNum12 => Ok(Self::AlphaNum12(Box::new(
61128                serde::de::Deserialize::deserialize(r)?,
61129            ))),
61130            TypeVariant::Asset => Ok(Self::Asset(Box::new(serde::de::Deserialize::deserialize(
61131                r,
61132            )?))),
61133            TypeVariant::Price => Ok(Self::Price(Box::new(serde::de::Deserialize::deserialize(
61134                r,
61135            )?))),
61136            TypeVariant::Liabilities => Ok(Self::Liabilities(Box::new(
61137                serde::de::Deserialize::deserialize(r)?,
61138            ))),
61139            TypeVariant::ThresholdIndexes => Ok(Self::ThresholdIndexes(Box::new(
61140                serde::de::Deserialize::deserialize(r)?,
61141            ))),
61142            TypeVariant::LedgerEntryType => Ok(Self::LedgerEntryType(Box::new(
61143                serde::de::Deserialize::deserialize(r)?,
61144            ))),
61145            TypeVariant::Signer => Ok(Self::Signer(Box::new(serde::de::Deserialize::deserialize(
61146                r,
61147            )?))),
61148            TypeVariant::AccountFlags => Ok(Self::AccountFlags(Box::new(
61149                serde::de::Deserialize::deserialize(r)?,
61150            ))),
61151            TypeVariant::SponsorshipDescriptor => Ok(Self::SponsorshipDescriptor(Box::new(
61152                serde::de::Deserialize::deserialize(r)?,
61153            ))),
61154            TypeVariant::AccountEntryExtensionV3 => Ok(Self::AccountEntryExtensionV3(Box::new(
61155                serde::de::Deserialize::deserialize(r)?,
61156            ))),
61157            TypeVariant::AccountEntryExtensionV2 => Ok(Self::AccountEntryExtensionV2(Box::new(
61158                serde::de::Deserialize::deserialize(r)?,
61159            ))),
61160            TypeVariant::AccountEntryExtensionV2Ext => Ok(Self::AccountEntryExtensionV2Ext(
61161                Box::new(serde::de::Deserialize::deserialize(r)?),
61162            )),
61163            TypeVariant::AccountEntryExtensionV1 => Ok(Self::AccountEntryExtensionV1(Box::new(
61164                serde::de::Deserialize::deserialize(r)?,
61165            ))),
61166            TypeVariant::AccountEntryExtensionV1Ext => Ok(Self::AccountEntryExtensionV1Ext(
61167                Box::new(serde::de::Deserialize::deserialize(r)?),
61168            )),
61169            TypeVariant::AccountEntry => Ok(Self::AccountEntry(Box::new(
61170                serde::de::Deserialize::deserialize(r)?,
61171            ))),
61172            TypeVariant::AccountEntryExt => Ok(Self::AccountEntryExt(Box::new(
61173                serde::de::Deserialize::deserialize(r)?,
61174            ))),
61175            TypeVariant::TrustLineFlags => Ok(Self::TrustLineFlags(Box::new(
61176                serde::de::Deserialize::deserialize(r)?,
61177            ))),
61178            TypeVariant::LiquidityPoolType => Ok(Self::LiquidityPoolType(Box::new(
61179                serde::de::Deserialize::deserialize(r)?,
61180            ))),
61181            TypeVariant::TrustLineAsset => Ok(Self::TrustLineAsset(Box::new(
61182                serde::de::Deserialize::deserialize(r)?,
61183            ))),
61184            TypeVariant::TrustLineEntryExtensionV2 => Ok(Self::TrustLineEntryExtensionV2(
61185                Box::new(serde::de::Deserialize::deserialize(r)?),
61186            )),
61187            TypeVariant::TrustLineEntryExtensionV2Ext => Ok(Self::TrustLineEntryExtensionV2Ext(
61188                Box::new(serde::de::Deserialize::deserialize(r)?),
61189            )),
61190            TypeVariant::TrustLineEntry => Ok(Self::TrustLineEntry(Box::new(
61191                serde::de::Deserialize::deserialize(r)?,
61192            ))),
61193            TypeVariant::TrustLineEntryExt => Ok(Self::TrustLineEntryExt(Box::new(
61194                serde::de::Deserialize::deserialize(r)?,
61195            ))),
61196            TypeVariant::TrustLineEntryV1 => Ok(Self::TrustLineEntryV1(Box::new(
61197                serde::de::Deserialize::deserialize(r)?,
61198            ))),
61199            TypeVariant::TrustLineEntryV1Ext => Ok(Self::TrustLineEntryV1Ext(Box::new(
61200                serde::de::Deserialize::deserialize(r)?,
61201            ))),
61202            TypeVariant::OfferEntryFlags => Ok(Self::OfferEntryFlags(Box::new(
61203                serde::de::Deserialize::deserialize(r)?,
61204            ))),
61205            TypeVariant::OfferEntry => Ok(Self::OfferEntry(Box::new(
61206                serde::de::Deserialize::deserialize(r)?,
61207            ))),
61208            TypeVariant::OfferEntryExt => Ok(Self::OfferEntryExt(Box::new(
61209                serde::de::Deserialize::deserialize(r)?,
61210            ))),
61211            TypeVariant::DataEntry => Ok(Self::DataEntry(Box::new(
61212                serde::de::Deserialize::deserialize(r)?,
61213            ))),
61214            TypeVariant::DataEntryExt => Ok(Self::DataEntryExt(Box::new(
61215                serde::de::Deserialize::deserialize(r)?,
61216            ))),
61217            TypeVariant::ClaimPredicateType => Ok(Self::ClaimPredicateType(Box::new(
61218                serde::de::Deserialize::deserialize(r)?,
61219            ))),
61220            TypeVariant::ClaimPredicate => Ok(Self::ClaimPredicate(Box::new(
61221                serde::de::Deserialize::deserialize(r)?,
61222            ))),
61223            TypeVariant::ClaimantType => Ok(Self::ClaimantType(Box::new(
61224                serde::de::Deserialize::deserialize(r)?,
61225            ))),
61226            TypeVariant::Claimant => Ok(Self::Claimant(Box::new(
61227                serde::de::Deserialize::deserialize(r)?,
61228            ))),
61229            TypeVariant::ClaimantV0 => Ok(Self::ClaimantV0(Box::new(
61230                serde::de::Deserialize::deserialize(r)?,
61231            ))),
61232            TypeVariant::ClaimableBalanceIdType => Ok(Self::ClaimableBalanceIdType(Box::new(
61233                serde::de::Deserialize::deserialize(r)?,
61234            ))),
61235            TypeVariant::ClaimableBalanceId => Ok(Self::ClaimableBalanceId(Box::new(
61236                serde::de::Deserialize::deserialize(r)?,
61237            ))),
61238            TypeVariant::ClaimableBalanceFlags => Ok(Self::ClaimableBalanceFlags(Box::new(
61239                serde::de::Deserialize::deserialize(r)?,
61240            ))),
61241            TypeVariant::ClaimableBalanceEntryExtensionV1 => {
61242                Ok(Self::ClaimableBalanceEntryExtensionV1(Box::new(
61243                    serde::de::Deserialize::deserialize(r)?,
61244                )))
61245            }
61246            TypeVariant::ClaimableBalanceEntryExtensionV1Ext => {
61247                Ok(Self::ClaimableBalanceEntryExtensionV1Ext(Box::new(
61248                    serde::de::Deserialize::deserialize(r)?,
61249                )))
61250            }
61251            TypeVariant::ClaimableBalanceEntry => Ok(Self::ClaimableBalanceEntry(Box::new(
61252                serde::de::Deserialize::deserialize(r)?,
61253            ))),
61254            TypeVariant::ClaimableBalanceEntryExt => Ok(Self::ClaimableBalanceEntryExt(Box::new(
61255                serde::de::Deserialize::deserialize(r)?,
61256            ))),
61257            TypeVariant::LiquidityPoolConstantProductParameters => {
61258                Ok(Self::LiquidityPoolConstantProductParameters(Box::new(
61259                    serde::de::Deserialize::deserialize(r)?,
61260                )))
61261            }
61262            TypeVariant::LiquidityPoolEntry => Ok(Self::LiquidityPoolEntry(Box::new(
61263                serde::de::Deserialize::deserialize(r)?,
61264            ))),
61265            TypeVariant::LiquidityPoolEntryBody => Ok(Self::LiquidityPoolEntryBody(Box::new(
61266                serde::de::Deserialize::deserialize(r)?,
61267            ))),
61268            TypeVariant::LiquidityPoolEntryConstantProduct => {
61269                Ok(Self::LiquidityPoolEntryConstantProduct(Box::new(
61270                    serde::de::Deserialize::deserialize(r)?,
61271                )))
61272            }
61273            TypeVariant::ContractDataDurability => Ok(Self::ContractDataDurability(Box::new(
61274                serde::de::Deserialize::deserialize(r)?,
61275            ))),
61276            TypeVariant::ContractDataEntry => Ok(Self::ContractDataEntry(Box::new(
61277                serde::de::Deserialize::deserialize(r)?,
61278            ))),
61279            TypeVariant::ContractCodeCostInputs => Ok(Self::ContractCodeCostInputs(Box::new(
61280                serde::de::Deserialize::deserialize(r)?,
61281            ))),
61282            TypeVariant::ContractCodeEntry => Ok(Self::ContractCodeEntry(Box::new(
61283                serde::de::Deserialize::deserialize(r)?,
61284            ))),
61285            TypeVariant::ContractCodeEntryExt => Ok(Self::ContractCodeEntryExt(Box::new(
61286                serde::de::Deserialize::deserialize(r)?,
61287            ))),
61288            TypeVariant::ContractCodeEntryV1 => Ok(Self::ContractCodeEntryV1(Box::new(
61289                serde::de::Deserialize::deserialize(r)?,
61290            ))),
61291            TypeVariant::TtlEntry => Ok(Self::TtlEntry(Box::new(
61292                serde::de::Deserialize::deserialize(r)?,
61293            ))),
61294            TypeVariant::LedgerEntryExtensionV1 => Ok(Self::LedgerEntryExtensionV1(Box::new(
61295                serde::de::Deserialize::deserialize(r)?,
61296            ))),
61297            TypeVariant::LedgerEntryExtensionV1Ext => Ok(Self::LedgerEntryExtensionV1Ext(
61298                Box::new(serde::de::Deserialize::deserialize(r)?),
61299            )),
61300            TypeVariant::LedgerEntry => Ok(Self::LedgerEntry(Box::new(
61301                serde::de::Deserialize::deserialize(r)?,
61302            ))),
61303            TypeVariant::LedgerEntryData => Ok(Self::LedgerEntryData(Box::new(
61304                serde::de::Deserialize::deserialize(r)?,
61305            ))),
61306            TypeVariant::LedgerEntryExt => Ok(Self::LedgerEntryExt(Box::new(
61307                serde::de::Deserialize::deserialize(r)?,
61308            ))),
61309            TypeVariant::LedgerKey => Ok(Self::LedgerKey(Box::new(
61310                serde::de::Deserialize::deserialize(r)?,
61311            ))),
61312            TypeVariant::LedgerKeyAccount => Ok(Self::LedgerKeyAccount(Box::new(
61313                serde::de::Deserialize::deserialize(r)?,
61314            ))),
61315            TypeVariant::LedgerKeyTrustLine => Ok(Self::LedgerKeyTrustLine(Box::new(
61316                serde::de::Deserialize::deserialize(r)?,
61317            ))),
61318            TypeVariant::LedgerKeyOffer => Ok(Self::LedgerKeyOffer(Box::new(
61319                serde::de::Deserialize::deserialize(r)?,
61320            ))),
61321            TypeVariant::LedgerKeyData => Ok(Self::LedgerKeyData(Box::new(
61322                serde::de::Deserialize::deserialize(r)?,
61323            ))),
61324            TypeVariant::LedgerKeyClaimableBalance => Ok(Self::LedgerKeyClaimableBalance(
61325                Box::new(serde::de::Deserialize::deserialize(r)?),
61326            )),
61327            TypeVariant::LedgerKeyLiquidityPool => Ok(Self::LedgerKeyLiquidityPool(Box::new(
61328                serde::de::Deserialize::deserialize(r)?,
61329            ))),
61330            TypeVariant::LedgerKeyContractData => Ok(Self::LedgerKeyContractData(Box::new(
61331                serde::de::Deserialize::deserialize(r)?,
61332            ))),
61333            TypeVariant::LedgerKeyContractCode => Ok(Self::LedgerKeyContractCode(Box::new(
61334                serde::de::Deserialize::deserialize(r)?,
61335            ))),
61336            TypeVariant::LedgerKeyConfigSetting => Ok(Self::LedgerKeyConfigSetting(Box::new(
61337                serde::de::Deserialize::deserialize(r)?,
61338            ))),
61339            TypeVariant::LedgerKeyTtl => Ok(Self::LedgerKeyTtl(Box::new(
61340                serde::de::Deserialize::deserialize(r)?,
61341            ))),
61342            TypeVariant::EnvelopeType => Ok(Self::EnvelopeType(Box::new(
61343                serde::de::Deserialize::deserialize(r)?,
61344            ))),
61345            TypeVariant::BucketListType => Ok(Self::BucketListType(Box::new(
61346                serde::de::Deserialize::deserialize(r)?,
61347            ))),
61348            TypeVariant::BucketEntryType => Ok(Self::BucketEntryType(Box::new(
61349                serde::de::Deserialize::deserialize(r)?,
61350            ))),
61351            TypeVariant::HotArchiveBucketEntryType => Ok(Self::HotArchiveBucketEntryType(
61352                Box::new(serde::de::Deserialize::deserialize(r)?),
61353            )),
61354            TypeVariant::ColdArchiveBucketEntryType => Ok(Self::ColdArchiveBucketEntryType(
61355                Box::new(serde::de::Deserialize::deserialize(r)?),
61356            )),
61357            TypeVariant::BucketMetadata => Ok(Self::BucketMetadata(Box::new(
61358                serde::de::Deserialize::deserialize(r)?,
61359            ))),
61360            TypeVariant::BucketMetadataExt => Ok(Self::BucketMetadataExt(Box::new(
61361                serde::de::Deserialize::deserialize(r)?,
61362            ))),
61363            TypeVariant::BucketEntry => Ok(Self::BucketEntry(Box::new(
61364                serde::de::Deserialize::deserialize(r)?,
61365            ))),
61366            TypeVariant::HotArchiveBucketEntry => Ok(Self::HotArchiveBucketEntry(Box::new(
61367                serde::de::Deserialize::deserialize(r)?,
61368            ))),
61369            TypeVariant::ColdArchiveArchivedLeaf => Ok(Self::ColdArchiveArchivedLeaf(Box::new(
61370                serde::de::Deserialize::deserialize(r)?,
61371            ))),
61372            TypeVariant::ColdArchiveDeletedLeaf => Ok(Self::ColdArchiveDeletedLeaf(Box::new(
61373                serde::de::Deserialize::deserialize(r)?,
61374            ))),
61375            TypeVariant::ColdArchiveBoundaryLeaf => Ok(Self::ColdArchiveBoundaryLeaf(Box::new(
61376                serde::de::Deserialize::deserialize(r)?,
61377            ))),
61378            TypeVariant::ColdArchiveHashEntry => Ok(Self::ColdArchiveHashEntry(Box::new(
61379                serde::de::Deserialize::deserialize(r)?,
61380            ))),
61381            TypeVariant::ColdArchiveBucketEntry => Ok(Self::ColdArchiveBucketEntry(Box::new(
61382                serde::de::Deserialize::deserialize(r)?,
61383            ))),
61384            TypeVariant::UpgradeType => Ok(Self::UpgradeType(Box::new(
61385                serde::de::Deserialize::deserialize(r)?,
61386            ))),
61387            TypeVariant::StellarValueType => Ok(Self::StellarValueType(Box::new(
61388                serde::de::Deserialize::deserialize(r)?,
61389            ))),
61390            TypeVariant::LedgerCloseValueSignature => Ok(Self::LedgerCloseValueSignature(
61391                Box::new(serde::de::Deserialize::deserialize(r)?),
61392            )),
61393            TypeVariant::StellarValue => Ok(Self::StellarValue(Box::new(
61394                serde::de::Deserialize::deserialize(r)?,
61395            ))),
61396            TypeVariant::StellarValueExt => Ok(Self::StellarValueExt(Box::new(
61397                serde::de::Deserialize::deserialize(r)?,
61398            ))),
61399            TypeVariant::LedgerHeaderFlags => Ok(Self::LedgerHeaderFlags(Box::new(
61400                serde::de::Deserialize::deserialize(r)?,
61401            ))),
61402            TypeVariant::LedgerHeaderExtensionV1 => Ok(Self::LedgerHeaderExtensionV1(Box::new(
61403                serde::de::Deserialize::deserialize(r)?,
61404            ))),
61405            TypeVariant::LedgerHeaderExtensionV1Ext => Ok(Self::LedgerHeaderExtensionV1Ext(
61406                Box::new(serde::de::Deserialize::deserialize(r)?),
61407            )),
61408            TypeVariant::LedgerHeader => Ok(Self::LedgerHeader(Box::new(
61409                serde::de::Deserialize::deserialize(r)?,
61410            ))),
61411            TypeVariant::LedgerHeaderExt => Ok(Self::LedgerHeaderExt(Box::new(
61412                serde::de::Deserialize::deserialize(r)?,
61413            ))),
61414            TypeVariant::LedgerUpgradeType => Ok(Self::LedgerUpgradeType(Box::new(
61415                serde::de::Deserialize::deserialize(r)?,
61416            ))),
61417            TypeVariant::ConfigUpgradeSetKey => Ok(Self::ConfigUpgradeSetKey(Box::new(
61418                serde::de::Deserialize::deserialize(r)?,
61419            ))),
61420            TypeVariant::LedgerUpgrade => Ok(Self::LedgerUpgrade(Box::new(
61421                serde::de::Deserialize::deserialize(r)?,
61422            ))),
61423            TypeVariant::ConfigUpgradeSet => Ok(Self::ConfigUpgradeSet(Box::new(
61424                serde::de::Deserialize::deserialize(r)?,
61425            ))),
61426            TypeVariant::TxSetComponentType => Ok(Self::TxSetComponentType(Box::new(
61427                serde::de::Deserialize::deserialize(r)?,
61428            ))),
61429            TypeVariant::TxExecutionThread => Ok(Self::TxExecutionThread(Box::new(
61430                serde::de::Deserialize::deserialize(r)?,
61431            ))),
61432            TypeVariant::ParallelTxExecutionStage => Ok(Self::ParallelTxExecutionStage(Box::new(
61433                serde::de::Deserialize::deserialize(r)?,
61434            ))),
61435            TypeVariant::ParallelTxsComponent => Ok(Self::ParallelTxsComponent(Box::new(
61436                serde::de::Deserialize::deserialize(r)?,
61437            ))),
61438            TypeVariant::TxSetComponent => Ok(Self::TxSetComponent(Box::new(
61439                serde::de::Deserialize::deserialize(r)?,
61440            ))),
61441            TypeVariant::TxSetComponentTxsMaybeDiscountedFee => {
61442                Ok(Self::TxSetComponentTxsMaybeDiscountedFee(Box::new(
61443                    serde::de::Deserialize::deserialize(r)?,
61444                )))
61445            }
61446            TypeVariant::TransactionPhase => Ok(Self::TransactionPhase(Box::new(
61447                serde::de::Deserialize::deserialize(r)?,
61448            ))),
61449            TypeVariant::TransactionSet => Ok(Self::TransactionSet(Box::new(
61450                serde::de::Deserialize::deserialize(r)?,
61451            ))),
61452            TypeVariant::TransactionSetV1 => Ok(Self::TransactionSetV1(Box::new(
61453                serde::de::Deserialize::deserialize(r)?,
61454            ))),
61455            TypeVariant::GeneralizedTransactionSet => Ok(Self::GeneralizedTransactionSet(
61456                Box::new(serde::de::Deserialize::deserialize(r)?),
61457            )),
61458            TypeVariant::TransactionResultPair => Ok(Self::TransactionResultPair(Box::new(
61459                serde::de::Deserialize::deserialize(r)?,
61460            ))),
61461            TypeVariant::TransactionResultSet => Ok(Self::TransactionResultSet(Box::new(
61462                serde::de::Deserialize::deserialize(r)?,
61463            ))),
61464            TypeVariant::TransactionHistoryEntry => Ok(Self::TransactionHistoryEntry(Box::new(
61465                serde::de::Deserialize::deserialize(r)?,
61466            ))),
61467            TypeVariant::TransactionHistoryEntryExt => Ok(Self::TransactionHistoryEntryExt(
61468                Box::new(serde::de::Deserialize::deserialize(r)?),
61469            )),
61470            TypeVariant::TransactionHistoryResultEntry => Ok(Self::TransactionHistoryResultEntry(
61471                Box::new(serde::de::Deserialize::deserialize(r)?),
61472            )),
61473            TypeVariant::TransactionHistoryResultEntryExt => {
61474                Ok(Self::TransactionHistoryResultEntryExt(Box::new(
61475                    serde::de::Deserialize::deserialize(r)?,
61476                )))
61477            }
61478            TypeVariant::LedgerHeaderHistoryEntry => Ok(Self::LedgerHeaderHistoryEntry(Box::new(
61479                serde::de::Deserialize::deserialize(r)?,
61480            ))),
61481            TypeVariant::LedgerHeaderHistoryEntryExt => Ok(Self::LedgerHeaderHistoryEntryExt(
61482                Box::new(serde::de::Deserialize::deserialize(r)?),
61483            )),
61484            TypeVariant::LedgerScpMessages => Ok(Self::LedgerScpMessages(Box::new(
61485                serde::de::Deserialize::deserialize(r)?,
61486            ))),
61487            TypeVariant::ScpHistoryEntryV0 => Ok(Self::ScpHistoryEntryV0(Box::new(
61488                serde::de::Deserialize::deserialize(r)?,
61489            ))),
61490            TypeVariant::ScpHistoryEntry => Ok(Self::ScpHistoryEntry(Box::new(
61491                serde::de::Deserialize::deserialize(r)?,
61492            ))),
61493            TypeVariant::LedgerEntryChangeType => Ok(Self::LedgerEntryChangeType(Box::new(
61494                serde::de::Deserialize::deserialize(r)?,
61495            ))),
61496            TypeVariant::LedgerEntryChange => Ok(Self::LedgerEntryChange(Box::new(
61497                serde::de::Deserialize::deserialize(r)?,
61498            ))),
61499            TypeVariant::LedgerEntryChanges => Ok(Self::LedgerEntryChanges(Box::new(
61500                serde::de::Deserialize::deserialize(r)?,
61501            ))),
61502            TypeVariant::OperationMeta => Ok(Self::OperationMeta(Box::new(
61503                serde::de::Deserialize::deserialize(r)?,
61504            ))),
61505            TypeVariant::TransactionMetaV1 => Ok(Self::TransactionMetaV1(Box::new(
61506                serde::de::Deserialize::deserialize(r)?,
61507            ))),
61508            TypeVariant::TransactionMetaV2 => Ok(Self::TransactionMetaV2(Box::new(
61509                serde::de::Deserialize::deserialize(r)?,
61510            ))),
61511            TypeVariant::ContractEventType => Ok(Self::ContractEventType(Box::new(
61512                serde::de::Deserialize::deserialize(r)?,
61513            ))),
61514            TypeVariant::ContractEvent => Ok(Self::ContractEvent(Box::new(
61515                serde::de::Deserialize::deserialize(r)?,
61516            ))),
61517            TypeVariant::ContractEventBody => Ok(Self::ContractEventBody(Box::new(
61518                serde::de::Deserialize::deserialize(r)?,
61519            ))),
61520            TypeVariant::ContractEventV0 => Ok(Self::ContractEventV0(Box::new(
61521                serde::de::Deserialize::deserialize(r)?,
61522            ))),
61523            TypeVariant::DiagnosticEvent => Ok(Self::DiagnosticEvent(Box::new(
61524                serde::de::Deserialize::deserialize(r)?,
61525            ))),
61526            TypeVariant::SorobanTransactionMetaExtV1 => Ok(Self::SorobanTransactionMetaExtV1(
61527                Box::new(serde::de::Deserialize::deserialize(r)?),
61528            )),
61529            TypeVariant::SorobanTransactionMetaExt => Ok(Self::SorobanTransactionMetaExt(
61530                Box::new(serde::de::Deserialize::deserialize(r)?),
61531            )),
61532            TypeVariant::SorobanTransactionMeta => Ok(Self::SorobanTransactionMeta(Box::new(
61533                serde::de::Deserialize::deserialize(r)?,
61534            ))),
61535            TypeVariant::TransactionMetaV3 => Ok(Self::TransactionMetaV3(Box::new(
61536                serde::de::Deserialize::deserialize(r)?,
61537            ))),
61538            TypeVariant::InvokeHostFunctionSuccessPreImage => {
61539                Ok(Self::InvokeHostFunctionSuccessPreImage(Box::new(
61540                    serde::de::Deserialize::deserialize(r)?,
61541                )))
61542            }
61543            TypeVariant::TransactionMeta => Ok(Self::TransactionMeta(Box::new(
61544                serde::de::Deserialize::deserialize(r)?,
61545            ))),
61546            TypeVariant::TransactionResultMeta => Ok(Self::TransactionResultMeta(Box::new(
61547                serde::de::Deserialize::deserialize(r)?,
61548            ))),
61549            TypeVariant::UpgradeEntryMeta => Ok(Self::UpgradeEntryMeta(Box::new(
61550                serde::de::Deserialize::deserialize(r)?,
61551            ))),
61552            TypeVariant::LedgerCloseMetaV0 => Ok(Self::LedgerCloseMetaV0(Box::new(
61553                serde::de::Deserialize::deserialize(r)?,
61554            ))),
61555            TypeVariant::LedgerCloseMetaExtV1 => Ok(Self::LedgerCloseMetaExtV1(Box::new(
61556                serde::de::Deserialize::deserialize(r)?,
61557            ))),
61558            TypeVariant::LedgerCloseMetaExtV2 => Ok(Self::LedgerCloseMetaExtV2(Box::new(
61559                serde::de::Deserialize::deserialize(r)?,
61560            ))),
61561            TypeVariant::LedgerCloseMetaExt => Ok(Self::LedgerCloseMetaExt(Box::new(
61562                serde::de::Deserialize::deserialize(r)?,
61563            ))),
61564            TypeVariant::LedgerCloseMetaV1 => Ok(Self::LedgerCloseMetaV1(Box::new(
61565                serde::de::Deserialize::deserialize(r)?,
61566            ))),
61567            TypeVariant::LedgerCloseMeta => Ok(Self::LedgerCloseMeta(Box::new(
61568                serde::de::Deserialize::deserialize(r)?,
61569            ))),
61570            TypeVariant::ErrorCode => Ok(Self::ErrorCode(Box::new(
61571                serde::de::Deserialize::deserialize(r)?,
61572            ))),
61573            TypeVariant::SError => Ok(Self::SError(Box::new(serde::de::Deserialize::deserialize(
61574                r,
61575            )?))),
61576            TypeVariant::SendMore => Ok(Self::SendMore(Box::new(
61577                serde::de::Deserialize::deserialize(r)?,
61578            ))),
61579            TypeVariant::SendMoreExtended => Ok(Self::SendMoreExtended(Box::new(
61580                serde::de::Deserialize::deserialize(r)?,
61581            ))),
61582            TypeVariant::AuthCert => Ok(Self::AuthCert(Box::new(
61583                serde::de::Deserialize::deserialize(r)?,
61584            ))),
61585            TypeVariant::Hello => Ok(Self::Hello(Box::new(serde::de::Deserialize::deserialize(
61586                r,
61587            )?))),
61588            TypeVariant::Auth => Ok(Self::Auth(Box::new(serde::de::Deserialize::deserialize(
61589                r,
61590            )?))),
61591            TypeVariant::IpAddrType => Ok(Self::IpAddrType(Box::new(
61592                serde::de::Deserialize::deserialize(r)?,
61593            ))),
61594            TypeVariant::PeerAddress => Ok(Self::PeerAddress(Box::new(
61595                serde::de::Deserialize::deserialize(r)?,
61596            ))),
61597            TypeVariant::PeerAddressIp => Ok(Self::PeerAddressIp(Box::new(
61598                serde::de::Deserialize::deserialize(r)?,
61599            ))),
61600            TypeVariant::MessageType => Ok(Self::MessageType(Box::new(
61601                serde::de::Deserialize::deserialize(r)?,
61602            ))),
61603            TypeVariant::DontHave => Ok(Self::DontHave(Box::new(
61604                serde::de::Deserialize::deserialize(r)?,
61605            ))),
61606            TypeVariant::SurveyMessageCommandType => Ok(Self::SurveyMessageCommandType(Box::new(
61607                serde::de::Deserialize::deserialize(r)?,
61608            ))),
61609            TypeVariant::SurveyMessageResponseType => Ok(Self::SurveyMessageResponseType(
61610                Box::new(serde::de::Deserialize::deserialize(r)?),
61611            )),
61612            TypeVariant::TimeSlicedSurveyStartCollectingMessage => {
61613                Ok(Self::TimeSlicedSurveyStartCollectingMessage(Box::new(
61614                    serde::de::Deserialize::deserialize(r)?,
61615                )))
61616            }
61617            TypeVariant::SignedTimeSlicedSurveyStartCollectingMessage => {
61618                Ok(Self::SignedTimeSlicedSurveyStartCollectingMessage(
61619                    Box::new(serde::de::Deserialize::deserialize(r)?),
61620                ))
61621            }
61622            TypeVariant::TimeSlicedSurveyStopCollectingMessage => {
61623                Ok(Self::TimeSlicedSurveyStopCollectingMessage(Box::new(
61624                    serde::de::Deserialize::deserialize(r)?,
61625                )))
61626            }
61627            TypeVariant::SignedTimeSlicedSurveyStopCollectingMessage => {
61628                Ok(Self::SignedTimeSlicedSurveyStopCollectingMessage(Box::new(
61629                    serde::de::Deserialize::deserialize(r)?,
61630                )))
61631            }
61632            TypeVariant::SurveyRequestMessage => Ok(Self::SurveyRequestMessage(Box::new(
61633                serde::de::Deserialize::deserialize(r)?,
61634            ))),
61635            TypeVariant::TimeSlicedSurveyRequestMessage => {
61636                Ok(Self::TimeSlicedSurveyRequestMessage(Box::new(
61637                    serde::de::Deserialize::deserialize(r)?,
61638                )))
61639            }
61640            TypeVariant::SignedSurveyRequestMessage => Ok(Self::SignedSurveyRequestMessage(
61641                Box::new(serde::de::Deserialize::deserialize(r)?),
61642            )),
61643            TypeVariant::SignedTimeSlicedSurveyRequestMessage => {
61644                Ok(Self::SignedTimeSlicedSurveyRequestMessage(Box::new(
61645                    serde::de::Deserialize::deserialize(r)?,
61646                )))
61647            }
61648            TypeVariant::EncryptedBody => Ok(Self::EncryptedBody(Box::new(
61649                serde::de::Deserialize::deserialize(r)?,
61650            ))),
61651            TypeVariant::SurveyResponseMessage => Ok(Self::SurveyResponseMessage(Box::new(
61652                serde::de::Deserialize::deserialize(r)?,
61653            ))),
61654            TypeVariant::TimeSlicedSurveyResponseMessage => {
61655                Ok(Self::TimeSlicedSurveyResponseMessage(Box::new(
61656                    serde::de::Deserialize::deserialize(r)?,
61657                )))
61658            }
61659            TypeVariant::SignedSurveyResponseMessage => Ok(Self::SignedSurveyResponseMessage(
61660                Box::new(serde::de::Deserialize::deserialize(r)?),
61661            )),
61662            TypeVariant::SignedTimeSlicedSurveyResponseMessage => {
61663                Ok(Self::SignedTimeSlicedSurveyResponseMessage(Box::new(
61664                    serde::de::Deserialize::deserialize(r)?,
61665                )))
61666            }
61667            TypeVariant::PeerStats => Ok(Self::PeerStats(Box::new(
61668                serde::de::Deserialize::deserialize(r)?,
61669            ))),
61670            TypeVariant::PeerStatList => Ok(Self::PeerStatList(Box::new(
61671                serde::de::Deserialize::deserialize(r)?,
61672            ))),
61673            TypeVariant::TimeSlicedNodeData => Ok(Self::TimeSlicedNodeData(Box::new(
61674                serde::de::Deserialize::deserialize(r)?,
61675            ))),
61676            TypeVariant::TimeSlicedPeerData => Ok(Self::TimeSlicedPeerData(Box::new(
61677                serde::de::Deserialize::deserialize(r)?,
61678            ))),
61679            TypeVariant::TimeSlicedPeerDataList => Ok(Self::TimeSlicedPeerDataList(Box::new(
61680                serde::de::Deserialize::deserialize(r)?,
61681            ))),
61682            TypeVariant::TopologyResponseBodyV0 => Ok(Self::TopologyResponseBodyV0(Box::new(
61683                serde::de::Deserialize::deserialize(r)?,
61684            ))),
61685            TypeVariant::TopologyResponseBodyV1 => Ok(Self::TopologyResponseBodyV1(Box::new(
61686                serde::de::Deserialize::deserialize(r)?,
61687            ))),
61688            TypeVariant::TopologyResponseBodyV2 => Ok(Self::TopologyResponseBodyV2(Box::new(
61689                serde::de::Deserialize::deserialize(r)?,
61690            ))),
61691            TypeVariant::SurveyResponseBody => Ok(Self::SurveyResponseBody(Box::new(
61692                serde::de::Deserialize::deserialize(r)?,
61693            ))),
61694            TypeVariant::TxAdvertVector => Ok(Self::TxAdvertVector(Box::new(
61695                serde::de::Deserialize::deserialize(r)?,
61696            ))),
61697            TypeVariant::FloodAdvert => Ok(Self::FloodAdvert(Box::new(
61698                serde::de::Deserialize::deserialize(r)?,
61699            ))),
61700            TypeVariant::TxDemandVector => Ok(Self::TxDemandVector(Box::new(
61701                serde::de::Deserialize::deserialize(r)?,
61702            ))),
61703            TypeVariant::FloodDemand => Ok(Self::FloodDemand(Box::new(
61704                serde::de::Deserialize::deserialize(r)?,
61705            ))),
61706            TypeVariant::StellarMessage => Ok(Self::StellarMessage(Box::new(
61707                serde::de::Deserialize::deserialize(r)?,
61708            ))),
61709            TypeVariant::AuthenticatedMessage => Ok(Self::AuthenticatedMessage(Box::new(
61710                serde::de::Deserialize::deserialize(r)?,
61711            ))),
61712            TypeVariant::AuthenticatedMessageV0 => Ok(Self::AuthenticatedMessageV0(Box::new(
61713                serde::de::Deserialize::deserialize(r)?,
61714            ))),
61715            TypeVariant::LiquidityPoolParameters => Ok(Self::LiquidityPoolParameters(Box::new(
61716                serde::de::Deserialize::deserialize(r)?,
61717            ))),
61718            TypeVariant::MuxedAccount => Ok(Self::MuxedAccount(Box::new(
61719                serde::de::Deserialize::deserialize(r)?,
61720            ))),
61721            TypeVariant::MuxedAccountMed25519 => Ok(Self::MuxedAccountMed25519(Box::new(
61722                serde::de::Deserialize::deserialize(r)?,
61723            ))),
61724            TypeVariant::DecoratedSignature => Ok(Self::DecoratedSignature(Box::new(
61725                serde::de::Deserialize::deserialize(r)?,
61726            ))),
61727            TypeVariant::OperationType => Ok(Self::OperationType(Box::new(
61728                serde::de::Deserialize::deserialize(r)?,
61729            ))),
61730            TypeVariant::CreateAccountOp => Ok(Self::CreateAccountOp(Box::new(
61731                serde::de::Deserialize::deserialize(r)?,
61732            ))),
61733            TypeVariant::PaymentOp => Ok(Self::PaymentOp(Box::new(
61734                serde::de::Deserialize::deserialize(r)?,
61735            ))),
61736            TypeVariant::PathPaymentStrictReceiveOp => Ok(Self::PathPaymentStrictReceiveOp(
61737                Box::new(serde::de::Deserialize::deserialize(r)?),
61738            )),
61739            TypeVariant::PathPaymentStrictSendOp => Ok(Self::PathPaymentStrictSendOp(Box::new(
61740                serde::de::Deserialize::deserialize(r)?,
61741            ))),
61742            TypeVariant::ManageSellOfferOp => Ok(Self::ManageSellOfferOp(Box::new(
61743                serde::de::Deserialize::deserialize(r)?,
61744            ))),
61745            TypeVariant::ManageBuyOfferOp => Ok(Self::ManageBuyOfferOp(Box::new(
61746                serde::de::Deserialize::deserialize(r)?,
61747            ))),
61748            TypeVariant::CreatePassiveSellOfferOp => Ok(Self::CreatePassiveSellOfferOp(Box::new(
61749                serde::de::Deserialize::deserialize(r)?,
61750            ))),
61751            TypeVariant::SetOptionsOp => Ok(Self::SetOptionsOp(Box::new(
61752                serde::de::Deserialize::deserialize(r)?,
61753            ))),
61754            TypeVariant::ChangeTrustAsset => Ok(Self::ChangeTrustAsset(Box::new(
61755                serde::de::Deserialize::deserialize(r)?,
61756            ))),
61757            TypeVariant::ChangeTrustOp => Ok(Self::ChangeTrustOp(Box::new(
61758                serde::de::Deserialize::deserialize(r)?,
61759            ))),
61760            TypeVariant::AllowTrustOp => Ok(Self::AllowTrustOp(Box::new(
61761                serde::de::Deserialize::deserialize(r)?,
61762            ))),
61763            TypeVariant::ManageDataOp => Ok(Self::ManageDataOp(Box::new(
61764                serde::de::Deserialize::deserialize(r)?,
61765            ))),
61766            TypeVariant::BumpSequenceOp => Ok(Self::BumpSequenceOp(Box::new(
61767                serde::de::Deserialize::deserialize(r)?,
61768            ))),
61769            TypeVariant::CreateClaimableBalanceOp => Ok(Self::CreateClaimableBalanceOp(Box::new(
61770                serde::de::Deserialize::deserialize(r)?,
61771            ))),
61772            TypeVariant::ClaimClaimableBalanceOp => Ok(Self::ClaimClaimableBalanceOp(Box::new(
61773                serde::de::Deserialize::deserialize(r)?,
61774            ))),
61775            TypeVariant::BeginSponsoringFutureReservesOp => {
61776                Ok(Self::BeginSponsoringFutureReservesOp(Box::new(
61777                    serde::de::Deserialize::deserialize(r)?,
61778                )))
61779            }
61780            TypeVariant::RevokeSponsorshipType => Ok(Self::RevokeSponsorshipType(Box::new(
61781                serde::de::Deserialize::deserialize(r)?,
61782            ))),
61783            TypeVariant::RevokeSponsorshipOp => Ok(Self::RevokeSponsorshipOp(Box::new(
61784                serde::de::Deserialize::deserialize(r)?,
61785            ))),
61786            TypeVariant::RevokeSponsorshipOpSigner => Ok(Self::RevokeSponsorshipOpSigner(
61787                Box::new(serde::de::Deserialize::deserialize(r)?),
61788            )),
61789            TypeVariant::ClawbackOp => Ok(Self::ClawbackOp(Box::new(
61790                serde::de::Deserialize::deserialize(r)?,
61791            ))),
61792            TypeVariant::ClawbackClaimableBalanceOp => Ok(Self::ClawbackClaimableBalanceOp(
61793                Box::new(serde::de::Deserialize::deserialize(r)?),
61794            )),
61795            TypeVariant::SetTrustLineFlagsOp => Ok(Self::SetTrustLineFlagsOp(Box::new(
61796                serde::de::Deserialize::deserialize(r)?,
61797            ))),
61798            TypeVariant::LiquidityPoolDepositOp => Ok(Self::LiquidityPoolDepositOp(Box::new(
61799                serde::de::Deserialize::deserialize(r)?,
61800            ))),
61801            TypeVariant::LiquidityPoolWithdrawOp => Ok(Self::LiquidityPoolWithdrawOp(Box::new(
61802                serde::de::Deserialize::deserialize(r)?,
61803            ))),
61804            TypeVariant::HostFunctionType => Ok(Self::HostFunctionType(Box::new(
61805                serde::de::Deserialize::deserialize(r)?,
61806            ))),
61807            TypeVariant::ContractIdPreimageType => Ok(Self::ContractIdPreimageType(Box::new(
61808                serde::de::Deserialize::deserialize(r)?,
61809            ))),
61810            TypeVariant::ContractIdPreimage => Ok(Self::ContractIdPreimage(Box::new(
61811                serde::de::Deserialize::deserialize(r)?,
61812            ))),
61813            TypeVariant::ContractIdPreimageFromAddress => Ok(Self::ContractIdPreimageFromAddress(
61814                Box::new(serde::de::Deserialize::deserialize(r)?),
61815            )),
61816            TypeVariant::CreateContractArgs => Ok(Self::CreateContractArgs(Box::new(
61817                serde::de::Deserialize::deserialize(r)?,
61818            ))),
61819            TypeVariant::CreateContractArgsV2 => Ok(Self::CreateContractArgsV2(Box::new(
61820                serde::de::Deserialize::deserialize(r)?,
61821            ))),
61822            TypeVariant::InvokeContractArgs => Ok(Self::InvokeContractArgs(Box::new(
61823                serde::de::Deserialize::deserialize(r)?,
61824            ))),
61825            TypeVariant::HostFunction => Ok(Self::HostFunction(Box::new(
61826                serde::de::Deserialize::deserialize(r)?,
61827            ))),
61828            TypeVariant::SorobanAuthorizedFunctionType => Ok(Self::SorobanAuthorizedFunctionType(
61829                Box::new(serde::de::Deserialize::deserialize(r)?),
61830            )),
61831            TypeVariant::SorobanAuthorizedFunction => Ok(Self::SorobanAuthorizedFunction(
61832                Box::new(serde::de::Deserialize::deserialize(r)?),
61833            )),
61834            TypeVariant::SorobanAuthorizedInvocation => Ok(Self::SorobanAuthorizedInvocation(
61835                Box::new(serde::de::Deserialize::deserialize(r)?),
61836            )),
61837            TypeVariant::SorobanAddressCredentials => Ok(Self::SorobanAddressCredentials(
61838                Box::new(serde::de::Deserialize::deserialize(r)?),
61839            )),
61840            TypeVariant::SorobanCredentialsType => Ok(Self::SorobanCredentialsType(Box::new(
61841                serde::de::Deserialize::deserialize(r)?,
61842            ))),
61843            TypeVariant::SorobanCredentials => Ok(Self::SorobanCredentials(Box::new(
61844                serde::de::Deserialize::deserialize(r)?,
61845            ))),
61846            TypeVariant::SorobanAuthorizationEntry => Ok(Self::SorobanAuthorizationEntry(
61847                Box::new(serde::de::Deserialize::deserialize(r)?),
61848            )),
61849            TypeVariant::InvokeHostFunctionOp => Ok(Self::InvokeHostFunctionOp(Box::new(
61850                serde::de::Deserialize::deserialize(r)?,
61851            ))),
61852            TypeVariant::ExtendFootprintTtlOp => Ok(Self::ExtendFootprintTtlOp(Box::new(
61853                serde::de::Deserialize::deserialize(r)?,
61854            ))),
61855            TypeVariant::RestoreFootprintOp => Ok(Self::RestoreFootprintOp(Box::new(
61856                serde::de::Deserialize::deserialize(r)?,
61857            ))),
61858            TypeVariant::Operation => Ok(Self::Operation(Box::new(
61859                serde::de::Deserialize::deserialize(r)?,
61860            ))),
61861            TypeVariant::OperationBody => Ok(Self::OperationBody(Box::new(
61862                serde::de::Deserialize::deserialize(r)?,
61863            ))),
61864            TypeVariant::HashIdPreimage => Ok(Self::HashIdPreimage(Box::new(
61865                serde::de::Deserialize::deserialize(r)?,
61866            ))),
61867            TypeVariant::HashIdPreimageOperationId => Ok(Self::HashIdPreimageOperationId(
61868                Box::new(serde::de::Deserialize::deserialize(r)?),
61869            )),
61870            TypeVariant::HashIdPreimageRevokeId => Ok(Self::HashIdPreimageRevokeId(Box::new(
61871                serde::de::Deserialize::deserialize(r)?,
61872            ))),
61873            TypeVariant::HashIdPreimageContractId => Ok(Self::HashIdPreimageContractId(Box::new(
61874                serde::de::Deserialize::deserialize(r)?,
61875            ))),
61876            TypeVariant::HashIdPreimageSorobanAuthorization => {
61877                Ok(Self::HashIdPreimageSorobanAuthorization(Box::new(
61878                    serde::de::Deserialize::deserialize(r)?,
61879                )))
61880            }
61881            TypeVariant::MemoType => Ok(Self::MemoType(Box::new(
61882                serde::de::Deserialize::deserialize(r)?,
61883            ))),
61884            TypeVariant::Memo => Ok(Self::Memo(Box::new(serde::de::Deserialize::deserialize(
61885                r,
61886            )?))),
61887            TypeVariant::TimeBounds => Ok(Self::TimeBounds(Box::new(
61888                serde::de::Deserialize::deserialize(r)?,
61889            ))),
61890            TypeVariant::LedgerBounds => Ok(Self::LedgerBounds(Box::new(
61891                serde::de::Deserialize::deserialize(r)?,
61892            ))),
61893            TypeVariant::PreconditionsV2 => Ok(Self::PreconditionsV2(Box::new(
61894                serde::de::Deserialize::deserialize(r)?,
61895            ))),
61896            TypeVariant::PreconditionType => Ok(Self::PreconditionType(Box::new(
61897                serde::de::Deserialize::deserialize(r)?,
61898            ))),
61899            TypeVariant::Preconditions => Ok(Self::Preconditions(Box::new(
61900                serde::de::Deserialize::deserialize(r)?,
61901            ))),
61902            TypeVariant::LedgerFootprint => Ok(Self::LedgerFootprint(Box::new(
61903                serde::de::Deserialize::deserialize(r)?,
61904            ))),
61905            TypeVariant::ArchivalProofType => Ok(Self::ArchivalProofType(Box::new(
61906                serde::de::Deserialize::deserialize(r)?,
61907            ))),
61908            TypeVariant::ArchivalProofNode => Ok(Self::ArchivalProofNode(Box::new(
61909                serde::de::Deserialize::deserialize(r)?,
61910            ))),
61911            TypeVariant::ProofLevel => Ok(Self::ProofLevel(Box::new(
61912                serde::de::Deserialize::deserialize(r)?,
61913            ))),
61914            TypeVariant::ExistenceProofBody => Ok(Self::ExistenceProofBody(Box::new(
61915                serde::de::Deserialize::deserialize(r)?,
61916            ))),
61917            TypeVariant::NonexistenceProofBody => Ok(Self::NonexistenceProofBody(Box::new(
61918                serde::de::Deserialize::deserialize(r)?,
61919            ))),
61920            TypeVariant::ArchivalProof => Ok(Self::ArchivalProof(Box::new(
61921                serde::de::Deserialize::deserialize(r)?,
61922            ))),
61923            TypeVariant::ArchivalProofBody => Ok(Self::ArchivalProofBody(Box::new(
61924                serde::de::Deserialize::deserialize(r)?,
61925            ))),
61926            TypeVariant::SorobanResources => Ok(Self::SorobanResources(Box::new(
61927                serde::de::Deserialize::deserialize(r)?,
61928            ))),
61929            TypeVariant::SorobanTransactionData => Ok(Self::SorobanTransactionData(Box::new(
61930                serde::de::Deserialize::deserialize(r)?,
61931            ))),
61932            TypeVariant::SorobanTransactionDataExt => Ok(Self::SorobanTransactionDataExt(
61933                Box::new(serde::de::Deserialize::deserialize(r)?),
61934            )),
61935            TypeVariant::TransactionV0 => Ok(Self::TransactionV0(Box::new(
61936                serde::de::Deserialize::deserialize(r)?,
61937            ))),
61938            TypeVariant::TransactionV0Ext => Ok(Self::TransactionV0Ext(Box::new(
61939                serde::de::Deserialize::deserialize(r)?,
61940            ))),
61941            TypeVariant::TransactionV0Envelope => Ok(Self::TransactionV0Envelope(Box::new(
61942                serde::de::Deserialize::deserialize(r)?,
61943            ))),
61944            TypeVariant::Transaction => Ok(Self::Transaction(Box::new(
61945                serde::de::Deserialize::deserialize(r)?,
61946            ))),
61947            TypeVariant::TransactionExt => Ok(Self::TransactionExt(Box::new(
61948                serde::de::Deserialize::deserialize(r)?,
61949            ))),
61950            TypeVariant::TransactionV1Envelope => Ok(Self::TransactionV1Envelope(Box::new(
61951                serde::de::Deserialize::deserialize(r)?,
61952            ))),
61953            TypeVariant::FeeBumpTransaction => Ok(Self::FeeBumpTransaction(Box::new(
61954                serde::de::Deserialize::deserialize(r)?,
61955            ))),
61956            TypeVariant::FeeBumpTransactionInnerTx => Ok(Self::FeeBumpTransactionInnerTx(
61957                Box::new(serde::de::Deserialize::deserialize(r)?),
61958            )),
61959            TypeVariant::FeeBumpTransactionExt => Ok(Self::FeeBumpTransactionExt(Box::new(
61960                serde::de::Deserialize::deserialize(r)?,
61961            ))),
61962            TypeVariant::FeeBumpTransactionEnvelope => Ok(Self::FeeBumpTransactionEnvelope(
61963                Box::new(serde::de::Deserialize::deserialize(r)?),
61964            )),
61965            TypeVariant::TransactionEnvelope => Ok(Self::TransactionEnvelope(Box::new(
61966                serde::de::Deserialize::deserialize(r)?,
61967            ))),
61968            TypeVariant::TransactionSignaturePayload => Ok(Self::TransactionSignaturePayload(
61969                Box::new(serde::de::Deserialize::deserialize(r)?),
61970            )),
61971            TypeVariant::TransactionSignaturePayloadTaggedTransaction => {
61972                Ok(Self::TransactionSignaturePayloadTaggedTransaction(
61973                    Box::new(serde::de::Deserialize::deserialize(r)?),
61974                ))
61975            }
61976            TypeVariant::ClaimAtomType => Ok(Self::ClaimAtomType(Box::new(
61977                serde::de::Deserialize::deserialize(r)?,
61978            ))),
61979            TypeVariant::ClaimOfferAtomV0 => Ok(Self::ClaimOfferAtomV0(Box::new(
61980                serde::de::Deserialize::deserialize(r)?,
61981            ))),
61982            TypeVariant::ClaimOfferAtom => Ok(Self::ClaimOfferAtom(Box::new(
61983                serde::de::Deserialize::deserialize(r)?,
61984            ))),
61985            TypeVariant::ClaimLiquidityAtom => Ok(Self::ClaimLiquidityAtom(Box::new(
61986                serde::de::Deserialize::deserialize(r)?,
61987            ))),
61988            TypeVariant::ClaimAtom => Ok(Self::ClaimAtom(Box::new(
61989                serde::de::Deserialize::deserialize(r)?,
61990            ))),
61991            TypeVariant::CreateAccountResultCode => Ok(Self::CreateAccountResultCode(Box::new(
61992                serde::de::Deserialize::deserialize(r)?,
61993            ))),
61994            TypeVariant::CreateAccountResult => Ok(Self::CreateAccountResult(Box::new(
61995                serde::de::Deserialize::deserialize(r)?,
61996            ))),
61997            TypeVariant::PaymentResultCode => Ok(Self::PaymentResultCode(Box::new(
61998                serde::de::Deserialize::deserialize(r)?,
61999            ))),
62000            TypeVariant::PaymentResult => Ok(Self::PaymentResult(Box::new(
62001                serde::de::Deserialize::deserialize(r)?,
62002            ))),
62003            TypeVariant::PathPaymentStrictReceiveResultCode => {
62004                Ok(Self::PathPaymentStrictReceiveResultCode(Box::new(
62005                    serde::de::Deserialize::deserialize(r)?,
62006                )))
62007            }
62008            TypeVariant::SimplePaymentResult => Ok(Self::SimplePaymentResult(Box::new(
62009                serde::de::Deserialize::deserialize(r)?,
62010            ))),
62011            TypeVariant::PathPaymentStrictReceiveResult => {
62012                Ok(Self::PathPaymentStrictReceiveResult(Box::new(
62013                    serde::de::Deserialize::deserialize(r)?,
62014                )))
62015            }
62016            TypeVariant::PathPaymentStrictReceiveResultSuccess => {
62017                Ok(Self::PathPaymentStrictReceiveResultSuccess(Box::new(
62018                    serde::de::Deserialize::deserialize(r)?,
62019                )))
62020            }
62021            TypeVariant::PathPaymentStrictSendResultCode => {
62022                Ok(Self::PathPaymentStrictSendResultCode(Box::new(
62023                    serde::de::Deserialize::deserialize(r)?,
62024                )))
62025            }
62026            TypeVariant::PathPaymentStrictSendResult => Ok(Self::PathPaymentStrictSendResult(
62027                Box::new(serde::de::Deserialize::deserialize(r)?),
62028            )),
62029            TypeVariant::PathPaymentStrictSendResultSuccess => {
62030                Ok(Self::PathPaymentStrictSendResultSuccess(Box::new(
62031                    serde::de::Deserialize::deserialize(r)?,
62032                )))
62033            }
62034            TypeVariant::ManageSellOfferResultCode => Ok(Self::ManageSellOfferResultCode(
62035                Box::new(serde::de::Deserialize::deserialize(r)?),
62036            )),
62037            TypeVariant::ManageOfferEffect => Ok(Self::ManageOfferEffect(Box::new(
62038                serde::de::Deserialize::deserialize(r)?,
62039            ))),
62040            TypeVariant::ManageOfferSuccessResult => Ok(Self::ManageOfferSuccessResult(Box::new(
62041                serde::de::Deserialize::deserialize(r)?,
62042            ))),
62043            TypeVariant::ManageOfferSuccessResultOffer => Ok(Self::ManageOfferSuccessResultOffer(
62044                Box::new(serde::de::Deserialize::deserialize(r)?),
62045            )),
62046            TypeVariant::ManageSellOfferResult => Ok(Self::ManageSellOfferResult(Box::new(
62047                serde::de::Deserialize::deserialize(r)?,
62048            ))),
62049            TypeVariant::ManageBuyOfferResultCode => Ok(Self::ManageBuyOfferResultCode(Box::new(
62050                serde::de::Deserialize::deserialize(r)?,
62051            ))),
62052            TypeVariant::ManageBuyOfferResult => Ok(Self::ManageBuyOfferResult(Box::new(
62053                serde::de::Deserialize::deserialize(r)?,
62054            ))),
62055            TypeVariant::SetOptionsResultCode => Ok(Self::SetOptionsResultCode(Box::new(
62056                serde::de::Deserialize::deserialize(r)?,
62057            ))),
62058            TypeVariant::SetOptionsResult => Ok(Self::SetOptionsResult(Box::new(
62059                serde::de::Deserialize::deserialize(r)?,
62060            ))),
62061            TypeVariant::ChangeTrustResultCode => Ok(Self::ChangeTrustResultCode(Box::new(
62062                serde::de::Deserialize::deserialize(r)?,
62063            ))),
62064            TypeVariant::ChangeTrustResult => Ok(Self::ChangeTrustResult(Box::new(
62065                serde::de::Deserialize::deserialize(r)?,
62066            ))),
62067            TypeVariant::AllowTrustResultCode => Ok(Self::AllowTrustResultCode(Box::new(
62068                serde::de::Deserialize::deserialize(r)?,
62069            ))),
62070            TypeVariant::AllowTrustResult => Ok(Self::AllowTrustResult(Box::new(
62071                serde::de::Deserialize::deserialize(r)?,
62072            ))),
62073            TypeVariant::AccountMergeResultCode => Ok(Self::AccountMergeResultCode(Box::new(
62074                serde::de::Deserialize::deserialize(r)?,
62075            ))),
62076            TypeVariant::AccountMergeResult => Ok(Self::AccountMergeResult(Box::new(
62077                serde::de::Deserialize::deserialize(r)?,
62078            ))),
62079            TypeVariant::InflationResultCode => Ok(Self::InflationResultCode(Box::new(
62080                serde::de::Deserialize::deserialize(r)?,
62081            ))),
62082            TypeVariant::InflationPayout => Ok(Self::InflationPayout(Box::new(
62083                serde::de::Deserialize::deserialize(r)?,
62084            ))),
62085            TypeVariant::InflationResult => Ok(Self::InflationResult(Box::new(
62086                serde::de::Deserialize::deserialize(r)?,
62087            ))),
62088            TypeVariant::ManageDataResultCode => Ok(Self::ManageDataResultCode(Box::new(
62089                serde::de::Deserialize::deserialize(r)?,
62090            ))),
62091            TypeVariant::ManageDataResult => Ok(Self::ManageDataResult(Box::new(
62092                serde::de::Deserialize::deserialize(r)?,
62093            ))),
62094            TypeVariant::BumpSequenceResultCode => Ok(Self::BumpSequenceResultCode(Box::new(
62095                serde::de::Deserialize::deserialize(r)?,
62096            ))),
62097            TypeVariant::BumpSequenceResult => Ok(Self::BumpSequenceResult(Box::new(
62098                serde::de::Deserialize::deserialize(r)?,
62099            ))),
62100            TypeVariant::CreateClaimableBalanceResultCode => {
62101                Ok(Self::CreateClaimableBalanceResultCode(Box::new(
62102                    serde::de::Deserialize::deserialize(r)?,
62103                )))
62104            }
62105            TypeVariant::CreateClaimableBalanceResult => Ok(Self::CreateClaimableBalanceResult(
62106                Box::new(serde::de::Deserialize::deserialize(r)?),
62107            )),
62108            TypeVariant::ClaimClaimableBalanceResultCode => {
62109                Ok(Self::ClaimClaimableBalanceResultCode(Box::new(
62110                    serde::de::Deserialize::deserialize(r)?,
62111                )))
62112            }
62113            TypeVariant::ClaimClaimableBalanceResult => Ok(Self::ClaimClaimableBalanceResult(
62114                Box::new(serde::de::Deserialize::deserialize(r)?),
62115            )),
62116            TypeVariant::BeginSponsoringFutureReservesResultCode => {
62117                Ok(Self::BeginSponsoringFutureReservesResultCode(Box::new(
62118                    serde::de::Deserialize::deserialize(r)?,
62119                )))
62120            }
62121            TypeVariant::BeginSponsoringFutureReservesResult => {
62122                Ok(Self::BeginSponsoringFutureReservesResult(Box::new(
62123                    serde::de::Deserialize::deserialize(r)?,
62124                )))
62125            }
62126            TypeVariant::EndSponsoringFutureReservesResultCode => {
62127                Ok(Self::EndSponsoringFutureReservesResultCode(Box::new(
62128                    serde::de::Deserialize::deserialize(r)?,
62129                )))
62130            }
62131            TypeVariant::EndSponsoringFutureReservesResult => {
62132                Ok(Self::EndSponsoringFutureReservesResult(Box::new(
62133                    serde::de::Deserialize::deserialize(r)?,
62134                )))
62135            }
62136            TypeVariant::RevokeSponsorshipResultCode => Ok(Self::RevokeSponsorshipResultCode(
62137                Box::new(serde::de::Deserialize::deserialize(r)?),
62138            )),
62139            TypeVariant::RevokeSponsorshipResult => Ok(Self::RevokeSponsorshipResult(Box::new(
62140                serde::de::Deserialize::deserialize(r)?,
62141            ))),
62142            TypeVariant::ClawbackResultCode => Ok(Self::ClawbackResultCode(Box::new(
62143                serde::de::Deserialize::deserialize(r)?,
62144            ))),
62145            TypeVariant::ClawbackResult => Ok(Self::ClawbackResult(Box::new(
62146                serde::de::Deserialize::deserialize(r)?,
62147            ))),
62148            TypeVariant::ClawbackClaimableBalanceResultCode => {
62149                Ok(Self::ClawbackClaimableBalanceResultCode(Box::new(
62150                    serde::de::Deserialize::deserialize(r)?,
62151                )))
62152            }
62153            TypeVariant::ClawbackClaimableBalanceResult => {
62154                Ok(Self::ClawbackClaimableBalanceResult(Box::new(
62155                    serde::de::Deserialize::deserialize(r)?,
62156                )))
62157            }
62158            TypeVariant::SetTrustLineFlagsResultCode => Ok(Self::SetTrustLineFlagsResultCode(
62159                Box::new(serde::de::Deserialize::deserialize(r)?),
62160            )),
62161            TypeVariant::SetTrustLineFlagsResult => Ok(Self::SetTrustLineFlagsResult(Box::new(
62162                serde::de::Deserialize::deserialize(r)?,
62163            ))),
62164            TypeVariant::LiquidityPoolDepositResultCode => {
62165                Ok(Self::LiquidityPoolDepositResultCode(Box::new(
62166                    serde::de::Deserialize::deserialize(r)?,
62167                )))
62168            }
62169            TypeVariant::LiquidityPoolDepositResult => Ok(Self::LiquidityPoolDepositResult(
62170                Box::new(serde::de::Deserialize::deserialize(r)?),
62171            )),
62172            TypeVariant::LiquidityPoolWithdrawResultCode => {
62173                Ok(Self::LiquidityPoolWithdrawResultCode(Box::new(
62174                    serde::de::Deserialize::deserialize(r)?,
62175                )))
62176            }
62177            TypeVariant::LiquidityPoolWithdrawResult => Ok(Self::LiquidityPoolWithdrawResult(
62178                Box::new(serde::de::Deserialize::deserialize(r)?),
62179            )),
62180            TypeVariant::InvokeHostFunctionResultCode => Ok(Self::InvokeHostFunctionResultCode(
62181                Box::new(serde::de::Deserialize::deserialize(r)?),
62182            )),
62183            TypeVariant::InvokeHostFunctionResult => Ok(Self::InvokeHostFunctionResult(Box::new(
62184                serde::de::Deserialize::deserialize(r)?,
62185            ))),
62186            TypeVariant::ExtendFootprintTtlResultCode => Ok(Self::ExtendFootprintTtlResultCode(
62187                Box::new(serde::de::Deserialize::deserialize(r)?),
62188            )),
62189            TypeVariant::ExtendFootprintTtlResult => Ok(Self::ExtendFootprintTtlResult(Box::new(
62190                serde::de::Deserialize::deserialize(r)?,
62191            ))),
62192            TypeVariant::RestoreFootprintResultCode => Ok(Self::RestoreFootprintResultCode(
62193                Box::new(serde::de::Deserialize::deserialize(r)?),
62194            )),
62195            TypeVariant::RestoreFootprintResult => Ok(Self::RestoreFootprintResult(Box::new(
62196                serde::de::Deserialize::deserialize(r)?,
62197            ))),
62198            TypeVariant::OperationResultCode => Ok(Self::OperationResultCode(Box::new(
62199                serde::de::Deserialize::deserialize(r)?,
62200            ))),
62201            TypeVariant::OperationResult => Ok(Self::OperationResult(Box::new(
62202                serde::de::Deserialize::deserialize(r)?,
62203            ))),
62204            TypeVariant::OperationResultTr => Ok(Self::OperationResultTr(Box::new(
62205                serde::de::Deserialize::deserialize(r)?,
62206            ))),
62207            TypeVariant::TransactionResultCode => Ok(Self::TransactionResultCode(Box::new(
62208                serde::de::Deserialize::deserialize(r)?,
62209            ))),
62210            TypeVariant::InnerTransactionResult => Ok(Self::InnerTransactionResult(Box::new(
62211                serde::de::Deserialize::deserialize(r)?,
62212            ))),
62213            TypeVariant::InnerTransactionResultResult => Ok(Self::InnerTransactionResultResult(
62214                Box::new(serde::de::Deserialize::deserialize(r)?),
62215            )),
62216            TypeVariant::InnerTransactionResultExt => Ok(Self::InnerTransactionResultExt(
62217                Box::new(serde::de::Deserialize::deserialize(r)?),
62218            )),
62219            TypeVariant::InnerTransactionResultPair => Ok(Self::InnerTransactionResultPair(
62220                Box::new(serde::de::Deserialize::deserialize(r)?),
62221            )),
62222            TypeVariant::TransactionResult => Ok(Self::TransactionResult(Box::new(
62223                serde::de::Deserialize::deserialize(r)?,
62224            ))),
62225            TypeVariant::TransactionResultResult => Ok(Self::TransactionResultResult(Box::new(
62226                serde::de::Deserialize::deserialize(r)?,
62227            ))),
62228            TypeVariant::TransactionResultExt => Ok(Self::TransactionResultExt(Box::new(
62229                serde::de::Deserialize::deserialize(r)?,
62230            ))),
62231            TypeVariant::Hash => Ok(Self::Hash(Box::new(serde::de::Deserialize::deserialize(
62232                r,
62233            )?))),
62234            TypeVariant::Uint256 => Ok(Self::Uint256(Box::new(
62235                serde::de::Deserialize::deserialize(r)?,
62236            ))),
62237            TypeVariant::Uint32 => Ok(Self::Uint32(Box::new(serde::de::Deserialize::deserialize(
62238                r,
62239            )?))),
62240            TypeVariant::Int32 => Ok(Self::Int32(Box::new(serde::de::Deserialize::deserialize(
62241                r,
62242            )?))),
62243            TypeVariant::Uint64 => Ok(Self::Uint64(Box::new(serde::de::Deserialize::deserialize(
62244                r,
62245            )?))),
62246            TypeVariant::Int64 => Ok(Self::Int64(Box::new(serde::de::Deserialize::deserialize(
62247                r,
62248            )?))),
62249            TypeVariant::TimePoint => Ok(Self::TimePoint(Box::new(
62250                serde::de::Deserialize::deserialize(r)?,
62251            ))),
62252            TypeVariant::Duration => Ok(Self::Duration(Box::new(
62253                serde::de::Deserialize::deserialize(r)?,
62254            ))),
62255            TypeVariant::ExtensionPoint => Ok(Self::ExtensionPoint(Box::new(
62256                serde::de::Deserialize::deserialize(r)?,
62257            ))),
62258            TypeVariant::CryptoKeyType => Ok(Self::CryptoKeyType(Box::new(
62259                serde::de::Deserialize::deserialize(r)?,
62260            ))),
62261            TypeVariant::PublicKeyType => Ok(Self::PublicKeyType(Box::new(
62262                serde::de::Deserialize::deserialize(r)?,
62263            ))),
62264            TypeVariant::SignerKeyType => Ok(Self::SignerKeyType(Box::new(
62265                serde::de::Deserialize::deserialize(r)?,
62266            ))),
62267            TypeVariant::PublicKey => Ok(Self::PublicKey(Box::new(
62268                serde::de::Deserialize::deserialize(r)?,
62269            ))),
62270            TypeVariant::SignerKey => Ok(Self::SignerKey(Box::new(
62271                serde::de::Deserialize::deserialize(r)?,
62272            ))),
62273            TypeVariant::SignerKeyEd25519SignedPayload => Ok(Self::SignerKeyEd25519SignedPayload(
62274                Box::new(serde::de::Deserialize::deserialize(r)?),
62275            )),
62276            TypeVariant::Signature => Ok(Self::Signature(Box::new(
62277                serde::de::Deserialize::deserialize(r)?,
62278            ))),
62279            TypeVariant::SignatureHint => Ok(Self::SignatureHint(Box::new(
62280                serde::de::Deserialize::deserialize(r)?,
62281            ))),
62282            TypeVariant::NodeId => Ok(Self::NodeId(Box::new(serde::de::Deserialize::deserialize(
62283                r,
62284            )?))),
62285            TypeVariant::AccountId => Ok(Self::AccountId(Box::new(
62286                serde::de::Deserialize::deserialize(r)?,
62287            ))),
62288            TypeVariant::Curve25519Secret => Ok(Self::Curve25519Secret(Box::new(
62289                serde::de::Deserialize::deserialize(r)?,
62290            ))),
62291            TypeVariant::Curve25519Public => Ok(Self::Curve25519Public(Box::new(
62292                serde::de::Deserialize::deserialize(r)?,
62293            ))),
62294            TypeVariant::HmacSha256Key => Ok(Self::HmacSha256Key(Box::new(
62295                serde::de::Deserialize::deserialize(r)?,
62296            ))),
62297            TypeVariant::HmacSha256Mac => Ok(Self::HmacSha256Mac(Box::new(
62298                serde::de::Deserialize::deserialize(r)?,
62299            ))),
62300            TypeVariant::ShortHashSeed => Ok(Self::ShortHashSeed(Box::new(
62301                serde::de::Deserialize::deserialize(r)?,
62302            ))),
62303            TypeVariant::BinaryFuseFilterType => Ok(Self::BinaryFuseFilterType(Box::new(
62304                serde::de::Deserialize::deserialize(r)?,
62305            ))),
62306            TypeVariant::SerializedBinaryFuseFilter => Ok(Self::SerializedBinaryFuseFilter(
62307                Box::new(serde::de::Deserialize::deserialize(r)?),
62308            )),
62309        }
62310    }
62311
62312    #[cfg(feature = "alloc")]
62313    #[must_use]
62314    #[allow(clippy::too_many_lines)]
62315    pub fn value(&self) -> &dyn core::any::Any {
62316        #[allow(clippy::match_same_arms)]
62317        match self {
62318            Self::Value(ref v) => v.as_ref(),
62319            Self::ScpBallot(ref v) => v.as_ref(),
62320            Self::ScpStatementType(ref v) => v.as_ref(),
62321            Self::ScpNomination(ref v) => v.as_ref(),
62322            Self::ScpStatement(ref v) => v.as_ref(),
62323            Self::ScpStatementPledges(ref v) => v.as_ref(),
62324            Self::ScpStatementPrepare(ref v) => v.as_ref(),
62325            Self::ScpStatementConfirm(ref v) => v.as_ref(),
62326            Self::ScpStatementExternalize(ref v) => v.as_ref(),
62327            Self::ScpEnvelope(ref v) => v.as_ref(),
62328            Self::ScpQuorumSet(ref v) => v.as_ref(),
62329            Self::ConfigSettingContractExecutionLanesV0(ref v) => v.as_ref(),
62330            Self::ConfigSettingContractComputeV0(ref v) => v.as_ref(),
62331            Self::ConfigSettingContractParallelComputeV0(ref v) => v.as_ref(),
62332            Self::ConfigSettingContractLedgerCostV0(ref v) => v.as_ref(),
62333            Self::ConfigSettingContractHistoricalDataV0(ref v) => v.as_ref(),
62334            Self::ConfigSettingContractEventsV0(ref v) => v.as_ref(),
62335            Self::ConfigSettingContractBandwidthV0(ref v) => v.as_ref(),
62336            Self::ContractCostType(ref v) => v.as_ref(),
62337            Self::ContractCostParamEntry(ref v) => v.as_ref(),
62338            Self::StateArchivalSettings(ref v) => v.as_ref(),
62339            Self::EvictionIterator(ref v) => v.as_ref(),
62340            Self::ContractCostParams(ref v) => v.as_ref(),
62341            Self::ConfigSettingId(ref v) => v.as_ref(),
62342            Self::ConfigSettingEntry(ref v) => v.as_ref(),
62343            Self::ScEnvMetaKind(ref v) => v.as_ref(),
62344            Self::ScEnvMetaEntry(ref v) => v.as_ref(),
62345            Self::ScEnvMetaEntryInterfaceVersion(ref v) => v.as_ref(),
62346            Self::ScMetaV0(ref v) => v.as_ref(),
62347            Self::ScMetaKind(ref v) => v.as_ref(),
62348            Self::ScMetaEntry(ref v) => v.as_ref(),
62349            Self::ScSpecType(ref v) => v.as_ref(),
62350            Self::ScSpecTypeOption(ref v) => v.as_ref(),
62351            Self::ScSpecTypeResult(ref v) => v.as_ref(),
62352            Self::ScSpecTypeVec(ref v) => v.as_ref(),
62353            Self::ScSpecTypeMap(ref v) => v.as_ref(),
62354            Self::ScSpecTypeTuple(ref v) => v.as_ref(),
62355            Self::ScSpecTypeBytesN(ref v) => v.as_ref(),
62356            Self::ScSpecTypeUdt(ref v) => v.as_ref(),
62357            Self::ScSpecTypeDef(ref v) => v.as_ref(),
62358            Self::ScSpecUdtStructFieldV0(ref v) => v.as_ref(),
62359            Self::ScSpecUdtStructV0(ref v) => v.as_ref(),
62360            Self::ScSpecUdtUnionCaseVoidV0(ref v) => v.as_ref(),
62361            Self::ScSpecUdtUnionCaseTupleV0(ref v) => v.as_ref(),
62362            Self::ScSpecUdtUnionCaseV0Kind(ref v) => v.as_ref(),
62363            Self::ScSpecUdtUnionCaseV0(ref v) => v.as_ref(),
62364            Self::ScSpecUdtUnionV0(ref v) => v.as_ref(),
62365            Self::ScSpecUdtEnumCaseV0(ref v) => v.as_ref(),
62366            Self::ScSpecUdtEnumV0(ref v) => v.as_ref(),
62367            Self::ScSpecUdtErrorEnumCaseV0(ref v) => v.as_ref(),
62368            Self::ScSpecUdtErrorEnumV0(ref v) => v.as_ref(),
62369            Self::ScSpecFunctionInputV0(ref v) => v.as_ref(),
62370            Self::ScSpecFunctionV0(ref v) => v.as_ref(),
62371            Self::ScSpecEntryKind(ref v) => v.as_ref(),
62372            Self::ScSpecEntry(ref v) => v.as_ref(),
62373            Self::ScValType(ref v) => v.as_ref(),
62374            Self::ScErrorType(ref v) => v.as_ref(),
62375            Self::ScErrorCode(ref v) => v.as_ref(),
62376            Self::ScError(ref v) => v.as_ref(),
62377            Self::UInt128Parts(ref v) => v.as_ref(),
62378            Self::Int128Parts(ref v) => v.as_ref(),
62379            Self::UInt256Parts(ref v) => v.as_ref(),
62380            Self::Int256Parts(ref v) => v.as_ref(),
62381            Self::ContractExecutableType(ref v) => v.as_ref(),
62382            Self::ContractExecutable(ref v) => v.as_ref(),
62383            Self::ScAddressType(ref v) => v.as_ref(),
62384            Self::ScAddress(ref v) => v.as_ref(),
62385            Self::ScVec(ref v) => v.as_ref(),
62386            Self::ScMap(ref v) => v.as_ref(),
62387            Self::ScBytes(ref v) => v.as_ref(),
62388            Self::ScString(ref v) => v.as_ref(),
62389            Self::ScSymbol(ref v) => v.as_ref(),
62390            Self::ScNonceKey(ref v) => v.as_ref(),
62391            Self::ScContractInstance(ref v) => v.as_ref(),
62392            Self::ScVal(ref v) => v.as_ref(),
62393            Self::ScMapEntry(ref v) => v.as_ref(),
62394            Self::StoredTransactionSet(ref v) => v.as_ref(),
62395            Self::StoredDebugTransactionSet(ref v) => v.as_ref(),
62396            Self::PersistedScpStateV0(ref v) => v.as_ref(),
62397            Self::PersistedScpStateV1(ref v) => v.as_ref(),
62398            Self::PersistedScpState(ref v) => v.as_ref(),
62399            Self::Thresholds(ref v) => v.as_ref(),
62400            Self::String32(ref v) => v.as_ref(),
62401            Self::String64(ref v) => v.as_ref(),
62402            Self::SequenceNumber(ref v) => v.as_ref(),
62403            Self::DataValue(ref v) => v.as_ref(),
62404            Self::PoolId(ref v) => v.as_ref(),
62405            Self::AssetCode4(ref v) => v.as_ref(),
62406            Self::AssetCode12(ref v) => v.as_ref(),
62407            Self::AssetType(ref v) => v.as_ref(),
62408            Self::AssetCode(ref v) => v.as_ref(),
62409            Self::AlphaNum4(ref v) => v.as_ref(),
62410            Self::AlphaNum12(ref v) => v.as_ref(),
62411            Self::Asset(ref v) => v.as_ref(),
62412            Self::Price(ref v) => v.as_ref(),
62413            Self::Liabilities(ref v) => v.as_ref(),
62414            Self::ThresholdIndexes(ref v) => v.as_ref(),
62415            Self::LedgerEntryType(ref v) => v.as_ref(),
62416            Self::Signer(ref v) => v.as_ref(),
62417            Self::AccountFlags(ref v) => v.as_ref(),
62418            Self::SponsorshipDescriptor(ref v) => v.as_ref(),
62419            Self::AccountEntryExtensionV3(ref v) => v.as_ref(),
62420            Self::AccountEntryExtensionV2(ref v) => v.as_ref(),
62421            Self::AccountEntryExtensionV2Ext(ref v) => v.as_ref(),
62422            Self::AccountEntryExtensionV1(ref v) => v.as_ref(),
62423            Self::AccountEntryExtensionV1Ext(ref v) => v.as_ref(),
62424            Self::AccountEntry(ref v) => v.as_ref(),
62425            Self::AccountEntryExt(ref v) => v.as_ref(),
62426            Self::TrustLineFlags(ref v) => v.as_ref(),
62427            Self::LiquidityPoolType(ref v) => v.as_ref(),
62428            Self::TrustLineAsset(ref v) => v.as_ref(),
62429            Self::TrustLineEntryExtensionV2(ref v) => v.as_ref(),
62430            Self::TrustLineEntryExtensionV2Ext(ref v) => v.as_ref(),
62431            Self::TrustLineEntry(ref v) => v.as_ref(),
62432            Self::TrustLineEntryExt(ref v) => v.as_ref(),
62433            Self::TrustLineEntryV1(ref v) => v.as_ref(),
62434            Self::TrustLineEntryV1Ext(ref v) => v.as_ref(),
62435            Self::OfferEntryFlags(ref v) => v.as_ref(),
62436            Self::OfferEntry(ref v) => v.as_ref(),
62437            Self::OfferEntryExt(ref v) => v.as_ref(),
62438            Self::DataEntry(ref v) => v.as_ref(),
62439            Self::DataEntryExt(ref v) => v.as_ref(),
62440            Self::ClaimPredicateType(ref v) => v.as_ref(),
62441            Self::ClaimPredicate(ref v) => v.as_ref(),
62442            Self::ClaimantType(ref v) => v.as_ref(),
62443            Self::Claimant(ref v) => v.as_ref(),
62444            Self::ClaimantV0(ref v) => v.as_ref(),
62445            Self::ClaimableBalanceIdType(ref v) => v.as_ref(),
62446            Self::ClaimableBalanceId(ref v) => v.as_ref(),
62447            Self::ClaimableBalanceFlags(ref v) => v.as_ref(),
62448            Self::ClaimableBalanceEntryExtensionV1(ref v) => v.as_ref(),
62449            Self::ClaimableBalanceEntryExtensionV1Ext(ref v) => v.as_ref(),
62450            Self::ClaimableBalanceEntry(ref v) => v.as_ref(),
62451            Self::ClaimableBalanceEntryExt(ref v) => v.as_ref(),
62452            Self::LiquidityPoolConstantProductParameters(ref v) => v.as_ref(),
62453            Self::LiquidityPoolEntry(ref v) => v.as_ref(),
62454            Self::LiquidityPoolEntryBody(ref v) => v.as_ref(),
62455            Self::LiquidityPoolEntryConstantProduct(ref v) => v.as_ref(),
62456            Self::ContractDataDurability(ref v) => v.as_ref(),
62457            Self::ContractDataEntry(ref v) => v.as_ref(),
62458            Self::ContractCodeCostInputs(ref v) => v.as_ref(),
62459            Self::ContractCodeEntry(ref v) => v.as_ref(),
62460            Self::ContractCodeEntryExt(ref v) => v.as_ref(),
62461            Self::ContractCodeEntryV1(ref v) => v.as_ref(),
62462            Self::TtlEntry(ref v) => v.as_ref(),
62463            Self::LedgerEntryExtensionV1(ref v) => v.as_ref(),
62464            Self::LedgerEntryExtensionV1Ext(ref v) => v.as_ref(),
62465            Self::LedgerEntry(ref v) => v.as_ref(),
62466            Self::LedgerEntryData(ref v) => v.as_ref(),
62467            Self::LedgerEntryExt(ref v) => v.as_ref(),
62468            Self::LedgerKey(ref v) => v.as_ref(),
62469            Self::LedgerKeyAccount(ref v) => v.as_ref(),
62470            Self::LedgerKeyTrustLine(ref v) => v.as_ref(),
62471            Self::LedgerKeyOffer(ref v) => v.as_ref(),
62472            Self::LedgerKeyData(ref v) => v.as_ref(),
62473            Self::LedgerKeyClaimableBalance(ref v) => v.as_ref(),
62474            Self::LedgerKeyLiquidityPool(ref v) => v.as_ref(),
62475            Self::LedgerKeyContractData(ref v) => v.as_ref(),
62476            Self::LedgerKeyContractCode(ref v) => v.as_ref(),
62477            Self::LedgerKeyConfigSetting(ref v) => v.as_ref(),
62478            Self::LedgerKeyTtl(ref v) => v.as_ref(),
62479            Self::EnvelopeType(ref v) => v.as_ref(),
62480            Self::BucketListType(ref v) => v.as_ref(),
62481            Self::BucketEntryType(ref v) => v.as_ref(),
62482            Self::HotArchiveBucketEntryType(ref v) => v.as_ref(),
62483            Self::ColdArchiveBucketEntryType(ref v) => v.as_ref(),
62484            Self::BucketMetadata(ref v) => v.as_ref(),
62485            Self::BucketMetadataExt(ref v) => v.as_ref(),
62486            Self::BucketEntry(ref v) => v.as_ref(),
62487            Self::HotArchiveBucketEntry(ref v) => v.as_ref(),
62488            Self::ColdArchiveArchivedLeaf(ref v) => v.as_ref(),
62489            Self::ColdArchiveDeletedLeaf(ref v) => v.as_ref(),
62490            Self::ColdArchiveBoundaryLeaf(ref v) => v.as_ref(),
62491            Self::ColdArchiveHashEntry(ref v) => v.as_ref(),
62492            Self::ColdArchiveBucketEntry(ref v) => v.as_ref(),
62493            Self::UpgradeType(ref v) => v.as_ref(),
62494            Self::StellarValueType(ref v) => v.as_ref(),
62495            Self::LedgerCloseValueSignature(ref v) => v.as_ref(),
62496            Self::StellarValue(ref v) => v.as_ref(),
62497            Self::StellarValueExt(ref v) => v.as_ref(),
62498            Self::LedgerHeaderFlags(ref v) => v.as_ref(),
62499            Self::LedgerHeaderExtensionV1(ref v) => v.as_ref(),
62500            Self::LedgerHeaderExtensionV1Ext(ref v) => v.as_ref(),
62501            Self::LedgerHeader(ref v) => v.as_ref(),
62502            Self::LedgerHeaderExt(ref v) => v.as_ref(),
62503            Self::LedgerUpgradeType(ref v) => v.as_ref(),
62504            Self::ConfigUpgradeSetKey(ref v) => v.as_ref(),
62505            Self::LedgerUpgrade(ref v) => v.as_ref(),
62506            Self::ConfigUpgradeSet(ref v) => v.as_ref(),
62507            Self::TxSetComponentType(ref v) => v.as_ref(),
62508            Self::TxExecutionThread(ref v) => v.as_ref(),
62509            Self::ParallelTxExecutionStage(ref v) => v.as_ref(),
62510            Self::ParallelTxsComponent(ref v) => v.as_ref(),
62511            Self::TxSetComponent(ref v) => v.as_ref(),
62512            Self::TxSetComponentTxsMaybeDiscountedFee(ref v) => v.as_ref(),
62513            Self::TransactionPhase(ref v) => v.as_ref(),
62514            Self::TransactionSet(ref v) => v.as_ref(),
62515            Self::TransactionSetV1(ref v) => v.as_ref(),
62516            Self::GeneralizedTransactionSet(ref v) => v.as_ref(),
62517            Self::TransactionResultPair(ref v) => v.as_ref(),
62518            Self::TransactionResultSet(ref v) => v.as_ref(),
62519            Self::TransactionHistoryEntry(ref v) => v.as_ref(),
62520            Self::TransactionHistoryEntryExt(ref v) => v.as_ref(),
62521            Self::TransactionHistoryResultEntry(ref v) => v.as_ref(),
62522            Self::TransactionHistoryResultEntryExt(ref v) => v.as_ref(),
62523            Self::LedgerHeaderHistoryEntry(ref v) => v.as_ref(),
62524            Self::LedgerHeaderHistoryEntryExt(ref v) => v.as_ref(),
62525            Self::LedgerScpMessages(ref v) => v.as_ref(),
62526            Self::ScpHistoryEntryV0(ref v) => v.as_ref(),
62527            Self::ScpHistoryEntry(ref v) => v.as_ref(),
62528            Self::LedgerEntryChangeType(ref v) => v.as_ref(),
62529            Self::LedgerEntryChange(ref v) => v.as_ref(),
62530            Self::LedgerEntryChanges(ref v) => v.as_ref(),
62531            Self::OperationMeta(ref v) => v.as_ref(),
62532            Self::TransactionMetaV1(ref v) => v.as_ref(),
62533            Self::TransactionMetaV2(ref v) => v.as_ref(),
62534            Self::ContractEventType(ref v) => v.as_ref(),
62535            Self::ContractEvent(ref v) => v.as_ref(),
62536            Self::ContractEventBody(ref v) => v.as_ref(),
62537            Self::ContractEventV0(ref v) => v.as_ref(),
62538            Self::DiagnosticEvent(ref v) => v.as_ref(),
62539            Self::SorobanTransactionMetaExtV1(ref v) => v.as_ref(),
62540            Self::SorobanTransactionMetaExt(ref v) => v.as_ref(),
62541            Self::SorobanTransactionMeta(ref v) => v.as_ref(),
62542            Self::TransactionMetaV3(ref v) => v.as_ref(),
62543            Self::InvokeHostFunctionSuccessPreImage(ref v) => v.as_ref(),
62544            Self::TransactionMeta(ref v) => v.as_ref(),
62545            Self::TransactionResultMeta(ref v) => v.as_ref(),
62546            Self::UpgradeEntryMeta(ref v) => v.as_ref(),
62547            Self::LedgerCloseMetaV0(ref v) => v.as_ref(),
62548            Self::LedgerCloseMetaExtV1(ref v) => v.as_ref(),
62549            Self::LedgerCloseMetaExtV2(ref v) => v.as_ref(),
62550            Self::LedgerCloseMetaExt(ref v) => v.as_ref(),
62551            Self::LedgerCloseMetaV1(ref v) => v.as_ref(),
62552            Self::LedgerCloseMeta(ref v) => v.as_ref(),
62553            Self::ErrorCode(ref v) => v.as_ref(),
62554            Self::SError(ref v) => v.as_ref(),
62555            Self::SendMore(ref v) => v.as_ref(),
62556            Self::SendMoreExtended(ref v) => v.as_ref(),
62557            Self::AuthCert(ref v) => v.as_ref(),
62558            Self::Hello(ref v) => v.as_ref(),
62559            Self::Auth(ref v) => v.as_ref(),
62560            Self::IpAddrType(ref v) => v.as_ref(),
62561            Self::PeerAddress(ref v) => v.as_ref(),
62562            Self::PeerAddressIp(ref v) => v.as_ref(),
62563            Self::MessageType(ref v) => v.as_ref(),
62564            Self::DontHave(ref v) => v.as_ref(),
62565            Self::SurveyMessageCommandType(ref v) => v.as_ref(),
62566            Self::SurveyMessageResponseType(ref v) => v.as_ref(),
62567            Self::TimeSlicedSurveyStartCollectingMessage(ref v) => v.as_ref(),
62568            Self::SignedTimeSlicedSurveyStartCollectingMessage(ref v) => v.as_ref(),
62569            Self::TimeSlicedSurveyStopCollectingMessage(ref v) => v.as_ref(),
62570            Self::SignedTimeSlicedSurveyStopCollectingMessage(ref v) => v.as_ref(),
62571            Self::SurveyRequestMessage(ref v) => v.as_ref(),
62572            Self::TimeSlicedSurveyRequestMessage(ref v) => v.as_ref(),
62573            Self::SignedSurveyRequestMessage(ref v) => v.as_ref(),
62574            Self::SignedTimeSlicedSurveyRequestMessage(ref v) => v.as_ref(),
62575            Self::EncryptedBody(ref v) => v.as_ref(),
62576            Self::SurveyResponseMessage(ref v) => v.as_ref(),
62577            Self::TimeSlicedSurveyResponseMessage(ref v) => v.as_ref(),
62578            Self::SignedSurveyResponseMessage(ref v) => v.as_ref(),
62579            Self::SignedTimeSlicedSurveyResponseMessage(ref v) => v.as_ref(),
62580            Self::PeerStats(ref v) => v.as_ref(),
62581            Self::PeerStatList(ref v) => v.as_ref(),
62582            Self::TimeSlicedNodeData(ref v) => v.as_ref(),
62583            Self::TimeSlicedPeerData(ref v) => v.as_ref(),
62584            Self::TimeSlicedPeerDataList(ref v) => v.as_ref(),
62585            Self::TopologyResponseBodyV0(ref v) => v.as_ref(),
62586            Self::TopologyResponseBodyV1(ref v) => v.as_ref(),
62587            Self::TopologyResponseBodyV2(ref v) => v.as_ref(),
62588            Self::SurveyResponseBody(ref v) => v.as_ref(),
62589            Self::TxAdvertVector(ref v) => v.as_ref(),
62590            Self::FloodAdvert(ref v) => v.as_ref(),
62591            Self::TxDemandVector(ref v) => v.as_ref(),
62592            Self::FloodDemand(ref v) => v.as_ref(),
62593            Self::StellarMessage(ref v) => v.as_ref(),
62594            Self::AuthenticatedMessage(ref v) => v.as_ref(),
62595            Self::AuthenticatedMessageV0(ref v) => v.as_ref(),
62596            Self::LiquidityPoolParameters(ref v) => v.as_ref(),
62597            Self::MuxedAccount(ref v) => v.as_ref(),
62598            Self::MuxedAccountMed25519(ref v) => v.as_ref(),
62599            Self::DecoratedSignature(ref v) => v.as_ref(),
62600            Self::OperationType(ref v) => v.as_ref(),
62601            Self::CreateAccountOp(ref v) => v.as_ref(),
62602            Self::PaymentOp(ref v) => v.as_ref(),
62603            Self::PathPaymentStrictReceiveOp(ref v) => v.as_ref(),
62604            Self::PathPaymentStrictSendOp(ref v) => v.as_ref(),
62605            Self::ManageSellOfferOp(ref v) => v.as_ref(),
62606            Self::ManageBuyOfferOp(ref v) => v.as_ref(),
62607            Self::CreatePassiveSellOfferOp(ref v) => v.as_ref(),
62608            Self::SetOptionsOp(ref v) => v.as_ref(),
62609            Self::ChangeTrustAsset(ref v) => v.as_ref(),
62610            Self::ChangeTrustOp(ref v) => v.as_ref(),
62611            Self::AllowTrustOp(ref v) => v.as_ref(),
62612            Self::ManageDataOp(ref v) => v.as_ref(),
62613            Self::BumpSequenceOp(ref v) => v.as_ref(),
62614            Self::CreateClaimableBalanceOp(ref v) => v.as_ref(),
62615            Self::ClaimClaimableBalanceOp(ref v) => v.as_ref(),
62616            Self::BeginSponsoringFutureReservesOp(ref v) => v.as_ref(),
62617            Self::RevokeSponsorshipType(ref v) => v.as_ref(),
62618            Self::RevokeSponsorshipOp(ref v) => v.as_ref(),
62619            Self::RevokeSponsorshipOpSigner(ref v) => v.as_ref(),
62620            Self::ClawbackOp(ref v) => v.as_ref(),
62621            Self::ClawbackClaimableBalanceOp(ref v) => v.as_ref(),
62622            Self::SetTrustLineFlagsOp(ref v) => v.as_ref(),
62623            Self::LiquidityPoolDepositOp(ref v) => v.as_ref(),
62624            Self::LiquidityPoolWithdrawOp(ref v) => v.as_ref(),
62625            Self::HostFunctionType(ref v) => v.as_ref(),
62626            Self::ContractIdPreimageType(ref v) => v.as_ref(),
62627            Self::ContractIdPreimage(ref v) => v.as_ref(),
62628            Self::ContractIdPreimageFromAddress(ref v) => v.as_ref(),
62629            Self::CreateContractArgs(ref v) => v.as_ref(),
62630            Self::CreateContractArgsV2(ref v) => v.as_ref(),
62631            Self::InvokeContractArgs(ref v) => v.as_ref(),
62632            Self::HostFunction(ref v) => v.as_ref(),
62633            Self::SorobanAuthorizedFunctionType(ref v) => v.as_ref(),
62634            Self::SorobanAuthorizedFunction(ref v) => v.as_ref(),
62635            Self::SorobanAuthorizedInvocation(ref v) => v.as_ref(),
62636            Self::SorobanAddressCredentials(ref v) => v.as_ref(),
62637            Self::SorobanCredentialsType(ref v) => v.as_ref(),
62638            Self::SorobanCredentials(ref v) => v.as_ref(),
62639            Self::SorobanAuthorizationEntry(ref v) => v.as_ref(),
62640            Self::InvokeHostFunctionOp(ref v) => v.as_ref(),
62641            Self::ExtendFootprintTtlOp(ref v) => v.as_ref(),
62642            Self::RestoreFootprintOp(ref v) => v.as_ref(),
62643            Self::Operation(ref v) => v.as_ref(),
62644            Self::OperationBody(ref v) => v.as_ref(),
62645            Self::HashIdPreimage(ref v) => v.as_ref(),
62646            Self::HashIdPreimageOperationId(ref v) => v.as_ref(),
62647            Self::HashIdPreimageRevokeId(ref v) => v.as_ref(),
62648            Self::HashIdPreimageContractId(ref v) => v.as_ref(),
62649            Self::HashIdPreimageSorobanAuthorization(ref v) => v.as_ref(),
62650            Self::MemoType(ref v) => v.as_ref(),
62651            Self::Memo(ref v) => v.as_ref(),
62652            Self::TimeBounds(ref v) => v.as_ref(),
62653            Self::LedgerBounds(ref v) => v.as_ref(),
62654            Self::PreconditionsV2(ref v) => v.as_ref(),
62655            Self::PreconditionType(ref v) => v.as_ref(),
62656            Self::Preconditions(ref v) => v.as_ref(),
62657            Self::LedgerFootprint(ref v) => v.as_ref(),
62658            Self::ArchivalProofType(ref v) => v.as_ref(),
62659            Self::ArchivalProofNode(ref v) => v.as_ref(),
62660            Self::ProofLevel(ref v) => v.as_ref(),
62661            Self::ExistenceProofBody(ref v) => v.as_ref(),
62662            Self::NonexistenceProofBody(ref v) => v.as_ref(),
62663            Self::ArchivalProof(ref v) => v.as_ref(),
62664            Self::ArchivalProofBody(ref v) => v.as_ref(),
62665            Self::SorobanResources(ref v) => v.as_ref(),
62666            Self::SorobanTransactionData(ref v) => v.as_ref(),
62667            Self::SorobanTransactionDataExt(ref v) => v.as_ref(),
62668            Self::TransactionV0(ref v) => v.as_ref(),
62669            Self::TransactionV0Ext(ref v) => v.as_ref(),
62670            Self::TransactionV0Envelope(ref v) => v.as_ref(),
62671            Self::Transaction(ref v) => v.as_ref(),
62672            Self::TransactionExt(ref v) => v.as_ref(),
62673            Self::TransactionV1Envelope(ref v) => v.as_ref(),
62674            Self::FeeBumpTransaction(ref v) => v.as_ref(),
62675            Self::FeeBumpTransactionInnerTx(ref v) => v.as_ref(),
62676            Self::FeeBumpTransactionExt(ref v) => v.as_ref(),
62677            Self::FeeBumpTransactionEnvelope(ref v) => v.as_ref(),
62678            Self::TransactionEnvelope(ref v) => v.as_ref(),
62679            Self::TransactionSignaturePayload(ref v) => v.as_ref(),
62680            Self::TransactionSignaturePayloadTaggedTransaction(ref v) => v.as_ref(),
62681            Self::ClaimAtomType(ref v) => v.as_ref(),
62682            Self::ClaimOfferAtomV0(ref v) => v.as_ref(),
62683            Self::ClaimOfferAtom(ref v) => v.as_ref(),
62684            Self::ClaimLiquidityAtom(ref v) => v.as_ref(),
62685            Self::ClaimAtom(ref v) => v.as_ref(),
62686            Self::CreateAccountResultCode(ref v) => v.as_ref(),
62687            Self::CreateAccountResult(ref v) => v.as_ref(),
62688            Self::PaymentResultCode(ref v) => v.as_ref(),
62689            Self::PaymentResult(ref v) => v.as_ref(),
62690            Self::PathPaymentStrictReceiveResultCode(ref v) => v.as_ref(),
62691            Self::SimplePaymentResult(ref v) => v.as_ref(),
62692            Self::PathPaymentStrictReceiveResult(ref v) => v.as_ref(),
62693            Self::PathPaymentStrictReceiveResultSuccess(ref v) => v.as_ref(),
62694            Self::PathPaymentStrictSendResultCode(ref v) => v.as_ref(),
62695            Self::PathPaymentStrictSendResult(ref v) => v.as_ref(),
62696            Self::PathPaymentStrictSendResultSuccess(ref v) => v.as_ref(),
62697            Self::ManageSellOfferResultCode(ref v) => v.as_ref(),
62698            Self::ManageOfferEffect(ref v) => v.as_ref(),
62699            Self::ManageOfferSuccessResult(ref v) => v.as_ref(),
62700            Self::ManageOfferSuccessResultOffer(ref v) => v.as_ref(),
62701            Self::ManageSellOfferResult(ref v) => v.as_ref(),
62702            Self::ManageBuyOfferResultCode(ref v) => v.as_ref(),
62703            Self::ManageBuyOfferResult(ref v) => v.as_ref(),
62704            Self::SetOptionsResultCode(ref v) => v.as_ref(),
62705            Self::SetOptionsResult(ref v) => v.as_ref(),
62706            Self::ChangeTrustResultCode(ref v) => v.as_ref(),
62707            Self::ChangeTrustResult(ref v) => v.as_ref(),
62708            Self::AllowTrustResultCode(ref v) => v.as_ref(),
62709            Self::AllowTrustResult(ref v) => v.as_ref(),
62710            Self::AccountMergeResultCode(ref v) => v.as_ref(),
62711            Self::AccountMergeResult(ref v) => v.as_ref(),
62712            Self::InflationResultCode(ref v) => v.as_ref(),
62713            Self::InflationPayout(ref v) => v.as_ref(),
62714            Self::InflationResult(ref v) => v.as_ref(),
62715            Self::ManageDataResultCode(ref v) => v.as_ref(),
62716            Self::ManageDataResult(ref v) => v.as_ref(),
62717            Self::BumpSequenceResultCode(ref v) => v.as_ref(),
62718            Self::BumpSequenceResult(ref v) => v.as_ref(),
62719            Self::CreateClaimableBalanceResultCode(ref v) => v.as_ref(),
62720            Self::CreateClaimableBalanceResult(ref v) => v.as_ref(),
62721            Self::ClaimClaimableBalanceResultCode(ref v) => v.as_ref(),
62722            Self::ClaimClaimableBalanceResult(ref v) => v.as_ref(),
62723            Self::BeginSponsoringFutureReservesResultCode(ref v) => v.as_ref(),
62724            Self::BeginSponsoringFutureReservesResult(ref v) => v.as_ref(),
62725            Self::EndSponsoringFutureReservesResultCode(ref v) => v.as_ref(),
62726            Self::EndSponsoringFutureReservesResult(ref v) => v.as_ref(),
62727            Self::RevokeSponsorshipResultCode(ref v) => v.as_ref(),
62728            Self::RevokeSponsorshipResult(ref v) => v.as_ref(),
62729            Self::ClawbackResultCode(ref v) => v.as_ref(),
62730            Self::ClawbackResult(ref v) => v.as_ref(),
62731            Self::ClawbackClaimableBalanceResultCode(ref v) => v.as_ref(),
62732            Self::ClawbackClaimableBalanceResult(ref v) => v.as_ref(),
62733            Self::SetTrustLineFlagsResultCode(ref v) => v.as_ref(),
62734            Self::SetTrustLineFlagsResult(ref v) => v.as_ref(),
62735            Self::LiquidityPoolDepositResultCode(ref v) => v.as_ref(),
62736            Self::LiquidityPoolDepositResult(ref v) => v.as_ref(),
62737            Self::LiquidityPoolWithdrawResultCode(ref v) => v.as_ref(),
62738            Self::LiquidityPoolWithdrawResult(ref v) => v.as_ref(),
62739            Self::InvokeHostFunctionResultCode(ref v) => v.as_ref(),
62740            Self::InvokeHostFunctionResult(ref v) => v.as_ref(),
62741            Self::ExtendFootprintTtlResultCode(ref v) => v.as_ref(),
62742            Self::ExtendFootprintTtlResult(ref v) => v.as_ref(),
62743            Self::RestoreFootprintResultCode(ref v) => v.as_ref(),
62744            Self::RestoreFootprintResult(ref v) => v.as_ref(),
62745            Self::OperationResultCode(ref v) => v.as_ref(),
62746            Self::OperationResult(ref v) => v.as_ref(),
62747            Self::OperationResultTr(ref v) => v.as_ref(),
62748            Self::TransactionResultCode(ref v) => v.as_ref(),
62749            Self::InnerTransactionResult(ref v) => v.as_ref(),
62750            Self::InnerTransactionResultResult(ref v) => v.as_ref(),
62751            Self::InnerTransactionResultExt(ref v) => v.as_ref(),
62752            Self::InnerTransactionResultPair(ref v) => v.as_ref(),
62753            Self::TransactionResult(ref v) => v.as_ref(),
62754            Self::TransactionResultResult(ref v) => v.as_ref(),
62755            Self::TransactionResultExt(ref v) => v.as_ref(),
62756            Self::Hash(ref v) => v.as_ref(),
62757            Self::Uint256(ref v) => v.as_ref(),
62758            Self::Uint32(ref v) => v.as_ref(),
62759            Self::Int32(ref v) => v.as_ref(),
62760            Self::Uint64(ref v) => v.as_ref(),
62761            Self::Int64(ref v) => v.as_ref(),
62762            Self::TimePoint(ref v) => v.as_ref(),
62763            Self::Duration(ref v) => v.as_ref(),
62764            Self::ExtensionPoint(ref v) => v.as_ref(),
62765            Self::CryptoKeyType(ref v) => v.as_ref(),
62766            Self::PublicKeyType(ref v) => v.as_ref(),
62767            Self::SignerKeyType(ref v) => v.as_ref(),
62768            Self::PublicKey(ref v) => v.as_ref(),
62769            Self::SignerKey(ref v) => v.as_ref(),
62770            Self::SignerKeyEd25519SignedPayload(ref v) => v.as_ref(),
62771            Self::Signature(ref v) => v.as_ref(),
62772            Self::SignatureHint(ref v) => v.as_ref(),
62773            Self::NodeId(ref v) => v.as_ref(),
62774            Self::AccountId(ref v) => v.as_ref(),
62775            Self::Curve25519Secret(ref v) => v.as_ref(),
62776            Self::Curve25519Public(ref v) => v.as_ref(),
62777            Self::HmacSha256Key(ref v) => v.as_ref(),
62778            Self::HmacSha256Mac(ref v) => v.as_ref(),
62779            Self::ShortHashSeed(ref v) => v.as_ref(),
62780            Self::BinaryFuseFilterType(ref v) => v.as_ref(),
62781            Self::SerializedBinaryFuseFilter(ref v) => v.as_ref(),
62782        }
62783    }
62784
62785    #[must_use]
62786    #[allow(clippy::too_many_lines)]
62787    pub const fn name(&self) -> &'static str {
62788        match self {
62789            Self::Value(_) => "Value",
62790            Self::ScpBallot(_) => "ScpBallot",
62791            Self::ScpStatementType(_) => "ScpStatementType",
62792            Self::ScpNomination(_) => "ScpNomination",
62793            Self::ScpStatement(_) => "ScpStatement",
62794            Self::ScpStatementPledges(_) => "ScpStatementPledges",
62795            Self::ScpStatementPrepare(_) => "ScpStatementPrepare",
62796            Self::ScpStatementConfirm(_) => "ScpStatementConfirm",
62797            Self::ScpStatementExternalize(_) => "ScpStatementExternalize",
62798            Self::ScpEnvelope(_) => "ScpEnvelope",
62799            Self::ScpQuorumSet(_) => "ScpQuorumSet",
62800            Self::ConfigSettingContractExecutionLanesV0(_) => {
62801                "ConfigSettingContractExecutionLanesV0"
62802            }
62803            Self::ConfigSettingContractComputeV0(_) => "ConfigSettingContractComputeV0",
62804            Self::ConfigSettingContractParallelComputeV0(_) => {
62805                "ConfigSettingContractParallelComputeV0"
62806            }
62807            Self::ConfigSettingContractLedgerCostV0(_) => "ConfigSettingContractLedgerCostV0",
62808            Self::ConfigSettingContractHistoricalDataV0(_) => {
62809                "ConfigSettingContractHistoricalDataV0"
62810            }
62811            Self::ConfigSettingContractEventsV0(_) => "ConfigSettingContractEventsV0",
62812            Self::ConfigSettingContractBandwidthV0(_) => "ConfigSettingContractBandwidthV0",
62813            Self::ContractCostType(_) => "ContractCostType",
62814            Self::ContractCostParamEntry(_) => "ContractCostParamEntry",
62815            Self::StateArchivalSettings(_) => "StateArchivalSettings",
62816            Self::EvictionIterator(_) => "EvictionIterator",
62817            Self::ContractCostParams(_) => "ContractCostParams",
62818            Self::ConfigSettingId(_) => "ConfigSettingId",
62819            Self::ConfigSettingEntry(_) => "ConfigSettingEntry",
62820            Self::ScEnvMetaKind(_) => "ScEnvMetaKind",
62821            Self::ScEnvMetaEntry(_) => "ScEnvMetaEntry",
62822            Self::ScEnvMetaEntryInterfaceVersion(_) => "ScEnvMetaEntryInterfaceVersion",
62823            Self::ScMetaV0(_) => "ScMetaV0",
62824            Self::ScMetaKind(_) => "ScMetaKind",
62825            Self::ScMetaEntry(_) => "ScMetaEntry",
62826            Self::ScSpecType(_) => "ScSpecType",
62827            Self::ScSpecTypeOption(_) => "ScSpecTypeOption",
62828            Self::ScSpecTypeResult(_) => "ScSpecTypeResult",
62829            Self::ScSpecTypeVec(_) => "ScSpecTypeVec",
62830            Self::ScSpecTypeMap(_) => "ScSpecTypeMap",
62831            Self::ScSpecTypeTuple(_) => "ScSpecTypeTuple",
62832            Self::ScSpecTypeBytesN(_) => "ScSpecTypeBytesN",
62833            Self::ScSpecTypeUdt(_) => "ScSpecTypeUdt",
62834            Self::ScSpecTypeDef(_) => "ScSpecTypeDef",
62835            Self::ScSpecUdtStructFieldV0(_) => "ScSpecUdtStructFieldV0",
62836            Self::ScSpecUdtStructV0(_) => "ScSpecUdtStructV0",
62837            Self::ScSpecUdtUnionCaseVoidV0(_) => "ScSpecUdtUnionCaseVoidV0",
62838            Self::ScSpecUdtUnionCaseTupleV0(_) => "ScSpecUdtUnionCaseTupleV0",
62839            Self::ScSpecUdtUnionCaseV0Kind(_) => "ScSpecUdtUnionCaseV0Kind",
62840            Self::ScSpecUdtUnionCaseV0(_) => "ScSpecUdtUnionCaseV0",
62841            Self::ScSpecUdtUnionV0(_) => "ScSpecUdtUnionV0",
62842            Self::ScSpecUdtEnumCaseV0(_) => "ScSpecUdtEnumCaseV0",
62843            Self::ScSpecUdtEnumV0(_) => "ScSpecUdtEnumV0",
62844            Self::ScSpecUdtErrorEnumCaseV0(_) => "ScSpecUdtErrorEnumCaseV0",
62845            Self::ScSpecUdtErrorEnumV0(_) => "ScSpecUdtErrorEnumV0",
62846            Self::ScSpecFunctionInputV0(_) => "ScSpecFunctionInputV0",
62847            Self::ScSpecFunctionV0(_) => "ScSpecFunctionV0",
62848            Self::ScSpecEntryKind(_) => "ScSpecEntryKind",
62849            Self::ScSpecEntry(_) => "ScSpecEntry",
62850            Self::ScValType(_) => "ScValType",
62851            Self::ScErrorType(_) => "ScErrorType",
62852            Self::ScErrorCode(_) => "ScErrorCode",
62853            Self::ScError(_) => "ScError",
62854            Self::UInt128Parts(_) => "UInt128Parts",
62855            Self::Int128Parts(_) => "Int128Parts",
62856            Self::UInt256Parts(_) => "UInt256Parts",
62857            Self::Int256Parts(_) => "Int256Parts",
62858            Self::ContractExecutableType(_) => "ContractExecutableType",
62859            Self::ContractExecutable(_) => "ContractExecutable",
62860            Self::ScAddressType(_) => "ScAddressType",
62861            Self::ScAddress(_) => "ScAddress",
62862            Self::ScVec(_) => "ScVec",
62863            Self::ScMap(_) => "ScMap",
62864            Self::ScBytes(_) => "ScBytes",
62865            Self::ScString(_) => "ScString",
62866            Self::ScSymbol(_) => "ScSymbol",
62867            Self::ScNonceKey(_) => "ScNonceKey",
62868            Self::ScContractInstance(_) => "ScContractInstance",
62869            Self::ScVal(_) => "ScVal",
62870            Self::ScMapEntry(_) => "ScMapEntry",
62871            Self::StoredTransactionSet(_) => "StoredTransactionSet",
62872            Self::StoredDebugTransactionSet(_) => "StoredDebugTransactionSet",
62873            Self::PersistedScpStateV0(_) => "PersistedScpStateV0",
62874            Self::PersistedScpStateV1(_) => "PersistedScpStateV1",
62875            Self::PersistedScpState(_) => "PersistedScpState",
62876            Self::Thresholds(_) => "Thresholds",
62877            Self::String32(_) => "String32",
62878            Self::String64(_) => "String64",
62879            Self::SequenceNumber(_) => "SequenceNumber",
62880            Self::DataValue(_) => "DataValue",
62881            Self::PoolId(_) => "PoolId",
62882            Self::AssetCode4(_) => "AssetCode4",
62883            Self::AssetCode12(_) => "AssetCode12",
62884            Self::AssetType(_) => "AssetType",
62885            Self::AssetCode(_) => "AssetCode",
62886            Self::AlphaNum4(_) => "AlphaNum4",
62887            Self::AlphaNum12(_) => "AlphaNum12",
62888            Self::Asset(_) => "Asset",
62889            Self::Price(_) => "Price",
62890            Self::Liabilities(_) => "Liabilities",
62891            Self::ThresholdIndexes(_) => "ThresholdIndexes",
62892            Self::LedgerEntryType(_) => "LedgerEntryType",
62893            Self::Signer(_) => "Signer",
62894            Self::AccountFlags(_) => "AccountFlags",
62895            Self::SponsorshipDescriptor(_) => "SponsorshipDescriptor",
62896            Self::AccountEntryExtensionV3(_) => "AccountEntryExtensionV3",
62897            Self::AccountEntryExtensionV2(_) => "AccountEntryExtensionV2",
62898            Self::AccountEntryExtensionV2Ext(_) => "AccountEntryExtensionV2Ext",
62899            Self::AccountEntryExtensionV1(_) => "AccountEntryExtensionV1",
62900            Self::AccountEntryExtensionV1Ext(_) => "AccountEntryExtensionV1Ext",
62901            Self::AccountEntry(_) => "AccountEntry",
62902            Self::AccountEntryExt(_) => "AccountEntryExt",
62903            Self::TrustLineFlags(_) => "TrustLineFlags",
62904            Self::LiquidityPoolType(_) => "LiquidityPoolType",
62905            Self::TrustLineAsset(_) => "TrustLineAsset",
62906            Self::TrustLineEntryExtensionV2(_) => "TrustLineEntryExtensionV2",
62907            Self::TrustLineEntryExtensionV2Ext(_) => "TrustLineEntryExtensionV2Ext",
62908            Self::TrustLineEntry(_) => "TrustLineEntry",
62909            Self::TrustLineEntryExt(_) => "TrustLineEntryExt",
62910            Self::TrustLineEntryV1(_) => "TrustLineEntryV1",
62911            Self::TrustLineEntryV1Ext(_) => "TrustLineEntryV1Ext",
62912            Self::OfferEntryFlags(_) => "OfferEntryFlags",
62913            Self::OfferEntry(_) => "OfferEntry",
62914            Self::OfferEntryExt(_) => "OfferEntryExt",
62915            Self::DataEntry(_) => "DataEntry",
62916            Self::DataEntryExt(_) => "DataEntryExt",
62917            Self::ClaimPredicateType(_) => "ClaimPredicateType",
62918            Self::ClaimPredicate(_) => "ClaimPredicate",
62919            Self::ClaimantType(_) => "ClaimantType",
62920            Self::Claimant(_) => "Claimant",
62921            Self::ClaimantV0(_) => "ClaimantV0",
62922            Self::ClaimableBalanceIdType(_) => "ClaimableBalanceIdType",
62923            Self::ClaimableBalanceId(_) => "ClaimableBalanceId",
62924            Self::ClaimableBalanceFlags(_) => "ClaimableBalanceFlags",
62925            Self::ClaimableBalanceEntryExtensionV1(_) => "ClaimableBalanceEntryExtensionV1",
62926            Self::ClaimableBalanceEntryExtensionV1Ext(_) => "ClaimableBalanceEntryExtensionV1Ext",
62927            Self::ClaimableBalanceEntry(_) => "ClaimableBalanceEntry",
62928            Self::ClaimableBalanceEntryExt(_) => "ClaimableBalanceEntryExt",
62929            Self::LiquidityPoolConstantProductParameters(_) => {
62930                "LiquidityPoolConstantProductParameters"
62931            }
62932            Self::LiquidityPoolEntry(_) => "LiquidityPoolEntry",
62933            Self::LiquidityPoolEntryBody(_) => "LiquidityPoolEntryBody",
62934            Self::LiquidityPoolEntryConstantProduct(_) => "LiquidityPoolEntryConstantProduct",
62935            Self::ContractDataDurability(_) => "ContractDataDurability",
62936            Self::ContractDataEntry(_) => "ContractDataEntry",
62937            Self::ContractCodeCostInputs(_) => "ContractCodeCostInputs",
62938            Self::ContractCodeEntry(_) => "ContractCodeEntry",
62939            Self::ContractCodeEntryExt(_) => "ContractCodeEntryExt",
62940            Self::ContractCodeEntryV1(_) => "ContractCodeEntryV1",
62941            Self::TtlEntry(_) => "TtlEntry",
62942            Self::LedgerEntryExtensionV1(_) => "LedgerEntryExtensionV1",
62943            Self::LedgerEntryExtensionV1Ext(_) => "LedgerEntryExtensionV1Ext",
62944            Self::LedgerEntry(_) => "LedgerEntry",
62945            Self::LedgerEntryData(_) => "LedgerEntryData",
62946            Self::LedgerEntryExt(_) => "LedgerEntryExt",
62947            Self::LedgerKey(_) => "LedgerKey",
62948            Self::LedgerKeyAccount(_) => "LedgerKeyAccount",
62949            Self::LedgerKeyTrustLine(_) => "LedgerKeyTrustLine",
62950            Self::LedgerKeyOffer(_) => "LedgerKeyOffer",
62951            Self::LedgerKeyData(_) => "LedgerKeyData",
62952            Self::LedgerKeyClaimableBalance(_) => "LedgerKeyClaimableBalance",
62953            Self::LedgerKeyLiquidityPool(_) => "LedgerKeyLiquidityPool",
62954            Self::LedgerKeyContractData(_) => "LedgerKeyContractData",
62955            Self::LedgerKeyContractCode(_) => "LedgerKeyContractCode",
62956            Self::LedgerKeyConfigSetting(_) => "LedgerKeyConfigSetting",
62957            Self::LedgerKeyTtl(_) => "LedgerKeyTtl",
62958            Self::EnvelopeType(_) => "EnvelopeType",
62959            Self::BucketListType(_) => "BucketListType",
62960            Self::BucketEntryType(_) => "BucketEntryType",
62961            Self::HotArchiveBucketEntryType(_) => "HotArchiveBucketEntryType",
62962            Self::ColdArchiveBucketEntryType(_) => "ColdArchiveBucketEntryType",
62963            Self::BucketMetadata(_) => "BucketMetadata",
62964            Self::BucketMetadataExt(_) => "BucketMetadataExt",
62965            Self::BucketEntry(_) => "BucketEntry",
62966            Self::HotArchiveBucketEntry(_) => "HotArchiveBucketEntry",
62967            Self::ColdArchiveArchivedLeaf(_) => "ColdArchiveArchivedLeaf",
62968            Self::ColdArchiveDeletedLeaf(_) => "ColdArchiveDeletedLeaf",
62969            Self::ColdArchiveBoundaryLeaf(_) => "ColdArchiveBoundaryLeaf",
62970            Self::ColdArchiveHashEntry(_) => "ColdArchiveHashEntry",
62971            Self::ColdArchiveBucketEntry(_) => "ColdArchiveBucketEntry",
62972            Self::UpgradeType(_) => "UpgradeType",
62973            Self::StellarValueType(_) => "StellarValueType",
62974            Self::LedgerCloseValueSignature(_) => "LedgerCloseValueSignature",
62975            Self::StellarValue(_) => "StellarValue",
62976            Self::StellarValueExt(_) => "StellarValueExt",
62977            Self::LedgerHeaderFlags(_) => "LedgerHeaderFlags",
62978            Self::LedgerHeaderExtensionV1(_) => "LedgerHeaderExtensionV1",
62979            Self::LedgerHeaderExtensionV1Ext(_) => "LedgerHeaderExtensionV1Ext",
62980            Self::LedgerHeader(_) => "LedgerHeader",
62981            Self::LedgerHeaderExt(_) => "LedgerHeaderExt",
62982            Self::LedgerUpgradeType(_) => "LedgerUpgradeType",
62983            Self::ConfigUpgradeSetKey(_) => "ConfigUpgradeSetKey",
62984            Self::LedgerUpgrade(_) => "LedgerUpgrade",
62985            Self::ConfigUpgradeSet(_) => "ConfigUpgradeSet",
62986            Self::TxSetComponentType(_) => "TxSetComponentType",
62987            Self::TxExecutionThread(_) => "TxExecutionThread",
62988            Self::ParallelTxExecutionStage(_) => "ParallelTxExecutionStage",
62989            Self::ParallelTxsComponent(_) => "ParallelTxsComponent",
62990            Self::TxSetComponent(_) => "TxSetComponent",
62991            Self::TxSetComponentTxsMaybeDiscountedFee(_) => "TxSetComponentTxsMaybeDiscountedFee",
62992            Self::TransactionPhase(_) => "TransactionPhase",
62993            Self::TransactionSet(_) => "TransactionSet",
62994            Self::TransactionSetV1(_) => "TransactionSetV1",
62995            Self::GeneralizedTransactionSet(_) => "GeneralizedTransactionSet",
62996            Self::TransactionResultPair(_) => "TransactionResultPair",
62997            Self::TransactionResultSet(_) => "TransactionResultSet",
62998            Self::TransactionHistoryEntry(_) => "TransactionHistoryEntry",
62999            Self::TransactionHistoryEntryExt(_) => "TransactionHistoryEntryExt",
63000            Self::TransactionHistoryResultEntry(_) => "TransactionHistoryResultEntry",
63001            Self::TransactionHistoryResultEntryExt(_) => "TransactionHistoryResultEntryExt",
63002            Self::LedgerHeaderHistoryEntry(_) => "LedgerHeaderHistoryEntry",
63003            Self::LedgerHeaderHistoryEntryExt(_) => "LedgerHeaderHistoryEntryExt",
63004            Self::LedgerScpMessages(_) => "LedgerScpMessages",
63005            Self::ScpHistoryEntryV0(_) => "ScpHistoryEntryV0",
63006            Self::ScpHistoryEntry(_) => "ScpHistoryEntry",
63007            Self::LedgerEntryChangeType(_) => "LedgerEntryChangeType",
63008            Self::LedgerEntryChange(_) => "LedgerEntryChange",
63009            Self::LedgerEntryChanges(_) => "LedgerEntryChanges",
63010            Self::OperationMeta(_) => "OperationMeta",
63011            Self::TransactionMetaV1(_) => "TransactionMetaV1",
63012            Self::TransactionMetaV2(_) => "TransactionMetaV2",
63013            Self::ContractEventType(_) => "ContractEventType",
63014            Self::ContractEvent(_) => "ContractEvent",
63015            Self::ContractEventBody(_) => "ContractEventBody",
63016            Self::ContractEventV0(_) => "ContractEventV0",
63017            Self::DiagnosticEvent(_) => "DiagnosticEvent",
63018            Self::SorobanTransactionMetaExtV1(_) => "SorobanTransactionMetaExtV1",
63019            Self::SorobanTransactionMetaExt(_) => "SorobanTransactionMetaExt",
63020            Self::SorobanTransactionMeta(_) => "SorobanTransactionMeta",
63021            Self::TransactionMetaV3(_) => "TransactionMetaV3",
63022            Self::InvokeHostFunctionSuccessPreImage(_) => "InvokeHostFunctionSuccessPreImage",
63023            Self::TransactionMeta(_) => "TransactionMeta",
63024            Self::TransactionResultMeta(_) => "TransactionResultMeta",
63025            Self::UpgradeEntryMeta(_) => "UpgradeEntryMeta",
63026            Self::LedgerCloseMetaV0(_) => "LedgerCloseMetaV0",
63027            Self::LedgerCloseMetaExtV1(_) => "LedgerCloseMetaExtV1",
63028            Self::LedgerCloseMetaExtV2(_) => "LedgerCloseMetaExtV2",
63029            Self::LedgerCloseMetaExt(_) => "LedgerCloseMetaExt",
63030            Self::LedgerCloseMetaV1(_) => "LedgerCloseMetaV1",
63031            Self::LedgerCloseMeta(_) => "LedgerCloseMeta",
63032            Self::ErrorCode(_) => "ErrorCode",
63033            Self::SError(_) => "SError",
63034            Self::SendMore(_) => "SendMore",
63035            Self::SendMoreExtended(_) => "SendMoreExtended",
63036            Self::AuthCert(_) => "AuthCert",
63037            Self::Hello(_) => "Hello",
63038            Self::Auth(_) => "Auth",
63039            Self::IpAddrType(_) => "IpAddrType",
63040            Self::PeerAddress(_) => "PeerAddress",
63041            Self::PeerAddressIp(_) => "PeerAddressIp",
63042            Self::MessageType(_) => "MessageType",
63043            Self::DontHave(_) => "DontHave",
63044            Self::SurveyMessageCommandType(_) => "SurveyMessageCommandType",
63045            Self::SurveyMessageResponseType(_) => "SurveyMessageResponseType",
63046            Self::TimeSlicedSurveyStartCollectingMessage(_) => {
63047                "TimeSlicedSurveyStartCollectingMessage"
63048            }
63049            Self::SignedTimeSlicedSurveyStartCollectingMessage(_) => {
63050                "SignedTimeSlicedSurveyStartCollectingMessage"
63051            }
63052            Self::TimeSlicedSurveyStopCollectingMessage(_) => {
63053                "TimeSlicedSurveyStopCollectingMessage"
63054            }
63055            Self::SignedTimeSlicedSurveyStopCollectingMessage(_) => {
63056                "SignedTimeSlicedSurveyStopCollectingMessage"
63057            }
63058            Self::SurveyRequestMessage(_) => "SurveyRequestMessage",
63059            Self::TimeSlicedSurveyRequestMessage(_) => "TimeSlicedSurveyRequestMessage",
63060            Self::SignedSurveyRequestMessage(_) => "SignedSurveyRequestMessage",
63061            Self::SignedTimeSlicedSurveyRequestMessage(_) => "SignedTimeSlicedSurveyRequestMessage",
63062            Self::EncryptedBody(_) => "EncryptedBody",
63063            Self::SurveyResponseMessage(_) => "SurveyResponseMessage",
63064            Self::TimeSlicedSurveyResponseMessage(_) => "TimeSlicedSurveyResponseMessage",
63065            Self::SignedSurveyResponseMessage(_) => "SignedSurveyResponseMessage",
63066            Self::SignedTimeSlicedSurveyResponseMessage(_) => {
63067                "SignedTimeSlicedSurveyResponseMessage"
63068            }
63069            Self::PeerStats(_) => "PeerStats",
63070            Self::PeerStatList(_) => "PeerStatList",
63071            Self::TimeSlicedNodeData(_) => "TimeSlicedNodeData",
63072            Self::TimeSlicedPeerData(_) => "TimeSlicedPeerData",
63073            Self::TimeSlicedPeerDataList(_) => "TimeSlicedPeerDataList",
63074            Self::TopologyResponseBodyV0(_) => "TopologyResponseBodyV0",
63075            Self::TopologyResponseBodyV1(_) => "TopologyResponseBodyV1",
63076            Self::TopologyResponseBodyV2(_) => "TopologyResponseBodyV2",
63077            Self::SurveyResponseBody(_) => "SurveyResponseBody",
63078            Self::TxAdvertVector(_) => "TxAdvertVector",
63079            Self::FloodAdvert(_) => "FloodAdvert",
63080            Self::TxDemandVector(_) => "TxDemandVector",
63081            Self::FloodDemand(_) => "FloodDemand",
63082            Self::StellarMessage(_) => "StellarMessage",
63083            Self::AuthenticatedMessage(_) => "AuthenticatedMessage",
63084            Self::AuthenticatedMessageV0(_) => "AuthenticatedMessageV0",
63085            Self::LiquidityPoolParameters(_) => "LiquidityPoolParameters",
63086            Self::MuxedAccount(_) => "MuxedAccount",
63087            Self::MuxedAccountMed25519(_) => "MuxedAccountMed25519",
63088            Self::DecoratedSignature(_) => "DecoratedSignature",
63089            Self::OperationType(_) => "OperationType",
63090            Self::CreateAccountOp(_) => "CreateAccountOp",
63091            Self::PaymentOp(_) => "PaymentOp",
63092            Self::PathPaymentStrictReceiveOp(_) => "PathPaymentStrictReceiveOp",
63093            Self::PathPaymentStrictSendOp(_) => "PathPaymentStrictSendOp",
63094            Self::ManageSellOfferOp(_) => "ManageSellOfferOp",
63095            Self::ManageBuyOfferOp(_) => "ManageBuyOfferOp",
63096            Self::CreatePassiveSellOfferOp(_) => "CreatePassiveSellOfferOp",
63097            Self::SetOptionsOp(_) => "SetOptionsOp",
63098            Self::ChangeTrustAsset(_) => "ChangeTrustAsset",
63099            Self::ChangeTrustOp(_) => "ChangeTrustOp",
63100            Self::AllowTrustOp(_) => "AllowTrustOp",
63101            Self::ManageDataOp(_) => "ManageDataOp",
63102            Self::BumpSequenceOp(_) => "BumpSequenceOp",
63103            Self::CreateClaimableBalanceOp(_) => "CreateClaimableBalanceOp",
63104            Self::ClaimClaimableBalanceOp(_) => "ClaimClaimableBalanceOp",
63105            Self::BeginSponsoringFutureReservesOp(_) => "BeginSponsoringFutureReservesOp",
63106            Self::RevokeSponsorshipType(_) => "RevokeSponsorshipType",
63107            Self::RevokeSponsorshipOp(_) => "RevokeSponsorshipOp",
63108            Self::RevokeSponsorshipOpSigner(_) => "RevokeSponsorshipOpSigner",
63109            Self::ClawbackOp(_) => "ClawbackOp",
63110            Self::ClawbackClaimableBalanceOp(_) => "ClawbackClaimableBalanceOp",
63111            Self::SetTrustLineFlagsOp(_) => "SetTrustLineFlagsOp",
63112            Self::LiquidityPoolDepositOp(_) => "LiquidityPoolDepositOp",
63113            Self::LiquidityPoolWithdrawOp(_) => "LiquidityPoolWithdrawOp",
63114            Self::HostFunctionType(_) => "HostFunctionType",
63115            Self::ContractIdPreimageType(_) => "ContractIdPreimageType",
63116            Self::ContractIdPreimage(_) => "ContractIdPreimage",
63117            Self::ContractIdPreimageFromAddress(_) => "ContractIdPreimageFromAddress",
63118            Self::CreateContractArgs(_) => "CreateContractArgs",
63119            Self::CreateContractArgsV2(_) => "CreateContractArgsV2",
63120            Self::InvokeContractArgs(_) => "InvokeContractArgs",
63121            Self::HostFunction(_) => "HostFunction",
63122            Self::SorobanAuthorizedFunctionType(_) => "SorobanAuthorizedFunctionType",
63123            Self::SorobanAuthorizedFunction(_) => "SorobanAuthorizedFunction",
63124            Self::SorobanAuthorizedInvocation(_) => "SorobanAuthorizedInvocation",
63125            Self::SorobanAddressCredentials(_) => "SorobanAddressCredentials",
63126            Self::SorobanCredentialsType(_) => "SorobanCredentialsType",
63127            Self::SorobanCredentials(_) => "SorobanCredentials",
63128            Self::SorobanAuthorizationEntry(_) => "SorobanAuthorizationEntry",
63129            Self::InvokeHostFunctionOp(_) => "InvokeHostFunctionOp",
63130            Self::ExtendFootprintTtlOp(_) => "ExtendFootprintTtlOp",
63131            Self::RestoreFootprintOp(_) => "RestoreFootprintOp",
63132            Self::Operation(_) => "Operation",
63133            Self::OperationBody(_) => "OperationBody",
63134            Self::HashIdPreimage(_) => "HashIdPreimage",
63135            Self::HashIdPreimageOperationId(_) => "HashIdPreimageOperationId",
63136            Self::HashIdPreimageRevokeId(_) => "HashIdPreimageRevokeId",
63137            Self::HashIdPreimageContractId(_) => "HashIdPreimageContractId",
63138            Self::HashIdPreimageSorobanAuthorization(_) => "HashIdPreimageSorobanAuthorization",
63139            Self::MemoType(_) => "MemoType",
63140            Self::Memo(_) => "Memo",
63141            Self::TimeBounds(_) => "TimeBounds",
63142            Self::LedgerBounds(_) => "LedgerBounds",
63143            Self::PreconditionsV2(_) => "PreconditionsV2",
63144            Self::PreconditionType(_) => "PreconditionType",
63145            Self::Preconditions(_) => "Preconditions",
63146            Self::LedgerFootprint(_) => "LedgerFootprint",
63147            Self::ArchivalProofType(_) => "ArchivalProofType",
63148            Self::ArchivalProofNode(_) => "ArchivalProofNode",
63149            Self::ProofLevel(_) => "ProofLevel",
63150            Self::ExistenceProofBody(_) => "ExistenceProofBody",
63151            Self::NonexistenceProofBody(_) => "NonexistenceProofBody",
63152            Self::ArchivalProof(_) => "ArchivalProof",
63153            Self::ArchivalProofBody(_) => "ArchivalProofBody",
63154            Self::SorobanResources(_) => "SorobanResources",
63155            Self::SorobanTransactionData(_) => "SorobanTransactionData",
63156            Self::SorobanTransactionDataExt(_) => "SorobanTransactionDataExt",
63157            Self::TransactionV0(_) => "TransactionV0",
63158            Self::TransactionV0Ext(_) => "TransactionV0Ext",
63159            Self::TransactionV0Envelope(_) => "TransactionV0Envelope",
63160            Self::Transaction(_) => "Transaction",
63161            Self::TransactionExt(_) => "TransactionExt",
63162            Self::TransactionV1Envelope(_) => "TransactionV1Envelope",
63163            Self::FeeBumpTransaction(_) => "FeeBumpTransaction",
63164            Self::FeeBumpTransactionInnerTx(_) => "FeeBumpTransactionInnerTx",
63165            Self::FeeBumpTransactionExt(_) => "FeeBumpTransactionExt",
63166            Self::FeeBumpTransactionEnvelope(_) => "FeeBumpTransactionEnvelope",
63167            Self::TransactionEnvelope(_) => "TransactionEnvelope",
63168            Self::TransactionSignaturePayload(_) => "TransactionSignaturePayload",
63169            Self::TransactionSignaturePayloadTaggedTransaction(_) => {
63170                "TransactionSignaturePayloadTaggedTransaction"
63171            }
63172            Self::ClaimAtomType(_) => "ClaimAtomType",
63173            Self::ClaimOfferAtomV0(_) => "ClaimOfferAtomV0",
63174            Self::ClaimOfferAtom(_) => "ClaimOfferAtom",
63175            Self::ClaimLiquidityAtom(_) => "ClaimLiquidityAtom",
63176            Self::ClaimAtom(_) => "ClaimAtom",
63177            Self::CreateAccountResultCode(_) => "CreateAccountResultCode",
63178            Self::CreateAccountResult(_) => "CreateAccountResult",
63179            Self::PaymentResultCode(_) => "PaymentResultCode",
63180            Self::PaymentResult(_) => "PaymentResult",
63181            Self::PathPaymentStrictReceiveResultCode(_) => "PathPaymentStrictReceiveResultCode",
63182            Self::SimplePaymentResult(_) => "SimplePaymentResult",
63183            Self::PathPaymentStrictReceiveResult(_) => "PathPaymentStrictReceiveResult",
63184            Self::PathPaymentStrictReceiveResultSuccess(_) => {
63185                "PathPaymentStrictReceiveResultSuccess"
63186            }
63187            Self::PathPaymentStrictSendResultCode(_) => "PathPaymentStrictSendResultCode",
63188            Self::PathPaymentStrictSendResult(_) => "PathPaymentStrictSendResult",
63189            Self::PathPaymentStrictSendResultSuccess(_) => "PathPaymentStrictSendResultSuccess",
63190            Self::ManageSellOfferResultCode(_) => "ManageSellOfferResultCode",
63191            Self::ManageOfferEffect(_) => "ManageOfferEffect",
63192            Self::ManageOfferSuccessResult(_) => "ManageOfferSuccessResult",
63193            Self::ManageOfferSuccessResultOffer(_) => "ManageOfferSuccessResultOffer",
63194            Self::ManageSellOfferResult(_) => "ManageSellOfferResult",
63195            Self::ManageBuyOfferResultCode(_) => "ManageBuyOfferResultCode",
63196            Self::ManageBuyOfferResult(_) => "ManageBuyOfferResult",
63197            Self::SetOptionsResultCode(_) => "SetOptionsResultCode",
63198            Self::SetOptionsResult(_) => "SetOptionsResult",
63199            Self::ChangeTrustResultCode(_) => "ChangeTrustResultCode",
63200            Self::ChangeTrustResult(_) => "ChangeTrustResult",
63201            Self::AllowTrustResultCode(_) => "AllowTrustResultCode",
63202            Self::AllowTrustResult(_) => "AllowTrustResult",
63203            Self::AccountMergeResultCode(_) => "AccountMergeResultCode",
63204            Self::AccountMergeResult(_) => "AccountMergeResult",
63205            Self::InflationResultCode(_) => "InflationResultCode",
63206            Self::InflationPayout(_) => "InflationPayout",
63207            Self::InflationResult(_) => "InflationResult",
63208            Self::ManageDataResultCode(_) => "ManageDataResultCode",
63209            Self::ManageDataResult(_) => "ManageDataResult",
63210            Self::BumpSequenceResultCode(_) => "BumpSequenceResultCode",
63211            Self::BumpSequenceResult(_) => "BumpSequenceResult",
63212            Self::CreateClaimableBalanceResultCode(_) => "CreateClaimableBalanceResultCode",
63213            Self::CreateClaimableBalanceResult(_) => "CreateClaimableBalanceResult",
63214            Self::ClaimClaimableBalanceResultCode(_) => "ClaimClaimableBalanceResultCode",
63215            Self::ClaimClaimableBalanceResult(_) => "ClaimClaimableBalanceResult",
63216            Self::BeginSponsoringFutureReservesResultCode(_) => {
63217                "BeginSponsoringFutureReservesResultCode"
63218            }
63219            Self::BeginSponsoringFutureReservesResult(_) => "BeginSponsoringFutureReservesResult",
63220            Self::EndSponsoringFutureReservesResultCode(_) => {
63221                "EndSponsoringFutureReservesResultCode"
63222            }
63223            Self::EndSponsoringFutureReservesResult(_) => "EndSponsoringFutureReservesResult",
63224            Self::RevokeSponsorshipResultCode(_) => "RevokeSponsorshipResultCode",
63225            Self::RevokeSponsorshipResult(_) => "RevokeSponsorshipResult",
63226            Self::ClawbackResultCode(_) => "ClawbackResultCode",
63227            Self::ClawbackResult(_) => "ClawbackResult",
63228            Self::ClawbackClaimableBalanceResultCode(_) => "ClawbackClaimableBalanceResultCode",
63229            Self::ClawbackClaimableBalanceResult(_) => "ClawbackClaimableBalanceResult",
63230            Self::SetTrustLineFlagsResultCode(_) => "SetTrustLineFlagsResultCode",
63231            Self::SetTrustLineFlagsResult(_) => "SetTrustLineFlagsResult",
63232            Self::LiquidityPoolDepositResultCode(_) => "LiquidityPoolDepositResultCode",
63233            Self::LiquidityPoolDepositResult(_) => "LiquidityPoolDepositResult",
63234            Self::LiquidityPoolWithdrawResultCode(_) => "LiquidityPoolWithdrawResultCode",
63235            Self::LiquidityPoolWithdrawResult(_) => "LiquidityPoolWithdrawResult",
63236            Self::InvokeHostFunctionResultCode(_) => "InvokeHostFunctionResultCode",
63237            Self::InvokeHostFunctionResult(_) => "InvokeHostFunctionResult",
63238            Self::ExtendFootprintTtlResultCode(_) => "ExtendFootprintTtlResultCode",
63239            Self::ExtendFootprintTtlResult(_) => "ExtendFootprintTtlResult",
63240            Self::RestoreFootprintResultCode(_) => "RestoreFootprintResultCode",
63241            Self::RestoreFootprintResult(_) => "RestoreFootprintResult",
63242            Self::OperationResultCode(_) => "OperationResultCode",
63243            Self::OperationResult(_) => "OperationResult",
63244            Self::OperationResultTr(_) => "OperationResultTr",
63245            Self::TransactionResultCode(_) => "TransactionResultCode",
63246            Self::InnerTransactionResult(_) => "InnerTransactionResult",
63247            Self::InnerTransactionResultResult(_) => "InnerTransactionResultResult",
63248            Self::InnerTransactionResultExt(_) => "InnerTransactionResultExt",
63249            Self::InnerTransactionResultPair(_) => "InnerTransactionResultPair",
63250            Self::TransactionResult(_) => "TransactionResult",
63251            Self::TransactionResultResult(_) => "TransactionResultResult",
63252            Self::TransactionResultExt(_) => "TransactionResultExt",
63253            Self::Hash(_) => "Hash",
63254            Self::Uint256(_) => "Uint256",
63255            Self::Uint32(_) => "Uint32",
63256            Self::Int32(_) => "Int32",
63257            Self::Uint64(_) => "Uint64",
63258            Self::Int64(_) => "Int64",
63259            Self::TimePoint(_) => "TimePoint",
63260            Self::Duration(_) => "Duration",
63261            Self::ExtensionPoint(_) => "ExtensionPoint",
63262            Self::CryptoKeyType(_) => "CryptoKeyType",
63263            Self::PublicKeyType(_) => "PublicKeyType",
63264            Self::SignerKeyType(_) => "SignerKeyType",
63265            Self::PublicKey(_) => "PublicKey",
63266            Self::SignerKey(_) => "SignerKey",
63267            Self::SignerKeyEd25519SignedPayload(_) => "SignerKeyEd25519SignedPayload",
63268            Self::Signature(_) => "Signature",
63269            Self::SignatureHint(_) => "SignatureHint",
63270            Self::NodeId(_) => "NodeId",
63271            Self::AccountId(_) => "AccountId",
63272            Self::Curve25519Secret(_) => "Curve25519Secret",
63273            Self::Curve25519Public(_) => "Curve25519Public",
63274            Self::HmacSha256Key(_) => "HmacSha256Key",
63275            Self::HmacSha256Mac(_) => "HmacSha256Mac",
63276            Self::ShortHashSeed(_) => "ShortHashSeed",
63277            Self::BinaryFuseFilterType(_) => "BinaryFuseFilterType",
63278            Self::SerializedBinaryFuseFilter(_) => "SerializedBinaryFuseFilter",
63279        }
63280    }
63281
63282    #[must_use]
63283    #[allow(clippy::too_many_lines)]
63284    pub const fn variants() -> [TypeVariant; 464] {
63285        Self::VARIANTS
63286    }
63287
63288    #[must_use]
63289    #[allow(clippy::too_many_lines)]
63290    pub const fn variant(&self) -> TypeVariant {
63291        match self {
63292            Self::Value(_) => TypeVariant::Value,
63293            Self::ScpBallot(_) => TypeVariant::ScpBallot,
63294            Self::ScpStatementType(_) => TypeVariant::ScpStatementType,
63295            Self::ScpNomination(_) => TypeVariant::ScpNomination,
63296            Self::ScpStatement(_) => TypeVariant::ScpStatement,
63297            Self::ScpStatementPledges(_) => TypeVariant::ScpStatementPledges,
63298            Self::ScpStatementPrepare(_) => TypeVariant::ScpStatementPrepare,
63299            Self::ScpStatementConfirm(_) => TypeVariant::ScpStatementConfirm,
63300            Self::ScpStatementExternalize(_) => TypeVariant::ScpStatementExternalize,
63301            Self::ScpEnvelope(_) => TypeVariant::ScpEnvelope,
63302            Self::ScpQuorumSet(_) => TypeVariant::ScpQuorumSet,
63303            Self::ConfigSettingContractExecutionLanesV0(_) => {
63304                TypeVariant::ConfigSettingContractExecutionLanesV0
63305            }
63306            Self::ConfigSettingContractComputeV0(_) => TypeVariant::ConfigSettingContractComputeV0,
63307            Self::ConfigSettingContractParallelComputeV0(_) => {
63308                TypeVariant::ConfigSettingContractParallelComputeV0
63309            }
63310            Self::ConfigSettingContractLedgerCostV0(_) => {
63311                TypeVariant::ConfigSettingContractLedgerCostV0
63312            }
63313            Self::ConfigSettingContractHistoricalDataV0(_) => {
63314                TypeVariant::ConfigSettingContractHistoricalDataV0
63315            }
63316            Self::ConfigSettingContractEventsV0(_) => TypeVariant::ConfigSettingContractEventsV0,
63317            Self::ConfigSettingContractBandwidthV0(_) => {
63318                TypeVariant::ConfigSettingContractBandwidthV0
63319            }
63320            Self::ContractCostType(_) => TypeVariant::ContractCostType,
63321            Self::ContractCostParamEntry(_) => TypeVariant::ContractCostParamEntry,
63322            Self::StateArchivalSettings(_) => TypeVariant::StateArchivalSettings,
63323            Self::EvictionIterator(_) => TypeVariant::EvictionIterator,
63324            Self::ContractCostParams(_) => TypeVariant::ContractCostParams,
63325            Self::ConfigSettingId(_) => TypeVariant::ConfigSettingId,
63326            Self::ConfigSettingEntry(_) => TypeVariant::ConfigSettingEntry,
63327            Self::ScEnvMetaKind(_) => TypeVariant::ScEnvMetaKind,
63328            Self::ScEnvMetaEntry(_) => TypeVariant::ScEnvMetaEntry,
63329            Self::ScEnvMetaEntryInterfaceVersion(_) => TypeVariant::ScEnvMetaEntryInterfaceVersion,
63330            Self::ScMetaV0(_) => TypeVariant::ScMetaV0,
63331            Self::ScMetaKind(_) => TypeVariant::ScMetaKind,
63332            Self::ScMetaEntry(_) => TypeVariant::ScMetaEntry,
63333            Self::ScSpecType(_) => TypeVariant::ScSpecType,
63334            Self::ScSpecTypeOption(_) => TypeVariant::ScSpecTypeOption,
63335            Self::ScSpecTypeResult(_) => TypeVariant::ScSpecTypeResult,
63336            Self::ScSpecTypeVec(_) => TypeVariant::ScSpecTypeVec,
63337            Self::ScSpecTypeMap(_) => TypeVariant::ScSpecTypeMap,
63338            Self::ScSpecTypeTuple(_) => TypeVariant::ScSpecTypeTuple,
63339            Self::ScSpecTypeBytesN(_) => TypeVariant::ScSpecTypeBytesN,
63340            Self::ScSpecTypeUdt(_) => TypeVariant::ScSpecTypeUdt,
63341            Self::ScSpecTypeDef(_) => TypeVariant::ScSpecTypeDef,
63342            Self::ScSpecUdtStructFieldV0(_) => TypeVariant::ScSpecUdtStructFieldV0,
63343            Self::ScSpecUdtStructV0(_) => TypeVariant::ScSpecUdtStructV0,
63344            Self::ScSpecUdtUnionCaseVoidV0(_) => TypeVariant::ScSpecUdtUnionCaseVoidV0,
63345            Self::ScSpecUdtUnionCaseTupleV0(_) => TypeVariant::ScSpecUdtUnionCaseTupleV0,
63346            Self::ScSpecUdtUnionCaseV0Kind(_) => TypeVariant::ScSpecUdtUnionCaseV0Kind,
63347            Self::ScSpecUdtUnionCaseV0(_) => TypeVariant::ScSpecUdtUnionCaseV0,
63348            Self::ScSpecUdtUnionV0(_) => TypeVariant::ScSpecUdtUnionV0,
63349            Self::ScSpecUdtEnumCaseV0(_) => TypeVariant::ScSpecUdtEnumCaseV0,
63350            Self::ScSpecUdtEnumV0(_) => TypeVariant::ScSpecUdtEnumV0,
63351            Self::ScSpecUdtErrorEnumCaseV0(_) => TypeVariant::ScSpecUdtErrorEnumCaseV0,
63352            Self::ScSpecUdtErrorEnumV0(_) => TypeVariant::ScSpecUdtErrorEnumV0,
63353            Self::ScSpecFunctionInputV0(_) => TypeVariant::ScSpecFunctionInputV0,
63354            Self::ScSpecFunctionV0(_) => TypeVariant::ScSpecFunctionV0,
63355            Self::ScSpecEntryKind(_) => TypeVariant::ScSpecEntryKind,
63356            Self::ScSpecEntry(_) => TypeVariant::ScSpecEntry,
63357            Self::ScValType(_) => TypeVariant::ScValType,
63358            Self::ScErrorType(_) => TypeVariant::ScErrorType,
63359            Self::ScErrorCode(_) => TypeVariant::ScErrorCode,
63360            Self::ScError(_) => TypeVariant::ScError,
63361            Self::UInt128Parts(_) => TypeVariant::UInt128Parts,
63362            Self::Int128Parts(_) => TypeVariant::Int128Parts,
63363            Self::UInt256Parts(_) => TypeVariant::UInt256Parts,
63364            Self::Int256Parts(_) => TypeVariant::Int256Parts,
63365            Self::ContractExecutableType(_) => TypeVariant::ContractExecutableType,
63366            Self::ContractExecutable(_) => TypeVariant::ContractExecutable,
63367            Self::ScAddressType(_) => TypeVariant::ScAddressType,
63368            Self::ScAddress(_) => TypeVariant::ScAddress,
63369            Self::ScVec(_) => TypeVariant::ScVec,
63370            Self::ScMap(_) => TypeVariant::ScMap,
63371            Self::ScBytes(_) => TypeVariant::ScBytes,
63372            Self::ScString(_) => TypeVariant::ScString,
63373            Self::ScSymbol(_) => TypeVariant::ScSymbol,
63374            Self::ScNonceKey(_) => TypeVariant::ScNonceKey,
63375            Self::ScContractInstance(_) => TypeVariant::ScContractInstance,
63376            Self::ScVal(_) => TypeVariant::ScVal,
63377            Self::ScMapEntry(_) => TypeVariant::ScMapEntry,
63378            Self::StoredTransactionSet(_) => TypeVariant::StoredTransactionSet,
63379            Self::StoredDebugTransactionSet(_) => TypeVariant::StoredDebugTransactionSet,
63380            Self::PersistedScpStateV0(_) => TypeVariant::PersistedScpStateV0,
63381            Self::PersistedScpStateV1(_) => TypeVariant::PersistedScpStateV1,
63382            Self::PersistedScpState(_) => TypeVariant::PersistedScpState,
63383            Self::Thresholds(_) => TypeVariant::Thresholds,
63384            Self::String32(_) => TypeVariant::String32,
63385            Self::String64(_) => TypeVariant::String64,
63386            Self::SequenceNumber(_) => TypeVariant::SequenceNumber,
63387            Self::DataValue(_) => TypeVariant::DataValue,
63388            Self::PoolId(_) => TypeVariant::PoolId,
63389            Self::AssetCode4(_) => TypeVariant::AssetCode4,
63390            Self::AssetCode12(_) => TypeVariant::AssetCode12,
63391            Self::AssetType(_) => TypeVariant::AssetType,
63392            Self::AssetCode(_) => TypeVariant::AssetCode,
63393            Self::AlphaNum4(_) => TypeVariant::AlphaNum4,
63394            Self::AlphaNum12(_) => TypeVariant::AlphaNum12,
63395            Self::Asset(_) => TypeVariant::Asset,
63396            Self::Price(_) => TypeVariant::Price,
63397            Self::Liabilities(_) => TypeVariant::Liabilities,
63398            Self::ThresholdIndexes(_) => TypeVariant::ThresholdIndexes,
63399            Self::LedgerEntryType(_) => TypeVariant::LedgerEntryType,
63400            Self::Signer(_) => TypeVariant::Signer,
63401            Self::AccountFlags(_) => TypeVariant::AccountFlags,
63402            Self::SponsorshipDescriptor(_) => TypeVariant::SponsorshipDescriptor,
63403            Self::AccountEntryExtensionV3(_) => TypeVariant::AccountEntryExtensionV3,
63404            Self::AccountEntryExtensionV2(_) => TypeVariant::AccountEntryExtensionV2,
63405            Self::AccountEntryExtensionV2Ext(_) => TypeVariant::AccountEntryExtensionV2Ext,
63406            Self::AccountEntryExtensionV1(_) => TypeVariant::AccountEntryExtensionV1,
63407            Self::AccountEntryExtensionV1Ext(_) => TypeVariant::AccountEntryExtensionV1Ext,
63408            Self::AccountEntry(_) => TypeVariant::AccountEntry,
63409            Self::AccountEntryExt(_) => TypeVariant::AccountEntryExt,
63410            Self::TrustLineFlags(_) => TypeVariant::TrustLineFlags,
63411            Self::LiquidityPoolType(_) => TypeVariant::LiquidityPoolType,
63412            Self::TrustLineAsset(_) => TypeVariant::TrustLineAsset,
63413            Self::TrustLineEntryExtensionV2(_) => TypeVariant::TrustLineEntryExtensionV2,
63414            Self::TrustLineEntryExtensionV2Ext(_) => TypeVariant::TrustLineEntryExtensionV2Ext,
63415            Self::TrustLineEntry(_) => TypeVariant::TrustLineEntry,
63416            Self::TrustLineEntryExt(_) => TypeVariant::TrustLineEntryExt,
63417            Self::TrustLineEntryV1(_) => TypeVariant::TrustLineEntryV1,
63418            Self::TrustLineEntryV1Ext(_) => TypeVariant::TrustLineEntryV1Ext,
63419            Self::OfferEntryFlags(_) => TypeVariant::OfferEntryFlags,
63420            Self::OfferEntry(_) => TypeVariant::OfferEntry,
63421            Self::OfferEntryExt(_) => TypeVariant::OfferEntryExt,
63422            Self::DataEntry(_) => TypeVariant::DataEntry,
63423            Self::DataEntryExt(_) => TypeVariant::DataEntryExt,
63424            Self::ClaimPredicateType(_) => TypeVariant::ClaimPredicateType,
63425            Self::ClaimPredicate(_) => TypeVariant::ClaimPredicate,
63426            Self::ClaimantType(_) => TypeVariant::ClaimantType,
63427            Self::Claimant(_) => TypeVariant::Claimant,
63428            Self::ClaimantV0(_) => TypeVariant::ClaimantV0,
63429            Self::ClaimableBalanceIdType(_) => TypeVariant::ClaimableBalanceIdType,
63430            Self::ClaimableBalanceId(_) => TypeVariant::ClaimableBalanceId,
63431            Self::ClaimableBalanceFlags(_) => TypeVariant::ClaimableBalanceFlags,
63432            Self::ClaimableBalanceEntryExtensionV1(_) => {
63433                TypeVariant::ClaimableBalanceEntryExtensionV1
63434            }
63435            Self::ClaimableBalanceEntryExtensionV1Ext(_) => {
63436                TypeVariant::ClaimableBalanceEntryExtensionV1Ext
63437            }
63438            Self::ClaimableBalanceEntry(_) => TypeVariant::ClaimableBalanceEntry,
63439            Self::ClaimableBalanceEntryExt(_) => TypeVariant::ClaimableBalanceEntryExt,
63440            Self::LiquidityPoolConstantProductParameters(_) => {
63441                TypeVariant::LiquidityPoolConstantProductParameters
63442            }
63443            Self::LiquidityPoolEntry(_) => TypeVariant::LiquidityPoolEntry,
63444            Self::LiquidityPoolEntryBody(_) => TypeVariant::LiquidityPoolEntryBody,
63445            Self::LiquidityPoolEntryConstantProduct(_) => {
63446                TypeVariant::LiquidityPoolEntryConstantProduct
63447            }
63448            Self::ContractDataDurability(_) => TypeVariant::ContractDataDurability,
63449            Self::ContractDataEntry(_) => TypeVariant::ContractDataEntry,
63450            Self::ContractCodeCostInputs(_) => TypeVariant::ContractCodeCostInputs,
63451            Self::ContractCodeEntry(_) => TypeVariant::ContractCodeEntry,
63452            Self::ContractCodeEntryExt(_) => TypeVariant::ContractCodeEntryExt,
63453            Self::ContractCodeEntryV1(_) => TypeVariant::ContractCodeEntryV1,
63454            Self::TtlEntry(_) => TypeVariant::TtlEntry,
63455            Self::LedgerEntryExtensionV1(_) => TypeVariant::LedgerEntryExtensionV1,
63456            Self::LedgerEntryExtensionV1Ext(_) => TypeVariant::LedgerEntryExtensionV1Ext,
63457            Self::LedgerEntry(_) => TypeVariant::LedgerEntry,
63458            Self::LedgerEntryData(_) => TypeVariant::LedgerEntryData,
63459            Self::LedgerEntryExt(_) => TypeVariant::LedgerEntryExt,
63460            Self::LedgerKey(_) => TypeVariant::LedgerKey,
63461            Self::LedgerKeyAccount(_) => TypeVariant::LedgerKeyAccount,
63462            Self::LedgerKeyTrustLine(_) => TypeVariant::LedgerKeyTrustLine,
63463            Self::LedgerKeyOffer(_) => TypeVariant::LedgerKeyOffer,
63464            Self::LedgerKeyData(_) => TypeVariant::LedgerKeyData,
63465            Self::LedgerKeyClaimableBalance(_) => TypeVariant::LedgerKeyClaimableBalance,
63466            Self::LedgerKeyLiquidityPool(_) => TypeVariant::LedgerKeyLiquidityPool,
63467            Self::LedgerKeyContractData(_) => TypeVariant::LedgerKeyContractData,
63468            Self::LedgerKeyContractCode(_) => TypeVariant::LedgerKeyContractCode,
63469            Self::LedgerKeyConfigSetting(_) => TypeVariant::LedgerKeyConfigSetting,
63470            Self::LedgerKeyTtl(_) => TypeVariant::LedgerKeyTtl,
63471            Self::EnvelopeType(_) => TypeVariant::EnvelopeType,
63472            Self::BucketListType(_) => TypeVariant::BucketListType,
63473            Self::BucketEntryType(_) => TypeVariant::BucketEntryType,
63474            Self::HotArchiveBucketEntryType(_) => TypeVariant::HotArchiveBucketEntryType,
63475            Self::ColdArchiveBucketEntryType(_) => TypeVariant::ColdArchiveBucketEntryType,
63476            Self::BucketMetadata(_) => TypeVariant::BucketMetadata,
63477            Self::BucketMetadataExt(_) => TypeVariant::BucketMetadataExt,
63478            Self::BucketEntry(_) => TypeVariant::BucketEntry,
63479            Self::HotArchiveBucketEntry(_) => TypeVariant::HotArchiveBucketEntry,
63480            Self::ColdArchiveArchivedLeaf(_) => TypeVariant::ColdArchiveArchivedLeaf,
63481            Self::ColdArchiveDeletedLeaf(_) => TypeVariant::ColdArchiveDeletedLeaf,
63482            Self::ColdArchiveBoundaryLeaf(_) => TypeVariant::ColdArchiveBoundaryLeaf,
63483            Self::ColdArchiveHashEntry(_) => TypeVariant::ColdArchiveHashEntry,
63484            Self::ColdArchiveBucketEntry(_) => TypeVariant::ColdArchiveBucketEntry,
63485            Self::UpgradeType(_) => TypeVariant::UpgradeType,
63486            Self::StellarValueType(_) => TypeVariant::StellarValueType,
63487            Self::LedgerCloseValueSignature(_) => TypeVariant::LedgerCloseValueSignature,
63488            Self::StellarValue(_) => TypeVariant::StellarValue,
63489            Self::StellarValueExt(_) => TypeVariant::StellarValueExt,
63490            Self::LedgerHeaderFlags(_) => TypeVariant::LedgerHeaderFlags,
63491            Self::LedgerHeaderExtensionV1(_) => TypeVariant::LedgerHeaderExtensionV1,
63492            Self::LedgerHeaderExtensionV1Ext(_) => TypeVariant::LedgerHeaderExtensionV1Ext,
63493            Self::LedgerHeader(_) => TypeVariant::LedgerHeader,
63494            Self::LedgerHeaderExt(_) => TypeVariant::LedgerHeaderExt,
63495            Self::LedgerUpgradeType(_) => TypeVariant::LedgerUpgradeType,
63496            Self::ConfigUpgradeSetKey(_) => TypeVariant::ConfigUpgradeSetKey,
63497            Self::LedgerUpgrade(_) => TypeVariant::LedgerUpgrade,
63498            Self::ConfigUpgradeSet(_) => TypeVariant::ConfigUpgradeSet,
63499            Self::TxSetComponentType(_) => TypeVariant::TxSetComponentType,
63500            Self::TxExecutionThread(_) => TypeVariant::TxExecutionThread,
63501            Self::ParallelTxExecutionStage(_) => TypeVariant::ParallelTxExecutionStage,
63502            Self::ParallelTxsComponent(_) => TypeVariant::ParallelTxsComponent,
63503            Self::TxSetComponent(_) => TypeVariant::TxSetComponent,
63504            Self::TxSetComponentTxsMaybeDiscountedFee(_) => {
63505                TypeVariant::TxSetComponentTxsMaybeDiscountedFee
63506            }
63507            Self::TransactionPhase(_) => TypeVariant::TransactionPhase,
63508            Self::TransactionSet(_) => TypeVariant::TransactionSet,
63509            Self::TransactionSetV1(_) => TypeVariant::TransactionSetV1,
63510            Self::GeneralizedTransactionSet(_) => TypeVariant::GeneralizedTransactionSet,
63511            Self::TransactionResultPair(_) => TypeVariant::TransactionResultPair,
63512            Self::TransactionResultSet(_) => TypeVariant::TransactionResultSet,
63513            Self::TransactionHistoryEntry(_) => TypeVariant::TransactionHistoryEntry,
63514            Self::TransactionHistoryEntryExt(_) => TypeVariant::TransactionHistoryEntryExt,
63515            Self::TransactionHistoryResultEntry(_) => TypeVariant::TransactionHistoryResultEntry,
63516            Self::TransactionHistoryResultEntryExt(_) => {
63517                TypeVariant::TransactionHistoryResultEntryExt
63518            }
63519            Self::LedgerHeaderHistoryEntry(_) => TypeVariant::LedgerHeaderHistoryEntry,
63520            Self::LedgerHeaderHistoryEntryExt(_) => TypeVariant::LedgerHeaderHistoryEntryExt,
63521            Self::LedgerScpMessages(_) => TypeVariant::LedgerScpMessages,
63522            Self::ScpHistoryEntryV0(_) => TypeVariant::ScpHistoryEntryV0,
63523            Self::ScpHistoryEntry(_) => TypeVariant::ScpHistoryEntry,
63524            Self::LedgerEntryChangeType(_) => TypeVariant::LedgerEntryChangeType,
63525            Self::LedgerEntryChange(_) => TypeVariant::LedgerEntryChange,
63526            Self::LedgerEntryChanges(_) => TypeVariant::LedgerEntryChanges,
63527            Self::OperationMeta(_) => TypeVariant::OperationMeta,
63528            Self::TransactionMetaV1(_) => TypeVariant::TransactionMetaV1,
63529            Self::TransactionMetaV2(_) => TypeVariant::TransactionMetaV2,
63530            Self::ContractEventType(_) => TypeVariant::ContractEventType,
63531            Self::ContractEvent(_) => TypeVariant::ContractEvent,
63532            Self::ContractEventBody(_) => TypeVariant::ContractEventBody,
63533            Self::ContractEventV0(_) => TypeVariant::ContractEventV0,
63534            Self::DiagnosticEvent(_) => TypeVariant::DiagnosticEvent,
63535            Self::SorobanTransactionMetaExtV1(_) => TypeVariant::SorobanTransactionMetaExtV1,
63536            Self::SorobanTransactionMetaExt(_) => TypeVariant::SorobanTransactionMetaExt,
63537            Self::SorobanTransactionMeta(_) => TypeVariant::SorobanTransactionMeta,
63538            Self::TransactionMetaV3(_) => TypeVariant::TransactionMetaV3,
63539            Self::InvokeHostFunctionSuccessPreImage(_) => {
63540                TypeVariant::InvokeHostFunctionSuccessPreImage
63541            }
63542            Self::TransactionMeta(_) => TypeVariant::TransactionMeta,
63543            Self::TransactionResultMeta(_) => TypeVariant::TransactionResultMeta,
63544            Self::UpgradeEntryMeta(_) => TypeVariant::UpgradeEntryMeta,
63545            Self::LedgerCloseMetaV0(_) => TypeVariant::LedgerCloseMetaV0,
63546            Self::LedgerCloseMetaExtV1(_) => TypeVariant::LedgerCloseMetaExtV1,
63547            Self::LedgerCloseMetaExtV2(_) => TypeVariant::LedgerCloseMetaExtV2,
63548            Self::LedgerCloseMetaExt(_) => TypeVariant::LedgerCloseMetaExt,
63549            Self::LedgerCloseMetaV1(_) => TypeVariant::LedgerCloseMetaV1,
63550            Self::LedgerCloseMeta(_) => TypeVariant::LedgerCloseMeta,
63551            Self::ErrorCode(_) => TypeVariant::ErrorCode,
63552            Self::SError(_) => TypeVariant::SError,
63553            Self::SendMore(_) => TypeVariant::SendMore,
63554            Self::SendMoreExtended(_) => TypeVariant::SendMoreExtended,
63555            Self::AuthCert(_) => TypeVariant::AuthCert,
63556            Self::Hello(_) => TypeVariant::Hello,
63557            Self::Auth(_) => TypeVariant::Auth,
63558            Self::IpAddrType(_) => TypeVariant::IpAddrType,
63559            Self::PeerAddress(_) => TypeVariant::PeerAddress,
63560            Self::PeerAddressIp(_) => TypeVariant::PeerAddressIp,
63561            Self::MessageType(_) => TypeVariant::MessageType,
63562            Self::DontHave(_) => TypeVariant::DontHave,
63563            Self::SurveyMessageCommandType(_) => TypeVariant::SurveyMessageCommandType,
63564            Self::SurveyMessageResponseType(_) => TypeVariant::SurveyMessageResponseType,
63565            Self::TimeSlicedSurveyStartCollectingMessage(_) => {
63566                TypeVariant::TimeSlicedSurveyStartCollectingMessage
63567            }
63568            Self::SignedTimeSlicedSurveyStartCollectingMessage(_) => {
63569                TypeVariant::SignedTimeSlicedSurveyStartCollectingMessage
63570            }
63571            Self::TimeSlicedSurveyStopCollectingMessage(_) => {
63572                TypeVariant::TimeSlicedSurveyStopCollectingMessage
63573            }
63574            Self::SignedTimeSlicedSurveyStopCollectingMessage(_) => {
63575                TypeVariant::SignedTimeSlicedSurveyStopCollectingMessage
63576            }
63577            Self::SurveyRequestMessage(_) => TypeVariant::SurveyRequestMessage,
63578            Self::TimeSlicedSurveyRequestMessage(_) => TypeVariant::TimeSlicedSurveyRequestMessage,
63579            Self::SignedSurveyRequestMessage(_) => TypeVariant::SignedSurveyRequestMessage,
63580            Self::SignedTimeSlicedSurveyRequestMessage(_) => {
63581                TypeVariant::SignedTimeSlicedSurveyRequestMessage
63582            }
63583            Self::EncryptedBody(_) => TypeVariant::EncryptedBody,
63584            Self::SurveyResponseMessage(_) => TypeVariant::SurveyResponseMessage,
63585            Self::TimeSlicedSurveyResponseMessage(_) => {
63586                TypeVariant::TimeSlicedSurveyResponseMessage
63587            }
63588            Self::SignedSurveyResponseMessage(_) => TypeVariant::SignedSurveyResponseMessage,
63589            Self::SignedTimeSlicedSurveyResponseMessage(_) => {
63590                TypeVariant::SignedTimeSlicedSurveyResponseMessage
63591            }
63592            Self::PeerStats(_) => TypeVariant::PeerStats,
63593            Self::PeerStatList(_) => TypeVariant::PeerStatList,
63594            Self::TimeSlicedNodeData(_) => TypeVariant::TimeSlicedNodeData,
63595            Self::TimeSlicedPeerData(_) => TypeVariant::TimeSlicedPeerData,
63596            Self::TimeSlicedPeerDataList(_) => TypeVariant::TimeSlicedPeerDataList,
63597            Self::TopologyResponseBodyV0(_) => TypeVariant::TopologyResponseBodyV0,
63598            Self::TopologyResponseBodyV1(_) => TypeVariant::TopologyResponseBodyV1,
63599            Self::TopologyResponseBodyV2(_) => TypeVariant::TopologyResponseBodyV2,
63600            Self::SurveyResponseBody(_) => TypeVariant::SurveyResponseBody,
63601            Self::TxAdvertVector(_) => TypeVariant::TxAdvertVector,
63602            Self::FloodAdvert(_) => TypeVariant::FloodAdvert,
63603            Self::TxDemandVector(_) => TypeVariant::TxDemandVector,
63604            Self::FloodDemand(_) => TypeVariant::FloodDemand,
63605            Self::StellarMessage(_) => TypeVariant::StellarMessage,
63606            Self::AuthenticatedMessage(_) => TypeVariant::AuthenticatedMessage,
63607            Self::AuthenticatedMessageV0(_) => TypeVariant::AuthenticatedMessageV0,
63608            Self::LiquidityPoolParameters(_) => TypeVariant::LiquidityPoolParameters,
63609            Self::MuxedAccount(_) => TypeVariant::MuxedAccount,
63610            Self::MuxedAccountMed25519(_) => TypeVariant::MuxedAccountMed25519,
63611            Self::DecoratedSignature(_) => TypeVariant::DecoratedSignature,
63612            Self::OperationType(_) => TypeVariant::OperationType,
63613            Self::CreateAccountOp(_) => TypeVariant::CreateAccountOp,
63614            Self::PaymentOp(_) => TypeVariant::PaymentOp,
63615            Self::PathPaymentStrictReceiveOp(_) => TypeVariant::PathPaymentStrictReceiveOp,
63616            Self::PathPaymentStrictSendOp(_) => TypeVariant::PathPaymentStrictSendOp,
63617            Self::ManageSellOfferOp(_) => TypeVariant::ManageSellOfferOp,
63618            Self::ManageBuyOfferOp(_) => TypeVariant::ManageBuyOfferOp,
63619            Self::CreatePassiveSellOfferOp(_) => TypeVariant::CreatePassiveSellOfferOp,
63620            Self::SetOptionsOp(_) => TypeVariant::SetOptionsOp,
63621            Self::ChangeTrustAsset(_) => TypeVariant::ChangeTrustAsset,
63622            Self::ChangeTrustOp(_) => TypeVariant::ChangeTrustOp,
63623            Self::AllowTrustOp(_) => TypeVariant::AllowTrustOp,
63624            Self::ManageDataOp(_) => TypeVariant::ManageDataOp,
63625            Self::BumpSequenceOp(_) => TypeVariant::BumpSequenceOp,
63626            Self::CreateClaimableBalanceOp(_) => TypeVariant::CreateClaimableBalanceOp,
63627            Self::ClaimClaimableBalanceOp(_) => TypeVariant::ClaimClaimableBalanceOp,
63628            Self::BeginSponsoringFutureReservesOp(_) => {
63629                TypeVariant::BeginSponsoringFutureReservesOp
63630            }
63631            Self::RevokeSponsorshipType(_) => TypeVariant::RevokeSponsorshipType,
63632            Self::RevokeSponsorshipOp(_) => TypeVariant::RevokeSponsorshipOp,
63633            Self::RevokeSponsorshipOpSigner(_) => TypeVariant::RevokeSponsorshipOpSigner,
63634            Self::ClawbackOp(_) => TypeVariant::ClawbackOp,
63635            Self::ClawbackClaimableBalanceOp(_) => TypeVariant::ClawbackClaimableBalanceOp,
63636            Self::SetTrustLineFlagsOp(_) => TypeVariant::SetTrustLineFlagsOp,
63637            Self::LiquidityPoolDepositOp(_) => TypeVariant::LiquidityPoolDepositOp,
63638            Self::LiquidityPoolWithdrawOp(_) => TypeVariant::LiquidityPoolWithdrawOp,
63639            Self::HostFunctionType(_) => TypeVariant::HostFunctionType,
63640            Self::ContractIdPreimageType(_) => TypeVariant::ContractIdPreimageType,
63641            Self::ContractIdPreimage(_) => TypeVariant::ContractIdPreimage,
63642            Self::ContractIdPreimageFromAddress(_) => TypeVariant::ContractIdPreimageFromAddress,
63643            Self::CreateContractArgs(_) => TypeVariant::CreateContractArgs,
63644            Self::CreateContractArgsV2(_) => TypeVariant::CreateContractArgsV2,
63645            Self::InvokeContractArgs(_) => TypeVariant::InvokeContractArgs,
63646            Self::HostFunction(_) => TypeVariant::HostFunction,
63647            Self::SorobanAuthorizedFunctionType(_) => TypeVariant::SorobanAuthorizedFunctionType,
63648            Self::SorobanAuthorizedFunction(_) => TypeVariant::SorobanAuthorizedFunction,
63649            Self::SorobanAuthorizedInvocation(_) => TypeVariant::SorobanAuthorizedInvocation,
63650            Self::SorobanAddressCredentials(_) => TypeVariant::SorobanAddressCredentials,
63651            Self::SorobanCredentialsType(_) => TypeVariant::SorobanCredentialsType,
63652            Self::SorobanCredentials(_) => TypeVariant::SorobanCredentials,
63653            Self::SorobanAuthorizationEntry(_) => TypeVariant::SorobanAuthorizationEntry,
63654            Self::InvokeHostFunctionOp(_) => TypeVariant::InvokeHostFunctionOp,
63655            Self::ExtendFootprintTtlOp(_) => TypeVariant::ExtendFootprintTtlOp,
63656            Self::RestoreFootprintOp(_) => TypeVariant::RestoreFootprintOp,
63657            Self::Operation(_) => TypeVariant::Operation,
63658            Self::OperationBody(_) => TypeVariant::OperationBody,
63659            Self::HashIdPreimage(_) => TypeVariant::HashIdPreimage,
63660            Self::HashIdPreimageOperationId(_) => TypeVariant::HashIdPreimageOperationId,
63661            Self::HashIdPreimageRevokeId(_) => TypeVariant::HashIdPreimageRevokeId,
63662            Self::HashIdPreimageContractId(_) => TypeVariant::HashIdPreimageContractId,
63663            Self::HashIdPreimageSorobanAuthorization(_) => {
63664                TypeVariant::HashIdPreimageSorobanAuthorization
63665            }
63666            Self::MemoType(_) => TypeVariant::MemoType,
63667            Self::Memo(_) => TypeVariant::Memo,
63668            Self::TimeBounds(_) => TypeVariant::TimeBounds,
63669            Self::LedgerBounds(_) => TypeVariant::LedgerBounds,
63670            Self::PreconditionsV2(_) => TypeVariant::PreconditionsV2,
63671            Self::PreconditionType(_) => TypeVariant::PreconditionType,
63672            Self::Preconditions(_) => TypeVariant::Preconditions,
63673            Self::LedgerFootprint(_) => TypeVariant::LedgerFootprint,
63674            Self::ArchivalProofType(_) => TypeVariant::ArchivalProofType,
63675            Self::ArchivalProofNode(_) => TypeVariant::ArchivalProofNode,
63676            Self::ProofLevel(_) => TypeVariant::ProofLevel,
63677            Self::ExistenceProofBody(_) => TypeVariant::ExistenceProofBody,
63678            Self::NonexistenceProofBody(_) => TypeVariant::NonexistenceProofBody,
63679            Self::ArchivalProof(_) => TypeVariant::ArchivalProof,
63680            Self::ArchivalProofBody(_) => TypeVariant::ArchivalProofBody,
63681            Self::SorobanResources(_) => TypeVariant::SorobanResources,
63682            Self::SorobanTransactionData(_) => TypeVariant::SorobanTransactionData,
63683            Self::SorobanTransactionDataExt(_) => TypeVariant::SorobanTransactionDataExt,
63684            Self::TransactionV0(_) => TypeVariant::TransactionV0,
63685            Self::TransactionV0Ext(_) => TypeVariant::TransactionV0Ext,
63686            Self::TransactionV0Envelope(_) => TypeVariant::TransactionV0Envelope,
63687            Self::Transaction(_) => TypeVariant::Transaction,
63688            Self::TransactionExt(_) => TypeVariant::TransactionExt,
63689            Self::TransactionV1Envelope(_) => TypeVariant::TransactionV1Envelope,
63690            Self::FeeBumpTransaction(_) => TypeVariant::FeeBumpTransaction,
63691            Self::FeeBumpTransactionInnerTx(_) => TypeVariant::FeeBumpTransactionInnerTx,
63692            Self::FeeBumpTransactionExt(_) => TypeVariant::FeeBumpTransactionExt,
63693            Self::FeeBumpTransactionEnvelope(_) => TypeVariant::FeeBumpTransactionEnvelope,
63694            Self::TransactionEnvelope(_) => TypeVariant::TransactionEnvelope,
63695            Self::TransactionSignaturePayload(_) => TypeVariant::TransactionSignaturePayload,
63696            Self::TransactionSignaturePayloadTaggedTransaction(_) => {
63697                TypeVariant::TransactionSignaturePayloadTaggedTransaction
63698            }
63699            Self::ClaimAtomType(_) => TypeVariant::ClaimAtomType,
63700            Self::ClaimOfferAtomV0(_) => TypeVariant::ClaimOfferAtomV0,
63701            Self::ClaimOfferAtom(_) => TypeVariant::ClaimOfferAtom,
63702            Self::ClaimLiquidityAtom(_) => TypeVariant::ClaimLiquidityAtom,
63703            Self::ClaimAtom(_) => TypeVariant::ClaimAtom,
63704            Self::CreateAccountResultCode(_) => TypeVariant::CreateAccountResultCode,
63705            Self::CreateAccountResult(_) => TypeVariant::CreateAccountResult,
63706            Self::PaymentResultCode(_) => TypeVariant::PaymentResultCode,
63707            Self::PaymentResult(_) => TypeVariant::PaymentResult,
63708            Self::PathPaymentStrictReceiveResultCode(_) => {
63709                TypeVariant::PathPaymentStrictReceiveResultCode
63710            }
63711            Self::SimplePaymentResult(_) => TypeVariant::SimplePaymentResult,
63712            Self::PathPaymentStrictReceiveResult(_) => TypeVariant::PathPaymentStrictReceiveResult,
63713            Self::PathPaymentStrictReceiveResultSuccess(_) => {
63714                TypeVariant::PathPaymentStrictReceiveResultSuccess
63715            }
63716            Self::PathPaymentStrictSendResultCode(_) => {
63717                TypeVariant::PathPaymentStrictSendResultCode
63718            }
63719            Self::PathPaymentStrictSendResult(_) => TypeVariant::PathPaymentStrictSendResult,
63720            Self::PathPaymentStrictSendResultSuccess(_) => {
63721                TypeVariant::PathPaymentStrictSendResultSuccess
63722            }
63723            Self::ManageSellOfferResultCode(_) => TypeVariant::ManageSellOfferResultCode,
63724            Self::ManageOfferEffect(_) => TypeVariant::ManageOfferEffect,
63725            Self::ManageOfferSuccessResult(_) => TypeVariant::ManageOfferSuccessResult,
63726            Self::ManageOfferSuccessResultOffer(_) => TypeVariant::ManageOfferSuccessResultOffer,
63727            Self::ManageSellOfferResult(_) => TypeVariant::ManageSellOfferResult,
63728            Self::ManageBuyOfferResultCode(_) => TypeVariant::ManageBuyOfferResultCode,
63729            Self::ManageBuyOfferResult(_) => TypeVariant::ManageBuyOfferResult,
63730            Self::SetOptionsResultCode(_) => TypeVariant::SetOptionsResultCode,
63731            Self::SetOptionsResult(_) => TypeVariant::SetOptionsResult,
63732            Self::ChangeTrustResultCode(_) => TypeVariant::ChangeTrustResultCode,
63733            Self::ChangeTrustResult(_) => TypeVariant::ChangeTrustResult,
63734            Self::AllowTrustResultCode(_) => TypeVariant::AllowTrustResultCode,
63735            Self::AllowTrustResult(_) => TypeVariant::AllowTrustResult,
63736            Self::AccountMergeResultCode(_) => TypeVariant::AccountMergeResultCode,
63737            Self::AccountMergeResult(_) => TypeVariant::AccountMergeResult,
63738            Self::InflationResultCode(_) => TypeVariant::InflationResultCode,
63739            Self::InflationPayout(_) => TypeVariant::InflationPayout,
63740            Self::InflationResult(_) => TypeVariant::InflationResult,
63741            Self::ManageDataResultCode(_) => TypeVariant::ManageDataResultCode,
63742            Self::ManageDataResult(_) => TypeVariant::ManageDataResult,
63743            Self::BumpSequenceResultCode(_) => TypeVariant::BumpSequenceResultCode,
63744            Self::BumpSequenceResult(_) => TypeVariant::BumpSequenceResult,
63745            Self::CreateClaimableBalanceResultCode(_) => {
63746                TypeVariant::CreateClaimableBalanceResultCode
63747            }
63748            Self::CreateClaimableBalanceResult(_) => TypeVariant::CreateClaimableBalanceResult,
63749            Self::ClaimClaimableBalanceResultCode(_) => {
63750                TypeVariant::ClaimClaimableBalanceResultCode
63751            }
63752            Self::ClaimClaimableBalanceResult(_) => TypeVariant::ClaimClaimableBalanceResult,
63753            Self::BeginSponsoringFutureReservesResultCode(_) => {
63754                TypeVariant::BeginSponsoringFutureReservesResultCode
63755            }
63756            Self::BeginSponsoringFutureReservesResult(_) => {
63757                TypeVariant::BeginSponsoringFutureReservesResult
63758            }
63759            Self::EndSponsoringFutureReservesResultCode(_) => {
63760                TypeVariant::EndSponsoringFutureReservesResultCode
63761            }
63762            Self::EndSponsoringFutureReservesResult(_) => {
63763                TypeVariant::EndSponsoringFutureReservesResult
63764            }
63765            Self::RevokeSponsorshipResultCode(_) => TypeVariant::RevokeSponsorshipResultCode,
63766            Self::RevokeSponsorshipResult(_) => TypeVariant::RevokeSponsorshipResult,
63767            Self::ClawbackResultCode(_) => TypeVariant::ClawbackResultCode,
63768            Self::ClawbackResult(_) => TypeVariant::ClawbackResult,
63769            Self::ClawbackClaimableBalanceResultCode(_) => {
63770                TypeVariant::ClawbackClaimableBalanceResultCode
63771            }
63772            Self::ClawbackClaimableBalanceResult(_) => TypeVariant::ClawbackClaimableBalanceResult,
63773            Self::SetTrustLineFlagsResultCode(_) => TypeVariant::SetTrustLineFlagsResultCode,
63774            Self::SetTrustLineFlagsResult(_) => TypeVariant::SetTrustLineFlagsResult,
63775            Self::LiquidityPoolDepositResultCode(_) => TypeVariant::LiquidityPoolDepositResultCode,
63776            Self::LiquidityPoolDepositResult(_) => TypeVariant::LiquidityPoolDepositResult,
63777            Self::LiquidityPoolWithdrawResultCode(_) => {
63778                TypeVariant::LiquidityPoolWithdrawResultCode
63779            }
63780            Self::LiquidityPoolWithdrawResult(_) => TypeVariant::LiquidityPoolWithdrawResult,
63781            Self::InvokeHostFunctionResultCode(_) => TypeVariant::InvokeHostFunctionResultCode,
63782            Self::InvokeHostFunctionResult(_) => TypeVariant::InvokeHostFunctionResult,
63783            Self::ExtendFootprintTtlResultCode(_) => TypeVariant::ExtendFootprintTtlResultCode,
63784            Self::ExtendFootprintTtlResult(_) => TypeVariant::ExtendFootprintTtlResult,
63785            Self::RestoreFootprintResultCode(_) => TypeVariant::RestoreFootprintResultCode,
63786            Self::RestoreFootprintResult(_) => TypeVariant::RestoreFootprintResult,
63787            Self::OperationResultCode(_) => TypeVariant::OperationResultCode,
63788            Self::OperationResult(_) => TypeVariant::OperationResult,
63789            Self::OperationResultTr(_) => TypeVariant::OperationResultTr,
63790            Self::TransactionResultCode(_) => TypeVariant::TransactionResultCode,
63791            Self::InnerTransactionResult(_) => TypeVariant::InnerTransactionResult,
63792            Self::InnerTransactionResultResult(_) => TypeVariant::InnerTransactionResultResult,
63793            Self::InnerTransactionResultExt(_) => TypeVariant::InnerTransactionResultExt,
63794            Self::InnerTransactionResultPair(_) => TypeVariant::InnerTransactionResultPair,
63795            Self::TransactionResult(_) => TypeVariant::TransactionResult,
63796            Self::TransactionResultResult(_) => TypeVariant::TransactionResultResult,
63797            Self::TransactionResultExt(_) => TypeVariant::TransactionResultExt,
63798            Self::Hash(_) => TypeVariant::Hash,
63799            Self::Uint256(_) => TypeVariant::Uint256,
63800            Self::Uint32(_) => TypeVariant::Uint32,
63801            Self::Int32(_) => TypeVariant::Int32,
63802            Self::Uint64(_) => TypeVariant::Uint64,
63803            Self::Int64(_) => TypeVariant::Int64,
63804            Self::TimePoint(_) => TypeVariant::TimePoint,
63805            Self::Duration(_) => TypeVariant::Duration,
63806            Self::ExtensionPoint(_) => TypeVariant::ExtensionPoint,
63807            Self::CryptoKeyType(_) => TypeVariant::CryptoKeyType,
63808            Self::PublicKeyType(_) => TypeVariant::PublicKeyType,
63809            Self::SignerKeyType(_) => TypeVariant::SignerKeyType,
63810            Self::PublicKey(_) => TypeVariant::PublicKey,
63811            Self::SignerKey(_) => TypeVariant::SignerKey,
63812            Self::SignerKeyEd25519SignedPayload(_) => TypeVariant::SignerKeyEd25519SignedPayload,
63813            Self::Signature(_) => TypeVariant::Signature,
63814            Self::SignatureHint(_) => TypeVariant::SignatureHint,
63815            Self::NodeId(_) => TypeVariant::NodeId,
63816            Self::AccountId(_) => TypeVariant::AccountId,
63817            Self::Curve25519Secret(_) => TypeVariant::Curve25519Secret,
63818            Self::Curve25519Public(_) => TypeVariant::Curve25519Public,
63819            Self::HmacSha256Key(_) => TypeVariant::HmacSha256Key,
63820            Self::HmacSha256Mac(_) => TypeVariant::HmacSha256Mac,
63821            Self::ShortHashSeed(_) => TypeVariant::ShortHashSeed,
63822            Self::BinaryFuseFilterType(_) => TypeVariant::BinaryFuseFilterType,
63823            Self::SerializedBinaryFuseFilter(_) => TypeVariant::SerializedBinaryFuseFilter,
63824        }
63825    }
63826}
63827
63828impl Name for Type {
63829    #[must_use]
63830    fn name(&self) -> &'static str {
63831        Self::name(self)
63832    }
63833}
63834
63835impl Variants<TypeVariant> for Type {
63836    fn variants() -> slice::Iter<'static, TypeVariant> {
63837        Self::VARIANTS.iter()
63838    }
63839}
63840
63841impl WriteXdr for Type {
63842    #[cfg(feature = "std")]
63843    #[allow(clippy::too_many_lines)]
63844    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<()> {
63845        match self {
63846            Self::Value(v) => v.write_xdr(w),
63847            Self::ScpBallot(v) => v.write_xdr(w),
63848            Self::ScpStatementType(v) => v.write_xdr(w),
63849            Self::ScpNomination(v) => v.write_xdr(w),
63850            Self::ScpStatement(v) => v.write_xdr(w),
63851            Self::ScpStatementPledges(v) => v.write_xdr(w),
63852            Self::ScpStatementPrepare(v) => v.write_xdr(w),
63853            Self::ScpStatementConfirm(v) => v.write_xdr(w),
63854            Self::ScpStatementExternalize(v) => v.write_xdr(w),
63855            Self::ScpEnvelope(v) => v.write_xdr(w),
63856            Self::ScpQuorumSet(v) => v.write_xdr(w),
63857            Self::ConfigSettingContractExecutionLanesV0(v) => v.write_xdr(w),
63858            Self::ConfigSettingContractComputeV0(v) => v.write_xdr(w),
63859            Self::ConfigSettingContractParallelComputeV0(v) => v.write_xdr(w),
63860            Self::ConfigSettingContractLedgerCostV0(v) => v.write_xdr(w),
63861            Self::ConfigSettingContractHistoricalDataV0(v) => v.write_xdr(w),
63862            Self::ConfigSettingContractEventsV0(v) => v.write_xdr(w),
63863            Self::ConfigSettingContractBandwidthV0(v) => v.write_xdr(w),
63864            Self::ContractCostType(v) => v.write_xdr(w),
63865            Self::ContractCostParamEntry(v) => v.write_xdr(w),
63866            Self::StateArchivalSettings(v) => v.write_xdr(w),
63867            Self::EvictionIterator(v) => v.write_xdr(w),
63868            Self::ContractCostParams(v) => v.write_xdr(w),
63869            Self::ConfigSettingId(v) => v.write_xdr(w),
63870            Self::ConfigSettingEntry(v) => v.write_xdr(w),
63871            Self::ScEnvMetaKind(v) => v.write_xdr(w),
63872            Self::ScEnvMetaEntry(v) => v.write_xdr(w),
63873            Self::ScEnvMetaEntryInterfaceVersion(v) => v.write_xdr(w),
63874            Self::ScMetaV0(v) => v.write_xdr(w),
63875            Self::ScMetaKind(v) => v.write_xdr(w),
63876            Self::ScMetaEntry(v) => v.write_xdr(w),
63877            Self::ScSpecType(v) => v.write_xdr(w),
63878            Self::ScSpecTypeOption(v) => v.write_xdr(w),
63879            Self::ScSpecTypeResult(v) => v.write_xdr(w),
63880            Self::ScSpecTypeVec(v) => v.write_xdr(w),
63881            Self::ScSpecTypeMap(v) => v.write_xdr(w),
63882            Self::ScSpecTypeTuple(v) => v.write_xdr(w),
63883            Self::ScSpecTypeBytesN(v) => v.write_xdr(w),
63884            Self::ScSpecTypeUdt(v) => v.write_xdr(w),
63885            Self::ScSpecTypeDef(v) => v.write_xdr(w),
63886            Self::ScSpecUdtStructFieldV0(v) => v.write_xdr(w),
63887            Self::ScSpecUdtStructV0(v) => v.write_xdr(w),
63888            Self::ScSpecUdtUnionCaseVoidV0(v) => v.write_xdr(w),
63889            Self::ScSpecUdtUnionCaseTupleV0(v) => v.write_xdr(w),
63890            Self::ScSpecUdtUnionCaseV0Kind(v) => v.write_xdr(w),
63891            Self::ScSpecUdtUnionCaseV0(v) => v.write_xdr(w),
63892            Self::ScSpecUdtUnionV0(v) => v.write_xdr(w),
63893            Self::ScSpecUdtEnumCaseV0(v) => v.write_xdr(w),
63894            Self::ScSpecUdtEnumV0(v) => v.write_xdr(w),
63895            Self::ScSpecUdtErrorEnumCaseV0(v) => v.write_xdr(w),
63896            Self::ScSpecUdtErrorEnumV0(v) => v.write_xdr(w),
63897            Self::ScSpecFunctionInputV0(v) => v.write_xdr(w),
63898            Self::ScSpecFunctionV0(v) => v.write_xdr(w),
63899            Self::ScSpecEntryKind(v) => v.write_xdr(w),
63900            Self::ScSpecEntry(v) => v.write_xdr(w),
63901            Self::ScValType(v) => v.write_xdr(w),
63902            Self::ScErrorType(v) => v.write_xdr(w),
63903            Self::ScErrorCode(v) => v.write_xdr(w),
63904            Self::ScError(v) => v.write_xdr(w),
63905            Self::UInt128Parts(v) => v.write_xdr(w),
63906            Self::Int128Parts(v) => v.write_xdr(w),
63907            Self::UInt256Parts(v) => v.write_xdr(w),
63908            Self::Int256Parts(v) => v.write_xdr(w),
63909            Self::ContractExecutableType(v) => v.write_xdr(w),
63910            Self::ContractExecutable(v) => v.write_xdr(w),
63911            Self::ScAddressType(v) => v.write_xdr(w),
63912            Self::ScAddress(v) => v.write_xdr(w),
63913            Self::ScVec(v) => v.write_xdr(w),
63914            Self::ScMap(v) => v.write_xdr(w),
63915            Self::ScBytes(v) => v.write_xdr(w),
63916            Self::ScString(v) => v.write_xdr(w),
63917            Self::ScSymbol(v) => v.write_xdr(w),
63918            Self::ScNonceKey(v) => v.write_xdr(w),
63919            Self::ScContractInstance(v) => v.write_xdr(w),
63920            Self::ScVal(v) => v.write_xdr(w),
63921            Self::ScMapEntry(v) => v.write_xdr(w),
63922            Self::StoredTransactionSet(v) => v.write_xdr(w),
63923            Self::StoredDebugTransactionSet(v) => v.write_xdr(w),
63924            Self::PersistedScpStateV0(v) => v.write_xdr(w),
63925            Self::PersistedScpStateV1(v) => v.write_xdr(w),
63926            Self::PersistedScpState(v) => v.write_xdr(w),
63927            Self::Thresholds(v) => v.write_xdr(w),
63928            Self::String32(v) => v.write_xdr(w),
63929            Self::String64(v) => v.write_xdr(w),
63930            Self::SequenceNumber(v) => v.write_xdr(w),
63931            Self::DataValue(v) => v.write_xdr(w),
63932            Self::PoolId(v) => v.write_xdr(w),
63933            Self::AssetCode4(v) => v.write_xdr(w),
63934            Self::AssetCode12(v) => v.write_xdr(w),
63935            Self::AssetType(v) => v.write_xdr(w),
63936            Self::AssetCode(v) => v.write_xdr(w),
63937            Self::AlphaNum4(v) => v.write_xdr(w),
63938            Self::AlphaNum12(v) => v.write_xdr(w),
63939            Self::Asset(v) => v.write_xdr(w),
63940            Self::Price(v) => v.write_xdr(w),
63941            Self::Liabilities(v) => v.write_xdr(w),
63942            Self::ThresholdIndexes(v) => v.write_xdr(w),
63943            Self::LedgerEntryType(v) => v.write_xdr(w),
63944            Self::Signer(v) => v.write_xdr(w),
63945            Self::AccountFlags(v) => v.write_xdr(w),
63946            Self::SponsorshipDescriptor(v) => v.write_xdr(w),
63947            Self::AccountEntryExtensionV3(v) => v.write_xdr(w),
63948            Self::AccountEntryExtensionV2(v) => v.write_xdr(w),
63949            Self::AccountEntryExtensionV2Ext(v) => v.write_xdr(w),
63950            Self::AccountEntryExtensionV1(v) => v.write_xdr(w),
63951            Self::AccountEntryExtensionV1Ext(v) => v.write_xdr(w),
63952            Self::AccountEntry(v) => v.write_xdr(w),
63953            Self::AccountEntryExt(v) => v.write_xdr(w),
63954            Self::TrustLineFlags(v) => v.write_xdr(w),
63955            Self::LiquidityPoolType(v) => v.write_xdr(w),
63956            Self::TrustLineAsset(v) => v.write_xdr(w),
63957            Self::TrustLineEntryExtensionV2(v) => v.write_xdr(w),
63958            Self::TrustLineEntryExtensionV2Ext(v) => v.write_xdr(w),
63959            Self::TrustLineEntry(v) => v.write_xdr(w),
63960            Self::TrustLineEntryExt(v) => v.write_xdr(w),
63961            Self::TrustLineEntryV1(v) => v.write_xdr(w),
63962            Self::TrustLineEntryV1Ext(v) => v.write_xdr(w),
63963            Self::OfferEntryFlags(v) => v.write_xdr(w),
63964            Self::OfferEntry(v) => v.write_xdr(w),
63965            Self::OfferEntryExt(v) => v.write_xdr(w),
63966            Self::DataEntry(v) => v.write_xdr(w),
63967            Self::DataEntryExt(v) => v.write_xdr(w),
63968            Self::ClaimPredicateType(v) => v.write_xdr(w),
63969            Self::ClaimPredicate(v) => v.write_xdr(w),
63970            Self::ClaimantType(v) => v.write_xdr(w),
63971            Self::Claimant(v) => v.write_xdr(w),
63972            Self::ClaimantV0(v) => v.write_xdr(w),
63973            Self::ClaimableBalanceIdType(v) => v.write_xdr(w),
63974            Self::ClaimableBalanceId(v) => v.write_xdr(w),
63975            Self::ClaimableBalanceFlags(v) => v.write_xdr(w),
63976            Self::ClaimableBalanceEntryExtensionV1(v) => v.write_xdr(w),
63977            Self::ClaimableBalanceEntryExtensionV1Ext(v) => v.write_xdr(w),
63978            Self::ClaimableBalanceEntry(v) => v.write_xdr(w),
63979            Self::ClaimableBalanceEntryExt(v) => v.write_xdr(w),
63980            Self::LiquidityPoolConstantProductParameters(v) => v.write_xdr(w),
63981            Self::LiquidityPoolEntry(v) => v.write_xdr(w),
63982            Self::LiquidityPoolEntryBody(v) => v.write_xdr(w),
63983            Self::LiquidityPoolEntryConstantProduct(v) => v.write_xdr(w),
63984            Self::ContractDataDurability(v) => v.write_xdr(w),
63985            Self::ContractDataEntry(v) => v.write_xdr(w),
63986            Self::ContractCodeCostInputs(v) => v.write_xdr(w),
63987            Self::ContractCodeEntry(v) => v.write_xdr(w),
63988            Self::ContractCodeEntryExt(v) => v.write_xdr(w),
63989            Self::ContractCodeEntryV1(v) => v.write_xdr(w),
63990            Self::TtlEntry(v) => v.write_xdr(w),
63991            Self::LedgerEntryExtensionV1(v) => v.write_xdr(w),
63992            Self::LedgerEntryExtensionV1Ext(v) => v.write_xdr(w),
63993            Self::LedgerEntry(v) => v.write_xdr(w),
63994            Self::LedgerEntryData(v) => v.write_xdr(w),
63995            Self::LedgerEntryExt(v) => v.write_xdr(w),
63996            Self::LedgerKey(v) => v.write_xdr(w),
63997            Self::LedgerKeyAccount(v) => v.write_xdr(w),
63998            Self::LedgerKeyTrustLine(v) => v.write_xdr(w),
63999            Self::LedgerKeyOffer(v) => v.write_xdr(w),
64000            Self::LedgerKeyData(v) => v.write_xdr(w),
64001            Self::LedgerKeyClaimableBalance(v) => v.write_xdr(w),
64002            Self::LedgerKeyLiquidityPool(v) => v.write_xdr(w),
64003            Self::LedgerKeyContractData(v) => v.write_xdr(w),
64004            Self::LedgerKeyContractCode(v) => v.write_xdr(w),
64005            Self::LedgerKeyConfigSetting(v) => v.write_xdr(w),
64006            Self::LedgerKeyTtl(v) => v.write_xdr(w),
64007            Self::EnvelopeType(v) => v.write_xdr(w),
64008            Self::BucketListType(v) => v.write_xdr(w),
64009            Self::BucketEntryType(v) => v.write_xdr(w),
64010            Self::HotArchiveBucketEntryType(v) => v.write_xdr(w),
64011            Self::ColdArchiveBucketEntryType(v) => v.write_xdr(w),
64012            Self::BucketMetadata(v) => v.write_xdr(w),
64013            Self::BucketMetadataExt(v) => v.write_xdr(w),
64014            Self::BucketEntry(v) => v.write_xdr(w),
64015            Self::HotArchiveBucketEntry(v) => v.write_xdr(w),
64016            Self::ColdArchiveArchivedLeaf(v) => v.write_xdr(w),
64017            Self::ColdArchiveDeletedLeaf(v) => v.write_xdr(w),
64018            Self::ColdArchiveBoundaryLeaf(v) => v.write_xdr(w),
64019            Self::ColdArchiveHashEntry(v) => v.write_xdr(w),
64020            Self::ColdArchiveBucketEntry(v) => v.write_xdr(w),
64021            Self::UpgradeType(v) => v.write_xdr(w),
64022            Self::StellarValueType(v) => v.write_xdr(w),
64023            Self::LedgerCloseValueSignature(v) => v.write_xdr(w),
64024            Self::StellarValue(v) => v.write_xdr(w),
64025            Self::StellarValueExt(v) => v.write_xdr(w),
64026            Self::LedgerHeaderFlags(v) => v.write_xdr(w),
64027            Self::LedgerHeaderExtensionV1(v) => v.write_xdr(w),
64028            Self::LedgerHeaderExtensionV1Ext(v) => v.write_xdr(w),
64029            Self::LedgerHeader(v) => v.write_xdr(w),
64030            Self::LedgerHeaderExt(v) => v.write_xdr(w),
64031            Self::LedgerUpgradeType(v) => v.write_xdr(w),
64032            Self::ConfigUpgradeSetKey(v) => v.write_xdr(w),
64033            Self::LedgerUpgrade(v) => v.write_xdr(w),
64034            Self::ConfigUpgradeSet(v) => v.write_xdr(w),
64035            Self::TxSetComponentType(v) => v.write_xdr(w),
64036            Self::TxExecutionThread(v) => v.write_xdr(w),
64037            Self::ParallelTxExecutionStage(v) => v.write_xdr(w),
64038            Self::ParallelTxsComponent(v) => v.write_xdr(w),
64039            Self::TxSetComponent(v) => v.write_xdr(w),
64040            Self::TxSetComponentTxsMaybeDiscountedFee(v) => v.write_xdr(w),
64041            Self::TransactionPhase(v) => v.write_xdr(w),
64042            Self::TransactionSet(v) => v.write_xdr(w),
64043            Self::TransactionSetV1(v) => v.write_xdr(w),
64044            Self::GeneralizedTransactionSet(v) => v.write_xdr(w),
64045            Self::TransactionResultPair(v) => v.write_xdr(w),
64046            Self::TransactionResultSet(v) => v.write_xdr(w),
64047            Self::TransactionHistoryEntry(v) => v.write_xdr(w),
64048            Self::TransactionHistoryEntryExt(v) => v.write_xdr(w),
64049            Self::TransactionHistoryResultEntry(v) => v.write_xdr(w),
64050            Self::TransactionHistoryResultEntryExt(v) => v.write_xdr(w),
64051            Self::LedgerHeaderHistoryEntry(v) => v.write_xdr(w),
64052            Self::LedgerHeaderHistoryEntryExt(v) => v.write_xdr(w),
64053            Self::LedgerScpMessages(v) => v.write_xdr(w),
64054            Self::ScpHistoryEntryV0(v) => v.write_xdr(w),
64055            Self::ScpHistoryEntry(v) => v.write_xdr(w),
64056            Self::LedgerEntryChangeType(v) => v.write_xdr(w),
64057            Self::LedgerEntryChange(v) => v.write_xdr(w),
64058            Self::LedgerEntryChanges(v) => v.write_xdr(w),
64059            Self::OperationMeta(v) => v.write_xdr(w),
64060            Self::TransactionMetaV1(v) => v.write_xdr(w),
64061            Self::TransactionMetaV2(v) => v.write_xdr(w),
64062            Self::ContractEventType(v) => v.write_xdr(w),
64063            Self::ContractEvent(v) => v.write_xdr(w),
64064            Self::ContractEventBody(v) => v.write_xdr(w),
64065            Self::ContractEventV0(v) => v.write_xdr(w),
64066            Self::DiagnosticEvent(v) => v.write_xdr(w),
64067            Self::SorobanTransactionMetaExtV1(v) => v.write_xdr(w),
64068            Self::SorobanTransactionMetaExt(v) => v.write_xdr(w),
64069            Self::SorobanTransactionMeta(v) => v.write_xdr(w),
64070            Self::TransactionMetaV3(v) => v.write_xdr(w),
64071            Self::InvokeHostFunctionSuccessPreImage(v) => v.write_xdr(w),
64072            Self::TransactionMeta(v) => v.write_xdr(w),
64073            Self::TransactionResultMeta(v) => v.write_xdr(w),
64074            Self::UpgradeEntryMeta(v) => v.write_xdr(w),
64075            Self::LedgerCloseMetaV0(v) => v.write_xdr(w),
64076            Self::LedgerCloseMetaExtV1(v) => v.write_xdr(w),
64077            Self::LedgerCloseMetaExtV2(v) => v.write_xdr(w),
64078            Self::LedgerCloseMetaExt(v) => v.write_xdr(w),
64079            Self::LedgerCloseMetaV1(v) => v.write_xdr(w),
64080            Self::LedgerCloseMeta(v) => v.write_xdr(w),
64081            Self::ErrorCode(v) => v.write_xdr(w),
64082            Self::SError(v) => v.write_xdr(w),
64083            Self::SendMore(v) => v.write_xdr(w),
64084            Self::SendMoreExtended(v) => v.write_xdr(w),
64085            Self::AuthCert(v) => v.write_xdr(w),
64086            Self::Hello(v) => v.write_xdr(w),
64087            Self::Auth(v) => v.write_xdr(w),
64088            Self::IpAddrType(v) => v.write_xdr(w),
64089            Self::PeerAddress(v) => v.write_xdr(w),
64090            Self::PeerAddressIp(v) => v.write_xdr(w),
64091            Self::MessageType(v) => v.write_xdr(w),
64092            Self::DontHave(v) => v.write_xdr(w),
64093            Self::SurveyMessageCommandType(v) => v.write_xdr(w),
64094            Self::SurveyMessageResponseType(v) => v.write_xdr(w),
64095            Self::TimeSlicedSurveyStartCollectingMessage(v) => v.write_xdr(w),
64096            Self::SignedTimeSlicedSurveyStartCollectingMessage(v) => v.write_xdr(w),
64097            Self::TimeSlicedSurveyStopCollectingMessage(v) => v.write_xdr(w),
64098            Self::SignedTimeSlicedSurveyStopCollectingMessage(v) => v.write_xdr(w),
64099            Self::SurveyRequestMessage(v) => v.write_xdr(w),
64100            Self::TimeSlicedSurveyRequestMessage(v) => v.write_xdr(w),
64101            Self::SignedSurveyRequestMessage(v) => v.write_xdr(w),
64102            Self::SignedTimeSlicedSurveyRequestMessage(v) => v.write_xdr(w),
64103            Self::EncryptedBody(v) => v.write_xdr(w),
64104            Self::SurveyResponseMessage(v) => v.write_xdr(w),
64105            Self::TimeSlicedSurveyResponseMessage(v) => v.write_xdr(w),
64106            Self::SignedSurveyResponseMessage(v) => v.write_xdr(w),
64107            Self::SignedTimeSlicedSurveyResponseMessage(v) => v.write_xdr(w),
64108            Self::PeerStats(v) => v.write_xdr(w),
64109            Self::PeerStatList(v) => v.write_xdr(w),
64110            Self::TimeSlicedNodeData(v) => v.write_xdr(w),
64111            Self::TimeSlicedPeerData(v) => v.write_xdr(w),
64112            Self::TimeSlicedPeerDataList(v) => v.write_xdr(w),
64113            Self::TopologyResponseBodyV0(v) => v.write_xdr(w),
64114            Self::TopologyResponseBodyV1(v) => v.write_xdr(w),
64115            Self::TopologyResponseBodyV2(v) => v.write_xdr(w),
64116            Self::SurveyResponseBody(v) => v.write_xdr(w),
64117            Self::TxAdvertVector(v) => v.write_xdr(w),
64118            Self::FloodAdvert(v) => v.write_xdr(w),
64119            Self::TxDemandVector(v) => v.write_xdr(w),
64120            Self::FloodDemand(v) => v.write_xdr(w),
64121            Self::StellarMessage(v) => v.write_xdr(w),
64122            Self::AuthenticatedMessage(v) => v.write_xdr(w),
64123            Self::AuthenticatedMessageV0(v) => v.write_xdr(w),
64124            Self::LiquidityPoolParameters(v) => v.write_xdr(w),
64125            Self::MuxedAccount(v) => v.write_xdr(w),
64126            Self::MuxedAccountMed25519(v) => v.write_xdr(w),
64127            Self::DecoratedSignature(v) => v.write_xdr(w),
64128            Self::OperationType(v) => v.write_xdr(w),
64129            Self::CreateAccountOp(v) => v.write_xdr(w),
64130            Self::PaymentOp(v) => v.write_xdr(w),
64131            Self::PathPaymentStrictReceiveOp(v) => v.write_xdr(w),
64132            Self::PathPaymentStrictSendOp(v) => v.write_xdr(w),
64133            Self::ManageSellOfferOp(v) => v.write_xdr(w),
64134            Self::ManageBuyOfferOp(v) => v.write_xdr(w),
64135            Self::CreatePassiveSellOfferOp(v) => v.write_xdr(w),
64136            Self::SetOptionsOp(v) => v.write_xdr(w),
64137            Self::ChangeTrustAsset(v) => v.write_xdr(w),
64138            Self::ChangeTrustOp(v) => v.write_xdr(w),
64139            Self::AllowTrustOp(v) => v.write_xdr(w),
64140            Self::ManageDataOp(v) => v.write_xdr(w),
64141            Self::BumpSequenceOp(v) => v.write_xdr(w),
64142            Self::CreateClaimableBalanceOp(v) => v.write_xdr(w),
64143            Self::ClaimClaimableBalanceOp(v) => v.write_xdr(w),
64144            Self::BeginSponsoringFutureReservesOp(v) => v.write_xdr(w),
64145            Self::RevokeSponsorshipType(v) => v.write_xdr(w),
64146            Self::RevokeSponsorshipOp(v) => v.write_xdr(w),
64147            Self::RevokeSponsorshipOpSigner(v) => v.write_xdr(w),
64148            Self::ClawbackOp(v) => v.write_xdr(w),
64149            Self::ClawbackClaimableBalanceOp(v) => v.write_xdr(w),
64150            Self::SetTrustLineFlagsOp(v) => v.write_xdr(w),
64151            Self::LiquidityPoolDepositOp(v) => v.write_xdr(w),
64152            Self::LiquidityPoolWithdrawOp(v) => v.write_xdr(w),
64153            Self::HostFunctionType(v) => v.write_xdr(w),
64154            Self::ContractIdPreimageType(v) => v.write_xdr(w),
64155            Self::ContractIdPreimage(v) => v.write_xdr(w),
64156            Self::ContractIdPreimageFromAddress(v) => v.write_xdr(w),
64157            Self::CreateContractArgs(v) => v.write_xdr(w),
64158            Self::CreateContractArgsV2(v) => v.write_xdr(w),
64159            Self::InvokeContractArgs(v) => v.write_xdr(w),
64160            Self::HostFunction(v) => v.write_xdr(w),
64161            Self::SorobanAuthorizedFunctionType(v) => v.write_xdr(w),
64162            Self::SorobanAuthorizedFunction(v) => v.write_xdr(w),
64163            Self::SorobanAuthorizedInvocation(v) => v.write_xdr(w),
64164            Self::SorobanAddressCredentials(v) => v.write_xdr(w),
64165            Self::SorobanCredentialsType(v) => v.write_xdr(w),
64166            Self::SorobanCredentials(v) => v.write_xdr(w),
64167            Self::SorobanAuthorizationEntry(v) => v.write_xdr(w),
64168            Self::InvokeHostFunctionOp(v) => v.write_xdr(w),
64169            Self::ExtendFootprintTtlOp(v) => v.write_xdr(w),
64170            Self::RestoreFootprintOp(v) => v.write_xdr(w),
64171            Self::Operation(v) => v.write_xdr(w),
64172            Self::OperationBody(v) => v.write_xdr(w),
64173            Self::HashIdPreimage(v) => v.write_xdr(w),
64174            Self::HashIdPreimageOperationId(v) => v.write_xdr(w),
64175            Self::HashIdPreimageRevokeId(v) => v.write_xdr(w),
64176            Self::HashIdPreimageContractId(v) => v.write_xdr(w),
64177            Self::HashIdPreimageSorobanAuthorization(v) => v.write_xdr(w),
64178            Self::MemoType(v) => v.write_xdr(w),
64179            Self::Memo(v) => v.write_xdr(w),
64180            Self::TimeBounds(v) => v.write_xdr(w),
64181            Self::LedgerBounds(v) => v.write_xdr(w),
64182            Self::PreconditionsV2(v) => v.write_xdr(w),
64183            Self::PreconditionType(v) => v.write_xdr(w),
64184            Self::Preconditions(v) => v.write_xdr(w),
64185            Self::LedgerFootprint(v) => v.write_xdr(w),
64186            Self::ArchivalProofType(v) => v.write_xdr(w),
64187            Self::ArchivalProofNode(v) => v.write_xdr(w),
64188            Self::ProofLevel(v) => v.write_xdr(w),
64189            Self::ExistenceProofBody(v) => v.write_xdr(w),
64190            Self::NonexistenceProofBody(v) => v.write_xdr(w),
64191            Self::ArchivalProof(v) => v.write_xdr(w),
64192            Self::ArchivalProofBody(v) => v.write_xdr(w),
64193            Self::SorobanResources(v) => v.write_xdr(w),
64194            Self::SorobanTransactionData(v) => v.write_xdr(w),
64195            Self::SorobanTransactionDataExt(v) => v.write_xdr(w),
64196            Self::TransactionV0(v) => v.write_xdr(w),
64197            Self::TransactionV0Ext(v) => v.write_xdr(w),
64198            Self::TransactionV0Envelope(v) => v.write_xdr(w),
64199            Self::Transaction(v) => v.write_xdr(w),
64200            Self::TransactionExt(v) => v.write_xdr(w),
64201            Self::TransactionV1Envelope(v) => v.write_xdr(w),
64202            Self::FeeBumpTransaction(v) => v.write_xdr(w),
64203            Self::FeeBumpTransactionInnerTx(v) => v.write_xdr(w),
64204            Self::FeeBumpTransactionExt(v) => v.write_xdr(w),
64205            Self::FeeBumpTransactionEnvelope(v) => v.write_xdr(w),
64206            Self::TransactionEnvelope(v) => v.write_xdr(w),
64207            Self::TransactionSignaturePayload(v) => v.write_xdr(w),
64208            Self::TransactionSignaturePayloadTaggedTransaction(v) => v.write_xdr(w),
64209            Self::ClaimAtomType(v) => v.write_xdr(w),
64210            Self::ClaimOfferAtomV0(v) => v.write_xdr(w),
64211            Self::ClaimOfferAtom(v) => v.write_xdr(w),
64212            Self::ClaimLiquidityAtom(v) => v.write_xdr(w),
64213            Self::ClaimAtom(v) => v.write_xdr(w),
64214            Self::CreateAccountResultCode(v) => v.write_xdr(w),
64215            Self::CreateAccountResult(v) => v.write_xdr(w),
64216            Self::PaymentResultCode(v) => v.write_xdr(w),
64217            Self::PaymentResult(v) => v.write_xdr(w),
64218            Self::PathPaymentStrictReceiveResultCode(v) => v.write_xdr(w),
64219            Self::SimplePaymentResult(v) => v.write_xdr(w),
64220            Self::PathPaymentStrictReceiveResult(v) => v.write_xdr(w),
64221            Self::PathPaymentStrictReceiveResultSuccess(v) => v.write_xdr(w),
64222            Self::PathPaymentStrictSendResultCode(v) => v.write_xdr(w),
64223            Self::PathPaymentStrictSendResult(v) => v.write_xdr(w),
64224            Self::PathPaymentStrictSendResultSuccess(v) => v.write_xdr(w),
64225            Self::ManageSellOfferResultCode(v) => v.write_xdr(w),
64226            Self::ManageOfferEffect(v) => v.write_xdr(w),
64227            Self::ManageOfferSuccessResult(v) => v.write_xdr(w),
64228            Self::ManageOfferSuccessResultOffer(v) => v.write_xdr(w),
64229            Self::ManageSellOfferResult(v) => v.write_xdr(w),
64230            Self::ManageBuyOfferResultCode(v) => v.write_xdr(w),
64231            Self::ManageBuyOfferResult(v) => v.write_xdr(w),
64232            Self::SetOptionsResultCode(v) => v.write_xdr(w),
64233            Self::SetOptionsResult(v) => v.write_xdr(w),
64234            Self::ChangeTrustResultCode(v) => v.write_xdr(w),
64235            Self::ChangeTrustResult(v) => v.write_xdr(w),
64236            Self::AllowTrustResultCode(v) => v.write_xdr(w),
64237            Self::AllowTrustResult(v) => v.write_xdr(w),
64238            Self::AccountMergeResultCode(v) => v.write_xdr(w),
64239            Self::AccountMergeResult(v) => v.write_xdr(w),
64240            Self::InflationResultCode(v) => v.write_xdr(w),
64241            Self::InflationPayout(v) => v.write_xdr(w),
64242            Self::InflationResult(v) => v.write_xdr(w),
64243            Self::ManageDataResultCode(v) => v.write_xdr(w),
64244            Self::ManageDataResult(v) => v.write_xdr(w),
64245            Self::BumpSequenceResultCode(v) => v.write_xdr(w),
64246            Self::BumpSequenceResult(v) => v.write_xdr(w),
64247            Self::CreateClaimableBalanceResultCode(v) => v.write_xdr(w),
64248            Self::CreateClaimableBalanceResult(v) => v.write_xdr(w),
64249            Self::ClaimClaimableBalanceResultCode(v) => v.write_xdr(w),
64250            Self::ClaimClaimableBalanceResult(v) => v.write_xdr(w),
64251            Self::BeginSponsoringFutureReservesResultCode(v) => v.write_xdr(w),
64252            Self::BeginSponsoringFutureReservesResult(v) => v.write_xdr(w),
64253            Self::EndSponsoringFutureReservesResultCode(v) => v.write_xdr(w),
64254            Self::EndSponsoringFutureReservesResult(v) => v.write_xdr(w),
64255            Self::RevokeSponsorshipResultCode(v) => v.write_xdr(w),
64256            Self::RevokeSponsorshipResult(v) => v.write_xdr(w),
64257            Self::ClawbackResultCode(v) => v.write_xdr(w),
64258            Self::ClawbackResult(v) => v.write_xdr(w),
64259            Self::ClawbackClaimableBalanceResultCode(v) => v.write_xdr(w),
64260            Self::ClawbackClaimableBalanceResult(v) => v.write_xdr(w),
64261            Self::SetTrustLineFlagsResultCode(v) => v.write_xdr(w),
64262            Self::SetTrustLineFlagsResult(v) => v.write_xdr(w),
64263            Self::LiquidityPoolDepositResultCode(v) => v.write_xdr(w),
64264            Self::LiquidityPoolDepositResult(v) => v.write_xdr(w),
64265            Self::LiquidityPoolWithdrawResultCode(v) => v.write_xdr(w),
64266            Self::LiquidityPoolWithdrawResult(v) => v.write_xdr(w),
64267            Self::InvokeHostFunctionResultCode(v) => v.write_xdr(w),
64268            Self::InvokeHostFunctionResult(v) => v.write_xdr(w),
64269            Self::ExtendFootprintTtlResultCode(v) => v.write_xdr(w),
64270            Self::ExtendFootprintTtlResult(v) => v.write_xdr(w),
64271            Self::RestoreFootprintResultCode(v) => v.write_xdr(w),
64272            Self::RestoreFootprintResult(v) => v.write_xdr(w),
64273            Self::OperationResultCode(v) => v.write_xdr(w),
64274            Self::OperationResult(v) => v.write_xdr(w),
64275            Self::OperationResultTr(v) => v.write_xdr(w),
64276            Self::TransactionResultCode(v) => v.write_xdr(w),
64277            Self::InnerTransactionResult(v) => v.write_xdr(w),
64278            Self::InnerTransactionResultResult(v) => v.write_xdr(w),
64279            Self::InnerTransactionResultExt(v) => v.write_xdr(w),
64280            Self::InnerTransactionResultPair(v) => v.write_xdr(w),
64281            Self::TransactionResult(v) => v.write_xdr(w),
64282            Self::TransactionResultResult(v) => v.write_xdr(w),
64283            Self::TransactionResultExt(v) => v.write_xdr(w),
64284            Self::Hash(v) => v.write_xdr(w),
64285            Self::Uint256(v) => v.write_xdr(w),
64286            Self::Uint32(v) => v.write_xdr(w),
64287            Self::Int32(v) => v.write_xdr(w),
64288            Self::Uint64(v) => v.write_xdr(w),
64289            Self::Int64(v) => v.write_xdr(w),
64290            Self::TimePoint(v) => v.write_xdr(w),
64291            Self::Duration(v) => v.write_xdr(w),
64292            Self::ExtensionPoint(v) => v.write_xdr(w),
64293            Self::CryptoKeyType(v) => v.write_xdr(w),
64294            Self::PublicKeyType(v) => v.write_xdr(w),
64295            Self::SignerKeyType(v) => v.write_xdr(w),
64296            Self::PublicKey(v) => v.write_xdr(w),
64297            Self::SignerKey(v) => v.write_xdr(w),
64298            Self::SignerKeyEd25519SignedPayload(v) => v.write_xdr(w),
64299            Self::Signature(v) => v.write_xdr(w),
64300            Self::SignatureHint(v) => v.write_xdr(w),
64301            Self::NodeId(v) => v.write_xdr(w),
64302            Self::AccountId(v) => v.write_xdr(w),
64303            Self::Curve25519Secret(v) => v.write_xdr(w),
64304            Self::Curve25519Public(v) => v.write_xdr(w),
64305            Self::HmacSha256Key(v) => v.write_xdr(w),
64306            Self::HmacSha256Mac(v) => v.write_xdr(w),
64307            Self::ShortHashSeed(v) => v.write_xdr(w),
64308            Self::BinaryFuseFilterType(v) => v.write_xdr(w),
64309            Self::SerializedBinaryFuseFilter(v) => v.write_xdr(w),
64310        }
64311    }
64312}