From 9aa53b6f4b1754efa3faf8261fd7db945332eb46 Mon Sep 17 00:00:00 2001 From: George Kudrayvtsev Date: Thu, 28 Apr 2022 00:30:25 -0700 Subject: [PATCH] General linting, plus new txMALFORMED error code --- gxdr/xdr_generated.go | 23 ++++--- xdr/Stellar-ledger-entries.x | 10 +-- xdr/Stellar-transaction.x | 82 ++++++++++++----------- xdr/Stellar-types.x | 8 ++- xdr/xdr_generated.go | 122 +++++++++++++++++++++-------------- 5 files changed, 144 insertions(+), 101 deletions(-) diff --git a/gxdr/xdr_generated.go b/gxdr/xdr_generated.go index ff20939b27..2c8d430dc4 100644 --- a/gxdr/xdr_generated.go +++ b/gxdr/xdr_generated.go @@ -419,7 +419,8 @@ type XdrAnon_TrustLineEntry_Ext_V1_Ext struct { type OfferEntryFlags int32 const ( - // an offer with this flag will not act on and take a reverse offer of equal price + // an offer with this flag will not act on and take a reverse offer of equal + // price PASSIVE_FLAG OfferEntryFlags = 1 ) @@ -618,7 +619,7 @@ type XdrAnon_LiquidityPoolEntry_Body_ConstantProduct struct { ReserveB Int64 // total number of pool shares issued TotalPoolShares Int64 - // number of trust lines for the associated pool shares + // number of trust lines for the PoolSharesTrustLineCount Int64 } @@ -2919,8 +2920,10 @@ const ( TxFEE_BUMP_INNER_FAILED TransactionResultCode = -13 // sponsorship not confirmed TxBAD_SPONSORSHIP TransactionResultCode = -14 - //minSeqAge or minSeqLedgerGap conditions not met + // minSeqAge or minSeqLedgerGap conditions not met TxBAD_MIN_SEQ_AGE_OR_GAP TransactionResultCode = -15 + // precondition is invalid + TxMALFORMED TransactionResultCode = -16 ) // InnerTransactionResult must be binary compatible with TransactionResult @@ -2935,7 +2938,7 @@ type XdrAnon_InnerTransactionResult_Result struct { // The union discriminant Code selects among the following arms: // TxSUCCESS, TxFAILED: // Results() *[]OperationResult - // TxTOO_EARLY, TxTOO_LATE, TxMISSING_OPERATION, TxBAD_SEQ, TxBAD_AUTH, TxINSUFFICIENT_BALANCE, TxNO_ACCOUNT, TxINSUFFICIENT_FEE, TxBAD_AUTH_EXTRA, TxINTERNAL_ERROR, TxNOT_SUPPORTED, TxBAD_SPONSORSHIP, TxBAD_MIN_SEQ_AGE_OR_GAP: + // TxTOO_EARLY, TxTOO_LATE, TxMISSING_OPERATION, TxBAD_SEQ, TxBAD_AUTH, TxINSUFFICIENT_BALANCE, TxNO_ACCOUNT, TxINSUFFICIENT_FEE, TxBAD_AUTH_EXTRA, TxINTERNAL_ERROR, TxNOT_SUPPORTED, TxBAD_SPONSORSHIP, TxBAD_MIN_SEQ_AGE_OR_GAP, TxMALFORMED: // void Code TransactionResultCode _u interface{} @@ -18400,6 +18403,7 @@ var _XdrNames_TransactionResultCode = map[int32]string{ int32(TxFEE_BUMP_INNER_FAILED): "txFEE_BUMP_INNER_FAILED", int32(TxBAD_SPONSORSHIP): "txBAD_SPONSORSHIP", int32(TxBAD_MIN_SEQ_AGE_OR_GAP): "txBAD_MIN_SEQ_AGE_OR_GAP", + int32(TxMALFORMED): "txMALFORMED", } var _XdrValues_TransactionResultCode = map[string]int32{ "txFEE_BUMP_INNER_SUCCESS": int32(TxFEE_BUMP_INNER_SUCCESS), @@ -18419,6 +18423,7 @@ var _XdrValues_TransactionResultCode = map[string]int32{ "txFEE_BUMP_INNER_FAILED": int32(TxFEE_BUMP_INNER_FAILED), "txBAD_SPONSORSHIP": int32(TxBAD_SPONSORSHIP), "txBAD_MIN_SEQ_AGE_OR_GAP": int32(TxBAD_MIN_SEQ_AGE_OR_GAP), + "txMALFORMED": int32(TxMALFORMED), } func (TransactionResultCode) XdrEnumNames() map[int32]string { @@ -18475,6 +18480,7 @@ var _XdrComments_TransactionResultCode = map[int32]string{ int32(TxFEE_BUMP_INNER_FAILED): "fee bump inner transaction failed", int32(TxBAD_SPONSORSHIP): "sponsorship not confirmed", int32(TxBAD_MIN_SEQ_AGE_OR_GAP): "minSeqAge or minSeqLedgerGap conditions not met", + int32(TxMALFORMED): "precondition is invalid", } func (e TransactionResultCode) XdrEnumComments() map[int32]string { @@ -18554,6 +18560,7 @@ var _XdrTags_XdrAnon_InnerTransactionResult_Result = map[int32]bool{ XdrToI32(TxNOT_SUPPORTED): true, XdrToI32(TxBAD_SPONSORSHIP): true, XdrToI32(TxBAD_MIN_SEQ_AGE_OR_GAP): true, + XdrToI32(TxMALFORMED): true, } func (_ XdrAnon_InnerTransactionResult_Result) XdrValidTags() map[int32]bool { @@ -18576,7 +18583,7 @@ func (u *XdrAnon_InnerTransactionResult_Result) Results() *[]OperationResult { } func (u XdrAnon_InnerTransactionResult_Result) XdrValid() bool { switch u.Code { - case TxSUCCESS, TxFAILED, TxTOO_EARLY, TxTOO_LATE, TxMISSING_OPERATION, TxBAD_SEQ, TxBAD_AUTH, TxINSUFFICIENT_BALANCE, TxNO_ACCOUNT, TxINSUFFICIENT_FEE, TxBAD_AUTH_EXTRA, TxINTERNAL_ERROR, TxNOT_SUPPORTED, TxBAD_SPONSORSHIP, TxBAD_MIN_SEQ_AGE_OR_GAP: + case TxSUCCESS, TxFAILED, TxTOO_EARLY, TxTOO_LATE, TxMISSING_OPERATION, TxBAD_SEQ, TxBAD_AUTH, TxINSUFFICIENT_BALANCE, TxNO_ACCOUNT, TxINSUFFICIENT_FEE, TxBAD_AUTH_EXTRA, TxINTERNAL_ERROR, TxNOT_SUPPORTED, TxBAD_SPONSORSHIP, TxBAD_MIN_SEQ_AGE_OR_GAP, TxMALFORMED: return true } return false @@ -18591,7 +18598,7 @@ func (u *XdrAnon_InnerTransactionResult_Result) XdrUnionBody() XdrType { switch u.Code { case TxSUCCESS, TxFAILED: return (*_XdrVec_unbounded_OperationResult)(u.Results()) - case TxTOO_EARLY, TxTOO_LATE, TxMISSING_OPERATION, TxBAD_SEQ, TxBAD_AUTH, TxINSUFFICIENT_BALANCE, TxNO_ACCOUNT, TxINSUFFICIENT_FEE, TxBAD_AUTH_EXTRA, TxINTERNAL_ERROR, TxNOT_SUPPORTED, TxBAD_SPONSORSHIP, TxBAD_MIN_SEQ_AGE_OR_GAP: + case TxTOO_EARLY, TxTOO_LATE, TxMISSING_OPERATION, TxBAD_SEQ, TxBAD_AUTH, TxINSUFFICIENT_BALANCE, TxNO_ACCOUNT, TxINSUFFICIENT_FEE, TxBAD_AUTH_EXTRA, TxINTERNAL_ERROR, TxNOT_SUPPORTED, TxBAD_SPONSORSHIP, TxBAD_MIN_SEQ_AGE_OR_GAP, TxMALFORMED: return nil } return nil @@ -18600,7 +18607,7 @@ func (u *XdrAnon_InnerTransactionResult_Result) XdrUnionBodyName() string { switch u.Code { case TxSUCCESS, TxFAILED: return "Results" - case TxTOO_EARLY, TxTOO_LATE, TxMISSING_OPERATION, TxBAD_SEQ, TxBAD_AUTH, TxINSUFFICIENT_BALANCE, TxNO_ACCOUNT, TxINSUFFICIENT_FEE, TxBAD_AUTH_EXTRA, TxINTERNAL_ERROR, TxNOT_SUPPORTED, TxBAD_SPONSORSHIP, TxBAD_MIN_SEQ_AGE_OR_GAP: + case TxTOO_EARLY, TxTOO_LATE, TxMISSING_OPERATION, TxBAD_SEQ, TxBAD_AUTH, TxINSUFFICIENT_BALANCE, TxNO_ACCOUNT, TxINSUFFICIENT_FEE, TxBAD_AUTH_EXTRA, TxINTERNAL_ERROR, TxNOT_SUPPORTED, TxBAD_SPONSORSHIP, TxBAD_MIN_SEQ_AGE_OR_GAP, TxMALFORMED: return "" } return "" @@ -18623,7 +18630,7 @@ func (u *XdrAnon_InnerTransactionResult_Result) XdrRecurse(x XDR, name string) { case TxSUCCESS, TxFAILED: x.Marshal(x.Sprintf("%sresults", name), (*_XdrVec_unbounded_OperationResult)(u.Results())) return - case TxTOO_EARLY, TxTOO_LATE, TxMISSING_OPERATION, TxBAD_SEQ, TxBAD_AUTH, TxINSUFFICIENT_BALANCE, TxNO_ACCOUNT, TxINSUFFICIENT_FEE, TxBAD_AUTH_EXTRA, TxINTERNAL_ERROR, TxNOT_SUPPORTED, TxBAD_SPONSORSHIP, TxBAD_MIN_SEQ_AGE_OR_GAP: + case TxTOO_EARLY, TxTOO_LATE, TxMISSING_OPERATION, TxBAD_SEQ, TxBAD_AUTH, TxINSUFFICIENT_BALANCE, TxNO_ACCOUNT, TxINSUFFICIENT_FEE, TxBAD_AUTH_EXTRA, TxINTERNAL_ERROR, TxNOT_SUPPORTED, TxBAD_SPONSORSHIP, TxBAD_MIN_SEQ_AGE_OR_GAP, TxMALFORMED: return } XdrPanic("invalid Code (%v) in XdrAnon_InnerTransactionResult_Result", u.Code) diff --git a/xdr/Stellar-ledger-entries.x b/xdr/Stellar-ledger-entries.x index e0f719d0f1..3eb578f16b 100644 --- a/xdr/Stellar-ledger-entries.x +++ b/xdr/Stellar-ledger-entries.x @@ -306,7 +306,8 @@ struct TrustLineEntry enum OfferEntryFlags { - // an offer with this flag will not act on and take a reverse offer of equal price + // an offer with this flag will not act on and take a reverse offer of equal + // price PASSIVE_FLAG = 1 }; @@ -387,7 +388,7 @@ case CLAIM_PREDICATE_BEFORE_ABSOLUTE_TIME: int64 absBefore; // Predicate will be true if closeTime < absBefore case CLAIM_PREDICATE_BEFORE_RELATIVE_TIME: int64 relBefore; // Seconds since closeTime of the ledger in which the - // ClaimableBalanceEntry was created + // ClaimableBalanceEntry was created }; enum ClaimantType @@ -466,7 +467,7 @@ struct LiquidityPoolConstantProductParameters { Asset assetA; // assetA < assetB Asset assetB; - int32 fee; // Fee is in basis points, so the actual rate is (fee/100)% + int32 fee; // Fee is in basis points, so the actual rate is (fee/100)% }; struct LiquidityPoolEntry @@ -483,7 +484,8 @@ struct LiquidityPoolEntry int64 reserveA; // amount of A in the pool int64 reserveB; // amount of B in the pool int64 totalPoolShares; // total number of pool shares issued - int64 poolSharesTrustLineCount; // number of trust lines for the associated pool shares + int64 poolSharesTrustLineCount; // number of trust lines for the + // associated pool shares } constantProduct; } body; diff --git a/xdr/Stellar-transaction.x b/xdr/Stellar-transaction.x index a9fdbe69f1..f2f593c213 100644 --- a/xdr/Stellar-transaction.x +++ b/xdr/Stellar-transaction.x @@ -445,10 +445,10 @@ const LIQUIDITY_POOL_FEE_V18 = 30; struct LiquidityPoolDepositOp { PoolID liquidityPoolID; - int64 maxAmountA; // maximum amount of first asset to deposit - int64 maxAmountB; // maximum amount of second asset to deposit - Price minPrice; // minimum depositA/depositB - Price maxPrice; // maximum depositA/depositB + int64 maxAmountA; // maximum amount of first asset to deposit + int64 maxAmountB; // maximum amount of second asset to deposit + Price minPrice; // minimum depositA/depositB + Price maxPrice; // maximum depositA/depositB }; /* Withdraw assets from a liquidity pool @@ -460,9 +460,9 @@ struct LiquidityPoolDepositOp struct LiquidityPoolWithdrawOp { PoolID liquidityPoolID; - int64 amount; // amount of pool shares to withdraw - int64 minAmountA; // minimum amount of first asset to withdraw - int64 minAmountB; // minimum amount of second asset to withdraw + int64 amount; // amount of pool shares to withdraw + int64 minAmountA; // minimum amount of first asset to withdraw + int64 minAmountB; // minimum amount of second asset to withdraw }; /* An operation is the lowest unit of work that a transaction does */ @@ -582,13 +582,14 @@ struct LedgerBounds uint32 maxLedger; // 0 here means no maxLedger }; -struct PreconditionsV2 { - TimeBounds *timeBounds; +struct PreconditionsV2 +{ + TimeBounds* timeBounds; // Transaction only valid for ledger numbers n such that // minLedger <= n < maxLedger (if maxLedger == 0, then // only minLedger is checked) - LedgerBounds *ledgerBounds; + LedgerBounds* ledgerBounds; // If NULL, only valid when sourceAccount's sequence number // is seqNum - 1. Otherwise, valid when sourceAccount's @@ -596,7 +597,7 @@ struct PreconditionsV2 { // Note that after execution the account's sequence number // is always raised to tx.seqNum, and a transaction is not // valid if tx.seqNum is too high to ensure replay protection. - SequenceNumber *minSeqNum; + SequenceNumber* minSeqNum; // For the transaction to be valid, the current ledger time must // be at least minSeqAge greater than sourceAccount's seqTime. @@ -614,19 +615,21 @@ struct PreconditionsV2 { SignerKey extraSigners<2>; }; -enum PreconditionType { +enum PreconditionType +{ PRECOND_NONE = 0, PRECOND_TIME = 1, PRECOND_V2 = 2 }; -union Preconditions switch (PreconditionType type) { - case PRECOND_NONE: - void; - case PRECOND_TIME: - TimeBounds timeBounds; - case PRECOND_V2: - PreconditionsV2 v2; +union Preconditions switch (PreconditionType type) +{ +case PRECOND_NONE: + void; +case PRECOND_TIME: + TimeBounds timeBounds; +case PRECOND_V2: + PreconditionsV2 v2; }; // maximum number of operations per transaction @@ -1107,10 +1110,12 @@ enum ChangeTrustResultCode // cannot create with a limit of 0 CHANGE_TRUST_LOW_RESERVE = -4, // not enough funds to create a new trust line, - CHANGE_TRUST_SELF_NOT_ALLOWED = -5, // trusting self is not allowed + CHANGE_TRUST_SELF_NOT_ALLOWED = -5, // trusting self is not allowed CHANGE_TRUST_TRUST_LINE_MISSING = -6, // Asset trustline is missing for pool - CHANGE_TRUST_CANNOT_DELETE = -7, // Asset trustline is still referenced in a pool - CHANGE_TRUST_NOT_AUTH_MAINTAIN_LIABILITIES = -8 // Asset trustline is deauthorized + CHANGE_TRUST_CANNOT_DELETE = + -7, // Asset trustline is still referenced in a pool + CHANGE_TRUST_NOT_AUTH_MAINTAIN_LIABILITIES = + -8 // Asset trustline is deauthorized }; union ChangeTrustResult switch (ChangeTrustResultCode code) @@ -1132,10 +1137,10 @@ enum AllowTrustResultCode ALLOW_TRUST_NO_TRUST_LINE = -2, // trustor does not have a trustline // source account does not require trust ALLOW_TRUST_TRUST_NOT_REQUIRED = -3, - ALLOW_TRUST_CANT_REVOKE = -4, // source account can't revoke trust, + ALLOW_TRUST_CANT_REVOKE = -4, // source account can't revoke trust, ALLOW_TRUST_SELF_NOT_ALLOWED = -5, // trusting self is not allowed - ALLOW_TRUST_LOW_RESERVE = -6 // claimable balances can't be created - // on revoke due to low reserves + ALLOW_TRUST_LOW_RESERVE = -6 // claimable balances can't be created + // on revoke due to low reserves }; union AllowTrustResult switch (AllowTrustResultCode code) @@ -1432,8 +1437,7 @@ enum LiquidityPoolDepositResultCode LIQUIDITY_POOL_DEPOSIT_POOL_FULL = -7 // pool reserves are full }; -union LiquidityPoolDepositResult switch ( - LiquidityPoolDepositResultCode code) +union LiquidityPoolDepositResult switch (LiquidityPoolDepositResultCode code) { case LIQUIDITY_POOL_DEPOSIT_SUCCESS: void; @@ -1449,18 +1453,17 @@ enum LiquidityPoolWithdrawResultCode LIQUIDITY_POOL_WITHDRAW_SUCCESS = 0, // codes considered as "failure" for the operation - LIQUIDITY_POOL_WITHDRAW_MALFORMED = -1, // bad input - LIQUIDITY_POOL_WITHDRAW_NO_TRUST = -2, // no trust line for one of the - // assets - LIQUIDITY_POOL_WITHDRAW_UNDERFUNDED = -3, // not enough balance of the - // pool share - LIQUIDITY_POOL_WITHDRAW_LINE_FULL = -4, // would go above limit for one - // of the assets - LIQUIDITY_POOL_WITHDRAW_UNDER_MINIMUM = -5 // didn't withdraw enough + LIQUIDITY_POOL_WITHDRAW_MALFORMED = -1, // bad input + LIQUIDITY_POOL_WITHDRAW_NO_TRUST = -2, // no trust line for one of the + // assets + LIQUIDITY_POOL_WITHDRAW_UNDERFUNDED = -3, // not enough balance of the + // pool share + LIQUIDITY_POOL_WITHDRAW_LINE_FULL = -4, // would go above limit for one + // of the assets + LIQUIDITY_POOL_WITHDRAW_UNDER_MINIMUM = -5 // didn't withdraw enough }; -union LiquidityPoolWithdrawResult switch ( - LiquidityPoolWithdrawResultCode code) +union LiquidityPoolWithdrawResult switch (LiquidityPoolWithdrawResultCode code) { case LIQUIDITY_POOL_WITHDRAW_SUCCESS: void; @@ -1562,7 +1565,9 @@ enum TransactionResultCode txNOT_SUPPORTED = -12, // transaction type not supported txFEE_BUMP_INNER_FAILED = -13, // fee bump inner transaction failed txBAD_SPONSORSHIP = -14, // sponsorship not confirmed - txBAD_MIN_SEQ_AGE_OR_GAP = -15 //minSeqAge or minSeqLedgerGap conditions not met + txBAD_MIN_SEQ_AGE_OR_GAP = + -15, // minSeqAge or minSeqLedgerGap conditions not met + txMALFORMED = -16 // precondition is invalid }; // InnerTransactionResult must be binary compatible with TransactionResult @@ -1592,6 +1597,7 @@ struct InnerTransactionResult // txFEE_BUMP_INNER_FAILED is not included case txBAD_SPONSORSHIP: case txBAD_MIN_SEQ_AGE_OR_GAP: + case txMALFORMED: void; } result; diff --git a/xdr/Stellar-types.x b/xdr/Stellar-types.x index 562f8fc269..c3a1ebe2c8 100644 --- a/xdr/Stellar-types.x +++ b/xdr/Stellar-types.x @@ -17,9 +17,10 @@ typedef hyper int64; // An ExtensionPoint is always marshaled as a 32-bit 0 value. At a // later point, it can be replaced by a different union so as to // extend a structure. -union ExtensionPoint switch (int v) { +union ExtensionPoint switch (int v) +{ case 0: - void; + void; }; enum CryptoKeyType @@ -63,7 +64,8 @@ case SIGNER_KEY_TYPE_HASH_X: /* Hash of random 256 bit preimage X */ uint256 hashX; case SIGNER_KEY_TYPE_ED25519_SIGNED_PAYLOAD: - struct { + struct + { /* Public key that must sign the payload. */ uint256 ed25519; /* Payload to be raw signed by ed25519. */ diff --git a/xdr/xdr_generated.go b/xdr/xdr_generated.go index f21480c2c6..ddae1f9b30 100644 --- a/xdr/xdr_generated.go +++ b/xdr/xdr_generated.go @@ -5227,7 +5227,8 @@ var _ xdrType = (*TrustLineEntry)(nil) // // enum OfferEntryFlags // { -// // an offer with this flag will not act on and take a reverse offer of equal price +// // an offer with this flag will not act on and take a reverse offer of equal +// // price // PASSIVE_FLAG = 1 // }; // @@ -5861,7 +5862,7 @@ var _ xdrType = (*ClaimPredicateType)(nil) // int64 absBefore; // Predicate will be true if closeTime < absBefore // case CLAIM_PREDICATE_BEFORE_RELATIVE_TIME: // int64 relBefore; // Seconds since closeTime of the ledger in which the -// // ClaimableBalanceEntry was created +// // ClaimableBalanceEntry was created // }; // type ClaimPredicate struct { @@ -7313,7 +7314,7 @@ var _ xdrType = (*ClaimableBalanceEntry)(nil) // { // Asset assetA; // assetA < assetB // Asset assetB; -// int32 fee; // Fee is in basis points, so the actual rate is (fee/100)% +// int32 fee; // Fee is in basis points, so the actual rate is (fee/100)% // }; // type LiquidityPoolConstantProductParameters struct { @@ -7397,7 +7398,8 @@ var _ xdrType = (*LiquidityPoolConstantProductParameters)(nil) // int64 reserveA; // amount of A in the pool // int64 reserveB; // amount of B in the pool // int64 totalPoolShares; // total number of pool shares issued -// int64 poolSharesTrustLineCount; // number of trust lines for the associated pool shares +// int64 poolSharesTrustLineCount; // number of trust lines for the +// // associated pool shares // } // type LiquidityPoolEntryConstantProduct struct { @@ -7502,7 +7504,8 @@ var _ xdrType = (*LiquidityPoolEntryConstantProduct)(nil) // int64 reserveA; // amount of A in the pool // int64 reserveB; // amount of B in the pool // int64 totalPoolShares; // total number of pool shares issued -// int64 poolSharesTrustLineCount; // number of trust lines for the associated pool shares +// int64 poolSharesTrustLineCount; // number of trust lines for the +// // associated pool shares // } constantProduct; // } // @@ -7650,7 +7653,8 @@ var _ xdrType = (*LiquidityPoolEntryBody)(nil) // int64 reserveA; // amount of A in the pool // int64 reserveB; // amount of B in the pool // int64 totalPoolShares; // total number of pool shares issued -// int64 poolSharesTrustLineCount; // number of trust lines for the associated pool shares +// int64 poolSharesTrustLineCount; // number of trust lines for the +// // associated pool shares // } constantProduct; // } // body; @@ -20204,10 +20208,10 @@ const LiquidityPoolFeeV18 = 30 // struct LiquidityPoolDepositOp // { // PoolID liquidityPoolID; -// int64 maxAmountA; // maximum amount of first asset to deposit -// int64 maxAmountB; // maximum amount of second asset to deposit -// Price minPrice; // minimum depositA/depositB -// Price maxPrice; // maximum depositA/depositB +// int64 maxAmountA; // maximum amount of first asset to deposit +// int64 maxAmountB; // maximum amount of second asset to deposit +// Price minPrice; // minimum depositA/depositB +// Price maxPrice; // maximum depositA/depositB // }; // type LiquidityPoolDepositOp struct { @@ -20305,9 +20309,9 @@ var _ xdrType = (*LiquidityPoolDepositOp)(nil) // struct LiquidityPoolWithdrawOp // { // PoolID liquidityPoolID; -// int64 amount; // amount of pool shares to withdraw -// int64 minAmountA; // minimum amount of first asset to withdraw -// int64 minAmountB; // minimum amount of second asset to withdraw +// int64 amount; // amount of pool shares to withdraw +// int64 minAmountA; // minimum amount of first asset to withdraw +// int64 minAmountB; // minimum amount of second asset to withdraw // }; // type LiquidityPoolWithdrawOp struct { @@ -22657,13 +22661,14 @@ var _ xdrType = (*LedgerBounds)(nil) // PreconditionsV2 is an XDR Struct defines as: // -// struct PreconditionsV2 { -// TimeBounds *timeBounds; +// struct PreconditionsV2 +// { +// TimeBounds* timeBounds; // // // Transaction only valid for ledger numbers n such that // // minLedger <= n < maxLedger (if maxLedger == 0, then // // only minLedger is checked) -// LedgerBounds *ledgerBounds; +// LedgerBounds* ledgerBounds; // // // If NULL, only valid when sourceAccount's sequence number // // is seqNum - 1. Otherwise, valid when sourceAccount's @@ -22671,7 +22676,7 @@ var _ xdrType = (*LedgerBounds)(nil) // // Note that after execution the account's sequence number // // is always raised to tx.seqNum, and a transaction is not // // valid if tx.seqNum is too high to ensure replay protection. -// SequenceNumber *minSeqNum; +// SequenceNumber* minSeqNum; // // // For the transaction to be valid, the current ledger time must // // be at least minSeqAge greater than sourceAccount's seqTime. @@ -22853,7 +22858,8 @@ var _ xdrType = (*PreconditionsV2)(nil) // PreconditionType is an XDR Enum defines as: // -// enum PreconditionType { +// enum PreconditionType +// { // PRECOND_NONE = 0, // PRECOND_TIME = 1, // PRECOND_V2 = 2 @@ -22939,13 +22945,14 @@ var _ xdrType = (*PreconditionType)(nil) // Preconditions is an XDR Union defines as: // -// union Preconditions switch (PreconditionType type) { -// case PRECOND_NONE: -// void; -// case PRECOND_TIME: -// TimeBounds timeBounds; -// case PRECOND_V2: -// PreconditionsV2 v2; +// union Preconditions switch (PreconditionType type) +// { +// case PRECOND_NONE: +// void; +// case PRECOND_TIME: +// TimeBounds timeBounds; +// case PRECOND_V2: +// PreconditionsV2 v2; // }; // type Preconditions struct { @@ -27893,10 +27900,12 @@ var _ xdrType = (*SetOptionsResult)(nil) // // cannot create with a limit of 0 // CHANGE_TRUST_LOW_RESERVE = // -4, // not enough funds to create a new trust line, -// CHANGE_TRUST_SELF_NOT_ALLOWED = -5, // trusting self is not allowed +// CHANGE_TRUST_SELF_NOT_ALLOWED = -5, // trusting self is not allowed // CHANGE_TRUST_TRUST_LINE_MISSING = -6, // Asset trustline is missing for pool -// CHANGE_TRUST_CANNOT_DELETE = -7, // Asset trustline is still referenced in a pool -// CHANGE_TRUST_NOT_AUTH_MAINTAIN_LIABILITIES = -8 // Asset trustline is deauthorized +// CHANGE_TRUST_CANNOT_DELETE = +// -7, // Asset trustline is still referenced in a pool +// CHANGE_TRUST_NOT_AUTH_MAINTAIN_LIABILITIES = +// -8 // Asset trustline is deauthorized // }; // type ChangeTrustResultCode int32 @@ -28107,10 +28116,10 @@ var _ xdrType = (*ChangeTrustResult)(nil) // ALLOW_TRUST_NO_TRUST_LINE = -2, // trustor does not have a trustline // // source account does not require trust // ALLOW_TRUST_TRUST_NOT_REQUIRED = -3, -// ALLOW_TRUST_CANT_REVOKE = -4, // source account can't revoke trust, +// ALLOW_TRUST_CANT_REVOKE = -4, // source account can't revoke trust, // ALLOW_TRUST_SELF_NOT_ALLOWED = -5, // trusting self is not allowed -// ALLOW_TRUST_LOW_RESERVE = -6 // claimable balances can't be created -// // on revoke due to low reserves +// ALLOW_TRUST_LOW_RESERVE = -6 // claimable balances can't be created +// // on revoke due to low reserves // }; // type AllowTrustResultCode int32 @@ -31042,8 +31051,7 @@ var _ xdrType = (*LiquidityPoolDepositResultCode)(nil) // LiquidityPoolDepositResult is an XDR Union defines as: // -// union LiquidityPoolDepositResult switch ( -// LiquidityPoolDepositResultCode code) +// union LiquidityPoolDepositResult switch (LiquidityPoolDepositResultCode code) // { // case LIQUIDITY_POOL_DEPOSIT_SUCCESS: // void; @@ -31156,14 +31164,14 @@ var _ xdrType = (*LiquidityPoolDepositResult)(nil) // LIQUIDITY_POOL_WITHDRAW_SUCCESS = 0, // // // codes considered as "failure" for the operation -// LIQUIDITY_POOL_WITHDRAW_MALFORMED = -1, // bad input -// LIQUIDITY_POOL_WITHDRAW_NO_TRUST = -2, // no trust line for one of the -// // assets -// LIQUIDITY_POOL_WITHDRAW_UNDERFUNDED = -3, // not enough balance of the -// // pool share -// LIQUIDITY_POOL_WITHDRAW_LINE_FULL = -4, // would go above limit for one -// // of the assets -// LIQUIDITY_POOL_WITHDRAW_UNDER_MINIMUM = -5 // didn't withdraw enough +// LIQUIDITY_POOL_WITHDRAW_MALFORMED = -1, // bad input +// LIQUIDITY_POOL_WITHDRAW_NO_TRUST = -2, // no trust line for one of the +// // assets +// LIQUIDITY_POOL_WITHDRAW_UNDERFUNDED = -3, // not enough balance of the +// // pool share +// LIQUIDITY_POOL_WITHDRAW_LINE_FULL = -4, // would go above limit for one +// // of the assets +// LIQUIDITY_POOL_WITHDRAW_UNDER_MINIMUM = -5 // didn't withdraw enough // }; // type LiquidityPoolWithdrawResultCode int32 @@ -31252,8 +31260,7 @@ var _ xdrType = (*LiquidityPoolWithdrawResultCode)(nil) // LiquidityPoolWithdrawResult is an XDR Union defines as: // -// union LiquidityPoolWithdrawResult switch ( -// LiquidityPoolWithdrawResultCode code) +// union LiquidityPoolWithdrawResult switch (LiquidityPoolWithdrawResultCode code) // { // case LIQUIDITY_POOL_WITHDRAW_SUCCESS: // void; @@ -32964,7 +32971,9 @@ var _ xdrType = (*OperationResult)(nil) // txNOT_SUPPORTED = -12, // transaction type not supported // txFEE_BUMP_INNER_FAILED = -13, // fee bump inner transaction failed // txBAD_SPONSORSHIP = -14, // sponsorship not confirmed -// txBAD_MIN_SEQ_AGE_OR_GAP = -15 //minSeqAge or minSeqLedgerGap conditions not met +// txBAD_MIN_SEQ_AGE_OR_GAP = +// -15, // minSeqAge or minSeqLedgerGap conditions not met +// txMALFORMED = -16 // precondition is invalid // }; // type TransactionResultCode int32 @@ -32987,6 +32996,7 @@ const ( TransactionResultCodeTxFeeBumpInnerFailed TransactionResultCode = -13 TransactionResultCodeTxBadSponsorship TransactionResultCode = -14 TransactionResultCodeTxBadMinSeqAgeOrGap TransactionResultCode = -15 + TransactionResultCodeTxMalformed TransactionResultCode = -16 ) var transactionResultCodeMap = map[int32]string{ @@ -33007,6 +33017,7 @@ var transactionResultCodeMap = map[int32]string{ -13: "TransactionResultCodeTxFeeBumpInnerFailed", -14: "TransactionResultCodeTxBadSponsorship", -15: "TransactionResultCodeTxBadMinSeqAgeOrGap", + -16: "TransactionResultCodeTxMalformed", } // ValidEnum validates a proposed value for this enum. Implements @@ -33095,6 +33106,7 @@ var _ xdrType = (*TransactionResultCode)(nil) // // txFEE_BUMP_INNER_FAILED is not included // case txBAD_SPONSORSHIP: // case txBAD_MIN_SEQ_AGE_OR_GAP: +// case txMALFORMED: // void; // } // @@ -33143,6 +33155,8 @@ func (u InnerTransactionResultResult) ArmForSwitch(sw int32) (string, bool) { return "", true case TransactionResultCodeTxBadMinSeqAgeOrGap: return "", true + case TransactionResultCodeTxMalformed: + return "", true } return "-", false } @@ -33191,6 +33205,8 @@ func NewInnerTransactionResultResult(code TransactionResultCode, value interface // void case TransactionResultCodeTxBadMinSeqAgeOrGap: // void + case TransactionResultCodeTxMalformed: + // void } return } @@ -33286,6 +33302,9 @@ func (u InnerTransactionResultResult) EncodeTo(e *xdr.Encoder) error { case TransactionResultCodeTxBadMinSeqAgeOrGap: // Void return nil + case TransactionResultCodeTxMalformed: + // Void + return nil } return fmt.Errorf("Code (TransactionResultCode) switch value '%d' is not valid for union InnerTransactionResultResult", u.Code) } @@ -33381,6 +33400,9 @@ func (u *InnerTransactionResultResult) DecodeFrom(d *xdr.Decoder) (int, error) { case TransactionResultCodeTxBadMinSeqAgeOrGap: // Void return n, nil + case TransactionResultCodeTxMalformed: + // Void + return n, nil } return n, fmt.Errorf("union InnerTransactionResultResult has invalid Code (TransactionResultCode) switch value '%d'", u.Code) } @@ -33537,6 +33559,7 @@ var _ xdrType = (*InnerTransactionResultExt)(nil) // // txFEE_BUMP_INNER_FAILED is not included // case txBAD_SPONSORSHIP: // case txBAD_MIN_SEQ_AGE_OR_GAP: +// case txMALFORMED: // void; // } // result; @@ -34522,9 +34545,10 @@ var _ xdrType = (*Int64)(nil) // ExtensionPoint is an XDR Union defines as: // -// union ExtensionPoint switch (int v) { +// union ExtensionPoint switch (int v) +// { // case 0: -// void; +// void; // }; // type ExtensionPoint struct { @@ -35021,7 +35045,8 @@ var _ xdrType = (*PublicKey)(nil) // SignerKeyEd25519SignedPayload is an XDR NestedStruct defines as: // -// struct { +// struct +// { // /* Public key that must sign the payload. */ // uint256 ed25519; // /* Payload to be raw signed by ed25519. */ @@ -35104,7 +35129,8 @@ var _ xdrType = (*SignerKeyEd25519SignedPayload)(nil) // /* Hash of random 256 bit preimage X */ // uint256 hashX; // case SIGNER_KEY_TYPE_ED25519_SIGNED_PAYLOAD: -// struct { +// struct +// { // /* Public key that must sign the payload. */ // uint256 ed25519; // /* Payload to be raw signed by ed25519. */