1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#[allow(unused_imports, clippy::wildcard_imports)]
use super::*;
/// InnerTransactionResult is an XDR Struct defined as:
///
/// ```text
/// struct InnerTransactionResult
/// {
/// // Always 0. Here for binary compatibility.
/// int64 feeCharged;
///
/// union switch (TransactionResultCode code)
/// {
/// // txFEE_BUMP_INNER_SUCCESS is not included
/// case txSUCCESS:
/// case txFAILED:
/// OperationResult results<>;
/// case txTOO_EARLY:
/// case txTOO_LATE:
/// case txMISSING_OPERATION:
/// case txBAD_SEQ:
/// case txBAD_AUTH:
/// case txINSUFFICIENT_BALANCE:
/// case txNO_ACCOUNT:
/// case txINSUFFICIENT_FEE:
/// case txBAD_AUTH_EXTRA:
/// case txINTERNAL_ERROR:
/// case txNOT_SUPPORTED:
/// // txFEE_BUMP_INNER_FAILED is not included
/// case txBAD_SPONSORSHIP:
/// case txBAD_MIN_SEQ_AGE_OR_GAP:
/// case txMALFORMED:
/// case txSOROBAN_INVALID:
/// case txFROZEN_KEY_ACCESSED:
/// void;
/// }
/// result;
///
/// // reserved for future use
/// union switch (int v)
/// {
/// case 0:
/// void;
/// }
/// ext;
/// };
/// ```
///
#[cfg_attr(feature = "alloc", derive(Default))]
#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
#[cfg_attr(feature = "serde", cfg_eval::cfg_eval)]
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
#[cfg_attr(
all(feature = "serde", feature = "alloc"),
serde_with::serde_as,
derive(serde::Serialize, serde::Deserialize),
serde(rename_all = "snake_case")
)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
pub struct InnerTransactionResult {
#[cfg_attr(
all(feature = "serde", feature = "alloc"),
serde_as(as = "NumberOrString")
)]
pub fee_charged: i64,
pub result: InnerTransactionResultResult,
pub ext: InnerTransactionResultExt,
}
impl ReadXdr for InnerTransactionResult {
#[cfg(feature = "std")]
fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self, Error> {
r.with_limited_depth(|r| {
Ok(Self {
fee_charged: i64::read_xdr(r)?,
result: InnerTransactionResultResult::read_xdr(r)?,
ext: InnerTransactionResultExt::read_xdr(r)?,
})
})
}
}
impl WriteXdr for InnerTransactionResult {
#[cfg(feature = "std")]
fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<(), Error> {
w.with_limited_depth(|w| {
self.fee_charged.write_xdr(w)?;
self.result.write_xdr(w)?;
self.ext.write_xdr(w)?;
Ok(())
})
}
}