1use crate::amount::{Price, Stroops};
2use crate::asset::Asset;
3use crate::claim::ClaimableBalanceId;
4use crate::crypto::PublicKey;
5use crate::error::Result;
6use crate::xdr;
7
8#[derive(Debug, Clone, PartialEq, Eq)]
9pub enum OperationResult {
10 Inner(InnerOperationResult),
11 BadAuth,
12 NoAccount,
13 NotSupported,
14 TooManySubentries,
15 ExceededWorkLimit,
16 TooManySponsoring,
17}
18
19#[derive(Debug, Clone, PartialEq, Eq)]
20pub enum InnerOperationResult {
21 CreateAccount(CreateAccountResult),
22 Payment(PaymentResult),
23 PathPaymentStrictReceive(PathPaymentStrictReceiveResult),
24 PathPaymentStrictSend(PathPaymentStrictSendResult),
25 ManageSellOffer(ManageSellOfferResult),
26 ManageBuyOffer(ManageBuyOfferResult),
27 CreatePassiveSellOffer(ManageSellOfferResult),
28 SetOptions(SetOptionsResult),
29 ChangeTrust(ChangeTrustResult),
30 AllowTrust(AllowTrustResult),
31 AccountMerge(AccountMergeResult),
32 Inflation(InflationResult),
33 ManageData(ManageDataResult),
34 BumpSequence(BumpSequenceResult),
35 CreateClaimableBalance(CreateClaimableBalanceResult),
36 ClaimClaimableBalance(ClaimClaimableBalanceResult),
37 BeginSponsoringFutureReserves(BeginSponsoringFutureReservesResult),
38 EndSponsoringFutureReserves(EndSponsoringFutureReservesResult),
39 RevokeSponsorship(RevokeSponsorshipResult),
40 Clawback(ClawbackResult),
41 ClawbackClaimableBalance(ClawbackClaimableBalanceResult),
42 SetTrustLineFlags(SetTrustLineFlagsResult),
43 LiquidityPoolDeposit(LiquidityPoolDepositResult),
44 LiquidityPoolWithdraw(LiquidityPoolWithdrawResult),
45 InvokeHostFunction(InvokeHostFunctionResult),
46 ExtendFootprintTtl(ExtendFootprintTtlResult),
47 RestoreFootprint(RestoreFootprintResult),
48}
49
50pub use xdr::CreateAccountResult;
51pub use xdr::PaymentResult;
52
53#[derive(Debug, Clone, PartialEq, Eq)]
54pub enum PathPaymentStrictReceiveResult {
55 Success(PathPaymentStrictReceiveResultSuccess),
56 NoIssuer(Asset),
57 Malformed,
58 Underfunded,
59 SourceNoTrust,
60 SourceNotAuthorized,
61 NoDestination,
62 NoTrust,
63 NotAuthorized,
64 LineFull,
65 TooFewOffers,
66 OfferCrossSelf,
67 OverSendMax,
68}
69
70#[derive(Debug, Clone, PartialEq, Eq)]
71pub enum PathPaymentStrictSendResult {
72 Success(PathPaymentStrictSendResultSuccess),
73 NoIssuer(Asset),
74 Malformed,
75 Underfunded,
76 SourceNoTrust,
77 SourceNotAuthorized,
78 NoDestination,
79 NoTrust,
80 NotAuthorized,
81 LineFull,
82 TooFewOffers,
83 OfferCrossSelf,
84 UnderDestinationMin,
85}
86
87pub use xdr::SetOptionsResult;
88
89#[derive(Debug, Clone, PartialEq, Eq)]
90pub enum ManageSellOfferResult {
91 Success(ManageOfferResultSuccess),
92 Malformed,
93 SellNoTrust,
94 BuyNoTrust,
95 SellNotAuthorized,
96 BuyNotAuthorized,
97 LineFull,
98 Underfunded,
99 CrossSelf,
100 SellNoIssuer,
101 BuyNoIssuer,
102 NotFound,
103 LowReserve,
104}
105
106#[derive(Debug, Clone, PartialEq, Eq)]
107pub enum ManageBuyOfferResult {
108 Success(ManageOfferResultSuccess),
109 Malformed,
110 SellNoTrust,
111 BuyNoTrust,
112 SellNotAuthorized,
113 BuyNotAuthorized,
114 LineFull,
115 Underfunded,
116 CrossSelf,
117 SellNoIssuer,
118 BuyNoIssuer,
119 NotFound,
120 LowReserve,
121}
122
123pub use xdr::AllowTrustResult;
124pub use xdr::ChangeTrustResult;
125
126#[derive(Debug, Clone, PartialEq, Eq)]
127pub enum AccountMergeResult {
128 Success(Stroops),
129 Malformed,
130 NoAccount,
131 ImmutableSet,
132 HasSubEntries,
133 SequenceTooFar,
134 DestinationFull,
135 IsSponsor,
136}
137
138#[derive(Debug, Clone, PartialEq, Eq)]
139pub enum InflationResult {
140 Success(Vec<InflationPayout>),
141 NotTime,
142}
143
144pub use xdr::BumpSequenceResult;
145pub use xdr::ManageDataResult;
146
147#[derive(Debug, Clone, PartialEq, Eq)]
148pub enum CreateClaimableBalanceResult {
149 Success(ClaimableBalanceId),
150 Malformed,
151 LowReserve,
152 NoTrust,
153 NotAuthorized,
154 Underfunded,
155}
156
157pub use xdr::BeginSponsoringFutureReservesResult;
158pub use xdr::ClaimClaimableBalanceResult;
159pub use xdr::ClawbackClaimableBalanceResult;
160pub use xdr::ClawbackResult;
161pub use xdr::EndSponsoringFutureReservesResult;
162pub use xdr::ExtendFootprintTtlResult;
163pub use xdr::InvokeHostFunctionResult;
164pub use xdr::LiquidityPoolDepositResult;
165pub use xdr::LiquidityPoolWithdrawResult;
166pub use xdr::RestoreFootprintResult;
167pub use xdr::RevokeSponsorshipResult;
168pub use xdr::SetTrustLineFlagsResult;
169
170#[derive(Debug, Clone, PartialEq, Eq)]
171pub struct PathPaymentStrictReceiveResultSuccess {
172 pub offers: Vec<ClaimAtom>,
173 pub last: SimplePaymentResult,
174}
175
176#[derive(Debug, Clone, PartialEq, Eq)]
177pub struct PathPaymentStrictSendResultSuccess {
178 pub offers: Vec<ClaimAtom>,
179 pub last: SimplePaymentResult,
180}
181
182#[derive(Debug, Clone, PartialEq, Eq)]
183pub struct ManageOfferResultSuccess {
184 pub offers_claimed: Vec<ClaimAtom>,
185 pub offer: OfferResult,
186}
187
188#[derive(Debug, Clone, PartialEq, Eq)]
189pub struct SimplePaymentResult {
190 pub destination: PublicKey,
191 pub asset: Asset,
192 pub amount: Stroops,
193}
194
195#[derive(Debug, Clone, PartialEq, Eq)]
196pub enum ClaimAtom {
197 OrderBook(ClaimOfferAtom),
198 LiquidityPool(ClaimLiquidityAtom),
199}
200
201#[derive(Debug, Clone, PartialEq, Eq)]
202pub struct ClaimLiquidityAtom {
203 pub pool_id: Vec<u8>,
204 pub asset_sold: Asset,
205 pub amount_sold: Stroops,
206 pub asset_bought: Asset,
207 pub amount_bought: Stroops,
208}
209
210#[derive(Debug, Clone, PartialEq, Eq)]
211pub struct ClaimOfferAtom {
212 pub seller_id: PublicKey,
213 pub offer_id: i64,
214 pub asset_sold: Asset,
215 pub amount_sold: Stroops,
216 pub asset_bought: Asset,
217 pub amount_bought: Stroops,
218}
219
220#[derive(Debug, Clone, PartialEq, Eq)]
221pub enum OfferResult {
222 Created(OfferEntry),
223 Updated(OfferEntry),
224 Deleted,
225}
226
227#[derive(Debug, Clone, PartialEq, Eq)]
228pub struct OfferEntry {
229 pub seller_id: PublicKey,
230 pub offer_id: i64,
231 pub selling: Asset,
232 pub buying: Asset,
233 pub amount: Stroops,
234 pub price: Price,
235 pub flags: u32,
236}
237
238#[derive(Debug, Clone, PartialEq, Eq)]
239pub struct InflationPayout {
240 pub destination: PublicKey,
241 pub amount: Stroops,
242}
243
244impl OperationResult {
245 pub fn from_xdr(x: &xdr::OperationResult) -> Result<OperationResult> {
246 match *x {
247 xdr::OperationResult::OpInner(ref xdr_inner) => {
248 let inner = InnerOperationResult::from_xdr(xdr_inner)?;
249 Ok(OperationResult::Inner(inner))
250 }
251 xdr::OperationResult::OpBadAuth => Ok(OperationResult::BadAuth),
252 xdr::OperationResult::OpNoAccount => Ok(OperationResult::NoAccount),
253 xdr::OperationResult::OpNotSupported => Ok(OperationResult::NotSupported),
254 xdr::OperationResult::OpTooManySubentries => Ok(OperationResult::TooManySubentries),
255 xdr::OperationResult::OpExceededWorkLimit => Ok(OperationResult::ExceededWorkLimit),
256 xdr::OperationResult::OpTooManySponsoring => Ok(OperationResult::TooManySponsoring),
257 }
258 }
259}
260
261impl InnerOperationResult {
262 pub fn from_xdr(x: &xdr::OperationResultTr) -> Result<InnerOperationResult> {
263 match x {
264 xdr::OperationResultTr::CreateAccount(xdr_inner) => {
265 Ok(InnerOperationResult::CreateAccount(xdr_inner.clone()))
266 }
267 xdr::OperationResultTr::Payment(xdr_inner) => {
268 Ok(InnerOperationResult::Payment(xdr_inner.clone()))
269 }
270 xdr::OperationResultTr::PathPaymentStrictReceive(ref xdr_inner) => {
271 let inner = PathPaymentStrictReceiveResult::from_xdr(xdr_inner)?;
272 Ok(InnerOperationResult::PathPaymentStrictReceive(inner))
273 }
274 xdr::OperationResultTr::ManageSellOffer(ref xdr_inner) => {
275 let inner = ManageSellOfferResult::from_xdr(xdr_inner)?;
276 Ok(InnerOperationResult::ManageSellOffer(inner))
277 }
278 xdr::OperationResultTr::CreatePassiveSellOffer(ref xdr_inner) => {
279 let inner = ManageSellOfferResult::from_xdr(xdr_inner)?;
280 Ok(InnerOperationResult::CreatePassiveSellOffer(inner))
281 }
282 xdr::OperationResultTr::SetOptions(xdr_inner) => {
283 Ok(InnerOperationResult::SetOptions(xdr_inner.clone()))
284 }
285 xdr::OperationResultTr::ChangeTrust(xdr_inner) => {
286 Ok(InnerOperationResult::ChangeTrust(xdr_inner.clone()))
287 }
288 xdr::OperationResultTr::AllowTrust(xdr_inner) => {
289 Ok(InnerOperationResult::AllowTrust(xdr_inner.clone()))
290 }
291 xdr::OperationResultTr::AccountMerge(ref xdr_inner) => {
292 let inner = AccountMergeResult::from_xdr(xdr_inner)?;
293 Ok(InnerOperationResult::AccountMerge(inner))
294 }
295 xdr::OperationResultTr::Inflation(ref xdr_inner) => {
296 let inner = InflationResult::from_xdr(xdr_inner)?;
297 Ok(InnerOperationResult::Inflation(inner))
298 }
299 xdr::OperationResultTr::ManageData(xdr_inner) => {
300 Ok(InnerOperationResult::ManageData(xdr_inner.clone()))
301 }
302 xdr::OperationResultTr::BumpSequence(xdr_inner) => {
303 Ok(InnerOperationResult::BumpSequence(xdr_inner.clone()))
304 }
305 xdr::OperationResultTr::ManageBuyOffer(ref xdr_inner) => {
306 let inner = ManageBuyOfferResult::from_xdr(xdr_inner)?;
307 Ok(InnerOperationResult::ManageBuyOffer(inner))
308 }
309 xdr::OperationResultTr::PathPaymentStrictSend(ref xdr_inner) => {
310 let inner = PathPaymentStrictSendResult::from_xdr(xdr_inner)?;
311 Ok(InnerOperationResult::PathPaymentStrictSend(inner))
312 }
313 xdr::OperationResultTr::CreateClaimableBalance(ref xdr_inner) => {
314 let inner = CreateClaimableBalanceResult::from_xdr(xdr_inner)?;
315 Ok(InnerOperationResult::CreateClaimableBalance(inner))
316 }
317 xdr::OperationResultTr::ClaimClaimableBalance(xdr_inner) => Ok(
318 InnerOperationResult::ClaimClaimableBalance(xdr_inner.clone()),
319 ),
320 xdr::OperationResultTr::BeginSponsoringFutureReserves(xdr_inner) => Ok(
321 InnerOperationResult::BeginSponsoringFutureReserves(xdr_inner.clone()),
322 ),
323 xdr::OperationResultTr::EndSponsoringFutureReserves(xdr_inner) => Ok(
324 InnerOperationResult::EndSponsoringFutureReserves(xdr_inner.clone()),
325 ),
326 xdr::OperationResultTr::RevokeSponsorship(xdr_inner) => {
327 Ok(InnerOperationResult::RevokeSponsorship(xdr_inner.clone()))
328 }
329 xdr::OperationResultTr::Clawback(xdr_inner) => {
330 Ok(InnerOperationResult::Clawback(xdr_inner.clone()))
331 }
332 xdr::OperationResultTr::ClawbackClaimableBalance(xdr_inner) => Ok(
333 InnerOperationResult::ClawbackClaimableBalance(xdr_inner.clone()),
334 ),
335 xdr::OperationResultTr::SetTrustLineFlags(xdr_inner) => {
336 Ok(InnerOperationResult::SetTrustLineFlags(xdr_inner.clone()))
337 }
338 xdr::OperationResultTr::LiquidityPoolDeposit(xdr_inner) => Ok(
339 InnerOperationResult::LiquidityPoolDeposit(xdr_inner.clone()),
340 ),
341 xdr::OperationResultTr::LiquidityPoolWithdraw(xdr_inner) => Ok(
342 InnerOperationResult::LiquidityPoolWithdraw(xdr_inner.clone()),
343 ),
344 xdr::OperationResultTr::InvokeHostFunction(xdr_inner) => {
345 Ok(InnerOperationResult::InvokeHostFunction(xdr_inner.clone()))
346 }
347 xdr::OperationResultTr::ExtendFootprintTtl(xdr_inner) => {
348 Ok(InnerOperationResult::ExtendFootprintTtl(xdr_inner.clone()))
349 }
350 xdr::OperationResultTr::RestoreFootprint(xdr_inner) => {
351 Ok(InnerOperationResult::RestoreFootprint(xdr_inner.clone()))
352 }
353 }
354 }
355}
356
357impl PathPaymentStrictReceiveResult {
358 pub fn from_xdr(
359 x: &xdr::PathPaymentStrictReceiveResult,
360 ) -> Result<PathPaymentStrictReceiveResult> {
361 match *x {
362 xdr::PathPaymentStrictReceiveResult::Success(ref xdr_inner) => {
363 let inner = PathPaymentStrictReceiveResultSuccess::from_xdr(xdr_inner)?;
364 Ok(PathPaymentStrictReceiveResult::Success(inner))
365 }
366 xdr::PathPaymentStrictReceiveResult::Malformed => {
367 Ok(PathPaymentStrictReceiveResult::Malformed)
368 }
369 xdr::PathPaymentStrictReceiveResult::Underfunded => {
370 Ok(PathPaymentStrictReceiveResult::Underfunded)
371 }
372 xdr::PathPaymentStrictReceiveResult::SrcNoTrust => {
373 Ok(PathPaymentStrictReceiveResult::SourceNoTrust)
374 }
375 xdr::PathPaymentStrictReceiveResult::SrcNotAuthorized => {
376 Ok(PathPaymentStrictReceiveResult::SourceNotAuthorized)
377 }
378 xdr::PathPaymentStrictReceiveResult::NoDestination => {
379 Ok(PathPaymentStrictReceiveResult::NoDestination)
380 }
381 xdr::PathPaymentStrictReceiveResult::NoTrust => {
382 Ok(PathPaymentStrictReceiveResult::NoTrust)
383 }
384 xdr::PathPaymentStrictReceiveResult::NotAuthorized => {
385 Ok(PathPaymentStrictReceiveResult::NotAuthorized)
386 }
387 xdr::PathPaymentStrictReceiveResult::NoIssuer(ref xdr_asset) => {
388 let asset = Asset::from_xdr(xdr_asset)?;
389 Ok(PathPaymentStrictReceiveResult::NoIssuer(asset))
390 }
391 xdr::PathPaymentStrictReceiveResult::LineFull => {
392 Ok(PathPaymentStrictReceiveResult::LineFull)
393 }
394 xdr::PathPaymentStrictReceiveResult::TooFewOffers => {
395 Ok(PathPaymentStrictReceiveResult::TooFewOffers)
396 }
397 xdr::PathPaymentStrictReceiveResult::OfferCrossSelf => {
398 Ok(PathPaymentStrictReceiveResult::OfferCrossSelf)
399 }
400 xdr::PathPaymentStrictReceiveResult::OverSendmax => {
401 Ok(PathPaymentStrictReceiveResult::OverSendMax)
402 }
403 }
404 }
405}
406
407impl PathPaymentStrictSendResult {
408 pub fn from_xdr(x: &xdr::PathPaymentStrictSendResult) -> Result<PathPaymentStrictSendResult> {
409 match *x {
410 xdr::PathPaymentStrictSendResult::Success(ref xdr_inner) => {
411 let inner = PathPaymentStrictSendResultSuccess::from_xdr(xdr_inner)?;
412 Ok(PathPaymentStrictSendResult::Success(inner))
413 }
414 xdr::PathPaymentStrictSendResult::Malformed => {
415 Ok(PathPaymentStrictSendResult::Malformed)
416 }
417 xdr::PathPaymentStrictSendResult::Underfunded => {
418 Ok(PathPaymentStrictSendResult::Underfunded)
419 }
420 xdr::PathPaymentStrictSendResult::SrcNoTrust => {
421 Ok(PathPaymentStrictSendResult::SourceNoTrust)
422 }
423 xdr::PathPaymentStrictSendResult::SrcNotAuthorized => {
424 Ok(PathPaymentStrictSendResult::SourceNotAuthorized)
425 }
426 xdr::PathPaymentStrictSendResult::NoDestination => {
427 Ok(PathPaymentStrictSendResult::NoDestination)
428 }
429 xdr::PathPaymentStrictSendResult::NoTrust => Ok(PathPaymentStrictSendResult::NoTrust),
430 xdr::PathPaymentStrictSendResult::NotAuthorized => {
431 Ok(PathPaymentStrictSendResult::NotAuthorized)
432 }
433 xdr::PathPaymentStrictSendResult::LineFull => Ok(PathPaymentStrictSendResult::LineFull),
434 xdr::PathPaymentStrictSendResult::NoIssuer(ref xdr_asset) => {
435 let asset = Asset::from_xdr(xdr_asset)?;
436 Ok(PathPaymentStrictSendResult::NoIssuer(asset))
437 }
438 xdr::PathPaymentStrictSendResult::TooFewOffers => {
439 Ok(PathPaymentStrictSendResult::TooFewOffers)
440 }
441 xdr::PathPaymentStrictSendResult::OfferCrossSelf => {
442 Ok(PathPaymentStrictSendResult::OfferCrossSelf)
443 }
444 xdr::PathPaymentStrictSendResult::UnderDestmin => {
445 Ok(PathPaymentStrictSendResult::UnderDestinationMin)
446 }
447 }
448 }
449}
450
451impl ManageSellOfferResult {
452 pub fn from_xdr(x: &xdr::ManageSellOfferResult) -> Result<ManageSellOfferResult> {
453 match *x {
454 xdr::ManageSellOfferResult::Success(ref xdr_inner) => {
455 let inner = ManageOfferResultSuccess::from_xdr(xdr_inner)?;
456 Ok(ManageSellOfferResult::Success(inner))
457 }
458 xdr::ManageSellOfferResult::Malformed => Ok(ManageSellOfferResult::Malformed),
459 xdr::ManageSellOfferResult::SellNoTrust => Ok(ManageSellOfferResult::SellNoTrust),
460 xdr::ManageSellOfferResult::BuyNoTrust => Ok(ManageSellOfferResult::BuyNoTrust),
461 xdr::ManageSellOfferResult::SellNotAuthorized => {
462 Ok(ManageSellOfferResult::SellNotAuthorized)
463 }
464 xdr::ManageSellOfferResult::BuyNotAuthorized => {
465 Ok(ManageSellOfferResult::BuyNotAuthorized)
466 }
467 xdr::ManageSellOfferResult::LineFull => Ok(ManageSellOfferResult::LineFull),
468 xdr::ManageSellOfferResult::Underfunded => Ok(ManageSellOfferResult::Underfunded),
469 xdr::ManageSellOfferResult::CrossSelf => Ok(ManageSellOfferResult::CrossSelf),
470 xdr::ManageSellOfferResult::SellNoIssuer => Ok(ManageSellOfferResult::SellNoIssuer),
471 xdr::ManageSellOfferResult::BuyNoIssuer => Ok(ManageSellOfferResult::BuyNoIssuer),
472 xdr::ManageSellOfferResult::NotFound => Ok(ManageSellOfferResult::NotFound),
473 xdr::ManageSellOfferResult::LowReserve => Ok(ManageSellOfferResult::LowReserve),
474 }
475 }
476}
477
478impl ManageBuyOfferResult {
479 pub fn from_xdr(x: &xdr::ManageBuyOfferResult) -> Result<ManageBuyOfferResult> {
480 match *x {
481 xdr::ManageBuyOfferResult::Success(ref xdr_inner) => {
482 let inner = ManageOfferResultSuccess::from_xdr(xdr_inner)?;
483 Ok(ManageBuyOfferResult::Success(inner))
484 }
485 xdr::ManageBuyOfferResult::Malformed => Ok(ManageBuyOfferResult::Malformed),
486 xdr::ManageBuyOfferResult::SellNoTrust => Ok(ManageBuyOfferResult::SellNoTrust),
487 xdr::ManageBuyOfferResult::BuyNoTrust => Ok(ManageBuyOfferResult::BuyNoTrust),
488 xdr::ManageBuyOfferResult::SellNotAuthorized => {
489 Ok(ManageBuyOfferResult::SellNotAuthorized)
490 }
491 xdr::ManageBuyOfferResult::BuyNotAuthorized => {
492 Ok(ManageBuyOfferResult::BuyNotAuthorized)
493 }
494 xdr::ManageBuyOfferResult::LineFull => Ok(ManageBuyOfferResult::LineFull),
495 xdr::ManageBuyOfferResult::Underfunded => Ok(ManageBuyOfferResult::Underfunded),
496 xdr::ManageBuyOfferResult::CrossSelf => Ok(ManageBuyOfferResult::CrossSelf),
497 xdr::ManageBuyOfferResult::BuyNoIssuer => Ok(ManageBuyOfferResult::BuyNoIssuer),
498 xdr::ManageBuyOfferResult::SellNoIssuer => Ok(ManageBuyOfferResult::SellNoIssuer),
499 xdr::ManageBuyOfferResult::NotFound => Ok(ManageBuyOfferResult::NotFound),
500 xdr::ManageBuyOfferResult::LowReserve => Ok(ManageBuyOfferResult::LowReserve),
501 }
502 }
503}
504
505impl AccountMergeResult {
506 pub fn from_xdr(x: &xdr::AccountMergeResult) -> Result<AccountMergeResult> {
507 match *x {
508 xdr::AccountMergeResult::Success(xdr_balance) => {
509 let balance = Stroops::from_xdr_int64(xdr_balance)?;
510 Ok(AccountMergeResult::Success(balance))
511 }
512 xdr::AccountMergeResult::Malformed => Ok(AccountMergeResult::Malformed),
513 xdr::AccountMergeResult::NoAccount => Ok(AccountMergeResult::NoAccount),
514 xdr::AccountMergeResult::ImmutableSet => Ok(AccountMergeResult::ImmutableSet),
515 xdr::AccountMergeResult::HasSubEntries => Ok(AccountMergeResult::HasSubEntries),
516 xdr::AccountMergeResult::SeqnumTooFar => Ok(AccountMergeResult::SequenceTooFar),
517 xdr::AccountMergeResult::DestFull => Ok(AccountMergeResult::DestinationFull),
518 xdr::AccountMergeResult::IsSponsor => Ok(AccountMergeResult::IsSponsor),
519 }
520 }
521}
522
523impl InflationResult {
524 pub fn from_xdr(x: &xdr::InflationResult) -> Result<InflationResult> {
525 match *x {
526 xdr::InflationResult::Success(ref xdr_payouts) => {
527 let mut payouts = Vec::new();
528 for xdr_payout in xdr_payouts.as_slice() {
529 let payout = InflationPayout::from_xdr(xdr_payout)?;
530 payouts.push(payout);
531 }
532 Ok(InflationResult::Success(payouts))
533 }
534 xdr::InflationResult::NotTime => Ok(InflationResult::NotTime),
535 }
536 }
537}
538
539impl CreateClaimableBalanceResult {
540 pub fn from_xdr(x: &xdr::CreateClaimableBalanceResult) -> Result<CreateClaimableBalanceResult> {
541 match *x {
542 xdr::CreateClaimableBalanceResult::Success(ref xdr_id) => {
543 let id = ClaimableBalanceId::from_xdr(xdr_id)?;
544 Ok(CreateClaimableBalanceResult::Success(id))
545 }
546 xdr::CreateClaimableBalanceResult::Malformed => {
547 Ok(CreateClaimableBalanceResult::Malformed)
548 }
549 xdr::CreateClaimableBalanceResult::LowReserve => {
550 Ok(CreateClaimableBalanceResult::LowReserve)
551 }
552 xdr::CreateClaimableBalanceResult::NoTrust => Ok(CreateClaimableBalanceResult::NoTrust),
553 xdr::CreateClaimableBalanceResult::NotAuthorized => {
554 Ok(CreateClaimableBalanceResult::NotAuthorized)
555 }
556 xdr::CreateClaimableBalanceResult::Underfunded => {
557 Ok(CreateClaimableBalanceResult::Underfunded)
558 }
559 }
560 }
561}
562
563impl PathPaymentStrictReceiveResultSuccess {
564 pub fn from_xdr(
565 x: &xdr::PathPaymentStrictReceiveResultSuccess,
566 ) -> Result<PathPaymentStrictReceiveResultSuccess> {
567 let mut offers = Vec::new();
568 for xdr_offer in x.offers.as_slice() {
569 let offer = ClaimAtom::from_xdr(xdr_offer)?;
570 offers.push(offer);
571 }
572 let last = SimplePaymentResult::from_xdr(&x.last)?;
573 Ok(PathPaymentStrictReceiveResultSuccess { last, offers })
574 }
575}
576
577impl PathPaymentStrictSendResultSuccess {
578 pub fn from_xdr(
579 x: &xdr::PathPaymentStrictSendResultSuccess,
580 ) -> Result<PathPaymentStrictSendResultSuccess> {
581 let mut offers = Vec::new();
582 for xdr_offer in x.offers.as_slice() {
583 let offer = ClaimAtom::from_xdr(xdr_offer)?;
584 offers.push(offer);
585 }
586 let last = SimplePaymentResult::from_xdr(&x.last)?;
587 Ok(PathPaymentStrictSendResultSuccess { last, offers })
588 }
589}
590
591impl ManageOfferResultSuccess {
592 pub fn from_xdr(x: &xdr::ManageOfferSuccessResult) -> Result<ManageOfferResultSuccess> {
593 let mut offers_claimed = Vec::new();
594 for xdr_offer in x.offers_claimed.as_slice() {
595 let offer = ClaimAtom::from_xdr(xdr_offer)?;
596 offers_claimed.push(offer);
597 }
598 let offer = OfferResult::from_xdr(&x.offer)?;
599 Ok(ManageOfferResultSuccess {
600 offers_claimed,
601 offer,
602 })
603 }
604}
605
606impl SimplePaymentResult {
607 pub fn from_xdr(x: &xdr::SimplePaymentResult) -> Result<SimplePaymentResult> {
608 let destination = PublicKey::from_xdr_account_id(&x.destination)?;
609 let asset = Asset::from_xdr(&x.asset)?;
610 let amount = Stroops::from_xdr_int64(x.amount)?;
611 Ok(SimplePaymentResult {
612 destination,
613 asset,
614 amount,
615 })
616 }
617}
618
619impl ClaimAtom {
620 pub fn from_xdr(x: &xdr::ClaimAtom) -> Result<ClaimAtom> {
621 Ok(match *x {
622 xdr::ClaimAtom::V0(ref inner_xdr) => {
623 let inner = ClaimOfferAtom::from_xdr_v0(inner_xdr)?;
624 ClaimAtom::OrderBook(inner)
625 }
626 xdr::ClaimAtom::OrderBook(ref inner_xdr) => {
627 let inner = ClaimOfferAtom::from_xdr(inner_xdr)?;
628 ClaimAtom::OrderBook(inner)
629 }
630 xdr::ClaimAtom::LiquidityPool(ref inner_xdr) => {
631 let inner = ClaimLiquidityAtom::from_xdr(inner_xdr)?;
632 ClaimAtom::LiquidityPool(inner)
633 }
634 })
635 }
636}
637
638impl ClaimOfferAtom {
639 pub fn from_xdr(x: &xdr::ClaimOfferAtom) -> Result<ClaimOfferAtom> {
640 let seller_id = PublicKey::from_xdr_account_id(&x.seller_id)?;
641 let offer_id = x.offer_id;
642 let asset_sold = Asset::from_xdr(&x.asset_sold)?;
643 let amount_sold = Stroops::from_xdr_int64(x.amount_sold)?;
644 let asset_bought = Asset::from_xdr(&x.asset_bought)?;
645 let amount_bought = Stroops::from_xdr_int64(x.amount_bought)?;
646 Ok(ClaimOfferAtom {
647 seller_id,
648 offer_id,
649 asset_sold,
650 amount_sold,
651 asset_bought,
652 amount_bought,
653 })
654 }
655
656 pub fn from_xdr_v0(x: &xdr::ClaimOfferAtomV0) -> Result<ClaimOfferAtom> {
657 let seller_id = PublicKey::from_slice(x.seller_ed25519.as_slice())?;
658 let offer_id = x.offer_id;
659 let asset_sold = Asset::from_xdr(&x.asset_sold)?;
660 let amount_sold = Stroops::from_xdr_int64(x.amount_sold)?;
661 let asset_bought = Asset::from_xdr(&x.asset_bought)?;
662 let amount_bought = Stroops::from_xdr_int64(x.amount_bought)?;
663 Ok(ClaimOfferAtom {
664 seller_id,
665 offer_id,
666 asset_sold,
667 amount_sold,
668 asset_bought,
669 amount_bought,
670 })
671 }
672}
673
674impl ClaimLiquidityAtom {
675 pub fn from_xdr(x: &xdr::ClaimLiquidityAtom) -> Result<ClaimLiquidityAtom> {
676 let pool_id = x.liquidity_pool_id.0 .0.to_vec();
677 let asset_sold = Asset::from_xdr(&x.asset_sold)?;
678 let amount_sold = Stroops::from_xdr_int64(x.amount_sold)?;
679 let asset_bought = Asset::from_xdr(&x.asset_bought)?;
680 let amount_bought = Stroops::from_xdr_int64(x.amount_bought)?;
681 Ok(ClaimLiquidityAtom {
682 pool_id,
683 asset_sold,
684 amount_sold,
685 asset_bought,
686 amount_bought,
687 })
688 }
689}
690
691impl OfferResult {
692 pub fn from_xdr(x: &xdr::ManageOfferSuccessResultOffer) -> Result<OfferResult> {
693 match *x {
694 xdr::ManageOfferSuccessResultOffer::Created(ref xdr_inner) => {
695 let inner = OfferEntry::from_xdr(xdr_inner)?;
696 Ok(OfferResult::Created(inner))
697 }
698 xdr::ManageOfferSuccessResultOffer::Updated(ref xdr_inner) => {
699 let inner = OfferEntry::from_xdr(xdr_inner)?;
700 Ok(OfferResult::Updated(inner))
701 }
702 xdr::ManageOfferSuccessResultOffer::Deleted => Ok(OfferResult::Deleted),
703 }
704 }
705}
706
707impl OfferEntry {
708 pub fn from_xdr(x: &xdr::OfferEntry) -> Result<OfferEntry> {
709 let seller_id = PublicKey::from_xdr_account_id(&x.seller_id)?;
710 let offer_id = x.offer_id;
711 let selling = Asset::from_xdr(&x.selling)?;
712 let buying = Asset::from_xdr(&x.buying)?;
713 let amount = Stroops::from_xdr_int64(x.amount)?;
714 let price = Price::from_xdr(&x.price)?;
715 let flags = x.flags;
716 Ok(OfferEntry {
717 seller_id,
718 offer_id,
719 selling,
720 buying,
721 amount,
722 price,
723 flags,
724 })
725 }
726}
727
728impl InflationPayout {
729 pub fn from_xdr(x: &xdr::InflationPayout) -> Result<InflationPayout> {
730 let destination = PublicKey::from_xdr_account_id(&x.destination)?;
731 let amount = Stroops::from_xdr_int64(x.amount)?;
732 Ok(InflationPayout {
733 destination,
734 amount,
735 })
736 }
737}
738
739#[cfg(test)]
740mod tests {
741 use super::*;
742 use crate::{transaction_result::TransactionResult, xdr::XDRDeserialize as _};
743
744 macro_rules! impl_inner_op_result_test {
745 ($test_name:ident, $xdr_str:tt, $expected_res:pat) => {
746 #[test]
747 fn $test_name() {
748 let xdr = $xdr_str;
749 let result = TransactionResult::from_xdr_base64(&xdr)
750 .unwrap()
751 .as_failed()
752 .unwrap()
753 .clone();
754 assert_eq!(result.results.len(), 1);
755 match result.results[0] {
756 OperationResult::Inner(ref inner) => match inner {
757 $expected_res => {}
758 _ => panic!("expected {:?}", stringify!($expected_res)),
759 },
760 _ => panic!("expected OperationResult::Inner"),
761 }
762 }
763 };
764 }
765
766 #[test]
767 fn test_bad_auth() {
768 let xdr = "AAAAAACYloD/////AAAAAf////8AAAAA";
769 let result = TransactionResult::from_xdr_base64(xdr)
770 .unwrap()
771 .as_failed()
772 .unwrap()
773 .clone();
774 assert_eq!(result.results.len(), 1);
775 match result.results[0] {
776 OperationResult::BadAuth => {}
777 _ => panic!("expected OperationResult::BadAuth"),
778 }
779 }
780
781 #[test]
782 fn test_no_account() {
783 let xdr = "AAAAAACYloD/////AAAAAf////4AAAAA";
784 let result = TransactionResult::from_xdr_base64(xdr)
785 .unwrap()
786 .as_failed()
787 .unwrap()
788 .clone();
789 assert_eq!(result.results.len(), 1);
790 match result.results[0] {
791 OperationResult::NoAccount => {}
792 _ => panic!("expected OperationResult::NoAccount"),
793 }
794 }
795
796 #[test]
797 fn test_not_supported() {
798 let xdr = "AAAAAACYloD/////AAAAAf////0AAAAA";
799 let result = TransactionResult::from_xdr_base64(xdr)
800 .unwrap()
801 .as_failed()
802 .unwrap()
803 .clone();
804 assert_eq!(result.results.len(), 1);
805 match result.results[0] {
806 OperationResult::NotSupported => {}
807 _ => panic!("expected OperationResult::NotSupported"),
808 }
809 }
810
811 #[test]
812 fn test_too_many_subentries() {
813 let xdr = "AAAAAAAAA+j/////AAAAAf////wAAAAA";
814 let result = TransactionResult::from_xdr_base64(xdr)
815 .unwrap()
816 .as_failed()
817 .unwrap()
818 .clone();
819 assert_eq!(result.results.len(), 1);
820 match result.results[0] {
821 OperationResult::TooManySubentries => {}
822 _ => panic!("expected OperationResult::TooManySubentries"),
823 }
824 }
825
826 #[test]
827 fn test_exceeded_work_limit() {
828 let xdr = "AAAAAAAAA+j/////AAAAAf////sAAAAA";
829 let result = TransactionResult::from_xdr_base64(xdr)
830 .unwrap()
831 .as_failed()
832 .unwrap()
833 .clone();
834 assert_eq!(result.results.len(), 1);
835 match result.results[0] {
836 OperationResult::ExceededWorkLimit => {}
837 _ => panic!("expected OperationResult::ExceededWorkLimit"),
838 }
839 }
840
841 #[test]
842 fn test_too_many_sponsoring() {
843 let xdr = "AAAAAAAAA+j/////AAAAAf////oAAAAA";
844 let result = TransactionResult::from_xdr_base64(xdr)
845 .unwrap()
846 .as_failed()
847 .unwrap()
848 .clone();
849 assert_eq!(result.results.len(), 1);
850 match result.results[0] {
851 OperationResult::TooManySponsoring => {}
852 _ => panic!("expected OperationResult::TooManySponsoring"),
853 }
854 }
855
856 impl_inner_op_result_test!(
861 test_create_account_success,
862 "AAAAAACYloD/////AAAAAQAAAAAAAAAAAAAAAAAAAAA=",
863 InnerOperationResult::CreateAccount(CreateAccountResult::Success)
864 );
865
866 impl_inner_op_result_test!(
867 test_create_account_malformed,
868 "AAAAAACYloD/////AAAAAQAAAAAAAAAA/////wAAAAA=",
869 InnerOperationResult::CreateAccount(CreateAccountResult::Malformed)
870 );
871
872 impl_inner_op_result_test!(
873 test_create_account_underfunded,
874 "AAAAAACYloD/////AAAAAQAAAAAAAAAA/////gAAAAA=",
875 InnerOperationResult::CreateAccount(CreateAccountResult::Underfunded)
876 );
877
878 impl_inner_op_result_test!(
879 test_create_account_low_reserve,
880 "AAAAAACYloD/////AAAAAQAAAAAAAAAA/////QAAAAA=",
881 InnerOperationResult::CreateAccount(CreateAccountResult::LowReserve)
882 );
883
884 impl_inner_op_result_test!(
885 test_create_account_already_exist,
886 "AAAAAACYloD/////AAAAAQAAAAAAAAAA/////AAAAAA=",
887 InnerOperationResult::CreateAccount(CreateAccountResult::AlreadyExist)
888 );
889
890 impl_inner_op_result_test!(
895 test_payment_success,
896 "AAAAAACYloD/////AAAAAQAAAAAAAAABAAAAAAAAAAA=",
897 InnerOperationResult::Payment(PaymentResult::Success)
898 );
899
900 impl_inner_op_result_test!(
901 test_payment_malformed,
902 "AAAAAACYloD/////AAAAAQAAAAAAAAAB/////wAAAAA=",
903 InnerOperationResult::Payment(PaymentResult::Malformed)
904 );
905
906 impl_inner_op_result_test!(
907 test_payment_underfunded,
908 "AAAAAACYloD/////AAAAAQAAAAAAAAAB/////gAAAAA=",
909 InnerOperationResult::Payment(PaymentResult::Underfunded)
910 );
911
912 impl_inner_op_result_test!(
913 test_payment_source_no_trust,
914 "AAAAAACYloD/////AAAAAQAAAAAAAAAB/////QAAAAA=",
915 InnerOperationResult::Payment(PaymentResult::SrcNoTrust)
916 );
917
918 impl_inner_op_result_test!(
919 test_payment_source_not_authorized,
920 "AAAAAACYloD/////AAAAAQAAAAAAAAAB/////AAAAAA=",
921 InnerOperationResult::Payment(PaymentResult::SrcNotAuthorized)
922 );
923
924 impl_inner_op_result_test!(
925 test_payment_no_destination,
926 "AAAAAACYloD/////AAAAAQAAAAAAAAAB////+wAAAAA=",
927 InnerOperationResult::Payment(PaymentResult::NoDestination)
928 );
929
930 impl_inner_op_result_test!(
931 test_payment_no_trust,
932 "AAAAAACYloD/////AAAAAQAAAAAAAAAB////+gAAAAA=",
933 InnerOperationResult::Payment(PaymentResult::NoTrust)
934 );
935
936 impl_inner_op_result_test!(
937 test_payment_not_authorized,
938 "AAAAAACYloD/////AAAAAQAAAAAAAAAB////+QAAAAA=",
939 InnerOperationResult::Payment(PaymentResult::NotAuthorized)
940 );
941
942 impl_inner_op_result_test!(
943 test_payment_line_full,
944 "AAAAAACYloD/////AAAAAQAAAAAAAAAB////+AAAAAA=",
945 InnerOperationResult::Payment(PaymentResult::LineFull)
946 );
947
948 impl_inner_op_result_test!(
949 test_payment_no_issuer,
950 "AAAAAACYloD/////AAAAAQAAAAAAAAAB////9wAAAAA=",
951 InnerOperationResult::Payment(PaymentResult::NoIssuer)
952 );
953
954 impl_inner_op_result_test!(
959 test_path_payment_strict_receive_success,
960 "AAAAAACYloD/////AAAAAQAAAAAAAAACAAAAAAAAAAEAAAAAKoNGsl81xj8D8XyekzKZXRuSU2KImhHkQj4QWhroY64AAAAAAAAE0gAAAAAAAAAAAJiWgAAAAAFVU0QAAAAAACqDRrJfNcY/A/F8npMymV0bklNiiJoR5EI+EFoa6GOuAAAAAAADDUAAAAAAAyzXIcEd0vK9XlVfmjyQE9QpJjOLzYUN5orR0N+Dz+QAAAABVVNEAAAAAAAqg0ayXzXGPwPxfJ6TMpldG5JTYoiaEeRCPhBaGuhjrgAAAAAAAw1AAAAAAA==",
961 InnerOperationResult::PathPaymentStrictReceive(PathPaymentStrictReceiveResult::Success(_))
962 );
963
964 impl_inner_op_result_test!(
965 test_path_payment_strict_receive_no_issuer,
966 "AAAAAACYloD/////AAAAAQAAAAAAAAAC////9wAAAAFVU0QAAAAAACqDRrJfNcY/A/F8npMymV0bklNiiJoR5EI+EFoa6GOuAAAAAA==",
967 InnerOperationResult::PathPaymentStrictReceive(PathPaymentStrictReceiveResult::NoIssuer(_))
968 );
969
970 impl_inner_op_result_test!(
971 test_path_payment_strict_receive_malformed,
972 "AAAAAACYloD/////AAAAAQAAAAAAAAAC/////wAAAAA=",
973 InnerOperationResult::PathPaymentStrictReceive(PathPaymentStrictReceiveResult::Malformed)
974 );
975
976 impl_inner_op_result_test!(
977 test_path_payment_strict_receive_underfunded,
978 "AAAAAACYloD/////AAAAAQAAAAAAAAAC/////gAAAAA=",
979 InnerOperationResult::PathPaymentStrictReceive(PathPaymentStrictReceiveResult::Underfunded)
980 );
981
982 impl_inner_op_result_test!(
983 test_path_payment_strict_receive_source_no_trust,
984 "AAAAAACYloD/////AAAAAQAAAAAAAAAC/////QAAAAA=",
985 InnerOperationResult::PathPaymentStrictReceive(
986 PathPaymentStrictReceiveResult::SourceNoTrust
987 )
988 );
989
990 impl_inner_op_result_test!(
991 test_path_payment_strict_receive_source_not_authorized,
992 "AAAAAACYloD/////AAAAAQAAAAAAAAAC/////AAAAAA=",
993 InnerOperationResult::PathPaymentStrictReceive(
994 PathPaymentStrictReceiveResult::SourceNotAuthorized
995 )
996 );
997
998 impl_inner_op_result_test!(
999 test_path_payment_strict_receive_no_destination,
1000 "AAAAAACYloD/////AAAAAQAAAAAAAAAC////+wAAAAA=",
1001 InnerOperationResult::PathPaymentStrictReceive(
1002 PathPaymentStrictReceiveResult::NoDestination
1003 )
1004 );
1005
1006 impl_inner_op_result_test!(
1007 test_path_payment_strict_receive_no_trust,
1008 "AAAAAACYloD/////AAAAAQAAAAAAAAAC////+gAAAAA=",
1009 InnerOperationResult::PathPaymentStrictReceive(PathPaymentStrictReceiveResult::NoTrust)
1010 );
1011
1012 impl_inner_op_result_test!(
1013 test_path_payment_strict_receive_not_authorized,
1014 "AAAAAACYloD/////AAAAAQAAAAAAAAAC////+QAAAAA=",
1015 InnerOperationResult::PathPaymentStrictReceive(
1016 PathPaymentStrictReceiveResult::NotAuthorized
1017 )
1018 );
1019
1020 impl_inner_op_result_test!(
1021 test_path_payment_strict_receive_line_full,
1022 "AAAAAACYloD/////AAAAAQAAAAAAAAAC////+AAAAAA=",
1023 InnerOperationResult::PathPaymentStrictReceive(PathPaymentStrictReceiveResult::LineFull)
1024 );
1025
1026 impl_inner_op_result_test!(
1027 test_path_payment_strict_receive_too_few_offers,
1028 "AAAAAACYloD/////AAAAAQAAAAAAAAAC////9gAAAAA=",
1029 InnerOperationResult::PathPaymentStrictReceive(
1030 PathPaymentStrictReceiveResult::TooFewOffers
1031 )
1032 );
1033
1034 impl_inner_op_result_test!(
1035 test_path_payment_strict_receive_offer_cross_self,
1036 "AAAAAACYloD/////AAAAAQAAAAAAAAAC////9QAAAAA=",
1037 InnerOperationResult::PathPaymentStrictReceive(
1038 PathPaymentStrictReceiveResult::OfferCrossSelf
1039 )
1040 );
1041
1042 impl_inner_op_result_test!(
1043 test_path_payment_strict_receive_over_send_max,
1044 "AAAAAACYloD/////AAAAAQAAAAAAAAAC////9AAAAAA=",
1045 InnerOperationResult::PathPaymentStrictReceive(PathPaymentStrictReceiveResult::OverSendMax)
1046 );
1047
1048 impl_inner_op_result_test!(
1053 test_path_payment_strict_send_success,
1054 "AAAAAACYloD/////AAAAAQAAAAAAAAANAAAAAAAAAAEAAAAAKoNGsl81xj8D8XyekzKZXRuSU2KImhHkQj4QWhroY64AAAAAAAAE0gAAAAAAAAAAAJiWgAAAAAFVU0QAAAAAACqDRrJfNcY/A/F8npMymV0bklNiiJoR5EI+EFoa6GOuAAAAAAADDUAAAAAAAyzXIcEd0vK9XlVfmjyQE9QpJjOLzYUN5orR0N+Dz+QAAAABVVNEAAAAAAAqg0ayXzXGPwPxfJ6TMpldG5JTYoiaEeRCPhBaGuhjrgAAAAAAAw1AAAAAAA==",
1055 InnerOperationResult::PathPaymentStrictSend(PathPaymentStrictSendResult::Success(_))
1056 );
1057
1058 impl_inner_op_result_test!(
1059 test_path_payment_strict_send_no_issuer,
1060 "AAAAAACYloD/////AAAAAQAAAAAAAAAN////9wAAAAFVU0QAAAAAACqDRrJfNcY/A/F8npMymV0bklNiiJoR5EI+EFoa6GOuAAAAAA==",
1061 InnerOperationResult::PathPaymentStrictSend(PathPaymentStrictSendResult::NoIssuer(_))
1062 );
1063
1064 impl_inner_op_result_test!(
1065 test_path_payment_strict_send_malformed,
1066 "AAAAAACYloD/////AAAAAQAAAAAAAAAN/////wAAAAA=",
1067 InnerOperationResult::PathPaymentStrictSend(PathPaymentStrictSendResult::Malformed)
1068 );
1069
1070 impl_inner_op_result_test!(
1071 test_path_payment_strict_send_underfunded,
1072 "AAAAAACYloD/////AAAAAQAAAAAAAAAN/////gAAAAA=",
1073 InnerOperationResult::PathPaymentStrictSend(PathPaymentStrictSendResult::Underfunded)
1074 );
1075
1076 impl_inner_op_result_test!(
1077 test_path_payment_strict_send_source_no_trust,
1078 "AAAAAACYloD/////AAAAAQAAAAAAAAAN/////QAAAAA=",
1079 InnerOperationResult::PathPaymentStrictSend(PathPaymentStrictSendResult::SourceNoTrust)
1080 );
1081
1082 impl_inner_op_result_test!(
1083 test_path_payment_strict_send_source_not_authorized,
1084 "AAAAAACYloD/////AAAAAQAAAAAAAAAN/////AAAAAA=",
1085 InnerOperationResult::PathPaymentStrictSend(
1086 PathPaymentStrictSendResult::SourceNotAuthorized
1087 )
1088 );
1089
1090 impl_inner_op_result_test!(
1091 test_path_payment_strict_send_no_destination,
1092 "AAAAAACYloD/////AAAAAQAAAAAAAAAN////+wAAAAA=",
1093 InnerOperationResult::PathPaymentStrictSend(PathPaymentStrictSendResult::NoDestination)
1094 );
1095
1096 impl_inner_op_result_test!(
1097 test_path_payment_strict_send_no_trust,
1098 "AAAAAACYloD/////AAAAAQAAAAAAAAAN////+gAAAAA=",
1099 InnerOperationResult::PathPaymentStrictSend(PathPaymentStrictSendResult::NoTrust)
1100 );
1101
1102 impl_inner_op_result_test!(
1103 test_path_payment_strict_send_not_authorized,
1104 "AAAAAACYloD/////AAAAAQAAAAAAAAAN////+QAAAAA=",
1105 InnerOperationResult::PathPaymentStrictSend(PathPaymentStrictSendResult::NotAuthorized)
1106 );
1107
1108 impl_inner_op_result_test!(
1109 test_path_payment_strict_send_line_full,
1110 "AAAAAACYloD/////AAAAAQAAAAAAAAAN////+AAAAAA=",
1111 InnerOperationResult::PathPaymentStrictSend(PathPaymentStrictSendResult::LineFull)
1112 );
1113
1114 impl_inner_op_result_test!(
1115 test_path_payment_strict_send_too_few_offers,
1116 "AAAAAACYloD/////AAAAAQAAAAAAAAAN////9gAAAAA=",
1117 InnerOperationResult::PathPaymentStrictSend(PathPaymentStrictSendResult::TooFewOffers)
1118 );
1119
1120 impl_inner_op_result_test!(
1121 test_path_payment_strict_send_offer_cross_self,
1122 "AAAAAACYloD/////AAAAAQAAAAAAAAAN////9QAAAAA=",
1123 InnerOperationResult::PathPaymentStrictSend(PathPaymentStrictSendResult::OfferCrossSelf)
1124 );
1125
1126 impl_inner_op_result_test!(
1127 test_path_payment_strict_send_under_destination_min,
1128 "AAAAAACYloD/////AAAAAQAAAAAAAAAN////9AAAAAA=",
1129 InnerOperationResult::PathPaymentStrictSend(
1130 PathPaymentStrictSendResult::UnderDestinationMin
1131 )
1132 );
1133
1134 impl_inner_op_result_test!(
1139 test_manage_sell_offer_success_created,
1140 "AAAAAACYloD/////AAAAAQAAAAAAAAADAAAAAAAAAAEAAAAAKoNGsl81xj8D8XyekzKZXRuSU2KImhHkQj4QWhroY64AAAAAAAAE0gAAAAAAAAAAAJiWgAAAAAFVU0QAAAAAACqDRrJfNcY/A/F8npMymV0bklNiiJoR5EI+EFoa6GOuAAAAAAADDUAAAAAAAAAAACqDRrJfNcY/A/F8npMymV0bklNiiJoR5EI+EFoa6GOuAAAAAAAABNIAAAAAAAAAAVVTRAAAAAAAKoNGsl81xj8D8XyekzKZXRuSU2KImhHkQj4QWhroY64AAAAAAJiWgAAAA+gAABEYAAAAAQAAAAAAAAAA",
1141 InnerOperationResult::ManageSellOffer(ManageSellOfferResult::Success(
1142 ManageOfferResultSuccess { offer: OfferResult::Created(_), .. })
1143 )
1144 );
1145
1146 impl_inner_op_result_test!(
1147 test_manage_sell_offer_success_updated,
1148 "AAAAAACYloD/////AAAAAQAAAAAAAAADAAAAAAAAAAEAAAAAKoNGsl81xj8D8XyekzKZXRuSU2KImhHkQj4QWhroY64AAAAAAAAE0gAAAAAAAAAAAJiWgAAAAAFVU0QAAAAAACqDRrJfNcY/A/F8npMymV0bklNiiJoR5EI+EFoa6GOuAAAAAAADDUAAAAABAAAAACqDRrJfNcY/A/F8npMymV0bklNiiJoR5EI+EFoa6GOuAAAAAAAABNIAAAAAAAAAAVVTRAAAAAAAKoNGsl81xj8D8XyekzKZXRuSU2KImhHkQj4QWhroY64AAAAAAJiWgAAAA+gAABEYAAAAAQAAAAAAAAAA",
1149 InnerOperationResult::ManageSellOffer(ManageSellOfferResult::Success(
1150 ManageOfferResultSuccess { offer: OfferResult::Updated(_), .. })
1151 )
1152 );
1153
1154 impl_inner_op_result_test!(
1155 test_manage_sell_offer_success_deleted,
1156 "AAAAAACYloD/////AAAAAQAAAAAAAAADAAAAAAAAAAEAAAAAKoNGsl81xj8D8XyekzKZXRuSU2KImhHkQj4QWhroY64AAAAAAAAE0gAAAAAAAAAAAJiWgAAAAAFVU0QAAAAAACqDRrJfNcY/A/F8npMymV0bklNiiJoR5EI+EFoa6GOuAAAAAAADDUAAAAACAAAAAA==",
1157 InnerOperationResult::ManageSellOffer(ManageSellOfferResult::Success(
1158 ManageOfferResultSuccess { offer: OfferResult::Deleted, .. })
1159 )
1160 );
1161
1162 impl_inner_op_result_test!(
1163 test_manage_sell_offer_malformed,
1164 "AAAAAACYloD/////AAAAAQAAAAAAAAAD/////wAAAAA=",
1165 InnerOperationResult::ManageSellOffer(ManageSellOfferResult::Malformed)
1166 );
1167
1168 impl_inner_op_result_test!(
1169 test_manage_sell_offer_sell_no_trust,
1170 "AAAAAACYloD/////AAAAAQAAAAAAAAAD/////gAAAAA=",
1171 InnerOperationResult::ManageSellOffer(ManageSellOfferResult::SellNoTrust)
1172 );
1173
1174 impl_inner_op_result_test!(
1175 test_manage_sell_offer_buy_no_trust,
1176 "AAAAAACYloD/////AAAAAQAAAAAAAAAD/////QAAAAA=",
1177 InnerOperationResult::ManageSellOffer(ManageSellOfferResult::BuyNoTrust)
1178 );
1179
1180 impl_inner_op_result_test!(
1181 test_manage_sell_offer_sell_not_authorized,
1182 "AAAAAACYloD/////AAAAAQAAAAAAAAAD/////AAAAAA=",
1183 InnerOperationResult::ManageSellOffer(ManageSellOfferResult::SellNotAuthorized)
1184 );
1185
1186 impl_inner_op_result_test!(
1187 test_manage_sell_offer_buy_not_authorized,
1188 "AAAAAACYloD/////AAAAAQAAAAAAAAAD////+wAAAAA=",
1189 InnerOperationResult::ManageSellOffer(ManageSellOfferResult::BuyNotAuthorized)
1190 );
1191
1192 impl_inner_op_result_test!(
1193 test_manage_sell_offer_line_full,
1194 "AAAAAACYloD/////AAAAAQAAAAAAAAAD////+gAAAAA=",
1195 InnerOperationResult::ManageSellOffer(ManageSellOfferResult::LineFull)
1196 );
1197
1198 impl_inner_op_result_test!(
1199 test_manage_sell_offer_underfunded,
1200 "AAAAAACYloD/////AAAAAQAAAAAAAAAD////+QAAAAA=",
1201 InnerOperationResult::ManageSellOffer(ManageSellOfferResult::Underfunded)
1202 );
1203
1204 impl_inner_op_result_test!(
1205 test_manage_sell_offer_cross_self,
1206 "AAAAAACYloD/////AAAAAQAAAAAAAAAD////+AAAAAA=",
1207 InnerOperationResult::ManageSellOffer(ManageSellOfferResult::CrossSelf)
1208 );
1209
1210 impl_inner_op_result_test!(
1211 test_manage_sell_offer_sell_no_issuer,
1212 "AAAAAACYloD/////AAAAAQAAAAAAAAAD////9wAAAAA=",
1213 InnerOperationResult::ManageSellOffer(ManageSellOfferResult::SellNoIssuer)
1214 );
1215
1216 impl_inner_op_result_test!(
1217 test_manage_sell_offer_buy_no_issuer,
1218 "AAAAAACYloD/////AAAAAQAAAAAAAAAD////9gAAAAA=",
1219 InnerOperationResult::ManageSellOffer(ManageSellOfferResult::BuyNoIssuer)
1220 );
1221
1222 impl_inner_op_result_test!(
1223 test_manage_sell_offer_not_found,
1224 "AAAAAACYloD/////AAAAAQAAAAAAAAAD////9QAAAAA=",
1225 InnerOperationResult::ManageSellOffer(ManageSellOfferResult::NotFound)
1226 );
1227
1228 impl_inner_op_result_test!(
1229 test_manage_sell_offer_low_reserve,
1230 "AAAAAACYloD/////AAAAAQAAAAAAAAAD////9AAAAAA=",
1231 InnerOperationResult::ManageSellOffer(ManageSellOfferResult::LowReserve)
1232 );
1233
1234 impl_inner_op_result_test!(
1239 test_manage_buy_offer_success_created,
1240 "AAAAAACYloD/////AAAAAQAAAAAAAAAMAAAAAAAAAAEAAAAAKoNGsl81xj8D8XyekzKZXRuSU2KImhHkQj4QWhroY64AAAAAAAAE0gAAAAAAAAAAAJiWgAAAAAFVU0QAAAAAACqDRrJfNcY/A/F8npMymV0bklNiiJoR5EI+EFoa6GOuAAAAAAADDUAAAAAAAAAAACqDRrJfNcY/A/F8npMymV0bklNiiJoR5EI+EFoa6GOuAAAAAAAABNIAAAAAAAAAAVVTRAAAAAAAKoNGsl81xj8D8XyekzKZXRuSU2KImhHkQj4QWhroY64AAAAAAJiWgAAAA+gAABEYAAAAAQAAAAAAAAAA",
1241 InnerOperationResult::ManageBuyOffer(ManageBuyOfferResult::Success(
1242 ManageOfferResultSuccess { offer: OfferResult::Created(_), .. })
1243 )
1244 );
1245
1246 impl_inner_op_result_test!(
1247 test_manage_buy_offer_success_updated,
1248 "AAAAAACYloD/////AAAAAQAAAAAAAAAMAAAAAAAAAAEAAAAAKoNGsl81xj8D8XyekzKZXRuSU2KImhHkQj4QWhroY64AAAAAAAAE0gAAAAAAAAAAAJiWgAAAAAFVU0QAAAAAACqDRrJfNcY/A/F8npMymV0bklNiiJoR5EI+EFoa6GOuAAAAAAADDUAAAAABAAAAACqDRrJfNcY/A/F8npMymV0bklNiiJoR5EI+EFoa6GOuAAAAAAAABNIAAAAAAAAAAVVTRAAAAAAAKoNGsl81xj8D8XyekzKZXRuSU2KImhHkQj4QWhroY64AAAAAAJiWgAAAA+gAABEYAAAAAQAAAAAAAAAA",
1249 InnerOperationResult::ManageBuyOffer(ManageBuyOfferResult::Success(
1250 ManageOfferResultSuccess { offer: OfferResult::Updated(_), .. })
1251 )
1252 );
1253
1254 impl_inner_op_result_test!(
1255 test_manage_buy_offer_success_deleted,
1256 "AAAAAACYloD/////AAAAAQAAAAAAAAAMAAAAAAAAAAEAAAAAKoNGsl81xj8D8XyekzKZXRuSU2KImhHkQj4QWhroY64AAAAAAAAE0gAAAAAAAAAAAJiWgAAAAAFVU0QAAAAAACqDRrJfNcY/A/F8npMymV0bklNiiJoR5EI+EFoa6GOuAAAAAAADDUAAAAACAAAAAA==",
1257 InnerOperationResult::ManageBuyOffer(ManageBuyOfferResult::Success(
1258 ManageOfferResultSuccess { offer: OfferResult::Deleted, .. })
1259 )
1260 );
1261
1262 impl_inner_op_result_test!(
1263 test_manage_buy_offer_malformed,
1264 "AAAAAACYloD/////AAAAAQAAAAAAAAAM/////wAAAAA=",
1265 InnerOperationResult::ManageBuyOffer(ManageBuyOfferResult::Malformed)
1266 );
1267
1268 impl_inner_op_result_test!(
1269 test_manage_buy_offer_sell_no_trust,
1270 "AAAAAACYloD/////AAAAAQAAAAAAAAAM/////gAAAAA=",
1271 InnerOperationResult::ManageBuyOffer(ManageBuyOfferResult::SellNoTrust)
1272 );
1273
1274 impl_inner_op_result_test!(
1275 test_manage_buy_offer_buy_no_trust,
1276 "AAAAAACYloD/////AAAAAQAAAAAAAAAM/////QAAAAA=",
1277 InnerOperationResult::ManageBuyOffer(ManageBuyOfferResult::BuyNoTrust)
1278 );
1279
1280 impl_inner_op_result_test!(
1281 test_manage_buy_offer_sell_not_authorized,
1282 "AAAAAACYloD/////AAAAAQAAAAAAAAAM/////AAAAAA=",
1283 InnerOperationResult::ManageBuyOffer(ManageBuyOfferResult::SellNotAuthorized)
1284 );
1285
1286 impl_inner_op_result_test!(
1287 test_manage_buy_offer_buy_not_authorized,
1288 "AAAAAACYloD/////AAAAAQAAAAAAAAAM////+wAAAAA=",
1289 InnerOperationResult::ManageBuyOffer(ManageBuyOfferResult::BuyNotAuthorized)
1290 );
1291
1292 impl_inner_op_result_test!(
1293 test_manage_buy_offer_line_full,
1294 "AAAAAACYloD/////AAAAAQAAAAAAAAAM////+gAAAAA=",
1295 InnerOperationResult::ManageBuyOffer(ManageBuyOfferResult::LineFull)
1296 );
1297
1298 impl_inner_op_result_test!(
1299 test_manage_buy_offer_underfunded,
1300 "AAAAAACYloD/////AAAAAQAAAAAAAAAM////+QAAAAA=",
1301 InnerOperationResult::ManageBuyOffer(ManageBuyOfferResult::Underfunded)
1302 );
1303
1304 impl_inner_op_result_test!(
1305 test_manage_buy_offer_cross_self,
1306 "AAAAAACYloD/////AAAAAQAAAAAAAAAM////+AAAAAA=",
1307 InnerOperationResult::ManageBuyOffer(ManageBuyOfferResult::CrossSelf)
1308 );
1309
1310 impl_inner_op_result_test!(
1311 test_manage_buy_offer_sell_no_issuer,
1312 "AAAAAACYloD/////AAAAAQAAAAAAAAAM////9wAAAAA=",
1313 InnerOperationResult::ManageBuyOffer(ManageBuyOfferResult::SellNoIssuer)
1314 );
1315
1316 impl_inner_op_result_test!(
1317 test_manage_buy_offer_buy_no_issuer,
1318 "AAAAAACYloD/////AAAAAQAAAAAAAAAM////9gAAAAA=",
1319 InnerOperationResult::ManageBuyOffer(ManageBuyOfferResult::BuyNoIssuer)
1320 );
1321
1322 impl_inner_op_result_test!(
1323 test_manage_buy_offer_not_found,
1324 "AAAAAACYloD/////AAAAAQAAAAAAAAAM////9QAAAAA=",
1325 InnerOperationResult::ManageBuyOffer(ManageBuyOfferResult::NotFound)
1326 );
1327
1328 impl_inner_op_result_test!(
1329 test_manage_buy_offer_low_reserve,
1330 "AAAAAACYloD/////AAAAAQAAAAAAAAAM////9AAAAAA=",
1331 InnerOperationResult::ManageBuyOffer(ManageBuyOfferResult::LowReserve)
1332 );
1333
1334 impl_inner_op_result_test!(
1341 test_create_passive_sell_offer_success_created,
1342 "AAAAAACYloD/////AAAAAQAAAAAAAAAEAAAAAAAAAAEAAAAAKoNGsl81xj8D8XyekzKZXRuSU2KImhHkQj4QWhroY64AAAAAAAAE0gAAAAAAAAAAAJiWgAAAAAFVU0QAAAAAACqDRrJfNcY/A/F8npMymV0bklNiiJoR5EI+EFoa6GOuAAAAAAADDUAAAAAAAAAAACqDRrJfNcY/A/F8npMymV0bklNiiJoR5EI+EFoa6GOuAAAAAAAABNIAAAAAAAAAAVVTRAAAAAAAKoNGsl81xj8D8XyekzKZXRuSU2KImhHkQj4QWhroY64AAAAAAJiWgAAAA+gAABEYAAAAAQAAAAAAAAAA",
1343 InnerOperationResult::CreatePassiveSellOffer(ManageSellOfferResult::Success(
1344 ManageOfferResultSuccess { offer: OfferResult::Created(_), .. })
1345 )
1346 );
1347
1348 impl_inner_op_result_test!(
1349 test_create_passive_sell_offer_success_updated,
1350 "AAAAAACYloD/////AAAAAQAAAAAAAAAEAAAAAAAAAAEAAAAAKoNGsl81xj8D8XyekzKZXRuSU2KImhHkQj4QWhroY64AAAAAAAAE0gAAAAAAAAAAAJiWgAAAAAFVU0QAAAAAACqDRrJfNcY/A/F8npMymV0bklNiiJoR5EI+EFoa6GOuAAAAAAADDUAAAAABAAAAACqDRrJfNcY/A/F8npMymV0bklNiiJoR5EI+EFoa6GOuAAAAAAAABNIAAAAAAAAAAVVTRAAAAAAAKoNGsl81xj8D8XyekzKZXRuSU2KImhHkQj4QWhroY64AAAAAAJiWgAAAA+gAABEYAAAAAQAAAAAAAAAA",
1351 InnerOperationResult::CreatePassiveSellOffer(ManageSellOfferResult::Success(
1352 ManageOfferResultSuccess { offer: OfferResult::Updated(_), .. })
1353 )
1354 );
1355
1356 impl_inner_op_result_test!(
1357 test_create_passive_sell_offer_success_deleted,
1358 "AAAAAACYloD/////AAAAAQAAAAAAAAAEAAAAAAAAAAEAAAAAKoNGsl81xj8D8XyekzKZXRuSU2KImhHkQj4QWhroY64AAAAAAAAE0gAAAAAAAAAAAJiWgAAAAAFVU0QAAAAAACqDRrJfNcY/A/F8npMymV0bklNiiJoR5EI+EFoa6GOuAAAAAAADDUAAAAACAAAAAA==",
1359 InnerOperationResult::CreatePassiveSellOffer(ManageSellOfferResult::Success(
1360 ManageOfferResultSuccess { offer: OfferResult::Deleted, .. })
1361 )
1362 );
1363
1364 impl_inner_op_result_test!(
1365 test_create_passive_sell_offer_malformed,
1366 "AAAAAACYloD/////AAAAAQAAAAAAAAAE/////wAAAAA=",
1367 InnerOperationResult::CreatePassiveSellOffer(ManageSellOfferResult::Malformed)
1368 );
1369
1370 impl_inner_op_result_test!(
1371 test_create_passive_sell_offer_sell_no_trust,
1372 "AAAAAACYloD/////AAAAAQAAAAAAAAAE/////gAAAAA=",
1373 InnerOperationResult::CreatePassiveSellOffer(ManageSellOfferResult::SellNoTrust)
1374 );
1375
1376 impl_inner_op_result_test!(
1377 test_create_passive_sell_offer_buy_no_trust,
1378 "AAAAAACYloD/////AAAAAQAAAAAAAAAE/////QAAAAA=",
1379 InnerOperationResult::CreatePassiveSellOffer(ManageSellOfferResult::BuyNoTrust)
1380 );
1381
1382 impl_inner_op_result_test!(
1383 test_create_passive_sell_offer_sell_not_authorized,
1384 "AAAAAACYloD/////AAAAAQAAAAAAAAAE/////AAAAAA=",
1385 InnerOperationResult::CreatePassiveSellOffer(ManageSellOfferResult::SellNotAuthorized)
1386 );
1387
1388 impl_inner_op_result_test!(
1389 test_create_passive_sell_offer_buy_not_authorized,
1390 "AAAAAACYloD/////AAAAAQAAAAAAAAAE////+wAAAAA=",
1391 InnerOperationResult::CreatePassiveSellOffer(ManageSellOfferResult::BuyNotAuthorized)
1392 );
1393
1394 impl_inner_op_result_test!(
1395 test_create_passive_sell_offer_line_full,
1396 "AAAAAACYloD/////AAAAAQAAAAAAAAAE////+gAAAAA=",
1397 InnerOperationResult::CreatePassiveSellOffer(ManageSellOfferResult::LineFull)
1398 );
1399
1400 impl_inner_op_result_test!(
1401 test_create_passive_sell_offer_underfunded,
1402 "AAAAAACYloD/////AAAAAQAAAAAAAAAE////+QAAAAA=",
1403 InnerOperationResult::CreatePassiveSellOffer(ManageSellOfferResult::Underfunded)
1404 );
1405
1406 impl_inner_op_result_test!(
1407 test_create_passive_sell_offer_cross_self,
1408 "AAAAAACYloD/////AAAAAQAAAAAAAAAE////+AAAAAA=",
1409 InnerOperationResult::CreatePassiveSellOffer(ManageSellOfferResult::CrossSelf)
1410 );
1411
1412 impl_inner_op_result_test!(
1413 test_create_passive_sell_offer_sell_no_issuer,
1414 "AAAAAACYloD/////AAAAAQAAAAAAAAAE////9wAAAAA=",
1415 InnerOperationResult::CreatePassiveSellOffer(ManageSellOfferResult::SellNoIssuer)
1416 );
1417
1418 impl_inner_op_result_test!(
1419 test_create_passive_sell_offer_buy_no_issuer,
1420 "AAAAAACYloD/////AAAAAQAAAAAAAAAE////9gAAAAA=",
1421 InnerOperationResult::CreatePassiveSellOffer(ManageSellOfferResult::BuyNoIssuer)
1422 );
1423
1424 impl_inner_op_result_test!(
1425 test_create_passive_sell_offer_not_found,
1426 "AAAAAACYloD/////AAAAAQAAAAAAAAAE////9QAAAAA=",
1427 InnerOperationResult::CreatePassiveSellOffer(ManageSellOfferResult::NotFound)
1428 );
1429
1430 impl_inner_op_result_test!(
1431 test_create_passive_sell_offer_low_reserve,
1432 "AAAAAACYloD/////AAAAAQAAAAAAAAAE////9AAAAAA=",
1433 InnerOperationResult::CreatePassiveSellOffer(ManageSellOfferResult::LowReserve)
1434 );
1435
1436 impl_inner_op_result_test!(
1441 test_set_options_success,
1442 "AAAAAACYloD/////AAAAAQAAAAAAAAAFAAAAAAAAAAA=",
1443 InnerOperationResult::SetOptions(SetOptionsResult::Success)
1444 );
1445
1446 impl_inner_op_result_test!(
1447 test_set_options_low_reserve,
1448 "AAAAAACYloD/////AAAAAQAAAAAAAAAF/////wAAAAA=",
1449 InnerOperationResult::SetOptions(SetOptionsResult::LowReserve)
1450 );
1451
1452 impl_inner_op_result_test!(
1453 test_set_options_too_many_signers,
1454 "AAAAAACYloD/////AAAAAQAAAAAAAAAF/////gAAAAA=",
1455 InnerOperationResult::SetOptions(SetOptionsResult::TooManySigners)
1456 );
1457
1458 impl_inner_op_result_test!(
1459 test_set_options_bad_flags,
1460 "AAAAAACYloD/////AAAAAQAAAAAAAAAF/////QAAAAA=",
1461 InnerOperationResult::SetOptions(SetOptionsResult::BadFlags)
1462 );
1463
1464 impl_inner_op_result_test!(
1465 test_set_options_invalid_inflation,
1466 "AAAAAACYloD/////AAAAAQAAAAAAAAAF/////AAAAAA=",
1467 InnerOperationResult::SetOptions(SetOptionsResult::InvalidInflation)
1468 );
1469
1470 impl_inner_op_result_test!(
1471 test_set_options_cant_change,
1472 "AAAAAACYloD/////AAAAAQAAAAAAAAAF////+wAAAAA=",
1473 InnerOperationResult::SetOptions(SetOptionsResult::CantChange)
1474 );
1475
1476 impl_inner_op_result_test!(
1477 test_set_options_unknown_flag,
1478 "AAAAAACYloD/////AAAAAQAAAAAAAAAF////+gAAAAA=",
1479 InnerOperationResult::SetOptions(SetOptionsResult::UnknownFlag)
1480 );
1481
1482 impl_inner_op_result_test!(
1483 test_set_options_threshold_out_of_range,
1484 "AAAAAACYloD/////AAAAAQAAAAAAAAAF////+QAAAAA=",
1485 InnerOperationResult::SetOptions(SetOptionsResult::ThresholdOutOfRange)
1486 );
1487
1488 impl_inner_op_result_test!(
1489 test_set_options_bad_signer,
1490 "AAAAAACYloD/////AAAAAQAAAAAAAAAF////+AAAAAA=",
1491 InnerOperationResult::SetOptions(SetOptionsResult::BadSigner)
1492 );
1493
1494 impl_inner_op_result_test!(
1495 test_set_options_invalid_home_domain,
1496 "AAAAAACYloD/////AAAAAQAAAAAAAAAF////9wAAAAA=",
1497 InnerOperationResult::SetOptions(SetOptionsResult::InvalidHomeDomain)
1498 );
1499
1500 impl_inner_op_result_test!(
1505 test_change_trust_success,
1506 "AAAAAACYloD/////AAAAAQAAAAAAAAAGAAAAAAAAAAA=",
1507 InnerOperationResult::ChangeTrust(ChangeTrustResult::Success)
1508 );
1509
1510 impl_inner_op_result_test!(
1511 test_change_trust_malformed,
1512 "AAAAAACYloD/////AAAAAQAAAAAAAAAG/////wAAAAA=",
1513 InnerOperationResult::ChangeTrust(ChangeTrustResult::Malformed)
1514 );
1515
1516 impl_inner_op_result_test!(
1517 test_change_trust_no_issuer,
1518 "AAAAAACYloD/////AAAAAQAAAAAAAAAG/////gAAAAA=",
1519 InnerOperationResult::ChangeTrust(ChangeTrustResult::NoIssuer)
1520 );
1521
1522 impl_inner_op_result_test!(
1523 test_change_trust_invalid_limit,
1524 "AAAAAACYloD/////AAAAAQAAAAAAAAAG/////QAAAAA=",
1525 InnerOperationResult::ChangeTrust(ChangeTrustResult::InvalidLimit)
1526 );
1527
1528 impl_inner_op_result_test!(
1529 test_change_trust_low_reserve,
1530 "AAAAAACYloD/////AAAAAQAAAAAAAAAG/////AAAAAA=",
1531 InnerOperationResult::ChangeTrust(ChangeTrustResult::LowReserve)
1532 );
1533
1534 impl_inner_op_result_test!(
1535 test_change_trust_self_not_allowed,
1536 "AAAAAACYloD/////AAAAAQAAAAAAAAAG////+wAAAAA=",
1537 InnerOperationResult::ChangeTrust(ChangeTrustResult::SelfNotAllowed)
1538 );
1539
1540 impl_inner_op_result_test!(
1545 test_allow_trust_success,
1546 "AAAAAACYloD/////AAAAAQAAAAAAAAAHAAAAAAAAAAA=",
1547 InnerOperationResult::AllowTrust(AllowTrustResult::Success)
1548 );
1549
1550 impl_inner_op_result_test!(
1551 test_allow_trust_malformed,
1552 "AAAAAACYloD/////AAAAAQAAAAAAAAAH/////wAAAAA=",
1553 InnerOperationResult::AllowTrust(AllowTrustResult::Malformed)
1554 );
1555
1556 impl_inner_op_result_test!(
1557 test_allow_trust_no_trustline,
1558 "AAAAAACYloD/////AAAAAQAAAAAAAAAH/////gAAAAA=",
1559 InnerOperationResult::AllowTrust(AllowTrustResult::NoTrustLine)
1560 );
1561
1562 impl_inner_op_result_test!(
1563 test_allow_trust_trust_not_required,
1564 "AAAAAACYloD/////AAAAAQAAAAAAAAAH/////QAAAAA=",
1565 InnerOperationResult::AllowTrust(AllowTrustResult::TrustNotRequired)
1566 );
1567
1568 impl_inner_op_result_test!(
1569 test_allow_trust_cant_revoke,
1570 "AAAAAACYloD/////AAAAAQAAAAAAAAAH/////AAAAAA=",
1571 InnerOperationResult::AllowTrust(AllowTrustResult::CantRevoke)
1572 );
1573
1574 impl_inner_op_result_test!(
1575 test_allow_trust_self_not_allowed,
1576 "AAAAAACYloD/////AAAAAQAAAAAAAAAH////+wAAAAA=",
1577 InnerOperationResult::AllowTrust(AllowTrustResult::SelfNotAllowed)
1578 );
1579
1580 impl_inner_op_result_test!(
1585 test_accout_merge_success,
1586 "AAAAAACYloD/////AAAAAQAAAAAAAAAIAAAAAAAAAAAF9eEAAAAAAA==",
1587 InnerOperationResult::AccountMerge(AccountMergeResult::Success(_))
1588 );
1589
1590 impl_inner_op_result_test!(
1591 test_accout_merge_malformed,
1592 "AAAAAACYloD/////AAAAAQAAAAAAAAAI/////wAAAAA=",
1593 InnerOperationResult::AccountMerge(AccountMergeResult::Malformed)
1594 );
1595
1596 impl_inner_op_result_test!(
1597 test_accout_merge_no_account,
1598 "AAAAAACYloD/////AAAAAQAAAAAAAAAI/////gAAAAA=",
1599 InnerOperationResult::AccountMerge(AccountMergeResult::NoAccount)
1600 );
1601
1602 impl_inner_op_result_test!(
1603 test_accout_merge_immutable_set,
1604 "AAAAAACYloD/////AAAAAQAAAAAAAAAI/////QAAAAA=",
1605 InnerOperationResult::AccountMerge(AccountMergeResult::ImmutableSet)
1606 );
1607
1608 impl_inner_op_result_test!(
1609 test_accout_merge_has_sub_entries,
1610 "AAAAAACYloD/////AAAAAQAAAAAAAAAI/////AAAAAA=",
1611 InnerOperationResult::AccountMerge(AccountMergeResult::HasSubEntries)
1612 );
1613
1614 impl_inner_op_result_test!(
1615 test_accout_merge_sequence_too_far,
1616 "AAAAAACYloD/////AAAAAQAAAAAAAAAI////+wAAAAA=",
1617 InnerOperationResult::AccountMerge(AccountMergeResult::SequenceTooFar)
1618 );
1619
1620 impl_inner_op_result_test!(
1621 test_accout_merge_destination_full,
1622 "AAAAAACYloD/////AAAAAQAAAAAAAAAI////+gAAAAA=",
1623 InnerOperationResult::AccountMerge(AccountMergeResult::DestinationFull)
1624 );
1625
1626 impl_inner_op_result_test!(
1627 test_accout_merge_is_sponsor,
1628 "AAAAAACYloD/////AAAAAQAAAAAAAAAI////+QAAAAA=",
1629 InnerOperationResult::AccountMerge(AccountMergeResult::IsSponsor)
1630 );
1631
1632 impl_inner_op_result_test!(
1637 test_inflation_success,
1638 "AAAAAACYloD/////AAAAAQAAAAAAAAAJAAAAAAAAAAIAAAAAKoNGsl81xj8D8XyekzKZXRuSU2KImhHkQj4QWhroY64AAAAAAJiWgAAAAAADLNchwR3S8r1eVV+aPJAT1CkmM4vNhQ3mitHQ34PP5AAAAAABMS0AAAAAAA==",
1639 InnerOperationResult::Inflation(InflationResult::Success(_))
1640 );
1641
1642 impl_inner_op_result_test!(
1643 test_inflation_no_time,
1644 "AAAAAACYloD/////AAAAAQAAAAAAAAAJ/////wAAAAA=",
1645 InnerOperationResult::Inflation(InflationResult::NotTime)
1646 );
1647
1648 impl_inner_op_result_test!(
1653 test_manage_data_success,
1654 "AAAAAACYloD/////AAAAAQAAAAAAAAAKAAAAAAAAAAA=",
1655 InnerOperationResult::ManageData(ManageDataResult::Success)
1656 );
1657
1658 impl_inner_op_result_test!(
1659 test_manage_data_not_supported_yet,
1660 "AAAAAACYloD/////AAAAAQAAAAAAAAAK/////wAAAAA=",
1661 InnerOperationResult::ManageData(ManageDataResult::NotSupportedYet)
1662 );
1663
1664 impl_inner_op_result_test!(
1665 test_manage_data_name_not_found,
1666 "AAAAAACYloD/////AAAAAQAAAAAAAAAK/////gAAAAA=",
1667 InnerOperationResult::ManageData(ManageDataResult::NameNotFound)
1668 );
1669
1670 impl_inner_op_result_test!(
1671 test_manage_data_low_reserve,
1672 "AAAAAACYloD/////AAAAAQAAAAAAAAAK/////QAAAAA=",
1673 InnerOperationResult::ManageData(ManageDataResult::LowReserve)
1674 );
1675
1676 impl_inner_op_result_test!(
1677 test_manage_data_invalid_name,
1678 "AAAAAACYloD/////AAAAAQAAAAAAAAAK/////AAAAAA=",
1679 InnerOperationResult::ManageData(ManageDataResult::InvalidName)
1680 );
1681
1682 impl_inner_op_result_test!(
1687 test_bump_sequence_success,
1688 "AAAAAACYloD/////AAAAAQAAAAAAAAALAAAAAAAAAAA=",
1689 InnerOperationResult::BumpSequence(BumpSequenceResult::Success)
1690 );
1691
1692 impl_inner_op_result_test!(
1693 test_bump_sequence_bad_sequence,
1694 "AAAAAACYloD/////AAAAAQAAAAAAAAAL/////wAAAAA=",
1695 InnerOperationResult::BumpSequence(BumpSequenceResult::BadSeq)
1696 );
1697
1698 impl_inner_op_result_test!(
1703 test_create_claimable_balance_success,
1704 "AAAAAAAAA+j/////AAAAAQAAAAAAAAAOAAAAAAAAAAAHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwAAAAA=",
1705 InnerOperationResult::CreateClaimableBalance(CreateClaimableBalanceResult::Success(_))
1706 );
1707
1708 impl_inner_op_result_test!(
1709 test_create_claimable_balance_malformed,
1710 "AAAAAAAAA+j/////AAAAAQAAAAAAAAAO/////wAAAAA=",
1711 InnerOperationResult::CreateClaimableBalance(CreateClaimableBalanceResult::Malformed)
1712 );
1713
1714 impl_inner_op_result_test!(
1715 test_create_claimable_balance_low_reserve,
1716 "AAAAAAAAA+j/////AAAAAQAAAAAAAAAO/////gAAAAA=",
1717 InnerOperationResult::CreateClaimableBalance(CreateClaimableBalanceResult::LowReserve)
1718 );
1719
1720 impl_inner_op_result_test!(
1721 test_create_claimable_balance_no_trust,
1722 "AAAAAAAAA+j/////AAAAAQAAAAAAAAAO/////QAAAAA=",
1723 InnerOperationResult::CreateClaimableBalance(CreateClaimableBalanceResult::NoTrust)
1724 );
1725
1726 impl_inner_op_result_test!(
1727 test_create_claimable_balance_not_authorized,
1728 "AAAAAAAAA+j/////AAAAAQAAAAAAAAAO/////AAAAAA=",
1729 InnerOperationResult::CreateClaimableBalance(CreateClaimableBalanceResult::NotAuthorized)
1730 );
1731
1732 impl_inner_op_result_test!(
1733 test_create_claimable_balance_underfunded,
1734 "AAAAAAAAA+j/////AAAAAQAAAAAAAAAO////+wAAAAA=",
1735 InnerOperationResult::CreateClaimableBalance(CreateClaimableBalanceResult::Underfunded)
1736 );
1737
1738 impl_inner_op_result_test!(
1743 test_begin_sponsoring_future_reserves_success,
1744 "AAAAAAAAA+j/////AAAAAQAAAAAAAAAQAAAAAAAAAAA=",
1745 InnerOperationResult::BeginSponsoringFutureReserves(
1746 BeginSponsoringFutureReservesResult::Success
1747 )
1748 );
1749
1750 impl_inner_op_result_test!(
1751 test_begin_sponsoring_future_reserves_malformed,
1752 "AAAAAAAAA+j/////AAAAAQAAAAAAAAAQ/////wAAAAA=",
1753 InnerOperationResult::BeginSponsoringFutureReserves(
1754 BeginSponsoringFutureReservesResult::Malformed
1755 )
1756 );
1757
1758 impl_inner_op_result_test!(
1759 test_begin_sponsoring_future_reserves_already_sponsored,
1760 "AAAAAAAAA+j/////AAAAAQAAAAAAAAAQ/////gAAAAA=",
1761 InnerOperationResult::BeginSponsoringFutureReserves(
1762 BeginSponsoringFutureReservesResult::AlreadySponsored
1763 )
1764 );
1765
1766 impl_inner_op_result_test!(
1767 test_begin_sponsoring_future_reserves_recursive,
1768 "AAAAAAAAA+j/////AAAAAQAAAAAAAAAQ/////QAAAAA=",
1769 InnerOperationResult::BeginSponsoringFutureReserves(
1770 BeginSponsoringFutureReservesResult::Recursive
1771 )
1772 );
1773
1774 impl_inner_op_result_test!(
1779 test_end_sponsoring_future_reserves_success,
1780 "AAAAAAAAA+j/////AAAAAQAAAAAAAAARAAAAAAAAAAA=",
1781 InnerOperationResult::EndSponsoringFutureReserves(
1782 EndSponsoringFutureReservesResult::Success
1783 )
1784 );
1785
1786 impl_inner_op_result_test!(
1787 test_end_sponsoring_future_reserves_not_sponsored,
1788 "AAAAAAAAA+j/////AAAAAQAAAAAAAAAR/////wAAAAA=",
1789 InnerOperationResult::EndSponsoringFutureReserves(
1790 EndSponsoringFutureReservesResult::NotSponsored
1791 )
1792 );
1793
1794 impl_inner_op_result_test!(
1799 test_revoke_sponsorship_success,
1800 "AAAAAAAAA+j/////AAAAAQAAAAAAAAASAAAAAAAAAAA=",
1801 InnerOperationResult::RevokeSponsorship(RevokeSponsorshipResult::Success)
1802 );
1803
1804 impl_inner_op_result_test!(
1805 test_revoke_sponsorship_does_not_exist,
1806 "AAAAAAAAA+j/////AAAAAQAAAAAAAAAS/////wAAAAA=",
1807 InnerOperationResult::RevokeSponsorship(RevokeSponsorshipResult::DoesNotExist)
1808 );
1809
1810 impl_inner_op_result_test!(
1811 test_revoke_sponsorship_not_sponsor,
1812 "AAAAAAAAA+j/////AAAAAQAAAAAAAAAS/////gAAAAA=",
1813 InnerOperationResult::RevokeSponsorship(RevokeSponsorshipResult::NotSponsor)
1814 );
1815
1816 impl_inner_op_result_test!(
1817 test_revoke_sponsorship_low_reserve,
1818 "AAAAAAAAA+j/////AAAAAQAAAAAAAAAS/////QAAAAA=",
1819 InnerOperationResult::RevokeSponsorship(RevokeSponsorshipResult::LowReserve)
1820 );
1821
1822 impl_inner_op_result_test!(
1823 test_revoke_sponsorship_only_transferable,
1824 "AAAAAAAAA+j/////AAAAAQAAAAAAAAAS/////AAAAAA=",
1825 InnerOperationResult::RevokeSponsorship(RevokeSponsorshipResult::OnlyTransferable)
1826 );
1827}